| 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/promise-utils.h" | 5 #include "src/promise-utils.h" |
| 6 | 6 |
| 7 #include "src/factory.h" | 7 #include "src/factory.h" |
| 8 #include "src/isolate.h" | 8 #include "src/isolate.h" |
| 9 #include "src/objects-inl.h" | 9 #include "src/objects-inl.h" |
| 10 | 10 |
| 11 namespace v8 { | 11 namespace v8 { |
| 12 namespace internal { | 12 namespace internal { |
| 13 | 13 |
| 14 enum PromiseResolvingFunctionContextSlot { | |
| 15 kAlreadyVisitedSlot = Context::MIN_CONTEXT_SLOTS, | |
| 16 kPromiseSlot, | |
| 17 kDebugEventSlot, | |
| 18 kPromiseContextLength, | |
| 19 }; | |
| 20 | |
| 21 JSObject* PromiseUtils::GetPromise(Handle<Context> context) { | 14 JSObject* PromiseUtils::GetPromise(Handle<Context> context) { |
| 22 return JSObject::cast(context->get(kPromiseSlot)); | 15 return JSObject::cast(context->get(kPromiseSlot)); |
| 23 } | 16 } |
| 24 | 17 |
| 25 Object* PromiseUtils::GetDebugEvent(Handle<Context> context) { | 18 Object* PromiseUtils::GetDebugEvent(Handle<Context> context) { |
| 26 return context->get(kDebugEventSlot); | 19 return context->get(kDebugEventSlot); |
| 27 } | 20 } |
| 28 | 21 |
| 29 bool PromiseUtils::HasAlreadyVisited(Handle<Context> context) { | 22 bool PromiseUtils::HasAlreadyVisited(Handle<Context> context) { |
| 30 return Smi::cast(context->get(kAlreadyVisitedSlot))->value() != 0; | 23 return Smi::cast(context->get(kAlreadyVisitedSlot))->value() != 0; |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 | 59 |
| 67 resolve_fun->set_context(*context); | 60 resolve_fun->set_context(*context); |
| 68 reject_fun->set_context(*context); | 61 reject_fun->set_context(*context); |
| 69 | 62 |
| 70 *resolve = resolve_fun; | 63 *resolve = resolve_fun; |
| 71 *reject = reject_fun; | 64 *reject = reject_fun; |
| 72 } | 65 } |
| 73 | 66 |
| 74 } // namespace internal | 67 } // namespace internal |
| 75 } // namespace v8 | 68 } // namespace v8 |
| OLD | NEW |