1 // Copyright 2018 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_OBJECTS_JS_PROMISE_INL_H_
6 #define V8_OBJECTS_JS_PROMISE_INL_H_
7
8 #include "src/objects/js-promise.h"
9
10 #include "src/objects/objects-inl.h" // Needed for write barriers
11 #include "src/objects/objects.h"
12
13 // Has to be the last include (doesn't have include guards):
14 #include "src/objects/object-macros.h"
15
16 namespace v8 {
17 namespace internal {
18
19 #include "torque-generated/src/objects/js-promise-tq-inl.inc"
20
21 TQ_OBJECT_CONSTRUCTORS_IMPL(JSPromise)
22
BOOL_ACCESSORS(JSPromise,flags,has_handler,HasHandlerBit::kShift)23 BOOL_ACCESSORS(JSPromise, flags, has_handler, HasHandlerBit::kShift)
24 BOOL_ACCESSORS(JSPromise, flags, handled_hint, HandledHintBit::kShift)
25
26 Object JSPromise::result() const {
27 DCHECK_NE(Promise::kPending, status());
28 return reactions_or_result();
29 }
30
reactions()31 Object JSPromise::reactions() const {
32 DCHECK_EQ(Promise::kPending, status());
33 return reactions_or_result();
34 }
35
36 } // namespace internal
37 } // namespace v8
38
39 #include "src/objects/object-macros-undef.h"
40
41 #endif // V8_OBJECTS_JS_PROMISE_INL_H_
42