From 275a7a0c0a2de638639e0a401c5d67fae8b9fedf Mon Sep 17 00:00:00 2001 From: Linus Groh Date: Sun, 21 Aug 2022 15:12:43 +0100 Subject: LibJS: Replace GlobalObject with VM in Environment AOs [Part 5/19] --- Userland/Libraries/LibJS/Bytecode/Op.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'Userland/Libraries/LibJS/Bytecode') diff --git a/Userland/Libraries/LibJS/Bytecode/Op.cpp b/Userland/Libraries/LibJS/Bytecode/Op.cpp index 4cc88cab8c..a85d7fdff7 100644 --- a/Userland/Libraries/LibJS/Bytecode/Op.cpp +++ b/Userland/Libraries/LibJS/Bytecode/Op.cpp @@ -357,15 +357,15 @@ ThrowCompletionOr CreateVariable::execute_impl(Bytecode::Interpreter& inte return vm.throw_completion(String::formatted("Lexical environment already has binding '{}'", name)); if (m_is_immutable) - vm.lexical_environment()->create_immutable_binding(interpreter.global_object(), name, vm.in_strict_mode()); + vm.lexical_environment()->create_immutable_binding(vm, name, vm.in_strict_mode()); else - vm.lexical_environment()->create_mutable_binding(interpreter.global_object(), name, vm.in_strict_mode()); + vm.lexical_environment()->create_mutable_binding(vm, name, vm.in_strict_mode()); } else { if (!m_is_global) { if (m_is_immutable) - vm.variable_environment()->create_immutable_binding(interpreter.global_object(), name, vm.in_strict_mode()); + vm.variable_environment()->create_immutable_binding(vm, name, vm.in_strict_mode()); else - vm.variable_environment()->create_mutable_binding(interpreter.global_object(), name, vm.in_strict_mode()); + vm.variable_environment()->create_mutable_binding(vm, name, vm.in_strict_mode()); } else { // NOTE: CreateVariable with m_is_global set to true is expected to only be used in GlobalDeclarationInstantiation currently, which only uses "false" for "can_be_deleted". // The only area that sets "can_be_deleted" to true is EvalDeclarationInstantiation, which is currently fully implemented in C++ and not in Bytecode. @@ -391,7 +391,7 @@ ThrowCompletionOr SetVariable::execute_impl(Bytecode::Interpreter& interpr case InitializationMode::InitializeOrSet: VERIFY(reference.is_environment_reference()); VERIFY(reference.base_environment().is_declarative_environment()); - TRY(static_cast(reference.base_environment()).initialize_or_set_mutable_binding(interpreter.global_object(), name, interpreter.accumulator())); + TRY(static_cast(reference.base_environment()).initialize_or_set_mutable_binding(vm, name, interpreter.accumulator())); break; } return {}; @@ -433,7 +433,8 @@ ThrowCompletionOr Jump::execute_impl(Bytecode::Interpreter& interpreter) c ThrowCompletionOr ResolveThisBinding::execute_impl(Bytecode::Interpreter& interpreter) const { - interpreter.accumulator() = TRY(interpreter.vm().resolve_this_binding(interpreter.global_object())); + auto& vm = interpreter.vm(); + interpreter.accumulator() = TRY(vm.resolve_this_binding()); return {}; } -- cgit v1.2.3