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
parent cd276235d7
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

@ -20,7 +20,7 @@ ModuleEnvironment::ModuleEnvironment(Environment* outer_environment)
}
// 9.1.1.5.1 GetBindingValue ( N, S ), https://tc39.es/ecma262/#sec-module-environment-records-getbindingvalue-n-s
ThrowCompletionOr<Value> ModuleEnvironment::get_binding_value(VM& vm, FlyString const& name, bool strict)
ThrowCompletionOr<Value> ModuleEnvironment::get_binding_value(VM& vm, Utf16FlyString const& name, bool strict)
{
// 1. Assert: S is true.
VERIFY(strict);
@ -51,7 +51,7 @@ ThrowCompletionOr<Value> ModuleEnvironment::get_binding_value(VM& vm, FlyString
}
// 9.1.1.5.2 DeleteBinding ( N ), https://tc39.es/ecma262/#sec-module-environment-records-deletebinding-n
ThrowCompletionOr<bool> ModuleEnvironment::delete_binding(VM&, FlyString const&)
ThrowCompletionOr<bool> ModuleEnvironment::delete_binding(VM&, Utf16FlyString const&)
{
// The DeleteBinding concrete method of a module Environment Record is never used within this specification.
VERIFY_NOT_REACHED();
@ -65,7 +65,7 @@ ThrowCompletionOr<Value> ModuleEnvironment::get_this_binding(VM&) const
}
// 9.1.1.5.5 CreateImportBinding ( N, M, N2 ), https://tc39.es/ecma262/#sec-createimportbinding
ThrowCompletionOr<void> ModuleEnvironment::create_import_binding(FlyString name, Module* module, FlyString binding_name)
ThrowCompletionOr<void> ModuleEnvironment::create_import_binding(Utf16FlyString name, Module* module, Utf16FlyString binding_name)
{
// 1. Assert: envRec does not already have a binding for N.
VERIFY(!get_indirect_binding(name));
@ -82,7 +82,7 @@ ThrowCompletionOr<void> ModuleEnvironment::create_import_binding(FlyString name,
return {};
}
ModuleEnvironment::IndirectBinding const* ModuleEnvironment::get_indirect_binding(FlyString const& name) const
ModuleEnvironment::IndirectBinding const* ModuleEnvironment::get_indirect_binding(Utf16FlyString const& name) const
{
auto binding_or_end = m_indirect_bindings.find_if([&](IndirectBinding const& binding) {
return binding.name == name;
@ -93,7 +93,7 @@ ModuleEnvironment::IndirectBinding const* ModuleEnvironment::get_indirect_bindin
return &(*binding_or_end);
}
Optional<ModuleEnvironment::BindingAndIndex> ModuleEnvironment::find_binding_and_index(FlyString const& name) const
Optional<ModuleEnvironment::BindingAndIndex> ModuleEnvironment::find_binding_and_index(Utf16FlyString const& name) const
{
auto* indirect_binding = get_indirect_binding(name);
if (indirect_binding != nullptr) {