From 9cbf17f1815a4d51d28b29209afef812655648d4 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Mon, 6 May 2024 13:38:08 +0200 Subject: [PATCH] LibJS/Bytecode: Emit `do...while` body before test in codegen This makes the code flow naturally and allows jump elision to work. --- Userland/Libraries/LibJS/Bytecode/ASTCodegen.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Userland/Libraries/LibJS/Bytecode/ASTCodegen.cpp b/Userland/Libraries/LibJS/Bytecode/ASTCodegen.cpp index a172a8b7543..9797507475c 100644 --- a/Userland/Libraries/LibJS/Bytecode/ASTCodegen.cpp +++ b/Userland/Libraries/LibJS/Bytecode/ASTCodegen.cpp @@ -787,8 +787,8 @@ Bytecode::CodeGenerationErrorOr> DoWhileStatement::g // body // jump always (true) test // end - auto& test_block = generator.make_block(); auto& body_block = generator.make_block(); + auto& test_block = generator.make_block(); auto& load_result_and_jump_to_end_block = generator.make_block(); auto& end_block = generator.make_block();