diff --git a/Userland/Libraries/LibJS/Bytecode/ASTCodegen.cpp b/Userland/Libraries/LibJS/Bytecode/ASTCodegen.cpp index 6950d6d632..4da233a48f 100644 --- a/Userland/Libraries/LibJS/Bytecode/ASTCodegen.cpp +++ b/Userland/Libraries/LibJS/Bytecode/ASTCodegen.cpp @@ -1987,7 +1987,8 @@ Bytecode::CodeGenerationErrorOr TryStatement::generate_bytecode(Bytecode:: generator.emit(finalizer_target); } else { auto& block = generator.make_block(); - generator.emit(Bytecode::Label { block }); + generator.emit(); + generator.emit(Bytecode::Label { block }); next_block = █ } } diff --git a/Userland/Libraries/LibJS/Bytecode/Instruction.h b/Userland/Libraries/LibJS/Bytecode/Instruction.h index bf4c624b65..524ea8dc3c 100644 --- a/Userland/Libraries/LibJS/Bytecode/Instruction.h +++ b/Userland/Libraries/LibJS/Bytecode/Instruction.h @@ -31,7 +31,6 @@ O(EnterUnwindContext) \ O(EnterObjectEnvironment) \ O(Exp) \ - O(FinishUnwind) \ O(GetById) \ O(GetByValue) \ O(GetIterator) \ diff --git a/Userland/Libraries/LibJS/Bytecode/Op.cpp b/Userland/Libraries/LibJS/Bytecode/Op.cpp index c4d1007b5d..7cec9665a4 100644 --- a/Userland/Libraries/LibJS/Bytecode/Op.cpp +++ b/Userland/Libraries/LibJS/Bytecode/Op.cpp @@ -744,19 +744,6 @@ void EnterUnwindContext::replace_references_impl(BasicBlock const& from, BasicBl m_finalizer_target = Label { to }; } -ThrowCompletionOr FinishUnwind::execute_impl(Bytecode::Interpreter& interpreter) const -{ - interpreter.leave_unwind_context(); - interpreter.jump(m_next_target); - return {}; -} - -void FinishUnwind::replace_references_impl(BasicBlock const& from, BasicBlock const& to) -{ - if (&m_next_target.block() == &from) - m_next_target = Label { to }; -} - void CopyObjectExcludingProperties::replace_references_impl(Register from, Register to) { if (m_from_object == from) @@ -1229,11 +1216,6 @@ DeprecatedString EnterUnwindContext::to_deprecated_string_impl(Bytecode::Executa return DeprecatedString::formatted("EnterUnwindContext handler:{} finalizer:{} entry:{}", handler_string, finalizer_string, m_entry_point); } -DeprecatedString FinishUnwind::to_deprecated_string_impl(Bytecode::Executable const&) const -{ - return DeprecatedString::formatted("FinishUnwind next:{}", m_next_target); -} - DeprecatedString LeaveEnvironment::to_deprecated_string_impl(Bytecode::Executable const&) const { auto mode_string = m_mode == EnvironmentMode::Lexical diff --git a/Userland/Libraries/LibJS/Bytecode/Op.h b/Userland/Libraries/LibJS/Bytecode/Op.h index 0ec5498884..c0de8fb4e7 100644 --- a/Userland/Libraries/LibJS/Bytecode/Op.h +++ b/Userland/Libraries/LibJS/Bytecode/Op.h @@ -876,27 +876,6 @@ public: void replace_references_impl(Register, Register) { } }; -class FinishUnwind final : public Instruction { -public: - constexpr static bool IsTerminator = true; - - FinishUnwind(Label next) - : Instruction(Type::FinishUnwind) - , m_next_target(move(next)) - { - } - - ThrowCompletionOr execute_impl(Bytecode::Interpreter&) const; - DeprecatedString to_deprecated_string_impl(Bytecode::Executable const&) const; - void replace_references_impl(BasicBlock const&, BasicBlock const&); - void replace_references_impl(Register, Register) { } - - Label next_target() const { return m_next_target; } - -private: - Label m_next_target; -}; - class ContinuePendingUnwind final : public Instruction { public: constexpr static bool IsTerminator = true; diff --git a/Userland/Libraries/LibJS/Bytecode/Pass/GenerateCFG.cpp b/Userland/Libraries/LibJS/Bytecode/Pass/GenerateCFG.cpp index d4be4b7148..476cc937b7 100644 --- a/Userland/Libraries/LibJS/Bytecode/Pass/GenerateCFG.cpp +++ b/Userland/Libraries/LibJS/Bytecode/Pass/GenerateCFG.cpp @@ -90,11 +90,6 @@ void GenerateCFG::perform(PassPipelineExecutable& executable) enter_label(&resume_target, current_block); continue; } - case FinishUnwind: { - auto const& next_target = static_cast(instruction).next_target(); - enter_label(&next_target, current_block); - continue; - } default: // Otherwise, pop the current block off, it doesn't jump anywhere. iterators.take_last();