5#ifndef INCLUDE_CPPGC_INTERNAL_GC_INFO_H_
6#define INCLUDE_CPPGC_INTERNAL_GC_INFO_H_
28 std::atomic<GCInfoIndex>& registered_index) {
29 return EnsureGCInfoIndexTraitDispatch<T>{}(registered_index);
33 template <typename T, bool = FinalizerTrait<T>::HasFinalizer(),
35 struct EnsureGCInfoIndexTraitDispatch;
48#define DISPATCH(has_finalizer, has_non_hidden_name, function) \
49 template <typename T> \
50 struct EnsureGCInfoIndexTrait::EnsureGCInfoIndexTraitDispatch< \
51 T, has_finalizer, has_non_hidden_name> { \
52 V8_INLINE GCInfoIndex \
53 operator()(std::atomic<GCInfoIndex>& registered_index) { \
62 EnsureGCInfoIndex(registered_index,
67 EnsureGCInfoIndex(registered_index,
71 EnsureGCInfoIndex(registered_index,
75 EnsureGCInfoIndex(registered_index,
85 static_assert(
sizeof(T),
"T must be fully defined");
86 static std::atomic<GCInfoIndex>
88 GCInfoIndex index = registered_index.load(std::memory_order_acquire);
90 index = EnsureGCInfoIndexTrait::EnsureIndex<T>(registered_index);
92 CPPGC_DCHECK(index == registered_index.load(std::memory_order_acquire));
108template <
typename T,
typename ParentMostGarbageCollectedType>
111 std::has_virtual_destructor<ParentMostGarbageCollectedType>::value;
113 std::is_trivially_destructible<ParentMostGarbageCollectedType>::value &&
114 std::is_trivially_destructible<T>::value;
117 ParentMostGarbageCollectedType>::value;
118#ifdef CPPGC_SUPPORTS_OBJECT_NAMES
144 std::conditional_t<
WantToFold(), ParentMostGarbageCollectedType, T>;
Definition: name-trait.h:75
#define DISPATCH(has_finalizer, has_non_hidden_name, function)
Definition: gc-info.h:48
#define CPPGC_DCHECK(condition)
Definition: logging.h:36
uint16_t GCInfoIndex
Definition: gc-info.h:21
HeapObjectName(*)(const void *, HeapObjectNameForUnnamedObject) NameCallback
Definition: name-trait.h:134
void(*)(void *) FinalizationCallback
Definition: finalizer-trait.h:15
Definition: allocation.h:38
void(*)(Visitor *visitor, const void *object) TraceCallback
Definition: trace-trait.h:38
Definition: trace-trait.h:105
Definition: finalizer-trait.h:66
static constexpr FinalizationCallback kCallback
Definition: finalizer-trait.h:83
Definition: gc-info.h:109
static constexpr bool kBothTypesAreTriviallyDestructible
Definition: gc-info.h:112
static constexpr bool kHasVirtualDestructorAtBase
Definition: gc-info.h:110
static constexpr bool kHasCustomFinalizerDispatchAtBase
Definition: gc-info.h:115
static constexpr bool kWantsDetailedObjectNames
Definition: gc-info.h:121
static constexpr bool WantToFold()
Definition: gc-info.h:129
std::conditional_t< WantToFold(), ParentMostGarbageCollectedType, T > ResultType
Definition: gc-info.h:144
static GCInfoIndex Index()
Definition: gc-info.h:84
static constexpr void CheckCallbacksAreDefined()
Definition: gc-info.h:97
Definition: finalizer-trait.h:18
static void Trace(Visitor *visitor, const void *self)
Definition: trace-trait.h:97
#define V8_EXPORT
Definition: v8config.h:793
#define V8_INLINE
Definition: v8config.h:499
#define V8_UNLIKELY(condition)
Definition: v8config.h:649
#define V8_PRESERVE_MOST
Definition: v8config.h:587