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_PROMISE_UTILS_H_ | 5 #ifndef V8_PROMISE_UTILS_H_ |
6 #define V8_PROMISE_UTILS_H_ | 6 #define V8_PROMISE_UTILS_H_ |
7 | 7 |
| 8 #include "src/contexts.h" |
8 #include "src/objects.h" | 9 #include "src/objects.h" |
9 | 10 |
10 namespace v8 { | 11 namespace v8 { |
11 namespace internal { | 12 namespace internal { |
12 | 13 |
13 // Helper methods for Promise builtins. | 14 // Helper methods for Promise builtins. |
14 class PromiseUtils : public AllStatic { | 15 class PromiseUtils : public AllStatic { |
15 public: | 16 public: |
| 17 enum PromiseResolvingFunctionContextSlot { |
| 18 kAlreadyVisitedSlot = Context::MIN_CONTEXT_SLOTS, |
| 19 kPromiseSlot, |
| 20 kDebugEventSlot, |
| 21 kPromiseContextLength, |
| 22 }; |
| 23 |
16 // These get and set the slots on the PromiseResolvingContext, which | 24 // These get and set the slots on the PromiseResolvingContext, which |
17 // is used by the resolve/reject promise callbacks. | 25 // is used by the resolve/reject promise callbacks. |
18 static JSObject* GetPromise(Handle<Context> context); | 26 static JSObject* GetPromise(Handle<Context> context); |
19 static Object* GetDebugEvent(Handle<Context> context); | 27 static Object* GetDebugEvent(Handle<Context> context); |
20 static bool HasAlreadyVisited(Handle<Context> context); | 28 static bool HasAlreadyVisited(Handle<Context> context); |
21 static void SetAlreadyVisited(Handle<Context> context); | 29 static void SetAlreadyVisited(Handle<Context> context); |
22 | 30 |
23 static void CreateResolvingFunctions(Isolate* isolate, | 31 static void CreateResolvingFunctions(Isolate* isolate, |
24 Handle<JSObject> promise, | 32 Handle<JSObject> promise, |
25 Handle<Object> debug_event, | 33 Handle<Object> debug_event, |
26 Handle<JSFunction>* resolve, | 34 Handle<JSFunction>* resolve, |
27 Handle<JSFunction>* reject); | 35 Handle<JSFunction>* reject); |
28 }; | 36 }; |
29 } // namespace internal | 37 } // namespace internal |
30 } // namespace v8 | 38 } // namespace v8 |
31 | 39 |
32 #endif // V8_PROMISE_UTILS_H_ | 40 #endif // V8_PROMISE_UTILS_H_ |
OLD | NEW |