| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |