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 545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 556 return judgeGCThreshold(1024 * 1024, 1.5); | 556 return judgeGCThreshold(1024 * 1024, 1.5); |
| 557 } | 557 } |
| 558 | 558 |
| 559 bool ThreadState::shouldScheduleV8FollowupGC() | 559 bool ThreadState::shouldScheduleV8FollowupGC() |
| 560 { | 560 { |
| 561 return judgeGCThreshold(32 * 1024 * 1024, 1.5); | 561 return judgeGCThreshold(32 * 1024 * 1024, 1.5); |
| 562 } | 562 } |
| 563 | 563 |
| 564 bool ThreadState::shouldSchedulePageNavigationGC(float estimatedRemovalRatio) | 564 bool ThreadState::shouldSchedulePageNavigationGC(float estimatedRemovalRatio) |
| 565 { | 565 { |
| 566 return judgeGCThreshold(1024 * 1024, 1.5 * (1 - estimatedRemovalRatio)); | 566 // If estimatedRemovalRatio is low we should let IdleGC handle this. |
| 567 if (estimatedRemovalRatio == 0.01) | |
|
haraken
2016/02/14 23:23:04
I'm confused with this branch.
- Are you intendin
keishi
2016/02/15 01:40:50
Yes, sorry.
| |
| 568 return false; | |
| 569 return judgeGCThreshold(32 * 1024 * 1024, 1.5 * (1 - estimatedRemovalRatio)) ; | |
| 567 } | 570 } |
| 568 | 571 |
| 569 bool ThreadState::shouldForceConservativeGC() | 572 bool ThreadState::shouldForceConservativeGC() |
| 570 { | 573 { |
| 571 // TODO(haraken): 400% is too large. Lower the heap growing factor. | 574 // TODO(haraken): 400% is too large. Lower the heap growing factor. |
| 572 return judgeGCThreshold(32 * 1024 * 1024, 5.0); | 575 return judgeGCThreshold(32 * 1024 * 1024, 5.0); |
| 573 } | 576 } |
| 574 | 577 |
| 575 // If we're consuming too much memory, trigger a conservative GC | 578 // If we're consuming too much memory, trigger a conservative GC |
| 576 // aggressively. This is a safe guard to avoid OOM. | 579 // aggressively. This is a safe guard to avoid OOM. |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 653 dataLogF("Scheduled MemoryPressureGC\n"); | 656 dataLogF("Scheduled MemoryPressureGC\n"); |
| 654 #endif | 657 #endif |
| 655 Heap::collectGarbage(BlinkGC::HeapPointersOnStack, BlinkGC::GCWithoutSwe ep, BlinkGC::MemoryPressureGC); | 658 Heap::collectGarbage(BlinkGC::HeapPointersOnStack, BlinkGC::GCWithoutSwe ep, BlinkGC::MemoryPressureGC); |
| 656 return; | 659 return; |
| 657 } | 660 } |
| 658 if (shouldSchedulePageNavigationGC(estimatedRemovalRatio)) { | 661 if (shouldSchedulePageNavigationGC(estimatedRemovalRatio)) { |
| 659 #if PRINT_HEAP_STATS | 662 #if PRINT_HEAP_STATS |
| 660 dataLogF("Scheduled PageNavigationGC\n"); | 663 dataLogF("Scheduled PageNavigationGC\n"); |
| 661 #endif | 664 #endif |
| 662 schedulePageNavigationGC(); | 665 schedulePageNavigationGC(); |
| 663 return; | |
| 664 } | 666 } |
| 665 } | 667 } |
| 666 | 668 |
| 667 void ThreadState::schedulePageNavigationGC() | 669 void ThreadState::schedulePageNavigationGC() |
| 668 { | 670 { |
| 669 ASSERT(checkThread()); | 671 ASSERT(checkThread()); |
| 670 ASSERT(!isSweepingInProgress()); | 672 ASSERT(!isSweepingInProgress()); |
| 671 setGCState(PageNavigationGCScheduled); | 673 setGCState(PageNavigationGCScheduled); |
| 672 } | 674 } |
| 673 | 675 |
| (...skipping 824 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1498 threadDump->addScalar("dead_count", "objects", totalDeadCount); | 1500 threadDump->addScalar("dead_count", "objects", totalDeadCount); |
| 1499 threadDump->addScalar("live_size", "bytes", totalLiveSize); | 1501 threadDump->addScalar("live_size", "bytes", totalLiveSize); |
| 1500 threadDump->addScalar("dead_size", "bytes", totalDeadSize); | 1502 threadDump->addScalar("dead_size", "bytes", totalDeadSize); |
| 1501 | 1503 |
| 1502 WebMemoryAllocatorDump* heapsDump = BlinkGCMemoryDumpProvider::instance()->c reateMemoryAllocatorDumpForCurrentGC(heapsDumpName); | 1504 WebMemoryAllocatorDump* heapsDump = BlinkGCMemoryDumpProvider::instance()->c reateMemoryAllocatorDumpForCurrentGC(heapsDumpName); |
| 1503 WebMemoryAllocatorDump* classesDump = BlinkGCMemoryDumpProvider::instance()- >createMemoryAllocatorDumpForCurrentGC(classesDumpName); | 1505 WebMemoryAllocatorDump* classesDump = BlinkGCMemoryDumpProvider::instance()- >createMemoryAllocatorDumpForCurrentGC(classesDumpName); |
| 1504 BlinkGCMemoryDumpProvider::instance()->currentProcessMemoryDump()->addOwners hipEdge(classesDump->guid(), heapsDump->guid()); | 1506 BlinkGCMemoryDumpProvider::instance()->currentProcessMemoryDump()->addOwners hipEdge(classesDump->guid(), heapsDump->guid()); |
| 1505 } | 1507 } |
| 1506 | 1508 |
| 1507 } // namespace blink | 1509 } // namespace blink |
| OLD | NEW |