1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 23:07:35 +00:00

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().
This commit is contained in:
Linus Groh 2022-08-16 00:20:50 +01:00
parent b99cc7d050
commit e992a9f469
82 changed files with 148 additions and 148 deletions

View file

@ -45,7 +45,7 @@ ThrowCompletionOr<Object*> promise_resolve(GlobalObject& global_object, Object&
Promise* Promise::create(Realm& realm)
{
return realm.heap().allocate<Promise>(realm.global_object(), *realm.global_object().promise_prototype());
return realm.heap().allocate<Promise>(realm, *realm.global_object().promise_prototype());
}
// 27.2 Promise Objects, https://tc39.es/ecma262/#sec-promise-objects
@ -64,7 +64,7 @@ Promise::ResolvingFunctions Promise::create_resolving_functions()
auto& realm = *global_object.associated_realm();
// 1. Let alreadyResolved be the Record { [[Value]]: false }.
auto* already_resolved = vm.heap().allocate_without_global_object<AlreadyResolved>();
auto* already_resolved = vm.heap().allocate_without_realm<AlreadyResolved>();
// 2. Let stepsResolve be the algorithm steps defined in Promise Resolve Functions.
// 3. Let lengthResolve be the number of non-optional parameters of the function definition in Promise Resolve Functions.