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-inl.h" // Needed for write barriers
11 #include "src/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 CAST_ACCESSOR(JSPromise)
20
ACCESSORS(JSPromise,reactions_or_result,Object,kReactionsOrResultOffset)21 ACCESSORS(JSPromise, reactions_or_result, Object, kReactionsOrResultOffset)
22 SMI_ACCESSORS(JSPromise, flags, kFlagsOffset)
23 BOOL_ACCESSORS(JSPromise, flags, has_handler, kHasHandlerBit)
24 BOOL_ACCESSORS(JSPromise, flags, handled_hint, kHandledHintBit)
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