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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « no previous file | test/cctest/interpreter/bytecode_expectations/ContextVariables.golden » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/interpreter/bytecode-generator.h" 5 #include "src/interpreter/bytecode-generator.h"
6 6
7 #include "src/ast/scopes.h" 7 #include "src/ast/scopes.h"
8 #include "src/compiler.h" 8 #include "src/compiler.h"
9 #include "src/interpreter/bytecode-register-allocator.h" 9 #include "src/interpreter/bytecode-register-allocator.h"
10 #include "src/interpreter/control-flow-builders.h" 10 #include "src/interpreter/control-flow-builders.h"
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after
355 355
356 private: 356 private:
357 TryFinallyBuilder* try_finally_builder_; 357 TryFinallyBuilder* try_finally_builder_;
358 DeferredCommands* commands_; 358 DeferredCommands* commands_;
359 }; 359 };
360 360
361 361
362 void BytecodeGenerator::ControlScope::PerformCommand(Command command, 362 void BytecodeGenerator::ControlScope::PerformCommand(Command command,
363 Statement* statement) { 363 Statement* statement) {
364 ControlScope* current = this; 364 ControlScope* current = this;
365 ContextScope* context = this->context(); 365 ContextScope* context = generator()->execution_context();
366 do { 366 do {
367 if (current->Execute(command, statement)) { return; }
368 current = current->outer();
369 if (current->context() != context) { 367 if (current->context() != context) {
370 // Pop context to the expected depth. 368 // Pop context to the expected depth.
371 // TODO(rmcilroy): Only emit a single context pop. 369 // 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.
372 generator()->builder()->PopContext(current->context()->reg()); 370 // 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.
371 // 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.
372 // return. So do not pop on return.
373 if (command == CMD_BREAK || command == CMD_CONTINUE) {
374 generator()->builder()->PopContext(current->context()->reg());
375 }
373 context = current->context(); 376 context = current->context();
374 } 377 }
378 if (current->Execute(command, statement)) {
379 return;
380 }
381 current = current->outer();
375 } while (current != nullptr); 382 } while (current != nullptr);
376 UNREACHABLE(); 383 UNREACHABLE();
377 } 384 }
378 385
379 386
380 class BytecodeGenerator::RegisterAllocationScope { 387 class BytecodeGenerator::RegisterAllocationScope {
381 public: 388 public:
382 explicit RegisterAllocationScope(BytecodeGenerator* generator) 389 explicit RegisterAllocationScope(BytecodeGenerator* generator)
383 : generator_(generator), 390 : generator_(generator),
384 outer_(generator->register_allocator()), 391 outer_(generator->register_allocator()),
(...skipping 2757 matching lines...) Expand 10 before | Expand all | Expand 10 after
3142 } 3149 }
3143 3150
3144 3151
3145 int BytecodeGenerator::feedback_index(FeedbackVectorSlot slot) const { 3152 int BytecodeGenerator::feedback_index(FeedbackVectorSlot slot) const {
3146 return info()->feedback_vector()->GetIndex(slot); 3153 return info()->feedback_vector()->GetIndex(slot);
3147 } 3154 }
3148 3155
3149 } // namespace interpreter 3156 } // namespace interpreter
3150 } // namespace internal 3157 } // namespace internal
3151 } // namespace v8 3158 } // namespace v8
OLDNEW
« 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