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

LibJS: Convert Object::create() to NonnullGCPtr

This commit is contained in:
Linus Groh 2022-12-13 20:49:50 +00:00
parent f990095728
commit ddc6e139a6
45 changed files with 80 additions and 80 deletions

View file

@ -27,14 +27,14 @@ namespace JS {
static HashMap<Object const*, HashMap<FlyString, Object::IntrinsicAccessor>> s_intrinsics;
// 10.1.12 OrdinaryObjectCreate ( proto [ , additionalInternalSlotsList ] ), https://tc39.es/ecma262/#sec-ordinaryobjectcreate
Object* Object::create(Realm& realm, Object* prototype)
NonnullGCPtr<Object> Object::create(Realm& realm, Object* prototype)
{
if (!prototype)
return realm.heap().allocate<Object>(realm, *realm.intrinsics().empty_object_shape());
return *realm.heap().allocate<Object>(realm, *realm.intrinsics().empty_object_shape());
else if (prototype == realm.intrinsics().object_prototype())
return realm.heap().allocate<Object>(realm, *realm.intrinsics().new_object_shape());
return *realm.heap().allocate<Object>(realm, *realm.intrinsics().new_object_shape());
else
return realm.heap().allocate<Object>(realm, *prototype);
return *realm.heap().allocate<Object>(realm, *prototype);
}
Object::Object(GlobalObjectTag, Realm& realm)