5#ifndef INCLUDE_CPPGC_MEMBER_H_
6#define INCLUDE_CPPGC_MEMBER_H_
34 const void*
GetRaw()
const {
return raw_; }
35 void SetRaw(
void* value) { raw_ = value; }
38 return reinterpret_cast<const std::atomic<const void*>*
>(&raw_)->load(
39 std::memory_order_relaxed);
42 reinterpret_cast<std::atomic<const void*>*
>(&raw_)->store(
43 value, std::memory_order_relaxed);
52 mutable const void* raw_;
56template <
typename T,
typename WeaknessTag,
typename WriteBarrierPolicy,
57 typename CheckingPolicy>
66 InitializingWriteBarrier();
67 this->CheckPointer(Get());
79 InitializingWriteBarrier();
80 this->CheckPointer(Get());
87 template <
typename U,
typename OtherBarrierPolicy,
typename OtherWeaknessTag,
88 typename OtherCheckingPolicy,
89 typename = std::enable_if_t<std::is_base_of<T, U>::value>>
91 const BasicMember<U, OtherWeaknessTag, OtherBarrierPolicy,
92 OtherCheckingPolicy>& other)
99 template <
typename U,
typename OtherBarrierPolicy,
typename OtherWeaknessTag,
100 typename OtherCheckingPolicy,
101 typename = std::enable_if_t<std::is_base_of<T, U>::value>>
103 OtherCheckingPolicy>&& other) noexcept
108 template <
typename U,
typename PersistentWeaknessPolicy,
109 typename PersistentLocationPolicy,
110 typename PersistentCheckingPolicy,
111 typename = std::enable_if_t<std::is_base_of<T, U>::value>>
113 PersistentLocationPolicy,
114 PersistentCheckingPolicy>& p)
122 template <
typename U,
typename OtherWeaknessTag,
typename OtherBarrierPolicy,
123 typename OtherCheckingPolicy,
124 typename = std::enable_if_t<std::is_base_of<T, U>::value>>
126 const BasicMember<U, OtherWeaknessTag, OtherBarrierPolicy,
127 OtherCheckingPolicy>& other) {
137 template <
typename U,
typename OtherWeaknessTag,
typename OtherBarrierPolicy,
138 typename OtherCheckingPolicy,
139 typename = std::enable_if_t<std::is_base_of<T, U>::value>>
141 OtherCheckingPolicy>&& other)
noexcept {
147 template <
typename U,
typename PersistentWeaknessPolicy,
148 typename PersistentLocationPolicy,
149 typename PersistentCheckingPolicy,
150 typename = std::enable_if_t<std::is_base_of<T, U>::value>>
153 PersistentLocationPolicy, PersistentCheckingPolicy>&
159 AssigningWriteBarrier();
160 this->CheckPointer(Get());
172 template <
typename OtherWeaknessTag,
typename OtherBarrierPolicy,
173 typename OtherCheckingPolicy>
175 OtherCheckingPolicy>& other) {
181 explicit operator bool()
const {
return Get(); }
182 operator T*()
const {
return Get(); }
207 return reinterpret_cast<const T**
>(
GetRawSlot());
211 const T* GetRawAtomic()
const {
215 void InitializingWriteBarrier()
const {
218 void AssigningWriteBarrier()
const {
224 T* GetFromGC()
const {
return Get(); }
227 template <
typename U>
231template <
typename T1,
typename WeaknessTag1,
typename WriteBarrierPolicy1,
232 typename CheckingPolicy1,
typename T2,
typename WeaknessTag2,
233 typename WriteBarrierPolicy2,
typename CheckingPolicy2>
235 CheckingPolicy1>& member1,
236 const BasicMember<T2, WeaknessTag2, WriteBarrierPolicy2,
237 CheckingPolicy2>& member2) {
238 return member1.Get() == member2.Get();
241template <
typename T1,
typename WeaknessTag1,
typename WriteBarrierPolicy1,
242 typename CheckingPolicy1,
typename T2,
typename WeaknessTag2,
243 typename WriteBarrierPolicy2,
typename CheckingPolicy2>
245 CheckingPolicy1>& member1,
246 const BasicMember<T2, WeaknessTag2, WriteBarrierPolicy2,
247 CheckingPolicy2>& member2) {
248 return !(member1 == member2);
251template <
typename T,
typename WriteBarrierPolicy,
typename CheckingPolicy>
253 internal::
BasicMember<T, WeakMemberTag, WriteBarrierPolicy, CheckingPolicy>>
BasicMember & operator=(std::nullptr_t)
BasicMember & operator=(BasicMember &&other) noexcept
BasicMember(const BasicMember &other)
BasicMember(BasicMember &&other) noexcept
BasicMember(const BasicPersistent< U, PersistentWeaknessPolicy, PersistentLocationPolicy, PersistentCheckingPolicy > &p)
BasicMember(const BasicMember< U, OtherWeaknessTag, OtherBarrierPolicy, OtherCheckingPolicy > &other)
V8_CLANG_NO_SANITIZE("cfi-unrelated-cast") T *Get() const
BasicMember(T *raw, AtomicInitializerTag atomic)
BasicMember & operator=(const BasicPersistent< U, PersistentWeaknessPolicy, PersistentLocationPolicy, PersistentCheckingPolicy > &other)
BasicMember & operator=(T *other)
BasicMember & operator=(const BasicMember &other)
BasicMember(std::nullptr_t, AtomicInitializerTag atomic)
void Swap(BasicMember< T, OtherWeaknessTag, OtherBarrierPolicy, OtherCheckingPolicy > &other)
const T ** GetSlotForTesting() const
BasicMember(BasicMember< U, OtherWeaknessTag, OtherBarrierPolicy, OtherCheckingPolicy > &&other) noexcept
BasicMember(SentinelPointer s)
BasicMember(SentinelPointer s, AtomicInitializerTag atomic)
constexpr BasicMember()=default
BasicMember & operator=(BasicMember< U, OtherWeaknessTag, OtherBarrierPolicy, OtherCheckingPolicy > &&other) noexcept
BasicMember & operator=(SentinelPointer s)
constexpr BasicMember(std::nullptr_t)
BasicMember(T &raw, AtomicInitializerTag atomic)
BasicMember & operator=(const BasicMember< U, OtherWeaknessTag, OtherBarrierPolicy, OtherCheckingPolicy > &other)
void SetRawAtomic(const void *value)
const void * GetRaw() const
const void ** GetRawSlot() const
MemberBase(const void *value, AtomicInitializerTag)
MemberBase(const void *value)
const void * GetRawAtomic() const
bool operator!=(const BasicMember< T1, WeaknessTag1, WriteBarrierPolicy1, CheckingPolicy1 > &member1, const BasicMember< T2, WeaknessTag2, WriteBarrierPolicy2, CheckingPolicy2 > &member2)
bool operator==(const BasicMember< T1, WeaknessTag1, WriteBarrierPolicy1, CheckingPolicy1 > &member1, const BasicMember< T2, WeaknessTag2, WriteBarrierPolicy2, CheckingPolicy2 > &member2)