OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "platform/heap/HeapCompact.h" | 5 #include "platform/heap/HeapCompact.h" |
6 | 6 |
7 #include "platform/Histogram.h" | 7 #include "platform/Histogram.h" |
8 #include "platform/RuntimeEnabledFeatures.h" | 8 #include "platform/RuntimeEnabledFeatures.h" |
9 #include "platform/heap/Heap.h" | 9 #include "platform/heap/Heap.h" |
10 #include "platform/heap/SparseHeapBitmap.h" | 10 #include "platform/heap/SparseHeapBitmap.h" |
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
421 return; | 421 return; |
422 | 422 |
423 #if DEBUG_HEAP_COMPACTION | 423 #if DEBUG_HEAP_COMPACTION |
424 if (m_fixups) | 424 if (m_fixups) |
425 m_fixups->dumpDebugStats(); | 425 m_fixups->dumpDebugStats(); |
426 #endif | 426 #endif |
427 m_fixups.reset(); | 427 m_fixups.reset(); |
428 m_doCompact = false; | 428 m_doCompact = false; |
429 | 429 |
430 double timeForHeapCompaction = WTF::currentTimeMS() - m_startCompactionTimeMS; | 430 double timeForHeapCompaction = WTF::currentTimeMS() - m_startCompactionTimeMS; |
431 DEFINE_STATIC_LOCAL(CustomCountHistogram, timeForHeapCompactionHistogram, | 431 DEFINE_THREAD_SAFE_STATIC_LOCAL( |
432 ("BlinkGC.TimeForHeapCompaction", 1, 10 * 1000, 50)); | 432 CustomCountHistogram, timeForHeapCompactionHistogram, |
| 433 new CustomCountHistogram("BlinkGC.TimeForHeapCompaction", 1, 10 * 1000, |
| 434 50)); |
433 timeForHeapCompactionHistogram.count(timeForHeapCompaction); | 435 timeForHeapCompactionHistogram.count(timeForHeapCompaction); |
434 m_startCompactionTimeMS = 0; | 436 m_startCompactionTimeMS = 0; |
435 | 437 |
436 DEFINE_STATIC_LOCAL( | 438 DEFINE_THREAD_SAFE_STATIC_LOCAL( |
437 CustomCountHistogram, objectSizeFreedByHeapCompaction, | 439 CustomCountHistogram, objectSizeFreedByHeapCompaction, |
438 ("BlinkGC.ObjectSizeFreedByHeapCompaction", 1, 4 * 1024 * 1024, 50)); | 440 new CustomCountHistogram("BlinkGC.ObjectSizeFreedByHeapCompaction", 1, |
| 441 4 * 1024 * 1024, 50)); |
439 objectSizeFreedByHeapCompaction.count(m_freedSize / 1024); | 442 objectSizeFreedByHeapCompaction.count(m_freedSize / 1024); |
440 | 443 |
441 #if DEBUG_LOG_HEAP_COMPACTION_RUNNING_TIME | 444 #if DEBUG_LOG_HEAP_COMPACTION_RUNNING_TIME |
442 LOG_HEAP_COMPACTION_INTERNAL( | 445 LOG_HEAP_COMPACTION_INTERNAL( |
443 "Compaction stats: time=%gms, pages freed=%zu, size=%zu\n", | 446 "Compaction stats: time=%gms, pages freed=%zu, size=%zu\n", |
444 timeForHeapCompaction, m_freedPages, m_freedSize); | 447 timeForHeapCompaction, m_freedPages, m_freedSize); |
445 #else | 448 #else |
446 LOG_HEAP_COMPACTION("Compaction stats: freed pages=%zu size=%zu\n", | 449 LOG_HEAP_COMPACTION("Compaction stats: freed pages=%zu size=%zu\n", |
447 m_freedPages, m_freedSize); | 450 m_freedPages, m_freedSize); |
448 #endif | 451 #endif |
449 } | 452 } |
450 | 453 |
451 void HeapCompact::addCompactingPage(BasePage* page) { | 454 void HeapCompact::addCompactingPage(BasePage* page) { |
452 DCHECK(m_doCompact); | 455 DCHECK(m_doCompact); |
453 DCHECK(isCompactingArena(page->arena()->arenaIndex())); | 456 DCHECK(isCompactingArena(page->arena()->arenaIndex())); |
454 fixups().addCompactingPage(page); | 457 fixups().addCompactingPage(page); |
455 } | 458 } |
456 | 459 |
457 bool HeapCompact::scheduleCompactionGCForTesting(bool value) { | 460 bool HeapCompact::scheduleCompactionGCForTesting(bool value) { |
458 bool current = s_forceCompactionGC; | 461 bool current = s_forceCompactionGC; |
459 s_forceCompactionGC = value; | 462 s_forceCompactionGC = value; |
460 return current; | 463 return current; |
461 } | 464 } |
462 | 465 |
463 } // namespace blink | 466 } // namespace blink |
OLD | NEW |