From 5181957da5310542388dad81528e0215482d302e Mon Sep 17 00:00:00 2001 From: Hendiadyoin1 Date: Tue, 22 Nov 2022 18:29:27 +0100 Subject: [PATCH] LibJS: VERIFY on unknown terminator opcodes in GenerateCFG If we mess up in here it could break promises later optimization stages assume, so rather than having wrong results, make it scream as load as it can. --- Userland/Libraries/LibJS/Bytecode/Pass/GenerateCFG.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Userland/Libraries/LibJS/Bytecode/Pass/GenerateCFG.cpp b/Userland/Libraries/LibJS/Bytecode/Pass/GenerateCFG.cpp index 476cc937b7..a3ec92ca5b 100644 --- a/Userland/Libraries/LibJS/Bytecode/Pass/GenerateCFG.cpp +++ b/Userland/Libraries/LibJS/Bytecode/Pass/GenerateCFG.cpp @@ -90,12 +90,15 @@ void GenerateCFG::perform(PassPipelineExecutable& executable) enter_label(&resume_target, current_block); continue; } - default: - // Otherwise, pop the current block off, it doesn't jump anywhere. + case Throw: + case Return: iterators.take_last(); entered_blocks.take_last(); continue; - } + default: + dbgln("Unhandled terminator instruction: `{}`", instruction.to_deprecated_string(executable.executable)); + VERIFY_NOT_REACHED(); + }; } finished();