LibJS: Cache arguments span in ExecutionContext

Allows us to avoid doing math in ExecutionContext::argument()
This commit is contained in:
Aliaksandr Kalenik 2025-04-24 01:37:30 +02:00 committed by Andreas Kling
parent ff751173ac
commit e48645c83f
Notes: github-actions[bot] 2025-04-24 08:31:57 +00:00
13 changed files with 24 additions and 31 deletions

View file

@ -374,7 +374,7 @@ FLATTEN_ON_CLANG void Interpreter::run_bytecode(size_t entry_point)
}
auto& running_execution_context = this->running_execution_context();
auto* arguments = running_execution_context.arguments().data();
auto* arguments = running_execution_context.arguments.data();
auto& accumulator = this->accumulator();
auto& executable = current_executable();
auto const* bytecode = executable.bytecode.data();
@ -2331,7 +2331,7 @@ ThrowCompletionOr<void> CreateVariable::execute_impl(Bytecode::Interpreter& inte
void CreateRestParams::execute_impl(Bytecode::Interpreter& interpreter) const
{
auto const arguments = interpreter.running_execution_context().arguments();
auto const arguments = interpreter.running_execution_context().arguments;
auto arguments_count = interpreter.running_execution_context().passed_argument_count;
auto array = MUST(Array::create(interpreter.realm(), 0));
for (size_t rest_index = m_rest_index; rest_index < arguments_count; ++rest_index)
@ -2342,7 +2342,7 @@ void CreateRestParams::execute_impl(Bytecode::Interpreter& interpreter) const
void CreateArguments::execute_impl(Bytecode::Interpreter& interpreter) const
{
auto const& function = interpreter.running_execution_context().function;
auto const arguments = interpreter.running_execution_context().arguments();
auto const arguments = interpreter.running_execution_context().arguments;
auto const& environment = interpreter.running_execution_context().lexical_environment;
auto passed_arguments = ReadonlySpan<Value> { arguments.data(), interpreter.running_execution_context().passed_argument_count };