5#ifndef INCLUDE_V8_SANDBOX_H_
6#define INCLUDE_V8_SANDBOX_H_
100 "V8Internal tag range must be within kObjectWrappableTagRange");
120#ifdef V8_COMPRESS_POINTERS
123 Internals::kIsolateCppHeapPointerTableOffset +
125 return *
reinterpret_cast<Address**
>(addr);
131 Address heap_object_ptr,
int offset,
138#ifdef V8_COMPRESS_POINTERS
140 Internals::ReadRawField<CppHeapPointerHandle>(heap_object_ptr, offset);
141 const uint32_t index = handle >> kExternalPointerIndexShift;
142 const Address* table = GetCppHeapPointerTableBase(isolate);
143 const std::atomic<Address>* ptr =
144 reinterpret_cast<const std::atomic<Address>*
>(&table[index]);
145 Address entry = std::atomic_load_explicit(ptr, std::memory_order_relaxed);
153 uint32_t actual_tag =
static_cast<uint16_t
>(entry);
158 uint32_t first_tag =
static_cast<uint32_t
>(tag_range.first) << kTagShift;
159 uint32_t last_tag = (
static_cast<uint32_t
>(tag_range.last) << kTagShift) + 1;
162 if (actual_tag >= first_tag && actual_tag <= last_tag) [[likely]] {
186 return reinterpret_cast<T*
>(safe_entry);
188 return reinterpret_cast<T*
>(
189 Internals::ReadRawField<Address>(heap_object_ptr, offset));
196V8_INLINE static constexpr bool ExternalPointerCanBeEmpty(
Definition: v8-isolate.h:291
Definition: v8-sandbox.h:108
static void InitializeBeforeThreadCreation()
static const int kExternalEntityTableBasePointerOffset
Definition: v8-internal.h:1021
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:82
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:510
constexpr bool Contains(Tag tag) const
Definition: v8-internal.h:545
#define V8_EXPORT
Definition: v8config.h:867
#define V8_INLINE
Definition: v8config.h:511