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 #include "src/contexts.h" |
6 | 7 |
7 namespace v8 { | 8 namespace v8 { |
8 namespace internal { | 9 namespace internal { |
9 | 10 |
10 typedef compiler::Node Node; | 11 typedef compiler::Node Node; |
11 typedef CodeStubAssembler::ParameterMode ParameterMode; | 12 typedef CodeStubAssembler::ParameterMode ParameterMode; |
12 typedef compiler::CodeAssemblerState CodeAssemblerState; | 13 typedef compiler::CodeAssemblerState CodeAssemblerState; |
13 | 14 |
14 class PromiseBuiltinsAssembler : public CodeStubAssembler { | 15 class PromiseBuiltinsAssembler : public CodeStubAssembler { |
15 public: | 16 public: |
| 17 enum PromiseResolvingFunctionContextSlot { |
| 18 // Whether the resolve/reject callback was already called. |
| 19 kAlreadyVisitedSlot = Context::MIN_CONTEXT_SLOTS, |
| 20 |
| 21 // The promise which resolve/reject callbacks fulfill. |
| 22 kPromiseSlot, |
| 23 |
| 24 // Whether to trigger a debug event or not. Used in catch |
| 25 // prediction. |
| 26 kDebugEventSlot, |
| 27 kPromiseContextLength, |
| 28 }; |
| 29 |
| 30 enum FunctionContextSlot { |
| 31 kCapabilitySlot = Context::MIN_CONTEXT_SLOTS, |
| 32 |
| 33 kCapabilitiesContextLength, |
| 34 }; |
| 35 |
16 explicit PromiseBuiltinsAssembler(CodeAssemblerState* state) | 36 explicit PromiseBuiltinsAssembler(CodeAssemblerState* state) |
17 : CodeStubAssembler(state) {} | 37 : CodeStubAssembler(state) {} |
18 | |
19 // These allocate and initialize a promise with pending state and | 38 // These allocate and initialize a promise with pending state and |
20 // undefined fields. | 39 // undefined fields. |
21 // | 40 // |
22 // This uses undefined as the parent promise for the promise init | 41 // This uses undefined as the parent promise for the promise init |
23 // hook. | 42 // hook. |
24 Node* AllocateAndInitJSPromise(Node* context); | 43 Node* AllocateAndInitJSPromise(Node* context); |
25 // This uses the given parent as the parent promise for the promise | 44 // This uses the given parent as the parent promise for the promise |
26 // init hook. | 45 // init hook. |
27 Node* AllocateAndInitJSPromise(Node* context, Node* parent); | 46 Node* AllocateAndInitJSPromise(Node* context, Node* parent); |
28 | 47 |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 bool debug_event); | 111 bool debug_event); |
93 void InternalPromiseReject(Node* context, Node* promise, Node* value, | 112 void InternalPromiseReject(Node* context, Node* promise, Node* value, |
94 Node* debug_event); | 113 Node* debug_event); |
95 | 114 |
96 private: | 115 private: |
97 Node* AllocateJSPromise(Node* context); | 116 Node* AllocateJSPromise(Node* context); |
98 }; | 117 }; |
99 | 118 |
100 } // namespace internal | 119 } // namespace internal |
101 } // namespace v8 | 120 } // namespace v8 |
OLD | NEW |