5#ifndef INCLUDE_V8_SANDBOX_H_
6#define INCLUDE_V8_SANDBOX_H_
88#ifdef V8_COMPRESS_POINTERS
91 Internals::kIsolateCppHeapPointerTableOffset +
93 return *
reinterpret_cast<Address**
>(addr);
99 Address heap_object_ptr,
int offset,
106#ifdef V8_COMPRESS_POINTERS
108 Internals::ReadRawField<CppHeapPointerHandle>(heap_object_ptr, offset);
109 const uint32_t index = handle >> kExternalPointerIndexShift;
110 const Address* table = GetCppHeapPointerTableBase(isolate);
111 const std::atomic<Address>* ptr =
112 reinterpret_cast<const std::atomic<Address>*
>(&table[index]);
113 Address entry = std::atomic_load_explicit(ptr, std::memory_order_relaxed);
121 uint32_t actual_tag =
static_cast<uint16_t
>(entry);
126 uint32_t first_tag =
static_cast<uint32_t
>(tag_range.first) << kTagShift;
127 uint32_t last_tag = (
static_cast<uint32_t
>(tag_range.last) << kTagShift) + 1;
128 if (
V8_LIKELY(actual_tag >= first_tag && actual_tag <= last_tag)) {
152 return reinterpret_cast<T*
>(entry);
154 return reinterpret_cast<T*
>(
155 Internals::ReadRawField<Address>(heap_object_ptr, offset));
162V8_INLINE static constexpr bool ExternalPointerCanBeEmpty(
Definition: v8-isolate.h:291
Definition: v8-sandbox.h:76
static void InitializeBeforeThreadCreation()
static const int kExternalPointerTableBasePointerOffset
Definition: v8-internal.h:976
uint32_t CppHeapPointerHandle
Definition: v8-internal.h:375
constexpr uint64_t kCppHeapPointerPayloadShift
Definition: v8-internal.h:392
constexpr uint64_t kCppHeapPointerTagShift
Definition: v8-internal.h:391
uintptr_t Address
Definition: v8-internal.h:38
Definition: libplatform.h:15
internal::TagRange< CppHeapPointerTag > CppHeapPointerTagRange
Definition: v8-sandbox.h:65
CppHeapPointerTag
Definition: v8-sandbox.h:28
constexpr CppHeapPointerTagRange kAnyCppHeapPointer(CppHeapPointerTag::kFirstTag, CppHeapPointerTag::kLastTag)
Definition: v8-internal.h:484
#define V8_EXPORT
Definition: v8config.h:854
#define V8_INLINE
Definition: v8config.h:508
#define V8_LIKELY(condition)
Definition: v8config.h:668