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; |
(...skipping 16 matching lines...) Expand all Loading... |
27 Node* AllocateAndInitJSPromise(Node* context, Node* parent); | 27 Node* AllocateAndInitJSPromise(Node* context, Node* parent); |
28 | 28 |
29 // This allocates and initializes a promise with the given state and | 29 // This allocates and initializes a promise with the given state and |
30 // fields. | 30 // fields. |
31 Node* AllocateAndSetJSPromise(Node* context, Node* status, Node* result); | 31 Node* AllocateAndSetJSPromise(Node* context, Node* status, Node* result); |
32 | 32 |
33 Node* AllocatePromiseResolveThenableJobInfo(Node* result, Node* then, | 33 Node* AllocatePromiseResolveThenableJobInfo(Node* result, Node* then, |
34 Node* resolve, Node* reject, | 34 Node* resolve, Node* reject, |
35 Node* context); | 35 Node* context); |
36 | 36 |
| 37 std::pair<Node*, Node*> CreatePromiseResolvingFunctions( |
| 38 Node* promise, Node* native_context, Node* promise_context); |
| 39 |
| 40 Node* PromiseHasHandler(Node* promise); |
| 41 |
| 42 Node* CreatePromiseResolvingFunctionsContext(Node* promise, Node* debug_event, |
| 43 Node* native_context); |
| 44 |
| 45 Node* CreatePromiseGetCapabilitiesExecutorContext(Node* native_context, |
| 46 Node* promise_capability); |
| 47 |
| 48 Node* NewPromiseCapability(Node* context, Node* constructor, |
| 49 Node* debug_event = nullptr); |
| 50 |
| 51 protected: |
| 52 void PromiseInit(Node* promise); |
| 53 |
37 Node* ThrowIfNotJSReceiver(Node* context, Node* value, | 54 Node* ThrowIfNotJSReceiver(Node* context, Node* value, |
38 MessageTemplate::Template msg_template, | 55 MessageTemplate::Template msg_template, |
39 const char* method_name = nullptr); | 56 const char* method_name = nullptr); |
40 | 57 |
41 Node* SpeciesConstructor(Node* context, Node* object, | 58 Node* SpeciesConstructor(Node* context, Node* object, |
42 Node* default_constructor); | 59 Node* default_constructor); |
43 | 60 |
44 Node* PromiseHasHandler(Node* promise); | |
45 | |
46 void PromiseSetHasHandler(Node* promise); | 61 void PromiseSetHasHandler(Node* promise); |
47 | 62 |
48 void AppendPromiseCallback(int offset, compiler::Node* promise, | 63 void AppendPromiseCallback(int offset, compiler::Node* promise, |
49 compiler::Node* value); | 64 compiler::Node* value); |
50 | 65 |
51 Node* InternalPromiseThen(Node* context, Node* promise, Node* on_resolve, | 66 Node* InternalPromiseThen(Node* context, Node* promise, Node* on_resolve, |
52 Node* on_reject); | 67 Node* on_reject); |
53 | 68 |
54 Node* InternalPerformPromiseThen(Node* context, Node* promise, | 69 Node* InternalPerformPromiseThen(Node* context, Node* promise, |
55 Node* on_resolve, Node* on_reject, | 70 Node* on_resolve, Node* on_reject, |
56 Node* deferred_promise, | 71 Node* deferred_promise, |
57 Node* deferred_on_resolve, | 72 Node* deferred_on_resolve, |
58 Node* deferred_on_reject); | 73 Node* deferred_on_reject); |
59 | 74 |
60 void InternalResolvePromise(Node* context, Node* promise, Node* result); | 75 void InternalResolvePromise(Node* context, Node* promise, Node* result); |
61 | 76 |
62 void BranchIfFastPath(Node* context, Node* promise, Label* if_isunmodified, | 77 void BranchIfFastPath(Node* context, Node* promise, Label* if_isunmodified, |
63 Label* if_ismodified); | 78 Label* if_ismodified); |
64 | 79 |
65 void BranchIfFastPath(Node* native_context, Node* promise_fun, Node* promise, | 80 void BranchIfFastPath(Node* native_context, Node* promise_fun, Node* promise, |
66 Label* if_isunmodified, Label* if_ismodified); | 81 Label* if_isunmodified, Label* if_ismodified); |
67 | 82 |
68 Node* CreatePromiseContext(Node* native_context, int slots); | 83 Node* CreatePromiseContext(Node* native_context, int slots); |
69 Node* CreatePromiseResolvingFunctionsContext(Node* promise, Node* debug_event, | |
70 Node* native_context); | |
71 | |
72 std::pair<Node*, Node*> CreatePromiseResolvingFunctions( | |
73 Node* promise, Node* native_context, Node* promise_context); | |
74 | |
75 Node* CreatePromiseGetCapabilitiesExecutorContext(Node* native_context, | |
76 Node* promise_capability); | |
77 | |
78 void PromiseFulfill(Node* context, Node* promise, Node* result, | 84 void PromiseFulfill(Node* context, Node* promise, Node* result, |
79 v8::Promise::PromiseState status); | 85 v8::Promise::PromiseState status); |
80 | 86 |
81 Node* NewPromiseCapability(Node* context, Node* constructor, | |
82 Node* debug_event = nullptr); | |
83 | |
84 void BranchIfAccessCheckFailed(Node* context, Node* native_context, | 87 void BranchIfAccessCheckFailed(Node* context, Node* native_context, |
85 Node* promise_constructor, Node* executor, | 88 Node* promise_constructor, Node* executor, |
86 Label* if_noaccess); | 89 Label* if_noaccess); |
87 | 90 |
88 protected: | 91 void InternalPromiseReject(Node* context, Node* promise, Node* value, |
89 void PromiseInit(Node* promise); | 92 bool debug_event); |
| 93 void InternalPromiseReject(Node* context, Node* promise, Node* value, |
| 94 Node* debug_event); |
90 | 95 |
91 private: | 96 private: |
92 Node* AllocateJSPromise(Node* context); | 97 Node* AllocateJSPromise(Node* context); |
93 }; | 98 }; |
94 | 99 |
95 } // namespace internal | 100 } // namespace internal |
96 } // namespace v8 | 101 } // namespace v8 |
OLD | NEW |