mirror of
https://github.com/zebrajr/ladybird.git
synced 2025-12-06 00:19:53 +01:00
LibJS: Precompute the number of regs/constants/locals in Executable
Instead of doing it again on every call. Minor bump in call performance.
This commit is contained in:
parent
cdcbbcf48b
commit
6671cbef41
|
|
@ -92,6 +92,8 @@ public:
|
|||
size_t number_of_registers { 0 };
|
||||
bool is_strict_mode { false };
|
||||
|
||||
size_t registers_and_constants_and_locals_count { 0 };
|
||||
|
||||
struct ExceptionHandlers {
|
||||
size_t start_offset;
|
||||
size_t end_offset;
|
||||
|
|
|
|||
|
|
@ -477,6 +477,8 @@ CodeGenerationErrorOr<GC::Ref<Executable>> Generator::compile(VM& vm, ASTNode co
|
|||
executable->argument_index_base = number_of_registers + number_of_constants + number_of_locals;
|
||||
executable->length_identifier = generator.m_length_identifier;
|
||||
|
||||
executable->registers_and_constants_and_locals_count = executable->number_of_registers + executable->constants.size() + executable->local_variable_names.size();
|
||||
|
||||
generator.m_finished = true;
|
||||
|
||||
return executable;
|
||||
|
|
|
|||
|
|
@ -507,7 +507,7 @@ ThrowCompletionOr<void> ECMAScriptFunctionObject::get_stack_frame_size(size_t& r
|
|||
executable = TRY(Bytecode::compile(vm(), *this));
|
||||
}
|
||||
}
|
||||
registers_and_constants_and_locals_count = executable->number_of_registers + executable->constants.size() + executable->local_variable_names.size();
|
||||
registers_and_constants_and_locals_count = executable->registers_and_constants_and_locals_count;
|
||||
argument_count = max(argument_count, formal_parameters().size());
|
||||
return {};
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user