LibJS+LibWeb+WebContent: Port JS::PropertyKey to UTF-16

This has quite a lot of fall out. But the majority of it is just type or
UDL substitution, where the changes just fall through to other function
calls.

By changing property key storage to UTF-16, the main affected areas are:
* NativeFunction names must now be UTF-16
* Bytecode identifiers must now be UTF-16
* Module/binding names must now be UTF-16
This commit is contained in:
Timothy Flynn 2025-08-02 19:27:29 -04:00 committed by Tim Flynn
commit 0efa98a57a
Notes: github-actions[bot] 2025-08-05 11:08:30 +00:00
131 changed files with 766 additions and 726 deletions

View file

@ -29,7 +29,7 @@ namespace JS {
GC_DEFINE_ALLOCATOR(Object);
static HashMap<GC::Ptr<Object const>, HashMap<FlyString, Object::IntrinsicAccessor>> s_intrinsics;
static HashMap<GC::Ptr<Object const>, HashMap<Utf16FlyString, Object::IntrinsicAccessor>> s_intrinsics;
// 10.1.12 OrdinaryObjectCreate ( proto [ , additionalInternalSlotsList ] ), https://tc39.es/ecma262/#sec-ordinaryobjectcreate
GC::Ref<Object> Object::create(Realm& realm, Object* prototype)
@ -1407,7 +1407,7 @@ Optional<Completion> Object::enumerate_object_properties(Function<Optional<Compl
// * Enumerating the properties of the target object includes enumerating properties of its prototype, and the prototype of the prototype, and so on, recursively.
// * A property of a prototype is not processed if it has the same name as a property that has already been processed.
HashTable<FlyString> visited;
HashTable<Utf16FlyString> visited;
auto const* target = this;
while (target) {
@ -1415,7 +1415,7 @@ Optional<Completion> Object::enumerate_object_properties(Function<Optional<Compl
for (auto& key : own_keys) {
if (!key.is_string())
continue;
FlyString property_key = key.as_string().utf8_string();
Utf16FlyString property_key = key.as_string().utf16_string();
if (visited.contains(property_key))
continue;
auto descriptor = TRY(target->internal_get_own_property(property_key));