Line data Source code
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 : OBJECT_CONSTRUCTORS_IMPL(JSPromise, JSObject)
20 : CAST_ACCESSOR(JSPromise)
21 :
22 653643 : ACCESSORS(JSPromise, reactions_or_result, Object, kReactionsOrResultOffset)
23 327292 : SMI_ACCESSORS(JSPromise, flags, kFlagsOffset)
24 8676 : BOOL_ACCESSORS(JSPromise, flags, has_handler, kHasHandlerBit)
25 6844 : BOOL_ACCESSORS(JSPromise, flags, handled_hint, kHandledHintBit)
26 :
27 : Object JSPromise::result() const {
28 : DCHECK_NE(Promise::kPending, status());
29 : return reactions_or_result();
30 : }
31 :
32 : 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_
|