v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
slots.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 V8_OBJECTS_SLOTS_H_
6#define V8_OBJECTS_SLOTS_H_
7
8#include "src/base/memory.h"
10#include "src/common/globals.h"
15#include "src/sandbox/isolate.h"
16
17namespace v8::internal {
18
19class Object;
20class ExposedTrustedObject;
22
23template <typename Subclass, typename Data,
24 size_t SlotDataAlignment = sizeof(Data)>
25class SlotBase {
26 public:
27 using TData = Data;
28
29 static constexpr size_t kSlotDataSize = sizeof(Data);
30 static constexpr size_t kSlotDataAlignment = SlotDataAlignment;
31
32 Subclass& operator++() { // Prefix increment.
33 ptr_ += kSlotDataSize;
34 return *static_cast<Subclass*>(this);
35 }
36 Subclass operator++(int) { // Postfix increment.
37 Subclass result = *static_cast<Subclass*>(this);
38 ptr_ += kSlotDataSize;
39 return result;
40 }
41 Subclass& operator--() { // Prefix decrement.
42 ptr_ -= kSlotDataSize;
43 return *static_cast<Subclass*>(this);
44 }
45 Subclass operator--(int) { // Postfix decrement.
46 Subclass result = *static_cast<Subclass*>(this);
47 ptr_ -= kSlotDataSize;
48 return result;
49 }
50
51 bool operator<(const SlotBase& other) const { return ptr_ < other.ptr_; }
52 bool operator<=(const SlotBase& other) const { return ptr_ <= other.ptr_; }
53 bool operator>(const SlotBase& other) const { return ptr_ > other.ptr_; }
54 bool operator>=(const SlotBase& other) const { return ptr_ >= other.ptr_; }
55 bool operator==(const SlotBase& other) const { return ptr_ == other.ptr_; }
56 bool operator!=(const SlotBase& other) const { return ptr_ != other.ptr_; }
57 size_t operator-(const SlotBase& other) const {
58 DCHECK_GE(ptr_, other.ptr_);
59 return static_cast<size_t>((ptr_ - other.ptr_) / kSlotDataSize);
60 }
61 Subclass operator-(int i) const { return Subclass(ptr_ - i * kSlotDataSize); }
62 Subclass operator+(int i) const { return Subclass(ptr_ + i * kSlotDataSize); }
63 friend Subclass operator+(int i, const Subclass& slot) {
64 return Subclass(slot.ptr_ + i * kSlotDataSize);
65 }
66 Subclass& operator+=(int i) {
67 ptr_ += i * kSlotDataSize;
68 return *static_cast<Subclass*>(this);
69 }
70 Subclass operator-(int i) { return Subclass(ptr_ - i * kSlotDataSize); }
71 Subclass& operator-=(int i) {
72 ptr_ -= i * kSlotDataSize;
73 return *static_cast<Subclass*>(this);
74 }
75
76 void* ToVoidPtr() const { return reinterpret_cast<void*>(address()); }
77
78 Address address() const { return ptr_; }
79 // For symmetry with Handle.
80 TData* location() const { return reinterpret_cast<TData*>(ptr_); }
81
82 protected:
83 explicit SlotBase(Address ptr) : ptr_(ptr) {
84 DCHECK(IsAligned(ptr, kSlotDataAlignment));
85 }
86
87 private:
88 // This field usually describes an on-heap address (a slot within an object),
89 // so its type should not be a pointer to another C++ wrapper class.
90 // Type safety is provided by well-defined conversion operations.
92};
93
94// An FullObjectSlot instance describes a kSystemPointerSize-sized field
95// ("slot") holding a tagged pointer (smi or strong heap object).
96// Its address() is the address of the slot.
97// The slot's contents can be read and written using operator* and store().
99 public:
102
103 // Tagged value stored in this slot is guaranteed to never be a weak pointer.
104 static constexpr bool kCanBeWeak = false;
105
107 explicit FullObjectSlot(Address ptr) : SlotBase(ptr) {}
108 explicit FullObjectSlot(const Address* ptr)
109 : SlotBase(reinterpret_cast<Address>(ptr)) {}
110 inline explicit FullObjectSlot(TaggedBase* object);
111#if defined(V8_HOST_ARCH_32_BIT) || \
112 defined(V8_HOST_ARCH_64_BIT) && !V8_COMPRESS_POINTERS_BOOL
113 explicit FullObjectSlot(const TaggedMemberBase* member)
114 : SlotBase(reinterpret_cast<Address>(member->ptr_location())) {}
115#endif
116 template <typename T>
118 : SlotBase(slot.address()) {}
119
120 // Compares memory representation of a value stored in the slot with given
121 // raw value.
122 inline bool contains_map_value(Address raw_value) const;
123 inline bool Relaxed_ContainsMapValue(Address raw_value) const;
124
125 inline Tagged<Object> operator*() const;
126 inline Tagged<Object> load() const;
127 inline Tagged<Object> load(PtrComprCageBase cage_base) const;
128 inline void store(Tagged<Object> value) const;
129 inline void store_map(Tagged<Map> map) const;
130
131 inline Tagged<Map> load_map() const;
132
133 inline Tagged<Object> Acquire_Load() const;
134 inline Tagged<Object> Acquire_Load(PtrComprCageBase cage_base) const;
135 inline Tagged<Object> Relaxed_Load() const;
136 inline Tagged<Object> Relaxed_Load(PtrComprCageBase cage_base) const;
137 inline Address Relaxed_Load_Raw() const;
138 static inline Tagged<Object> RawToTagged(PtrComprCageBase cage_base,
139 Address raw);
140 inline void Relaxed_Store(Tagged<Object> value) const;
141 inline void Release_Store(Tagged<Object> value) const;
142 inline Tagged<Object> Relaxed_CompareAndSwap(Tagged<Object> old,
143 Tagged<Object> target) const;
144 inline Tagged<Object> Release_CompareAndSwap(Tagged<Object> old,
145 Tagged<Object> target) const;
146};
147
148// A FullMaybeObjectSlot instance describes a kSystemPointerSize-sized field
149// ("slot") holding a possibly-weak tagged pointer (think: Tagged<MaybeObject>).
150// Its address() is the address of the slot.
151// The slot's contents can be read and written using operator* and store().
154 public:
157
158 // Tagged value stored in this slot can be a weak pointer.
159 static constexpr bool kCanBeWeak = true;
160
162 explicit FullMaybeObjectSlot(Address ptr) : SlotBase(ptr) {}
164 : SlotBase(reinterpret_cast<Address>(ptr)) {}
165#if defined(V8_HOST_ARCH_32_BIT) || \
166 defined(V8_HOST_ARCH_64_BIT) && !V8_COMPRESS_POINTERS_BOOL
167 explicit FullMaybeObjectSlot(const TaggedMemberBase* member)
168 : SlotBase(reinterpret_cast<Address>(member->ptr_location())) {}
169#endif
171 : SlotBase(reinterpret_cast<Address>(ptr)) {}
172 template <typename T>
175
176 inline Tagged<MaybeObject> operator*() const;
177 inline Tagged<MaybeObject> load() const;
178 inline Tagged<MaybeObject> load(PtrComprCageBase cage_base) const;
179 inline void store(Tagged<MaybeObject> value) const;
180
181 inline Tagged<MaybeObject> Relaxed_Load() const;
182 inline Tagged<MaybeObject> Relaxed_Load(PtrComprCageBase cage_base) const;
183 inline Address Relaxed_Load_Raw() const;
184 static inline Tagged<Object> RawToTagged(PtrComprCageBase cage_base,
185 Address raw);
186 inline void Relaxed_Store(Tagged<MaybeObject> value) const;
187 inline void Release_CompareAndSwap(Tagged<MaybeObject> old,
188 Tagged<MaybeObject> target) const;
189};
190
191// A FullHeapObjectSlot instance describes a kSystemPointerSize-sized field
192// ("slot") holding a weak or strong pointer to a heap object (think:
193// Tagged<HeapObjectReference>).
194// Its address() is the address of the slot.
195// The slot's contents can be read and written using operator* and store().
196// In case it is known that that slot contains a strong heap object pointer,
197// ToHeapObject() can be used to retrieve that heap object.
199 public:
201 explicit FullHeapObjectSlot(Address ptr) : SlotBase(ptr) {}
203 : SlotBase(reinterpret_cast<Address>(ptr)) {}
204#if defined(V8_HOST_ARCH_32_BIT) || \
205 defined(V8_HOST_ARCH_64_BIT) && !V8_COMPRESS_POINTERS_BOOL
206 explicit FullHeapObjectSlot(const TaggedMemberBase* member)
207 : SlotBase(reinterpret_cast<Address>(member->ptr_location())) {}
208#endif
209 template <typename T>
212
213 inline Tagged<HeapObjectReference> operator*() const;
214 inline Tagged<HeapObjectReference> load(PtrComprCageBase cage_base) const;
215 inline void store(Tagged<HeapObjectReference> value) const;
216
217 inline Tagged<HeapObject> ToHeapObject() const;
218
219 inline void StoreHeapObject(Tagged<HeapObject> value) const;
220};
221
222// TODO(ishell, v8:8875): When pointer compression is enabled the [u]intptr_t
223// and double fields are only kTaggedSize aligned so in order to avoid undefined
224// behavior in C++ code we use this iterator adaptor when using STL algorithms
225// with unaligned pointers.
226// It will be removed once all v8:8875 is fixed and all the full pointer and
227// double values in compressed V8 heap are properly aligned.
228template <typename T>
230 public:
231 // This class is a stand-in for "T&" that uses custom read/write operations
232 // for the actual memory accesses.
233 class Reference {
234 public:
235 explicit Reference(Address address) : address_(address) {}
236 Reference(const Reference&) V8_NOEXCEPT = default;
237
239 base::WriteUnalignedValue<T>(address_, other.value());
240 return *this;
241 }
243 base::WriteUnalignedValue<T>(address_, value);
244 return *this;
245 }
246
247 // Values of type UnalignedSlot::reference must be implicitly convertible
248 // to UnalignedSlot::value_type.
249 operator T() const { return value(); }
250
251 void swap(Reference& other) {
252 T tmp = value();
253 base::WriteUnalignedValue<T>(address_, other.value());
254 base::WriteUnalignedValue<T>(other.address_, tmp);
255 }
256
257 bool operator<(const Reference& other) const {
258 return value() < other.value();
259 }
260
261 bool operator==(const Reference& other) const {
262 return value() == other.value();
263 }
264
265 private:
266 T value() const { return base::ReadUnalignedValue<T>(address_); }
267
268 Address address_;
269 };
270
271 // The rest of this class follows C++'s "RandomAccessIterator" requirements.
272 // Most of the heavy lifting is inherited from SlotBase.
273 using difference_type = int;
274 using value_type = T;
276 using pointer = T*;
277 using iterator_category = std::random_access_iterator_tag;
278
280 explicit UnalignedSlot(Address address)
281 : SlotBase<UnalignedSlot<T>, T, 1>(address) {}
282 explicit UnalignedSlot(T* address)
283 : SlotBase<UnalignedSlot<T>, T, 1>(reinterpret_cast<Address>(address)) {}
284
286 return Reference(SlotBase<UnalignedSlot<T>, T, 1>::address());
287 }
289 return Reference(SlotBase<UnalignedSlot<T>, T, 1>::address() +
290 i * sizeof(T));
291 }
292
293 friend void swap(Reference lhs, Reference rhs) { lhs.swap(rhs); }
294
296 return static_cast<int>(a.address() - b.address()) / sizeof(T);
297 }
298};
299
300// An off-heap uncompressed object slot can be the same as an on-heap one, with
301// a few methods deleted.
303 public:
306 explicit OffHeapFullObjectSlot(const Address* ptr) : FullObjectSlot(ptr) {}
307
308 inline Tagged<Object> operator*() const = delete;
309
311};
312
313// An ExternalPointerSlot instance describes a kExternalPointerSlotSize-sized
314// field ("slot") holding a pointer to objects located outside the V8 heap and
315// V8 sandbox (think: ExternalPointer_t).
316// It's basically an ExternalPointer_t* but abstracting away the fact that the
317// pointer might not be kExternalPointerSlotSize-aligned in certain
318// configurations. Its address() is the address of the slot.
320 : public SlotBase<ExternalPointerSlot, ExternalPointer_t,
321 kTaggedSize /* slot alignment */> {
322 public:
325#ifdef V8_COMPRESS_POINTERS
326 ,
327 tag_range_()
328#endif
329 {
330 }
331
333 : SlotBase(ptr)
334#ifdef V8_COMPRESS_POINTERS
335 ,
336 tag_range_(tag_range)
337#endif
338 {
339 }
340
342 : SlotBase(ptr)
343#ifdef V8_COMPRESS_POINTERS
344 ,
345 tag_range_(tag_range)
346#endif
347 {
348 }
349
350 template <ExternalPointerTag tag>
352 : SlotBase(member->storage_address())
353#ifdef V8_COMPRESS_POINTERS
354 ,
355 tag_range_(tag)
356#endif
357 {
358 }
359
360 inline void init_lazily_initialized();
361
362 inline void init(IsolateForSandbox isolate, Tagged<HeapObject> host,
363 Address value, ExternalPointerTag tag);
364
365#ifdef V8_COMPRESS_POINTERS
366 // When the external pointer is sandboxed, or for array buffer extensions when
367 // pointer compression is on, its slot stores a handle to an entry in an
368 // ExternalPointerTable. These methods allow access to the underlying handle
369 // while the load/store methods below resolve the handle to the real pointer.
370 // Handles should generally be accessed atomically as they may be accessed
371 // from other threads, for example GC marking threads.
372 //
373 // TODO(wingo): Remove if we switch to use the EPT for all external pointers
374 // when pointer compression is enabled.
375 bool HasExternalPointerHandle() const {
378 }
379 inline ExternalPointerHandle Relaxed_LoadHandle() const;
380 inline void Relaxed_StoreHandle(ExternalPointerHandle handle) const;
381 inline void Release_StoreHandle(ExternalPointerHandle handle) const;
382#endif // V8_COMPRESS_POINTERS
383
384 inline Address load(IsolateForSandbox isolate);
385 inline void store(IsolateForSandbox isolate, Address value,
387
388 // ExternalPointerSlot serialization support.
389 // These methods can be used to clear an external pointer slot prior to
390 // serialization and restore it afterwards. This is useful in cases where the
391 // external pointer is not contained in the snapshot but will instead be
392 // reconstructed during deserialization.
393 // Note that GC must be disallowed while an object's external slot is cleared
394 // as otherwise the corresponding entry in the external pointer table may not
395 // be marked as alive.
398 const DisallowGarbageCollection& no_gc);
400 RawContent content, const DisallowGarbageCollection& no_gc);
401 // The ReadOnlySerializer replaces the RawContent in-place.
403 const DisallowGarbageCollection& no_gc, uint32_t index);
405 const DisallowGarbageCollection& no_gc);
406
407#ifdef V8_COMPRESS_POINTERS
408 bool ExactTagIsKnown() const { return tag_range_.Size() == 1; }
409
412 return tag_range_.first;
413 }
414
415 ExternalPointerTagRange tag_range() const { return tag_range_; }
416#else
417 bool ExactTagIsKnown() const { return true; }
418
420
424#endif // V8_COMPRESS_POINTERS
425
426 private:
427#ifdef V8_COMPRESS_POINTERS
428 ExternalPointerHandle* handle_location() const {
429 DCHECK(HasExternalPointerHandle());
430 return reinterpret_cast<ExternalPointerHandle*>(address());
431 }
432
433 // The tag range associated with this slot.
434 ExternalPointerTagRange tag_range_;
435#endif // V8_COMPRESS_POINTERS
436};
437
438// Similar to ExternalPointerSlot with the difference that it refers to an
439// `CppHeapPointer_t` which has different sizing and alignment than
440// `ExternalPointer_t`.
442 : public SlotBase<CppHeapPointerSlot, CppHeapPointer_t,
443 /*SlotDataAlignment=*/sizeof(CppHeapPointer_t)> {
444 public:
446
448
449#ifdef V8_COMPRESS_POINTERS
450
451 // When V8 runs with pointer compression, the slots here store a handle to an
452 // entry in a dedicated ExternalPointerTable that is only used for CppHeap
453 // references. These methods allow access to the underlying handle while the
454 // load/store methods below resolve the handle to the real pointer. Handles
455 // should generally be accessed atomically as they may be accessed from other
456 // threads, for example GC marking threads.
457 inline CppHeapPointerHandle Relaxed_LoadHandle() const;
458 inline void Relaxed_StoreHandle(CppHeapPointerHandle handle) const;
459 inline void Release_StoreHandle(CppHeapPointerHandle handle) const;
460
461#endif // V8_COMPRESS_POINTERS
462
464 CppHeapPointerTagRange tag_range) const;
465 inline void store(IsolateForPointerCompression isolate, Address value,
466 CppHeapPointerTag tag) const;
467 inline void init() const;
468};
469
470// An IndirectPointerSlot instance describes a 32-bit field ("slot") containing
471// an IndirectPointerHandle, i.e. an index to an entry in a pointer table which
472// contains the "real" pointer to the referenced HeapObject. These slots are
473// used when the sandbox is enabled to securely reference HeapObjects outside
474// of the sandbox.
476 : public SlotBase<IndirectPointerSlot, IndirectPointerHandle,
477 kTaggedSize /* slot alignment */> {
478 public:
481#ifdef V8_ENABLE_SANDBOX
482 ,
484#endif
485 {
486 }
487
489 : SlotBase(ptr)
490#ifdef V8_ENABLE_SANDBOX
491 ,
492 tag_(tag)
493#endif
494 {
495 }
496
497 // Even though only HeapObjects can be stored into an IndirectPointerSlot,
498 // these slots can be empty (containing kNullIndirectPointerHandle), in which
499 // case load() will return Smi::zero().
500 inline Tagged<Object> load(IsolateForSandbox isolate) const;
501 inline void store(Tagged<ExposedTrustedObject> value) const;
502
503 // Load the value of this slot.
504 // The isolate parameter is required unless using the kCodeTag tag, as these
505 // object use a different pointer table.
506 inline Tagged<Object> Relaxed_Load(IsolateForSandbox isolate) const;
508 IsolateForSandbox isolate) const;
509 inline Tagged<Object> Acquire_Load(IsolateForSandbox isolate) const;
510
511 // Store a reference to the given object into this slot. The object must be
512 // indirectly refereceable.
513 inline void Relaxed_Store(Tagged<ExposedTrustedObject> value) const;
514 inline void Release_Store(Tagged<ExposedTrustedObject> value) const;
515
520
521#ifdef V8_ENABLE_SANDBOX
522 IndirectPointerTag tag() const { return tag_; }
523#else
525#endif
526
527 // Whether this slot is empty, i.e. contains a null handle.
528 inline bool IsEmpty() const;
529
530 // Retrieve the object referenced by the given handle by determining the
531 // appropriate pointer table to use and loading the referenced entry in it.
532 // This method is used internally by load() and related functions but can
533 // also be used to manually implement indirect pointer accessors.
534 // {allow_unpublished}: allow the "unpublished" tag in addition to the
535 // tag specified by the slot.
537 template <TagCheckStrictness allow_unpublished = kRequireExactMatch>
539 IsolateForSandbox isolate) const;
540
541 private:
542#ifdef V8_ENABLE_SANDBOX
543 // Retrieve the object referenced through the given trusted pointer handle
544 // from the trusted pointer table.
545 template <TagCheckStrictness allow_unpublished = kRequireExactMatch>
546 inline Tagged<Object> ResolveTrustedPointerHandle(
548 // Retrieve the Code object referenced through the given code pointer handle
549 // from the code pointer table.
550 inline Tagged<Object> ResolveCodePointerHandle(
552
553 // The tag associated with this slot.
555#endif // V8_ENABLE_SANDBOX
556};
557
558class WritableJitAllocation;
559
560template <typename SlotT>
561class WriteProtectedSlot : public SlotT {
562 public:
563 using TObject = typename SlotT::TObject;
564 using SlotT::kCanBeWeak;
565
567 Address ptr)
568 : SlotT(ptr), jit_allocation_(jit_allocation) {}
569
570 inline TObject Relaxed_Load() const { return SlotT::Relaxed_Load(); }
571 inline TObject Relaxed_Load(PtrComprCageBase cage_base) const {
572 return SlotT::Relaxed_Load(cage_base);
573 }
574
575 inline void Relaxed_Store(TObject value) const;
576
577 private:
579};
580
581// Copies tagged words from |src| to |dst|. The data spans must not overlap.
582// |src| and |dst| must be kTaggedSize-aligned.
583inline void CopyTagged(Address dst, const Address src, size_t num_tagged);
584
585// Sets |counter| number of kTaggedSize-sized values starting at |start| slot.
587 size_t counter);
588
589// Sets |counter| number of kTaggedSize-sized values starting at |start| slot.
590template <typename T>
592 size_t counter);
593
594} // namespace v8::internal
595
596#endif // V8_OBJECTS_SLOTS_H_
#define T
Address try_load(IsolateForPointerCompression isolate, CppHeapPointerTagRange tag_range) const
Definition slots-inl.h:319
void store(IsolateForPointerCompression isolate, Address value, CppHeapPointerTag tag) const
Definition slots-inl.h:330
CppHeapPointerSlot(Address ptr)
Definition slots.h:447
void init(IsolateForSandbox isolate, Tagged< HeapObject > host, Address value, ExternalPointerTag tag)
Definition slots-inl.h:205
ExternalPointerSlot(Address ptr, ExternalPointerTag tag_range)
Definition slots.h:332
ExternalPointerSlot(ExternalPointerMember< tag > *member)
Definition slots.h:351
uint32_t GetContentAsIndexAfterDeserialization(const DisallowGarbageCollection &no_gc)
Definition slots-inl.h:293
ExternalPointer_t RawContent
Definition slots.h:396
ExternalPointerTagRange tag_range() const
Definition slots.h:421
ExternalPointerSlot(Address ptr, ExternalPointerTagRange tag_range)
Definition slots.h:341
RawContent GetAndClearContentForSerialization(const DisallowGarbageCollection &no_gc)
Definition slots-inl.h:261
void ReplaceContentWithIndexForSerialization(const DisallowGarbageCollection &no_gc, uint32_t index)
Definition slots-inl.h:283
ExternalPointerTag exact_tag() const
Definition slots.h:419
Address load(IsolateForSandbox isolate)
Definition slots-inl.h:237
void RestoreContentAfterSerialization(RawContent content, const DisallowGarbageCollection &no_gc)
Definition slots-inl.h:273
void store(IsolateForSandbox isolate, Address value, ExternalPointerTag tag)
Definition slots-inl.h:248
FullHeapObjectSlot(Address ptr)
Definition slots.h:201
FullHeapObjectSlot(SlotBase< T, TData, kSlotDataAlignment > slot)
Definition slots.h:210
FullHeapObjectSlot(TaggedBase *ptr)
Definition slots.h:202
FullMaybeObjectSlot(TaggedBase *ptr)
Definition slots.h:163
FullMaybeObjectSlot(SlotBase< T, TData, kSlotDataAlignment > slot)
Definition slots.h:173
FullMaybeObjectSlot(Tagged< MaybeObject > *ptr)
Definition slots.h:170
FullObjectSlot(Address ptr)
Definition slots.h:107
Tagged< Object > Relaxed_Load() const
Definition slots-inl.h:82
FullObjectSlot(const Address *ptr)
Definition slots.h:108
FullObjectSlot(SlotBase< T, TData, kSlotDataAlignment > slot)
Definition slots.h:117
Tagged< Object > Relaxed_Load_AllowUnpublished(IsolateForSandbox isolate) const
Definition slots-inl.h:363
IndirectPointerHandle Acquire_LoadHandle() const
Definition slots-inl.h:402
void Release_StoreHandle(IndirectPointerHandle handle) const
Definition slots-inl.h:411
Tagged< Object > load(IsolateForSandbox isolate) const
Definition slots-inl.h:349
IndirectPointerHandle Relaxed_LoadHandle() const
Definition slots-inl.h:398
Tagged< Object > Relaxed_Load(IsolateForSandbox isolate) const
Definition slots-inl.h:357
void Relaxed_StoreHandle(IndirectPointerHandle handle) const
Definition slots-inl.h:406
IndirectPointerTag tag() const
Definition slots.h:524
void Relaxed_Store(Tagged< ExposedTrustedObject > value) const
Definition slots-inl.h:375
Tagged< Object > Acquire_Load(IsolateForSandbox isolate) const
Definition slots-inl.h:369
void Release_Store(Tagged< ExposedTrustedObject > value) const
Definition slots-inl.h:387
Tagged< Object > ResolveHandle(IndirectPointerHandle handle, IsolateForSandbox isolate) const
Definition slots-inl.h:421
void store(Tagged< ExposedTrustedObject > value) const
Definition slots-inl.h:353
IndirectPointerSlot(Address ptr, IndirectPointerTag tag)
Definition slots.h:488
OffHeapFullObjectSlot(const Address *ptr)
Definition slots.h:306
Tagged< Object > operator*() const =delete
Subclass operator-(int i)
Definition slots.h:70
Subclass operator--(int)
Definition slots.h:45
Subclass & operator+=(int i)
Definition slots.h:66
bool operator>(const SlotBase &other) const
Definition slots.h:53
Subclass operator-(int i) const
Definition slots.h:61
Subclass & operator-=(int i)
Definition slots.h:71
bool operator==(const SlotBase &other) const
Definition slots.h:55
void * ToVoidPtr() const
Definition slots.h:76
SlotBase(Address ptr)
Definition slots.h:83
Address address() const
Definition slots.h:78
friend Subclass operator+(int i, const Subclass &slot)
Definition slots.h:63
Subclass & operator--()
Definition slots.h:41
bool operator!=(const SlotBase &other) const
Definition slots.h:56
size_t operator-(const SlotBase &other) const
Definition slots.h:57
Subclass operator+(int i) const
Definition slots.h:62
bool operator>=(const SlotBase &other) const
Definition slots.h:54
TData * location() const
Definition slots.h:80
Subclass operator++(int)
Definition slots.h:36
bool operator<(const SlotBase &other) const
Definition slots.h:51
Subclass & operator++()
Definition slots.h:32
bool operator<=(const SlotBase &other) const
Definition slots.h:52
bool operator==(const Reference &other) const
Definition slots.h:261
bool operator<(const Reference &other) const
Definition slots.h:257
Reference & operator=(T value)
Definition slots.h:242
Reference & operator=(const Reference &other) V8_NOEXCEPT
Definition slots.h:238
void swap(Reference &other)
Definition slots.h:251
Reference(const Reference &) V8_NOEXCEPT=default
friend difference_type operator-(UnalignedSlot a, UnalignedSlot b)
Definition slots.h:295
Reference operator[](difference_type i) const
Definition slots.h:288
std::random_access_iterator_tag iterator_category
Definition slots.h:277
UnalignedSlot(T *address)
Definition slots.h:282
Reference operator*() const
Definition slots.h:285
friend void swap(Reference lhs, Reference rhs)
Definition slots.h:293
UnalignedSlot(Address address)
Definition slots.h:280
TObject Relaxed_Load() const
Definition slots.h:570
typename SlotT::TObject TObject
Definition slots.h:563
WritableJitAllocation & jit_allocation_
Definition slots.h:578
void Relaxed_Store(TObject value) const
Definition slots-inl.h:469
WriteProtectedSlot(WritableJitAllocation &jit_allocation, Address ptr)
Definition slots.h:566
TObject Relaxed_Load(PtrComprCageBase cage_base) const
Definition slots.h:571
Node ** ptr_
#define V8_ENABLE_SANDBOX_BOOL
Definition globals.h:160
int start
ZoneVector< RpoNumber > & result
V8_INLINE IndirectHandle< T > handle(Tagged< T > object, Isolate *isolate)
Definition handles-inl.h:72
void CopyTagged(Address dst, const Address src, size_t num_tagged)
Definition slots-inl.h:479
too high values may cause the compiler to set high thresholds for inlining to as much as possible avoid inlined allocation of objects that cannot escape trace load stores from virtual maglev objects use TurboFan fast string builder analyze liveness of environment slots and zap dead values trace TurboFan load elimination emit data about basic block usage in builtins to this enable builtin reordering when run mksnapshot flag for emit warnings when applying builtin profile data verify register allocation in TurboFan randomly schedule instructions to stress dependency tracking enable store store elimination in TurboFan rewrite far to near simulate GC compiler thread race related to allow float parameters to be passed in simulator mode JS Wasm Run additional turbo_optimize_inlined_js_wasm_wrappers enable experimental feedback collection in generic lowering enable Turboshaft s WasmLoadElimination enable Turboshaft s low level load elimination for JS enable Turboshaft s escape analysis for string concatenation use enable Turbolev features that we want to ship in the not too far future trace individual Turboshaft reduction steps trace intermediate Turboshaft reduction steps invocation count threshold for early optimization Enables optimizations which favor memory size over execution speed Enables sampling allocation profiler with X as a sample interval min size of a semi the new space consists of two semi spaces max size of the Collect garbage after Collect garbage after keeps maps alive for< n > old space garbage collections print one detailed trace line in allocation gc speed threshold for starting incremental marking via a task in percent of available threshold for starting incremental marking immediately in percent of available Use a single schedule for determining a marking schedule between JS and C objects schedules the minor GC task with kUserVisible priority max worker number of concurrent for NumberOfWorkerThreads start background threads that allocate memory concurrent_array_buffer_sweeping use parallel threads to clear weak refs in the atomic pause trace progress of the incremental marking trace object counts and memory usage report a tick only when allocated zone memory changes by this amount TracingFlags::gc_stats store(v8::tracing::TracingCategoryObserver::ENABLED_BY_NATIVE)) DEFINE_GENERIC_IMPLICATION(trace_gc_object_stats
void MemsetTagged(Tagged_t *start, Tagged< MaybeObject > value, size_t counter)
Definition slots-inl.h:486
Address Tagged_t
Definition globals.h:547
TagRange< ExternalPointerTag > ExternalPointerTagRange
uint32_t IndirectPointerHandle
Address ExternalPointer_t
@ kExternalPointerNullTag
@ kArrayBufferExtensionTag
uint32_t ExternalPointerHandle
uint32_t CppHeapPointerHandle
static constexpr Address kNullAddress
Definition v8-internal.h:53
CppHeapPointerTag
Definition v8-sandbox.h:28
#define V8_NOEXCEPT
#define DCHECK_GE(v1, v2)
Definition logging.h:488
#define DCHECK(condition)
Definition logging.h:482
constexpr bool IsAligned(T value, U alignment)
Definition macros.h:403
std::unique_ptr< ValueMirror > value