Index: Source/platform/heap/ThreadState.cpp |
diff --git a/Source/platform/heap/ThreadState.cpp b/Source/platform/heap/ThreadState.cpp |
index b478a51002e467856f2553c6408948ab67046969..b725e1b7aa974a1d5e909ec550bc5b7fbfdc7975 100644 |
--- a/Source/platform/heap/ThreadState.cpp |
+++ b/Source/platform/heap/ThreadState.cpp |
@@ -878,6 +878,9 @@ void ThreadState::postGC(GCType gcType) |
} |
#endif |
+ if (gcType == TakeSnapshot) |
+ takeSnapshot(); |
+ |
for (int i = 0; i < NumberOfHeaps; i++) |
m_heaps[i]->prepareForSweep(); |
@@ -886,7 +889,6 @@ void ThreadState::postGC(GCType gcType) |
} else if (gcType == GCWithoutSweep) { |
setGCState(LazySweepScheduled); |
} else { |
- takeSnapshot(); |
// This unmarks all marked objects and marks all unmarked objects dead. |
makeConsistentForSweeping(gcType); |
// Force setting NoGCScheduled to circumvent checkThread() |
@@ -1280,7 +1282,34 @@ void ThreadState::promptlyFreed(size_t gcInfoIndex) |
void ThreadState::takeSnapshot() |
{ |
ASSERT(isInGC()); |
- // TODO(ssid): Implement this. |
+ |
+#define SNAPSHOT_HEAP(HeapType) \ |
+ { \ |
+ String allocatorBaseName; \ |
+ if (isMainThread()) { \ |
+ allocatorBaseName = String("blink_gc/thread_main/heaps/" #HeapType); \ |
+ } \ |
+ else { \ |
+ allocatorBaseName = String::format("blink_gc/thread_%ld/heaps/" #HeapType, m_thread); \ |
+ } \ |
+ m_heaps[HeapType##HeapIndex]->takeSnapshot(allocatorBaseName); \ |
+ } |
+ |
+ SNAPSHOT_HEAP(NormalPage1); |
+ SNAPSHOT_HEAP(NormalPage2); |
+ SNAPSHOT_HEAP(NormalPage3); |
+ SNAPSHOT_HEAP(NormalPage4); |
+ SNAPSHOT_HEAP(EagerSweep); |
+ SNAPSHOT_HEAP(Vector1); |
+ SNAPSHOT_HEAP(Vector2); |
+ SNAPSHOT_HEAP(Vector3); |
+ SNAPSHOT_HEAP(Vector4); |
+ SNAPSHOT_HEAP(InlineVector); |
+ SNAPSHOT_HEAP(HashTable); |
+ SNAPSHOT_HEAP(LargeObject); |
+ FOR_EACH_TYPED_HEAP(SNAPSHOT_HEAP); |
+ |
+#undef SNAPSHOT_HEAP |
} |
#if ENABLE(GC_PROFILING) |