  | 
  
    V8
    latest master commit
    
   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>
 
   67     return static_cast<int32_t
>(
static_cast<uint32_t
>(value)) >> shift_bits;
 
   73     return (
static_cast<uintptr_t
>(value) -
 
   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 
  231 #ifdef V8_ENABLE_CHECKS 
  241     return PlatformSmiTagging::SmiToInt(value);
 
  245     return internal::IntToSmi(value);
 
  249     return PlatformSmiTagging::IsValidSmi(value);
 
  269     return *addr & 
static_cast<uint8_t
>(1U << shift);
 
  275     uint8_t mask = 
static_cast<uint8_t
>(1U << shift);
 
  276     *addr = 
static_cast<uint8_t
>((*addr & ~mask) | (value << shift));
 
  294     *
reinterpret_cast<void**
>(addr) = data;
 
  302     return *
reinterpret_cast<void* const*
>(addr);
 
  312   template <
typename T>
 
  316 #ifdef V8_COMPRESS_POINTERS 
  323       memcpy(&r, 
reinterpret_cast<void*
>(addr), 
sizeof(T));
 
  327     return *
reinterpret_cast<const T*
>(addr);
 
  332 #ifdef V8_COMPRESS_POINTERS 
  333     uint32_t value = ReadRawField<uint32_t>(heap_object_ptr, offset);
 
  337     return ReadRawField<internal::Address>(heap_object_ptr, offset);
 
  343 #ifdef V8_COMPRESS_POINTERS 
  344     uint32_t value = ReadRawField<uint32_t>(heap_object_ptr, offset);
 
  347     return ReadRawField<internal::Address>(heap_object_ptr, offset);
 
  353 #ifdef V8_HEAP_SANDBOX 
  365 #ifdef V8_HEAP_SANDBOX 
  367     if (value) value = DecodeExternalPointer(isolate, value);
 
  372 #ifdef V8_COMPRESS_POINTERS 
  374   static constexpr 
size_t kPtrComprHeapReservationSize = 
size_t{1} << 32;
 
  375   static constexpr 
size_t kPtrComprIsolateRootAlignment = 
size_t{1} << 32;
 
  378   static constexpr uint32_t kExternalPointerSalt =
 
  383     return addr & -
static_cast<intptr_t
>(kPtrComprIsolateRootAlignment);
 
  394 #ifndef V8_HEAP_SANDBOX 
  395     return encoded_pointer;
 
  397     return encoded_pointer ^ kExternalPointerSalt;
 
  400 #endif  // V8_COMPRESS_POINTERS 
  405 template <
bool PerformCheck>
 
  433 #endif  // INCLUDE_V8_INTERNAL_H_ 
  
 
static const int kExternalMemoryOffset
 
static const int kInferShouldThrowMode
 
static V8_INLINE uint8_t GetNodeFlag(internal::Address *obj, int shift)
 
static const int kNullValueRootIndex
 
static const int kNodeStateIsPendingValue
 
static const int kStringResourceOffset
 
const intptr_t kHeapObjectTagMask
 
static const int kDontThrow
 
constexpr uintptr_t kUintptrAllBitsSet
 
static const uint32_t kNumIsolateDataSlots
 
static const int kNativeContextEmbedderDataOffset
 
static V8_INLINE int SmiToInt(const internal::Address value)
 
static V8_INLINE bool HasHeapObjectTag(const internal::Address value)
 
static constexpr V8_INLINE bool IsValidSmi(intptr_t value)
 
static const int kEmbedderDataSlotSize
 
static const int kJSApiObjectType
 
const int kWeakHeapObjectTag
 
static void Perform(T *data)
 
V8_EXPORT bool ShouldThrowOnError(v8::internal::Isolate *isolate)
 
static V8_INLINE bool IsExternalTwoByteString(int instance_type)
 
constexpr bool SmiValuesAre31Bits()
 
static const int kExternalTwoByteRepresentationTag
 
static V8_INLINE void CheckInitialized(v8::Isolate *isolate)
 
static constexpr V8_INLINE bool IsValidSmi(intptr_t value)
 
static const int kJSObjectHeaderSize
 
static constexpr int kExternalAllocationSoftLimit
 
static const int kJSObjectType
 
static const int kFalseValueRootIndex
 
static V8_INLINE void * GetEmbedderData(const v8::Isolate *isolate, uint32_t slot)
 
V8_INLINE void PerformCastCheck(T *data)
 
static const int kEmptyStringRootIndex
 
static const int kExternalOneByteRepresentationTag
 
static V8_EXPORT void CheckInitializedImpl(v8::Isolate *isolate)
 
static const int kStringEncodingMask
 
static const int kNodeClassIdOffset
 
static const int kIsolateEmbedderDataOffset
 
static const int kNodeFlagsOffset
 
static const int kIsolateRootsOffset
 
static V8_INLINE int SmiValue(const internal::Address value)
 
static const int kMapInstanceTypeOffset
 
static constexpr V8_INLINE internal::Address IntToSmi(int value)
 
static const int kNodeStateIsWeakValue
 
static V8_INLINE void UpdateNodeState(internal::Address *obj, uint8_t value)
 
static V8_INLINE int GetInstanceType(const internal::Address obj)
 
static const int kFirstNonstringType
 
static const int kFullStringRepresentationMask
 
V8_EXPORT internal::Isolate * IsolateFromNeverReadOnlySpaceObject(Address obj)
 
static const int kTrueValueRootIndex
 
static const int kEmbedderDataArrayHeaderSize
 
static V8_INLINE internal::Isolate * GetIsolateForHeapSandbox(internal::Address obj)
 
static V8_INLINE int SmiToInt(const internal::Address value)
 
static const int kIsolateFastCCallCallerPcOffset
 
static const int kIsolateStackGuardOffset
 
static const int kExternalMemoryLimitOffset
 
static const int kUndefinedValueRootIndex
 
static const int kNullOddballKind
 
static V8_INLINE internal::Address ReadTaggedSignedField(internal::Address heap_object_ptr, int offset)
 
constexpr bool HeapSandboxIsEnabled()
 
static const int kOddballType
 
static V8_INLINE int GetOddballKind(const internal::Address obj)
 
static V8_INLINE void SetEmbedderData(v8::Isolate *isolate, uint32_t slot, void *data)
 
const int kHeapObjectTagSize
 
static V8_INLINE T ReadRawField(internal::Address heap_object_ptr, int offset)
 
static const int kHeapObjectMapOffset
 
constexpr intptr_t kIntptrAllBitsSet
 
static V8_INLINE internal::Address ReadTaggedPointerField(internal::Address heap_object_ptr, int offset)
 
static const int kOddballKindOffset
 
const int kApiSystemPointerSize
 
static const int kUndefinedOddballKind
 
const intptr_t kSmiTagMask
 
static const int kIsolateFastCCallCallerFpOffset
 
constexpr bool PointerCompressionIsEnabled()
 
static const int kThrowOnError
 
static constexpr V8_INLINE bool IsValidSmi(intptr_t value)
 
static const int kNodeStateMask
 
static V8_INLINE void UpdateNodeFlag(internal::Address *obj, bool value, int shift)
 
Address ExternalPointer_t
 
constexpr bool SmiValuesAre32Bits()
 
static const int kFixedArrayHeaderSize
 
static V8_INLINE uint8_t GetNodeState(internal::Address *obj)
 
static const int kExternalMemoryLowSinceMarkCompactOffset
 
static const int kJSSpecialApiObjectType
 
static V8_INLINE internal::Address * GetRoot(v8::Isolate *isolate, int index)
 
static const int kTheHoleValueRootIndex
 
static const int kForeignType
 
static V8_INLINE internal::Address ReadExternalPointerField(internal::Isolate *isolate, internal::Address heap_object_ptr, int offset)