Chromium Code Reviews| Index: Source/heap/Visitor.h |
| diff --git a/Source/heap/Visitor.h b/Source/heap/Visitor.h |
| index 25bf88ced6acee0747f8382bcdd16248027d71d2..8d34a1a26989f99ecdf4d357dc578b3e9022f4fd 100644 |
| --- a/Source/heap/Visitor.h |
| +++ b/Source/heap/Visitor.h |
| @@ -152,28 +152,10 @@ template<typename T> struct FinalizerTrait { |
| static void finalize(void* obj) { FinalizerTraitImpl<T, nonTrivialFinalizer>::finalize(obj); } |
| }; |
| -#define DECLARE_GC_INFO \ |
| -public: \ |
| - static const GCInfo s_gcInfo; \ |
| - template<typename Any> friend struct FinalizerTrait; \ |
| -private: \ |
| - |
| -#define DEFINE_GC_INFO(Type) \ |
| -const GCInfo Type::s_gcInfo = { \ |
| - #Type, \ |
| - TraceTrait<Type>::trace, \ |
| - FinalizerTrait<Type>::finalize, \ |
| - FinalizerTrait<Type>::nonTrivialFinalizer, \ |
| - CLASSOF_FUNC(Type) \ |
| -}; \ |
| +#define DECLARE_GC_INFO |
| +#define DEFINE_GC_INFO(Type) |
| -template<typename T> |
| -struct GCInfoTrait { |
| - static const GCInfo* get() |
| - { |
| - return &T::s_gcInfo; |
| - } |
| -}; |
| +template<typename T> struct GCInfoTrait; |
| template<typename T> |
| const char* getTypeMarker() |
| @@ -532,5 +514,30 @@ public: |
| } |
| }; |
| +template<typename T> |
| +struct GCInfoAtBase { |
| + static const GCInfo* get() |
| + { |
| + static char foo = 'a'; // FIXME |
|
haraken
2014/02/19 02:51:40
foo => type (or className)
Add more description.
kouhei (in TOK)
2014/02/19 03:08:20
@Slava
I want your suggestions here. I'm not sure
zerny-chromium
2014/02/19 09:44:48
We only need the type marker on debug builds so we
kouhei (in TOK)
2014/02/19 11:57:27
Thanks for your comment.
Just to clarify, the abo
Vyacheslav Egorov (Chromium)
2014/02/19 15:03:31
CLASSOF_FUNC could delegate to a virtual classOf m
kouhei (in TOK)
2014/02/20 01:07:41
Thanks, Slava!
I'll split work and do the followin
|
| + static const GCInfo gcInfo = { |
| + &foo, |
| + TraceTrait<T>::trace, |
| + FinalizerTrait<T>::finalize, |
| + FinalizerTrait<T>::nonTrivialFinalizer, |
| + CLASSOF_FUNC(T) |
| + }; |
| + return &gcInfo; |
| + } |
| +}; |
| + |
| +template<typename T> |
| +struct GCInfoTrait { |
| + static const GCInfo* get() |
| + { |
| + return GCInfoAtBase<typename T::HeapAllocatedBase>::get(); |
| + } |
| +}; |
| + |
| } |
| + |
| #endif |