5#ifndef V8_OBJECTS_COMPRESSED_SLOTS_H_
6#define V8_OBJECTS_COMPRESSED_SLOTS_H_
16#ifdef V8_COMPRESS_POINTERS
22class CompressedObjectSlot :
public SlotBase<CompressedObjectSlot, Tagged_t> {
25 using TObject = Tagged<Object>;
26 using THeapObjectSlot = CompressedHeapObjectSlot;
28 static constexpr bool kCanBeWeak =
false;
31 explicit CompressedObjectSlot(Address ptr) : SlotBase(ptr) {}
32 explicit CompressedObjectSlot(Address* ptr)
33 : SlotBase(reinterpret_cast<
Address>(ptr)) {}
34 inline explicit CompressedObjectSlot(Tagged<Object>*
object);
35 explicit CompressedObjectSlot(Tagged<Object>
const*
const* ptr)
36 : SlotBase(reinterpret_cast<
Address>(ptr)) {}
37 explicit CompressedObjectSlot(
const TaggedMemberBase* member)
38 : SlotBase(reinterpret_cast<
Address>(member->ptr_location())) {}
40 explicit CompressedObjectSlot(SlotBase<T, TData, kSlotDataAlignment> slot)
41 : SlotBase(slot.address()) {}
45 inline bool contains_map_value(Address raw_value)
const;
46 inline bool Relaxed_ContainsMapValue(Address raw_value)
const;
50 inline Tagged<Object> operator*()
const;
57 inline Tagged<Object> load()
const;
58 inline Tagged<Object> load(PtrComprCageBase cage_base)
const;
59 inline void store(Tagged<Object> value)
const;
60 inline void store_map(Tagged<Map> map)
const;
62 inline Tagged<Map> load_map()
const;
66 inline Tagged<Object>
Relaxed_Load(PtrComprCageBase cage_base)
const;
67 inline Tagged_t Relaxed_Load_Raw()
const;
68 static inline Tagged<Object> RawToTagged(PtrComprCageBase cage_base,
73 Tagged<Object> target)
const;
81class CompressedMaybeObjectSlot
82 :
public SlotBase<CompressedMaybeObjectSlot, Tagged_t> {
85 using TObject = Tagged<MaybeObject>;
86 using THeapObjectSlot = CompressedHeapObjectSlot;
88 static constexpr bool kCanBeWeak =
true;
91 explicit CompressedMaybeObjectSlot(Address ptr) : SlotBase(ptr) {}
92 explicit CompressedMaybeObjectSlot(Tagged<Object>* ptr)
93 : SlotBase(reinterpret_cast<
Address>(ptr)) {}
94 explicit CompressedMaybeObjectSlot(Tagged<MaybeObject>* ptr)
95 : SlotBase(reinterpret_cast<
Address>(ptr)) {}
96 explicit CompressedMaybeObjectSlot(
const TaggedMemberBase* member)
97 : SlotBase(reinterpret_cast<
Address>(member->ptr_location())) {}
99 explicit CompressedMaybeObjectSlot(
100 SlotBase<T, TData, kSlotDataAlignment> slot)
101 : SlotBase(slot.address()) {}
103 inline Tagged<MaybeObject> operator*()
const;
104 inline Tagged<MaybeObject> load()
const;
105 inline Tagged<MaybeObject> load(PtrComprCageBase cage_base)
const;
106 inline void store(Tagged<MaybeObject> value)
const;
109 inline Tagged<MaybeObject>
Relaxed_Load(PtrComprCageBase cage_base)
const;
110 inline Tagged_t Relaxed_Load_Raw()
const;
111 static inline Tagged<Object> RawToTagged(PtrComprCageBase cage_base,
115 Tagged<MaybeObject> target)
const;
125class CompressedHeapObjectSlot
126 :
public SlotBase<CompressedHeapObjectSlot, Tagged_t> {
131 explicit CompressedHeapObjectSlot(Address ptr) : SlotBase(ptr) {}
132 explicit CompressedHeapObjectSlot(TaggedBase* ptr)
133 : SlotBase(reinterpret_cast<
Address>(ptr)) {}
134 template <
typename T>
135 explicit CompressedHeapObjectSlot(SlotBase<T, TData, kSlotDataAlignment> slot)
136 : SlotBase(slot.address()) {}
138 inline Tagged<HeapObjectReference> operator*()
const;
139 inline Tagged<HeapObjectReference> load(PtrComprCageBase cage_base)
const;
140 inline void store(Tagged<HeapObjectReference> value)
const;
142 inline Tagged<HeapObject> ToHeapObject()
const;
144 inline void StoreHeapObject(Tagged<HeapObject> value)
const;
153template <
typename CompressionScheme,
typename TObject,
typename Sub
class>
154class OffHeapCompressedObjectSlotBase :
public SlotBase<Subclass, Tagged_t> {
156 using TSlotBase = SlotBase<Subclass, Tagged_t>;
157 using TCompressionScheme = CompressionScheme;
159 OffHeapCompressedObjectSlotBase() : TSlotBase(
kNullAddress) {}
160 explicit OffHeapCompressedObjectSlotBase(Address ptr) : TSlotBase(ptr) {}
161 explicit OffHeapCompressedObjectSlotBase(
const uint32_t* ptr)
162 : TSlotBase(reinterpret_cast<
Address>(ptr)) {}
164 inline TObject load()
const;
165 inline TObject load(PtrComprCageBase cage_base)
const;
166 inline void store(TObject value)
const;
172 inline TObject
Relaxed_Load(PtrComprCageBase cage_base)
const;
173 inline Tagged_t Relaxed_Load_Raw()
const;
174 static inline Tagged<Object> RawToTagged(PtrComprCageBase cage_base,
177 inline TObject
Acquire_Load(PtrComprCageBase cage_base)
const;
183template <
typename CompressionScheme>
184class OffHeapCompressedObjectSlot
185 :
public OffHeapCompressedObjectSlotBase<
186 CompressionScheme, Tagged<Object>,
187 OffHeapCompressedObjectSlot<CompressionScheme>> {
189 using TSlotBase = OffHeapCompressedObjectSlotBase<
191 OffHeapCompressedObjectSlot<CompressionScheme>>;
193 using THeapObjectSlot = OffHeapCompressedObjectSlot<CompressionScheme>;
195 static constexpr bool kCanBeWeak =
false;
197 OffHeapCompressedObjectSlot() : TSlotBase(
kNullAddress) {}
198 explicit OffHeapCompressedObjectSlot(
Address ptr) : TSlotBase(ptr) {}
199 explicit OffHeapCompressedObjectSlot(
const uint32_t* ptr)
200 : TSlotBase(reinterpret_cast<
Address>(ptr)) {}
202 template <
typename T>
203 explicit OffHeapCompressedObjectSlot(SlotBase<T, Tagged_t> slot)
204 : TSlotBase(slot.address()) {}
207template <
typename CompressionScheme>
208class OffHeapCompressedMaybeObjectSlot
209 :
public OffHeapCompressedObjectSlotBase<
210 CompressionScheme, Tagged<MaybeObject>,
211 OffHeapCompressedMaybeObjectSlot<CompressionScheme>> {
213 using TSlotBase = OffHeapCompressedObjectSlotBase<
215 OffHeapCompressedMaybeObjectSlot<CompressionScheme>>;
217 using THeapObjectSlot = OffHeapCompressedMaybeObjectSlot<CompressionScheme>;
219 static constexpr bool kCanBeWeak =
true;
221 OffHeapCompressedMaybeObjectSlot() : TSlotBase(
kNullAddress) {}
222 explicit OffHeapCompressedMaybeObjectSlot(
Address ptr) : TSlotBase(ptr) {}
223 explicit OffHeapCompressedMaybeObjectSlot(
const uint32_t* ptr)
224 : TSlotBase(reinterpret_cast<
Address>(ptr)) {}
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 Relaxed_Store(volatile Atomic8 *ptr, Atomic8 value)
Atomic8 Release_CompareAndSwap(volatile Atomic8 *ptr, Atomic8 old_value, Atomic8 new_value)
Atomic8 Relaxed_Load(volatile const Atomic8 *ptr)
Atomic8 Acquire_Load(volatile const Atomic8 *ptr)
void Release_Store(volatile Atomic8 *ptr, Atomic8 value)
constexpr Address kNullAddress
Tagged(T object) -> Tagged< T >
static constexpr Address kNullAddress
V8HeapCompressionSchemeImpl< MainCage > V8HeapCompressionScheme