5#ifndef INCLUDE_V8_SANDBOX_H_
6#define INCLUDE_V8_SANDBOX_H_
103 "V8Internal tag range must be within kObjectWrappableTagRange");
123#ifdef V8_COMPRESS_POINTERS
126 Internals::kIsolateCppHeapPointerTableOffset +
128 return *
reinterpret_cast<Address**
>(addr);
134 Address heap_object_ptr,
int offset,
141#ifdef V8_COMPRESS_POINTERS
143 Internals::ReadRawField<CppHeapPointerHandle>(heap_object_ptr, offset);
144 const uint32_t index = handle >> kExternalPointerIndexShift;
145 const Address* table = GetCppHeapPointerTableBase(isolate);
146 const std::atomic<Address>* ptr =
147 reinterpret_cast<const std::atomic<Address>*
>(&table[index]);
148 Address entry = std::atomic_load_explicit(ptr, std::memory_order_relaxed);
156 uint32_t actual_tag =
static_cast<uint16_t
>(entry);
161 uint32_t first_tag =
static_cast<uint32_t
>(tag_range.first) << kTagShift;
162 uint32_t last_tag = (
static_cast<uint32_t
>(tag_range.last) << kTagShift) + 1;
165 if (actual_tag >= first_tag && actual_tag <= last_tag) [[likely]] {
189 return reinterpret_cast<T*
>(safe_entry);
191 return reinterpret_cast<T*
>(
192 Internals::ReadRawField<Address>(heap_object_ptr, offset));
199V8_INLINE static constexpr bool ExternalPointerCanBeEmpty(
Definition: v8-isolate.h:292
Definition: v8-sandbox.h:111
static void InitializeBeforeThreadCreation()
static const int kExternalEntityTableBasePointerOffset
Definition: v8-internal.h:1030
uint32_t CppHeapPointerHandle
Definition: v8-internal.h:405
constexpr uint64_t kCppHeapPointerPayloadShift
Definition: v8-internal.h:422
constexpr uint64_t kCppHeapPointerTagShift
Definition: v8-internal.h:421
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:85
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:517
constexpr bool Contains(Tag tag) const
Definition: v8-internal.h:552
#define V8_EXPORT
Definition: v8config.h:867
#define V8_INLINE
Definition: v8config.h:511