Skip to content

Commit 75d49c4

Browse files
committed
LibJS: Remove effectively unused value span from ExecutionContext
Instead of using this span, we can just use the getter that calculates the base of the register/constant/local/argument array based on the ExecutionContext's own address.
1 parent e1344af commit 75d49c4

File tree

3 files changed

+4
-7
lines changed

3 files changed

+4
-7
lines changed

Libraries/LibJS/Bytecode/Interpreter.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -167,12 +167,12 @@ Interpreter::~Interpreter()
167167

168168
ALWAYS_INLINE Value Interpreter::get(Operand op) const
169169
{
170-
return m_running_execution_context->registers_and_constants_and_locals_arguments.data()[op.index()];
170+
return m_running_execution_context->registers_and_constants_and_locals_and_arguments()[op.index()];
171171
}
172172

173173
ALWAYS_INLINE void Interpreter::set(Operand op, Value value)
174174
{
175-
m_running_execution_context->registers_and_constants_and_locals_arguments.data()[op.index()] = value;
175+
m_running_execution_context->registers_and_constants_and_locals_and_arguments()[op.index()] = value;
176176
}
177177

178178
ALWAYS_INLINE Value Interpreter::do_yield(Value value, Optional<Label> continuation)
@@ -716,8 +716,6 @@ ThrowCompletionOr<Value> Interpreter::run_executable(ExecutionContext& context,
716716

717717
ASSERT(executable.registers_and_constants_and_locals_count <= context.registers_and_constants_and_locals_and_arguments_span().size());
718718

719-
context.registers_and_constants_and_locals_arguments = context.registers_and_constants_and_locals_and_arguments_span();
720-
721719
reg(Register::accumulator()) = initial_accumulator_value;
722720

723721
// NOTE: We only copy the `this` value from ExecutionContext if it's not already set.

Libraries/LibJS/Bytecode/Interpreter.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,11 @@ class JS_API Interpreter {
4545
ALWAYS_INLINE Value& saved_return_value() { return reg(Register::saved_return_value()); }
4646
Value& reg(Register const& r)
4747
{
48-
return m_running_execution_context->registers_and_constants_and_locals_arguments.data()[r.index()];
48+
return m_running_execution_context->registers_and_constants_and_locals_and_arguments()[r.index()];
4949
}
5050
Value reg(Register const& r) const
5151
{
52-
return m_running_execution_context->registers_and_constants_and_locals_arguments.data()[r.index()];
52+
return m_running_execution_context->registers_and_constants_and_locals_and_arguments()[r.index()];
5353
}
5454

5555
[[nodiscard]] Value get(Operand) const;

Libraries/LibJS/Runtime/ExecutionContext.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@ struct JS_API ExecutionContext {
8282
Optional<size_t> scheduled_jump;
8383
GC::Ptr<Object> global_object;
8484
GC::Ptr<DeclarativeEnvironment> global_declarative_environment;
85-
Span<Value> registers_and_constants_and_locals_arguments;
8685
ReadonlySpan<Utf16FlyString> identifier_table;
8786

8887
u32 program_counter { 0 };

0 commit comments

Comments
 (0)