Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(36)

Side by Side Diff: Source/platform/heap/Heap.cpp

Issue 1159143006: Oilpan: Remove Heap::s_lastGCWasConservative (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/platform/heap/Heap.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1803 matching lines...) Expand 10 before | Expand all | Expand 10 after
1814 #if !ENABLE(ASSERT) 1814 #if !ENABLE(ASSERT)
1815 if (s_heapDoesNotContainCache->lookup(address)) 1815 if (s_heapDoesNotContainCache->lookup(address))
1816 return nullptr; 1816 return nullptr;
1817 #endif 1817 #endif
1818 1818
1819 if (BasePage* page = lookup(address)) { 1819 if (BasePage* page = lookup(address)) {
1820 ASSERT(page->contains(address)); 1820 ASSERT(page->contains(address));
1821 ASSERT(!page->orphaned()); 1821 ASSERT(!page->orphaned());
1822 ASSERT(!s_heapDoesNotContainCache->lookup(address)); 1822 ASSERT(!s_heapDoesNotContainCache->lookup(address));
1823 page->checkAndMarkPointer(visitor, address); 1823 page->checkAndMarkPointer(visitor, address);
1824 // FIXME: We only need to set the conservative flag if
1825 // checkAndMarkPointer actually marked the pointer.
1826 s_lastGCWasConservative = true;
1827 return address; 1824 return address;
1828 } 1825 }
1829 1826
1830 #if !ENABLE(ASSERT) 1827 #if !ENABLE(ASSERT)
1831 s_heapDoesNotContainCache->addEntry(address); 1828 s_heapDoesNotContainCache->addEntry(address);
1832 #else 1829 #else
1833 if (!s_heapDoesNotContainCache->lookup(address)) 1830 if (!s_heapDoesNotContainCache->lookup(address))
1834 s_heapDoesNotContainCache->addEntry(address); 1831 s_heapDoesNotContainCache->addEntry(address);
1835 #endif 1832 #endif
1836 return nullptr; 1833 return nullptr;
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
2016 2013
2017 GCScope gcScope(state, stackState, gcType); 2014 GCScope gcScope(state, stackState, gcType);
2018 // Check if we successfully parked the other threads. If not we bail out of 2015 // Check if we successfully parked the other threads. If not we bail out of
2019 // the GC. 2016 // the GC.
2020 if (!gcScope.allThreadsParked()) 2017 if (!gcScope.allThreadsParked())
2021 return; 2018 return;
2022 2019
2023 if (state->isMainThread()) 2020 if (state->isMainThread())
2024 ScriptForbiddenScope::enter(); 2021 ScriptForbiddenScope::enter();
2025 2022
2026 s_lastGCWasConservative = false;
2027
2028 TRACE_EVENT2("blink_gc", "Heap::collectGarbage", 2023 TRACE_EVENT2("blink_gc", "Heap::collectGarbage",
2029 "lazySweeping", gcType == ThreadState::GCWithoutSweep, 2024 "lazySweeping", gcType == ThreadState::GCWithoutSweep,
2030 "gcReason", gcReasonString(reason)); 2025 "gcReason", gcReasonString(reason));
2031 TRACE_EVENT_SCOPED_SAMPLING_STATE("blink_gc", "BlinkGC"); 2026 TRACE_EVENT_SCOPED_SAMPLING_STATE("blink_gc", "BlinkGC");
2032 double timeStamp = WTF::currentTimeMS(); 2027 double timeStamp = WTF::currentTimeMS();
2033 #if ENABLE(GC_PROFILING) 2028 #if ENABLE(GC_PROFILING)
2034 gcScope.visitor()->objectGraph().clear(); 2029 gcScope.visitor()->objectGraph().clear();
2035 #endif 2030 #endif
2036 2031
2037 // Disallow allocation during garbage collection (but not during the 2032 // Disallow allocation during garbage collection (but not during the
2038 // finalization that happens when the gcScope is torn down). 2033 // finalization that happens when the gcScope is torn down).
2039 ThreadState::NoAllocationScope noAllocationScope(state); 2034 ThreadState::NoAllocationScope noAllocationScope(state);
2040 2035
2041 preGC(); 2036 preGC();
2042 2037
2043 StackFrameDepthScope stackDepthScope; 2038 StackFrameDepthScope stackDepthScope;
2044 2039
2045 size_t totalObjectSize = Heap::allocatedObjectSize() + Heap::markedObjectSiz e(); 2040 size_t totalObjectSize = Heap::allocatedObjectSize() + Heap::markedObjectSiz e();
2046 Heap::resetHeapCounters(); 2041 Heap::resetHeapCounters();
2047 2042
2048 // 1. Trace persistent roots. 2043 // 1. Trace persistent roots.
2049 ThreadState::visitPersistentRoots(gcScope.visitor()); 2044 ThreadState::visitPersistentRoots(gcScope.visitor());
2050 2045
2051 // 2. Trace objects reachable from the persistent roots including 2046 // 2. Trace objects reachable from the stack. We do this independent of the
2052 // ephemerons.
2053 processMarkingStack(gcScope.visitor());
2054
2055 // 3. Trace objects reachable from the stack. We do this independent of the
2056 // given stackState since other threads might have a different stack state. 2047 // given stackState since other threads might have a different stack state.
2057 ThreadState::visitStackRoots(gcScope.visitor()); 2048 ThreadState::visitStackRoots(gcScope.visitor());
2058 2049
2059 // 4. Trace objects reachable from the stack "roots" including ephemerons. 2050 // 3. Transitive closure to trace objects including ephemerons.
2060 // Only do the processing if we found a pointer to an object on one of the 2051 processMarkingStack(gcScope.visitor());
2061 // thread stacks.
2062 if (lastGCWasConservative())
2063 processMarkingStack(gcScope.visitor());
2064 2052
2065 postMarkingProcessing(gcScope.visitor()); 2053 postMarkingProcessing(gcScope.visitor());
2066 globalWeakProcessing(gcScope.visitor()); 2054 globalWeakProcessing(gcScope.visitor());
2067 2055
2068 // Now we can delete all orphaned pages because there are no dangling 2056 // Now we can delete all orphaned pages because there are no dangling
2069 // pointers to the orphaned pages. (If we have such dangling pointers, 2057 // pointers to the orphaned pages. (If we have such dangling pointers,
2070 // we should have crashed during marking before getting here.) 2058 // we should have crashed during marking before getting here.)
2071 orphanedPagePool()->decommitOrphanedPages(); 2059 orphanedPagePool()->decommitOrphanedPages();
2072 2060
2073 postGC(gcType); 2061 postGC(gcType);
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
2344 s_markedObjectSize = 0; 2332 s_markedObjectSize = 0;
2345 s_externalObjectSizeAtLastGC = WTF::Partitions::totalSizeOfCommittedPages(); 2333 s_externalObjectSizeAtLastGC = WTF::Partitions::totalSizeOfCommittedPages();
2346 } 2334 }
2347 2335
2348 CallbackStack* Heap::s_markingStack; 2336 CallbackStack* Heap::s_markingStack;
2349 CallbackStack* Heap::s_postMarkingCallbackStack; 2337 CallbackStack* Heap::s_postMarkingCallbackStack;
2350 CallbackStack* Heap::s_globalWeakCallbackStack; 2338 CallbackStack* Heap::s_globalWeakCallbackStack;
2351 CallbackStack* Heap::s_ephemeronStack; 2339 CallbackStack* Heap::s_ephemeronStack;
2352 HeapDoesNotContainCache* Heap::s_heapDoesNotContainCache; 2340 HeapDoesNotContainCache* Heap::s_heapDoesNotContainCache;
2353 bool Heap::s_shutdownCalled = false; 2341 bool Heap::s_shutdownCalled = false;
2354 bool Heap::s_lastGCWasConservative = false;
2355 FreePagePool* Heap::s_freePagePool; 2342 FreePagePool* Heap::s_freePagePool;
2356 OrphanedPagePool* Heap::s_orphanedPagePool; 2343 OrphanedPagePool* Heap::s_orphanedPagePool;
2357 Heap::RegionTree* Heap::s_regionTree = nullptr; 2344 Heap::RegionTree* Heap::s_regionTree = nullptr;
2358 size_t Heap::s_allocatedObjectSize = 0; 2345 size_t Heap::s_allocatedObjectSize = 0;
2359 size_t Heap::s_allocatedSpace = 0; 2346 size_t Heap::s_allocatedSpace = 0;
2360 size_t Heap::s_markedObjectSize = 0; 2347 size_t Heap::s_markedObjectSize = 0;
2361 // We don't want to use 0 KB for the initial value because it may end up 2348 // We don't want to use 0 KB for the initial value because it may end up
2362 // triggering the first GC of some thread too prematurely. 2349 // triggering the first GC of some thread too prematurely.
2363 size_t Heap::s_estimatedLiveObjectSize = 512 * 1024; 2350 size_t Heap::s_estimatedLiveObjectSize = 512 * 1024;
2364 size_t Heap::s_externalObjectSizeAtLastGC = 0; 2351 size_t Heap::s_externalObjectSizeAtLastGC = 0;
2365 double Heap::s_estimatedMarkingTimePerByte = 0.0; 2352 double Heap::s_estimatedMarkingTimePerByte = 0.0;
2366 2353
2367 } // namespace blink 2354 } // namespace blink
OLDNEW
« no previous file with comments | « Source/platform/heap/Heap.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698