mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-27 10:07:15 +02: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:
Notes:
sideshowbarker
2024-07-17 07:52:48 +09:00
Author: https://github.com/linusg Commit: https://github.com/SerenityOS/serenity/commit/b345a0acca Pull-request: https://github.com/SerenityOS/serenity/pull/14973 Reviewed-by: https://github.com/davidot ✅
@@ -36,8 +36,8 @@ void DateTimeFormatFunction::initialize(Realm& realm)
|
||||
|
||||
ThrowCompletionOr<Value> DateTimeFormatFunction::call()
|
||||
{
|
||||
auto& global_object = this->global_object();
|
||||
auto& vm = global_object.vm();
|
||||
auto& vm = this->vm();
|
||||
auto& realm = *vm.current_realm();
|
||||
|
||||
auto date = vm.argument(0);
|
||||
|
||||
@@ -49,7 +49,7 @@ ThrowCompletionOr<Value> DateTimeFormatFunction::call()
|
||||
// 3. If date is not provided or is undefined, then
|
||||
if (date.is_undefined()) {
|
||||
// a. Let x be ! Call(%Date.now%, undefined).
|
||||
date_value = MUST(JS::call(vm, global_object.date_constructor_now_function(), js_undefined())).as_double();
|
||||
date_value = MUST(JS::call(vm, realm.global_object().date_constructor_now_function(), js_undefined())).as_double();
|
||||
}
|
||||
// 4. Else,
|
||||
else {
|
||||
|
||||
Reference in New Issue
Block a user