mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 01:07:36 +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
|
@ -53,7 +53,6 @@ bool is_valid_epoch_nanoseconds(BigInt const& epoch_nanoseconds)
|
|||
ThrowCompletionOr<Instant*> create_temporal_instant(VM& vm, BigInt const& epoch_nanoseconds, FunctionObject const* new_target)
|
||||
{
|
||||
auto& realm = *vm.current_realm();
|
||||
auto& global_object = realm.global_object();
|
||||
|
||||
// 1. Assert: Type(epochNanoseconds) is BigInt.
|
||||
|
||||
|
@ -62,7 +61,7 @@ ThrowCompletionOr<Instant*> create_temporal_instant(VM& vm, BigInt const& epoch_
|
|||
|
||||
// 3. If newTarget is not present, set newTarget to %Temporal.Instant%.
|
||||
if (!new_target)
|
||||
new_target = global_object.temporal_instant_constructor();
|
||||
new_target = realm.global_object().temporal_instant_constructor();
|
||||
|
||||
// 4. Let object be ? OrdinaryCreateFromConstructor(newTarget, "%Temporal.Instant.prototype%", « [[InitializedTemporalInstant]], [[Nanoseconds]] »).
|
||||
// 5. Set object.[[Nanoseconds]] to epochNanoseconds.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue