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