| 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 #ifndef V8_BUILTINS_BUILTINS_PROMISE_H_ | 5 #ifndef V8_BUILTINS_BUILTINS_PROMISE_H_ |
| 6 #define V8_BUILTINS_BUILTINS_PROMISE_H_ | 6 #define V8_BUILTINS_BUILTINS_PROMISE_H_ |
| 7 | 7 |
| 8 #include "src/code-stub-assembler.h" | 8 #include "src/code-stub-assembler.h" |
| 9 #include "src/contexts.h" | 9 #include "src/contexts.h" |
| 10 | 10 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 kDebugEventSlot, | 29 kDebugEventSlot, |
| 30 kPromiseContextLength, | 30 kPromiseContextLength, |
| 31 }; | 31 }; |
| 32 | 32 |
| 33 enum FunctionContextSlot { | 33 enum FunctionContextSlot { |
| 34 kCapabilitySlot = Context::MIN_CONTEXT_SLOTS, | 34 kCapabilitySlot = Context::MIN_CONTEXT_SLOTS, |
| 35 | 35 |
| 36 kCapabilitiesContextLength, | 36 kCapabilitiesContextLength, |
| 37 }; | 37 }; |
| 38 | 38 |
| 39 // This is used by the PromiseThenFinally and PromiseCatchFinally |
| 40 // builtins to store the onFinally in the onFinallySlot. |
| 41 // |
| 42 // This is also used by the PromiseValueThunkFinally to store the |
| 43 // value in the onFinallySlot and PromiseThrowerFinally to store the |
| 44 // reason in the onFinallySlot. |
| 45 enum PromiseFinallyContextSlot { |
| 46 kOnFinallySlot = Context::MIN_CONTEXT_SLOTS, |
| 47 |
| 48 kOnFinallyContextLength, |
| 49 }; |
| 50 |
| 39 explicit PromiseBuiltinsAssembler(CodeAssemblerState* state) | 51 explicit PromiseBuiltinsAssembler(CodeAssemblerState* state) |
| 40 : CodeStubAssembler(state) {} | 52 : CodeStubAssembler(state) {} |
| 41 // These allocate and initialize a promise with pending state and | 53 // These allocate and initialize a promise with pending state and |
| 42 // undefined fields. | 54 // undefined fields. |
| 43 // | 55 // |
| 44 // This uses undefined as the parent promise for the promise init | 56 // This uses undefined as the parent promise for the promise init |
| 45 // hook. | 57 // hook. |
| 46 Node* AllocateAndInitJSPromise(Node* context); | 58 Node* AllocateAndInitJSPromise(Node* context); |
| 47 // This uses the given parent as the parent promise for the promise | 59 // This uses the given parent as the parent promise for the promise |
| 48 // init hook. | 60 // init hook. |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 v8::Promise::PromiseState status); | 120 v8::Promise::PromiseState status); |
| 109 | 121 |
| 110 void BranchIfAccessCheckFailed(Node* context, Node* native_context, | 122 void BranchIfAccessCheckFailed(Node* context, Node* native_context, |
| 111 Node* promise_constructor, Node* executor, | 123 Node* promise_constructor, Node* executor, |
| 112 Label* if_noaccess); | 124 Label* if_noaccess); |
| 113 | 125 |
| 114 void InternalPromiseReject(Node* context, Node* promise, Node* value, | 126 void InternalPromiseReject(Node* context, Node* promise, Node* value, |
| 115 bool debug_event); | 127 bool debug_event); |
| 116 void InternalPromiseReject(Node* context, Node* promise, Node* value, | 128 void InternalPromiseReject(Node* context, Node* promise, Node* value, |
| 117 Node* debug_event); | 129 Node* debug_event); |
| 130 std::pair<Node*, Node*> CreatePromiseFinallyFunctions(Node* on_finally, |
| 131 Node* native_context); |
| 132 Node* CreatePromiseFinallyContext(Node* on_finally, Node* native_context); |
| 133 |
| 134 Node* CreateValueThunkFunction(Node* value, Node* native_context); |
| 135 Node* CreateValueThunkFunctionContext(Node* value, Node* native_context); |
| 136 |
| 137 Node* CreateThrowerFunctionContext(Node* reason, Node* native_context); |
| 138 Node* CreateThrowerFunction(Node* reason, Node* native_context); |
| 118 | 139 |
| 119 private: | 140 private: |
| 120 Node* AllocateJSPromise(Node* context); | 141 Node* AllocateJSPromise(Node* context); |
| 121 }; | 142 }; |
| 122 | 143 |
| 123 } // namespace internal | 144 } // namespace internal |
| 124 } // namespace v8 | 145 } // namespace v8 |
| 125 | 146 |
| 126 #endif // V8_BUILTINS_BUILTINS_PROMISE_H_ | 147 #endif // V8_BUILTINS_BUILTINS_PROMISE_H_ |
| OLD | NEW |