mirror of
https://github.com/SerenityOS/serenity
synced 2026-05-05 22:52:10 +02:00
LibJS: Join locals, constants and registers into single vector
Merging registers, constants and locals into single vector means: - Better data locality - No need to check type in Interpreter::get() and Interpreter::set() which are very hot functions Performance improvement is visible in almost all Octane and Kraken tests.
This commit is contained in:
committed by
Andreas Kling
parent
59cb7994c6
commit
d79438a2a6
@@ -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.data()[r.index()];
|
||||
return m_registers_and_constants_and_locals.data()[r.index()];
|
||||
}
|
||||
Value reg(Register const& r) const
|
||||
{
|
||||
return m_registers.data()[r.index()];
|
||||
return m_registers_and_constants_and_locals.data()[r.index()];
|
||||
}
|
||||
|
||||
[[nodiscard]] Value get(Operand) const;
|
||||
@@ -77,9 +77,6 @@ public:
|
||||
Executable const& current_executable() const { return *m_current_executable; }
|
||||
Optional<size_t> program_counter() const { return m_program_counter; }
|
||||
|
||||
Vector<Value>& registers() { return vm().running_execution_context().registers; }
|
||||
Vector<Value> const& registers() const { return vm().running_execution_context().registers; }
|
||||
|
||||
ExecutionContext& running_execution_context() { return *m_running_execution_context; }
|
||||
|
||||
private:
|
||||
@@ -99,9 +96,7 @@ private:
|
||||
GCPtr<DeclarativeEnvironment> m_global_declarative_environment { nullptr };
|
||||
Optional<size_t&> m_program_counter;
|
||||
Span<Value> m_arguments;
|
||||
Span<Value> m_registers;
|
||||
Span<Value> m_locals;
|
||||
Span<Value> m_constants;
|
||||
Span<Value> m_registers_and_constants_and_locals;
|
||||
ExecutionContext* m_running_execution_context { nullptr };
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user