5#ifndef INCLUDE_V8_INTERNAL_H_
6#define INCLUDE_V8_INTERNAL_H_
23#if __has_include(<version>)
26#if defined(__cpp_lib_three_way_comparison) && \
27 __cpp_lib_three_way_comparison >= 201711L && \
28 defined(__cpp_lib_concepts) && __cpp_lib_concepts >= 202002L
32#define V8_HAVE_SPACESHIP_OPERATOR 1
34#define V8_HAVE_SPACESHIP_OPERATOR 0
53static constexpr Address kNullAddress = 0;
55constexpr int KB = 1024;
56constexpr int MB =
KB * 1024;
57constexpr int GB =
MB * 1024;
58#ifdef V8_TARGET_ARCH_X64
59constexpr size_t TB =
size_t{
GB} * 1024;
90template <
size_t tagged_ptr_size>
109 return static_cast<int32_t
>(
static_cast<uint32_t
>(value)) >> shift_bits;
112 template <
class T,
typename std::enable_if_t<std::is_
integral_v<T> &&
113 std::is_
signed_v<T>>* =
nullptr>
118 return (
static_cast<uintptr_t
>(value) -
125 typename std::enable_if_t<std::is_integral_v<T> &&
126 std::is_unsigned_v<T>>* =
nullptr>
128 static_assert(kSmiMaxValue <= std::numeric_limits<uintptr_t>::max());
135 return (
static_cast<uint64_t
>(value) -
142 static_assert(kSmiMaxValue <= std::numeric_limits<uint64_t>::max());
159 return static_cast<int>(
static_cast<intptr_t
>(value) >> shift_bits);
162 template <
class T,
typename std::enable_if_t<std::is_
integral_v<T> &&
163 std::is_
signed_v<T>>* =
nullptr>
166 return std::numeric_limits<int32_t>::min() <= value &&
167 value <= std::numeric_limits<int32_t>::max();
171 typename std::enable_if_t<std::is_integral_v<T> &&
172 std::is_unsigned_v<T>>* =
nullptr>
174 return value <= std::numeric_limits<int32_t>::max();
178#ifdef V8_COMPRESS_POINTERS
181constexpr size_t kPtrComprCageReservationSize =
size_t{1} << 32;
182constexpr size_t kPtrComprCageBaseAlignment =
size_t{1} << 32;
186 "Pointer compression can be enabled only for 64-bit architectures");
196#ifdef V8_31BIT_SMIS_ON_64BIT_ARCH
206const int kSmiMinValue =
static_cast<int>(PlatformSmiTagging::kSmiMinValue);
207const int kSmiMaxValue =
static_cast<int>(PlatformSmiTagging::kSmiMaxValue);
221#ifdef V8_ENABLE_SANDBOX
232#ifdef V8_ENABLE_SANDBOX
235#if defined(V8_TARGET_OS_ANDROID)
239constexpr size_t kSandboxSizeLog2 = 37;
242constexpr size_t kSandboxSizeLog2 = 40;
244constexpr size_t kSandboxSize = 1ULL << kSandboxSizeLog2;
251constexpr size_t kSandboxAlignment = kPtrComprCageBaseAlignment;
257constexpr uint64_t kSandboxedPointerShift = 64 - kSandboxSizeLog2;
265constexpr size_t kSandboxGuardRegionSize = 32ULL *
GB + 4ULL *
GB;
267static_assert((kSandboxGuardRegionSize % kSandboxAlignment) == 0,
268 "The size of the guard regions around the sandbox must be a "
269 "multiple of its required alignment.");
281constexpr size_t kSandboxMinimumReservationSize = 8ULL *
GB;
283static_assert(kSandboxMinimumReservationSize > kPtrComprCageReservationSize,
284 "The minimum reservation size for a sandbox must be larger than "
285 "the pointer compression cage contained within it.");
291constexpr size_t kMaxSafeBufferSizeForSandbox = 32ULL *
GB - 1;
292static_assert(kMaxSafeBufferSizeForSandbox <= kSandboxGuardRegionSize,
293 "The maximum allowed buffer size must not be larger than the "
294 "sandbox's guard regions");
296constexpr size_t kBoundedSizeShift = 29;
297static_assert(1ULL << (64 - kBoundedSizeShift) ==
298 kMaxSafeBufferSizeForSandbox + 1,
299 "The maximum size of a BoundedSize must be synchronized with the "
300 "kMaxSafeBufferSizeForSandbox");
304#ifdef V8_COMPRESS_POINTERS
306#ifdef V8_TARGET_OS_ANDROID
312constexpr size_t kExternalPointerTableReservationSize = 256 *
MB;
318constexpr uint32_t kExternalPointerIndexShift = 7;
320constexpr size_t kExternalPointerTableReservationSize = 512 *
MB;
321constexpr uint32_t kExternalPointerIndexShift = 6;
325constexpr int kExternalPointerTableEntrySize = 8;
326constexpr int kExternalPointerTableEntrySizeLog2 = 3;
328 kExternalPointerTableReservationSize / kExternalPointerTableEntrySize;
330 "kExternalPointerTableReservationSize and "
331 "kExternalPointerIndexShift don't match");
362#ifdef V8_ENABLE_SANDBOX
382#ifdef V8_COMPRESS_POINTERS
395#ifdef V8_COMPRESS_POINTERS
399constexpr size_t kCppHeapPointerTableReservationSize =
400 kExternalPointerTableReservationSize;
401constexpr uint32_t kCppHeapPointerIndexShift = kExternalPointerIndexShift;
403constexpr int kCppHeapPointerTableEntrySize = 8;
404constexpr int kCppHeapPointerTableEntrySizeLog2 = 3;
406 kCppHeapPointerTableReservationSize / kCppHeapPointerTableEntrySize;
408 "kCppHeapPointerTableReservationSize and "
409 "kCppHeapPointerIndexShift don't match");
445template <
typename Tag>
447 static_assert(std::is_enum_v<Tag> &&
448 std::is_same_v<std::underlying_type_t<Tag>, uint16_t>,
449 "Tag parameter must be an enum with base type uint16_t");
468 constexpr size_t Size()
const {
480 return static_cast<uint32_t
>(tag) -
first <=
493 static_assert(std::is_same_v<std::underlying_type_t<Tag>, uint16_t>);
494 return (
static_cast<size_t>(
first) << 16) |
last;
674V8_INLINE static constexpr bool IsSharedExternalPointerType(
682V8_INLINE static constexpr bool IsMaybeReadOnlyExternalPointerType(
691V8_INLINE static constexpr bool IsManagedExternalPointerType(
703V8_INLINE static constexpr bool ExternalPointerCanBeEmpty(
767 "kTrustedPointerTableReservationSize and "
768 "kTrustedPointerHandleShift don't match");
816 "kCodePointerTableReservationSize and kCodePointerHandleShift don't match");
846 return mapword ^ kMapWordXorMask;
860#ifdef V8_COMPRESS_POINTERS
870#ifdef V8_ENABLE_SANDBOX
936#ifdef V8_COMPRESS_POINTERS
937 static const int kIsolateExternalPointerTableOffset =
939 static const int kIsolateSharedExternalPointerTableAddressOffset =
941 static const int kIsolateCppHeapPointerTableOffset =
943#ifdef V8_ENABLE_SANDBOX
944 static const int kIsolateTrustedCageBaseOffset =
946 static const int kIsolateTrustedPointerTableOffset =
948 static const int kIsolateSharedTrustedPointerTableAddressOffset =
950 static const int kIsolateTrustedPointerPublishingScopeOffset =
952 static const int kIsolateCodePointerTableBaseAddressOffset =
975#if V8_STATIC_ROOTS_BOOL
978#define EXPORTED_STATIC_ROOTS_PTR_LIST(V) \
979 V(UndefinedValue, 0x11) \
982 V(FalseValue, 0x55) \
983 V(EmptyString, 0x49) \
984 V(TheHoleValue, 0x761)
986 using Tagged_t = uint32_t;
987 struct StaticReadOnlyRoot {
988#define DEF_ROOT(name, value) static constexpr Tagged_t k##name = value;
989 EXPORTED_STATIC_ROOTS_PTR_LIST(DEF_ROOT)
993 static constexpr Tagged_t kStringMapLowerBound = 0;
994 static constexpr Tagged_t kStringMapUpperBound = 0x425;
996#define PLUSONE(...) +1
997 static constexpr size_t kNumberOfExportedStaticRoots =
998 2 + EXPORTED_STATIC_ROOTS_PTR_LIST(PLUSONE);
1042#ifdef V8_MAP_PACKING
1043 static const uintptr_t kMapWordMetadataMask = 0xffffULL << 48;
1045 static const uintptr_t kMapWordSignature = 0b10;
1050 static const int kMapWordXorMask = 0b11;
1055#ifdef V8_ENABLE_CHECKS
1065 return PlatformSmiTagging::SmiToInt(value);
1069 return (value << (
kSmiTagSize + PlatformSmiTagging::kSmiShiftSize)) |
1077 template <
typename T,
1078 typename std::enable_if_t<std::is_integral_v<T>>* =
nullptr>
1083 template <
typename T,
1084 typename std::enable_if_t<std::is_integral_v<T>>* =
nullptr>
1086 return PlatformSmiTagging::IsValidSmi(value);
1089 template <
typename T,
1090 typename std::enable_if_t<std::is_integral_v<T>>* =
nullptr>
1092 if (
V8_LIKELY(PlatformSmiTagging::IsValidSmi(value))) {
1098#if V8_STATIC_ROOTS_BOOL
1100 return static_cast<Tagged_t
>(obj) == constant;
1103 V8_INLINE static bool CheckInstanceMapRange(
Address obj, Tagged_t first_map,
1104 Tagged_t last_map) {
1106#ifdef V8_MAP_PACKING
1107 map = UnpackMapWord(map);
1109 return map >= first_map && map <= last_map;
1115#ifdef V8_MAP_PACKING
1116 map = UnpackMapWord(map);
1124#ifdef V8_MAP_PACKING
1125 map = UnpackMapWord(map);
1146 (
static_cast<unsigned>(
static_cast<unsigned>(instance_type) -
1153 return *addr &
static_cast<uint8_t
>(1U << shift);
1158 uint8_t mask =
static_cast<uint8_t
>(1U << shift);
1159 *addr =
static_cast<uint8_t
>((*addr & ~mask) | (value << shift));
1169 *addr =
static_cast<uint8_t
>((*addr & ~kNodeStateMask) | value);
1176 *
reinterpret_cast<void**
>(addr) = data;
1183 return *
reinterpret_cast<void* const*
>(addr);
1189 ++(*
reinterpret_cast<size_t*
>(addr));
1195 return reinterpret_cast<Address*
>(addr);
1199#if V8_STATIC_ROOTS_BOOL
1203#define DECOMPRESS_ROOT(name, ...) \
1204 case k##name##RootIndex: \
1205 return base + StaticReadOnlyRoot::k##name;
1206 EXPORTED_STATIC_ROOTS_PTR_LIST(DECOMPRESS_ROOT)
1207#undef DECOMPRESS_ROOT
1208#undef EXPORTED_STATIC_ROOTS_PTR_LIST
1216#ifdef V8_ENABLE_SANDBOX
1219 kIsolateExternalPointerTableOffset +
1221 return *
reinterpret_cast<Address**
>(addr);
1227 kIsolateSharedExternalPointerTableAddressOffset;
1228 addr = *
reinterpret_cast<Address*
>(addr);
1230 return *
reinterpret_cast<Address**
>(addr);
1234 template <
typename T>
1237#ifdef V8_COMPRESS_POINTERS
1244 memcpy(&r,
reinterpret_cast<void*
>(addr),
sizeof(T));
1248 return *
reinterpret_cast<const T*
>(addr);
1253#ifdef V8_COMPRESS_POINTERS
1254 uint32_t value = ReadRawField<uint32_t>(heap_object_ptr, offset);
1255 Address base = GetPtrComprCageBaseFromOnHeapAddress(heap_object_ptr);
1256 return base +
static_cast<Address>(
static_cast<uintptr_t
>(value));
1258 return ReadRawField<Address>(heap_object_ptr, offset);
1264#ifdef V8_COMPRESS_POINTERS
1265 uint32_t value = ReadRawField<uint32_t>(heap_object_ptr, offset);
1266 return static_cast<Address>(
static_cast<uintptr_t
>(value));
1268 return ReadRawField<Address>(heap_object_ptr, offset);
1273#ifdef V8_ENABLE_SANDBOX
1282 template <ExternalPo
interTagRange tag_range>
1286#ifdef V8_ENABLE_SANDBOX
1287 static_assert(!tag_range.IsEmpty());
1290 Address* table = IsSharedExternalPointerType(tag_range)
1291 ? GetSharedExternalPointerTableBase(isolate)
1292 : GetExternalPointerTableBase(isolate);
1294 ReadRawField<ExternalPointerHandle>(heap_object_ptr, offset);
1295 uint32_t index = handle >> kExternalPointerIndexShift;
1296 std::atomic<Address>* ptr =
1297 reinterpret_cast<std::atomic<Address>*
>(&table[index]);
1298 Address entry = std::atomic_load_explicit(ptr, std::memory_order_relaxed);
1301 if (
V8_LIKELY(tag_range.Contains(actual_tag))) {
1308 return ReadRawField<Address>(heap_object_ptr, offset);
1312#ifdef V8_COMPRESS_POINTERS
1314 return addr & -
static_cast<intptr_t
>(kPtrComprCageBaseAlignment);
1318 return static_cast<uint32_t
>(value);
1323 Address base = GetPtrComprCageBaseFromOnHeapAddress(heap_object_ptr);
1324 return base +
static_cast<Address>(
static_cast<uintptr_t
>(value));
1332template <
bool PerformCheck>
1351 !std::is_same<Data, std::remove_cv_t<T>>::value>::Perform(data);
1366 Heap*
heap()
const {
return heap_; }
1372 return a.heap_ == b.heap_;
1395template <
typename T>
1400 template <
typename HeapOrIsolateT>
1402 template <
typename U>
1405 using std::allocator<T>::allocate;
1406 using std::allocator<T>::deallocate;
1411template <
typename Iterator,
typename =
void>
1413template <
typename Iterator>
1415 Iterator, std::void_t<typename Iterator::iterator_concept>> =
true;
1417template <
typename Iterator,
typename =
void>
1419template <
typename Iterator>
1421 Iterator, std::void_t<typename Iterator::iterator_category>> =
true;
1426template <
typename Iterator,
typename =
void>
1429template <
typename Iterator>
1431 Iterator, std::enable_if_t<kHaveIteratorConcept<Iterator>>> {
1435template <
typename Iterator>
1437 Iterator, std::enable_if_t<kHaveIteratorCategory<Iterator> &&
1438 !kHaveIteratorConcept<Iterator>>> {
1444#if __has_include(<ranges>)
1445 using iterator_concept =
1446 typename std::iterator_traits<Iterator>::iterator_concept;
1454template <
typename Iterator,
typename ElementType =
void>
1458 std::is_void_v<ElementType> ||
1459 (std::is_convertible_v<typename std::iterator_traits<Iterator>::pointer,
1460 std::add_pointer_t<ElementType>> &&
1461 std::is_convertible_v<typename std::iterator_traits<Iterator>::reference,
1462 std::add_lvalue_reference_t<ElementType>>));
1465 typename std::iterator_traits<Iterator>::difference_type;
1467 std::conditional_t<std::is_void_v<ElementType>,
1468 typename std::iterator_traits<Iterator>::value_type,
1471 std::conditional_t<std::is_void_v<ElementType>,
1472 typename std::iterator_traits<Iterator>::pointer,
1473 std::add_pointer_t<ElementType>>;
1475 std::conditional_t<std::is_void_v<ElementType>,
1476 typename std::iterator_traits<Iterator>::reference,
1477 std::add_lvalue_reference_t<ElementType>>;
1479 typename std::iterator_traits<Iterator>::iterator_category;
1486 template <
typename OtherIterator,
typename OtherElementType,
1487 typename = std::enable_if_t<
1488 std::is_convertible_v<OtherIterator, Iterator>>>
1491 : it_(other.base()) {}
1495 if constexpr (std::is_pointer_v<Iterator>) {
1498 return it_.operator->();
1502 template <
typename OtherIterator,
typename OtherElementType>
1506 return it_ == other.base();
1508#if V8_HAVE_SPACESHIP_OPERATOR
1509 template <
typename OtherIterator,
typename OtherElementType>
1510 [[nodiscard]]
constexpr auto operator<=>(
1513 if constexpr (std::three_way_comparable_with<Iterator, OtherIterator>) {
1514 return it_ <=> other.base();
1515 }
else if constexpr (std::totally_ordered_with<Iterator, OtherIterator>) {
1516 if (it_ < other.base()) {
1517 return std::strong_ordering::less;
1519 return (it_ > other.base()) ? std::strong_ordering::greater
1520 : std::strong_ordering::equal;
1522 if (it_ < other.base()) {
1523 return std::partial_ordering::less;
1525 if (other.base() < it_) {
1526 return std::partial_ordering::greater;
1528 return (it_ == other.base()) ? std::partial_ordering::equivalent
1529 : std::partial_ordering::unordered;
1535 template <
typename OtherIterator,
typename OtherElementType>
1539 return it_ != other.base();
1542 template <
typename OtherIterator,
typename OtherElementType>
1546 return it_ < other.base();
1548 template <
typename OtherIterator,
typename OtherElementType>
1552 return it_ <= other.base();
1554 template <
typename OtherIterator,
typename OtherElementType>
1558 return it_ > other.base();
1560 template <
typename OtherIterator,
typename OtherElementType>
1564 return it_ >= other.base();
1608 template <
typename OtherIterator,
typename OtherElementType>
1612 return it_ - other.base();
1619 [[nodiscard]]
constexpr const Iterator&
base() const noexcept {
return it_; }
1636#ifdef V8_ENABLE_DIRECT_HANDLE
1637 static constexpr Address kTaggedNullAddress = 1;
1646 template <
typename T>
1654 template <
template <
typename T,
typename... Ms>
typename H,
typename T,
1657 return handle.template value<T>();
1660#ifdef V8_ENABLE_DIRECT_HANDLE
1662 template <
typename T>
1664 return reinterpret_cast<Address>(value);
1667 template <
typename T,
bool check_null = true,
typename S>
1669 if (check_null && slot ==
nullptr) {
1670 return reinterpret_cast<T*
>(kTaggedNullAddress);
1672 return *
reinterpret_cast<T**
>(slot);
1675 template <
typename T>
1680 template <
typename T>
1682 return reinterpret_cast<T*
>(repr);
1687 template <
typename T>
1689 return *
reinterpret_cast<const Address*
>(value);
1692 template <
typename T,
bool check_null = true,
typename S>
1694 return reinterpret_cast<T*
>(slot);
1697 template <
typename T>
1700 reinterpret_cast<const Address*
>(value));
1703 template <
typename T>
1705 return reinterpret_cast<T*
>(repr);
1726 template <
typename T1,
typename T2>
1728 if (lhs.IsEmpty())
return rhs.IsEmpty();
1729 if (rhs.IsEmpty())
return false;
1730 return lhs.ptr() == rhs.ptr();
Definition: v8-isolate.h:274
Definition: v8-internal.h:1356
Definition: v8-internal.h:1714
static bool EqualHandles(const T1 &lhs, const T2 &rhs)
Definition: v8-internal.h:1727
Definition: v8-internal.h:842
static Address LoadMap(Address obj)
Definition: v8-internal.h:1121
static constexpr size_t kExternalAllocationSoftLimit
Definition: v8-internal.h:1040
static bool IsExternalTwoByteString(int instance_type)
Definition: v8-internal.h:1134
static const int kIsolateCageBaseOffset
Definition: v8-internal.h:901
static const int kEmbedderDataArrayHeaderSize
Definition: v8-internal.h:868
static const int kHeapObjectMapOffset
Definition: v8-internal.h:853
static const int kEmbedderDataSlotSize
Definition: v8-internal.h:869
static const int kIsolateApiCallbackThunkArgumentOffset
Definition: v8-internal.h:961
static Address ReadExternalPointerField(v8::Isolate *isolate, Address heap_object_ptr, int offset)
Definition: v8-internal.h:1283
static const int kJSAPIObjectWithEmbedderSlotsHeaderSize
Definition: v8-internal.h:864
static constexpr bool HasHeapObjectTag(Address value)
Definition: v8-internal.h:1060
static const int kOddballType
Definition: v8-internal.h:1017
static const int kInferShouldThrowMode
Definition: v8-internal.h:1036
static const int kNewAllocationInfoOffset
Definition: v8-internal.h:913
static Address GetRoot(v8::Isolate *isolate, int index)
Definition: v8-internal.h:1198
static const int kStringEncodingMask
Definition: v8-internal.h:877
static const int kIsolateFastCCallCallerPcOffset
Definition: v8-internal.h:921
static uint8_t GetNodeFlag(Address *obj, int shift)
Definition: v8-internal.h:1151
static const int kIsolateThreadLocalTopOffset
Definition: v8-internal.h:930
static const uint32_t kNumIsolateDataSlots
Definition: v8-internal.h:881
static const int kForeignType
Definition: v8-internal.h:1018
static const int kFirstEmbedderJSApiObjectType
Definition: v8-internal.h:1025
static const int kNumberOfBooleanFlags
Definition: v8-internal.h:883
static uint8_t GetNodeState(Address *obj)
Definition: v8-internal.h:1162
static const int kThreadLocalTopSize
Definition: v8-internal.h:890
static const int kIsolateRootsOffset
Definition: v8-internal.h:968
static const int kExternalPointerTableSize
Definition: v8-internal.h:896
static const int kUndefinedOddballKind
Definition: v8-internal.h:1029
static const int kMapInstanceTypeOffset
Definition: v8-internal.h:854
static constexpr Address AddressToSmi(Address value)
Definition: v8-internal.h:1068
static const int kIsolateStackGuardOffset
Definition: v8-internal.h:902
static const int kLinearAllocationAreaSize
Definition: v8-internal.h:889
static const int kFastCCallAlignmentPaddingSize
Definition: v8-internal.h:918
static const int kDisallowGarbageCollectionAlign
Definition: v8-internal.h:972
static const int kIsolateFastCCallCallerFpOffset
Definition: v8-internal.h:924
static const int kErrorMessageParamSize
Definition: v8-internal.h:884
static void CheckInitialized(v8::Isolate *isolate)
Definition: v8-internal.h:1054
static void UpdateNodeState(Address *obj, uint8_t value)
Definition: v8-internal.h:1167
static constexpr Address IntegralToSmi(T value)
Definition: v8-internal.h:1079
static constexpr bool IsValidSmi(T value)
Definition: v8-internal.h:1085
static const int kJSObjectType
Definition: v8-internal.h:1020
static const int kBuiltinTier0TableOffset
Definition: v8-internal.h:911
static const int kIsolateLongTaskStatsCounterOffset
Definition: v8-internal.h:928
static const int kNativeContextEmbedderDataOffset
Definition: v8-internal.h:875
static const int kLastJSApiObjectType
Definition: v8-internal.h:1022
static constexpr bool CanHaveInternalField(int instance_type)
Definition: v8-internal.h:1139
static const int kIsolateHandleScopeDataOffset
Definition: v8-internal.h:932
static const int kFirstNonstringType
Definition: v8-internal.h:1016
static const int kEmptyStringRootIndex
Definition: v8-internal.h:1009
static const int kBuiltinTier0EntryTableOffset
Definition: v8-internal.h:908
static const int kFixedArrayHeaderSize
Definition: v8-internal.h:867
static const int kNullOddballKind
Definition: v8-internal.h:1030
static const int kUndefinedValueRootIndex
Definition: v8-internal.h:1004
static const int kExternalTwoByteRepresentationTag
Definition: v8-internal.h:878
static constexpr Address IntToSmi(int value)
Definition: v8-internal.h:1073
static const int kDontThrow
Definition: v8-internal.h:1034
static void CheckInitializedImpl(v8::Isolate *isolate)
static void * GetEmbedderData(const v8::Isolate *isolate, uint32_t slot)
Definition: v8-internal.h:1179
static const int kStackGuardSize
Definition: v8-internal.h:882
static const int kNodeStateMask
Definition: v8-internal.h:1013
static const int kNodeStateIsWeakValue
Definition: v8-internal.h:1014
static const int kFirstJSApiObjectType
Definition: v8-internal.h:1021
static const int kStringResourceOffset
Definition: v8-internal.h:855
static const int kErrorMessageParamOffset
Definition: v8-internal.h:906
static const int kExternalPointerTableBasePointerOffset
Definition: v8-internal.h:895
static const int kFalseValueRootIndex
Definition: v8-internal.h:1008
static const int kIsolateRegexpExecVectorArgumentOffset
Definition: v8-internal.h:964
static const int kIsolateFastApiCallTargetOffset
Definition: v8-internal.h:926
static const int kTrueValueRootIndex
Definition: v8-internal.h:1007
static int GetInstanceType(Address obj)
Definition: v8-internal.h:1113
static const int kThrowOnError
Definition: v8-internal.h:1035
static Address ReadTaggedSignedField(Address heap_object_ptr, int offset)
Definition: v8-internal.h:1262
static const int kOddballKindOffset
Definition: v8-internal.h:858
static const int kBuiltinTier0TableSize
Definition: v8-internal.h:888
static const int kContinuationPreservedEmbedderDataOffset
Definition: v8-internal.h:966
static Address ReadTaggedPointerField(Address heap_object_ptr, int offset)
Definition: v8-internal.h:1251
static const int kNullValueRootIndex
Definition: v8-internal.h:1006
static void SetEmbedderData(v8::Isolate *isolate, uint32_t slot, void *data)
Definition: v8-internal.h:1172
static Address * GetRootSlot(v8::Isolate *isolate, int index)
Definition: v8-internal.h:1192
static const int kTrustedPointerTableSize
Definition: v8-internal.h:897
static const int kTheHoleValueRootIndex
Definition: v8-internal.h:1005
static constexpr int SmiValue(Address value)
Definition: v8-internal.h:1064
static const int kTablesAlignmentPaddingSize
Definition: v8-internal.h:885
static const int kHandleScopeDataSize
Definition: v8-internal.h:891
static const int kExternalOneByteRepresentationTag
Definition: v8-internal.h:879
static const int kBuiltinTier0EntryTableSize
Definition: v8-internal.h:887
static void UpdateNodeFlag(Address *obj, bool value, int shift)
Definition: v8-internal.h:1156
static void IncrementLongTasksStatsCounter(v8::Isolate *isolate)
Definition: v8-internal.h:1186
static const int kDisallowGarbageCollectionSize
Definition: v8-internal.h:973
static const int kOldAllocationInfoOffset
Definition: v8-internal.h:915
static const int kIsolateEmbedderDataOffset
Definition: v8-internal.h:934
static T ReadRawField(Address heap_object_ptr, int offset)
Definition: v8-internal.h:1235
static const int kEmbedderDataSlotExternalPointerOffset
Definition: v8-internal.h:873
static int GetOddballKind(Address obj)
Definition: v8-internal.h:1130
static const int kNodeFlagsOffset
Definition: v8-internal.h:1012
static const int kTrustedPointerTableBasePointerOffset
Definition: v8-internal.h:898
static const int kRegExpStaticResultOffsetsVectorSize
Definition: v8-internal.h:886
static const int kLastEmbedderJSApiObjectType
Definition: v8-internal.h:1026
static const int kVariousBooleanFlagsOffset
Definition: v8-internal.h:904
static constexpr std::optional< Address > TryIntegralToSmi(T value)
Definition: v8-internal.h:1091
static const int kNodeClassIdOffset
Definition: v8-internal.h:1011
static const int kStringRepresentationAndEncodingMask
Definition: v8-internal.h:876
static const int kJSObjectHeaderSize
Definition: v8-internal.h:859
static v8::Isolate * GetIsolateForSandbox(Address obj)
Definition: v8-internal.h:1272
static const int kJSSpecialApiObjectType
Definition: v8-internal.h:1019
Definition: v8-internal.h:1364
friend bool operator==(const StrongRootAllocatorBase &a, const StrongRootAllocatorBase &b)
Definition: v8-internal.h:1368
StrongRootAllocatorBase(Heap *heap)
Definition: v8-internal.h:1376
Address * allocate_impl(size_t n)
StrongRootAllocatorBase(v8::Isolate *isolate)
StrongRootAllocatorBase(LocalIsolate *isolate)
void deallocate_impl(Address *p, size_t n) noexcept
StrongRootAllocatorBase(LocalHeap *heap)
StrongRootAllocatorBase(Isolate *isolate)
Heap * heap() const
Definition: v8-internal.h:1366
Definition: v8-internal.h:1396
StrongRootAllocator(HeapOrIsolateT *)
Definition: v8-internal.h:1401
T value_type
Definition: v8-internal.h:1398
StrongRootAllocator(const StrongRootAllocator< U > &other) noexcept
Definition: v8-internal.h:1403
Definition: v8-internal.h:1628
static Address ValueAsAddress(const T *value)
Definition: v8-internal.h:1688
static T * ReprAsValue(InternalRepresentationType repr)
Definition: v8-internal.h:1704
internal::Address * InternalRepresentationType
Definition: v8-internal.h:1642
static T * SlotAsValue(S *slot)
Definition: v8-internal.h:1693
static T * HandleAsValue(const H< T, Ms... > &handle)
Definition: v8-internal.h:1656
static InternalRepresentationType ValueAsRepr(const T *value)
Definition: v8-internal.h:1698
static bool IsEmpty(T *value)
Definition: v8-internal.h:1647
static constexpr InternalRepresentationType kEmpty
Definition: v8-internal.h:1643
Definition: v8-internal.h:1455
constexpr WrappedIterator & operator-=(difference_type n) noexcept
Definition: v8-internal.h:1605
constexpr WrappedIterator operator--(int) noexcept
Definition: v8-internal.h:1582
constexpr WrappedIterator & operator+=(difference_type n) noexcept
Definition: v8-internal.h:1597
constexpr const Iterator & base() const noexcept
Definition: v8-internal.h:1619
std::conditional_t< std::is_void_v< ElementType >, typename std::iterator_traits< Iterator >::value_type, ElementType > value_type
Definition: v8-internal.h:1469
constexpr WrappedIterator & operator++() noexcept
Definition: v8-internal.h:1568
constexpr pointer operator->() const noexcept
Definition: v8-internal.h:1494
constexpr reference operator[](difference_type n) const noexcept
Definition: v8-internal.h:1614
typename std::iterator_traits< Iterator >::difference_type difference_type
Definition: v8-internal.h:1465
constexpr bool operator!=(const WrappedIterator< OtherIterator, OtherElementType > &other) const noexcept
Definition: v8-internal.h:1536
constexpr bool operator>=(const WrappedIterator< OtherIterator, OtherElementType > &other) const noexcept
Definition: v8-internal.h:1561
constexpr bool operator<(const WrappedIterator< OtherIterator, OtherElementType > &other) const noexcept
Definition: v8-internal.h:1543
std::conditional_t< std::is_void_v< ElementType >, typename std::iterator_traits< Iterator >::reference, std::add_lvalue_reference_t< ElementType > > reference
Definition: v8-internal.h:1477
constexpr WrappedIterator & operator--() noexcept
Definition: v8-internal.h:1578
constexpr WrappedIterator() noexcept=default
constexpr bool operator<=(const WrappedIterator< OtherIterator, OtherElementType > &other) const noexcept
Definition: v8-internal.h:1549
constexpr WrappedIterator(const WrappedIterator< OtherIterator, OtherElementType > &other) noexcept
Definition: v8-internal.h:1489
constexpr bool operator>(const WrappedIterator< OtherIterator, OtherElementType > &other) const noexcept
Definition: v8-internal.h:1555
typename std::iterator_traits< Iterator >::iterator_category iterator_category
Definition: v8-internal.h:1479
constexpr reference operator*() const noexcept
Definition: v8-internal.h:1493
constexpr auto operator-(const WrappedIterator< OtherIterator, OtherElementType > &other) const noexcept
Definition: v8-internal.h:1609
friend constexpr WrappedIterator operator+(difference_type n, const WrappedIterator &x) noexcept
Definition: v8-internal.h:1593
constexpr WrappedIterator operator+(difference_type n) const noexcept
Definition: v8-internal.h:1587
constexpr WrappedIterator operator++(int) noexcept
Definition: v8-internal.h:1572
constexpr WrappedIterator operator-(difference_type n) const noexcept
Definition: v8-internal.h:1601
std::conditional_t< std::is_void_v< ElementType >, typename std::iterator_traits< Iterator >::pointer, std::add_pointer_t< ElementType > > pointer
Definition: v8-internal.h:1473
constexpr bool operator==(const WrappedIterator< OtherIterator, OtherElementType > &other) const noexcept
Definition: v8-internal.h:1503
const intptr_t kHeapObjectTagMask
Definition: v8-internal.h:75
constexpr uint64_t kCppHeapPointerMarkBit
Definition: v8-internal.h:391
constexpr int kCodePointerTableEntrySizeLog2
Definition: v8-internal.h:811
constexpr bool kRuntimeGeneratedCodeObjectsLiveInTrustedSpace
Definition: v8-internal.h:823
internal::Isolate * IsolateFromNeverReadOnlySpaceObject(Address obj)
constexpr uint64_t kExternalPointerTagShift
Definition: v8-internal.h:341
IndirectPointerHandle TrustedPointerHandle
Definition: v8-internal.h:746
const int kApiSystemPointerSize
Definition: v8-internal.h:65
constexpr bool SandboxIsEnabled()
Definition: v8-internal.h:220
const int kApiDoubleSize
Definition: v8-internal.h:66
constexpr size_t kMaxCppHeapPointers
Definition: v8-internal.h:414
constexpr intptr_t kIntptrAllBitsSet
Definition: v8-internal.h:93
constexpr int GB
Definition: v8-internal.h:57
void VerifyHandleIsNonEmpty(bool is_empty)
const int kApiInt32Size
Definition: v8-internal.h:67
const int kForwardingTagSize
Definition: v8-internal.h:82
uint32_t CppHeapPointerHandle
Definition: v8-internal.h:376
const intptr_t kForwardingTagMask
Definition: v8-internal.h:83
void PrintPropertyCallbackInfo(void *property_callback_info)
constexpr ExternalPointerTagRange kAnyManagedResourceExternalPointerTag(kFirstManagedResourceTag, kLastManagedResourceTag)
IndirectPointerHandle CodePointerHandle
Definition: v8-internal.h:784
constexpr uint64_t kExternalPointerPayloadMask
Definition: v8-internal.h:348
const int kSmiTagSize
Definition: v8-internal.h:87
const int kApiInt64Size
Definition: v8-internal.h:68
constexpr ExternalPointerTagRange kAnyExternalPointerTagRange(kFirstExternalPointerTag, kLastExternalPointerTag)
constexpr uint64_t kExternalPointerTagMask
Definition: v8-internal.h:342
constexpr int kCodePointerTableEntryCodeObjectOffset
Definition: v8-internal.h:819
constexpr int kTrustedPointerTableEntrySizeLog2
Definition: v8-internal.h:763
constexpr int kTrustedPointerTableEntrySize
Definition: v8-internal.h:762
constexpr uint64_t kCppHeapPointerPayloadShift
Definition: v8-internal.h:393
constexpr ExternalPointer_t kNullExternalPointer
Definition: v8-internal.h:368
Address ExternalPointer_t
Definition: v8-internal.h:365
uint32_t IndirectPointerHandle
Definition: v8-internal.h:726
constexpr CppHeapPointer_t kNullCppHeapPointer
Definition: v8-internal.h:388
constexpr ExternalPointerTagRange kAnySharedExternalPointerTagRange(kFirstSharedExternalPointerTag, kLastSharedExternalPointerTag)
const int kApiSizetSize
Definition: v8-internal.h:69
constexpr uint64_t kExternalPointerTagAndMarkbitMask
Definition: v8-internal.h:347
constexpr int kCodePointerTableEntryEntrypointOffset
Definition: v8-internal.h:818
constexpr size_t kMaxExternalPointers
Definition: v8-internal.h:336
constexpr size_t kCodePointerTableReservationSize
Definition: v8-internal.h:789
constexpr TrustedPointerHandle kNullTrustedPointerHandle
Definition: v8-internal.h:758
const int kWeakHeapObjectTag
Definition: v8-internal.h:73
constexpr ExternalPointerHandle kNullExternalPointerHandle
Definition: v8-internal.h:369
constexpr ExternalPointerTagRange kAnyMaybeReadOnlyExternalPointerTagRange(kFirstMaybeReadOnlyExternalPointerTag, kLastMaybeReadOnlyExternalPointerTag)
constexpr uintptr_t kUintptrAllBitsSet
Definition: v8-internal.h:94
const int kForwardingTag
Definition: v8-internal.h:81
const intptr_t kHeapObjectReferenceTagMask
Definition: v8-internal.h:76
constexpr bool SmiValuesAre31Bits()
Definition: v8-internal.h:208
constexpr size_t kMaxTrustedPointers
Definition: v8-internal.h:764
bool ShouldThrowOnError(internal::Isolate *isolate)
constexpr uint64_t kCppHeapPointerTagShift
Definition: v8-internal.h:392
constexpr ExternalPointerTagRange kAnyInterceptorInfoExternalPointerTagRange(kFirstInterceptorInfoExternalPointerTag, kLastInterceptorInfoExternalPointerTag)
constexpr int KB
Definition: v8-internal.h:55
constexpr bool kBuiltinCodeObjectsLiveInTrustedSpace
Definition: v8-internal.h:824
constexpr uint32_t kTrustedPointerHandleShift
Definition: v8-internal.h:755
constexpr uint32_t kCodePointerHandleShift
Definition: v8-internal.h:793
constexpr ExternalPointerTagRange kAnyManagedExternalPointerTagRange(kFirstManagedExternalPointerTag, kLastManagedExternalPointerTag)
const int kHeapObjectTag
Definition: v8-internal.h:72
const int kSmiShiftSize
Definition: v8-internal.h:204
constexpr size_t kMaxCodePointers
Definition: v8-internal.h:812
constexpr bool kHaveIteratorCategory
Definition: v8-internal.h:1418
SmiTagging< kApiTaggedSize > PlatformSmiTagging
Definition: v8-internal.h:199
ExternalPointerTag
Definition: v8-internal.h:546
@ kLastForeignExternalPointerTag
Definition: v8-internal.h:639
@ kApiIndexedPropertyDescriptorCallbackTag
Definition: v8-internal.h:589
@ kGenericForeignTag
Definition: v8-internal.h:606
@ kFirstMaybeReadOnlyExternalPointerTag
Definition: v8-internal.h:572
@ kExternalPointerEvacuationEntryTag
Definition: v8-internal.h:647
@ kFirstSharedExternalPointerTag
Definition: v8-internal.h:558
@ kApiNamedPropertyDefinerCallbackTag
Definition: v8-internal.h:583
@ kWasmExportedFunctionDataSignatureTag
Definition: v8-internal.h:600
@ kLastSharedExternalPointerTag
Definition: v8-internal.h:562
@ kD8WorkerTag
Definition: v8-internal.h:637
@ kApiIndexedPropertySetterCallbackTag
Definition: v8-internal.h:588
@ kWasmManagedDataTag
Definition: v8-internal.h:624
@ kLastExternalPointerTag
Definition: v8-internal.h:650
@ kIcuBreakIteratorTag
Definition: v8-internal.h:626
@ kMicrotaskCallbackDataTag
Definition: v8-internal.h:612
@ kWasmNativeModuleTag
Definition: v8-internal.h:625
@ kApiIndexedPropertyGetterCallbackTag
Definition: v8-internal.h:587
@ kApiNamedPropertyDescriptorCallbackTag
Definition: v8-internal.h:582
@ kAccessorInfoGetterTag
Definition: v8-internal.h:574
@ kIcuCollatorTag
Definition: v8-internal.h:635
@ kIcuSimpleDateFormatTag
Definition: v8-internal.h:630
@ kApiIndexedPropertyDefinerCallbackTag
Definition: v8-internal.h:590
@ kSyntheticModuleTag
Definition: v8-internal.h:610
@ kD8ModuleEmbedderDataTag
Definition: v8-internal.h:638
@ kExternalStringResourceTag
Definition: v8-internal.h:560
@ kWasmFuncDataTag
Definition: v8-internal.h:623
@ kExternalObjectValueTag
Definition: v8-internal.h:571
@ kWaiterQueueForeignTag
Definition: v8-internal.h:616
@ kAccessorInfoSetterTag
Definition: v8-internal.h:575
@ kApiNamedPropertyDeleterCallbackTag
Definition: v8-internal.h:584
@ kWasmIndirectFunctionTargetTag
Definition: v8-internal.h:602
@ kApiAccessCheckCallbackTag
Definition: v8-internal.h:608
@ kApiAbortScriptExecutionCallbackTag
Definition: v8-internal.h:609
@ kMicrotaskCallbackTag
Definition: v8-internal.h:611
@ kIcuLocalizedNumberFormatterTag
Definition: v8-internal.h:633
@ kApiNamedPropertyGetterCallbackTag
Definition: v8-internal.h:580
@ kApiNamedPropertySetterCallbackTag
Definition: v8-internal.h:581
@ kApiIndexedPropertyEnumeratorCallbackTag
Definition: v8-internal.h:592
@ kWasmInternalFunctionCallTargetTag
Definition: v8-internal.h:598
@ kExternalPointerFreeEntryTag
Definition: v8-internal.h:648
@ kFirstInterceptorInfoExternalPointerTag
Definition: v8-internal.h:578
@ kCFunctionTag
Definition: v8-internal.h:613
@ kIcuUnicodeStringTag
Definition: v8-internal.h:627
@ kLastManagedExternalPointerTag
Definition: v8-internal.h:640
@ kWaiterQueueNodeTag
Definition: v8-internal.h:559
@ kGenericManagedTag
Definition: v8-internal.h:621
@ kExternalPointerNullTag
Definition: v8-internal.h:548
@ kExternalStringResourceDataTag
Definition: v8-internal.h:561
@ kWasmStackMemoryTag
Definition: v8-internal.h:601
@ kLastManagedResourceTag
Definition: v8-internal.h:644
@ kExternalPointerZappedEntryTag
Definition: v8-internal.h:646
@ kApiNamedPropertyQueryCallbackTag
Definition: v8-internal.h:579
@ kWasmTypeInfoNativeTypeTag
Definition: v8-internal.h:599
@ kEmbedderDataSlotPayloadTag
Definition: v8-internal.h:567
@ kFirstForeignExternalPointerTag
Definition: v8-internal.h:605
@ kIcuListFormatterTag
Definition: v8-internal.h:628
@ kDisplayNamesInternalTag
Definition: v8-internal.h:636
@ kFirstManagedResourceTag
Definition: v8-internal.h:619
@ kFirstManagedExternalPointerTag
Definition: v8-internal.h:620
@ kIcuPluralRulesTag
Definition: v8-internal.h:634
@ kApiIndexedPropertyQueryCallbackTag
Definition: v8-internal.h:586
@ kIcuLocaleTag
Definition: v8-internal.h:629
@ kMessageListenerTag
Definition: v8-internal.h:615
@ kApiIndexedPropertyDeleterCallbackTag
Definition: v8-internal.h:591
@ kLastInterceptorInfoExternalPointerTag
Definition: v8-internal.h:593
@ kIcuRelativeDateTimeFormatterTag
Definition: v8-internal.h:632
@ kWasmWasmStreamingTag
Definition: v8-internal.h:622
@ kNativeContextMicrotaskQueueTag
Definition: v8-internal.h:566
@ kLastMaybeReadOnlyExternalPointerTag
Definition: v8-internal.h:596
@ kArrayBufferExtensionTag
Definition: v8-internal.h:643
@ kIcuDateIntervalFormatTag
Definition: v8-internal.h:631
@ kCFunctionInfoTag
Definition: v8-internal.h:614
@ kFirstExternalPointerTag
Definition: v8-internal.h:547
@ kApiNamedPropertyEnumeratorCallbackTag
Definition: v8-internal.h:585
@ kFunctionTemplateInfoCallbackTag
Definition: v8-internal.h:573
const int kSmiValueSize
Definition: v8-internal.h:205
constexpr ExternalPointerTagRange kAnyForeignExternalPointerTagRange(kFirstForeignExternalPointerTag, kLastForeignExternalPointerTag)
constexpr bool SmiValuesAre32Bits()
Definition: v8-internal.h:209
TagRange< ExternalPointerTag > ExternalPointerTagRange
Definition: v8-internal.h:653
constexpr IndirectPointerHandle kNullIndirectPointerHandle
Definition: v8-internal.h:729
uintptr_t Address
Definition: v8-internal.h:52
void PerformCastCheck(T *data)
Definition: v8-internal.h:1349
void PrintFunctionCallbackInfo(void *function_callback_info)
constexpr size_t kTrustedPointerTableReservationSize
Definition: v8-internal.h:751
uint32_t ExternalPointerHandle
Definition: v8-internal.h:357
const intptr_t kSmiTagMask
Definition: v8-internal.h:88
const int kHeapObjectTagSize
Definition: v8-internal.h:74
const int kSmiMaxValue
Definition: v8-internal.h:207
constexpr bool Is64()
Definition: v8-internal.h:210
constexpr bool kAllCodeObjectsLiveInTrustedSpace
Definition: v8-internal.h:825
const int kSmiTag
Definition: v8-internal.h:86
constexpr CodePointerHandle kNullCodePointerHandle
Definition: v8-internal.h:796
Address CppHeapPointer_t
Definition: v8-internal.h:385
constexpr CppHeapPointerHandle kNullCppHeapPointerHandle
Definition: v8-internal.h:389
constexpr int kGarbageCollectionReasonMaxValue
Definition: v8-internal.h:1360
constexpr int kCodePointerTableEntrySize
Definition: v8-internal.h:810
constexpr uint32_t kCodePointerHandleMarker
Definition: v8-internal.h:805
const int kSmiMinValue
Definition: v8-internal.h:206
constexpr bool kHaveIteratorConcept
Definition: v8-internal.h:1412
constexpr int MB
Definition: v8-internal.h:56
constexpr uint64_t kExternalPointerShiftedTagMask
Definition: v8-internal.h:343
constexpr uint64_t kExternalPointerMarkBit
Definition: v8-internal.h:340
Address SandboxedPointer_t
Definition: v8-internal.h:230
const int kApiTaggedSize
Definition: v8-internal.h:189
constexpr bool PointerCompressionIsEnabled()
Definition: v8-internal.h:192
Definition: libplatform.h:15
Definition: v8-internal.h:1333
static void Perform(T *data)
typename Iterator::iterator_concept iterator_concept
Definition: v8-internal.h:1432
Definition: v8-internal.h:1427
static constexpr bool IsValidSmi(uint64_t value)
Definition: v8-internal.h:141
static constexpr bool IsValidSmi(int64_t value)
Definition: v8-internal.h:134
static constexpr bool IsValidSmi(T value)
Definition: v8-internal.h:114
static constexpr int SmiToInt(Address value)
Definition: v8-internal.h:106
static constexpr bool IsValidSmi(T value)
Definition: v8-internal.h:164
static constexpr int SmiToInt(Address value)
Definition: v8-internal.h:156
Definition: v8-internal.h:91
Definition: v8-internal.h:446
constexpr size_t Size() const
Definition: v8-internal.h:468
constexpr bool IsEmpty() const
Definition: v8-internal.h:466
const Tag last
Definition: v8-internal.h:499
constexpr bool operator==(const TagRange other) const
Definition: v8-internal.h:488
constexpr bool Contains(Tag tag) const
Definition: v8-internal.h:476
const Tag first
Definition: v8-internal.h:498
constexpr TagRange()
Definition: v8-internal.h:463
constexpr TagRange(Tag tag)
Definition: v8-internal.h:459
constexpr size_t hash_value() const
Definition: v8-internal.h:492
constexpr TagRange(Tag first, Tag last)
Definition: v8-internal.h:452
constexpr bool Contains(TagRange tag_range) const
Definition: v8-internal.h:484
#define V8_EXPORT
Definition: v8config.h:800
#define V8_INLINE
Definition: v8config.h:500
#define V8_LIKELY(condition)
Definition: v8config.h:661