mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 07:57:46 +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
|
@ -64,14 +64,13 @@ Span<StringView const> available_calendars()
|
|||
ThrowCompletionOr<Calendar*> create_temporal_calendar(VM& vm, String const& identifier, FunctionObject const* new_target)
|
||||
{
|
||||
auto& realm = *vm.current_realm();
|
||||
auto& global_object = realm.global_object();
|
||||
|
||||
// 1. Assert: IsBuiltinCalendar(identifier) is true.
|
||||
VERIFY(is_builtin_calendar(identifier));
|
||||
|
||||
// 2. If newTarget is not provided, set newTarget to %Temporal.Calendar%.
|
||||
if (!new_target)
|
||||
new_target = global_object.temporal_calendar_constructor();
|
||||
new_target = realm.global_object().temporal_calendar_constructor();
|
||||
|
||||
// 3. Let object be ? OrdinaryCreateFromConstructor(newTarget, "%Temporal.Calendar.prototype%", « [[InitializedTemporalCalendar]], [[Identifier]] »).
|
||||
// 4. Set object.[[Identifier]] to identifier.
|
||||
|
@ -886,10 +885,9 @@ u8 iso_day(Object& temporal_object)
|
|||
ThrowCompletionOr<Object*> default_merge_calendar_fields(VM& vm, Object const& fields, Object const& additional_fields)
|
||||
{
|
||||
auto& realm = *vm.current_realm();
|
||||
auto& global_object = realm.global_object();
|
||||
|
||||
// 1. Let merged be OrdinaryObjectCreate(%Object.prototype%).
|
||||
auto* merged = Object::create(realm, global_object.object_prototype());
|
||||
auto* merged = Object::create(realm, realm.global_object().object_prototype());
|
||||
|
||||
// 2. Let fieldsKeys be ? EnumerableOwnPropertyNames(fields, key).
|
||||
auto fields_keys = TRY(fields.enumerable_own_property_names(Object::PropertyKind::Key));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue