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

Unified Diff: Source/platform/heap/Heap.h

Issue 383743002: Oilpan: GC profiling. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rebase Created 6 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: Source/platform/heap/Heap.h
diff --git a/Source/platform/heap/Heap.h b/Source/platform/heap/Heap.h
index 81bf4ad0cf68eb27e6c72f982c2e110a0707790b..4abf462daf627d43c4879899de20a37dd137d0ca 100644
--- a/Source/platform/heap/Heap.h
+++ b/Source/platform/heap/Heap.h
@@ -70,7 +70,14 @@ const size_t maxHeapObjectSize = 1 << 27;
const size_t markBitMask = 1;
const size_t freeListMask = 2;
const size_t debugBitMask = 4;
+#if GC_PROFILE_HEAP
+const size_t heapObjectGenerations = 8;
+const size_t maxHeapObjectAge = heapObjectGenerations - 1;
+const size_t heapObjectAgeMask = ~(maxHeapObjectSize - 1);
+const size_t sizeMask = ~heapObjectAgeMask & ~7;
+#else
const size_t sizeMask = ~7;
+#endif
const uint8_t freelistZapValue = 42;
const uint8_t finalizedZapValue = 24;
@@ -80,6 +87,11 @@ template<ThreadAffinity affinity> class ThreadLocalPersistents;
template<typename T, typename RootsAccessor = ThreadLocalPersistents<ThreadingTrait<T>::Affinity > > class Persistent;
template<typename T> class CrossThreadPersistent;
+#if GC_PROFILE_HEAP
+class TracedArrayBase;
+class TracedDictionaryBase;
+#endif
+
PLATFORM_EXPORT size_t osPageSize();
// Blink heap pages are set up with a guard page before and after the
@@ -158,7 +170,7 @@ public:
// the stack.
virtual void checkAndMarkPointer(Visitor*, Address) = 0;
-#if ENABLE(GC_TRACING)
+#if GC_PROFILE_MARKING
virtual const GCInfo* findGCInfo(Address) = 0;
#endif
@@ -202,7 +214,7 @@ public:
virtual void checkAndMarkPointer(Visitor*, Address) OVERRIDE;
virtual bool isLargeObject() OVERRIDE { return true; }
-#if ENABLE(GC_TRACING)
+#if GC_PROFILE_MARKING
virtual const GCInfo* findGCInfo(Address address)
{
if (!objectContains(address))
@@ -211,6 +223,10 @@ public:
}
#endif
+#if GC_PROFILE_HEAP
+ void snapshot(TracedDictionaryBase*, ThreadState::SnapshotInfo*);
+#endif
+
void link(LargeHeapObject<Header>** previousNext)
{
m_next = *previousNext;
@@ -285,6 +301,20 @@ public:
NO_SANITIZE_ADDRESS
size_t size() const { return m_size & sizeMask; }
+#if GC_PROFILE_HEAP
+ NO_SANITIZE_ADDRESS
+ size_t encodedSize() const { return m_size; }
+
+ NO_SANITIZE_ADDRESS size_t age() const { return m_size >> 27; }
Mads Ager (chromium) 2014/07/11 11:26:54 Let's consistently add NO_SANITIZE_ADDRESS on a li
zerny-chromium 2014/07/11 11:56:37 Acknowledged.
+
+ NO_SANITIZE_ADDRESS void incAge()
+ {
+ size_t current = age();
+ if (current < 7)
+ m_size = ((current + 1) << 27) | (m_size & ~heapObjectAgeMask);
+ }
+#endif
+
protected:
size_t m_size;
};
@@ -495,9 +525,12 @@ public:
void clearObjectStartBitMap();
void finalize(Header*);
virtual void checkAndMarkPointer(Visitor*, Address) OVERRIDE;
-#if ENABLE(GC_TRACING)
+#if GC_PROFILE_MARKING
const GCInfo* findGCInfo(Address) OVERRIDE;
#endif
+#if GC_PROFILE_HEAP
+ virtual void snapshot(TracedArrayBase*, ThreadState::SnapshotInfo*);
+#endif
ThreadHeap<Header>* heap() { return m_heap; }
#if defined(ADDRESS_SANITIZER)
void poisonUnmarkedObjects();
@@ -761,10 +794,14 @@ public:
// page in this thread heap.
virtual BaseHeapPage* heapPageFromAddress(Address) = 0;
-#if ENABLE(GC_TRACING)
+#if GC_PROFILE_MARKING
virtual const GCInfo* findGCInfoOfLargeHeapObject(Address) = 0;
#endif
+#if GC_PROFILE_HEAP
+ virtual void snapshot(TracedDictionaryBase*, ThreadState::SnapshotInfo*) = 0;
+#endif
+
// Sweep this part of the Blink heap. This finalizes dead objects
// and builds freelists for all the unused memory.
virtual void sweep() = 0;
@@ -807,9 +844,12 @@ public:
virtual ~ThreadHeap();
virtual BaseHeapPage* heapPageFromAddress(Address);
-#if ENABLE(GC_TRACING)
+#if GC_PROFILE_MARKING
virtual const GCInfo* findGCInfoOfLargeHeapObject(Address);
#endif
+#if GC_PROFILE_HEAP
+ virtual void snapshot(TracedDictionaryBase*, ThreadState::SnapshotInfo*);
+#endif
virtual void sweep();
virtual void assertEmpty();
virtual void clearFreeLists();
@@ -959,7 +999,7 @@ public:
// heaps. If so marks the object pointed to as live.
static Address checkAndMarkPointer(Visitor*, Address);
-#if ENABLE(GC_TRACING)
+#if GC_PROFILE_MARKING
// Dump the path to specified object on the next GC. This method is to be invoked from GDB.
static void dumpPathToObjectOnNextGC(void* p);
@@ -1800,7 +1840,7 @@ struct GCInfoTrait<HashMap<Key, Value, T, U, V, HeapAllocator> > {
0,
false, // HashMap needs no finalizer.
WTF::IsPolymorphic<TargetType>::value,
-#if ENABLE(GC_TRACING)
+#if GC_PROFILE_DEFINE_CLASSNAME
TypenameStringTrait<TargetType>::get()
#endif
};
@@ -1818,7 +1858,7 @@ struct GCInfoTrait<HashSet<T, U, V, HeapAllocator> > {
0,
false, // HashSet needs no finalizer.
WTF::IsPolymorphic<TargetType>::value,
-#if ENABLE(GC_TRACING)
+#if GC_PROFILE_DEFINE_CLASSNAME
TypenameStringTrait<TargetType>::get()
#endif
};
@@ -1836,7 +1876,7 @@ struct GCInfoTrait<LinkedHashSet<T, U, V, HeapAllocator> > {
LinkedHashSet<T, U, V, HeapAllocator>::finalize,
true, // Needs finalization. The anchor needs to unlink itself from the chain.
WTF::IsPolymorphic<TargetType>::value,
-#if ENABLE(GC_TRACING)
+#if GC_PROFILE_DEFINE_CLASSNAME
TypenameStringTrait<TargetType>::get()
#endif
};
@@ -1854,7 +1894,7 @@ struct GCInfoTrait<ListHashSet<ValueArg, inlineCapacity, U, HeapListHashSetAlloc
0,
false, // ListHashSet needs no finalization though its backing might.
false, // no vtable.
-#if ENABLE(GC_TRACING)
+#if GC_PROFILE_DEFINE_CLASSNAME
TypenameStringTrait<TargetType>::get()
#endif
};
@@ -1872,7 +1912,7 @@ struct GCInfoTrait<WTF::ListHashSetNode<T, Allocator> > {
TargetType::finalize,
WTF::HashTraits<T>::needsDestruction, // The node needs destruction if its data does.
false, // no vtable.
-#if ENABLE(GC_TRACING)
+#if GC_PROFILE_DEFINE_CLASSNAME
TypenameStringTrait<TargetType>::get()
#endif
};
@@ -1884,7 +1924,7 @@ template<typename T>
struct GCInfoTrait<Vector<T, 0, HeapAllocator> > {
static const GCInfo* get()
{
-#if ENABLE(GC_TRACING)
+#if GC_PROFILE_DEFINE_CLASSNAME
typedef Vector<T, 0, HeapAllocator> TargetType;
#endif
static const GCInfo info = {
@@ -1892,7 +1932,7 @@ struct GCInfoTrait<Vector<T, 0, HeapAllocator> > {
0,
false, // Vector needs no finalizer if it has no inline capacity.
WTF::IsPolymorphic<Vector<T, 0, HeapAllocator> >::value,
-#if ENABLE(GC_TRACING)
+#if GC_PROFILE_DEFINE_CLASSNAME
TypenameStringTrait<TargetType>::get()
#endif
};
@@ -1914,7 +1954,7 @@ struct GCInfoTrait<Vector<T, inlineCapacity, HeapAllocator> > {
// Finalizer is needed to destruct things stored in the inline capacity.
inlineCapacity && VectorTraits<T>::needsDestruction,
WTF::IsPolymorphic<TargetType>::value,
-#if ENABLE(GC_TRACING)
+#if GC_PROFILE_DEFINE_CLASSNAME
TypenameStringTrait<TargetType>::get()
#endif
};
@@ -1932,7 +1972,7 @@ struct GCInfoTrait<Deque<T, 0, HeapAllocator> > {
0,
false, // Deque needs no finalizer if it has no inline capacity.
WTF::IsPolymorphic<TargetType>::value,
-#if ENABLE(GC_TRACING)
+#if GC_PROFILE_DEFINE_CLASSNAME
TypenameStringTrait<TargetType>::get()
#endif
};
@@ -1951,7 +1991,7 @@ struct GCInfoTrait<HashCountedSet<T, U, V, HeapAllocator> > {
0,
false, // HashCountedSet is just a HashTable, and needs no finalizer.
WTF::IsPolymorphic<TargetType>::value,
-#if ENABLE(GC_TRACING)
+#if GC_PROFILE_DEFINE_CLASSNAME
TypenameStringTrait<TargetType>::get()
#endif
};
@@ -1974,7 +2014,7 @@ struct GCInfoTrait<Deque<T, inlineCapacity, HeapAllocator> > {
// Finalizer is needed to destruct things stored in the inline capacity.
inlineCapacity && VectorTraits<T>::needsDestruction,
WTF::IsPolymorphic<TargetType>::value,
-#if ENABLE(GC_TRACING)
+#if GC_PROFILE_DEFINE_CLASSNAME
TypenameStringTrait<TargetType>::get()
#endif
};
@@ -1993,7 +2033,7 @@ struct GCInfoTrait<HeapVectorBacking<T, Traits> > {
FinalizerTrait<TargetType>::finalize,
Traits::needsDestruction,
false, // We don't support embedded objects in HeapVectors with vtables.
-#if ENABLE(GC_TRACING)
+#if GC_PROFILE_DEFINE_CLASSNAME
TypenameStringTrait<TargetType>::get()
#endif
};
@@ -2011,7 +2051,7 @@ struct GCInfoTrait<HeapHashTableBacking<Table> > {
HeapHashTableBacking<Table>::finalize,
Table::ValueTraits::needsDestruction,
WTF::IsPolymorphic<TargetType>::value,
-#if ENABLE(GC_TRACING)
+#if GC_PROFILE_DEFINE_CLASSNAME
TypenameStringTrait<TargetType>::get()
#endif
};

Powered by Google App Engine
This is Rietveld 408576698