| Index: src/interpreter/bytecode-generator.cc
|
| diff --git a/src/interpreter/bytecode-generator.cc b/src/interpreter/bytecode-generator.cc
|
| index c4026b59ec1659c024f231fca7d6a561b6c39a72..839b2f884e8baafe979e7a902802449a566b095c 100644
|
| --- a/src/interpreter/bytecode-generator.cc
|
| +++ b/src/interpreter/bytecode-generator.cc
|
| @@ -362,16 +362,22 @@ class BytecodeGenerator::ControlScopeForTryFinally final
|
| void BytecodeGenerator::ControlScope::PerformCommand(Command command,
|
| Statement* statement) {
|
| ControlScope* current = this;
|
| - ContextScope* context = this->context();
|
| + ContextScope* context = generator()->execution_context();
|
| do {
|
| - if (current->Execute(command, statement)) { return; }
|
| - current = current->outer();
|
| if (current->context() != context) {
|
| - // Pop context to the expected depth.
|
| + // Pop context to the expected depth for break and continue. For return
|
| + // and throw it is not required to pop. Debugger expects that the
|
| + // context is not popped on return. So do not pop on return.
|
| // TODO(rmcilroy): Only emit a single context pop.
|
| - generator()->builder()->PopContext(current->context()->reg());
|
| + if (command == CMD_BREAK || command == CMD_CONTINUE) {
|
| + generator()->builder()->PopContext(current->context()->reg());
|
| + }
|
| context = current->context();
|
| }
|
| + if (current->Execute(command, statement)) {
|
| + return;
|
| + }
|
| + current = current->outer();
|
| } while (current != nullptr);
|
| UNREACHABLE();
|
| }
|
|
|