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/code-stub-assembler.h" | 5 #include "src/code-stub-assembler.h" |
6 | 6 |
7 namespace v8 { | 7 namespace v8 { |
8 namespace internal { | 8 namespace internal { |
9 | 9 |
10 typedef compiler::Node Node; | 10 typedef compiler::Node Node; |
11 typedef CodeStubAssembler::ParameterMode ParameterMode; | 11 typedef CodeStubAssembler::ParameterMode ParameterMode; |
12 typedef compiler::CodeAssemblerState CodeAssemblerState; | 12 typedef compiler::CodeAssemblerState CodeAssemblerState; |
13 | 13 |
14 class PromiseBuiltinsAssembler : public CodeStubAssembler { | 14 class PromiseBuiltinsAssembler : public CodeStubAssembler { |
15 public: | 15 public: |
16 explicit PromiseBuiltinsAssembler(CodeAssemblerState* state) | 16 explicit PromiseBuiltinsAssembler(CodeAssemblerState* state) |
17 : CodeStubAssembler(state) {} | 17 : CodeStubAssembler(state) {} |
18 | 18 |
19 Node* AllocateAndInitPromise(Node* context, Node* parent); | 19 // These allocate and initialize a promise with pending state and |
| 20 // undefined fields. |
| 21 // |
| 22 // This uses undefined as the parent promise for the promise init |
| 23 // hook. |
| 24 Node* AllocateAndInitJSPromise(Node* context); |
| 25 // This uses the given parent as the parent promise for the promise |
| 26 // init hook. |
| 27 Node* AllocateAndInitJSPromise(Node* context, Node* parent); |
| 28 |
| 29 // This allocates and initializes a promise with the given state and |
| 30 // fields. |
| 31 Node* AllocateAndSetJSPromise(Node* context, Node* status, Node* result); |
20 | 32 |
21 Node* ThrowIfNotJSReceiver(Node* context, Node* value, | 33 Node* ThrowIfNotJSReceiver(Node* context, Node* value, |
22 MessageTemplate::Template msg_template); | 34 MessageTemplate::Template msg_template); |
23 | 35 |
24 Node* SpeciesConstructor(Node* context, Node* object, | 36 Node* SpeciesConstructor(Node* context, Node* object, |
25 Node* default_constructor); | 37 Node* default_constructor); |
26 | 38 |
27 Node* PromiseHasHandler(Node* promise); | 39 Node* PromiseHasHandler(Node* promise); |
28 | 40 |
29 void PromiseSetHasHandler(Node* promise); | 41 void PromiseSetHasHandler(Node* promise); |
(...skipping 20 matching lines...) Expand all Loading... |
50 Node* native_context); | 62 Node* native_context); |
51 | 63 |
52 std::pair<Node*, Node*> CreatePromiseResolvingFunctions( | 64 std::pair<Node*, Node*> CreatePromiseResolvingFunctions( |
53 Node* promise, Node* native_context, Node* promise_context); | 65 Node* promise, Node* native_context, Node* promise_context); |
54 | 66 |
55 Node* CreatePromiseGetCapabilitiesExecutorContext(Node* native_context, | 67 Node* CreatePromiseGetCapabilitiesExecutorContext(Node* native_context, |
56 Node* promise_capability); | 68 Node* promise_capability); |
57 | 69 |
58 Node* NewPromiseCapability(Node* context, Node* constructor, | 70 Node* NewPromiseCapability(Node* context, Node* constructor, |
59 Node* debug_event = nullptr); | 71 Node* debug_event = nullptr); |
| 72 |
| 73 protected: |
| 74 void PromiseInit(Node* promise); |
| 75 |
| 76 private: |
| 77 Node* AllocateJSPromise(Node* context); |
60 }; | 78 }; |
61 | 79 |
62 } // namespace internal | 80 } // namespace internal |
63 } // namespace v8 | 81 } // namespace v8 |
OLD | NEW |