5#ifndef INCLUDE_CPPGC_INTERNAL_POINTER_POLICIES_H_
6#define INCLUDE_CPPGC_INTERNAL_POINTER_POLICIES_H_
22class PersistentRegion;
23class CrossThreadPersistentRegion;
28class UntracedMemberTag;
36#if defined(CPPGC_POINTER_COMPRESSION)
38 CompressedPointer storage) {}
41 template <WriteBarrierSlotType SlotType>
44#ifdef CPPGC_SLIM_WRITE_BARRIER
46 WriteBarrier::CombinedWriteBarrierSlow<SlotType>(slot);
55 template <WriteBarrierSlotType SlotType>
59 "Assigning storages of Member and UncompressedMember is not supported");
60#ifdef CPPGC_SLIM_WRITE_BARRIER
62 WriteBarrier::CombinedWriteBarrierSlow<SlotType>(slot);
71#if defined(CPPGC_POINTER_COMPRESSION)
72 template <WriteBarrierSlotType SlotType>
74 CompressedPointer storage) {
77 "Assigning storages of Member and UncompressedMember is not supported");
78#ifdef CPPGC_SLIM_WRITE_BARRIER
80 WriteBarrier::CombinedWriteBarrierSlow<SlotType>(slot);
92 const WriteBarrier::Params& params,
93 const void* slot,
const void* value) {
111#if defined(CPPGC_POINTER_COMPRESSION)
113 CompressedPointer storage) {}
115 template <WriteBarrierSlotType>
117 template <WriteBarrierSlotType,
typename MemberStorage>
124 bool check_off_heap_assignments);
126 const HeapBase* heap_ =
nullptr;
129template <
bool kCheckOffHeapAssignments>
133 template <
typename T>
138 CheckPointersImplTrampoline<T>::Call(
139 this,
static_cast<const T*
>(raw_pointer.
Load()));
141#if defined(CPPGC_POINTER_COMPRESSION)
142 template <
typename T>
143 V8_INLINE void CheckPointer(CompressedPointer compressed_pointer) {
144 if (compressed_pointer.IsCleared() || compressed_pointer.IsSentinel()) {
147 CheckPointersImplTrampoline<T>::Call(
148 this,
static_cast<const T*
>(compressed_pointer.Load()));
151 template <
typename T>
156 CheckPointersImplTrampoline<T>::Call(
this, ptr);
160 template <
typename T,
bool = IsCompleteV<T>>
161 struct CheckPointersImplTrampoline {
163 policy->CheckPointerImpl(ptr,
false, kCheckOffHeapAssignments);
167 template <
typename T>
168 struct CheckPointersImplTrampoline<T, true> {
169 static void Call(SameThreadEnabledCheckingPolicy* policy,
const T* ptr) {
170 policy->CheckPointerImpl(ptr, IsGarbageCollectedTypeV<T>,
171 kCheckOffHeapAssignments);
178 template <
typename T>
180 template <
typename T>
182#if defined(CPPGC_POINTER_COMPRESSION)
183 template <
typename T>
188#ifdef CPPGC_ENABLE_SLOW_API_CHECKS
192 SameThreadEnabledCheckingPolicy<
false >;
194 SameThreadEnabledCheckingPolicy<
true >;
211 : location_(location) {}
234#if CPPGC_SUPPORTS_OBJECT_NAMES
263template <
typename T,
typename WeaknessPolicy,
267template <
typename T,
typename WeaknessPolicy,
271template <
typename T,
typename WeaknessTag,
typename WriteBarrierPolicy,
Definition: cross-thread-persistent.h:74
Definition: persistent.h:54
Definition: persistent-node.h:185
Definition: pointer-policies.h:176
void CheckPointer(T *)
Definition: pointer-policies.h:179
void CheckPointer(RawPointer)
Definition: pointer-policies.h:181
Definition: pointer-policies.h:225
constexpr IgnoreLocationPolicy(const SourceLocation &)
Definition: pointer-policies.h:231
constexpr IgnoreLocationPolicy()=default
constexpr SourceLocation Location() const
Definition: pointer-policies.h:227
Definition: pointer-policies.h:204
constexpr KeepLocationPolicy()=default
constexpr const SourceLocation & Location() const
Definition: pointer-policies.h:206
KeepLocationPolicy & operator=(KeepLocationPolicy &&)=default
KeepLocationPolicy(KeepLocationPolicy &&)=default
constexpr KeepLocationPolicy(const SourceLocation &location)
Definition: pointer-policies.h:210
KeepLocationPolicy & operator=(const KeepLocationPolicy &)=delete
KeepLocationPolicy(const KeepLocationPolicy &)=delete
Definition: persistent-node.h:138
Definition: member-storage.h:203
const void * Load() const
Definition: member-storage.h:217
bool IsSentinel() const
Definition: member-storage.h:232
bool IsCleared() const
Definition: member-storage.h:230
Definition: pointer-policies.h:121
void CheckPointerImpl(const void *ptr, bool points_to_payload, bool check_off_heap_assignments)
Definition: pointer-policies.h:131
void CheckPointer(RawPointer raw_pointer)
Definition: pointer-policies.h:134
void CheckPointer(const T *ptr)
Definition: pointer-policies.h:152
Definition: write-barrier.h:39
Type
Definition: write-barrier.h:41
static Type GetWriteBarrierType(const void *slot, const void *value, Params ¶ms)
Definition: write-barrier.h:388
static void GenerationalBarrier(const Params ¶ms, const void *slot)
Definition: write-barrier.h:105
static bool IsEnabled()
Definition: write-barrier.h:118
static void DijkstraMarkingBarrier(const Params ¶ms, const void *object)
Definition: write-barrier.h:419
Definition: v8-source-location.h:31
IgnoreLocationPolicy DefaultLocationPolicy
Definition: pointer-policies.h:237
DisabledCheckingPolicy DefaultMemberCheckingPolicy
Definition: pointer-policies.h:196
DisabledCheckingPolicy DefaultPersistentCheckingPolicy
Definition: pointer-policies.h:197
Definition: allocation.h:38
constexpr internal::SentinelPointer kSentinelPointer
Definition: sentinel-pointer.h:35
Definition: pointer-policies.h:30
static void AssigningBarrier(const void *slot, const void *value)
Definition: pointer-policies.h:42
static void AssigningBarrier(const void *slot, RawPointer storage)
Definition: pointer-policies.h:56
static void InitializingBarrier(const void *, const void *)
Definition: pointer-policies.h:33
static void InitializingBarrier(const void *, RawPointer storage)
Definition: pointer-policies.h:34
Definition: pointer-policies.h:108
static void InitializingBarrier(const void *, const void *)
Definition: pointer-policies.h:109
static void AssigningBarrier(const void *, MemberStorage)
Definition: pointer-policies.h:118
static void InitializingBarrier(const void *, RawPointer storage)
Definition: pointer-policies.h:110
static void AssigningBarrier(const void *, const void *)
Definition: pointer-policies.h:116
Definition: pointer-policies.h:250
static CrossThreadPersistentRegion & GetPersistentRegion(const void *object)
std::true_type IsStrongPersistent
Definition: pointer-policies.h:251
Definition: pointer-policies.h:240
static PersistentRegion & GetPersistentRegion(const void *object)
std::true_type IsStrongPersistent
Definition: pointer-policies.h:241
Definition: pointer-policies.h:256
static CrossThreadPersistentRegion & GetPersistentRegion(const void *object)
std::false_type IsStrongPersistent
Definition: pointer-policies.h:257
Definition: pointer-policies.h:245
std::false_type IsStrongPersistent
Definition: pointer-policies.h:246
static PersistentRegion & GetPersistentRegion(const void *object)
Definition: write-barrier.h:53
#define V8_EXPORT
Definition: v8config.h:793
#define V8_INLINE
Definition: v8config.h:499
#define V8_UNLIKELY(condition)
Definition: v8config.h:649