5#ifndef INCLUDE_V8_SANDBOX_H_
6#define INCLUDE_V8_SANDBOX_H_
101 "V8Internal tag range must be within kObjectWrappableTagRange");
121#ifdef V8_COMPRESS_POINTERS
124 Internals::kIsolateCppHeapPointerTableOffset +
126 return *
reinterpret_cast<Address**
>(addr);
132 Address heap_object_ptr,
int offset,
139#ifdef V8_COMPRESS_POINTERS
141 Internals::ReadRawField<CppHeapPointerHandle>(heap_object_ptr, offset);
142 const uint32_t index = handle >> kExternalPointerIndexShift;
143 const Address* table = GetCppHeapPointerTableBase(isolate);
144 const std::atomic<Address>* ptr =
145 reinterpret_cast<const std::atomic<Address>*
>(&table[index]);
146 Address entry = std::atomic_load_explicit(ptr, std::memory_order_relaxed);
154 uint32_t actual_tag =
static_cast<uint16_t
>(entry);
159 uint32_t first_tag =
static_cast<uint32_t
>(tag_range.first) << kTagShift;
160 uint32_t last_tag = (
static_cast<uint32_t
>(tag_range.last) << kTagShift) + 1;
163 if (actual_tag >= first_tag && actual_tag <= last_tag) [[likely]] {
187 return reinterpret_cast<T*
>(safe_entry);
189 return reinterpret_cast<T*
>(
190 Internals::ReadRawField<Address>(heap_object_ptr, offset));
197V8_INLINE static constexpr bool ExternalPointerCanBeEmpty(
Definition: v8-isolate.h:292
Definition: v8-sandbox.h:109
static void InitializeBeforeThreadCreation()
static const int kExternalEntityTableBasePointerOffset
Definition: v8-internal.h:1026
uint32_t CppHeapPointerHandle
Definition: v8-internal.h:401
constexpr uint64_t kCppHeapPointerPayloadShift
Definition: v8-internal.h:418
constexpr uint64_t kCppHeapPointerTagShift
Definition: v8-internal.h:417
uintptr_t Address
Definition: v8-internal.h:38
Definition: libplatform.h:15
constexpr CppHeapPointerTagRange kAnyCppHeapPointer(CppHeapPointerTag::kFirstTag, CppHeapPointerTag::kZappedEntryTag)
internal::TagRange< CppHeapPointerTag > CppHeapPointerTagRange
Definition: v8-sandbox.h:83
CppHeapPointerTag
Definition: v8-sandbox.h:28
@ kLastObjectWrappableTag
@ kWasmMemoryMapDescriptorTag
@ kFirstObjectWrappableTag
constexpr CppHeapPointerTagRange kObjectWrappableTagRange(CppHeapPointerTag::kFirstObjectWrappableTag, CppHeapPointerTag::kLastObjectWrappableTag)
constexpr CppHeapPointerTagRange kV8InternalTagRange(CppHeapPointerTag::kFirstV8InternalTag, CppHeapPointerTag::kLastV8InternalTag)
Definition: v8-internal.h:513
constexpr bool Contains(Tag tag) const
Definition: v8-internal.h:548
#define V8_EXPORT
Definition: v8config.h:867
#define V8_INLINE
Definition: v8config.h:511