LibJS: Add new operand type for function arguments

This allows us to directly access passed arguments instead of copying
them to register/local first using GetArgument instruction.
This commit is contained in:
Aliaksandr Kalenik 2025-04-24 22:10:41 +02:00 committed by Andreas Kling
parent 81a3bfd492
commit 3f04d18ef7
Notes: github-actions[bot] 2025-04-26 09:03:30 +00:00
7 changed files with 27 additions and 93 deletions

View file

@ -49,11 +49,11 @@ public:
ALWAYS_INLINE Value& saved_return_value() { return reg(Register::saved_return_value()); }
Value& reg(Register const& r)
{
return m_registers_and_constants_and_locals.data()[r.index()];
return m_registers_and_constants_and_locals_arguments.data()[r.index()];
}
Value reg(Register const& r) const
{
return m_registers_and_constants_and_locals.data()[r.index()];
return m_registers_and_constants_and_locals_arguments.data()[r.index()];
}
[[nodiscard]] Value get(Operand) const;
@ -101,7 +101,7 @@ private:
GC::Ptr<Object> m_global_object { nullptr };
GC::Ptr<DeclarativeEnvironment> m_global_declarative_environment { nullptr };
Optional<size_t&> m_program_counter;
Span<Value> m_registers_and_constants_and_locals;
Span<Value> m_registers_and_constants_and_locals_arguments;
Vector<Value> m_argument_values_buffer;
ExecutionContext* m_running_execution_context { nullptr };
};