| 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)
|
|
|