| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef V8_PROMISE_UTILS_H_ | |
| 6 #define V8_PROMISE_UTILS_H_ | |
| 7 | |
| 8 #include "src/contexts.h" | |
| 9 #include "src/objects.h" | |
| 10 | |
| 11 namespace v8 { | |
| 12 namespace internal { | |
| 13 | |
| 14 // Helper methods for Promise builtins. | |
| 15 class PromiseUtils : public AllStatic { | |
| 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 // These get and set the slots on the PromiseResolvingContext, which | |
| 31 // is used by the resolve/reject promise callbacks. | |
| 32 static JSPromise* GetPromise(Handle<Context> context); | |
| 33 static Object* GetDebugEvent(Handle<Context> context); | |
| 34 static bool HasAlreadyVisited(Handle<Context> context); | |
| 35 static void SetAlreadyVisited(Handle<Context> context); | |
| 36 }; | |
| 37 | |
| 38 class GetPromiseCapabilityExecutor : public AllStatic { | |
| 39 public: | |
| 40 enum FunctionContextSlot { | |
| 41 kCapabilitySlot = Context::MIN_CONTEXT_SLOTS, | |
| 42 | |
| 43 kContextLength, | |
| 44 }; | |
| 45 }; | |
| 46 | |
| 47 } // namespace internal | |
| 48 } // namespace v8 | |
| 49 | |
| 50 #endif // V8_PROMISE_UTILS_H_ | |
| OLD | NEW |