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 1450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1461 double startTime = WTF::currentTimeMS(); | 1461 double startTime = WTF::currentTimeMS(); |
1462 | 1462 |
1463 if (gcType == BlinkGC::TakeSnapshot) | 1463 if (gcType == BlinkGC::TakeSnapshot) |
1464 BlinkGCMemoryDumpProvider::instance()->clearProcessDumpForCurrentGC(); | 1464 BlinkGCMemoryDumpProvider::instance()->clearProcessDumpForCurrentGC(); |
1465 | 1465 |
1466 // Disallow allocation during garbage collection (but not during the | 1466 // Disallow allocation during garbage collection (but not during the |
1467 // finalization that happens when the visitorScope is torn down). | 1467 // finalization that happens when the visitorScope is torn down). |
1468 NoAllocationScope noAllocationScope(this); | 1468 NoAllocationScope noAllocationScope(this); |
1469 | 1469 |
1470 heap().commitCallbackStacks(); | 1470 heap().commitCallbackStacks(); |
1471 heap().preGC(); | 1471 preGC(); |
1472 | 1472 |
1473 StackFrameDepthScope stackDepthScope(&heap().stackFrameDepth()); | 1473 StackFrameDepthScope stackDepthScope(&heap().stackFrameDepth()); |
1474 | 1474 |
1475 size_t totalObjectSize = heap().heapStats().allocatedObjectSize() + | 1475 size_t totalObjectSize = heap().heapStats().allocatedObjectSize() + |
1476 heap().heapStats().markedObjectSize(); | 1476 heap().heapStats().markedObjectSize(); |
1477 if (gcType != BlinkGC::TakeSnapshot) | 1477 if (gcType != BlinkGC::TakeSnapshot) |
1478 heap().resetHeapCounters(); | 1478 heap().resetHeapCounters(); |
1479 | 1479 |
1480 { | 1480 { |
1481 // 1. Trace persistent roots. | 1481 // 1. Trace persistent roots. |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1527 EnumerationHistogram, gcReasonHistogram, | 1527 EnumerationHistogram, gcReasonHistogram, |
1528 new EnumerationHistogram("BlinkGC.GCReason", | 1528 new EnumerationHistogram("BlinkGC.GCReason", |
1529 BlinkGC::LastGCReason + 1)); | 1529 BlinkGC::LastGCReason + 1)); |
1530 gcReasonHistogram.count(reason); | 1530 gcReasonHistogram.count(reason); |
1531 | 1531 |
1532 heap().m_lastGCReason = reason; | 1532 heap().m_lastGCReason = reason; |
1533 | 1533 |
1534 ThreadHeap::reportMemoryUsageHistogram(); | 1534 ThreadHeap::reportMemoryUsageHistogram(); |
1535 WTF::Partitions::reportMemoryUsageHistogram(); | 1535 WTF::Partitions::reportMemoryUsageHistogram(); |
1536 } | 1536 } |
1537 heap().postGC(gcType); | 1537 postGC(gcType); |
1538 } | 1538 } |
1539 | 1539 |
1540 heap().preSweep(gcType); | 1540 preSweep(gcType); |
1541 heap().decommitCallbackStacks(); | 1541 heap().decommitCallbackStacks(); |
1542 } | 1542 } |
1543 | 1543 |
1544 void ThreadState::collectAllGarbage() { | 1544 void ThreadState::collectAllGarbage() { |
1545 // We need to run multiple GCs to collect a chain of persistent handles. | 1545 // We need to run multiple GCs to collect a chain of persistent handles. |
1546 size_t previousLiveObjects = 0; | 1546 size_t previousLiveObjects = 0; |
1547 for (int i = 0; i < 5; ++i) { | 1547 for (int i = 0; i < 5; ++i) { |
1548 collectGarbage(BlinkGC::NoHeapPointersOnStack, BlinkGC::GCWithSweep, | 1548 collectGarbage(BlinkGC::NoHeapPointersOnStack, BlinkGC::GCWithSweep, |
1549 BlinkGC::ForcedGC); | 1549 BlinkGC::ForcedGC); |
1550 size_t liveObjects = heap().heapStats().markedObjectSize(); | 1550 size_t liveObjects = heap().heapStats().markedObjectSize(); |
1551 if (liveObjects == previousLiveObjects) | 1551 if (liveObjects == previousLiveObjects) |
1552 break; | 1552 break; |
1553 previousLiveObjects = liveObjects; | 1553 previousLiveObjects = liveObjects; |
1554 } | 1554 } |
1555 } | 1555 } |
1556 | 1556 |
1557 } // namespace blink | 1557 } // namespace blink |
OLD | NEW |