mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-07 18:17:23 +00:00
LibJS/Bytecode: Emit for
condition check before update statement
This allows jump elision to eliminate an unnecessary jump since things now get laid out naturally in memory (normal execution order).
This commit is contained in:
parent
24d8b056c7
commit
69cc64e94c
Notes:
sideshowbarker
2024-07-17 08:34:29 +09:00
Author: https://github.com/awesomekling
Commit: 69cc64e94c
Pull-request: https://github.com/SerenityOS/serenity/pull/24240
Reviewed-by: https://github.com/Hendiadyoin1
Reviewed-by: https://github.com/trflynn89 ✅
1 changed files with 5 additions and 5 deletions
|
@ -888,16 +888,16 @@ Bytecode::CodeGenerationErrorOr<Optional<Bytecode::Operand>> ForStatement::gener
|
|||
|
||||
body_block_ptr = &generator.make_block();
|
||||
|
||||
if (m_test)
|
||||
test_block_ptr = &generator.make_block();
|
||||
else
|
||||
test_block_ptr = body_block_ptr;
|
||||
|
||||
if (m_update)
|
||||
update_block_ptr = &generator.make_block();
|
||||
else
|
||||
update_block_ptr = body_block_ptr;
|
||||
|
||||
if (m_test)
|
||||
test_block_ptr = &generator.make_block();
|
||||
else
|
||||
test_block_ptr = body_block_ptr;
|
||||
|
||||
generator.emit<Bytecode::Op::Jump>(Bytecode::Label { *test_block_ptr });
|
||||
|
||||
if (m_test) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue