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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 , m_startOfStack(reinterpret_cast<intptr_t*>(StackFrameDepth::getStackStart(
))) | 92 , m_startOfStack(reinterpret_cast<intptr_t*>(StackFrameDepth::getStackStart(
))) |
93 , m_endOfStack(reinterpret_cast<intptr_t*>(StackFrameDepth::getStackStart())
) | 93 , m_endOfStack(reinterpret_cast<intptr_t*>(StackFrameDepth::getStackStart())
) |
94 , m_safePointScopeMarker(nullptr) | 94 , m_safePointScopeMarker(nullptr) |
95 , m_atSafePoint(false) | 95 , m_atSafePoint(false) |
96 , m_interruptors() | 96 , m_interruptors() |
97 , m_sweepForbidden(false) | 97 , m_sweepForbidden(false) |
98 , m_noAllocationCount(0) | 98 , m_noAllocationCount(0) |
99 , m_gcForbiddenCount(0) | 99 , m_gcForbiddenCount(0) |
100 , m_persistentAllocated(0) | 100 , m_persistentAllocated(0) |
101 , m_persistentFreed(0) | 101 , m_persistentFreed(0) |
102 , m_pageNavigationCount(0) | |
103 , m_vectorBackingHeapIndex(Vector1HeapIndex) | 102 , m_vectorBackingHeapIndex(Vector1HeapIndex) |
104 , m_currentHeapAges(0) | 103 , m_currentHeapAges(0) |
105 , m_isTerminating(false) | 104 , m_isTerminating(false) |
106 , m_gcMixinMarker(nullptr) | 105 , m_gcMixinMarker(nullptr) |
107 , m_shouldFlushHeapDoesNotContainCache(false) | 106 , m_shouldFlushHeapDoesNotContainCache(false) |
108 , m_gcState(NoGCScheduled) | 107 , m_gcState(NoGCScheduled) |
109 , m_traceDOMWrappers(nullptr) | 108 , m_traceDOMWrappers(nullptr) |
110 #if defined(ADDRESS_SANITIZER) | 109 #if defined(ADDRESS_SANITIZER) |
111 , m_asanFakeStack(__asan_get_current_fake_stack()) | 110 , m_asanFakeStack(__asan_get_current_fake_stack()) |
112 #endif | 111 #endif |
(...skipping 584 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
697 if (isGCForbidden()) | 696 if (isGCForbidden()) |
698 return; | 697 return; |
699 | 698 |
700 // Finish on-going lazy sweeping. | 699 // Finish on-going lazy sweeping. |
701 // TODO(haraken): It might not make sense to force completeSweep() for all | 700 // TODO(haraken): It might not make sense to force completeSweep() for all |
702 // page navigations. | 701 // page navigations. |
703 completeSweep(); | 702 completeSweep(); |
704 ASSERT(!isSweepingInProgress()); | 703 ASSERT(!isSweepingInProgress()); |
705 ASSERT(!sweepForbidden()); | 704 ASSERT(!sweepForbidden()); |
706 | 705 |
707 m_pageNavigationCount++; | |
708 if (m_pageNavigationCount >= 5) { | |
709 // A frame retains a lot of memory in the V8 side. V8's GC cannot | |
710 // collect the memory until Oilpan's GC collects the frame. So we | |
711 // for a conservative GC if no Oilpan's GC has been observed in | |
712 // the past 5 frame navigations. | |
713 // | |
714 Heap::collectGarbage(HeapPointersOnStack, GCWithoutSweep, Heap::Conserva
tiveGC); | |
715 return; | |
716 } | |
717 | |
718 if (shouldSchedulePageNavigationGC(estimatedRemovalRatio)) | 706 if (shouldSchedulePageNavigationGC(estimatedRemovalRatio)) |
719 schedulePageNavigationGC(); | 707 schedulePageNavigationGC(); |
720 } | 708 } |
721 | 709 |
722 void ThreadState::schedulePageNavigationGC() | 710 void ThreadState::schedulePageNavigationGC() |
723 { | 711 { |
724 ASSERT(checkThread()); | 712 ASSERT(checkThread()); |
725 ASSERT(!isSweepingInProgress()); | 713 ASSERT(!isSweepingInProgress()); |
726 setGCState(PageNavigationGCScheduled); | 714 setGCState(PageNavigationGCScheduled); |
727 } | 715 } |
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
991 } | 979 } |
992 | 980 |
993 void ThreadState::preGC() | 981 void ThreadState::preGC() |
994 { | 982 { |
995 ASSERT(!isInGC()); | 983 ASSERT(!isInGC()); |
996 setGCState(GCRunning); | 984 setGCState(GCRunning); |
997 makeConsistentForGC(); | 985 makeConsistentForGC(); |
998 flushHeapDoesNotContainCacheIfNeeded(); | 986 flushHeapDoesNotContainCacheIfNeeded(); |
999 clearHeapAges(); | 987 clearHeapAges(); |
1000 updatePersistentCounters(); | 988 updatePersistentCounters(); |
1001 m_pageNavigationCount = 0; | |
1002 } | 989 } |
1003 | 990 |
1004 void ThreadState::postGC(GCType gcType) | 991 void ThreadState::postGC(GCType gcType) |
1005 { | 992 { |
1006 ASSERT(isInGC()); | 993 ASSERT(isInGC()); |
1007 | 994 |
1008 #if ENABLE(GC_PROFILING) | 995 #if ENABLE(GC_PROFILING) |
1009 // We snapshot the heap prior to sweeping to get numbers for both resources | 996 // We snapshot the heap prior to sweeping to get numbers for both resources |
1010 // that have been allocated since the last GC and for resources that are | 997 // that have been allocated since the last GC and for resources that are |
1011 // going to be freed. | 998 // going to be freed. |
(...skipping 606 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1618 json->beginArray(it->key.ascii().data()); | 1605 json->beginArray(it->key.ascii().data()); |
1619 for (size_t age = 0; age <= maxHeapObjectAge; ++age) | 1606 for (size_t age = 0; age <= maxHeapObjectAge; ++age) |
1620 json->pushInteger(it->value.ages[age]); | 1607 json->pushInteger(it->value.ages[age]); |
1621 json->endArray(); | 1608 json->endArray(); |
1622 } | 1609 } |
1623 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID(TRACE_DISABLED_BY_DEFAULT("blink_gc"), s
tatsName, this, json.release()); | 1610 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID(TRACE_DISABLED_BY_DEFAULT("blink_gc"), s
tatsName, this, json.release()); |
1624 } | 1611 } |
1625 #endif | 1612 #endif |
1626 | 1613 |
1627 } // namespace blink | 1614 } // namespace blink |
OLD | NEW |