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

Unified Diff: Source/platform/heap/ThreadState.cpp

Issue 717923005: Profile FreeList Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebased Created 5 years, 11 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
« no previous file with comments | « Source/platform/heap/ThreadState.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/platform/heap/ThreadState.cpp
diff --git a/Source/platform/heap/ThreadState.cpp b/Source/platform/heap/ThreadState.cpp
index a0e71cd8b9e0f8cca790d40180f2b855c3c4bc4c..03001dd971f0aface86e6ced8d71e4368339d7b3 100644
--- a/Source/platform/heap/ThreadState.cpp
+++ b/Source/platform/heap/ThreadState.cpp
@@ -40,7 +40,7 @@
#include "public/platform/Platform.h"
#include "public/platform/WebThread.h"
#include "wtf/ThreadingPrimitives.h"
-#if ENABLE(GC_PROFILE_HEAP)
+#if ENABLE(GC_PROFILE_HEAP) || ENABLE(GC_PROFILE_FREE_LIST)
#include "platform/TracedValue.h"
#endif
@@ -592,6 +592,46 @@ const GCInfo* ThreadState::findGCInfo(Address address)
}
#endif
+#if ENABLE(GC_PROFILE_FREE_LIST)
+
+void ThreadState::snapshotFreeListIfNecessary()
+{
+ //bool gcTracingEnabled;
+ //TRACE_EVENT_CATEGORY_GROUP_ENABLED("blink_gc", &gcTracingEnabled);
+ //if (!gcTracingEnabled)
+ // return;
+ const double kRecordInterval = 0.010; // seconds
+ static double nextRecordTime = monotonicallyIncreasingTime() + kRecordInterval;
+ if (monotonicallyIncreasingTime() > nextRecordTime) {
+ snapshotFreeList();
+ nextRecordTime = monotonicallyIncreasingTime() + kRecordInterval;
+ }
+}
+
+void ThreadState::snapshotFreeList()
+{
+ RefPtr<TracedValue> json = TracedValue::create();
+
+#define SNAPSHOT_FREE_LIST(HeapType) \
+ { \
+ json->beginDictionary(); \
+ json->setString("name", #HeapType); \
+ m_heaps[HeapType##Heap]->snapshotFreeList(json.get()); \
+ json->endDictionary(); \
+ }
+ json->beginArray("heaps");
+ SNAPSHOT_FREE_LIST(General);
+ SNAPSHOT_FREE_LIST(VectorBacking);
+ SNAPSHOT_FREE_LIST(HashTableBacking);
+ FOR_EACH_TYPED_HEAP(SNAPSHOT_FREE_LIST);
+ json->endArray();
+#undef SNAPSHOT_FREE_LIST
+
+ TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID("blink_gc", "FreeList", this, json.release());
+}
+
+#endif
+
#if ENABLE(GC_PROFILE_HEAP)
size_t ThreadState::SnapshotInfo::getClassTag(const GCInfo* gcinfo)
{
@@ -914,7 +954,7 @@ void ThreadState::prepareHeapForTermination()
m_heaps[i]->prepareHeapForTermination();
}
-#if ENABLE(ASSERT)
+#if ENABLE(ASSERT) || ENABLE(GC_PROFILE_MARKING)
BaseHeapPage* ThreadState::findPageFromAddress(Address address)
{
for (int i = 0; i < NumberOfHeaps; ++i) {
@@ -1040,6 +1080,8 @@ void ThreadState::postGCProcessing()
if (gcState() != EagerSweepScheduled && gcState() != LazySweepScheduled)
return;
+ Heap::reportSweepingStats();
+
m_didV8GCAfterLastGC = false;
#if ENABLE(GC_PROFILE_HEAP)
@@ -1090,6 +1132,10 @@ void ThreadState::postGCProcessing()
setGCState(Sweeping);
completeSweep();
#endif
+
+#if ENABLE(GC_PROFILE_FREE_LIST)
+ snapshotFreeListIfNecessary();
+#endif
}
void ThreadState::addInterruptor(Interruptor* interruptor)
« no previous file with comments | « Source/platform/heap/ThreadState.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698