mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-05-05 06:32:30 +02: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:
Notes:
sideshowbarker
2024-07-17 08:34:29 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/69cc64e94c Pull-request: https://github.com/SerenityOS/serenity/pull/24240 Reviewed-by: https://github.com/Hendiadyoin1 Reviewed-by: https://github.com/trflynn89 ✅
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user