mirror of
https://github.com/zebrajr/ladybird.git
synced 2025-12-06 00:19:53 +01:00
LibJS: Only assign initial "accumulator" value if actually provided
This commit is contained in:
parent
6f9d297c3c
commit
3ef55f8859
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -34,12 +34,13 @@ public:
|
|||
ThrowCompletionOr<Value> run(Script&, GC::Ptr<Environment> lexical_environment_override = nullptr);
|
||||
ThrowCompletionOr<Value> run(SourceTextModule&);
|
||||
|
||||
ThrowCompletionOr<Value> run(ExecutionContext& context, Executable& executable, Optional<size_t> entry_point = {}, Value initial_accumulator_value = js_special_empty_value())
|
||||
{
|
||||
return run_executable(context, executable, entry_point, initial_accumulator_value);
|
||||
}
|
||||
ThrowCompletionOr<Value> run_executable(ExecutionContext&, Executable&, Optional<size_t> entry_point);
|
||||
|
||||
ThrowCompletionOr<Value> run_executable(ExecutionContext&, Executable&, Optional<size_t> entry_point, Value initial_accumulator_value = js_special_empty_value());
|
||||
ThrowCompletionOr<Value> run_executable(ExecutionContext& context, Executable& executable, Optional<size_t> 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()); }
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user