5#ifndef INCLUDE_CPPGC_INTERNAL_MEMBER_STORAGE_H_
6#define INCLUDE_CPPGC_INTERNAL_MEMBER_STORAGE_H_
12#include "cppgc/internal/api-constants.h"
13#include "cppgc/internal/caged-heap.h"
14#include "cppgc/internal/logging.h"
15#include "cppgc/sentinel-pointer.h"
26#if defined(CPPGC_POINTER_COMPRESSION)
31#define CPPGC_CONST __attribute__((const))
32#define CPPGC_REQUIRE_CONSTANT_INIT
33 __attribute__((require_constant_initialization))
36#define CPPGC_REQUIRE_CONSTANT_INIT
70#undef CPPGC_REQUIRE_CONSTANT_INIT
134 "The compression scheme relies on the sentinel encoded as 1 "
135 "<< kPointerCompressionShift");
178 return reinterpret_cast<
void*>(
mask &
base);
232 using IntegralType = uintptr_t;
244 return reinterpret_cast<
const std::atomic<
const void*>&>(ptr_).load(
245 std::memory_order_relaxed);
250 reinterpret_cast<std::atomic<
const void*>&>(ptr_).store(
251 ptr, std::memory_order_relaxed);
260 return reinterpret_cast<uintptr_t>(ptr_);
264 return a.ptr_ == b.ptr_;
267 return a.ptr_ != b.ptr_;
270 return a.ptr_ < b.ptr_;
273 return a.ptr_ <= b.ptr_;
276 return a.ptr_ > b.ptr_;
279 return a.ptr_ >= b.ptr_;
282 template <
typename Callback>
286 return callback(
const_cast<
void*>(address));
296#if defined(CPPGC_POINTER_COMPRESSION)
299using DefaultMemberStorage = RawPointer;
V8_INLINE friend bool operator!=(RawPointer a, RawPointer b)
V8_INLINE RawPointer(const void *ptr, AtomicInitializerTag)
V8_INLINE friend bool operator<(RawPointer a, RawPointer b)
V8_INLINE const void * Load() const
static V8_INLINE void VisitPossiblePointers(const void *address, Callback callback)
V8_INLINE bool IsSentinel() const
V8_INLINE friend bool operator==(RawPointer a, RawPointer b)
static constexpr auto kWriteBarrierSlotType
V8_INLINE const void * LoadAtomic() const
V8_INLINE void StoreAtomic(const void *ptr)
V8_INLINE void Store(const void *ptr)
V8_INLINE RawPointer(const void *ptr)
V8_INLINE bool IsCleared() const
V8_INLINE friend bool operator>(RawPointer a, RawPointer b)
V8_INLINE friend bool operator>=(RawPointer a, RawPointer b)
V8_INLINE uintptr_t GetAsInteger() const
V8_INLINE friend bool operator<=(RawPointer a, RawPointer b)
constexpr internal::SentinelPointer kSentinelPointer