summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibJS/Runtime/Realm.cpp
diff options
context:
space:
mode:
authorLinus Groh <mail@linusgroh.de>2022-08-16 00:20:50 +0100
committerLinus Groh <mail@linusgroh.de>2022-08-23 13:58:30 +0100
commite992a9f469a536b5a5442229a1adddd27deb1db9 (patch)
tree0fcfb0c3205530e9fd91d2cf8da315fb467e6d70 /Userland/Libraries/LibJS/Runtime/Realm.cpp
parentb99cc7d05039b9386538a581244be5af782c8d05 (diff)
downloadserenity-e992a9f469a536b5a5442229a1adddd27deb1db9.zip
LibJS+LibWeb: Replace GlobalObject with Realm in Heap::allocate<T>()
This is a continuation of the previous three commits. Now that create() receives the allocating realm, we can simply forward that to allocate(), which accounts for the majority of these changes. Additionally, we can get rid of the realm_from_global_object() in one place, with one more remaining in VM::throw_completion().
Diffstat (limited to 'Userland/Libraries/LibJS/Runtime/Realm.cpp')
-rw-r--r--Userland/Libraries/LibJS/Runtime/Realm.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/Userland/Libraries/LibJS/Runtime/Realm.cpp b/Userland/Libraries/LibJS/Runtime/Realm.cpp
index 93cfb071d5..32444af365 100644
--- a/Userland/Libraries/LibJS/Runtime/Realm.cpp
+++ b/Userland/Libraries/LibJS/Runtime/Realm.cpp
@@ -17,7 +17,7 @@ namespace JS {
// 9.3.1 CreateRealm ( ), https://tc39.es/ecma262/#sec-createrealm
Realm* Realm::create(VM& vm)
{
- return vm.heap().allocate_without_global_object<Realm>();
+ return vm.heap().allocate_without_realm<Realm>();
}
// 9.6 InitializeHostDefinedRealm ( ), https://tc39.es/ecma262/#sec-initializehostdefinedrealm
@@ -79,7 +79,7 @@ void Realm::set_global_object(GlobalObject* global_object, GlobalObject* this_va
// b. Set globalObj to OrdinaryObjectCreate(intrinsics.[[%Object.prototype%]]).
// NOTE: We allocate a proper GlobalObject directly as this plain object is
// turned into one via SetDefaultGlobalBindings in the spec.
- global_object = heap().allocate_without_global_object<GlobalObject>(*this);
+ global_object = heap().allocate_without_realm<GlobalObject>(*this);
}
// 2. Assert: Type(globalObj) is Object.
@@ -100,7 +100,7 @@ void Realm::set_global_object(GlobalObject* global_object, GlobalObject* this_va
// 5. Let newGlobalEnv be NewGlobalEnvironment(globalObj, thisValue).
// 6. Set realmRec.[[GlobalEnv]] to newGlobalEnv.
- m_global_environment = m_global_object->heap().allocate_without_global_object<GlobalEnvironment>(*global_object, *this_value);
+ m_global_environment = m_global_object->heap().allocate_without_realm<GlobalEnvironment>(*global_object, *this_value);
// 7. Return unused.
}