Skip to content

Commit 769c84c

Browse files
committed
LibJS: Make ExecutionContext constructor ALWAYS_INLINE
1 parent d88c19a commit 769c84c

File tree

2 files changed

+8
-10
lines changed

2 files changed

+8
-10
lines changed

Libraries/LibJS/Runtime/ExecutionContext.cpp

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -102,15 +102,6 @@ void ExecutionContext::operator delete(void* ptr)
102102
s_execution_context_allocator->deallocate(ptr, execution_context->registers_and_constants_and_locals_and_arguments_count);
103103
}
104104

105-
ExecutionContext::ExecutionContext(u32 registers_and_constants_and_locals_count, u32 arguments_count)
106-
{
107-
registers_and_constants_and_locals_and_arguments_count = registers_and_constants_and_locals_count + arguments_count;
108-
auto* registers_and_constants_and_locals_and_arguments = this->registers_and_constants_and_locals_and_arguments();
109-
for (size_t i = 0; i < registers_and_constants_and_locals_count; ++i)
110-
registers_and_constants_and_locals_and_arguments[i] = js_special_empty_value();
111-
arguments = { registers_and_constants_and_locals_and_arguments + registers_and_constants_and_locals_count, arguments_count };
112-
}
113-
114105
NonnullOwnPtr<ExecutionContext> ExecutionContext::copy() const
115106
{
116107
auto copy = create(registers_and_constants_and_locals_and_arguments_count, arguments.size());

Libraries/LibJS/Runtime/ExecutionContext.h

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,14 @@ struct JS_API ExecutionContext {
6767
friend class ExecutionContextAllocator;
6868

6969
public:
70-
ExecutionContext(u32 registers_and_constants_and_locals_count, u32 arguments_count);
70+
ALWAYS_INLINE ExecutionContext(u32 registers_and_constants_and_locals_count, u32 arguments_count)
71+
{
72+
registers_and_constants_and_locals_and_arguments_count = registers_and_constants_and_locals_count + arguments_count;
73+
auto* registers_and_constants_and_locals_and_arguments = this->registers_and_constants_and_locals_and_arguments();
74+
for (size_t i = 0; i < registers_and_constants_and_locals_count; ++i)
75+
registers_and_constants_and_locals_and_arguments[i] = js_special_empty_value();
76+
arguments = { registers_and_constants_and_locals_and_arguments + registers_and_constants_and_locals_count, arguments_count };
77+
}
7178

7279
GC::Ptr<ExecutionContextRareData> rare_data() const { return m_rare_data; }
7380
GC::Ref<ExecutionContextRareData> ensure_rare_data();

0 commit comments

Comments
 (0)