Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1023)

Unified Diff: src/interpreter/bytecode-generator.cc

Issue 1768123002: [Interpreter] Fixes a bug when popping context to correct level on break/continue. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fixed test-bytecode-generator tests Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | test/cctest/interpreter/bytecode_expectations/ContextVariables.golden » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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();
}
« no previous file with comments | « no previous file | test/cctest/interpreter/bytecode_expectations/ContextVariables.golden » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698