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

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

Issue 2936813002: Move closing of generators upon final return to the generator-resume builtin. (Closed)
Patch Set: Add TODO Created 3 years, 6 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 | « src/builtins/builtins-generator-gen.cc ('k') | src/parsing/rewriter.cc » ('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/compile-time-value.h" 7 #include "src/ast/compile-time-value.h"
8 #include "src/ast/scopes.h" 8 #include "src/ast/scopes.h"
9 #include "src/builtins/builtins-constructor.h" 9 #include "src/builtins/builtins-constructor.h"
10 #include "src/code-stubs.h" 10 #include "src/code-stubs.h"
(...skipping 2231 matching lines...) Expand 10 before | Expand all | Expand 10 after
2242 if (FLAG_trace) { 2242 if (FLAG_trace) {
2243 RegisterAllocationScope register_scope(this); 2243 RegisterAllocationScope register_scope(this);
2244 Register result = register_allocator()->NewRegister(); 2244 Register result = register_allocator()->NewRegister();
2245 // Runtime returns {result} value, preserving accumulator. 2245 // Runtime returns {result} value, preserving accumulator.
2246 builder()->StoreAccumulatorInRegister(result).CallRuntime( 2246 builder()->StoreAccumulatorInRegister(result).CallRuntime(
2247 Runtime::kTraceExit, result); 2247 Runtime::kTraceExit, result);
2248 } 2248 }
2249 if (info()->literal()->feedback_vector_spec()->HasTypeProfileSlot()) { 2249 if (info()->literal()->feedback_vector_spec()->HasTypeProfileSlot()) {
2250 builder()->CollectTypeProfile(info()->literal()->return_position()); 2250 builder()->CollectTypeProfile(info()->literal()->return_position());
2251 } 2251 }
2252 if (IsGeneratorFunction(info()->literal()->kind())) { 2252 if (IsAsyncGeneratorFunction(info()->literal()->kind())) {
2253 // Mark the generator as closed if returning from a generator function. 2253 // Mark the generator as closed if returning from an async generator
2254 // function. Note that non-async generators are closed by the
2255 // generator-resume builtin.
2256
2257 // TODO(jarin,caitp) Move the async generator closing to the resume
2258 // builtin.
2254 RegisterAllocationScope register_scope(this); 2259 RegisterAllocationScope register_scope(this);
2255 Register result = register_allocator()->NewRegister(); 2260 Register result = register_allocator()->NewRegister();
2256 builder() 2261 builder()
2257 ->StoreAccumulatorInRegister(result) 2262 ->StoreAccumulatorInRegister(result)
2258 .CallRuntime(Runtime::kInlineGeneratorClose, generator_object_) 2263 .CallRuntime(Runtime::kInlineGeneratorClose, generator_object_)
2259 .LoadAccumulatorWithRegister(result); 2264 .LoadAccumulatorWithRegister(result);
2260 } 2265 }
2261 builder()->Return(); 2266 builder()->Return();
2262 } 2267 }
2263 2268
(...skipping 1723 matching lines...) Expand 10 before | Expand all | Expand 10 after
3987 } 3992 }
3988 3993
3989 Runtime::FunctionId BytecodeGenerator::StoreKeyedToSuperRuntimeId() { 3994 Runtime::FunctionId BytecodeGenerator::StoreKeyedToSuperRuntimeId() {
3990 return is_strict(language_mode()) ? Runtime::kStoreKeyedToSuper_Strict 3995 return is_strict(language_mode()) ? Runtime::kStoreKeyedToSuper_Strict
3991 : Runtime::kStoreKeyedToSuper_Sloppy; 3996 : Runtime::kStoreKeyedToSuper_Sloppy;
3992 } 3997 }
3993 3998
3994 } // namespace interpreter 3999 } // namespace interpreter
3995 } // namespace internal 4000 } // namespace internal
3996 } // namespace v8 4001 } // namespace v8
OLDNEW
« no previous file with comments | « src/builtins/builtins-generator-gen.cc ('k') | src/parsing/rewriter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698