5#ifndef INCLUDE_CPPGC_INTERNAL_GC_INFO_H_
6#define INCLUDE_CPPGC_INTERNAL_GC_INFO_H_
27 std::atomic<GCInfoIndex>& registered_index) {
28 return EnsureGCInfoIndexTraitDispatch<T>{}(registered_index);
32 template <typename T, bool = std::is_polymorphic<T>::value,
35 struct EnsureGCInfoIndexTraitDispatch;
63#define DISPATCH(is_polymorphic, has_finalizer, has_non_hidden_name, function) \
64 template <typename T> \
65 struct EnsureGCInfoIndexTrait::EnsureGCInfoIndexTraitDispatch< \
66 T, is_polymorphic, has_finalizer, has_non_hidden_name> { \
67 V8_INLINE GCInfoIndex \
68 operator()(std::atomic<GCInfoIndex>& registered_index) { \
114template <
typename T,
typename ParentMostGarbageCollectedType>
117 std::has_virtual_destructor<ParentMostGarbageCollectedType>::value;
119 std::is_trivially_destructible<ParentMostGarbageCollectedType>::value &&
120 std::is_trivially_destructible<T>::value;
123 ParentMostGarbageCollectedType>::value;
124#ifdef CPPGC_SUPPORTS_OBJECT_NAMES
136 ParentMostGarbageCollectedType, T>;
144 static_assert(
sizeof(T),
"T must be fully defined");
145 static std::atomic<GCInfoIndex>
147 const GCInfoIndex index = registered_index.load(std::memory_order_acquire);
149 : EnsureGCInfoIndexTrait::EnsureIndex<T>(registered_index);
#define DISPATCH(is_polymorphic, has_finalizer, has_non_hidden_name, function)
void(*)(void *) FinalizationCallback
HeapObjectName(*)(const void *) NameCallback
EnsureGCInfoIndexNonPolymorphic(registered_index, TraceTrait< T >::Trace, FinalizerTrait< T >::kCallback, NameTrait< T >::GetName)) DISPATCH(false
EnsureGCInfoIndexPolymorphic(registered_index, TraceTrait< T >::Trace, FinalizerTrait< T >::kCallback)) DISPATCH(true
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 kWantsDetailedObjectNames
std::conditional_t<(kHasVirtualDestructorAtBase||kBothTypesAreTriviallyDestructible||kHasCustomFinalizerDispatchAtBase) &&!kWantsDetailedObjectNames, ParentMostGarbageCollectedType, T > ResultType
static constexpr bool kBothTypesAreTriviallyDestructible
static V8_INLINE GCInfoIndex Index()