| Index: Source/platform/heap/ThreadState.cpp
|
| diff --git a/Source/platform/heap/ThreadState.cpp b/Source/platform/heap/ThreadState.cpp
|
| index b80ebe2bf1c57f3f1b154ff384102d41e3902682..65d921c77eff8aa456f8988e9dd45ddcca754592 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
|
|
|
| @@ -607,6 +607,53 @@ 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->beginDictionary(); \
|
| + json->setString("name", #HeapType"NonFinalized"); \
|
| + m_heaps[HeapType##HeapNonFinalized]->snapshotFreeList(json.get()); \
|
| + json->endDictionary(); \
|
| + }
|
| + json->beginArray("heaps");
|
| + SNAPSHOT_FREE_LIST(General1);
|
| + SNAPSHOT_FREE_LIST(General2);
|
| + SNAPSHOT_FREE_LIST(General3);
|
| + SNAPSHOT_FREE_LIST(General4);
|
| + 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)
|
| {
|
| @@ -999,6 +1046,9 @@ void ThreadState::performPendingSweep()
|
| checkThread();
|
| if (gcState() != SweepScheduled)
|
| return;
|
| +
|
| + Heap::reportSweepingStats();
|
| +
|
| setGCState(Sweeping);
|
|
|
| #if ENABLE(GC_PROFILE_HEAP)
|
| @@ -1078,6 +1128,9 @@ void ThreadState::performPendingSweep()
|
| TRACE_EVENT_SET_NONCONST_SAMPLING_STATE(samplingState);
|
| ScriptForbiddenScope::exit();
|
| }
|
| +#if ENABLE(GC_PROFILE_FREE_LIST)
|
| + snapshotFreeListIfNecessary();
|
| +#endif
|
| }
|
|
|
| void ThreadState::addInterruptor(Interruptor* interruptor)
|
|
|