mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-28 11:49:44 +00:00
LibJS: Use ranges instead of specifying all registers for NewArray
Listing all the registers will lead to the inability to allocate enough space in one basic block (as there can be an arbitrary number of registers used), instead switch to specifying the range of registers used and save a lot of space in the process.
This commit is contained in:
parent
e517cb505a
commit
a37bee919a
Notes:
sideshowbarker
2024-07-17 17:26:43 +09:00
Author: https://github.com/alimpfard
Commit: a37bee919a
Pull-request: https://github.com/SerenityOS/serenity/pull/13039
Reviewed-by: https://github.com/Lubrsi
Reviewed-by: https://github.com/davidot
3 changed files with 50 additions and 23 deletions
|
@ -129,7 +129,7 @@ ThrowCompletionOr<void> NewArray::execute_impl(Bytecode::Interpreter& interprete
|
|||
{
|
||||
auto* array = MUST(Array::create(interpreter.global_object(), 0));
|
||||
for (size_t i = 0; i < m_element_count; i++) {
|
||||
auto& value = interpreter.reg(m_elements[i]);
|
||||
auto& value = interpreter.reg(Register(m_elements[0].index() + i));
|
||||
array->indexed_properties().put(i, value, default_attributes);
|
||||
}
|
||||
interpreter.accumulator() = array;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue