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

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

Issue 1203493004: [tracing] Adding class-wise memory statistics to blink gc memory dumps (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Back to life. Created 5 years, 4 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
« no previous file with comments | « no previous file | Source/platform/heap/Heap.h » ('j') | Source/platform/heap/Heap.cpp » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 bool hasFinalizer() const { return m_nonTrivialFinalizer; } 114 bool hasFinalizer() const { return m_nonTrivialFinalizer; }
115 bool hasVTable() const { return m_hasVTable; } 115 bool hasVTable() const { return m_hasVTable; }
116 TraceCallback m_trace; 116 TraceCallback m_trace;
117 FinalizationCallback m_finalize; 117 FinalizationCallback m_finalize;
118 bool m_nonTrivialFinalizer; 118 bool m_nonTrivialFinalizer;
119 bool m_hasVTable; 119 bool m_hasVTable;
120 #if ENABLE(GC_PROFILING)
121 // |m_className| is held as a reference to prevent dtor being called at exit . 120 // |m_className| is held as a reference to prevent dtor being called at exit .
122 const String& m_className; 121 const String& m_className;
123 #endif
124 }; 122 };
125 123
126 #if ENABLE(ASSERT) 124 #if ENABLE(ASSERT)
127 PLATFORM_EXPORT void assertObjectHasGCInfo(const void*, size_t gcInfoIndex); 125 PLATFORM_EXPORT void assertObjectHasGCInfo(const void*, size_t gcInfoIndex);
128 #endif 126 #endif
129 127
130 class GCInfoTable { 128 class GCInfoTable {
131 public: 129 public:
132 PLATFORM_EXPORT static void ensureGCInfoIndex(const GCInfo*, size_t*); 130 PLATFORM_EXPORT static void ensureGCInfoIndex(const GCInfo*, size_t*);
133 131
134 static void init(); 132 static void init();
135 static void shutdown(); 133 static void shutdown();
136 134
135 static size_t gcInfoIndex() { return s_gcInfoIndex; }
136
137 // The (max + 1) GCInfo index supported. 137 // The (max + 1) GCInfo index supported.
138 // We assume that 14 bits is enough to represent all possible types: during 138 // We assume that 14 bits is enough to represent all possible types: during
139 // telemetry runs, we see about 1000 different types, looking at the output 139 // telemetry runs, we see about 1000 different types, looking at the output
140 // of the oilpan gc clang plugin, there appear to be at most about 6000 140 // of the oilpan gc clang plugin, there appear to be at most about 6000
141 // types, so 14 bits should be more than twice as many bits as we will ever 141 // types, so 14 bits should be more than twice as many bits as we will ever
142 // encounter. 142 // encounter.
143 static const size_t maxIndex = 1 << 14; 143 static const size_t maxIndex = 1 << 14;
144 144
145 private: 145 private:
146 static void resize(); 146 static void resize();
(...skipping 16 matching lines...) Expand all
163 template<typename T> 163 template<typename T>
164 struct GCInfoAtBase { 164 struct GCInfoAtBase {
165 static size_t index() 165 static size_t index()
166 { 166 {
167 static_assert(sizeof(T), "T must be fully defined"); 167 static_assert(sizeof(T), "T must be fully defined");
168 static const GCInfo gcInfo = { 168 static const GCInfo gcInfo = {
169 TraceTrait<T>::trace, 169 TraceTrait<T>::trace,
170 FinalizerTrait<T>::finalize, 170 FinalizerTrait<T>::finalize,
171 FinalizerTrait<T>::nonTrivialFinalizer, 171 FinalizerTrait<T>::nonTrivialFinalizer,
172 WTF::IsPolymorphic<T>::value, 172 WTF::IsPolymorphic<T>::value,
173 #if ENABLE(GC_PROFILING)
174 TypenameStringTrait<T>::get() 173 TypenameStringTrait<T>::get()
175 #endif
176 }; 174 };
177 RETURN_GCINFO_INDEX(); 175 RETURN_GCINFO_INDEX();
178 } 176 }
179 }; 177 };
180 178
181 template<typename T, bool = WTF::IsSubclassOfTemplate<typename WTF::RemoveConst< T>::Type, GarbageCollected>::value> struct GetGarbageCollectedBase; 179 template<typename T, bool = WTF::IsSubclassOfTemplate<typename WTF::RemoveConst< T>::Type, GarbageCollected>::value> struct GetGarbageCollectedBase;
182 180
183 template<typename T> 181 template<typename T>
184 struct GetGarbageCollectedBase<T, true> { 182 struct GetGarbageCollectedBase<T, true> {
185 typedef typename T::GarbageCollectedBase type; 183 typedef typename T::GarbageCollectedBase type;
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 template<typename T, size_t inlineCapacity> 217 template<typename T, size_t inlineCapacity>
220 struct GCInfoTrait<HeapVector<T, inlineCapacity>> : public GCInfoTrait<Vector<T, inlineCapacity, HeapAllocator>> { }; 218 struct GCInfoTrait<HeapVector<T, inlineCapacity>> : public GCInfoTrait<Vector<T, inlineCapacity, HeapAllocator>> { };
221 template<typename T, size_t inlineCapacity> 219 template<typename T, size_t inlineCapacity>
222 struct GCInfoTrait<HeapDeque<T, inlineCapacity>> : public GCInfoTrait<Deque<T, i nlineCapacity, HeapAllocator>> { }; 220 struct GCInfoTrait<HeapDeque<T, inlineCapacity>> : public GCInfoTrait<Deque<T, i nlineCapacity, HeapAllocator>> { };
223 template<typename T, typename U, typename V> 221 template<typename T, typename U, typename V>
224 struct GCInfoTrait<HeapHashCountedSet<T, U, V>> : public GCInfoTrait<HashCounted Set<T, U, V, HeapAllocator>> { }; 222 struct GCInfoTrait<HeapHashCountedSet<T, U, V>> : public GCInfoTrait<HashCounted Set<T, U, V, HeapAllocator>> { };
225 223
226 } // namespace blink 224 } // namespace blink
227 225
228 #endif 226 #endif
OLDNEW
« no previous file with comments | « no previous file | Source/platform/heap/Heap.h » ('j') | Source/platform/heap/Heap.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698