mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 04:37:34 +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
|
@ -68,8 +68,7 @@ PromiseAllResolveElementFunction::PromiseAllResolveElementFunction(size_t index,
|
|||
ThrowCompletionOr<Value> PromiseAllResolveElementFunction::resolve_element()
|
||||
{
|
||||
auto& vm = this->vm();
|
||||
auto& global_object = this->global_object();
|
||||
auto& realm = *global_object.associated_realm();
|
||||
auto& realm = *vm.current_realm();
|
||||
|
||||
// 8. Set values[index] to x.
|
||||
m_values.values()[m_index] = vm.argument(0);
|
||||
|
@ -101,11 +100,10 @@ PromiseAllSettledResolveElementFunction::PromiseAllSettledResolveElementFunction
|
|||
ThrowCompletionOr<Value> PromiseAllSettledResolveElementFunction::resolve_element()
|
||||
{
|
||||
auto& vm = this->vm();
|
||||
auto& global_object = this->global_object();
|
||||
auto& realm = *global_object.associated_realm();
|
||||
auto& realm = *vm.current_realm();
|
||||
|
||||
// 9. Let obj be OrdinaryObjectCreate(%Object.prototype%).
|
||||
auto* object = Object::create(realm, global_object.object_prototype());
|
||||
auto* object = Object::create(realm, realm.global_object().object_prototype());
|
||||
|
||||
// 10. Perform ! CreateDataPropertyOrThrow(obj, "status", "fulfilled").
|
||||
MUST(object->create_data_property_or_throw(vm.names.status, js_string(vm, "fulfilled"sv)));
|
||||
|
@ -143,11 +141,10 @@ PromiseAllSettledRejectElementFunction::PromiseAllSettledRejectElementFunction(s
|
|||
ThrowCompletionOr<Value> PromiseAllSettledRejectElementFunction::resolve_element()
|
||||
{
|
||||
auto& vm = this->vm();
|
||||
auto& global_object = this->global_object();
|
||||
auto& realm = *global_object.associated_realm();
|
||||
auto& realm = *vm.current_realm();
|
||||
|
||||
// 9. Let obj be OrdinaryObjectCreate(%Object.prototype%).
|
||||
auto* object = Object::create(realm, global_object.object_prototype());
|
||||
auto* object = Object::create(realm, realm.global_object().object_prototype());
|
||||
|
||||
// 10. Perform ! CreateDataPropertyOrThrow(obj, "status", "rejected").
|
||||
MUST(object->create_data_property_or_throw(vm.names.status, js_string(vm, "rejected"sv)));
|
||||
|
@ -185,8 +182,7 @@ PromiseAnyRejectElementFunction::PromiseAnyRejectElementFunction(size_t index, P
|
|||
ThrowCompletionOr<Value> PromiseAnyRejectElementFunction::resolve_element()
|
||||
{
|
||||
auto& vm = this->vm();
|
||||
auto& global_object = this->global_object();
|
||||
auto& realm = *global_object.associated_realm();
|
||||
auto& realm = *vm.current_realm();
|
||||
|
||||
// 8. Set errors[index] to x.
|
||||
m_values.values()[m_index] = vm.argument(0);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue