|  | v8
    9.0.257(node16.0.0)
    V8 is Google's open source JavaScript engine | 
 
 
 
Go to the documentation of this file.
    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 
  140 #ifdef V8_31BIT_SMIS_ON_64BIT_ARCH 
  162                                             ExternalPointer_t pointer,
 
  193 #ifdef V8_HEAP_SANDBOX 
  258 #ifdef V8_ENABLE_CHECKS 
  259     CheckInitializedImpl(isolate);
 
  296     return *addr & 
static_cast<uint8_t>(1U << shift);
 
  302     uint8_t mask = 
static_cast<uint8_t>(1U << shift);
 
  303     *addr = 
static_cast<uint8_t>((*addr & ~mask) | (value << shift));
 
  321     *
reinterpret_cast<
void**>(addr) = data;
 
  329     return *
reinterpret_cast<
void* 
const*>(addr);
 
  339   template <
typename T>
 
  343 #ifdef V8_COMPRESS_POINTERS 
  344     if (
sizeof(T) > kApiTaggedSize) {
 
  350       memcpy(&r, 
reinterpret_cast<
void*>(addr), 
sizeof(T));
 
  354     return *
reinterpret_cast<
const T*>(addr);
 
  359 #ifdef V8_COMPRESS_POINTERS 
  360     uint32_t value = ReadRawField<uint32_t>(heap_object_ptr, offset);
 
  361     internal::Address root = GetRootFromOnHeapAddress(heap_object_ptr);
 
  362     return root + 
static_cast<internal::Address>(
static_cast<uintptr_t>(value));
 
  370 #ifdef V8_COMPRESS_POINTERS 
  371     uint32_t value = ReadRawField<uint32_t>(heap_object_ptr, offset);
 
  372     return static_cast<internal::Address>(
static_cast<uintptr_t>(value));
 
  380 #ifdef V8_HEAP_SANDBOX 
  381     return internal::IsolateFromNeverReadOnlySpaceObject(obj);
 
  389       const Isolate* isolate, ExternalPointer_t encoded_pointer,
 
  391 #ifdef V8_HEAP_SANDBOX 
  392     return internal::DecodeExternalPointerImpl(isolate, encoded_pointer, tag);
 
  394     return encoded_pointer;
 
  401 #ifdef V8_HEAP_SANDBOX 
  402     internal::ExternalPointer_t encoded_value =
 
  403         ReadRawField<uint32_t>(heap_object_ptr, offset);
 
  405     return encoded_value ? DecodeExternalPointer(isolate, encoded_value, tag)
 
  412 #ifdef V8_COMPRESS_POINTERS 
  433 template <
bool PerformCheck>
 
  452             !std::is_same<
Data, std::remove_cv_t<T>>::value>::Perform(data);
 
  
 
static const int kFullStringRepresentationMask
static const int kFalseValueRootIndex
static constexpr intptr_t kSmiMaxValue
static V8_INLINE T ReadRawField(internal::Address heap_object_ptr, int offset)
@ kDataViewDataPointerTag
static const int kNativeContextEmbedderDataOffset
static const int kJSObjectHeaderSize
static V8_INLINE void UpdateNodeFlag(internal::Address *obj, bool value, int shift)
static V8_INLINE int GetInstanceType(const internal::Address obj)
static const int kMapInstanceTypeOffset
static V8_INLINE uint8_t GetNodeFlag(internal::Address *obj, int shift)
V8_EXPORT Address DecodeExternalPointerImpl(const Isolate *isolate, ExternalPointer_t pointer, ExternalPointerTag tag)
static V8_INLINE void SetEmbedderData(v8::Isolate *isolate, uint32_t slot, void *data)
static V8_INLINE bool HasHeapObjectTag(const internal::Address value)
static V8_INLINE internal::Address ReadExternalPointerField(internal::Isolate *isolate, internal::Address heap_object_ptr, int offset, ExternalPointerTag tag)
static const int kDontThrow
static V8_INLINE bool IsExternalTwoByteString(int instance_type)
static V8_INLINE void UpdateNodeState(internal::Address *obj, uint8_t value)
V8_EXPORT bool ShouldThrowOnError(v8::internal::Isolate *isolate)
const int kApiSystemPointerSize
static V8_EXPORT void CheckInitializedImpl(v8::Isolate *isolate)
static constexpr V8_INLINE internal::Address IntToSmi(int value)
static constexpr V8_INLINE bool IsValidSmi(intptr_t value)
static constexpr intptr_t kSmiMinValue
constexpr bool SmiValuesAre31Bits()
@ kExternalStringResourceDataTag
static const int kHeapObjectMapOffset
@ kExternalPointerNullTag
static const int kNodeClassIdOffset
static const int kIsolateRootsOffset
static V8_INLINE int SmiToInt(const internal::Address value)
@ kEmbedderDataSlotPayloadTag
static const int kJSSpecialApiObjectType
V8_INLINE void PerformCastCheck(T *data)
static const int kJSApiObjectType
static const int kIsolateFastCCallCallerPcOffset
static const int kExternalOneByteRepresentationTag
static constexpr int kExternalAllocationSoftLimit
static const int kIsolateStackGuardOffset
static V8_INLINE internal::Address * GetRoot(v8::Isolate *isolate, int index)
static V8_INLINE Address DecodeExternalPointer(const Isolate *isolate, ExternalPointer_t encoded_pointer, ExternalPointerTag tag)
static const int kJSObjectType
@ kForeignForeignAddressTag
static const int kStringEncodingMask
static const int kIsolateFastApiCallTargetOffset
@ kTypedArrayExternalPointerTag
static V8_INLINE internal::Address ReadTaggedSignedField(internal::Address heap_object_ptr, int offset)
static const int kNullOddballKind
static const int kForeignType
static const int kIsolateEmbedderDataOffset
static const int kIsolateFastCCallCallerFpOffset
static constexpr V8_INLINE bool IsValidSmi(intptr_t value)
static const int kUndefinedOddballKind
V8_EXPORT internal::Isolate * IsolateFromNeverReadOnlySpaceObject(Address obj)
static constexpr intptr_t kSmiMaxValue
static const int kFirstNonstringType
static const int kExternalPointerTableCapacityOffset
static const int kExternalTwoByteRepresentationTag
static const int kEmbedderDataSlotSize
static const int kTrueValueRootIndex
static const int kOddballKindOffset
static V8_INLINE internal::Isolate * GetIsolateForHeapSandbox(internal::Address obj)
static const int kNodeStateMask
static V8_INLINE int SmiToInt(const internal::Address value)
constexpr bool HeapSandboxIsEnabled()
static const int kNullValueRootIndex
static V8_INLINE uint8_t GetNodeState(internal::Address *obj)
constexpr intptr_t kIntptrAllBitsSet
static const int kExternalPointerTableLengthOffset
constexpr uintptr_t kUintptrAllBitsSet
static V8_INLINE void CheckInitialized(v8::Isolate *isolate)
@ kExternalStringResourceTag
static const int kNodeFlagsOffset
static const int kStringResourceOffset
const intptr_t kHeapObjectTagMask
static void Perform(T *data)
static const int kEmbedderDataArrayHeaderSize
static const uint32_t kNumIsolateDataSlots
static V8_INLINE int SmiValue(const internal::Address value)
static V8_INLINE internal::Address ReadTaggedPointerField(internal::Address heap_object_ptr, int offset)
static const int kThrowOnError
static const int kOddballType
static const int kNodeStateIsPendingValue
constexpr bool PointerCompressionIsEnabled()
const int kHeapObjectTagSize
static constexpr intptr_t kSmiMinValue
static constexpr V8_INLINE bool IsValidSmi(intptr_t value)
constexpr bool SmiValuesAre32Bits()
static V8_INLINE void * GetEmbedderData(const v8::Isolate *isolate, uint32_t slot)
const int kWeakHeapObjectTag
static const int kUndefinedValueRootIndex
@ kArrayBufferBackingStoreTag
static V8_INLINE int GetOddballKind(const internal::Address obj)
static const int kNodeStateIsWeakValue
static const int kInferShouldThrowMode
const intptr_t kSmiTagMask
static const int kFixedArrayHeaderSize
@ kNativeContextMicrotaskQueueTag
static const int kTheHoleValueRootIndex
static const int kEmptyStringRootIndex
static const int kExternalPointerTableBufferOffset