Chromium Code Reviews| Index: src/interpreter/bytecode-generator.cc |
| diff --git a/src/interpreter/bytecode-generator.cc b/src/interpreter/bytecode-generator.cc |
| index c4026b59ec1659c024f231fca7d6a561b6c39a72..45a836bd8b3b53a8316216f8e955f64969292351 100644 |
| --- a/src/interpreter/bytecode-generator.cc |
| +++ b/src/interpreter/bytecode-generator.cc |
| @@ -362,16 +362,23 @@ 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. |
| // TODO(rmcilroy): Only emit a single context pop. |
|
rmcilroy
2016/03/08 17:33:40
nit - move TODO down below comment.
mythria
2016/03/09 10:24:45
Done.
|
| - generator()->builder()->PopContext(current->context()->reg()); |
| + // pop contexts only for break and continue. For Return and throw it is |
|
rmcilroy
2016/03/08 17:33:40
nit /s/pop/Pop
rmcilroy
2016/03/08 17:33:40
/s/Return/return
mythria
2016/03/09 10:24:44
Done.
mythria
2016/03/09 10:24:45
Done.
|
| + // not required to pop. Debuuger expects that the context is not popped on |
|
rmcilroy
2016/03/08 17:33:40
/s/debuuger/debugger
mythria
2016/03/09 10:24:45
Done.
|
| + // return. So do not pop on return. |
| + 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(); |
| } |