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 672 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
683 } | 683 } |
684 if (gcType == V8MajorGC) { | 684 if (gcType == V8MajorGC) { |
685 #if PRINT_HEAP_STATS | 685 #if PRINT_HEAP_STATS |
686 dataLogF("Scheduled IdleGC\n"); | 686 dataLogF("Scheduled IdleGC\n"); |
687 #endif | 687 #endif |
688 scheduleIdleGC(); | 688 scheduleIdleGC(); |
689 return; | 689 return; |
690 } | 690 } |
691 } | 691 } |
692 | 692 |
| 693 void ThreadState::willStartV8GC() |
| 694 { |
| 695 // Finish Oilpan's complete sweeping before running a V8 GC. |
| 696 // This will let the GC collect more V8 objects. |
| 697 // |
| 698 // TODO(haraken): It's a bit too late for a major GC to schedule |
| 699 // completeSweep() here, because gcPrologue for a major GC is called |
| 700 // not at the point where the major GC started but at the point where |
| 701 // the major GC requests object grouping. |
| 702 completeSweep(); |
| 703 |
| 704 // The fact that the PageNavigation GC is scheduled means that there is |
| 705 // a dead frame. In common cases, a sequence of Oilpan's GC => V8 GC => |
| 706 // Oilpan's GC is needed to collect the dead frame. So we force the |
| 707 // PageNavigation GC before running the V8 GC. |
| 708 if (gcState() == PageNavigationGCScheduled) { |
| 709 #if PRINT_HEAP_STATS |
| 710 dataLogF("Scheduled PageNavigationGC\n"); |
| 711 #endif |
| 712 Heap::collectGarbage(HeapPointersOnStack, GCWithSweep, Heap::PageNavigat
ionGC); |
| 713 } |
| 714 } |
| 715 |
693 void ThreadState::schedulePageNavigationGCIfNeeded(float estimatedRemovalRatio) | 716 void ThreadState::schedulePageNavigationGCIfNeeded(float estimatedRemovalRatio) |
694 { | 717 { |
695 ASSERT(checkThread()); | 718 ASSERT(checkThread()); |
696 Heap::reportMemoryUsageForTracing(); | 719 Heap::reportMemoryUsageForTracing(); |
697 | 720 |
698 #if PRINT_HEAP_STATS | 721 #if PRINT_HEAP_STATS |
699 dataLogF("ThreadState::schedulePageNavigationGCIfNeeded (estimatedRemovalRat
io=%.2lf)\n", estimatedRemovalRatio); | 722 dataLogF("ThreadState::schedulePageNavigationGCIfNeeded (estimatedRemovalRat
io=%.2lf)\n", estimatedRemovalRatio); |
700 #endif | 723 #endif |
701 | 724 |
702 if (isGCForbidden()) | 725 if (isGCForbidden()) |
(...skipping 935 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1638 json->beginArray(it->key.ascii().data()); | 1661 json->beginArray(it->key.ascii().data()); |
1639 for (size_t age = 0; age <= maxHeapObjectAge; ++age) | 1662 for (size_t age = 0; age <= maxHeapObjectAge; ++age) |
1640 json->pushInteger(it->value.ages[age]); | 1663 json->pushInteger(it->value.ages[age]); |
1641 json->endArray(); | 1664 json->endArray(); |
1642 } | 1665 } |
1643 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID(TRACE_DISABLED_BY_DEFAULT("blink_gc"), s
tatsName, this, json.release()); | 1666 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID(TRACE_DISABLED_BY_DEFAULT("blink_gc"), s
tatsName, this, json.release()); |
1644 } | 1667 } |
1645 #endif | 1668 #endif |
1646 | 1669 |
1647 } // namespace blink | 1670 } // namespace blink |
OLD | NEW |