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>
static const int kJSApiObjectType
const intptr_t kSmiTagMask
static V8_INLINE internal::Address ReadTaggedPointerField(internal::Address heap_object_ptr, int offset)
static V8_INLINE uint8_t GetNodeState(internal::Address *obj)
static const int kOddballKindOffset
static V8_INLINE int GetOddballKind(const internal::Address obj)
static const int kEmbedderDataSlotSize
static constexpr int kExternalAllocationSoftLimit
static constexpr intptr_t kSmiMaxValue
static const int kFirstNonstringType
static const int kIsolateFastCCallCallerFpOffset
static const int kNullValueRootIndex
static const uint32_t kNumIsolateDataSlots
static V8_INLINE void * GetEmbedderData(const v8::Isolate *isolate, uint32_t slot)
static const int kExternalMemoryLimitOffset
static const int kExternalMemoryAtLastMarkCompactOffset
static const int kThrowOnError
static constexpr intptr_t kSmiMaxValue
static V8_INLINE int SmiValue(const internal::Address value)
static const int kStringResourceOffset
static const int kJSObjectHeaderSize
const intptr_t kHeapObjectTagMask
constexpr intptr_t kIntptrAllBitsSet
V8_EXPORT bool ShouldThrowOnError(v8::internal::Isolate *isolate)
static const int kNodeFlagsOffset
static const int kFixedArrayHeaderSize
static const int kTheHoleValueRootIndex
static const int kNodeStateIsPendingValue
static const int kNodeStateIsWeakValue
static V8_INLINE bool IsExternalTwoByteString(int instance_type)
const int kApiSystemPointerSize
static const int kMapInstanceTypeOffset
static V8_INLINE bool HasHeapObjectTag(const internal::Address value)
static const int kNativeContextEmbedderDataOffset
static const int kInferShouldThrowMode
constexpr bool SmiValuesAre31Bits()
static V8_INLINE int GetInstanceType(const internal::Address obj)
static V8_INLINE void CheckInitialized(v8::Isolate *isolate)
V8_INLINE void PerformCastCheck(T *data)
static V8_INLINE constexpr internal::Address IntToSmi(int value)
static constexpr intptr_t kSmiMinValue
constexpr bool SmiValuesAre32Bits()
static V8_INLINE T ReadRawField(internal::Address heap_object_ptr, int offset)
static const int kEmbedderDataArrayHeaderSize
static const int kDontThrow
static const int kUndefinedValueRootIndex
static V8_INLINE void SetEmbedderData(v8::Isolate *isolate, uint32_t slot, void *data)
static const int kOddballType
static V8_INLINE constexpr bool IsValidSmi(intptr_t value)
constexpr uintptr_t kUintptrAllBitsSet
static const int kFalseValueRootIndex
static constexpr intptr_t kSmiMinValue
static const int kEmptyStringRootIndex
V8_EXPORT internal::Isolate * IsolateFromNeverReadOnlySpaceObject(Address obj)
static V8_INLINE constexpr bool IsValidSmi(intptr_t value)
static V8_INLINE int SmiToInt(const internal::Address value)
static const int kHeapObjectMapOffset
static V8_INLINE void UpdateNodeState(internal::Address *obj, uint8_t value)
static V8_INLINE constexpr bool IsValidSmi(intptr_t value)
static V8_INLINE internal::Address * GetRoot(v8::Isolate *isolate, int index)
static const int kFullStringRepresentationMask
static V8_INLINE int SmiToInt(const internal::Address value)
const int kWeakHeapObjectTag
static const int kUndefinedOddballKind
const int kHeapObjectTagSize
static V8_INLINE internal::Address ReadTaggedSignedField(internal::Address heap_object_ptr, int offset)
static V8_INLINE uint8_t GetNodeFlag(internal::Address *obj, int shift)
static V8_INLINE void UpdateNodeFlag(internal::Address *obj, bool value, int shift)
static const int kNodeStateMask
static const int kStringEncodingMask
static const int kExternalTwoByteRepresentationTag
static const int kTrueValueRootIndex
static V8_EXPORT void CheckInitializedImpl(v8::Isolate *isolate)
static const int kJSSpecialApiObjectType
static const int kForeignType
static const int kIsolateRootsOffset
static void Perform(T *data)
static const int kIsolateStackGuardOffset
static const int kIsolateEmbedderDataOffset
static const int kNullOddballKind
static const int kExternalOneByteRepresentationTag
static const int kExternalMemoryOffset
static const int kNodeClassIdOffset
static const int kJSObjectType
static const int kIsolateFastCCallCallerPcOffset
static const int kForeignAddressOffset