5 #ifndef INCLUDE_V8_INTERNAL_H_
6 #define INCLUDE_V8_INTERNAL_H_
11 #include <type_traits>
27 static const Address kNullAddress = 0;
48 template <size_t tagged_ptr_size>
57 struct SmiTagging<4> {
67 return static_cast<int32_t>(
static_cast<uint32_t>(value)) >> shift_bits;
73 return (
static_cast<uintptr_t>(value) -
82 struct SmiTagging<8> {
92 return static_cast<
int>(
static_cast<intptr_t>(value) >> shift_bits);
96 return (value ==
static_cast<int32_t>(value));
100 #ifdef V8_COMPRESS_POINTERS
103 "Pointer compression can be enabled only for 64-bit architectures");
114 #ifdef V8_HEAP_SANDBOX
123 #ifdef V8_31BIT_SMIS_ON_64BIT_ARCH
231 #ifdef V8_ENABLE_CHECKS
232 CheckInitializedImpl(isolate);
269 return *addr &
static_cast<uint8_t>(1U << shift);
275 uint8_t mask =
static_cast<uint8_t>(1U << shift);
276 *addr =
static_cast<uint8_t>((*addr & ~mask) | (value << shift));
294 *
reinterpret_cast<
void**>(addr) = data;
302 return *
reinterpret_cast<
void*
const*>(addr);
312 template <
typename T>
316 #ifdef V8_COMPRESS_POINTERS
317 if (
sizeof(T) > kApiTaggedSize) {
323 memcpy(&r,
reinterpret_cast<
void*>(addr),
sizeof(T));
327 return *
reinterpret_cast<
const T*>(addr);
332 #ifdef V8_COMPRESS_POINTERS
333 uint32_t value = ReadRawField<uint32_t>(heap_object_ptr, offset);
334 internal::Address root = GetRootFromOnHeapAddress(heap_object_ptr);
335 return root +
static_cast<internal::Address>(
static_cast<uintptr_t>(value));
343 #ifdef V8_COMPRESS_POINTERS
344 uint32_t value = ReadRawField<uint32_t>(heap_object_ptr, offset);
345 return static_cast<internal::Address>(
static_cast<uintptr_t>(value));
353 #ifdef V8_HEAP_SANDBOX
354 return internal::IsolateFromNeverReadOnlySpaceObject(obj);
365 #ifdef V8_HEAP_SANDBOX
367 if (value) value = DecodeExternalPointer(isolate, value);
372 #ifdef V8_COMPRESS_POINTERS
394 #ifndef V8_HEAP_SANDBOX
405 template <
bool PerformCheck>