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 
23 BOOL_ACCESSORS(JSPromise, flags, has_handler, HasHandlerBit::kShift)
24 BOOL_ACCESSORS(JSPromise, flags, handled_hint, HandledHintBit::kShift)
25 BOOL_ACCESSORS(JSPromise, flags, is_silent, IsSilentBit::kShift)
26 
result() const27 Object JSPromise::result() const {
28   DCHECK_NE(Promise::kPending, status());
29   return reactions_or_result();
30 }
31 
reactions() const32 Object JSPromise::reactions() const {
33   DCHECK_EQ(Promise::kPending, status());
34   return reactions_or_result();
35 }
36 
37 }  // namespace internal
38 }  // namespace v8
39 
40 #include "src/objects/object-macros-undef.h"
41 
42 #endif  // V8_OBJECTS_JS_PROMISE_INL_H_
43