diff --git a/Userland/Libraries/LibJS/Bytecode/Interpreter.cpp b/Userland/Libraries/LibJS/Bytecode/Interpreter.cpp index 188da2e406..b0c83f96c6 100644 --- a/Userland/Libraries/LibJS/Bytecode/Interpreter.cpp +++ b/Userland/Libraries/LibJS/Bytecode/Interpreter.cpp @@ -105,7 +105,7 @@ ThrowCompletionOr Interpreter::run(Script& script_record, JS::GCPtrdump(); // a. Set result to the result of evaluating script. - auto result_or_error = run_and_return_frame(script_record.realm(), *executable, nullptr); + auto result_or_error = run_and_return_frame(*executable, nullptr); if (result_or_error.value.is_error()) result = result_or_error.value.release_error(); else @@ -165,7 +165,7 @@ ThrowCompletionOr Interpreter::run(SourceTextModule& module) return js_undefined(); } -Interpreter::ValueAndFrame Interpreter::run_and_return_frame(Realm&, Executable& executable, BasicBlock const* entry_point, CallFrame* in_frame) +Interpreter::ValueAndFrame Interpreter::run_and_return_frame(Executable& executable, BasicBlock const* entry_point, CallFrame* in_frame) { dbgln_if(JS_BYTECODE_DEBUG, "Bytecode::Interpreter will run unit {:p}", &executable); diff --git a/Userland/Libraries/LibJS/Bytecode/Interpreter.h b/Userland/Libraries/LibJS/Bytecode/Interpreter.h index 8e863da4a9..d605d152f6 100644 --- a/Userland/Libraries/LibJS/Bytecode/Interpreter.h +++ b/Userland/Libraries/LibJS/Bytecode/Interpreter.h @@ -45,9 +45,9 @@ public: ThrowCompletionOr run(Script&, JS::GCPtr lexical_environment_override = nullptr); ThrowCompletionOr run(SourceTextModule&); - ThrowCompletionOr run(Realm& realm, Bytecode::Executable& executable, Bytecode::BasicBlock const* entry_point = nullptr) + ThrowCompletionOr run(Bytecode::Executable& executable, Bytecode::BasicBlock const* entry_point = nullptr) { - auto value_and_frame = run_and_return_frame(realm, executable, entry_point); + auto value_and_frame = run_and_return_frame(executable, entry_point); return move(value_and_frame.value); } @@ -55,7 +55,7 @@ public: ThrowCompletionOr value; OwnPtr frame; }; - ValueAndFrame run_and_return_frame(Realm&, Bytecode::Executable&, Bytecode::BasicBlock const* entry_point, CallFrame* = nullptr); + ValueAndFrame run_and_return_frame(Bytecode::Executable&, Bytecode::BasicBlock const* entry_point, CallFrame* = nullptr); ALWAYS_INLINE Value& accumulator() { return reg(Register::accumulator()); } ALWAYS_INLINE Value& saved_return_value() { return reg(Register::saved_return_value()); } diff --git a/Userland/Libraries/LibJS/Runtime/AbstractOperations.cpp b/Userland/Libraries/LibJS/Runtime/AbstractOperations.cpp index fc528e8f43..fa114e8c08 100644 --- a/Userland/Libraries/LibJS/Runtime/AbstractOperations.cpp +++ b/Userland/Libraries/LibJS/Runtime/AbstractOperations.cpp @@ -708,7 +708,7 @@ ThrowCompletionOr perform_eval(VM& vm, Value x, CallerMode strict_caller, executable->name = "eval"sv; if (Bytecode::g_dump_bytecode) executable->dump(); - auto result_or_error = vm.bytecode_interpreter().run_and_return_frame(eval_realm, *executable, nullptr); + auto result_or_error = vm.bytecode_interpreter().run_and_return_frame(*executable, nullptr); if (result_or_error.value.is_error()) return result_or_error.value.release_error(); diff --git a/Userland/Libraries/LibJS/Runtime/AsyncGenerator.cpp b/Userland/Libraries/LibJS/Runtime/AsyncGenerator.cpp index 58f8aa7f86..4d1f673ce6 100644 --- a/Userland/Libraries/LibJS/Runtime/AsyncGenerator.cpp +++ b/Userland/Libraries/LibJS/Runtime/AsyncGenerator.cpp @@ -199,7 +199,7 @@ void AsyncGenerator::execute(VM& vm, Completion completion) else bytecode_interpreter.accumulator() = completion_object; - auto next_result = bytecode_interpreter.run_and_return_frame(realm, *m_generating_function->bytecode_executable(), next_block, frame); + auto next_result = bytecode_interpreter.run_and_return_frame(*m_generating_function->bytecode_executable(), next_block, frame); if (!m_frame.has_value()) m_frame = move(*next_result.frame); diff --git a/Userland/Libraries/LibJS/Runtime/ECMAScriptFunctionObject.cpp b/Userland/Libraries/LibJS/Runtime/ECMAScriptFunctionObject.cpp index 82c9017cde..4a47f88cc5 100644 --- a/Userland/Libraries/LibJS/Runtime/ECMAScriptFunctionObject.cpp +++ b/Userland/Libraries/LibJS/Runtime/ECMAScriptFunctionObject.cpp @@ -626,7 +626,7 @@ ThrowCompletionOr ECMAScriptFunctionObject::function_declaration_instantia } else if (i < execution_context_arguments.size() && !execution_context_arguments[i].is_undefined()) { argument_value = execution_context_arguments[i]; } else if (parameter.default_value) { - auto value_and_frame = vm.bytecode_interpreter().run_and_return_frame(realm, *m_default_parameter_bytecode_executables[default_parameter_index - 1], nullptr); + auto value_and_frame = vm.bytecode_interpreter().run_and_return_frame(*m_default_parameter_bytecode_executables[default_parameter_index - 1], nullptr); if (value_and_frame.value.is_error()) return value_and_frame.value.release_error(); // Resulting value is in the accumulator. @@ -998,7 +998,7 @@ void async_block_start(VM& vm, T const& async_body, PromiseCapability const& pro auto& running_context = vm.running_execution_context(); // 3. Set the code evaluation state of asyncContext such that when evaluation is resumed for that execution context the following steps will be performed: - auto execution_steps = NativeFunction::create(realm, "", [&realm, &async_body, &promise_capability, &async_context](auto& vm) -> ThrowCompletionOr { + auto execution_steps = NativeFunction::create(realm, "", [&async_body, &promise_capability, &async_context](auto& vm) -> ThrowCompletionOr { Completion result; // a. If asyncBody is a Parse Node, then @@ -1009,12 +1009,10 @@ void async_block_start(VM& vm, T const& async_body, PromiseCapability const& pro if (maybe_executable.is_error()) result = maybe_executable.release_error(); else - result = vm.bytecode_interpreter().run_and_return_frame(realm, *maybe_executable.value(), nullptr).value; + result = vm.bytecode_interpreter().run_and_return_frame(*maybe_executable.value(), nullptr).value; } // b. Else, else { - (void)realm; - // i. Assert: asyncBody is an Abstract Closure with no parameters. static_assert(IsCallableWithArguments); @@ -1126,7 +1124,7 @@ Completion ECMAScriptFunctionObject::ordinary_call_evaluate_body() } } - auto result_and_frame = vm.bytecode_interpreter().run_and_return_frame(realm, *m_bytecode_executable, nullptr); + auto result_and_frame = vm.bytecode_interpreter().run_and_return_frame(*m_bytecode_executable, nullptr); VERIFY(result_and_frame.frame != nullptr); if (result_and_frame.value.is_error()) diff --git a/Userland/Libraries/LibJS/Runtime/GeneratorObject.cpp b/Userland/Libraries/LibJS/Runtime/GeneratorObject.cpp index 6dc17b279e..1d5022fe71 100644 --- a/Userland/Libraries/LibJS/Runtime/GeneratorObject.cpp +++ b/Userland/Libraries/LibJS/Runtime/GeneratorObject.cpp @@ -120,7 +120,7 @@ ThrowCompletionOr GeneratorObject::execute(VM& vm, Completion const& comp else bytecode_interpreter.accumulator() = completion_object; - auto next_result = bytecode_interpreter.run_and_return_frame(realm, *m_generating_function->bytecode_executable(), next_block, frame); + auto next_result = bytecode_interpreter.run_and_return_frame(*m_generating_function->bytecode_executable(), next_block, frame); vm.pop_execution_context(); diff --git a/Userland/Libraries/LibJS/Runtime/ShadowRealm.cpp b/Userland/Libraries/LibJS/Runtime/ShadowRealm.cpp index ff09acd6b6..b3e9cfa627 100644 --- a/Userland/Libraries/LibJS/Runtime/ShadowRealm.cpp +++ b/Userland/Libraries/LibJS/Runtime/ShadowRealm.cpp @@ -178,7 +178,7 @@ ThrowCompletionOr perform_shadow_realm_eval(VM& vm, StringView source_tex else { auto executable = maybe_executable.release_value(); - auto value_and_frame = vm.bytecode_interpreter().run_and_return_frame(eval_realm, *executable, nullptr); + auto value_and_frame = vm.bytecode_interpreter().run_and_return_frame(*executable, nullptr); if (value_and_frame.value.is_error()) { result = value_and_frame.value.release_error(); } else { diff --git a/Userland/Libraries/LibJS/Runtime/VM.cpp b/Userland/Libraries/LibJS/Runtime/VM.cpp index f23985ec58..e8528ef8b4 100644 --- a/Userland/Libraries/LibJS/Runtime/VM.cpp +++ b/Userland/Libraries/LibJS/Runtime/VM.cpp @@ -306,7 +306,7 @@ ThrowCompletionOr VM::binding_initialization(NonnullRefPtr VM::execute_ast_node(ASTNode const& node) { auto executable = TRY(Bytecode::compile(*this, node, FunctionKind::Normal, ""sv)); - auto result_or_error = bytecode_interpreter().run_and_return_frame(*current_realm(), *executable, nullptr); + auto result_or_error = bytecode_interpreter().run_and_return_frame(*executable, nullptr); if (result_or_error.value.is_error()) return result_or_error.value.release_error(); return result_or_error.frame->registers[0]; diff --git a/Userland/Libraries/LibJS/SourceTextModule.cpp b/Userland/Libraries/LibJS/SourceTextModule.cpp index 88c022bf29..501915697a 100644 --- a/Userland/Libraries/LibJS/SourceTextModule.cpp +++ b/Userland/Libraries/LibJS/SourceTextModule.cpp @@ -701,7 +701,7 @@ ThrowCompletionOr SourceTextModule::execute_module(VM& vm, GCPtr