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

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

Issue 2253033002: [interpreter] Don't assume generator functions do an initial yield. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 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
« no previous file with comments | « no previous file | test/cctest/interpreter/bytecode_expectations/Generators.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/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 858 matching lines...) Expand 10 before | Expand all | Expand 10 after
869 .JumpIfUndefined(&regular_call); 869 .JumpIfUndefined(&regular_call);
870 870
871 // This is a resume call. Restore registers and perform state dispatch. 871 // This is a resume call. Restore registers and perform state dispatch.
872 // (The current context has already been restored by the trampoline.) 872 // (The current context has already been restored by the trampoline.)
873 builder() 873 builder()
874 ->ResumeGenerator(generator_object) 874 ->ResumeGenerator(generator_object)
875 .StoreAccumulatorInRegister(generator_state_); 875 .StoreAccumulatorInRegister(generator_state_);
876 BuildIndexedJump(generator_state_, 0, generator_resume_points_.size(), 876 BuildIndexedJump(generator_state_, 0, generator_resume_points_.size(),
877 generator_resume_points_); 877 generator_resume_points_);
878 878
879 builder()->Bind(&regular_call); 879 builder()
880 ->Bind(&regular_call)
881 .LoadLiteral(Smi::FromInt(JSGeneratorObject::kGeneratorExecuting))
882 .StoreAccumulatorInRegister(generator_state_);
Dan Ehrenberg 2016/08/17 13:44:34 Looks like you're doing this extra load/store for
rmcilroy 2016/08/17 13:53:40 +1
880 // This is a regular call. Fall through to the ordinary function prologue, 883 // This is a regular call. Fall through to the ordinary function prologue,
881 // after which we will run into the generator object creation and other extra 884 // after which we will run into the generator object creation and other extra
882 // code inserted by the parser. 885 // code inserted by the parser.
883 } 886 }
884 887
885 void BytecodeGenerator::VisitBlock(Block* stmt) { 888 void BytecodeGenerator::VisitBlock(Block* stmt) {
886 // Visit declarations and statements. 889 // Visit declarations and statements.
887 if (stmt->scope() != nullptr && stmt->scope()->NeedsContext()) { 890 if (stmt->scope() != nullptr && stmt->scope()->NeedsContext()) {
888 VisitNewLocalBlockContext(stmt->scope()); 891 VisitNewLocalBlockContext(stmt->scope());
889 ContextScope scope(this, stmt->scope()); 892 ContextScope scope(this, stmt->scope());
(...skipping 2532 matching lines...) Expand 10 before | Expand all | Expand 10 after
3422 return execution_context()->scope()->language_mode(); 3425 return execution_context()->scope()->language_mode();
3423 } 3426 }
3424 3427
3425 int BytecodeGenerator::feedback_index(FeedbackVectorSlot slot) const { 3428 int BytecodeGenerator::feedback_index(FeedbackVectorSlot slot) const {
3426 return TypeFeedbackVector::GetIndex(slot); 3429 return TypeFeedbackVector::GetIndex(slot);
3427 } 3430 }
3428 3431
3429 } // namespace interpreter 3432 } // namespace interpreter
3430 } // namespace internal 3433 } // namespace internal
3431 } // namespace v8 3434 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | test/cctest/interpreter/bytecode_expectations/Generators.golden » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698