| 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 // force a conservative GC if no Oilpan's GC has been observed in | |
| 712 // the past 5 frame navigations. | |
| 713 Heap::collectGarbage(HeapPointersOnStack, GCWithoutSweep, Heap::Conserva
tiveGC); | |
| 714 return; | |
| 715 } | |
| 716 | |
| 717 if (shouldSchedulePageNavigationGC(estimatedRemovalRatio)) | 706 if (shouldSchedulePageNavigationGC(estimatedRemovalRatio)) |
| 718 schedulePageNavigationGC(); | 707 schedulePageNavigationGC(); |
| 719 } | 708 } |
| 720 | 709 |
| 721 void ThreadState::schedulePageNavigationGC() | 710 void ThreadState::schedulePageNavigationGC() |
| 722 { | 711 { |
| 723 ASSERT(checkThread()); | 712 ASSERT(checkThread()); |
| 724 ASSERT(!isSweepingInProgress()); | 713 ASSERT(!isSweepingInProgress()); |
| 725 setGCState(PageNavigationGCScheduled); | 714 setGCState(PageNavigationGCScheduled); |
| 726 } | 715 } |
| (...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 990 } | 979 } |
| 991 | 980 |
| 992 void ThreadState::preGC() | 981 void ThreadState::preGC() |
| 993 { | 982 { |
| 994 ASSERT(!isInGC()); | 983 ASSERT(!isInGC()); |
| 995 setGCState(GCRunning); | 984 setGCState(GCRunning); |
| 996 makeConsistentForGC(); | 985 makeConsistentForGC(); |
| 997 flushHeapDoesNotContainCacheIfNeeded(); | 986 flushHeapDoesNotContainCacheIfNeeded(); |
| 998 clearHeapAges(); | 987 clearHeapAges(); |
| 999 updatePersistentCounters(); | 988 updatePersistentCounters(); |
| 1000 m_pageNavigationCount = 0; | |
| 1001 } | 989 } |
| 1002 | 990 |
| 1003 void ThreadState::postGC(GCType gcType) | 991 void ThreadState::postGC(GCType gcType) |
| 1004 { | 992 { |
| 1005 ASSERT(isInGC()); | 993 ASSERT(isInGC()); |
| 1006 | 994 |
| 1007 #if ENABLE(GC_PROFILING) | 995 #if ENABLE(GC_PROFILING) |
| 1008 // 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 |
| 1009 // 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 |
| 1010 // going to be freed. | 998 // going to be freed. |
| (...skipping 610 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1621 json->beginArray(it->key.ascii().data()); | 1609 json->beginArray(it->key.ascii().data()); |
| 1622 for (size_t age = 0; age <= maxHeapObjectAge; ++age) | 1610 for (size_t age = 0; age <= maxHeapObjectAge; ++age) |
| 1623 json->pushInteger(it->value.ages[age]); | 1611 json->pushInteger(it->value.ages[age]); |
| 1624 json->endArray(); | 1612 json->endArray(); |
| 1625 } | 1613 } |
| 1626 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID(TRACE_DISABLED_BY_DEFAULT("blink_gc"), s
tatsName, this, json.release()); | 1614 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID(TRACE_DISABLED_BY_DEFAULT("blink_gc"), s
tatsName, this, json.release()); |
| 1627 } | 1615 } |
| 1628 #endif | 1616 #endif |
| 1629 | 1617 |
| 1630 } // namespace blink | 1618 } // namespace blink |
| OLD | NEW |