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");
109 #ifdef V8_31BIT_SMIS_ON_64BIT_ARCH
207 #ifdef V8_ENABLE_CHECKS
208 CheckInitializedImpl(isolate);
245 return *addr &
static_cast<uint8_t>(1U << shift);
251 uint8_t mask =
static_cast<uint8_t>(1U << shift);
252 *addr =
static_cast<uint8_t>((*addr & ~mask) | (value << shift));
270 *
reinterpret_cast<
void**>(addr) = data;
278 return *
reinterpret_cast<
void*
const*>(addr);
288 template <
typename T>
292 #ifdef V8_COMPRESS_POINTERS
293 if (
sizeof(T) > kApiTaggedSize) {
299 memcpy(&r,
reinterpret_cast<
void*>(addr),
sizeof(T));
303 return *
reinterpret_cast<
const T*>(addr);
308 #ifdef V8_COMPRESS_POINTERS
309 int32_t value = ReadRawField<int32_t>(heap_object_ptr, offset);
310 internal::Address root = GetRootFromOnHeapAddress(heap_object_ptr);
311 return root +
static_cast<internal::Address>(
static_cast<intptr_t>(value));
319 #ifdef V8_COMPRESS_POINTERS
320 int32_t value = ReadRawField<int32_t>(heap_object_ptr, offset);
321 return static_cast<internal::Address>(
static_cast<intptr_t>(value));
327 #ifdef V8_COMPRESS_POINTERS
354 template <
bool PerformCheck>