summaryrefslogtreecommitdiff
path: root/Userland/Libraries
diff options
context:
space:
mode:
authorGunnar Beutner <gbeutner@serenityos.org>2021-06-09 18:19:11 +0200
committerAndreas Kling <kling@serenityos.org>2021-06-09 20:04:11 +0200
commitd198e41f74d4b2b8be36fdfe945b6f739415658f (patch)
tree8fad36d9c9e6e0c1b8694ad0e5df905c58f458ed /Userland/Libraries
parentb78f1c12617e7a79ad47df6c5df4a3e43700c537 (diff)
downloadserenity-d198e41f74d4b2b8be36fdfe945b6f739415658f.zip
LibJS: Stop bytecode execution after we've encountered an exception
Diffstat (limited to 'Userland/Libraries')
-rw-r--r--Userland/Libraries/LibJS/Bytecode/Interpreter.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/Userland/Libraries/LibJS/Bytecode/Interpreter.cpp b/Userland/Libraries/LibJS/Bytecode/Interpreter.cpp
index 9bae427052..54ebd19c2a 100644
--- a/Userland/Libraries/LibJS/Bytecode/Interpreter.cpp
+++ b/Userland/Libraries/LibJS/Bytecode/Interpreter.cpp
@@ -65,6 +65,8 @@ Value Interpreter::run(Executable const& executable)
while (!pc.at_end()) {
auto& instruction = *pc;
instruction.execute(*this);
+ if (vm().exception())
+ break;
if (m_pending_jump.has_value()) {
block = m_pending_jump.release_value();
will_jump = true;
@@ -82,6 +84,9 @@ Value Interpreter::run(Executable const& executable)
if (pc.at_end() && !will_jump)
break;
+
+ if (vm().exception())
+ break;
}
dbgln_if(JS_BYTECODE_DEBUG, "Bytecode::Interpreter did run unit {:p}", &executable);