Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(10)

Side by Side Diff: Source/platform/heap/GCInfo.h

Issue 1317563005: Fix binary size increase because of class name loading. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: fix build. Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef GCInfo_h 5 #ifndef GCInfo_h
6 #define GCInfo_h 6 #define GCInfo_h
7 7
8 #include "platform/heap/Visitor.h" 8 #include "platform/heap/Visitor.h"
9 #include "wtf/Assertions.h" 9 #include "wtf/Assertions.h"
10 #include "wtf/Atomics.h" 10 #include "wtf/Atomics.h"
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 // indication of whether or not the object needs a finalization 108 // indication of whether or not the object needs a finalization
109 // callback, and a function pointer used to finalize the object when 109 // callback, and a function pointer used to finalize the object when
110 // the garbage collector determines that the object is no longer 110 // the garbage collector determines that the object is no longer
111 // reachable. There is a GCInfo struct for each class that directly 111 // reachable. There is a GCInfo struct for each class that directly
112 // inherits from GarbageCollected or GarbageCollectedFinalized. 112 // inherits from GarbageCollected or GarbageCollectedFinalized.
113 struct GCInfo { 113 struct GCInfo {
114 using GetClassNameCallback = const String (*)(); 114 using GetClassNameCallback = const String (*)();
115 115
116 bool hasFinalizer() const { return m_nonTrivialFinalizer; } 116 bool hasFinalizer() const { return m_nonTrivialFinalizer; }
117 bool hasVTable() const { return m_hasVTable; } 117 bool hasVTable() const { return m_hasVTable; }
118 const String className() const { return m_className(); }
119 TraceCallback m_trace; 118 TraceCallback m_trace;
120 FinalizationCallback m_finalize; 119 FinalizationCallback m_finalize;
121 bool m_nonTrivialFinalizer; 120 bool m_nonTrivialFinalizer;
122 bool m_hasVTable; 121 bool m_hasVTable;
122 #if ENABLE(GC_PROFILING)
123 const String className() const { return m_className(); }
123 GetClassNameCallback m_className; 124 GetClassNameCallback m_className;
125 #endif
124 }; 126 };
125 127
126 #if ENABLE(ASSERT) 128 #if ENABLE(ASSERT)
127 PLATFORM_EXPORT void assertObjectHasGCInfo(const void*, size_t gcInfoIndex); 129 PLATFORM_EXPORT void assertObjectHasGCInfo(const void*, size_t gcInfoIndex);
128 #endif 130 #endif
129 131
130 class GCInfoTable { 132 class GCInfoTable {
131 public: 133 public:
132 PLATFORM_EXPORT static void ensureGCInfoIndex(const GCInfo*, size_t*); 134 PLATFORM_EXPORT static void ensureGCInfoIndex(const GCInfo*, size_t*);
133 135
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 template<typename T> 167 template<typename T>
166 struct GCInfoAtBase { 168 struct GCInfoAtBase {
167 static size_t index() 169 static size_t index()
168 { 170 {
169 static_assert(sizeof(T), "T must be fully defined"); 171 static_assert(sizeof(T), "T must be fully defined");
170 static const GCInfo gcInfo = { 172 static const GCInfo gcInfo = {
171 TraceTrait<T>::trace, 173 TraceTrait<T>::trace,
172 FinalizerTrait<T>::finalize, 174 FinalizerTrait<T>::finalize,
173 FinalizerTrait<T>::nonTrivialFinalizer, 175 FinalizerTrait<T>::nonTrivialFinalizer,
174 WTF::IsPolymorphic<T>::value, 176 WTF::IsPolymorphic<T>::value,
177 #if ENABLE(GC_PROFILING)
175 TypenameStringTrait<T>::get 178 TypenameStringTrait<T>::get
179 #endif
176 }; 180 };
177 RETURN_GCINFO_INDEX(); 181 RETURN_GCINFO_INDEX();
178 } 182 }
179 }; 183 };
180 184
181 template<typename T, bool = WTF::IsSubclassOfTemplate<typename WTF::RemoveConst< T>::Type, GarbageCollected>::value> struct GetGarbageCollectedBase; 185 template<typename T, bool = WTF::IsSubclassOfTemplate<typename WTF::RemoveConst< T>::Type, GarbageCollected>::value> struct GetGarbageCollectedBase;
182 186
183 template<typename T> 187 template<typename T>
184 struct GetGarbageCollectedBase<T, true> { 188 struct GetGarbageCollectedBase<T, true> {
185 typedef typename T::GarbageCollectedBase type; 189 typedef typename T::GarbageCollectedBase type;
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 template<typename T, size_t inlineCapacity> 223 template<typename T, size_t inlineCapacity>
220 struct GCInfoTrait<HeapVector<T, inlineCapacity>> : public GCInfoTrait<Vector<T, inlineCapacity, HeapAllocator>> { }; 224 struct GCInfoTrait<HeapVector<T, inlineCapacity>> : public GCInfoTrait<Vector<T, inlineCapacity, HeapAllocator>> { };
221 template<typename T, size_t inlineCapacity> 225 template<typename T, size_t inlineCapacity>
222 struct GCInfoTrait<HeapDeque<T, inlineCapacity>> : public GCInfoTrait<Deque<T, i nlineCapacity, HeapAllocator>> { }; 226 struct GCInfoTrait<HeapDeque<T, inlineCapacity>> : public GCInfoTrait<Deque<T, i nlineCapacity, HeapAllocator>> { };
223 template<typename T, typename U, typename V> 227 template<typename T, typename U, typename V>
224 struct GCInfoTrait<HeapHashCountedSet<T, U, V>> : public GCInfoTrait<HashCounted Set<T, U, V, HeapAllocator>> { }; 228 struct GCInfoTrait<HeapHashCountedSet<T, U, V>> : public GCInfoTrait<HashCounted Set<T, U, V, HeapAllocator>> { };
225 229
226 } // namespace blink 230 } // namespace blink
227 231
228 #endif 232 #endif
OLDNEW
« no previous file with comments | « no previous file | Source/platform/heap/ThreadState.cpp » ('j') | Source/platform/heap/ThreadState.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698