Index: src/interpreter/bytecode-generator.cc |
diff --git a/src/interpreter/bytecode-generator.cc b/src/interpreter/bytecode-generator.cc |
index 022f41efa54ca550a3ffc6bd0c1d8c4e3e6d5294..67d81c605a163165873d2f3b6fcb77de5592dc89 100644 |
--- a/src/interpreter/bytecode-generator.cc |
+++ b/src/interpreter/bytecode-generator.cc |
@@ -301,7 +301,12 @@ class BytecodeGenerator::ControlScopeForTryCatch final |
public: |
ControlScopeForTryCatch(BytecodeGenerator* generator, |
TryCatchBuilder* try_catch_builder) |
- : ControlScope(generator) {} |
+ : ControlScope(generator) { |
+ generator->try_catch_nesting_level_++; |
+ } |
+ virtual ~ControlScopeForTryCatch() { |
+ generator()->try_catch_nesting_level_--; |
+ } |
protected: |
bool Execute(Command command, Statement* statement) override { |
@@ -328,7 +333,12 @@ class BytecodeGenerator::ControlScopeForTryFinally final |
DeferredCommands* commands) |
: ControlScope(generator), |
try_finally_builder_(try_finally_builder), |
- commands_(commands) {} |
+ commands_(commands) { |
+ generator->try_finally_nesting_level_++; |
+ } |
+ virtual ~ControlScopeForTryFinally() { |
+ generator()->try_finally_nesting_level_--; |
+ } |
protected: |
bool Execute(Command command, Statement* statement) override { |
@@ -543,7 +553,9 @@ BytecodeGenerator::BytecodeGenerator(Isolate* isolate, Zone* zone) |
execution_control_(nullptr), |
execution_context_(nullptr), |
execution_result_(nullptr), |
- register_allocator_(nullptr) { |
+ register_allocator_(nullptr), |
+ try_catch_nesting_level_(0), |
+ try_finally_nesting_level_(0) { |
InitializeAstVisitor(isolate); |
} |
@@ -1150,7 +1162,7 @@ void BytecodeGenerator::VisitTryCatchStatement(TryCatchStatement* stmt) { |
void BytecodeGenerator::VisitTryFinallyStatement(TryFinallyStatement* stmt) { |
- TryFinallyBuilder try_control_builder(builder()); |
+ TryFinallyBuilder try_control_builder(builder(), IsInsideTryCatch()); |
Register no_reg; |
// We keep a record of all paths that enter the finally-block to be able to |