LibJS+LibWeb: Replace GlobalObject with Realm in initialize() functions

This is a continuation of the previous commit.

Calling initialize() is the first thing that's done after allocating a
cell on the JS heap - and in the common case of allocating an object,
that's where properties are assigned and intrinsics occasionally
accessed.
Since those are supposed to live on the realm eventually, this is
another step into that direction.
This commit is contained in:
Linus Groh 2022-08-16 00:20:49 +01:00
commit 5dd5896588
Notes: sideshowbarker 2024-07-17 08:01:21 +09:00
304 changed files with 608 additions and 603 deletions

View file

@ -22,13 +22,13 @@ StringConstructor::StringConstructor(Realm& realm)
{
}
void StringConstructor::initialize(GlobalObject& global_object)
void StringConstructor::initialize(Realm& realm)
{
auto& vm = this->vm();
NativeFunction::initialize(global_object);
NativeFunction::initialize(realm);
// 22.1.2.3 String.prototype, https://tc39.es/ecma262/#sec-string.prototype
define_direct_property(vm.names.prototype, global_object.string_prototype(), 0);
define_direct_property(vm.names.prototype, realm.global_object().string_prototype(), 0);
u8 attr = Attribute::Writable | Attribute::Configurable;
define_native_function(vm.names.raw, raw, 1, attr);