mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-12-08 06:09:58 +00:00
LibJS: Only assign initial "accumulator" value if actually provided
This commit is contained in:
parent
6f9d297c3c
commit
3ef55f8859
Notes:
github-actions[bot]
2025-11-01 07:41:47 +00:00
Author: https://github.com/awesomekling
Commit: 3ef55f8859
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6657
2 changed files with 7 additions and 8 deletions
|
|
@ -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…
Add table
Add a link
Reference in a new issue