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