mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-29 20:29:18 +00:00
LibJS: Cache arguments span in ExecutionContext
Allows us to avoid doing math in ExecutionContext::argument()
This commit is contained in:
parent
ff751173ac
commit
e48645c83f
Notes:
github-actions[bot]
2025-04-24 08:31:57 +00:00
Author: https://github.com/kalenikaliaksandr
Commit: e48645c83f
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4434
Reviewed-by: https://github.com/alimpfard
13 changed files with 24 additions and 31 deletions
|
@ -83,10 +83,9 @@ public:
|
|||
|
||||
Value argument(size_t index) const
|
||||
{
|
||||
auto arguments_size = registers_and_constants_and_locals_and_arguments_count - arguments_offset;
|
||||
if (index >= arguments_size) [[unlikely]]
|
||||
if (index >= arguments.size()) [[unlikely]]
|
||||
return js_undefined();
|
||||
return registers_and_constants_and_locals_and_arguments()[arguments_offset + index];
|
||||
return arguments[index];
|
||||
}
|
||||
|
||||
Value& local(size_t index)
|
||||
|
@ -98,15 +97,7 @@ public:
|
|||
u32 passed_argument_count { 0 };
|
||||
bool is_strict_mode { false };
|
||||
|
||||
Span<Value> arguments()
|
||||
{
|
||||
return { registers_and_constants_and_locals_and_arguments() + arguments_offset, registers_and_constants_and_locals_and_arguments_count - arguments_offset };
|
||||
}
|
||||
|
||||
ReadonlySpan<Value> arguments() const
|
||||
{
|
||||
return { registers_and_constants_and_locals_and_arguments() + arguments_offset, registers_and_constants_and_locals_and_arguments_count - arguments_offset };
|
||||
}
|
||||
Span<Value> arguments;
|
||||
|
||||
Vector<Bytecode::UnwindInfo> unwind_contexts;
|
||||
Vector<Optional<size_t>> previously_scheduled_jumps;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue