| OLD | NEW |
| 1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 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/builtins/builtins-promise.h" | 5 #include "src/builtins/builtins-promise.h" |
| 6 #include "src/builtins/builtins-utils.h" | 6 #include "src/builtins/builtins-utils.h" |
| 7 #include "src/builtins/builtins.h" | 7 #include "src/builtins/builtins.h" |
| 8 #include "src/code-factory.h" | 8 #include "src/code-factory.h" |
| 9 #include "src/code-stub-assembler.h" | 9 #include "src/code-stub-assembler.h" |
| 10 #include "src/promise-utils.h" | 10 #include "src/promise-utils.h" |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 Variable var_deferred_promise(this, MachineRepresentation::kTagged), | 218 Variable var_deferred_promise(this, MachineRepresentation::kTagged), |
| 219 var_deferred_on_resolve(this, MachineRepresentation::kTagged), | 219 var_deferred_on_resolve(this, MachineRepresentation::kTagged), |
| 220 var_deferred_on_reject(this, MachineRepresentation::kTagged); | 220 var_deferred_on_reject(this, MachineRepresentation::kTagged); |
| 221 | 221 |
| 222 Branch(WordEqual(promise_fun, constructor), &fast_promise_capability, | 222 Branch(WordEqual(promise_fun, constructor), &fast_promise_capability, |
| 223 &promise_capability); | 223 &promise_capability); |
| 224 | 224 |
| 225 Bind(&fast_promise_capability); | 225 Bind(&fast_promise_capability); |
| 226 { | 226 { |
| 227 Node* const deferred_promise = AllocateAndInitPromise(context, promise); | 227 Node* const deferred_promise = AllocateAndInitPromise(context, promise); |
| 228 PromiseInit(deferred_promise); | |
| 229 var_deferred_promise.Bind(deferred_promise); | 228 var_deferred_promise.Bind(deferred_promise); |
| 230 var_deferred_on_resolve.Bind(UndefinedConstant()); | 229 var_deferred_on_resolve.Bind(UndefinedConstant()); |
| 231 var_deferred_on_reject.Bind(UndefinedConstant()); | 230 var_deferred_on_reject.Bind(UndefinedConstant()); |
| 232 Goto(&perform_promise_then); | 231 Goto(&perform_promise_then); |
| 233 } | 232 } |
| 234 | 233 |
| 235 Bind(&promise_capability); | 234 Bind(&promise_capability); |
| 236 { | 235 { |
| 237 // TODO(gsathya): Move this to TF. | 236 // TODO(gsathya): Move this to TF. |
| 238 Node* const new_promise_capability = LoadContextElement( | 237 Node* const new_promise_capability = LoadContextElement( |
| (...skipping 825 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1064 CallStub(getproperty_callable, context, promise, then_str); | 1063 CallStub(getproperty_callable, context, promise, then_str); |
| 1065 Callable call_callable = CodeFactory::Call(isolate); | 1064 Callable call_callable = CodeFactory::Call(isolate); |
| 1066 Node* const result = | 1065 Node* const result = |
| 1067 CallJS(call_callable, context, then, promise, on_resolve, on_reject); | 1066 CallJS(call_callable, context, then, promise, on_resolve, on_reject); |
| 1068 Return(result); | 1067 Return(result); |
| 1069 } | 1068 } |
| 1070 } | 1069 } |
| 1071 | 1070 |
| 1072 } // namespace internal | 1071 } // namespace internal |
| 1073 } // namespace v8 | 1072 } // namespace v8 |
| OLD | NEW |