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 639 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
650 | 650 |
651 bool ThreadState::shouldSchedulePreciseGC() | 651 bool ThreadState::shouldSchedulePreciseGC() |
652 { | 652 { |
653 #if ENABLE(IDLE_GC) | 653 #if ENABLE(IDLE_GC) |
654 return false; | 654 return false; |
655 #else | 655 #else |
656 return judgeGCThreshold(1024 * 1024, 1.5); | 656 return judgeGCThreshold(1024 * 1024, 1.5); |
657 #endif | 657 #endif |
658 } | 658 } |
659 | 659 |
| 660 bool ThreadState::shouldScheduleV8FollowupGC() |
| 661 { |
| 662 return judgeGCThreshold(32 * 1024 * 1024, 1.5); |
| 663 } |
| 664 |
660 bool ThreadState::shouldSchedulePageNavigationGC(float estimatedRemovalRatio) | 665 bool ThreadState::shouldSchedulePageNavigationGC(float estimatedRemovalRatio) |
661 { | 666 { |
662 return judgeGCThreshold(1024 * 1024, 1.5 * (1 - estimatedRemovalRatio)); | 667 return judgeGCThreshold(1024 * 1024, 1.5 * (1 - estimatedRemovalRatio)); |
663 } | 668 } |
664 | 669 |
665 bool ThreadState::shouldForceConservativeGC() | 670 bool ThreadState::shouldForceConservativeGC() |
666 { | 671 { |
667 // TODO(haraken): 400% is too large. Lower the heap growing factor. | 672 // TODO(haraken): 400% is too large. Lower the heap growing factor. |
668 return judgeGCThreshold(32 * 1024 * 1024, 5.0); | 673 return judgeGCThreshold(32 * 1024 * 1024, 5.0); |
669 } | 674 } |
670 | 675 |
| 676 void ThreadState::scheduleV8FollowupGCIfNeeded() |
| 677 { |
| 678 ASSERT(checkThread()); |
| 679 if (isGCForbidden()) |
| 680 return; |
| 681 |
| 682 if (isSweepingInProgress()) |
| 683 return; |
| 684 ASSERT(!sweepForbidden()); |
| 685 |
| 686 Heap::reportMemoryUsageForTracing(); |
| 687 if (shouldScheduleV8FollowupGC()) |
| 688 schedulePreciseGC(); |
| 689 } |
| 690 |
671 void ThreadState::schedulePageNavigationGCIfNeeded(float estimatedRemovalRatio) | 691 void ThreadState::schedulePageNavigationGCIfNeeded(float estimatedRemovalRatio) |
672 { | 692 { |
673 ASSERT(checkThread()); | 693 ASSERT(checkThread()); |
674 if (isGCForbidden()) | 694 if (isGCForbidden()) |
675 return; | 695 return; |
676 | 696 |
677 // Finish on-going lazy sweeping. | 697 // Finish on-going lazy sweeping. |
678 // TODO(haraken): It might not make sense to force completeSweep() for all | 698 // TODO(haraken): It might not make sense to force completeSweep() for all |
679 // page navigations. | 699 // page navigations. |
680 completeSweep(); | 700 completeSweep(); |
(...skipping 902 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1583 json->beginArray(it->key.ascii().data()); | 1603 json->beginArray(it->key.ascii().data()); |
1584 for (size_t age = 0; age <= maxHeapObjectAge; ++age) | 1604 for (size_t age = 0; age <= maxHeapObjectAge; ++age) |
1585 json->pushInteger(it->value.ages[age]); | 1605 json->pushInteger(it->value.ages[age]); |
1586 json->endArray(); | 1606 json->endArray(); |
1587 } | 1607 } |
1588 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID(TRACE_DISABLED_BY_DEFAULT("blink_gc"), s
tatsName, this, json.release()); | 1608 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID(TRACE_DISABLED_BY_DEFAULT("blink_gc"), s
tatsName, this, json.release()); |
1589 } | 1609 } |
1590 #endif | 1610 #endif |
1591 | 1611 |
1592 } // namespace blink | 1612 } // namespace blink |
OLD | NEW |