Loading...
Searching...
No Matches
v8-internal.h
Go to the documentation of this file.
1// Copyright 2018 the V8 project authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef INCLUDE_V8_INTERNAL_H_
6#define INCLUDE_V8_INTERNAL_H_
7
8#include <stddef.h>
9#include <stdint.h>
10#include <string.h>
11
12#include <atomic>
13#include <compare>
14#include <concepts>
15#include <iterator>
16#include <limits>
17#include <memory>
18#include <optional>
19#include <type_traits>
20
21#include "v8config.h" // NOLINT(build/include_directory)
22
23namespace v8 {
24
25class Array;
26class Context;
27class Data;
28class Isolate;
29
30namespace internal {
31
32class Heap;
33class LocalHeap;
34class Isolate;
35class IsolateGroup;
36class LocalIsolate;
37
38typedef uintptr_t Address;
39static constexpr Address kNullAddress = 0;
40
41constexpr int KB = 1024;
42constexpr int MB = KB * 1024;
43constexpr int GB = MB * 1024;
44#ifdef V8_TARGET_ARCH_X64
45constexpr size_t TB = size_t{GB} * 1024;
46#endif
47
51const int kApiSystemPointerSize = sizeof(void*);
52const int kApiDoubleSize = sizeof(double);
53const int kApiInt32Size = sizeof(int32_t);
54const int kApiInt64Size = sizeof(int64_t);
55const int kApiSizetSize = sizeof(size_t);
56
57// Tag information for HeapObject.
58const int kHeapObjectTag = 1;
59const int kWeakHeapObjectTag = 3;
60const int kHeapObjectTagSize = 2;
61const intptr_t kHeapObjectTagMask = (1 << kHeapObjectTagSize) - 1;
63
64// Tag information for fowarding pointers stored in object headers.
65// 0b00 at the lowest 2 bits in the header indicates that the map word is a
66// forwarding pointer.
67const int kForwardingTag = 0;
68const int kForwardingTagSize = 2;
69const intptr_t kForwardingTagMask = (1 << kForwardingTagSize) - 1;
70
71// Tag information for Smi.
72const int kSmiTag = 0;
73const int kSmiTagSize = 1;
74const intptr_t kSmiTagMask = (1 << kSmiTagSize) - 1;
75
76template <size_t tagged_ptr_size>
78
79constexpr intptr_t kIntptrAllBitsSet = intptr_t{-1};
80constexpr uintptr_t kUintptrAllBitsSet =
81 static_cast<uintptr_t>(kIntptrAllBitsSet);
82
83// Smi constants for systems where tagged pointer is a 32-bit value.
84template <>
85struct SmiTagging<4> {
86 enum { kSmiShiftSize = 0, kSmiValueSize = 31 };
87
88 static constexpr intptr_t kSmiMinValue =
89 static_cast<intptr_t>(kUintptrAllBitsSet << (kSmiValueSize - 1));
90 static constexpr intptr_t kSmiMaxValue = -(kSmiMinValue + 1);
91
92 V8_INLINE static constexpr int SmiToInt(Address value) {
93 int shift_bits = kSmiTagSize + kSmiShiftSize;
94 // Truncate and shift down (requires >> to be sign extending).
95 return static_cast<int32_t>(static_cast<uint32_t>(value)) >> shift_bits;
96 }
97
98 template <class T, typename std::enable_if_t<std::is_integral_v<T> &&
99 std::is_signed_v<T>>* = nullptr>
100 V8_INLINE static constexpr bool IsValidSmi(T value) {
101 // Is value in range [kSmiMinValue, kSmiMaxValue].
102 // Use unsigned operations in order to avoid undefined behaviour in case of
103 // signed integer overflow.
104 return (static_cast<uintptr_t>(value) -
105 static_cast<uintptr_t>(kSmiMinValue)) <=
106 (static_cast<uintptr_t>(kSmiMaxValue) -
107 static_cast<uintptr_t>(kSmiMinValue));
108 }
109
110 template <class T,
111 typename std::enable_if_t<std::is_integral_v<T> &&
112 std::is_unsigned_v<T>>* = nullptr>
113 V8_INLINE static constexpr bool IsValidSmi(T value) {
114 static_assert(kSmiMaxValue <= std::numeric_limits<uintptr_t>::max());
115 return value <= static_cast<uintptr_t>(kSmiMaxValue);
116 }
117
118 // Same as the `intptr_t` version but works with int64_t on 32-bit builds
119 // without slowing down anything else.
120 V8_INLINE static constexpr bool IsValidSmi(int64_t value) {
121 return (static_cast<uint64_t>(value) -
122 static_cast<uint64_t>(kSmiMinValue)) <=
123 (static_cast<uint64_t>(kSmiMaxValue) -
124 static_cast<uint64_t>(kSmiMinValue));
125 }
126
127 V8_INLINE static constexpr bool IsValidSmi(uint64_t value) {
128 static_assert(kSmiMaxValue <= std::numeric_limits<uint64_t>::max());
129 return value <= static_cast<uint64_t>(kSmiMaxValue);
130 }
131};
132
133// Smi constants for systems where tagged pointer is a 64-bit value.
134template <>
135struct SmiTagging<8> {
136 enum { kSmiShiftSize = 31, kSmiValueSize = 32 };
137
138 static constexpr intptr_t kSmiMinValue =
139 static_cast<intptr_t>(kUintptrAllBitsSet << (kSmiValueSize - 1));
140 static constexpr intptr_t kSmiMaxValue = -(kSmiMinValue + 1);
141
142 V8_INLINE static constexpr int SmiToInt(Address value) {
143 int shift_bits = kSmiTagSize + kSmiShiftSize;
144 // Shift down and throw away top 32 bits.
145 return static_cast<int>(static_cast<intptr_t>(value) >> shift_bits);
146 }
147
148 template <class T, typename std::enable_if_t<std::is_integral_v<T> &&
149 std::is_signed_v<T>>* = nullptr>
150 V8_INLINE static constexpr bool IsValidSmi(T value) {
151 // To be representable as a long smi, the value must be a 32-bit integer.
152 return std::numeric_limits<int32_t>::min() <= value &&
153 value <= std::numeric_limits<int32_t>::max();
154 }
155
156 template <class T,
157 typename std::enable_if_t<std::is_integral_v<T> &&
158 std::is_unsigned_v<T>>* = nullptr>
159 V8_INLINE static constexpr bool IsValidSmi(T value) {
160 return value <= std::numeric_limits<int32_t>::max();
161 }
162};
163
164#ifdef V8_COMPRESS_POINTERS
165// See v8:7703 or src/common/ptr-compr-inl.h for details about pointer
166// compression.
167constexpr size_t kPtrComprCageReservationSize = size_t{1} << 32;
168constexpr size_t kPtrComprCageBaseAlignment = size_t{1} << 32;
169
170static_assert(
172 "Pointer compression can be enabled only for 64-bit architectures");
173const int kApiTaggedSize = kApiInt32Size;
174#else
176#endif
177
180}
181
182#ifdef V8_31BIT_SMIS_ON_64BIT_ARCH
183using PlatformSmiTagging = SmiTagging<kApiInt32Size>;
184#else
186#endif
187
188// TODO(ishell): Consinder adding kSmiShiftBits = kSmiShiftSize + kSmiTagSize
189// since it's used much more often than the inividual constants.
190const int kSmiShiftSize = PlatformSmiTagging::kSmiShiftSize;
191const int kSmiValueSize = PlatformSmiTagging::kSmiValueSize;
192const int kSmiMinValue = static_cast<int>(PlatformSmiTagging::kSmiMinValue);
193const int kSmiMaxValue = static_cast<int>(PlatformSmiTagging::kSmiMaxValue);
194constexpr bool SmiValuesAre31Bits() { return kSmiValueSize == 31; }
195constexpr bool SmiValuesAre32Bits() { return kSmiValueSize == 32; }
196constexpr bool Is64() { return kApiSystemPointerSize == sizeof(int64_t); }
197
198V8_INLINE static constexpr Address IntToSmi(int value) {
199 return (static_cast<Address>(value) << (kSmiTagSize + kSmiShiftSize)) |
200 kSmiTag;
201}
202
203/*
204 * Sandbox related types, constants, and functions.
205 */
206constexpr bool SandboxIsEnabled() {
207#ifdef V8_ENABLE_SANDBOX
208 return true;
209#else
210 return false;
211#endif
212}
213
214// SandboxedPointers are guaranteed to point into the sandbox. This is achieved
215// for example by storing them as offset rather than as raw pointers.
217
218#ifdef V8_ENABLE_SANDBOX
219
220// Size of the sandbox, excluding the guard regions surrounding it.
221#if defined(V8_TARGET_OS_ANDROID)
222// On Android, most 64-bit devices seem to be configured with only 39 bits of
223// virtual address space for userspace. As such, limit the sandbox to 128GB (a
224// quarter of the total available address space).
225constexpr size_t kSandboxSizeLog2 = 37; // 128 GB
226#elif defined(V8_TARGET_OS_IOS)
227// On iOS, we only get 64 GB of usable virtual address space even with the
228// "jumbo" extended virtual addressing entitlement. Limit the sandbox size to
229// 16 GB so that the base address + size for the emulated virtual address space
230// lies within the 64 GB total virtual address space.
231constexpr size_t kSandboxSizeLog2 = 34; // 16 GB
232#elif defined(V8_HOST_ARCH_RISCV64)
233// Most RISC-V hardware currently uses Sv39 (39-bit VA, 256GB userspace).
234// Limit the sandbox to 128GB (a quarter of Sv39 userspace) to avoid exceeding
235// the available virtual address space. Uses V8_HOST_ARCH so that simulator
236// builds on x64 are not unnecessarily constrained.
237constexpr size_t kSandboxSizeLog2 = 37; // 128 GB
238#elif defined(V8_TARGET_ARCH_LOONG64)
239// Some hardwares like 2k3000 only have 40-bit virtual address space, 39 bits
240// userspace and kernel each.
241constexpr size_t kSandboxSizeLog2 = 37; // 128 GB
242#else
243// Everywhere else use a 1TB sandbox.
244constexpr size_t kSandboxSizeLog2 = 40; // 1 TB
245#endif // V8_TARGET_OS_ANDROID
246constexpr size_t kSandboxSize = 1ULL << kSandboxSizeLog2;
247
248// Required alignment of the sandbox. For simplicity, we require the
249// size of the guard regions to be a multiple of this, so that this specifies
250// the alignment of the sandbox including and excluding surrounding guard
251// regions. The alignment requirement is due to the pointer compression cage
252// being located at the start of the sandbox.
253constexpr size_t kSandboxAlignment = kPtrComprCageBaseAlignment;
254
255// Sandboxed pointers are stored inside the heap as offset from the sandbox
256// base shifted to the left. This way, it is guaranteed that the offset is
257// smaller than the sandbox size after shifting it to the right again. This
258// constant specifies the shift amount.
259constexpr uint64_t kSandboxedPointerShift = 64 - kSandboxSizeLog2;
260
261// On OSes where reserving virtual memory is too expensive to reserve the
262// entire address space backing the sandbox, notably Windows pre 8.1, we create
263// a partially reserved sandbox that doesn't actually reserve most of the
264// memory, and so doesn't have the desired security properties as unrelated
265// memory allocations could end up inside of it, but which still ensures that
266// objects that should be located inside the sandbox are allocated within
267// kSandboxSize bytes from the start of the sandbox. The minimum size of the
268// region that is actually reserved for such a sandbox is specified by this
269// constant and should be big enough to contain the pointer compression cage as
270// well as the ArrayBuffer partition.
271constexpr size_t kSandboxMinimumReservationSize = 8ULL * GB;
272
273static_assert(kSandboxMinimumReservationSize > kPtrComprCageReservationSize,
274 "The minimum reservation size for a sandbox must be larger than "
275 "the pointer compression cage contained within it.");
276
277// The maximum buffer size allowed inside the sandbox. This is mostly dependent
278// on the size of the guard regions around the sandbox: an attacker must not be
279// able to construct a buffer that appears larger than the guard regions and
280// thereby "reach out of" the sandbox.
281constexpr size_t kMaxSafeBufferSizeForSandbox = 32ULL * GB - 1;
282
283constexpr size_t kBoundedSizeShift = 29;
284static_assert(1ULL << (64 - kBoundedSizeShift) ==
285 kMaxSafeBufferSizeForSandbox + 1,
286 "The maximum size of a BoundedSize must be synchronized with the "
287 "kMaxSafeBufferSizeForSandbox");
288constexpr size_t kBoundedSizeMask = (1ULL << (64 - kBoundedSizeShift)) - 1;
289
290// Size of the guard regions surrounding the sandbox. This assumes a worst-case
291// scenario of a 32-bit unsigned index used to access an array of 64-bit values
292// with an additional 32GB (bounded size) offset. In particular, accesses to
293// TypedArrays are effectively computed as
294// `entry_pointer = array->base + array->offset + index * array->element_size`.
295// See also https://crbug.com/40070746 for more details.
296constexpr size_t kSandboxGuardRegionSize =
297 32ULL * GB + (kMaxSafeBufferSizeForSandbox + 1);
298
299static_assert((kSandboxGuardRegionSize % kSandboxAlignment) == 0,
300 "The size of the guard regions around the sandbox must be a "
301 "multiple of its required alignment.");
302static_assert(kMaxSafeBufferSizeForSandbox <= kSandboxGuardRegionSize,
303 "The maximum allowed buffer size must not be larger than the "
304 "sandbox's guard regions");
305
306#if defined(V8_TARGET_OS_ANDROID)
307// On Android, we often won't have sufficient virtual address space available.
308constexpr size_t kAdditionalTrailingGuardRegionSize = 0;
309#elif defined(V8_TARGET_ARCH_LOONG64)
310// Some hardwares like 2K3000 does not have sufficient virtual address space
311// available.
312constexpr size_t kAdditionalTrailingGuardRegionSize = 0;
313#else
314// Worst-case, we need 8 (max element size) * 32GB (max ArrayBuffer size) +
315// 32GB (additional bounded size offset for TypedArray access).
316constexpr size_t kAdditionalTrailingGuardRegionSize =
317 288ULL * GB - kSandboxGuardRegionSize;
318#endif
319
320constexpr bool kRequiresTypedArrayAccessMasks =
321 kAdditionalTrailingGuardRegionSize == 0;
322
323#endif // V8_ENABLE_SANDBOX
324
325#ifdef V8_COMPRESS_POINTERS
326
327#ifdef V8_TARGET_OS_ANDROID
328// The size of the virtual memory reservation for an external pointer table.
329// This determines the maximum number of entries in a table. Using a maximum
330// size allows omitting bounds checks on table accesses if the indices are
331// guaranteed (e.g. through shifting) to be below the maximum index. This
332// value must be a power of two.
333constexpr size_t kExternalPointerTableReservationSize = 256 * MB;
334
335// The external pointer table indices stored in HeapObjects as external
336// pointers are shifted to the left by this amount to guarantee that they are
337// smaller than the maximum table size even after the C++ compiler multiplies
338// them by 8 to be used as indexes into a table of 64 bit pointers.
339constexpr uint32_t kExternalPointerIndexShift = 7;
340#elif defined(V8_TARGET_OS_IOS)
341// iOS restricts large memory allocations, with 128 MB being the maximum size we
342// can configure. If we exceed this, SegmentedTable::Initialize will throw a V8
343// out-of-memory error when running the JetStream benchmark
344// (https://browserbench.org/JetStream/).
345constexpr size_t kExternalPointerTableReservationSize = 128 * MB;
346constexpr uint32_t kExternalPointerIndexShift = 8;
347#else
348constexpr size_t kExternalPointerTableReservationSize = 512 * MB;
349constexpr uint32_t kExternalPointerIndexShift = 6;
350#endif // V8_TARGET_OS_ANDROID
351
352// The byte size of an entry in an external pointer table.
353constexpr int kExternalPointerTableEntrySize = 8;
354constexpr int kExternalPointerTableEntrySizeLog2 = 3;
355// The maximum number of entries in an external pointer table.
356constexpr size_t kMaxExternalPointers =
357 kExternalPointerTableReservationSize / kExternalPointerTableEntrySize;
358static_assert((1 << (32 - kExternalPointerIndexShift)) == kMaxExternalPointers,
359 "kExternalPointerTableReservationSize and "
360 "kExternalPointerIndexShift don't match");
361
362#else // !V8_COMPRESS_POINTERS
363
364// Needed for the V8.SandboxedExternalPointersCount histogram.
365constexpr size_t kMaxExternalPointers = 0;
366
367#endif // V8_COMPRESS_POINTERS
368
369constexpr uint64_t kExternalPointerMarkBit = 1ULL << 48;
370constexpr uint64_t kExternalPointerTagShift = 49;
371constexpr uint64_t kExternalPointerTagMask = 0x00fe000000000000ULL;
376constexpr uint64_t kExternalPointerTagAndMarkbitMask = 0x00ff000000000000ULL;
377constexpr uint64_t kExternalPointerPayloadMask = 0xff00ffffffffffffULL;
378
379// A ExternalPointerHandle represents a (opaque) reference to an external
380// pointer that can be stored inside the sandbox. A ExternalPointerHandle has
381// meaning only in combination with an (active) Isolate as it references an
382// external pointer stored in the currently active Isolate's
383// ExternalPointerTable. Internally, an ExternalPointerHandles is simply an
384// index into an ExternalPointerTable that is shifted to the left to guarantee
385// that it is smaller than the size of the table.
386using ExternalPointerHandle = uint32_t;
387
388// ExternalPointers point to objects located outside the sandbox. When the V8
389// sandbox is enabled, these are stored on heap as ExternalPointerHandles,
390// otherwise they are simply raw pointers.
391#ifdef V8_ENABLE_SANDBOX
393#else
395#endif
396
399
400// See `ExternalPointerHandle` for the main documentation. The difference to
401// `ExternalPointerHandle` is that the handle does not represent an arbitrary
402// external pointer but always refers to an object managed by `CppHeap`. The
403// handles are using in combination with a dedicated table for `CppHeap`
404// references.
405using CppHeapPointerHandle = uint32_t;
406
407// The actual pointer to objects located on the `CppHeap`. When pointer
408// compression is enabled these pointers are stored as `CppHeapPointerHandle`.
409// In non-compressed configurations the pointers are simply stored as raw
410// pointers.
411#ifdef V8_COMPRESS_POINTERS
413#else
415#endif
416
419
420constexpr uint64_t kCppHeapPointerMarkBit = 1ULL;
421constexpr uint64_t kCppHeapPointerTagShift = 1;
422constexpr uint64_t kCppHeapPointerPayloadShift = 16;
423constexpr uint64_t kCppHeapPointerTagMask =
426
427#ifdef V8_COMPRESS_POINTERS
428// CppHeapPointers use a dedicated pointer table. These constants control the
429// size and layout of the table. See the corresponding constants for the
430// external pointer table for further details.
431constexpr size_t kCppHeapPointerTableReservationSize =
432 kExternalPointerTableReservationSize;
433constexpr uint32_t kCppHeapPointerIndexShift = kExternalPointerIndexShift;
434
435constexpr int kCppHeapPointerTableEntrySize = 8;
436constexpr int kCppHeapPointerTableEntrySizeLog2 = 3;
437constexpr size_t kMaxCppHeapPointers =
438 kCppHeapPointerTableReservationSize / kCppHeapPointerTableEntrySize;
439static_assert((1 << (32 - kCppHeapPointerIndexShift)) == kMaxCppHeapPointers,
440 "kCppHeapPointerTableReservationSize and "
441 "kCppHeapPointerIndexShift don't match");
442
443#else // !V8_COMPRESS_POINTERS
444
445// Needed for the V8.SandboxedCppHeapPointersCount histogram.
446constexpr size_t kMaxCppHeapPointers = 0;
447
448#endif // V8_COMPRESS_POINTERS
449
450// The number of tags reserved for embedder data stored in internal fields. The
451// value is picked arbitrarily, and is slightly larger than the number of tags
452// currently used in Chrome.
453#define V8_EMBEDDER_DATA_TAG_COUNT 15
454
455// The number of tags reserved for pointers stored in v8::External. The value is
456// picked arbitrarily, and is slightly larger than the number of tags currently
457// used in Chrome.
458#define V8_EXTERNAL_POINTER_TAG_COUNT 40
459
460// Generic tag range struct to represent ranges of type tags.
461//
462// When referencing external objects via pointer tables, type tags are
463// frequently necessary to guarantee type safety for the external objects. When
464// support for subtyping is necessary, range-based type checks are used in
465// which all subtypes of a given supertype use contiguous tags. This struct can
466// then be used to represent such a type range.
467//
468// As an example, consider the following type hierarchy:
469//
470// A F
471// / \
472// B E
473// / \
474// C D
475//
476// A potential type id assignment for range-based type checks is
477// {A: 0, B: 1, C: 2, D: 3, E: 4, F: 5}. With that, the type check for type A
478// would check for the range [A, E], while the check for B would check range
479// [B, D], and for F it would simply check [F, F].
480//
481// In addition, there is an option for performance tweaks: if the size of the
482// type range corresponding to a supertype is a power of two and starts at a
483// power of two (e.g. [0x100, 0x13f]), then the compiler can often optimize
484// the type check to use even fewer instructions (essentially replace a AND +
485// SUB with a single AND).
486//
487// Tag ranges can also to a limited degree be used for union types. For
488// example, with the type graph as above, it would be possible to specify a
489// Union(D, E, F) as the tag range [D, F]. However, this only works as long as
490// the (otherwise independent) types that form the union have adjacent tags.
491//
492//
493// There are broadly speaking two options for performing the type check when
494// given the expected type range and the actual tag of the entry.
495//
496// The first option is to simply have the equivalent of
497//
498// CHECK(expected_tag_range.Contains(actual_tag))
499//
500// This is nice and simple, and friendly to both the branch-predictor and the
501// user/developer as it produces clear error messages. However, this approach
502// may result in quite a bit of code being generated, for example for calling
503// RuntimeAbort from generated code or similar.
504//
505// The second option is to generate code such as
506//
507// if (!expected_tag_range.Contains(actual_tag)) return nullptr;
508//
509// With this, we are also guaranteed to crash safely when the returned pointer
510// is used, but this may result in significantly less code being generated, for
511// example because the compiler can implement this with a single conditional
512// select in combination with the zero register (e.g. on Arm).
513//
514// The choice of which approach to use therefore depends on the use case, the
515// performance and code size constraints, and the importance of debuggability.
516template <typename Tag>
517struct TagRange {
518 static_assert(std::is_enum_v<Tag> &&
519 std::is_same_v<std::underlying_type_t<Tag>, uint16_t>,
520 "Tag parameter must be an enum with base type uint16_t");
521
522 // Construct the inclusive tag range [first, last].
523 constexpr TagRange(Tag first, Tag last) : first(first), last(last) {
524#ifdef V8_ENABLE_CHECKS
525 // This would typically be a DCHECK, but that's not available here.
526 if (first > last) __builtin_unreachable(); // Invalid tag range.
527#endif
528 }
529
530 // Construct a tag range consisting of a single tag.
531 //
532 // A single tag is always implicitly convertible to a tag range. This greatly
533 // increases readability as most of the time, the exact tag of a field is
534 // known and so no tag range needs to explicitly be created for it.
535 constexpr TagRange(Tag tag) // NOLINT(runtime/explicit)
536 : first(tag), last(tag) {}
537
538 // Construct an empty tag range.
539 constexpr TagRange() : TagRange(static_cast<Tag>(0)) {}
540
541 // A tag range is considered empty if it only contains the null tag.
542 constexpr bool IsEmpty() const { return first == 0 && last == 0; }
543
544 constexpr size_t Size() const {
545 if (IsEmpty()) {
546 return 0;
547 } else {
548 return last - first + 1;
549 }
550 }
551
552 constexpr bool Contains(Tag tag) const {
553 // Need to perform the math with uint32_t. Otherwise, the uint16_ts would
554 // be promoted to (signed) int, allowing the compiler to (wrongly) assume
555 // that an underflow cannot happen as that would be undefined behavior.
556 return static_cast<uint32_t>(tag) - static_cast<uint32_t>(first) <=
557 static_cast<uint32_t>(last) - static_cast<uint32_t>(first);
558 }
559
560 constexpr bool Contains(TagRange tag_range) const {
561 return tag_range.first >= first && tag_range.last <= last;
562 }
563
564 constexpr bool operator==(const TagRange other) const {
565 return first == other.first && last == other.last;
566 }
567
568 constexpr size_t hash_value() const {
569 static_assert(std::is_same_v<std::underlying_type_t<Tag>, uint16_t>);
570 return (static_cast<size_t>(first) << 16) | last;
571 }
572
573 // Internally we represent tag ranges as closed ranges [first, last].
574 Tag first;
575 Tag last;
576};
577
578enum class ManagedTypeId : uint32_t {
584};
585
586#define SHARED_MANAGED_TAG_LIST(V) V(WasmFutexManagedObjectWaitListTag)
587
588#define MANAGED_TAG_LIST(V) \
589 SHARED_MANAGED_TAG_LIST(V) \
590 V(GenericManagedTag) \
591 V(WasmNativeModuleTag) \
592 V(BackingStoreTag) \
593 V(IcuBreakIteratorTag) \
594 V(IcuListFormatterTag) \
595 V(IcuLocaleTag) \
596 V(IcuSimpleDateFormatTag) \
597 V(IcuDateIntervalFormatTag) \
598 V(IcuRelativeDateTimeFormatterTag) \
599 V(IcuLocalizedNumberFormatterTag) \
600 V(IcuPluralRulesTag) \
601 V(IcuCollatorTag) \
602 V(IcuBreakIteratorWithTextTag) \
603 V(TemporalDurationTag) \
604 V(TemporalInstantTag) \
605 V(TemporalPlainDateTag) \
606 V(TemporalPlainTimeTag) \
607 V(TemporalPlainDateTimeTag) \
608 V(TemporalPlainYearMonthTag) \
609 V(TemporalPlainMonthDayTag) \
610 V(TemporalZonedDateTimeTag) \
611 V(DisplayNamesInternalTag) \
612 V(D8WorkerTag) \
613 V(D8ModuleEmbedderDataTag)
614
615#define FOREIGN_TAG_LIST(V) \
616 V(GenericForeignTag) \
617 V(ApiAccessCheckCallbackTag) \
618 V(ApiAbortScriptExecutionCallbackTag) \
619 V(ApiTemporalHostSystemUTCEpochNanosecondsCallbackTag) \
620 V(CFunctionTag) \
621 V(SyntheticModuleTag) \
622 V(MicrotaskCallbackTag) \
623 V(MicrotaskCallbackDataTag) \
624 V(MessageListenerTag) \
625 V(WaiterQueueForeignTag) \
626 /* Needs to stay last to form a range for resources. */ \
627 MANAGED_TAG_LIST(V)
628
629//
630// External Pointers.
631//
632// When the sandbox is enabled, external pointers are stored in an external
633// pointer table and are referenced from HeapObjects through an index (a
634// "handle"). When stored in the table, the pointers are tagged with per-type
635// tags to prevent type confusion attacks between different external objects.
636//
637// When loading an external pointer, a range of allowed tags can be specified.
638// This way, type hierarchies can be supported. The main requirement for that
639// is that all (transitive) child classes of a given parent class have type ids
640// in the same range, and that there are no unrelated types in that range. For
641// more details about how to assign type tags to types, see the TagRange class.
642//
643// The external pointer sandboxing mechanism ensures that every access to an
644// external pointer field will result in a valid pointer of the expected type
645// even in the presence of an attacker able to corrupt memory inside the
646// sandbox. However, if any data related to the external object is stored
647// inside the sandbox it may still be corrupted and so must be validated before
648// use or moved into the external object. Further, an attacker will always be
649// able to substitute different external pointers of the same type for each
650// other. Therefore, code using external pointers must be written in a
651// "substitution-safe" way, i.e. it must always be possible to substitute
652// external pointers of the same type without causing memory corruption outside
653// of the sandbox. Generally this is achieved by referencing any group of
654// related external objects through a single external pointer.
655//
656// Currently we use bit 62 for the marking bit which should always be unused as
657// it's part of the non-canonical address range. When Arm's top-byte ignore
658// (TBI) is enabled, this bit will be part of the ignored byte, and we assume
659// that the Embedder is not using this byte (really only this one bit) for any
660// other purpose. This bit also does not collide with the memory tagging
661// extension (MTE) which would use bits [56, 60).
662//
663// External pointer tables are also available even when the sandbox is off but
664// pointer compression is on. In that case, the mechanism can be used to ease
665// alignment requirements as it turns unaligned 64-bit raw pointers into
666// aligned 32-bit indices. To "opt-in" to the external pointer table mechanism
667// for this purpose, instead of using the ExternalPointer accessors one needs to
668// use ExternalPointerHandles directly and use them to access the pointers in an
669// ExternalPointerTable.
670//
671// The tag is currently in practice limited to 15 bits since it needs to fit
672// together with a marking bit into the unused parts of a pointer.
673enum ExternalPointerTag : uint16_t {
676
677 // When adding new tags, please ensure that the code using these tags is
678 // "substitution-safe", i.e. still operate safely if external pointers of the
679 // same type are swapped by an attacker. See comment above for more details.
680
681 // Shared external pointers are owned by the shared Isolate and stored in the
682 // shared external pointer table associated with that Isolate, where they can
683 // be accessed from multiple threads at the same time. The objects referenced
684 // in this way must therefore always be thread-safe.
690
691 // External pointers using these tags are kept in a per-Isolate external
692 // pointer table and can only be accessed when this Isolate is active.
694
695 // Placeholders for embedder data.
698
699 // Placeholders for pointers store in v8::External.
703 // This tag is used when a fast-api callback as a parameter of type
704 // `kPointer`. The V8 fast API is only able to use this generic tag, and is
705 // therefore not supposed to be used in Chrome.
711
712 // InterceptorInfo external pointers.
732
734
736
737#define AS_ENUM(name) k##name,
739
740#undef AS_ENUM
741
742 // External resources whose lifetime is tied to their entry in the
743 // external pointer table but which are not referenced via a Managed
750 // The tags are limited to 7 bits, so the last tag is 0x7f.
753
754constexpr const char* ToString(ExternalPointerTag tag) {
755 switch (tag) {
756#define ENUM_CASE(name) \
757 case ExternalPointerTag::k##name: \
758 return #name;
759
761
762#undef ENUM_CASE
763 default:
764 return "Unknown tag";
765 }
767
768using ExternalPointerTagRange = TagRange<ExternalPointerTag>;
769
770#define AS_LIST(name) ExternalPointerTag::k##name,
771
772#define GET_FIRST(LIST) \
773 []() { \
774 ExternalPointerTag items[] = {LIST(AS_LIST)}; \
775 return items[0]; \
776 }()
777
778#define GET_LAST(LIST) \
779 []() { \
780 ExternalPointerTag items[] = {LIST(AS_LIST)}; \
781 return items[(sizeof(items) / sizeof(items[0])) - 1]; \
782 }()
786
796
803
810// kLastManagedResourceTag defined in the enum.
813
821
822#undef AS_LIST
823#undef GET_FIRST
824#undef GET_LAST
825
826// True if the external pointer must be accessed from the shared isolate's
827// external pointer table.
828V8_INLINE static constexpr bool IsSharedExternalPointerType(
829 ExternalPointerTagRange tag_range) {
830 // This range should only be used together with
831 // kAnySharedManagedExternalPointerTagRange in this predicate. Therefore
832 // it is defined in this scope.
833 constexpr ExternalPointerTagRange kAnySharedExternalPointerTagRange(
835 return kAnySharedExternalPointerTagRange.Contains(tag_range) ||
837}
838
839// True if the external pointer may live in a read-only object, in which case
840// the table entry will be in the shared read-only segment of the external
841// pointer table.
842V8_INLINE static constexpr bool IsMaybeReadOnlyExternalPointerType(
843 ExternalPointerTagRange tag_range) {
845}
846
847// True if the external pointer references an external object whose lifetime is
848// tied to the entry in the external pointer table.
849// In this case, the entry in the ExternalPointerTable always points to an
850// object derived from ExternalPointerTable::ManagedResource.
851V8_INLINE static constexpr bool IsManagedExternalPointerType(
852 ExternalPointerTagRange tag_range) {
854}
855
856// When an external poiner field can contain the null external pointer handle,
857// the type checking mechanism needs to also check for null.
858// TODO(saelo): this is mostly a temporary workaround to introduce range-based
859// type checks. In the future, we should either (a) change the type tagging
860// scheme so that null always passes or (b) (more likely) introduce dedicated
861// null entries for those tags that need them (similar to other well-known
862// empty value constants such as the empty fixed array).
863V8_INLINE static constexpr bool ExternalPointerCanBeEmpty(
864 ExternalPointerTagRange tag_range) {
865 return tag_range.Contains(kArrayBufferExtensionTag) ||
866 (tag_range.first <= kLastEmbedderDataTag &&
867 kFirstEmbedderDataTag <= tag_range.last) ||
869}
870
871// Indirect Pointers.
872//
873// When the sandbox is enabled, indirect pointers are used to reference
874// HeapObjects that live outside of the sandbox (but are still managed by V8's
875// garbage collector). When object A references an object B through an indirect
876// pointer, object A will contain a IndirectPointerHandle, i.e. a shifted
877// 32-bit index, which identifies an entry in a pointer table (either the
878// trusted pointer table for TrustedObjects, or the code pointer table if it is
879// a Code object). This table entry then contains the actual pointer to object
880// B. Further, object B owns this pointer table entry, and it is responsible
881// for updating the "self-pointer" in the entry when it is relocated in memory.
882// This way, in contrast to "normal" pointers, indirect pointers never need to
883// be tracked by the GC (i.e. there is no remembered set for them).
884// These pointers do not exist when the sandbox is disabled.
885
886// An IndirectPointerHandle represents a 32-bit index into a pointer table.
887using IndirectPointerHandle = uint32_t;
888
889// A null handle always references an entry that contains nullptr.
891
892// When the sandbox is enabled, indirect pointers are used to implement:
893// - TrustedPointers: an indirect pointer using the trusted pointer table (TPT)
894// and referencing a TrustedObject in one of the trusted heap spaces.
895// - CodePointers, an indirect pointer using the code pointer table (CPT) and
896// referencing a Code object together with its instruction stream.
897
898//
899// Trusted Pointers.
900//
901// A pointer to a TrustedObject.
902// When the sandbox is enabled, these are indirect pointers using the trusted
903// pointer table (TPT). They are used to reference trusted objects (located in
904// one of V8's trusted heap spaces, outside of the sandbox) from inside the
905// sandbox in a memory-safe way. When the sandbox is disabled, these are
906// regular tagged pointers.
909// The size of the virtual memory reservation for the trusted pointer table.
910// As with the external pointer table, a maximum table size in combination with
911// shifted indices allows omitting bounds checks.
913
914// The trusted pointer handles are stored shifted to the left by this amount
915// to guarantee that they are smaller than the maximum table size.
916constexpr uint32_t kTrustedPointerHandleShift = 9;
917
918// A null handle always references an entry that contains nullptr.
921
922// The byte size of an entry in the trusted pointer table.
923constexpr int kTrustedPointerTableEntrySize = 8;
924constexpr int kTrustedPointerTableEntrySizeLog2 = 3;
925// The maximum number of entries in the trusted pointer table.
926constexpr size_t kMaxTrustedPointers =
928static_assert((1 << (32 - kTrustedPointerHandleShift)) == kMaxTrustedPointers,
929 "kTrustedPointerTableReservationSize and "
930 "kTrustedPointerHandleShift don't match");
932// The size of the virtual memory reservation for the Wasm code pointer table.
933// As with the other tables, a maximum table size in combination with shifted
934// indices allows omitting bounds checks.
937// Constants that can be used to mark places that should be modified once
938// certain types of objects are moved out of the sandbox and into trusted space.
940constexpr bool kBuiltinCodeObjectsLiveInTrustedSpace = false;
944
945// {obj} must be the raw tagged pointer representation of a HeapObject
946// that's guaranteed to never be in ReadOnlySpace.
948 "Use GetCurrentIsolate() instead, which is guaranteed to return the same "
949 "isolate since https://crrev.com/c/6458560.")
952// Returns if we need to throw when an error occurs. This infers the language
953// mode based on the current context and the closure. This returns true if the
954// language mode is strict.
955V8_EXPORT bool ShouldThrowOnError(internal::Isolate* isolate);
956
957struct HandleScopeData final {
958 static constexpr uint32_t kSizeInBytes =
961 Address* next;
962 Address* limit;
963 int level;
964 int sealed_level;
965
966 void Initialize() {
967 next = limit = nullptr;
968 sealed_level = level = 0;
969 }
970};
971
972static_assert(HandleScopeData::kSizeInBytes == sizeof(HandleScopeData));
973
979class Internals {
980#ifdef V8_MAP_PACKING
981 V8_INLINE static constexpr Address UnpackMapWord(Address mapword) {
982 // TODO(wenyuzhao): Clear header metadata.
983 return mapword ^ kMapWordXorMask;
984 }
985#endif
987 public:
988 // These values match non-compiler-dependent values defined within
989 // the implementation of v8.
990 static const int kHeapObjectMapOffset = 0;
992 static const int kStringResourceOffset =
994
995 static const int kOddballKindOffset = 4 * kApiTaggedSize + kApiDoubleSize;
996 static const int kJSObjectHeaderSize = 3 * kApiTaggedSize;
997#ifdef V8_COMPRESS_POINTERS
1000#else // !V8_COMPRESS_POINTERS
1003#endif // !V8_COMPRESS_POINTERS
1004 static const int kFixedArrayHeaderSize = 2 * kApiTaggedSize;
1005 static const int kEmbedderDataArrayHeaderSize = 2 * kApiTaggedSize;
1007#if defined(V8_COMPRESS_POINTERS) && !defined(V8_ENABLE_SANDBOX)
1009#else
1011#endif
1013 static const int kStringRepresentationAndEncodingMask = 0x0f;
1014 static const int kStringEncodingMask = 0x8;
1015 static const int kExternalTwoByteRepresentationTag = 0x02;
1016 static const int kExternalOneByteRepresentationTag = 0x0a;
1018 // AccessorInfo::data and InterceptorInfo::data field.
1021 static const uint32_t kNumIsolateDataSlots = 4;
1023 static const int kNumberOfBooleanFlags = 6;
1024 static const int kErrorMessageParamSize = 1;
1025 static const int kTablesAlignmentPaddingSize = 1;
1028 static const int kBuiltinTier0TableSize = 7 * kApiSystemPointerSize;
1030 static const int kThreadLocalTopSize = 28 * kApiSystemPointerSize;
1031 static const int kHandleScopeDataSize =
1033 static const int kHandleScopeImplementerSize =
1036 // ExternalPointerTable, CppHeapPointerTable and TrustedPointerTable layout
1037 // guarantees.
1038 static const int kExternalEntityTableBasePointerOffset = 0;
1039 static const int kSegmentedTableSegmentPoolSize = 4;
1040 static const int kExternalEntityTableSize =
1043
1044 // IsolateData layout guarantees.
1045 static const int kIsolateCageBaseOffset = 0;
1046 static const int kIsolateStackGuardOffset =
1050 static const int kErrorMessageParamOffset =
1052 static const int kBuiltinTier0EntryTableOffset =
1055 static const int kBuiltinTier0TableOffset =
1057 static const int kNewAllocationInfoOffset =
1059 static const int kOldAllocationInfoOffset =
1061 static const int kLastYoungAllocationOffset =
1064 static const int kFastCCallAlignmentPaddingSize =
1067 static const int kIsolateFastCCallCallerPcOffset =
1080 static const int kIsolateHandleScopeImplementerOffset =
1082 static const int kIsolateEmbedderDataOffset =
1084#ifdef V8_COMPRESS_POINTERS
1085 static const int kIsolateExternalPointerTableOffset =
1087 static const int kIsolateSharedExternalPointerTableAddressOffset =
1088 kIsolateExternalPointerTableOffset + kExternalEntityTableSize;
1089 static const int kIsolateCppHeapPointerTableOffset =
1090 kIsolateSharedExternalPointerTableAddressOffset + kApiSystemPointerSize;
1091#ifdef V8_ENABLE_SANDBOX
1092 static const int kIsolateTrustedCageBaseOffset =
1093 kIsolateCppHeapPointerTableOffset + kExternalEntityTableSize;
1094 static const int kIsolateTrustedPointerTableOffset =
1095 kIsolateTrustedCageBaseOffset + kApiSystemPointerSize;
1096 static const int kIsolateSharedTrustedPointerTableAddressOffset =
1097 kIsolateTrustedPointerTableOffset + kExternalEntityTableSize;
1098 static const int kIsolateTrustedPointerPublishingScopeOffset =
1099 kIsolateSharedTrustedPointerTableAddressOffset + kApiSystemPointerSize;
1100 static const int kIsolateJSDispatchTableOffset =
1101 kIsolateTrustedPointerPublishingScopeOffset + kApiSystemPointerSize;
1102#else
1104 kIsolateCppHeapPointerTableOffset + kExternalEntityTableSize;
1105#endif // V8_ENABLE_SANDBOX
1106#else
1107 static const int kIsolateJSDispatchTableOffset =
1109#endif // V8_COMPRESS_POINTERS
1118 static const int kCurrentMicrotaskNativeContextOffset =
1120 static const int kIsolateRootsOffset =
1123#if V8_TARGET_ARCH_PPC64
1124 static constexpr int kFrameCPSlotCount = 1;
1125#else
1126 static constexpr int kFrameCPSlotCount = 0;
1127#endif
1128
1129#if V8_TARGET_ARCH_ARM64
1130 // The padding required to keep SP 16-byte aligned.
1131 static constexpr int kSPAlignmentSlotCount = 1;
1132#else
1133 static constexpr int kSPAlignmentSlotCount = 0;
1134#endif
1136 static const int kFrameTypeApiCallExit = 18;
1137 static const int kFrameTypeApiConstructExit = 19;
1138 static const int kFrameTypeApiNamedAccessorExit = 20;
1140
1141 // Assert scopes
1142 static const int kDisallowGarbageCollectionAlign = alignof(uint32_t);
1143 static const int kDisallowGarbageCollectionSize = sizeof(uint32_t);
1144
1145#if V8_STATIC_ROOTS_BOOL
1146
1147// These constants are copied from static-roots.h and guarded by static asserts.
1148#define EXPORTED_STATIC_ROOTS_PTR_LIST(V) \
1149 V(UndefinedValue, 0x11) \
1150 V(NullValue, 0x2d) \
1151 V(TrueValue, 0x71) \
1152 V(FalseValue, 0x55) \
1153 V(EmptyString, 0x49) \
1154 /* The Hole moves around depending on build flags, so define it */ \
1155 /* separately inside StaticReadOnlyRoot using build macros */ \
1156 V(TheHoleValue, kBuildDependentTheHoleValue)
1157
1158 using Tagged_t = uint32_t;
1159 struct StaticReadOnlyRoot {
1160#ifdef V8_ENABLE_WEBASSEMBLY
1161 static constexpr Tagged_t kBuildDependentTheHoleValue = 0x2fffd;
1162#else
1163 static constexpr Tagged_t kBuildDependentTheHoleValue = 0xfffd;
1164#endif
1165
1166#define DEF_ROOT(name, value) static constexpr Tagged_t k##name = value;
1167 EXPORTED_STATIC_ROOTS_PTR_LIST(DEF_ROOT)
1168#undef DEF_ROOT
1169
1170 // Use 0 for kStringMapLowerBound since string maps are the first maps.
1171 static constexpr Tagged_t kStringMapLowerBound = 0;
1172 static constexpr Tagged_t kStringMapUpperBound = 0x425;
1173
1174#define PLUSONE(...) +1
1175 static constexpr size_t kNumberOfExportedStaticRoots =
1176 2 + EXPORTED_STATIC_ROOTS_PTR_LIST(PLUSONE);
1177#undef PLUSONE
1180#endif // V8_STATIC_ROOTS_BOOL
1182 static const int kUndefinedValueRootIndex = 0;
1183 static const int kTheHoleValueRootIndex = 1;
1184 static const int kNullValueRootIndex = 2;
1185 static const int kTrueValueRootIndex = 3;
1186 static const int kFalseValueRootIndex = 4;
1187 static const int kEmptyStringRootIndex = 5;
1189 static const int kNodeClassIdOffset = 1 * kApiSystemPointerSize;
1190 static const int kNodeFlagsOffset = 1 * kApiSystemPointerSize + 3;
1191 static const int kNodeStateMask = 0x3;
1192 static const int kNodeStateIsWeakValue = 2;
1194 static const int kFirstNonstringType = 0x80;
1195 static const int kOddballType = 0x83;
1196 static const int kForeignType = 0xcc;
1197 static const int kJSSpecialApiObjectType = 0x410;
1198 static const int kJSObjectType = 0x421;
1199 static const int kFirstJSApiObjectType = 0x422;
1200 static const int kLastJSApiObjectType = 0x80A;
1201 // Defines a range [kFirstEmbedderJSApiObjectType, kJSApiObjectTypesCount]
1202 // of JSApiObject instance type values that an embedder can use.
1203 static const int kFirstEmbedderJSApiObjectType = 0;
1206
1207 static const int kUndefinedOddballKind = 4;
1208 static const int kNullOddballKind = 3;
1210 // Constants used by PropertyCallbackInfo to check if we should throw when an
1211 // error occurs.
1212 static const int kDontThrow = 0;
1213 static const int kThrowOnError = 1;
1214 static const int kInferShouldThrowMode = 2;
1215
1216 // Soft limit for AdjustAmountofExternalAllocatedMemory. Trigger an
1217 // incremental GC once the external memory reaches this limit.
1218 static constexpr size_t kExternalAllocationSoftLimit = 64 * 1024 * 1024;
1219
1220#ifdef V8_MAP_PACKING
1221 static const uintptr_t kMapWordMetadataMask = 0xffffULL << 48;
1222 // The lowest two bits of mapwords are always `0b10`
1223 static const uintptr_t kMapWordSignature = 0b10;
1224 // XORing a (non-compressed) map with this mask ensures that the two
1225 // low-order bits are 0b10. The 0 at the end makes this look like a Smi,
1226 // although real Smis have all lower 32 bits unset. We only rely on these
1227 // values passing as Smis in very few places.
1228 static const int kMapWordXorMask = 0b11;
1229#endif
1230
1231 V8_EXPORT static void CheckInitializedImpl(v8::Isolate* isolate);
1232 V8_INLINE static void CheckInitialized(v8::Isolate* isolate) {
1233#ifdef V8_ENABLE_CHECKS
1235#endif
1236 }
1237
1238 V8_INLINE static constexpr bool HasHeapObjectTag(Address value) {
1239 return (value & kHeapObjectTagMask) == static_cast<Address>(kHeapObjectTag);
1240 }
1241
1242 V8_INLINE static constexpr int SmiValue(Address value) {
1243 return PlatformSmiTagging::SmiToInt(value);
1244 }
1245
1246 V8_INLINE static constexpr Address AddressToSmi(Address value) {
1247 return (value << (kSmiTagSize + PlatformSmiTagging::kSmiShiftSize)) |
1248 kSmiTag;
1249 }
1250
1251 V8_INLINE static constexpr Address IntToSmi(int value) {
1252 return AddressToSmi(static_cast<Address>(value));
1254
1255 template <typename T,
1256 typename std::enable_if_t<std::is_integral_v<T>>* = nullptr>
1257 V8_INLINE static constexpr Address IntegralToSmi(T value) {
1258 return AddressToSmi(static_cast<Address>(value));
1260
1261 template <typename T,
1262 typename std::enable_if_t<std::is_integral_v<T>>* = nullptr>
1263 V8_INLINE static constexpr bool IsValidSmi(T value) {
1264 return PlatformSmiTagging::IsValidSmi(value);
1266
1267 template <typename T,
1268 typename std::enable_if_t<std::is_integral_v<T>>* = nullptr>
1269 static constexpr std::optional<Address> TryIntegralToSmi(T value) {
1270 if (V8_LIKELY(PlatformSmiTagging::IsValidSmi(value))) {
1271 return {AddressToSmi(static_cast<Address>(value))};
1272 }
1273 return {};
1274 }
1275
1276#if V8_STATIC_ROOTS_BOOL
1277 V8_INLINE static bool is_identical(Address obj, Tagged_t constant) {
1278 return static_cast<Tagged_t>(obj) == constant;
1279 }
1280
1281 V8_INLINE static bool CheckInstanceMapRange(Address obj, Tagged_t first_map,
1282 Tagged_t last_map) {
1283 auto map = ReadRawField<Tagged_t>(obj, kHeapObjectMapOffset);
1284#ifdef V8_MAP_PACKING
1285 map = UnpackMapWord(map);
1286#endif
1287 return map >= first_map && map <= last_map;
1288 }
1289#endif
1290
1291 V8_INLINE static int GetInstanceType(Address obj) {
1293#ifdef V8_MAP_PACKING
1294 map = UnpackMapWord(map);
1295#endif
1296 return ReadRawField<uint16_t>(map, kMapInstanceTypeOffset);
1297 }
1298
1299 V8_INLINE static Address LoadMap(Address obj) {
1300 if (!HasHeapObjectTag(obj)) return kNullAddress;
1302#ifdef V8_MAP_PACKING
1303 map = UnpackMapWord(map);
1304#endif
1305 return map;
1306 }
1307
1310 }
1311
1312 V8_INLINE static bool IsExternalTwoByteString(int instance_type) {
1313 int representation = (instance_type & kStringRepresentationAndEncodingMask);
1314 return representation == kExternalTwoByteRepresentationTag;
1315 }
1316
1317 V8_INLINE static bool IsExternalOneByteString(int instance_type) {
1318 int representation = (instance_type & kStringRepresentationAndEncodingMask);
1319 return representation == kExternalOneByteRepresentationTag;
1320 }
1321
1322 V8_INLINE static constexpr bool CanHaveInternalField(int instance_type) {
1323 static_assert(kJSObjectType + 1 == kFirstJSApiObjectType);
1324 static_assert(kJSObjectType < kLastJSApiObjectType);
1326 // Check for IsJSObject() || IsJSSpecialApiObject() || IsJSApiObject()
1327 return instance_type == kJSSpecialApiObjectType ||
1328 // inlined version of base::IsInRange
1329 (static_cast<unsigned>(static_cast<unsigned>(instance_type) -
1330 static_cast<unsigned>(kJSObjectType)) <=
1331 static_cast<unsigned>(kLastJSApiObjectType - kJSObjectType));
1332 }
1333
1334 V8_INLINE static uint8_t GetNodeFlag(Address* obj, int shift) {
1335 uint8_t* addr = reinterpret_cast<uint8_t*>(obj) + kNodeFlagsOffset;
1336 return *addr & static_cast<uint8_t>(1U << shift);
1337 }
1338
1339 V8_INLINE static void UpdateNodeFlag(Address* obj, bool value, int shift) {
1340 uint8_t* addr = reinterpret_cast<uint8_t*>(obj) + kNodeFlagsOffset;
1341 uint8_t mask = static_cast<uint8_t>(1U << shift);
1342 *addr = static_cast<uint8_t>((*addr & ~mask) | (value << shift));
1343 }
1344
1345 V8_INLINE static uint8_t GetNodeState(Address* obj) {
1346 uint8_t* addr = reinterpret_cast<uint8_t*>(obj) + kNodeFlagsOffset;
1347 return *addr & kNodeStateMask;
1348 }
1349
1350 V8_INLINE static void UpdateNodeState(Address* obj, uint8_t value) {
1351 uint8_t* addr = reinterpret_cast<uint8_t*>(obj) + kNodeFlagsOffset;
1352 *addr = static_cast<uint8_t>((*addr & ~kNodeStateMask) | value);
1353 }
1354
1355 V8_INLINE static void SetEmbedderData(v8::Isolate* isolate, uint32_t slot,
1356 void* data) {
1357 Address addr = reinterpret_cast<Address>(isolate) +
1359 *reinterpret_cast<void**>(addr) = data;
1360 }
1361
1362 V8_INLINE static void* GetEmbedderData(const v8::Isolate* isolate,
1363 uint32_t slot) {
1364 Address addr = reinterpret_cast<Address>(isolate) +
1366 return *reinterpret_cast<void* const*>(addr);
1367 }
1368
1370 Address addr =
1371 reinterpret_cast<Address>(isolate) + kIsolateHandleScopeDataOffset;
1372 return reinterpret_cast<HandleScopeData*>(addr);
1373 }
1374
1376 Address addr =
1377 reinterpret_cast<Address>(isolate) + kIsolateLongTaskStatsCounterOffset;
1378 ++(*reinterpret_cast<size_t*>(addr));
1379 }
1380
1381 V8_INLINE static Address* GetRootSlot(v8::Isolate* isolate, int index) {
1382 Address addr = reinterpret_cast<Address>(isolate) + kIsolateRootsOffset +
1384 return reinterpret_cast<Address*>(addr);
1385 }
1386
1387 V8_INLINE static Address GetRoot(v8::Isolate* isolate, int index) {
1388#if V8_STATIC_ROOTS_BOOL
1389 Address base = *reinterpret_cast<Address*>(
1390 reinterpret_cast<uintptr_t>(isolate) + kIsolateCageBaseOffset);
1391 switch (index) {
1392#define DECOMPRESS_ROOT(name, ...) \
1393 case k##name##RootIndex: \
1394 return base + StaticReadOnlyRoot::k##name;
1395 EXPORTED_STATIC_ROOTS_PTR_LIST(DECOMPRESS_ROOT)
1396#undef DECOMPRESS_ROOT
1397#undef EXPORTED_STATIC_ROOTS_PTR_LIST
1398 default:
1399 break;
1400 }
1401#endif // V8_STATIC_ROOTS_BOOL
1402 return *GetRootSlot(isolate, index);
1403 }
1404
1405#ifdef V8_ENABLE_SANDBOX
1406 V8_INLINE static Address* GetExternalPointerTableBase(v8::Isolate* isolate) {
1407 Address addr = reinterpret_cast<Address>(isolate) +
1408 kIsolateExternalPointerTableOffset +
1410 return *reinterpret_cast<Address**>(addr);
1411 }
1412
1413 V8_INLINE static Address* GetSharedExternalPointerTableBase(
1414 v8::Isolate* isolate) {
1415 Address addr = reinterpret_cast<Address>(isolate) +
1416 kIsolateSharedExternalPointerTableAddressOffset;
1417 addr = *reinterpret_cast<Address*>(addr);
1419 return *reinterpret_cast<Address**>(addr);
1421#endif
1422
1423 template <typename T>
1424 V8_INLINE static T ReadRawField(Address heap_object_ptr, int offset) {
1425 Address addr = heap_object_ptr + offset - kHeapObjectTag;
1426#ifdef V8_COMPRESS_POINTERS
1427 if constexpr (sizeof(T) > kApiTaggedSize) {
1428 // TODO(ishell, v8:8875): When pointer compression is enabled 8-byte size
1429 // fields (external pointers, doubles and BigInt data) are only
1430 // kTaggedSize aligned so we have to use unaligned pointer friendly way of
1431 // accessing them in order to avoid undefined behavior in C++ code.
1432 T r;
1433 memcpy(&r, reinterpret_cast<void*>(addr), sizeof(T));
1434 return r;
1435 }
1436#endif
1437 return *reinterpret_cast<const T*>(addr);
1438 }
1439
1440 V8_INLINE static Address ReadTaggedPointerField(Address heap_object_ptr,
1441 int offset) {
1442#ifdef V8_COMPRESS_POINTERS
1443 uint32_t value = ReadRawField<uint32_t>(heap_object_ptr, offset);
1444 Address base = GetPtrComprCageBaseFromOnHeapAddress(heap_object_ptr);
1445 return base + static_cast<Address>(static_cast<uintptr_t>(value));
1446#else
1447 return ReadRawField<Address>(heap_object_ptr, offset);
1448#endif
1449 }
1450
1451 V8_INLINE static Address ReadTaggedSignedField(Address heap_object_ptr,
1452 int offset) {
1453#ifdef V8_COMPRESS_POINTERS
1454 uint32_t value = ReadRawField<uint32_t>(heap_object_ptr, offset);
1455 return static_cast<Address>(static_cast<uintptr_t>(value));
1456#else
1457 return ReadRawField<Address>(heap_object_ptr, offset);
1458#endif
1460
1461 // Returns v8::Isolate::Current(), but without needing to include the
1462 // v8-isolate.h header.
1464
1466#ifdef V8_ENABLE_SANDBOX
1467 return GetCurrentIsolate();
1468#else
1469 // Not used in non-sandbox mode.
1470 return nullptr;
1471#endif
1472 }
1473
1474 template <ExternalPointerTagRange tag_range>
1476 Address heap_object_ptr,
1477 int offset) {
1478#ifdef V8_ENABLE_SANDBOX
1479 static_assert(!tag_range.IsEmpty());
1480 // See src/sandbox/external-pointer-table.h. Logic duplicated here so
1481 // it can be inlined and doesn't require an additional call.
1482 Address* table = IsSharedExternalPointerType(tag_range)
1483 ? GetSharedExternalPointerTableBase(isolate)
1484 : GetExternalPointerTableBase(isolate);
1486 ReadRawField<ExternalPointerHandle>(heap_object_ptr, offset);
1487 uint32_t index = handle >> kExternalPointerIndexShift;
1488 std::atomic<Address>* ptr =
1489 reinterpret_cast<std::atomic<Address>*>(&table[index]);
1490 Address entry = std::atomic_load_explicit(ptr, std::memory_order_relaxed);
1491 ExternalPointerTag actual_tag = static_cast<ExternalPointerTag>(
1493 volatile Address safe_entry;
1494 if (V8_LIKELY(tag_range.Contains(actual_tag))) {
1495 safe_entry = entry & kExternalPointerPayloadMask;
1496 } else {
1497 safe_entry = 0;
1498 }
1499 return safe_entry;
1500#else
1501 return ReadRawField<Address>(heap_object_ptr, offset);
1502#endif // V8_ENABLE_SANDBOX
1503 }
1504
1506 v8::Isolate* isolate, Address heap_object_ptr, int offset,
1507 ExternalPointerTagRange tag_range) {
1508#ifdef V8_ENABLE_SANDBOX
1509 // See src/sandbox/external-pointer-table.h. Logic duplicated here so
1510 // it can be inlined and doesn't require an additional call.
1511 Address* table = IsSharedExternalPointerType(tag_range)
1512 ? GetSharedExternalPointerTableBase(isolate)
1513 : GetExternalPointerTableBase(isolate);
1515 ReadRawField<ExternalPointerHandle>(heap_object_ptr, offset);
1516 uint32_t index = handle >> kExternalPointerIndexShift;
1517 std::atomic<Address>* ptr =
1518 reinterpret_cast<std::atomic<Address>*>(&table[index]);
1519 Address entry = std::atomic_load_explicit(ptr, std::memory_order_relaxed);
1520 ExternalPointerTag actual_tag = static_cast<ExternalPointerTag>(
1522 // Avoid DCE of the entry logic using volatile.
1523 volatile Address safe_entry;
1524 if (V8_LIKELY(tag_range.Contains(actual_tag))) {
1525 safe_entry = entry & kExternalPointerPayloadMask;
1526 } else {
1527 safe_entry = 0;
1528 }
1529 return safe_entry;
1530#else
1531 return ReadRawField<Address>(heap_object_ptr, offset);
1532#endif // V8_ENABLE_SANDBOX
1533 }
1534
1535#ifdef V8_COMPRESS_POINTERS
1536 V8_INLINE static Address GetPtrComprCageBaseFromOnHeapAddress(Address addr) {
1537 return addr & -static_cast<intptr_t>(kPtrComprCageBaseAlignment);
1538 }
1539
1540 V8_INLINE static uint32_t CompressTagged(Address value) {
1541 return static_cast<uint32_t>(value);
1542 }
1543
1544 V8_INLINE static Address DecompressTaggedField(Address heap_object_ptr,
1545 uint32_t value) {
1546 Address base = GetPtrComprCageBaseFromOnHeapAddress(heap_object_ptr);
1547 return base + static_cast<Address>(static_cast<uintptr_t>(value));
1548 }
1549
1550#endif // V8_COMPRESS_POINTERS
1551};
1553// Only perform cast check for types derived from v8::Data since
1554// other types do not implement the Cast method.
1555template <bool PerformCheck>
1556struct CastCheck {
1557 template <class T>
1558 static void Perform(T* data);
1560
1561template <>
1562template <class T>
1563void CastCheck<true>::Perform(T* data) {
1564 T::Cast(data);
1566
1567template <>
1568template <class T>
1569void CastCheck<false>::Perform(T* data) {}
1570
1571template <class T>
1572V8_INLINE void PerformCastCheck(T* data) {
1573 CastCheck<std::is_base_of_v<Data, T> &&
1574 !std::is_same_v<Data, std::remove_cv_t<T>>>::Perform(data);
1576
1577// A base class for backing stores, which is needed due to vagaries of
1578// how static casts work with std::shared_ptr.
1580
1581// The maximum value in enum GarbageCollectionReason, defined in heap.h.
1582// This is needed for histograms sampling garbage collection reasons.
1584
1585// Base class for the address block allocator compatible with standard
1586// containers, which registers its allocated range as strong roots.
1588 public:
1589 Heap* heap() const { return heap_; }
1591 constexpr bool operator==(const StrongRootAllocatorBase&) const = default;
1593 protected:
1594 explicit StrongRootAllocatorBase(Heap* heap) : heap_(heap) {}
1595 explicit StrongRootAllocatorBase(LocalHeap* heap);
1596 explicit StrongRootAllocatorBase(Isolate* isolate);
1598 explicit StrongRootAllocatorBase(LocalIsolate* isolate);
1599
1600 // Allocate/deallocate a range of n elements of type internal::Address.
1601 Address* allocate_impl(size_t n);
1602 void deallocate_impl(Address* p, size_t n) noexcept;
1603
1604 private:
1605 Heap* heap_;
1606};
1607
1608// The general version of this template behaves just as std::allocator, with
1609// the exception that the constructor takes the isolate as parameter. Only
1610// specialized versions, e.g., internal::StrongRootAllocator<internal::Address>
1611// and internal::StrongRootAllocator<v8::Local<T>> register the allocated range
1612// as strong roots.
1613template <typename T>
1614class StrongRootAllocator : private std::allocator<T> {
1615 public:
1616 using value_type = T;
1618 template <typename HeapOrIsolateT>
1619 explicit StrongRootAllocator(HeapOrIsolateT*) {}
1620 template <typename U>
1621 StrongRootAllocator(const StrongRootAllocator<U>& other) noexcept {}
1622
1623 using std::allocator<T>::allocate;
1624 using std::allocator<T>::deallocate;
1625};
1626
1627template <typename Iterator>
1628concept HasIteratorConcept = requires { typename Iterator::iterator_concept; };
1629
1630template <typename Iterator>
1631concept HasIteratorCategory =
1632 requires { typename Iterator::iterator_category; };
1633
1634// Helper struct that contains an `iterator_concept` type alias only when either
1635// `Iterator` or `std::iterator_traits<Iterator>` do.
1636// Default: no alias.
1637template <typename Iterator>
1639// Use `Iterator::iterator_concept` if available.
1640template <HasIteratorConcept Iterator>
1641struct MaybeDefineIteratorConcept<Iterator> {
1642 using iterator_concept = typename Iterator::iterator_concept;
1643};
1644// Otherwise fall back to `std::iterator_traits<Iterator>` if possible.
1645template <typename Iterator>
1648 using iterator_concept =
1649 typename std::iterator_traits<Iterator>::iterator_concept;
1651
1652template <typename T>
1653struct MaybeDefineIteratorConcept<T*> {
1654 using iterator_concept = std::contiguous_iterator_tag;
1655};
1656
1657// A class of iterators that wrap some different iterator type.
1658// If specified, ElementType is the type of element accessed by the wrapper
1659// iterator; in this case, the actual reference and pointer types of Iterator
1660// must be convertible to ElementType& and ElementType*, respectively.
1661template <typename Iterator, typename ElementType = void>
1662class WrappedIterator : public MaybeDefineIteratorConcept<Iterator> {
1663 public:
1664 static_assert(
1665 std::is_void_v<ElementType> ||
1666 (std::is_convertible_v<typename std::iterator_traits<Iterator>::pointer,
1667 std::add_pointer_t<ElementType>> &&
1668 std::is_convertible_v<typename std::iterator_traits<Iterator>::reference,
1669 std::add_lvalue_reference_t<ElementType>>));
1670
1671 using difference_type =
1672 typename std::iterator_traits<Iterator>::difference_type;
1674 std::conditional_t<std::is_void_v<ElementType>,
1675 typename std::iterator_traits<Iterator>::value_type,
1676 ElementType>;
1677 using pointer =
1678 std::conditional_t<std::is_void_v<ElementType>,
1679 typename std::iterator_traits<Iterator>::pointer,
1680 std::add_pointer_t<ElementType>>;
1682 std::conditional_t<std::is_void_v<ElementType>,
1683 typename std::iterator_traits<Iterator>::reference,
1684 std::add_lvalue_reference_t<ElementType>>;
1686 typename std::iterator_traits<Iterator>::iterator_category;
1687
1688 constexpr WrappedIterator() noexcept = default;
1689 constexpr explicit WrappedIterator(Iterator it) noexcept : it_(it) {}
1690
1691 template <typename OtherIterator, typename OtherElementType>
1692 requires std::is_convertible_v<OtherIterator, Iterator>
1695 : it_(other.base()) {}
1696
1697 [[nodiscard]] constexpr reference operator*() const noexcept { return *it_; }
1698 [[nodiscard]] constexpr pointer operator->() const noexcept {
1699 if constexpr (std::is_pointer_v<Iterator>) {
1700 return it_;
1701 } else {
1702 return it_.operator->();
1704 }
1705
1706 template <typename OtherIterator, typename OtherElementType>
1707 [[nodiscard]] constexpr bool operator==(
1708 const WrappedIterator<OtherIterator, OtherElementType>& other)
1709 const noexcept {
1710 return it_ == other.base();
1711 }
1712
1713 template <typename OtherIterator, typename OtherElementType>
1714 [[nodiscard]] constexpr auto operator<=>(
1716 const noexcept {
1717 if constexpr (std::three_way_comparable_with<Iterator, OtherIterator>) {
1718 return it_ <=> other.base();
1719 } else if constexpr (std::totally_ordered_with<Iterator, OtherIterator>) {
1720 if (it_ < other.base()) {
1721 return std::strong_ordering::less;
1722 }
1723 return (it_ > other.base()) ? std::strong_ordering::greater
1724 : std::strong_ordering::equal;
1725 } else {
1726 if (it_ < other.base()) {
1727 return std::partial_ordering::less;
1728 }
1729 if (other.base() < it_) {
1730 return std::partial_ordering::greater;
1731 }
1732 return (it_ == other.base()) ? std::partial_ordering::equivalent
1733 : std::partial_ordering::unordered;
1734 }
1735 }
1736
1737 constexpr WrappedIterator& operator++() noexcept {
1738 ++it_;
1739 return *this;
1740 }
1741 constexpr WrappedIterator operator++(int) noexcept {
1742 WrappedIterator result(*this);
1743 ++(*this);
1744 return result;
1745 }
1746
1747 constexpr WrappedIterator& operator--() noexcept {
1748 --it_;
1749 return *this;
1750 }
1751 constexpr WrappedIterator operator--(int) noexcept {
1752 WrappedIterator result(*this);
1753 --(*this);
1754 return result;
1755 }
1756 [[nodiscard]] constexpr WrappedIterator operator+(
1757 difference_type n) const noexcept {
1758 WrappedIterator result(*this);
1759 result += n;
1760 return result;
1761 }
1762 [[nodiscard]] friend constexpr WrappedIterator operator+(
1763 difference_type n, const WrappedIterator& x) noexcept {
1764 return x + n;
1765 }
1767 it_ += n;
1768 return *this;
1769 }
1770 [[nodiscard]] constexpr WrappedIterator operator-(
1771 difference_type n) const noexcept {
1772 return *this + -n;
1773 }
1775 return *this += -n;
1776 }
1777 template <typename OtherIterator, typename OtherElementType>
1778 [[nodiscard]] constexpr auto operator-(
1780 const noexcept {
1781 return it_ - other.base();
1782 }
1783 [[nodiscard]] constexpr reference operator[](
1784 difference_type n) const noexcept {
1785 return it_[n];
1786 }
1787
1788 [[nodiscard]] constexpr const Iterator& base() const noexcept { return it_; }
1789
1790 private:
1791 Iterator it_;
1792};
1794// Helper functions about values contained in handles.
1795// A value is either an indirect pointer or a direct pointer, depending on
1796// whether direct local support is enabled.
1797class ValueHelper final {
1798 public:
1799 // ValueHelper::InternalRepresentationType is an abstract type that
1800 // corresponds to the internal representation of v8::Local and essentially
1801 // to what T* really is (these two are always in sync). This type is used in
1802 // methods like GetDataFromSnapshotOnce that need access to a handle's
1803 // internal representation. In particular, if `x` is a `v8::Local<T>`, then
1804 // `v8::Local<T>::FromRepr(x.repr())` gives exactly the same handle as `x`.
1805#ifdef V8_ENABLE_DIRECT_HANDLE
1806 static constexpr Address kTaggedNullAddress = 1;
1809 static constexpr InternalRepresentationType kEmpty = kTaggedNullAddress;
1810#else
1812 static constexpr InternalRepresentationType kEmpty = nullptr;
1813#endif // V8_ENABLE_DIRECT_HANDLE
1814
1815 template <typename T>
1816 V8_INLINE static bool IsEmpty(T* value) {
1817 return ValueAsRepr(value) == kEmpty;
1818 }
1819
1820 // Returns a handle's "value" for all kinds of abstract handles. For Local,
1821 // it is equivalent to `*handle`. The variadic parameters support handle
1822 // types with extra type parameters, like `Persistent<T, M>`.
1823 template <template <typename T, typename... Ms> typename H, typename T,
1824 typename... Ms>
1825 V8_INLINE static T* HandleAsValue(const H<T, Ms...>& handle) {
1826 return handle.template value<T>();
1827 }
1828
1829#ifdef V8_ENABLE_DIRECT_HANDLE
1830
1831 template <typename T>
1832 V8_INLINE static Address ValueAsAddress(const T* value) {
1833 return reinterpret_cast<Address>(value);
1834 }
1835
1836 template <typename T, bool check_null = true, typename S>
1837 V8_INLINE static T* SlotAsValue(S* slot) {
1838 if (check_null && slot == nullptr) {
1839 return reinterpret_cast<T*>(kTaggedNullAddress);
1840 }
1841 return *reinterpret_cast<T**>(slot);
1842 }
1843
1844 template <typename T>
1845 V8_INLINE static InternalRepresentationType ValueAsRepr(const T* value) {
1846 return reinterpret_cast<InternalRepresentationType>(value);
1847 }
1848
1849 template <typename T>
1851 return reinterpret_cast<T*>(repr);
1852 }
1854#else // !V8_ENABLE_DIRECT_HANDLE
1855
1856 template <typename T>
1857 V8_INLINE static Address ValueAsAddress(const T* value) {
1858 return *reinterpret_cast<const Address*>(value);
1859 }
1860
1861 template <typename T, bool check_null = true, typename S>
1862 V8_INLINE static T* SlotAsValue(S* slot) {
1863 return reinterpret_cast<T*>(slot);
1864 }
1865
1866 template <typename T>
1867 V8_INLINE static InternalRepresentationType ValueAsRepr(const T* value) {
1868 return const_cast<InternalRepresentationType>(
1869 reinterpret_cast<const Address*>(value));
1870 }
1871
1872 template <typename T>
1874 return reinterpret_cast<T*>(repr);
1875 }
1876
1877#endif // V8_ENABLE_DIRECT_HANDLE
1878};
1883class HandleHelper final {
1884 public:
1895 template <typename T1, typename T2>
1896 V8_INLINE static bool EqualHandles(const T1& lhs, const T2& rhs) {
1897 if (lhs.IsEmpty()) return rhs.IsEmpty();
1898 if (rhs.IsEmpty()) return false;
1899 return lhs.ptr() == rhs.ptr();
1900 }
1901};
1902
1903V8_EXPORT void VerifyHandleIsNonEmpty(bool is_empty);
1904
1905// These functions are here just to match friend declarations in
1906// XxxCallbackInfo classes allowing these functions to access the internals
1907// of the info objects. These functions are supposed to be called by debugger
1908// macros.
1909void PrintFunctionCallbackInfo(void* function_callback_info);
1910void PrintPropertyCallbackInfo(void* property_callback_info);
1911
1912} // namespace internal
1913} // namespace v8
1914
1915#endif // INCLUDE_V8_INTERNAL_H_
Definition: v8-isolate.h:292
Definition: v8-internal.h:1575
Definition: v8-internal.h:1879
static bool EqualHandles(const T1 &lhs, const T2 &rhs)
Definition: v8-internal.h:1892
static Address LoadMap(Address obj)
Definition: v8-internal.h:1295
static constexpr size_t kExternalAllocationSoftLimit
Definition: v8-internal.h:1214
static bool IsExternalTwoByteString(int instance_type)
Definition: v8-internal.h:1308
static const int kIsolateCageBaseOffset
Definition: v8-internal.h:1041
static const int kEmbedderDataArrayHeaderSize
Definition: v8-internal.h:1001
static const int kHeapObjectMapOffset
Definition: v8-internal.h:986
static const int kEmbedderDataSlotSize
Definition: v8-internal.h:1002
static const int kIsolateApiCallbackThunkArgumentOffset
Definition: v8-internal.h:1106
static Address ReadExternalPointerField(v8::Isolate *isolate, Address heap_object_ptr, int offset)
Definition: v8-internal.h:1471
static const int kJSAPIObjectWithEmbedderSlotsHeaderSize
Definition: v8-internal.h:997
static constexpr bool HasHeapObjectTag(Address value)
Definition: v8-internal.h:1234
static const int kIsolateHandleScopeImplementerOffset
Definition: v8-internal.h:1076
static const int kOddballType
Definition: v8-internal.h:1191
static const int kInferShouldThrowMode
Definition: v8-internal.h:1210
static const int kNewAllocationInfoOffset
Definition: v8-internal.h:1053
static Address GetRoot(v8::Isolate *isolate, int index)
Definition: v8-internal.h:1383
static const int kStringEncodingMask
Definition: v8-internal.h:1010
static const int kIsolateFastCCallCallerPcOffset
Definition: v8-internal.h:1063
static uint8_t GetNodeFlag(Address *obj, int shift)
Definition: v8-internal.h:1330
static const int kIsolateThreadLocalTopOffset
Definition: v8-internal.h:1072
static const uint32_t kNumIsolateDataSlots
Definition: v8-internal.h:1017
static const int kForeignType
Definition: v8-internal.h:1192
static const int kFirstEmbedderJSApiObjectType
Definition: v8-internal.h:1199
static const int kNumberOfBooleanFlags
Definition: v8-internal.h:1019
static uint8_t GetNodeState(Address *obj)
Definition: v8-internal.h:1341
static const int kThreadLocalTopSize
Definition: v8-internal.h:1026
static const int kIsolateRootsOffset
Definition: v8-internal.h:1116
static const int kFrameTypeApiCallExit
Definition: v8-internal.h:1132
static const int kUndefinedOddballKind
Definition: v8-internal.h:1203
static const int kMapInstanceTypeOffset
Definition: v8-internal.h:987
static constexpr Address AddressToSmi(Address value)
Definition: v8-internal.h:1242
static const int kIsolateStackGuardOffset
Definition: v8-internal.h:1042
static const int kLinearAllocationAreaSize
Definition: v8-internal.h:1025
static const int kFastCCallAlignmentPaddingSize
Definition: v8-internal.h:1060
static const int kDisallowGarbageCollectionAlign
Definition: v8-internal.h:1138
static const int kIsolateFastCCallCallerFpOffset
Definition: v8-internal.h:1066
static const int kErrorMessageParamSize
Definition: v8-internal.h:1020
static const int kSegmentedTableSegmentPoolSize
Definition: v8-internal.h:1035
static void CheckInitialized(v8::Isolate *isolate)
Definition: v8-internal.h:1228
static void UpdateNodeState(Address *obj, uint8_t value)
Definition: v8-internal.h:1346
static constexpr Address IntegralToSmi(T value)
Definition: v8-internal.h:1253
static constexpr bool IsValidSmi(T value)
Definition: v8-internal.h:1259
static const int kJSObjectType
Definition: v8-internal.h:1194
static const int kExternalEntityTableBasePointerOffset
Definition: v8-internal.h:1034
static const int kBuiltinTier0TableOffset
Definition: v8-internal.h:1051
static const int kIsolateLongTaskStatsCounterOffset
Definition: v8-internal.h:1070
static const int kNativeContextEmbedderDataOffset
Definition: v8-internal.h:1008
static const int kLastJSApiObjectType
Definition: v8-internal.h:1196
static constexpr bool CanHaveInternalField(int instance_type)
Definition: v8-internal.h:1318
static constexpr int kSPAlignmentSlotCount
Definition: v8-internal.h:1129
static const int kIsolateHandleScopeDataOffset
Definition: v8-internal.h:1074
static const int kFirstNonstringType
Definition: v8-internal.h:1190
static const int kEmptyStringRootIndex
Definition: v8-internal.h:1183
static const int kBuiltinTier0EntryTableOffset
Definition: v8-internal.h:1048
static const int kFrameTypeApiIndexedAccessorExit
Definition: v8-internal.h:1135
static const int kFixedArrayHeaderSize
Definition: v8-internal.h:1000
static const int kNullOddballKind
Definition: v8-internal.h:1204
static const int kUndefinedValueRootIndex
Definition: v8-internal.h:1178
static const int kExternalTwoByteRepresentationTag
Definition: v8-internal.h:1011
static constexpr Address IntToSmi(int value)
Definition: v8-internal.h:1247
static const int kDontThrow
Definition: v8-internal.h:1208
static void CheckInitializedImpl(v8::Isolate *isolate)
static void * GetEmbedderData(const v8::Isolate *isolate, uint32_t slot)
Definition: v8-internal.h:1358
static const int kStackGuardSize
Definition: v8-internal.h:1018
static const int kNodeStateMask
Definition: v8-internal.h:1187
static HandleScopeData * GetHandleScopeData(v8::Isolate *isolate)
Definition: v8-internal.h:1365
static const int kNodeStateIsWeakValue
Definition: v8-internal.h:1188
static const int kFirstJSApiObjectType
Definition: v8-internal.h:1195
static const int kStringResourceOffset
Definition: v8-internal.h:988
static bool IsExternalOneByteString(int instance_type)
Definition: v8-internal.h:1313
static const int kErrorMessageParamOffset
Definition: v8-internal.h:1046
static const int kCurrentMicrotaskNativeContextOffset
Definition: v8-internal.h:1114
static const int kFalseValueRootIndex
Definition: v8-internal.h:1182
static const int kIsolateRegexpExecVectorArgumentOffset
Definition: v8-internal.h:1108
static const int kIsolateFastApiCallTargetOffset
Definition: v8-internal.h:1068
static const int kTrueValueRootIndex
Definition: v8-internal.h:1181
static int GetInstanceType(Address obj)
Definition: v8-internal.h:1287
static const int kThrowOnError
Definition: v8-internal.h:1209
static Address ReadTaggedSignedField(Address heap_object_ptr, int offset)
Definition: v8-internal.h:1447
static const int kOddballKindOffset
Definition: v8-internal.h:991
static const int kBuiltinTier0TableSize
Definition: v8-internal.h:1024
static const int kExternalEntityTableSize
Definition: v8-internal.h:1036
static const int kFrameTypeApiConstructExit
Definition: v8-internal.h:1133
static const int kContinuationPreservedEmbedderDataOffset
Definition: v8-internal.h:1110
static const int kHandleScopeImplementerSize
Definition: v8-internal.h:1029
static const int kLastYoungAllocationOffset
Definition: v8-internal.h:1057
static const int kCurrentMicrotaskQueueOffset
Definition: v8-internal.h:1112
static Address ReadTaggedPointerField(Address heap_object_ptr, int offset)
Definition: v8-internal.h:1436
static const int kFrameTypeApiNamedAccessorExit
Definition: v8-internal.h:1134
static const int kNullValueRootIndex
Definition: v8-internal.h:1180
static void SetEmbedderData(v8::Isolate *isolate, uint32_t slot, void *data)
Definition: v8-internal.h:1351
static Address * GetRootSlot(v8::Isolate *isolate, int index)
Definition: v8-internal.h:1377
static const int kIsolateJSDispatchTableOffset
Definition: v8-internal.h:1103
static const int kTheHoleValueRootIndex
Definition: v8-internal.h:1179
static constexpr int SmiValue(Address value)
Definition: v8-internal.h:1238
static const int kTablesAlignmentPaddingSize
Definition: v8-internal.h:1021
static const int kHandleScopeDataSize
Definition: v8-internal.h:1027
static const int kExternalOneByteRepresentationTag
Definition: v8-internal.h:1012
static const int kBuiltinTier0EntryTableSize
Definition: v8-internal.h:1023
static void UpdateNodeFlag(Address *obj, bool value, int shift)
Definition: v8-internal.h:1335
static const int kCallbackInfoDataOffset
Definition: v8-internal.h:1015
static void IncrementLongTasksStatsCounter(v8::Isolate *isolate)
Definition: v8-internal.h:1371
static const int kDisallowGarbageCollectionSize
Definition: v8-internal.h:1139
static const int kOldAllocationInfoOffset
Definition: v8-internal.h:1055
static const int kIsolateEmbedderDataOffset
Definition: v8-internal.h:1078
static T ReadRawField(Address heap_object_ptr, int offset)
Definition: v8-internal.h:1420
static v8::Isolate * GetCurrentIsolate()
static constexpr int kFrameCPSlotCount
Definition: v8-internal.h:1122
static const int kEmbedderDataSlotExternalPointerOffset
Definition: v8-internal.h:1006
static v8::Isolate * GetCurrentIsolateForSandbox()
Definition: v8-internal.h:1461
static int GetOddballKind(Address obj)
Definition: v8-internal.h:1304
static const int kNodeFlagsOffset
Definition: v8-internal.h:1186
static const int kRegExpStaticResultOffsetsVectorSize
Definition: v8-internal.h:1022
static const int kLastEmbedderJSApiObjectType
Definition: v8-internal.h:1200
static const int kVariousBooleanFlagsOffset
Definition: v8-internal.h:1044
static constexpr std::optional< Address > TryIntegralToSmi(T value)
Definition: v8-internal.h:1265
static const int kNodeClassIdOffset
Definition: v8-internal.h:1185
static const int kStringRepresentationAndEncodingMask
Definition: v8-internal.h:1009
static const int kJSObjectHeaderSize
Definition: v8-internal.h:992
static const int kJSSpecialApiObjectType
Definition: v8-internal.h:1193
Definition: v8-internal.h:1583
StrongRootAllocatorBase(LocalIsolate *isolate)
Definition: v8-internal.h:1610
T value_type
Definition: v8-internal.h:1612
Definition: v8-internal.h:1793
static Address ValueAsAddress(const T *value)
Definition: v8-internal.h:1853
static T * ReprAsValue(InternalRepresentationType repr)
Definition: v8-internal.h:1869
internal::Address * InternalRepresentationType
Definition: v8-internal.h:1807
static T * SlotAsValue(S *slot)
Definition: v8-internal.h:1858
static T * HandleAsValue(const H< T, Ms... > &handle)
Definition: v8-internal.h:1821
static InternalRepresentationType ValueAsRepr(const T *value)
Definition: v8-internal.h:1863
static bool IsEmpty(T *value)
Definition: v8-internal.h:1812
static constexpr InternalRepresentationType kEmpty
Definition: v8-internal.h:1808
Definition: v8-internal.h:1658
constexpr WrappedIterator & operator-=(difference_type n) noexcept
Definition: v8-internal.h:1770
constexpr WrappedIterator operator--(int) noexcept
Definition: v8-internal.h:1747
constexpr WrappedIterator & operator+=(difference_type n) noexcept
Definition: v8-internal.h:1762
constexpr const Iterator & base() const noexcept
Definition: v8-internal.h:1784
std::conditional_t< std::is_void_v< ElementType >, typename std::iterator_traits< Iterator >::value_type, ElementType > value_type
Definition: v8-internal.h:1672
constexpr WrappedIterator & operator++() noexcept
Definition: v8-internal.h:1733
constexpr pointer operator->() const noexcept
Definition: v8-internal.h:1694
constexpr reference operator[](difference_type n) const noexcept
Definition: v8-internal.h:1779
typename std::iterator_traits< Iterator >::difference_type difference_type
Definition: v8-internal.h:1668
constexpr auto operator<=>(const WrappedIterator< OtherIterator, OtherElementType > &other) const noexcept
Definition: v8-internal.h:1710
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:1680
constexpr WrappedIterator & operator--() noexcept
Definition: v8-internal.h:1743
constexpr WrappedIterator() noexcept=default
typename std::iterator_traits< Iterator >::iterator_category iterator_category
Definition: v8-internal.h:1682
constexpr reference operator*() const noexcept
Definition: v8-internal.h:1693
friend constexpr WrappedIterator operator+(difference_type n, const WrappedIterator &x) noexcept
Definition: v8-internal.h:1758
constexpr WrappedIterator operator++(int) noexcept
Definition: v8-internal.h:1737
constexpr WrappedIterator operator-(difference_type n) const noexcept
Definition: v8-internal.h:1766
std::conditional_t< std::is_void_v< ElementType >, typename std::iterator_traits< Iterator >::pointer, std::add_pointer_t< ElementType > > pointer
Definition: v8-internal.h:1676
constexpr bool operator==(const WrappedIterator< OtherIterator, OtherElementType > &other) const noexcept
Definition: v8-internal.h:1703
Definition: v8-internal.h:1627
Definition: v8-internal.h:1624
const intptr_t kHeapObjectTagMask
Definition: v8-internal.h:61
constexpr uint64_t kCppHeapPointerMarkBit
Definition: v8-internal.h:420
constexpr bool kRuntimeGeneratedCodeObjectsLiveInTrustedSpace
Definition: v8-internal.h:935
internal::Isolate * IsolateFromNeverReadOnlySpaceObject(Address obj)
constexpr uint64_t kExternalPointerTagShift
Definition: v8-internal.h:370
IndirectPointerHandle TrustedPointerHandle
Definition: v8-internal.h:903
const int kApiSystemPointerSize
Definition: v8-internal.h:51
constexpr const char * ToString(ExternalPointerTag tag)
Definition: v8-internal.h:752
constexpr bool SandboxIsEnabled()
Definition: v8-internal.h:206
const int kApiDoubleSize
Definition: v8-internal.h:52
constexpr size_t kMaxCppHeapPointers
Definition: v8-internal.h:446
constexpr intptr_t kIntptrAllBitsSet
Definition: v8-internal.h:79
constexpr int GB
Definition: v8-internal.h:43
void VerifyHandleIsNonEmpty(bool is_empty)
const int kApiInt32Size
Definition: v8-internal.h:53
const int kForwardingTagSize
Definition: v8-internal.h:68
uint32_t CppHeapPointerHandle
Definition: v8-internal.h:405
const intptr_t kForwardingTagMask
Definition: v8-internal.h:69
void PrintPropertyCallbackInfo(void *property_callback_info)
constexpr ExternalPointerTagRange kAnyManagedResourceExternalPointerTag(kFirstManagedResourceTag, kLastManagedResourceTag)
constexpr uint64_t kExternalPointerPayloadMask
Definition: v8-internal.h:377
const int kSmiTagSize
Definition: v8-internal.h:73
const int kApiInt64Size
Definition: v8-internal.h:54
constexpr ExternalPointerTagRange kAnyExternalPointerTagRange(kFirstExternalPointerTag, kLastExternalPointerTag)
constexpr uint64_t kExternalPointerTagMask
Definition: v8-internal.h:371
constexpr uint64_t kCppHeapPointerTagMask
Definition: v8-internal.h:423
constexpr int kTrustedPointerTableEntrySizeLog2
Definition: v8-internal.h:920
constexpr int kTrustedPointerTableEntrySize
Definition: v8-internal.h:919
constexpr uint64_t kCppHeapPointerPayloadShift
Definition: v8-internal.h:422
constexpr ExternalPointer_t kNullExternalPointer
Definition: v8-internal.h:397
Address ExternalPointer_t
Definition: v8-internal.h:394
uint32_t IndirectPointerHandle
Definition: v8-internal.h:883
constexpr CppHeapPointer_t kNullCppHeapPointer
Definition: v8-internal.h:417
const int kApiSizetSize
Definition: v8-internal.h:55
constexpr uint64_t kExternalPointerTagAndMarkbitMask
Definition: v8-internal.h:376
constexpr size_t kMaxExternalPointers
Definition: v8-internal.h:365
constexpr ExternalPointerTagRange kAnySharedManagedExternalPointerTagRange(kFirstSharedManagedExternalPointerTag, kLastSharedManagedExternalPointerTag)
constexpr size_t kWasmCodePointerTableReservationSize
Definition: v8-internal.h:931
constexpr TrustedPointerHandle kNullTrustedPointerHandle
Definition: v8-internal.h:915
const int kWeakHeapObjectTag
Definition: v8-internal.h:59
constexpr ExternalPointerHandle kNullExternalPointerHandle
Definition: v8-internal.h:398
constexpr ExternalPointerTagRange kAnyMaybeReadOnlyExternalPointerTagRange(kFirstMaybeReadOnlyExternalPointerTag, kLastMaybeReadOnlyExternalPointerTag)
constexpr ExternalPointerTag kFirstSharedManagedExternalPointerTag
Definition: v8-internal.h:810
constexpr uintptr_t kUintptrAllBitsSet
Definition: v8-internal.h:80
const int kForwardingTag
Definition: v8-internal.h:67
const intptr_t kHeapObjectReferenceTagMask
Definition: v8-internal.h:62
constexpr bool SmiValuesAre31Bits()
Definition: v8-internal.h:194
constexpr size_t kMaxTrustedPointers
Definition: v8-internal.h:922
bool ShouldThrowOnError(internal::Isolate *isolate)
constexpr uint64_t kCppHeapPointerTagShift
Definition: v8-internal.h:421
constexpr ExternalPointerTagRange kAnyInterceptorInfoExternalPointerTagRange(kFirstInterceptorInfoExternalPointerTag, kLastInterceptorInfoExternalPointerTag)
constexpr ExternalPointerTag kFirstManagedExternalPointerTag
Definition: v8-internal.h:793
constexpr int KB
Definition: v8-internal.h:41
constexpr bool kBuiltinCodeObjectsLiveInTrustedSpace
Definition: v8-internal.h:936
constexpr uint32_t kTrustedPointerHandleShift
Definition: v8-internal.h:912
constexpr ExternalPointerTagRange kAnyManagedExternalPointerTagRange(kFirstManagedExternalPointerTag, kLastManagedExternalPointerTag)
const int kHeapObjectTag
Definition: v8-internal.h:58
const int kSmiShiftSize
Definition: v8-internal.h:190
SmiTagging< kApiTaggedSize > PlatformSmiTagging
Definition: v8-internal.h:185
ExternalPointerTag
Definition: v8-internal.h:673
@ kApiIndexedPropertyDescriptorCallbackTag
Definition: v8-internal.h:724
@ kFirstMaybeReadOnlyExternalPointerTag
Definition: v8-internal.h:707
@ kExternalPointerEvacuationEntryTag
Definition: v8-internal.h:746
@ kFirstSharedExternalPointerTag
Definition: v8-internal.h:685
@ kApiNamedPropertyDefinerCallbackTag
Definition: v8-internal.h:718
@ kLastSharedExternalPointerTag
Definition: v8-internal.h:689
@ kApiIndexedPropertySetterCallbackTag
Definition: v8-internal.h:723
@ kLastExternalPointerTag
Definition: v8-internal.h:749
@ kLastExternalTypeTag
Definition: v8-internal.h:701
@ kApiIndexedPropertyGetterCallbackTag
Definition: v8-internal.h:722
@ kApiNamedPropertyDescriptorCallbackTag
Definition: v8-internal.h:717
@ kAccessorInfoGetterTag
Definition: v8-internal.h:709
@ kApiIndexedPropertyDefinerCallbackTag
Definition: v8-internal.h:725
@ kFirstExternalTypeTag
Definition: v8-internal.h:700
@ kExternalStringResourceTag
Definition: v8-internal.h:687
@ kAccessorInfoSetterTag
Definition: v8-internal.h:710
@ kApiNamedPropertyDeleterCallbackTag
Definition: v8-internal.h:719
@ kApiNamedPropertyGetterCallbackTag
Definition: v8-internal.h:715
@ kApiNamedPropertySetterCallbackTag
Definition: v8-internal.h:716
@ kApiIndexedPropertyIndexOfCallbackTag
Definition: v8-internal.h:728
@ kApiIndexedPropertyEnumeratorCallbackTag
Definition: v8-internal.h:727
@ kExternalPointerFreeEntryTag
Definition: v8-internal.h:747
@ kFirstInterceptorInfoExternalPointerTag
Definition: v8-internal.h:713
@ kWaiterQueueNodeTag
Definition: v8-internal.h:686
@ kExternalPointerNullTag
Definition: v8-internal.h:675
@ kExternalStringResourceDataTag
Definition: v8-internal.h:688
@ kWasmStackMemoryTag
Definition: v8-internal.h:735
@ kLastManagedResourceTag
Definition: v8-internal.h:743
@ kFastApiExternalTypeTag
Definition: v8-internal.h:706
@ kExternalPointerZappedEntryTag
Definition: v8-internal.h:745
@ kApiNamedPropertyQueryCallbackTag
Definition: v8-internal.h:714
@ kFirstEmbedderDataTag
Definition: v8-internal.h:696
@ kApiIndexedPropertyQueryCallbackTag
Definition: v8-internal.h:721
@ kApiIndexedPropertyDeleterCallbackTag
Definition: v8-internal.h:726
@ kLastInterceptorInfoExternalPointerTag
Definition: v8-internal.h:730
@ kNativeContextMicrotaskQueueTag
Definition: v8-internal.h:693
@ kLastMaybeReadOnlyExternalPointerTag
Definition: v8-internal.h:733
@ kLastEmbedderDataTag
Definition: v8-internal.h:697
@ kArrayBufferExtensionTag
Definition: v8-internal.h:742
@ kFirstExternalPointerTag
Definition: v8-internal.h:674
@ kApiNamedPropertyEnumeratorCallbackTag
Definition: v8-internal.h:720
@ kFunctionTemplateInfoCallbackTag
Definition: v8-internal.h:708
@ kApiIndexedPropertyIterableToListCallbackTag
Definition: v8-internal.h:729
const int kSmiValueSize
Definition: v8-internal.h:191
constexpr ExternalPointerTag kLastSharedManagedExternalPointerTag
Definition: v8-internal.h:812
constexpr ExternalPointerTagRange kAnyForeignExternalPointerTagRange(kFirstForeignExternalPointerTag, kLastForeignExternalPointerTag)
constexpr bool SmiValuesAre32Bits()
Definition: v8-internal.h:195
constexpr ExternalPointerTag kLastManagedExternalPointerTag
Definition: v8-internal.h:795
TagRange< ExternalPointerTag > ExternalPointerTagRange
Definition: v8-internal.h:764
constexpr ExternalPointerTag kFirstForeignExternalPointerTag
Definition: v8-internal.h:783
constexpr IndirectPointerHandle kNullIndirectPointerHandle
Definition: v8-internal.h:886
uintptr_t Address
Definition: v8-internal.h:38
void PerformCastCheck(T *data)
Definition: v8-internal.h:1568
void PrintFunctionCallbackInfo(void *function_callback_info)
constexpr size_t kTrustedPointerTableReservationSize
Definition: v8-internal.h:908
uint32_t ExternalPointerHandle
Definition: v8-internal.h:386
const intptr_t kSmiTagMask
Definition: v8-internal.h:74
const int kHeapObjectTagSize
Definition: v8-internal.h:60
const int kSmiMaxValue
Definition: v8-internal.h:193
constexpr bool Is64()
Definition: v8-internal.h:196
constexpr bool kAllCodeObjectsLiveInTrustedSpace
Definition: v8-internal.h:937
const int kSmiTag
Definition: v8-internal.h:72
constexpr ExternalPointerTag kFirstManagedResourceTag
Definition: v8-internal.h:804
Address CppHeapPointer_t
Definition: v8-internal.h:414
constexpr CppHeapPointerHandle kNullCppHeapPointerHandle
Definition: v8-internal.h:418
constexpr int kGarbageCollectionReasonMaxValue
Definition: v8-internal.h:1579
const int kSmiMinValue
Definition: v8-internal.h:192
ManagedTypeId
Definition: v8-internal.h:578
constexpr int MB
Definition: v8-internal.h:42
constexpr uint64_t kExternalPointerShiftedTagMask
Definition: v8-internal.h:372
constexpr uint64_t kExternalPointerMarkBit
Definition: v8-internal.h:369
Address SandboxedPointer_t
Definition: v8-internal.h:216
const int kApiTaggedSize
Definition: v8-internal.h:175
constexpr bool PointerCompressionIsEnabled()
Definition: v8-internal.h:178
constexpr ExternalPointerTag kLastForeignExternalPointerTag
Definition: v8-internal.h:785
Definition: libplatform.h:15
Definition: v8-internal.h:1552
static void Perform(T *data)
Definition: v8-internal.h:953
static constexpr uint32_t kSizeInBytes
Definition: v8-internal.h:954
typename Iterator::iterator_concept iterator_concept
Definition: v8-internal.h:1638
Definition: v8-internal.h:1634
static constexpr bool IsValidSmi(uint64_t value)
Definition: v8-internal.h:127
static constexpr bool IsValidSmi(int64_t value)
Definition: v8-internal.h:120
static constexpr bool IsValidSmi(T value)
Definition: v8-internal.h:100
static constexpr int SmiToInt(Address value)
Definition: v8-internal.h:92
static constexpr bool IsValidSmi(T value)
Definition: v8-internal.h:150
static constexpr int SmiToInt(Address value)
Definition: v8-internal.h:142
Definition: v8-internal.h:77
Definition: v8-internal.h:517
constexpr size_t Size() const
Definition: v8-internal.h:544
constexpr bool IsEmpty() const
Definition: v8-internal.h:542
Tag last
Definition: v8-internal.h:575
Tag first
Definition: v8-internal.h:574
constexpr bool operator==(const TagRange other) const
Definition: v8-internal.h:564
constexpr bool Contains(Tag tag) const
Definition: v8-internal.h:552
constexpr TagRange()
Definition: v8-internal.h:539
constexpr TagRange(Tag tag)
Definition: v8-internal.h:535
constexpr size_t hash_value() const
Definition: v8-internal.h:568
constexpr TagRange(Tag first, Tag last)
Definition: v8-internal.h:523
constexpr bool Contains(TagRange tag_range) const
Definition: v8-internal.h:560
#define FOREIGN_TAG_LIST(V)
Definition: v8-internal.h:615
#define AS_ENUM(name)
Definition: v8-internal.h:737
#define V8_EXTERNAL_POINTER_TAG_COUNT
Definition: v8-internal.h:458
#define MANAGED_TAG_LIST(V)
Definition: v8-internal.h:588
#define SHARED_MANAGED_TAG_LIST(V)
Definition: v8-internal.h:586
#define ENUM_CASE(name)
#define GET_FIRST(LIST)
Definition: v8-internal.h:768
#define V8_EMBEDDER_DATA_TAG_COUNT
Definition: v8-internal.h:453
#define GET_LAST(LIST)
Definition: v8-internal.h:774
#define V8_EXPORT
Definition: v8config.h:867
#define V8_INLINE
Definition: v8config.h:511
#define V8_DEPRECATE_SOON(message)
Definition: v8config.h:624
#define V8_LIKELY(condition)
Definition: v8config.h:671