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

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

Issue 2667983004: [async-await] don't eagerly resolve Promise before finally blocks have executed
Patch Set: clean merge Created 3 years, 10 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 | src/parsing/parser.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 2152 matching lines...) Expand 10 before | Expand all | Expand 10 after
2163 } 2163 }
2164 2164
2165 void BytecodeGenerator::BuildVariableLoadForAccumulatorValue( 2165 void BytecodeGenerator::BuildVariableLoadForAccumulatorValue(
2166 Variable* variable, FeedbackVectorSlot slot, HoleCheckMode hole_check_mode, 2166 Variable* variable, FeedbackVectorSlot slot, HoleCheckMode hole_check_mode,
2167 TypeofMode typeof_mode) { 2167 TypeofMode typeof_mode) {
2168 ValueResultScope accumulator_result(this); 2168 ValueResultScope accumulator_result(this);
2169 BuildVariableLoad(variable, slot, hole_check_mode, typeof_mode); 2169 BuildVariableLoad(variable, slot, hole_check_mode, typeof_mode);
2170 } 2170 }
2171 2171
2172 void BytecodeGenerator::BuildReturn() { 2172 void BytecodeGenerator::BuildReturn() {
2173 if (IsAsyncFunction(info()->literal()->kind())) {
2174 RegisterAllocationScope register_scope(this);
2175 RegisterList args = register_allocator()->NewRegisterList(3);
2176 Register receiver = args[0];
2177 Register promise = args[1];
2178 Register return_value = args[2];
2179 builder()->StoreAccumulatorInRegister(return_value);
2180
2181 Variable* var_promise = scope()->promise_var();
2182 DCHECK_NOT_NULL(var_promise);
2183 BuildVariableLoad(var_promise, FeedbackVectorSlot::Invalid(),
2184 HoleCheckMode::kElided);
2185 builder()
2186 ->StoreAccumulatorInRegister(promise)
2187 .LoadUndefined()
2188 .StoreAccumulatorInRegister(receiver)
2189 .CallJSRuntime(Context::PROMISE_RESOLVE_INDEX, args)
2190 .LoadAccumulatorWithRegister(promise);
2191 }
2192
2173 if (FLAG_trace) { 2193 if (FLAG_trace) {
2174 RegisterAllocationScope register_scope(this); 2194 RegisterAllocationScope register_scope(this);
2175 Register result = register_allocator()->NewRegister(); 2195 Register result = register_allocator()->NewRegister();
2176 // Runtime returns {result} value, preserving accumulator. 2196 // Runtime returns {result} value, preserving accumulator.
2177 builder()->StoreAccumulatorInRegister(result).CallRuntime( 2197 builder()->StoreAccumulatorInRegister(result).CallRuntime(
2178 Runtime::kTraceExit, result); 2198 Runtime::kTraceExit, result);
2179 } 2199 }
2180 builder()->Return(); 2200 builder()->Return();
2181 } 2201 }
2182 2202
(...skipping 1396 matching lines...) Expand 10 before | Expand all | Expand 10 after
3579 } 3599 }
3580 3600
3581 Runtime::FunctionId BytecodeGenerator::StoreKeyedToSuperRuntimeId() { 3601 Runtime::FunctionId BytecodeGenerator::StoreKeyedToSuperRuntimeId() {
3582 return is_strict(language_mode()) ? Runtime::kStoreKeyedToSuper_Strict 3602 return is_strict(language_mode()) ? Runtime::kStoreKeyedToSuper_Strict
3583 : Runtime::kStoreKeyedToSuper_Sloppy; 3603 : Runtime::kStoreKeyedToSuper_Sloppy;
3584 } 3604 }
3585 3605
3586 } // namespace interpreter 3606 } // namespace interpreter
3587 } // namespace internal 3607 } // namespace internal
3588 } // namespace v8 3608 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/parsing/parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698