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 |
11 namespace v8 { | 11 namespace v8 { |
12 namespace internal { | 12 namespace internal { |
13 | 13 |
14 typedef compiler::Node Node; | |
15 typedef CodeStubAssembler::ParameterMode ParameterMode; | |
16 typedef compiler::CodeAssemblerState CodeAssemblerState; | 14 typedef compiler::CodeAssemblerState CodeAssemblerState; |
17 | 15 |
18 class PromiseBuiltinsAssembler : public CodeStubAssembler { | 16 class PromiseBuiltinsAssembler : public CodeStubAssembler { |
19 public: | 17 public: |
20 enum PromiseResolvingFunctionContextSlot { | 18 enum PromiseResolvingFunctionContextSlot { |
21 // Whether the resolve/reject callback was already called. | 19 // Whether the resolve/reject callback was already called. |
22 kAlreadyVisitedSlot = Context::MIN_CONTEXT_SLOTS, | 20 kAlreadyVisitedSlot = Context::MIN_CONTEXT_SLOTS, |
23 | 21 |
24 // The promise which resolve/reject callbacks fulfill. | 22 // The promise which resolve/reject callbacks fulfill. |
25 kPromiseSlot, | 23 kPromiseSlot, |
(...skipping 15 matching lines...) Expand all Loading... |
41 // | 39 // |
42 // This is also used by the PromiseValueThunkFinally to store the | 40 // This is also used by the PromiseValueThunkFinally to store the |
43 // value in the onFinallySlot and PromiseThrowerFinally to store the | 41 // value in the onFinallySlot and PromiseThrowerFinally to store the |
44 // reason in the onFinallySlot. | 42 // reason in the onFinallySlot. |
45 enum PromiseFinallyContextSlot { | 43 enum PromiseFinallyContextSlot { |
46 kOnFinallySlot = Context::MIN_CONTEXT_SLOTS, | 44 kOnFinallySlot = Context::MIN_CONTEXT_SLOTS, |
47 | 45 |
48 kOnFinallyContextLength, | 46 kOnFinallyContextLength, |
49 }; | 47 }; |
50 | 48 |
51 explicit PromiseBuiltinsAssembler(CodeAssemblerState* state) | 49 explicit PromiseBuiltinsAssembler(compiler::CodeAssemblerState* state) |
52 : CodeStubAssembler(state) {} | 50 : CodeStubAssembler(state) {} |
53 // These allocate and initialize a promise with pending state and | 51 // These allocate and initialize a promise with pending state and |
54 // undefined fields. | 52 // undefined fields. |
55 // | 53 // |
56 // This uses undefined as the parent promise for the promise init | 54 // This uses undefined as the parent promise for the promise init |
57 // hook. | 55 // hook. |
58 Node* AllocateAndInitJSPromise(Node* context); | 56 Node* AllocateAndInitJSPromise(Node* context); |
59 // This uses the given parent as the parent promise for the promise | 57 // This uses the given parent as the parent promise for the promise |
60 // init hook. | 58 // init hook. |
61 Node* AllocateAndInitJSPromise(Node* context, Node* parent); | 59 Node* AllocateAndInitJSPromise(Node* context, Node* parent); |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 Node* CreateThrowerFunction(Node* reason, Node* native_context); | 136 Node* CreateThrowerFunction(Node* reason, Node* native_context); |
139 | 137 |
140 private: | 138 private: |
141 Node* AllocateJSPromise(Node* context); | 139 Node* AllocateJSPromise(Node* context); |
142 }; | 140 }; |
143 | 141 |
144 } // namespace internal | 142 } // namespace internal |
145 } // namespace v8 | 143 } // namespace v8 |
146 | 144 |
147 #endif // V8_BUILTINS_BUILTINS_PROMISE_H_ | 145 #endif // V8_BUILTINS_BUILTINS_PROMISE_H_ |
OLD | NEW |