5#ifndef INCLUDE_V8_HANDLE_BASE_H_
6#define INCLUDE_V8_HANDLE_BASE_H_
12template <
bool check_statically_enabled>
33#if V8_HAS_ATTRIBUTE_TRIVIAL_ABI
36 StackAllocated& operator=(
const StackAllocated&) =
default;
46#ifdef ENABLE_SLOW_DCHECKS
75 : location_(location) {}
84 reinterpret_cast<const std::atomic<internal::Address*>*
>(&location_)
85 ->load(std::memory_order_relaxed)) {
86 return reinterpret_cast<const std::atomic<internal::Address>*
>(loc)->load(
87 std::memory_order_relaxed);
98 template <
typename T,
bool check_null = false>
100 return internal::ValueHelper::SlotAsValue<T, check_null>(
slot());
103#ifdef V8_ENABLE_DIRECT_HANDLE
117#ifdef V8_ENABLE_DIRECT_HANDLE
123class DirectHandleBase {
127 return ptr_ == internal::ValueHelper::kEmpty;
131 V8_INLINE void Clear() { ptr_ = internal::ValueHelper::kEmpty; }
134 friend class internal::ValueHelper;
135 friend class internal::HandleHelper;
138 V8_INLINE DirectHandleBase(
const DirectHandleBase& other) =
default;
139 V8_INLINE DirectHandleBase& operator=(
const DirectHandleBase& that) =
default;
141 V8_INLINE explicit DirectHandleBase(internal::Address ptr) : ptr_(ptr) {}
144 V8_INLINE internal::Address ptr()
const {
return ptr_; }
146 V8_INLINE internal::Address ptr_relaxed()
const {
147 return reinterpret_cast<const std::atomic<internal::Address>*
>(&ptr_)->load(
148 std::memory_order_relaxed);
153 template <
typename T,
bool check_null = false>
155 return reinterpret_cast<T*
>(ptr_);
158 V8_INLINE internal::ValueHelper::InternalRepresentationType repr()
const {
163 internal::Address ptr_ = internal::ValueHelper::kEmpty;
Definition: v8-handle-base.h:57
IndirectHandleBase & operator=(const IndirectHandleBase &that)=default
T * value() const
Definition: v8-handle-base.h:99
internal::Address ptr() const
Definition: v8-handle-base.h:80
internal::Address *& slot()
Definition: v8-handle-base.h:94
IndirectHandleBase()=default
internal::Address *const & slot() const
Definition: v8-handle-base.h:93
bool IsEmpty() const
Definition: v8-handle-base.h:60
IndirectHandleBase(const IndirectHandleBase &other)=default
IndirectHandleBase(internal::Address *location)
Definition: v8-handle-base.h:74
void Clear()
Definition: v8-handle-base.h:63
internal::ValueHelper::InternalRepresentationType repr() const
Definition: v8-handle-base.h:108
internal::Address ptr_relaxed() const
Definition: v8-handle-base.h:82
void VerifyOnStack() const
Definition: v8-handle-base.h:49
StackAllocated()
Definition: v8-handle-base.h:31
StackAllocated(const StackAllocated &other, no_checking_tag tag)
Definition: v8-handle-base.h:42
StackAllocated(no_checking_tag tag)
Definition: v8-handle-base.h:40
Definition: v8-handle-base.h:13
void VerifyOnStack() const
Definition: v8-handle-base.h:25
StackAllocated(const StackAllocated &other, no_checking_tag)
Definition: v8-handle-base.h:22
StackAllocated(no_checking_tag)
Definition: v8-handle-base.h:21
static constexpr no_checking_tag do_not_check
Definition: v8-handle-base.h:19
Definition: v8-internal.h:1862
Definition: v8-internal.h:1776
internal::Address * InternalRepresentationType
Definition: v8-internal.h:1790
static constexpr Address kTaggedNullAddress
Definition: v8-internal.h:1784
static constexpr InternalRepresentationType kEmpty
Definition: v8-internal.h:1791
Definition: v8-function-callback.h:35
uintptr_t Address
Definition: v8-internal.h:38
Definition: v8-handle-base.h:18
#define V8_EXPORT
Definition: v8config.h:875
#define V8_INLINE
Definition: v8config.h:519
#define V8_TRIVIAL_ABI
Definition: v8config.h:828