LibJS: Only assign initial "accumulator" value if actually provided

This commit is contained in:
Andreas Kling 2025-10-31 21:18:56 +01:00 committed by Andreas Kling
parent 6f9d297c3c
commit 3ef55f8859
Notes: github-actions[bot] 2025-11-01 07:41:47 +00:00
2 changed files with 7 additions and 8 deletions

View file

@ -705,7 +705,7 @@ Utf16FlyString const& Interpreter::get_identifier(IdentifierTableIndex index) co
return m_running_execution_context->identifier_table.data()[index.value];
}
ThrowCompletionOr<Value> Interpreter::run_executable(ExecutionContext& context, Executable& executable, Optional<size_t> entry_point, Value initial_accumulator_value)
ThrowCompletionOr<Value> Interpreter::run_executable(ExecutionContext& context, Executable& executable, Optional<size_t> entry_point)
{
dbgln_if(JS_BYTECODE_DEBUG, "Bytecode::Interpreter will run unit {}", &executable);
@ -719,8 +719,6 @@ ThrowCompletionOr<Value> 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,