mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 04:57:44 +00:00
LibJS+LibWeb: Reduce use of GlobalObject as an intermediary
- Prefer VM::current_realm() over GlobalObject::associated_realm() - Prefer VM::heap() over GlobalObject::heap() - Prefer Cell::vm() over Cell::global_object() - Prefer Wrapper::vm() over Wrapper::global_object() - Inline Realm::global_object() calls used to access intrinsics as they will later perform a direct lookup without going through the global object
This commit is contained in:
parent
e3895e6c80
commit
b345a0acca
58 changed files with 157 additions and 231 deletions
|
@ -46,7 +46,6 @@ void JSONObject::initialize(Realm& realm)
|
|||
ThrowCompletionOr<String> JSONObject::stringify_impl(VM& vm, Value value, Value replacer, Value space)
|
||||
{
|
||||
auto& realm = *vm.current_realm();
|
||||
auto& global_object = realm.global_object();
|
||||
|
||||
StringifyState state;
|
||||
|
||||
|
@ -102,7 +101,7 @@ ThrowCompletionOr<String> JSONObject::stringify_impl(VM& vm, Value value, Value
|
|||
state.gap = String::empty();
|
||||
}
|
||||
|
||||
auto* wrapper = Object::create(realm, global_object.object_prototype());
|
||||
auto* wrapper = Object::create(realm, realm.global_object().object_prototype());
|
||||
MUST(wrapper->create_data_property_or_throw(String::empty(), value));
|
||||
return serialize_json_property(vm, state, String::empty(), wrapper);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue