5#ifndef INCLUDE_CPPGC_INTERNAL_POINTER_POLICIES_H_
6#define INCLUDE_CPPGC_INTERNAL_POINTER_POLICIES_H_
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);
51 WriteBarrier(type, params, slot, value);
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);
67 WriteBarrier(type, params, slot, storage.
Load());
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);
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,
V8_INLINE void CheckPointer(T *)
V8_INLINE void CheckPointer(RawPointer)
constexpr SourceLocation Location() const
constexpr IgnoreLocationPolicy(const SourceLocation &)
constexpr IgnoreLocationPolicy()=default
KeepLocationPolicy & operator=(const KeepLocationPolicy &)=delete
KeepLocationPolicy(KeepLocationPolicy &&)=default
KeepLocationPolicy & operator=(KeepLocationPolicy &&)=default
constexpr KeepLocationPolicy(const SourceLocation &location)
constexpr const SourceLocation & Location() const
KeepLocationPolicy(const KeepLocationPolicy &)=delete
constexpr KeepLocationPolicy()=default
V8_INLINE const void * Load() const
V8_INLINE bool IsSentinel() const
V8_INLINE bool IsCleared() const
void CheckPointerImpl(const void *ptr, bool points_to_payload, bool check_off_heap_assignments)
void CheckPointer(const T *ptr)
V8_INLINE void CheckPointer(RawPointer raw_pointer)
static V8_INLINE void GenerationalBarrier(const Params ¶ms, const void *slot)
static V8_INLINE void DijkstraMarkingBarrier(const Params ¶ms, const void *object)
static V8_INLINE Type GetWriteBarrierType(const void *slot, const void *value, Params ¶ms)
IgnoreLocationPolicy DefaultLocationPolicy
DisabledCheckingPolicy DefaultPersistentCheckingPolicy
DisabledCheckingPolicy DefaultCrossThreadPersistentCheckingPolicy
DisabledCheckingPolicy DefaultMemberCheckingPolicy
RawPointer DefaultMemberStorage
v8::SourceLocation SourceLocation
constexpr internal::SentinelPointer kSentinelPointer
static V8_INLINE void InitializingBarrier(const void *, RawPointer storage)
static V8_INLINE void AssigningBarrier(const void *slot, const void *value)
static V8_INLINE void AssigningBarrier(const void *slot, RawPointer storage)
static V8_INLINE void InitializingBarrier(const void *, const void *)
static V8_INLINE void AssigningBarrier(const void *, const void *)
static V8_INLINE void InitializingBarrier(const void *, RawPointer storage)
static V8_INLINE void AssigningBarrier(const void *, MemberStorage)
static V8_INLINE void InitializingBarrier(const void *, const void *)
std::true_type IsStrongPersistent
static V8_EXPORT CrossThreadPersistentRegion & GetPersistentRegion(const void *object)
std::true_type IsStrongPersistent
static V8_EXPORT PersistentRegion & GetPersistentRegion(const void *object)
static V8_EXPORT CrossThreadPersistentRegion & GetPersistentRegion(const void *object)
std::false_type IsStrongPersistent
static V8_EXPORT PersistentRegion & GetPersistentRegion(const void *object)
std::false_type IsStrongPersistent
#define V8_UNLIKELY(condition)