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
225 #ifdef V8_ENABLE_CHECKS
226 CheckInitializedImpl(isolate);
263 return *addr &
static_cast<uint8_t>(1U << shift);
269 uint8_t mask =
static_cast<uint8_t>(1U << shift);
270 *addr =
static_cast<uint8_t>((*addr & ~mask) | (value << shift));
288 *
reinterpret_cast<
void**>(addr) = data;
296 return *
reinterpret_cast<
void*
const*>(addr);
306 template <
typename T>
310 #ifdef V8_COMPRESS_POINTERS
311 if (
sizeof(T) > kApiTaggedSize) {
317 memcpy(&r,
reinterpret_cast<
void*>(addr),
sizeof(T));
321 return *
reinterpret_cast<
const T*>(addr);
326 #ifdef V8_COMPRESS_POINTERS
327 uint32_t value = ReadRawField<uint32_t>(heap_object_ptr, offset);
328 internal::Address root = GetRootFromOnHeapAddress(heap_object_ptr);
329 return root +
static_cast<internal::Address>(
static_cast<uintptr_t>(value));
337 #ifdef V8_COMPRESS_POINTERS
338 uint32_t value = ReadRawField<uint32_t>(heap_object_ptr, offset);
339 return static_cast<internal::Address>(
static_cast<uintptr_t>(value));
347 #ifdef V8_HEAP_SANDBOX
348 return internal::IsolateFromNeverReadOnlySpaceObject(obj);
359 #ifdef V8_HEAP_SANDBOX
361 if (value) value = DecodeExternalPointer(isolate, value);
366 #ifdef V8_COMPRESS_POINTERS
388 #ifndef V8_HEAP_SANDBOX
399 template <
bool PerformCheck>