| Index: Source/platform/heap/Heap.cpp
|
| diff --git a/Source/platform/heap/Heap.cpp b/Source/platform/heap/Heap.cpp
|
| index 725a025011133b6bcee970fbcf12516d28b73430..d6c57cb4422785de3554b671e96c0070ef35d551 100644
|
| --- a/Source/platform/heap/Heap.cpp
|
| +++ b/Source/platform/heap/Heap.cpp
|
| @@ -261,12 +261,13 @@ void BaseHeap::cleanupPages()
|
|
|
| void BaseHeap::takeSnapshot(const String& dumpBaseName)
|
| {
|
| - size_t pageCount = 0;
|
| + WebMemoryAllocatorDump* allocatorDump = BlinkGCMemoryDumpProvider::instance()->createMemoryAllocatorDumpForCurrentGC(dumpBaseName);
|
| + size_t pageIndex = 0;
|
| for (BasePage* page = m_firstUnsweptPage; page; page = page->next()) {
|
| - pageCount++;
|
| + page->takeSnapshot(dumpBaseName, pageIndex);
|
| + pageIndex++;
|
| }
|
| - WebMemoryAllocatorDump* allocatorDump = BlinkGCMemoryDumpProvider::instance()->createMemoryAllocatorDumpForCurrentGC(dumpBaseName);
|
| - allocatorDump->AddScalar("blink_page_count", "objects", pageCount);
|
| + allocatorDump->AddScalar("blink_page_count", "objects", pageIndex);
|
| }
|
|
|
| #if ENABLE(ASSERT) || ENABLE(GC_PROFILING)
|
| @@ -1450,6 +1451,40 @@ void NormalPage::markOrphaned()
|
| BasePage::markOrphaned();
|
| }
|
|
|
| +void NormalPage::takeSnapshot(String dumpName, size_t pageIndex)
|
| +{
|
| + dumpName.append(String::format("/page_%lu", static_cast<unsigned long>(pageIndex)));
|
| + WebMemoryAllocatorDump* pageDump = BlinkGCMemoryDumpProvider::instance()->createMemoryAllocatorDumpForCurrentGC(dumpName);
|
| +
|
| + HeapObjectHeader* header = nullptr;
|
| + size_t liveCount = 0;
|
| + size_t deadCount = 0;
|
| + size_t freeCount = 0;
|
| + size_t liveSize = 0;
|
| + size_t deadSize = 0;
|
| + size_t freeSize = 0;
|
| + for (Address headerAddress = payload(); headerAddress < payloadEnd(); headerAddress += header->size()) {
|
| + header = reinterpret_cast<HeapObjectHeader*>(headerAddress);
|
| + if (header->isFree()) {
|
| + freeCount++;
|
| + freeSize += header->size();
|
| + } else if (header->isMarked()) {
|
| + liveCount++;
|
| + liveSize += header->size();
|
| + } else {
|
| + deadCount++;
|
| + deadSize += header->size();
|
| + }
|
| + }
|
| +
|
| + pageDump->AddScalar("live_count", "objects", liveCount);
|
| + pageDump->AddScalar("dead_count", "objects", deadCount);
|
| + pageDump->AddScalar("free_count", "objects", freeCount);
|
| + pageDump->AddScalar("live_size", "bytes", liveSize);
|
| + pageDump->AddScalar("dead_size", "bytes", deadSize);
|
| + pageDump->AddScalar("free_size", "bytes", freeSize);
|
| +}
|
| +
|
| #if ENABLE(GC_PROFILING)
|
| const GCInfo* NormalPage::findGCInfo(Address address)
|
| {
|
| @@ -1625,6 +1660,30 @@ void LargeObjectPage::markOrphaned()
|
| BasePage::markOrphaned();
|
| }
|
|
|
| +void LargeObjectPage::takeSnapshot(String dumpName, size_t pageIndex)
|
| +{
|
| + dumpName.append(String::format("/page_%lu", static_cast<unsigned long>(pageIndex)));
|
| + WebMemoryAllocatorDump* pageDump = BlinkGCMemoryDumpProvider::instance()->createMemoryAllocatorDumpForCurrentGC(dumpName);
|
| +
|
| + size_t liveSize = 0;
|
| + size_t deadSize = 0;
|
| + size_t liveCount = 0;
|
| + size_t deadCount = 0;
|
| + HeapObjectHeader* header = heapObjectHeader();
|
| + if (header->isMarked()) {
|
| + liveCount = 1;
|
| + liveSize += header->size();
|
| + } else {
|
| + deadCount = 1;
|
| + deadSize += header->size();
|
| + }
|
| +
|
| + pageDump->AddScalar("live_count", "objects", liveCount);
|
| + pageDump->AddScalar("dead_count", "objects", deadCount);
|
| + pageDump->AddScalar("live_size", "bytes", liveSize);
|
| + pageDump->AddScalar("dead_size", "bytes", deadSize);
|
| +}
|
| +
|
| #if ENABLE(GC_PROFILING)
|
| const GCInfo* LargeObjectPage::findGCInfo(Address address)
|
| {
|
|
|