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) { \
83struct GCInfoTrait final {
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));
97 static constexpr bool CheckCallbacksAreDefined() {
109template <
typename T,
typename ParentMostGarbageCollectedType>
112 std::has_virtual_destructor<ParentMostGarbageCollectedType>::value;
114 std::is_trivially_destructible<ParentMostGarbageCollectedType>::value &&
115 std::is_trivially_destructible<T>::value;
118 ParentMostGarbageCollectedType>::value;
119#ifdef CPPGC_SUPPORTS_OBJECT_NAMES
131 GCInfoTrait<T>::CheckCallbacksAreDefined() &&
132 GCInfoTrait<ParentMostGarbageCollectedType>::CheckCallbacksAreDefined();
142 ParentMostGarbageCollectedType, T>;
#define DISPATCH(has_finalizer, has_non_hidden_name, function)
#define CPPGC_DCHECK(condition)
void(*)(void *) FinalizationCallback
EnsureGCInfoIndex(registered_index, TraceTrait< T >::Trace, FinalizerTrait< T >::kCallback)) DISPATCH(false
HeapObjectName(*)(const void *, HeapObjectNameForUnnamedObject) NameCallback
void(*)(Visitor *visitor, const void *object) TraceCallback
static V8_INLINE GCInfoIndex EnsureIndex(std::atomic< GCInfoIndex > ®istered_index)
static constexpr bool kHasCustomFinalizerDispatchAtBase
static constexpr bool kHasVirtualDestructorAtBase
static constexpr bool kCheckTypeGuardAlwaysTrue
static constexpr bool kWantsDetailedObjectNames
static constexpr bool kBothTypesAreTriviallyDestructible
std::conditional_t< kCheckTypeGuardAlwaysTrue &&(kHasVirtualDestructorAtBase||kBothTypesAreTriviallyDestructible||kHasCustomFinalizerDispatchAtBase) &&!kWantsDetailedObjectNames, ParentMostGarbageCollectedType, T > ResultType
#define V8_UNLIKELY(condition)