v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
js-promise-inl.h
Go to the documentation of this file.
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
9// Include the non-inl header before the rest of the headers.
10
11#include "src/objects/objects-inl.h" // Needed for write barriers
12#include "src/objects/objects.h"
13
14// Has to be the last include (doesn't have include guards):
16
17namespace v8 {
18namespace internal {
19
20#include "torque-generated/src/objects/js-promise-tq-inl.inc"
21
23
24BOOL_ACCESSORS(JSPromise, flags, has_handler, HasHandlerBit::kShift)
25BOOL_ACCESSORS(JSPromise, flags, is_silent, IsSilentBit::kShift)
26
27// static
28uint32_t JSPromise::GetNextAsyncTaskId(uint32_t async_task_id) {
29 do {
30 ++async_task_id;
31 async_task_id &= AsyncTaskIdBits::kMax;
32 } while (async_task_id == kInvalidAsyncTaskId);
33 return async_task_id;
34}
35
39
40uint32_t JSPromise::async_task_id() const {
41 return AsyncTaskIdBits::decode(flags());
42}
43
45 set_flags(AsyncTaskIdBits::update(flags(), id));
46}
47
50 return reactions_or_result();
51}
52
55 return reactions_or_result();
56}
57
58} // namespace internal
59} // namespace v8
60
62
63#endif // V8_OBJECTS_JS_PROMISE_INL_H_
Tagged< Object > reactions() const
uint32_t async_task_id() const
Tagged< Object > result() const
bool has_async_task_id() const
static constexpr uint32_t kInvalidAsyncTaskId
Definition js-promise.h:34
void set_async_task_id(uint32_t id)
V8_EXPORT_PRIVATE Promise::PromiseState status() const
Definition objects.cc:4993
Flag flags[]
Definition flags.cc:3797
#define BOOL_ACCESSORS(holder, field, name, offset)
#define TQ_OBJECT_CONSTRUCTORS_IMPL(Type)
#define DCHECK_NE(v1, v2)
Definition logging.h:486
#define DCHECK_EQ(v1, v2)
Definition logging.h:485