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-constructor.h" | 6 #include "src/builtins/builtins-constructor.h" |
7 #include "src/builtins/builtins-utils.h" | 7 #include "src/builtins/builtins-utils.h" |
8 #include "src/builtins/builtins.h" | 8 #include "src/builtins/builtins.h" |
9 #include "src/code-factory.h" | 9 #include "src/code-factory.h" |
10 #include "src/code-stub-assembler.h" | 10 #include "src/code-stub-assembler.h" |
11 #include "src/objects-inl.h" | 11 #include "src/objects-inl.h" |
12 | 12 |
13 namespace v8 { | 13 namespace v8 { |
14 namespace internal { | 14 namespace internal { |
15 | 15 |
16 typedef compiler::Node Node; | |
17 typedef CodeStubAssembler::ParameterMode ParameterMode; | |
18 typedef compiler::CodeAssemblerState CodeAssemblerState; | |
19 | |
20 Node* PromiseBuiltinsAssembler::AllocateJSPromise(Node* context) { | 16 Node* PromiseBuiltinsAssembler::AllocateJSPromise(Node* context) { |
21 Node* const native_context = LoadNativeContext(context); | 17 Node* const native_context = LoadNativeContext(context); |
22 Node* const promise_fun = | 18 Node* const promise_fun = |
23 LoadContextElement(native_context, Context::PROMISE_FUNCTION_INDEX); | 19 LoadContextElement(native_context, Context::PROMISE_FUNCTION_INDEX); |
24 Node* const initial_map = | 20 Node* const initial_map = |
25 LoadObjectField(promise_fun, JSFunction::kPrototypeOrInitialMapOffset); | 21 LoadObjectField(promise_fun, JSFunction::kPrototypeOrInitialMapOffset); |
26 Node* const instance = AllocateJSObjectFromMap(initial_map); | 22 Node* const instance = AllocateJSObjectFromMap(initial_map); |
27 return instance; | 23 return instance; |
28 } | 24 } |
29 | 25 |
(...skipping 1742 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1772 // 5. Return ? Invoke(promise, "then", « thenFinally, catchFinally »). | 1768 // 5. Return ? Invoke(promise, "then", « thenFinally, catchFinally »). |
1773 Node* const result = | 1769 Node* const result = |
1774 CallJS(call_callable, context, then, promise, var_then_finally.value(), | 1770 CallJS(call_callable, context, then, promise, var_then_finally.value(), |
1775 var_catch_finally.value()); | 1771 var_catch_finally.value()); |
1776 Return(result); | 1772 Return(result); |
1777 } | 1773 } |
1778 } | 1774 } |
1779 | 1775 |
1780 } // namespace internal | 1776 } // namespace internal |
1781 } // namespace v8 | 1777 } // namespace v8 |
OLD | NEW |