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

LibJS: Convert Heap::allocate{,_without_realm}() to NonnullGCPtr

This commit is contained in:
Linus Groh 2022-12-14 17:40:33 +00:00 committed by Tim Flynn
parent 2a66fc6cae
commit 22089436ed
161 changed files with 367 additions and 370 deletions

View file

@ -125,7 +125,7 @@ NonnullGCPtr<PrimitiveString> PrimitiveString::create(VM& vm, Utf16String string
return vm.single_ascii_character_string(static_cast<u8>(code_unit));
}
return *vm.heap().allocate_without_realm<PrimitiveString>(move(string));
return vm.heap().allocate_without_realm<PrimitiveString>(move(string));
}
NonnullGCPtr<PrimitiveString> PrimitiveString::create(VM& vm, DeprecatedString string)
@ -142,7 +142,7 @@ NonnullGCPtr<PrimitiveString> PrimitiveString::create(VM& vm, DeprecatedString s
auto& string_cache = vm.string_cache();
auto it = string_cache.find(string);
if (it == string_cache.end()) {
auto* new_string = vm.heap().allocate_without_realm<PrimitiveString>(string);
auto new_string = vm.heap().allocate_without_realm<PrimitiveString>(string);
string_cache.set(move(string), new_string);
return *new_string;
}
@ -166,7 +166,7 @@ NonnullGCPtr<PrimitiveString> PrimitiveString::create(VM& vm, PrimitiveString& l
if (rhs_empty)
return lhs;
return *vm.heap().allocate_without_realm<PrimitiveString>(lhs, rhs);
return vm.heap().allocate_without_realm<PrimitiveString>(lhs, rhs);
}
void PrimitiveString::resolve_rope_if_needed() const