Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 253 | 253 |
| 254 ASSERT(!m_firstUnsweptPage); | 254 ASSERT(!m_firstUnsweptPage); |
| 255 // Add the BaseHeap's pages to the orphanedPagePool. | 255 // Add the BaseHeap's pages to the orphanedPagePool. |
| 256 for (BasePage* page = m_firstPage; page; page = page->next()) { | 256 for (BasePage* page = m_firstPage; page; page = page->next()) { |
| 257 Heap::decreaseAllocatedSpace(page->size()); | 257 Heap::decreaseAllocatedSpace(page->size()); |
| 258 Heap::orphanedPagePool()->addOrphanedPage(heapIndex(), page); | 258 Heap::orphanedPagePool()->addOrphanedPage(heapIndex(), page); |
| 259 } | 259 } |
| 260 m_firstPage = nullptr; | 260 m_firstPage = nullptr; |
| 261 } | 261 } |
| 262 | 262 |
| 263 void BaseHeap::takeSnapshot(const String& dumpBaseName) | 263 void BaseHeap::takeSnapshot(const String& dumpBaseName, ThreadState::GCSnapshotI nfo& info) |
| 264 { | 264 { |
| 265 WebMemoryAllocatorDump* allocatorDump = BlinkGCMemoryDumpProvider::instance( )->createMemoryAllocatorDumpForCurrentGC(dumpBaseName); | 265 WebMemoryAllocatorDump* allocatorDump = BlinkGCMemoryDumpProvider::instance( )->createMemoryAllocatorDumpForCurrentGC(dumpBaseName); |
| 266 size_t pageIndex = 0; | 266 size_t pageIndex = 0; |
| 267 for (BasePage* page = m_firstUnsweptPage; page; page = page->next()) { | 267 for (BasePage* page = m_firstUnsweptPage; page; page = page->next()) { |
| 268 page->takeSnapshot(dumpBaseName, pageIndex); | 268 page->takeSnapshot(dumpBaseName, pageIndex, info); |
| 269 pageIndex++; | 269 pageIndex++; |
| 270 } | 270 } |
| 271 allocatorDump->AddScalar("blink_page_count", "objects", pageIndex); | 271 allocatorDump->AddScalar("blink_page_count", "objects", pageIndex); |
| 272 } | 272 } |
| 273 | 273 |
| 274 #if ENABLE(ASSERT) || ENABLE(GC_PROFILING) | 274 #if ENABLE(ASSERT) || ENABLE(GC_PROFILING) |
| 275 BasePage* BaseHeap::findPageFromAddress(Address address) | 275 BasePage* BaseHeap::findPageFromAddress(Address address) |
| 276 { | 276 { |
| 277 for (BasePage* page = m_firstPage; page; page = page->next()) { | 277 for (BasePage* page = m_firstPage; page; page = page->next()) { |
| 278 if (page->contains(address)) | 278 if (page->contains(address)) |
| (...skipping 1202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1481 // cross thread pointer usage. | 1481 // cross thread pointer usage. |
| 1482 #if defined(ADDRESS_SANITIZER) | 1482 #if defined(ADDRESS_SANITIZER) |
| 1483 // This needs to zap poisoned memory as well. | 1483 // This needs to zap poisoned memory as well. |
| 1484 // Force unpoison memory before memset. | 1484 // Force unpoison memory before memset. |
| 1485 ASAN_UNPOISON_MEMORY_REGION(payload(), payloadSize()); | 1485 ASAN_UNPOISON_MEMORY_REGION(payload(), payloadSize()); |
| 1486 #endif | 1486 #endif |
| 1487 memset(payload(), orphanedZapValue, payloadSize()); | 1487 memset(payload(), orphanedZapValue, payloadSize()); |
| 1488 BasePage::markOrphaned(); | 1488 BasePage::markOrphaned(); |
| 1489 } | 1489 } |
| 1490 | 1490 |
| 1491 void NormalPage::takeSnapshot(String dumpName, size_t pageIndex) | 1491 void NormalPage::takeSnapshot(String dumpName, size_t pageIndex, ThreadState::GC SnapshotInfo& info) |
| 1492 { | 1492 { |
| 1493 dumpName.append(String::format("/pages/page_%lu", static_cast<unsigned long> (pageIndex))); | 1493 dumpName.append(String::format("/pages/page_%lu", static_cast<unsigned long> (pageIndex))); |
| 1494 WebMemoryAllocatorDump* pageDump = BlinkGCMemoryDumpProvider::instance()->cr eateMemoryAllocatorDumpForCurrentGC(dumpName); | 1494 WebMemoryAllocatorDump* pageDump = BlinkGCMemoryDumpProvider::instance()->cr eateMemoryAllocatorDumpForCurrentGC(dumpName); |
| 1495 | 1495 |
| 1496 HeapObjectHeader* header = nullptr; | 1496 HeapObjectHeader* header = nullptr; |
| 1497 size_t liveCount = 0; | 1497 size_t liveCount = 0; |
| 1498 size_t deadCount = 0; | 1498 size_t deadCount = 0; |
| 1499 size_t freeCount = 0; | 1499 size_t freeCount = 0; |
| 1500 size_t liveSize = 0; | 1500 size_t liveSize = 0; |
| 1501 size_t deadSize = 0; | 1501 size_t deadSize = 0; |
| 1502 size_t freeSize = 0; | 1502 size_t freeSize = 0; |
| 1503 for (Address headerAddress = payload(); headerAddress < payloadEnd(); header Address += header->size()) { | 1503 for (Address headerAddress = payload(); headerAddress < payloadEnd(); header Address += header->size()) { |
| 1504 header = reinterpret_cast<HeapObjectHeader*>(headerAddress); | 1504 header = reinterpret_cast<HeapObjectHeader*>(headerAddress); |
| 1505 if (header->isFree()) { | 1505 if (header->isFree()) { |
| 1506 freeCount++; | 1506 freeCount++; |
| 1507 freeSize += header->size(); | 1507 freeSize += header->size(); |
| 1508 } else if (header->isMarked()) { | 1508 } else if (header->isMarked()) { |
| 1509 liveCount++; | 1509 liveCount++; |
| 1510 liveSize += header->size(); | 1510 liveSize += header->size(); |
| 1511 | |
| 1512 size_t tag = info.getClassTag(Heap::gcInfo(header->gcInfoIndex())); | |
| 1513 info.liveCount[tag]++; | |
| 1514 info.liveSize[tag] += header->size(); | |
| 1511 } else { | 1515 } else { |
| 1512 deadCount++; | 1516 deadCount++; |
| 1513 deadSize += header->size(); | 1517 deadSize += header->size(); |
| 1518 | |
| 1519 size_t tag = info.getClassTag(Heap::gcInfo(header->gcInfoIndex())); | |
| 1520 info.deadCount[tag]++; | |
| 1521 info.deadSize[tag] += header->size(); | |
| 1514 } | 1522 } |
| 1515 } | 1523 } |
| 1516 | 1524 |
| 1517 pageDump->AddScalar("live_count", "objects", liveCount); | 1525 pageDump->AddScalar("live_count", "objects", liveCount); |
| 1518 pageDump->AddScalar("dead_count", "objects", deadCount); | 1526 pageDump->AddScalar("dead_count", "objects", deadCount); |
| 1519 pageDump->AddScalar("free_count", "objects", freeCount); | 1527 pageDump->AddScalar("free_count", "objects", freeCount); |
| 1520 pageDump->AddScalar("live_size", "bytes", liveSize); | 1528 pageDump->AddScalar("live_size", "bytes", liveSize); |
| 1521 pageDump->AddScalar("dead_size", "bytes", deadSize); | 1529 pageDump->AddScalar("dead_size", "bytes", deadSize); |
| 1522 pageDump->AddScalar("free_size", "bytes", freeSize); | 1530 pageDump->AddScalar("free_size", "bytes", freeSize); |
| 1523 } | 1531 } |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1690 } | 1698 } |
| 1691 | 1699 |
| 1692 void LargeObjectPage::markOrphaned() | 1700 void LargeObjectPage::markOrphaned() |
| 1693 { | 1701 { |
| 1694 // Zap the payload with a recognizable value to detect any incorrect | 1702 // Zap the payload with a recognizable value to detect any incorrect |
| 1695 // cross thread pointer usage. | 1703 // cross thread pointer usage. |
| 1696 memset(payload(), orphanedZapValue, payloadSize()); | 1704 memset(payload(), orphanedZapValue, payloadSize()); |
| 1697 BasePage::markOrphaned(); | 1705 BasePage::markOrphaned(); |
| 1698 } | 1706 } |
| 1699 | 1707 |
| 1700 void LargeObjectPage::takeSnapshot(String dumpName, size_t pageIndex) | 1708 void LargeObjectPage::takeSnapshot(String dumpName, size_t pageIndex, ThreadStat e::GCSnapshotInfo& info) |
| 1701 { | 1709 { |
| 1702 dumpName.append(String::format("/pages/page_%lu", static_cast<unsigned long> (pageIndex))); | 1710 dumpName.append(String::format("/pages/page_%lu", static_cast<unsigned long> (pageIndex))); |
| 1703 WebMemoryAllocatorDump* pageDump = BlinkGCMemoryDumpProvider::instance()->cr eateMemoryAllocatorDumpForCurrentGC(dumpName); | 1711 WebMemoryAllocatorDump* pageDump = BlinkGCMemoryDumpProvider::instance()->cr eateMemoryAllocatorDumpForCurrentGC(dumpName); |
| 1704 | 1712 |
| 1705 size_t liveSize = 0; | 1713 size_t liveSize = 0; |
| 1706 size_t deadSize = 0; | 1714 size_t deadSize = 0; |
| 1707 size_t liveCount = 0; | 1715 size_t liveCount = 0; |
| 1708 size_t deadCount = 0; | 1716 size_t deadCount = 0; |
| 1709 HeapObjectHeader* header = heapObjectHeader(); | 1717 HeapObjectHeader* header = heapObjectHeader(); |
| 1718 size_t tag = info.getClassTag(Heap::gcInfo(header->gcInfoIndex())); | |
| 1710 if (header->isMarked()) { | 1719 if (header->isMarked()) { |
| 1711 liveCount = 1; | 1720 liveCount = 1; |
| 1712 liveSize += header->size(); | 1721 liveSize += header->size(); |
| 1722 info.liveCount[tag]++; | |
| 1723 info.liveSize[tag] += header->size(); | |
|
haraken
2015/06/26 05:35:28
header->size() => header->payloadSize()
header->s
ssid
2015/06/26 10:10:28
Done.
| |
| 1713 } else { | 1724 } else { |
| 1714 deadCount = 1; | 1725 deadCount = 1; |
| 1715 deadSize += header->size(); | 1726 deadSize += header->size(); |
| 1727 info.deadCount[tag]++; | |
| 1728 info.deadSize[tag] += header->size(); | |
|
haraken
2015/06/26 05:35:28
Ditto.
| |
| 1716 } | 1729 } |
| 1717 | 1730 |
| 1718 pageDump->AddScalar("live_count", "objects", liveCount); | 1731 pageDump->AddScalar("live_count", "objects", liveCount); |
| 1719 pageDump->AddScalar("dead_count", "objects", deadCount); | 1732 pageDump->AddScalar("dead_count", "objects", deadCount); |
| 1720 pageDump->AddScalar("live_size", "bytes", liveSize); | 1733 pageDump->AddScalar("live_size", "bytes", liveSize); |
| 1721 pageDump->AddScalar("dead_size", "bytes", deadSize); | 1734 pageDump->AddScalar("dead_size", "bytes", deadSize); |
| 1722 } | 1735 } |
| 1723 | 1736 |
| 1724 #if ENABLE(GC_PROFILING) | 1737 #if ENABLE(GC_PROFILING) |
| 1725 const GCInfo* LargeObjectPage::findGCInfo(Address address) | 1738 const GCInfo* LargeObjectPage::findGCInfo(Address address) |
| (...skipping 718 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2444 size_t Heap::s_allocatedObjectSize = 0; | 2457 size_t Heap::s_allocatedObjectSize = 0; |
| 2445 size_t Heap::s_allocatedSpace = 0; | 2458 size_t Heap::s_allocatedSpace = 0; |
| 2446 size_t Heap::s_markedObjectSize = 0; | 2459 size_t Heap::s_markedObjectSize = 0; |
| 2447 // We don't want to use 0 KB for the initial value because it may end up | 2460 // We don't want to use 0 KB for the initial value because it may end up |
| 2448 // triggering the first GC of some thread too prematurely. | 2461 // triggering the first GC of some thread too prematurely. |
| 2449 size_t Heap::s_estimatedLiveObjectSize = 512 * 1024; | 2462 size_t Heap::s_estimatedLiveObjectSize = 512 * 1024; |
| 2450 size_t Heap::s_externalObjectSizeAtLastGC = 0; | 2463 size_t Heap::s_externalObjectSizeAtLastGC = 0; |
| 2451 double Heap::s_estimatedMarkingTimePerByte = 0.0; | 2464 double Heap::s_estimatedMarkingTimePerByte = 0.0; |
| 2452 | 2465 |
| 2453 } // namespace blink | 2466 } // namespace blink |
| OLD | NEW |