diff --git a/Libraries/LibJS/Bytecode/Interpreter.cpp b/Libraries/LibJS/Bytecode/Interpreter.cpp index 724b283460..df1d861029 100644 --- a/Libraries/LibJS/Bytecode/Interpreter.cpp +++ b/Libraries/LibJS/Bytecode/Interpreter.cpp @@ -705,7 +705,7 @@ Utf16FlyString const& Interpreter::get_identifier(IdentifierTableIndex index) co return m_running_execution_context->identifier_table.data()[index.value]; } -ThrowCompletionOr Interpreter::run_executable(ExecutionContext& context, Executable& executable, Optional entry_point, Value initial_accumulator_value) +ThrowCompletionOr Interpreter::run_executable(ExecutionContext& context, Executable& executable, Optional entry_point) { dbgln_if(JS_BYTECODE_DEBUG, "Bytecode::Interpreter will run unit {}", &executable); @@ -719,8 +719,6 @@ ThrowCompletionOr Interpreter::run_executable(ExecutionContext& context, ASSERT(executable.registers_and_constants_and_locals_count <= context.registers_and_constants_and_locals_and_arguments_span().size()); - reg(Register::accumulator()) = initial_accumulator_value; - // NOTE: We only copy the `this` value from ExecutionContext if it's not already set. // If we are re-entering an async/generator context, the `this` value // may have already been cached by a ResolveThisBinding instruction, diff --git a/Libraries/LibJS/Bytecode/Interpreter.h b/Libraries/LibJS/Bytecode/Interpreter.h index 267af58fb1..f89f0ce6b3 100644 --- a/Libraries/LibJS/Bytecode/Interpreter.h +++ b/Libraries/LibJS/Bytecode/Interpreter.h @@ -34,12 +34,13 @@ public: ThrowCompletionOr run(Script&, GC::Ptr lexical_environment_override = nullptr); ThrowCompletionOr run(SourceTextModule&); - ThrowCompletionOr run(ExecutionContext& context, Executable& executable, Optional entry_point = {}, Value initial_accumulator_value = js_special_empty_value()) - { - return run_executable(context, executable, entry_point, initial_accumulator_value); - } + ThrowCompletionOr run_executable(ExecutionContext&, Executable&, Optional entry_point); - ThrowCompletionOr run_executable(ExecutionContext&, Executable&, Optional entry_point, Value initial_accumulator_value = js_special_empty_value()); + ThrowCompletionOr run_executable(ExecutionContext& context, Executable& executable, Optional entry_point, Value initial_accumulator_value) + { + context.registers_and_constants_and_locals_and_arguments_span()[0] = initial_accumulator_value; + return run_executable(context, executable, entry_point); + } ALWAYS_INLINE Value& accumulator() { return reg(Register::accumulator()); } ALWAYS_INLINE Value& saved_return_value() { return reg(Register::saved_return_value()); }