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
209 #ifdef V8_ENABLE_CHECKS
210 CheckInitializedImpl(isolate);
247 return *addr &
static_cast<uint8_t>(1U << shift);
253 uint8_t mask =
static_cast<uint8_t>(1U << shift);
254 *addr =
static_cast<uint8_t>((*addr & ~mask) | (value << shift));
272 *
reinterpret_cast<
void**>(addr) = data;
280 return *
reinterpret_cast<
void*
const*>(addr);
290 template <
typename T>
294 #ifdef V8_COMPRESS_POINTERS
295 if (
sizeof(T) > kApiTaggedSize) {
301 memcpy(&r,
reinterpret_cast<
void*>(addr),
sizeof(T));
305 return *
reinterpret_cast<
const T*>(addr);
310 #ifdef V8_COMPRESS_POINTERS
311 int32_t value = ReadRawField<int32_t>(heap_object_ptr, offset);
312 internal::Address root = GetRootFromOnHeapAddress(heap_object_ptr);
313 return root +
static_cast<internal::Address>(
static_cast<intptr_t>(value));
321 #ifdef V8_COMPRESS_POINTERS
322 int32_t value = ReadRawField<int32_t>(heap_object_ptr, offset);
323 return static_cast<internal::Address>(
static_cast<intptr_t>(value));
329 #ifdef V8_COMPRESS_POINTERS
353 template <
bool PerformCheck>