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

Side by Side Diff: src/interpreter/bytecode-generator.cc

Issue 2172233002: [interpreter] Add explicit OSR polling bytecode. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@local_interpreter-osr-1
Patch Set: Minor cleanups. Created 4 years, 4 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
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/code-stubs.h" 8 #include "src/code-stubs.h"
9 #include "src/compiler.h" 9 #include "src/compiler.h"
10 #include "src/interpreter/bytecode-flags.h" 10 #include "src/interpreter/bytecode-flags.h"
(...skipping 646 matching lines...) Expand 10 before | Expand all | Expand 10 after
657 // If we are resuming, perform state dispatch. 657 // If we are resuming, perform state dispatch.
658 BytecodeLabel not_resuming; 658 BytecodeLabel not_resuming;
659 builder() 659 builder()
660 ->LoadLiteral(Smi::FromInt(JSGeneratorObject::kGeneratorExecuting)) 660 ->LoadLiteral(Smi::FromInt(JSGeneratorObject::kGeneratorExecuting))
661 .CompareOperation(Token::Value::EQ, generator_state_) 661 .CompareOperation(Token::Value::EQ, generator_state_)
662 .JumpIfTrue(&not_resuming); 662 .JumpIfTrue(&not_resuming);
663 BuildIndexedJump(generator_state_, first_yield, 663 BuildIndexedJump(generator_state_, first_yield,
664 stmt->yield_count(), generator_resume_points_); 664 stmt->yield_count(), generator_resume_points_);
665 builder()->Bind(&not_resuming); 665 builder()->Bind(&not_resuming);
666 } 666 }
667
668 // Insert an explicit {OsrPoll} right after the loop header, to trigger
669 // on-stack replacement when armed for the given loop nesting depth.
rmcilroy 2016/07/25 12:40:23 Should this be before the generator resume logic (
Michael Starzinger 2016/07/25 13:40:48 Done. Yes, I am not 100% sure about interaction wi
rmcilroy 2016/07/26 09:26:44 Acknowledged.
670 if (FLAG_ignition_osr) {
671 // TODO(4764): Merge this with another bytecode (e.g. {Jump} back edge).
672 // TODO(4764): Investigate interaction with generators.
673 // TODO(4764): Track and pass correct loop depth.
674 DCHECK_EQ(0, stmt->yield_count());
675 builder()->OsrPoll(0);
676 }
667 } 677 }
668 678
669 void BytecodeGenerator::VisitGeneratorPrologue() { 679 void BytecodeGenerator::VisitGeneratorPrologue() {
670 // The generator resume trampoline abuses the new.target register both to 680 // The generator resume trampoline abuses the new.target register both to
671 // indicate that this is a resume call and to pass in the generator object. 681 // indicate that this is a resume call and to pass in the generator object.
672 // In ordinary calls, new.target is always undefined because generator 682 // In ordinary calls, new.target is always undefined because generator
673 // functions are non-constructable. 683 // functions are non-constructable.
674 Register generator_object = Register::new_target(); 684 Register generator_object = Register::new_target();
675 BytecodeLabel regular_call; 685 BytecodeLabel regular_call;
676 builder() 686 builder()
(...skipping 2502 matching lines...) Expand 10 before | Expand all | Expand 10 after
3179 return execution_context()->scope()->language_mode(); 3189 return execution_context()->scope()->language_mode();
3180 } 3190 }
3181 3191
3182 int BytecodeGenerator::feedback_index(FeedbackVectorSlot slot) const { 3192 int BytecodeGenerator::feedback_index(FeedbackVectorSlot slot) const {
3183 return TypeFeedbackVector::GetIndex(slot); 3193 return TypeFeedbackVector::GetIndex(slot);
3184 } 3194 }
3185 3195
3186 } // namespace interpreter 3196 } // namespace interpreter
3187 } // namespace internal 3197 } // namespace internal
3188 } // namespace v8 3198 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698