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 544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 555 bool NormalPageHeap::pagesToBeSweptContains(Address address) | 555 bool NormalPageHeap::pagesToBeSweptContains(Address address) |
| 556 { | 556 { |
| 557 for (BasePage* page = m_firstUnsweptPage; page; page = page->next()) { | 557 for (BasePage* page = m_firstUnsweptPage; page; page = page->next()) { |
| 558 if (page->contains(address)) | 558 if (page->contains(address)) |
| 559 return true; | 559 return true; |
| 560 } | 560 } |
| 561 return false; | 561 return false; |
| 562 } | 562 } |
| 563 #endif | 563 #endif |
| 564 | 564 |
| 565 void NormalPageHeap::takeFreelistSnapshot(const String& dumpName) | |
| 566 { | |
| 567 m_freeList.takeSnapshot(dumpName); | |
| 568 } | |
| 569 | |
| 565 #if ENABLE(GC_PROFILING) | 570 #if ENABLE(GC_PROFILING) |
| 566 void NormalPageHeap::snapshotFreeList(TracedValue& json) | 571 void NormalPageHeap::snapshotFreeList(TracedValue& json) |
| 567 { | 572 { |
| 568 json.setInteger("cumulativeAllocationSize", m_cumulativeAllocationSize); | 573 json.setInteger("cumulativeAllocationSize", m_cumulativeAllocationSize); |
| 569 json.setDouble("inlineAllocationRate", static_cast<double>(m_inlineAllocatio nCount) / m_allocationCount); | 574 json.setDouble("inlineAllocationRate", static_cast<double>(m_inlineAllocatio nCount) / m_allocationCount); |
| 570 json.setInteger("inlineAllocationCount", m_inlineAllocationCount); | 575 json.setInteger("inlineAllocationCount", m_inlineAllocationCount); |
| 571 json.setInteger("allocationCount", m_allocationCount); | 576 json.setInteger("allocationCount", m_allocationCount); |
| 572 size_t pageCount = 0; | 577 size_t pageCount = 0; |
| 573 size_t totalPageSize = 0; | 578 size_t totalPageSize = 0; |
| 574 for (NormalPage* page = static_cast<NormalPage*>(m_firstPage); page; page = static_cast<NormalPage*>(page->next())) { | 579 for (NormalPage* page = static_cast<NormalPage*>(m_firstPage); page; page = static_cast<NormalPage*>(page->next())) { |
| (...skipping 538 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1113 { | 1118 { |
| 1114 ASSERT(size > 0); | 1119 ASSERT(size > 0); |
| 1115 int index = -1; | 1120 int index = -1; |
| 1116 while (size) { | 1121 while (size) { |
| 1117 size >>= 1; | 1122 size >>= 1; |
| 1118 index++; | 1123 index++; |
| 1119 } | 1124 } |
| 1120 return index; | 1125 return index; |
| 1121 } | 1126 } |
| 1122 | 1127 |
| 1128 void FreeList::takeSnapshot(const String& dumpBaseName) | |
| 1129 { | |
| 1130 for (size_t i = 0; i < blinkPageSizeLog2; ++i) { | |
| 1131 size_t entryCount = 0; | |
| 1132 size_t freeSize = 0; | |
| 1133 for (FreeListEntry* entry = m_freeLists[i]; entry; entry = entry->next() ) { | |
| 1134 ++entryCount; | |
| 1135 freeSize += entry->size(); | |
| 1136 } | |
| 1137 | |
| 1138 String dumpName = dumpBaseName + String::format("/buckets/bucket_%lu", s tatic_cast<unsigned long>(1 << i)); | |
|
haraken
2015/06/23 08:14:49
I'm just curious, but where is the String::operato
| |
| 1139 WebMemoryAllocatorDump* bucketDump = BlinkGCMemoryDumpProvider::instance ()->createMemoryAllocatorDumpForCurrentGC(dumpName); | |
| 1140 bucketDump->AddScalar("freelist_entry_count", "objects", entryCount); | |
| 1141 bucketDump->AddScalar("free_size", "bytes", freeSize); | |
| 1142 } | |
| 1143 } | |
| 1144 | |
| 1123 #if ENABLE(GC_PROFILING) | 1145 #if ENABLE(GC_PROFILING) |
| 1124 void FreeList::getFreeSizeStats(PerBucketFreeListStats bucketStats[], size_t& to talFreeSize) const | 1146 void FreeList::getFreeSizeStats(PerBucketFreeListStats bucketStats[], size_t& to talFreeSize) const |
| 1125 { | 1147 { |
| 1126 totalFreeSize = 0; | 1148 totalFreeSize = 0; |
| 1127 for (size_t i = 0; i < blinkPageSizeLog2; i++) { | 1149 for (size_t i = 0; i < blinkPageSizeLog2; i++) { |
| 1128 size_t& entryCount = bucketStats[i].entryCount; | 1150 size_t& entryCount = bucketStats[i].entryCount; |
| 1129 size_t& freeSize = bucketStats[i].freeSize; | 1151 size_t& freeSize = bucketStats[i].freeSize; |
| 1130 for (FreeListEntry* entry = m_freeLists[i]; entry; entry = entry->next() ) { | 1152 for (FreeListEntry* entry = m_freeLists[i]; entry; entry = entry->next() ) { |
| 1131 ++entryCount; | 1153 ++entryCount; |
| 1132 freeSize += entry->size(); | 1154 freeSize += entry->size(); |
| (...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1446 // This needs to zap poisoned memory as well. | 1468 // This needs to zap poisoned memory as well. |
| 1447 // Force unpoison memory before memset. | 1469 // Force unpoison memory before memset. |
| 1448 ASAN_UNPOISON_MEMORY_REGION(payload(), payloadSize()); | 1470 ASAN_UNPOISON_MEMORY_REGION(payload(), payloadSize()); |
| 1449 #endif | 1471 #endif |
| 1450 memset(payload(), orphanedZapValue, payloadSize()); | 1472 memset(payload(), orphanedZapValue, payloadSize()); |
| 1451 BasePage::markOrphaned(); | 1473 BasePage::markOrphaned(); |
| 1452 } | 1474 } |
| 1453 | 1475 |
| 1454 void NormalPage::takeSnapshot(String dumpName, size_t pageIndex) | 1476 void NormalPage::takeSnapshot(String dumpName, size_t pageIndex) |
| 1455 { | 1477 { |
| 1456 dumpName.append(String::format("/page_%lu", static_cast<unsigned long>(pageI ndex))); | 1478 dumpName.append(String::format("/pages/page_%lu", static_cast<unsigned long> (pageIndex))); |
| 1457 WebMemoryAllocatorDump* pageDump = BlinkGCMemoryDumpProvider::instance()->cr eateMemoryAllocatorDumpForCurrentGC(dumpName); | 1479 WebMemoryAllocatorDump* pageDump = BlinkGCMemoryDumpProvider::instance()->cr eateMemoryAllocatorDumpForCurrentGC(dumpName); |
| 1458 | 1480 |
| 1459 HeapObjectHeader* header = nullptr; | 1481 HeapObjectHeader* header = nullptr; |
| 1460 size_t liveCount = 0; | 1482 size_t liveCount = 0; |
| 1461 size_t deadCount = 0; | 1483 size_t deadCount = 0; |
| 1462 size_t freeCount = 0; | 1484 size_t freeCount = 0; |
| 1463 size_t liveSize = 0; | 1485 size_t liveSize = 0; |
| 1464 size_t deadSize = 0; | 1486 size_t deadSize = 0; |
| 1465 size_t freeSize = 0; | 1487 size_t freeSize = 0; |
| 1466 for (Address headerAddress = payload(); headerAddress < payloadEnd(); header Address += header->size()) { | 1488 for (Address headerAddress = payload(); headerAddress < payloadEnd(); header Address += header->size()) { |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1655 void LargeObjectPage::markOrphaned() | 1677 void LargeObjectPage::markOrphaned() |
| 1656 { | 1678 { |
| 1657 // Zap the payload with a recognizable value to detect any incorrect | 1679 // Zap the payload with a recognizable value to detect any incorrect |
| 1658 // cross thread pointer usage. | 1680 // cross thread pointer usage. |
| 1659 memset(payload(), orphanedZapValue, payloadSize()); | 1681 memset(payload(), orphanedZapValue, payloadSize()); |
| 1660 BasePage::markOrphaned(); | 1682 BasePage::markOrphaned(); |
| 1661 } | 1683 } |
| 1662 | 1684 |
| 1663 void LargeObjectPage::takeSnapshot(String dumpName, size_t pageIndex) | 1685 void LargeObjectPage::takeSnapshot(String dumpName, size_t pageIndex) |
| 1664 { | 1686 { |
| 1665 dumpName.append(String::format("/page_%lu", static_cast<unsigned long>(pageI ndex))); | 1687 dumpName.append(String::format("/pages/page_%lu", static_cast<unsigned long> (pageIndex))); |
| 1666 WebMemoryAllocatorDump* pageDump = BlinkGCMemoryDumpProvider::instance()->cr eateMemoryAllocatorDumpForCurrentGC(dumpName); | 1688 WebMemoryAllocatorDump* pageDump = BlinkGCMemoryDumpProvider::instance()->cr eateMemoryAllocatorDumpForCurrentGC(dumpName); |
| 1667 | 1689 |
| 1668 size_t liveSize = 0; | 1690 size_t liveSize = 0; |
| 1669 size_t deadSize = 0; | 1691 size_t deadSize = 0; |
| 1670 size_t liveCount = 0; | 1692 size_t liveCount = 0; |
| 1671 size_t deadCount = 0; | 1693 size_t deadCount = 0; |
| 1672 HeapObjectHeader* header = heapObjectHeader(); | 1694 HeapObjectHeader* header = heapObjectHeader(); |
| 1673 if (header->isMarked()) { | 1695 if (header->isMarked()) { |
| 1674 liveCount = 1; | 1696 liveCount = 1; |
| 1675 liveSize += header->size(); | 1697 liveSize += header->size(); |
| (...skipping 719 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2395 size_t Heap::s_allocatedObjectSize = 0; | 2417 size_t Heap::s_allocatedObjectSize = 0; |
| 2396 size_t Heap::s_allocatedSpace = 0; | 2418 size_t Heap::s_allocatedSpace = 0; |
| 2397 size_t Heap::s_markedObjectSize = 0; | 2419 size_t Heap::s_markedObjectSize = 0; |
| 2398 // We don't want to use 0 KB for the initial value because it may end up | 2420 // We don't want to use 0 KB for the initial value because it may end up |
| 2399 // triggering the first GC of some thread too prematurely. | 2421 // triggering the first GC of some thread too prematurely. |
| 2400 size_t Heap::s_estimatedLiveObjectSize = 512 * 1024; | 2422 size_t Heap::s_estimatedLiveObjectSize = 512 * 1024; |
| 2401 size_t Heap::s_externalObjectSizeAtLastGC = 0; | 2423 size_t Heap::s_externalObjectSizeAtLastGC = 0; |
| 2402 double Heap::s_estimatedMarkingTimePerByte = 0.0; | 2424 double Heap::s_estimatedMarkingTimePerByte = 0.0; |
| 2403 | 2425 |
| 2404 } // namespace blink | 2426 } // namespace blink |
| OLD | NEW |