5#ifndef INCLUDE_V8_SANDBOX_H_
6#define INCLUDE_V8_SANDBOX_H_
16
17
18
19
20
21
22
23
24
25
26
27
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
90 uint32_t actual_tag =
static_cast<uint16_t>(entry);
95 uint32_t first_tag =
static_cast<uint32_t>(
lower_bound) << kTagShift;
96 uint32_t last_tag = (
static_cast<uint32_t>(
upper_bound) << kTagShift) + 1;
97 return actual_tag >= first_tag && actual_tag <= last_tag;
105
106
107
108
109
113
114
115
116
120
121
122
123
124
125
126
132#ifdef V8_COMPRESS_POINTERS
143 Address heap_object_ptr,
int offset,
145#ifdef V8_COMPRESS_POINTERS
148 const CppHeapPointerHandle handle =
149 Internals::ReadRawField<CppHeapPointerHandle>(heap_object_ptr, offset);
150 const uint32_t index = handle >> kExternalPointerIndexShift;
151 const Address* table = GetCppHeapPointerTableBase(isolate);
152 const std::atomic<Address>* ptr =
153 reinterpret_cast<
const std::atomic<Address>*>(&table[index]);
154 Address entry = std::atomic_load_explicit(ptr, std::memory_order_relaxed);
156 Address pointer = entry;
157 if (V8_LIKELY(tag_range.CheckTagOf(entry))) {
158 pointer = entry >> kCppHeapPointerPayloadShift;
179 return reinterpret_cast<T*>(pointer);
181 return reinterpret_cast<T*>(
static V8_EXPORT void InitializeBeforeThreadCreation()
static V8_EXPORT void PrepareCurrentThreadForHardwareSandboxing()
constexpr uint64_t kCppHeapPointerTagShift
constexpr CppHeapPointerTagRange kAnyCppHeapPointer(CppHeapPointerTag::kFirstTag, CppHeapPointerTag::kLastTag)
constexpr CppHeapPointerTagRange(CppHeapPointerTag lower, CppHeapPointerTag upper)
CppHeapPointerTag lower_bound
CppHeapPointerTag upper_bound
bool CheckTagOf(uint64_t entry)