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

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

Issue 1149943003: Oilpan: Rename weak callback related methods (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 7 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') | Source/platform/heap/HeapAllocator.h » ('j') | 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 1595 matching lines...) Expand 10 before | Expand all | Expand 10 after
1606 void Heap::flushHeapDoesNotContainCache() 1606 void Heap::flushHeapDoesNotContainCache()
1607 { 1607 {
1608 s_heapDoesNotContainCache->flush(); 1608 s_heapDoesNotContainCache->flush();
1609 } 1609 }
1610 1610
1611 void Heap::init() 1611 void Heap::init()
1612 { 1612 {
1613 ThreadState::init(); 1613 ThreadState::init();
1614 s_markingStack = new CallbackStack(); 1614 s_markingStack = new CallbackStack();
1615 s_postMarkingCallbackStack = new CallbackStack(); 1615 s_postMarkingCallbackStack = new CallbackStack();
1616 s_weakCallbackStack = new CallbackStack(); 1616 s_globalWeakCallbackStack = new CallbackStack();
1617 s_ephemeronStack = new CallbackStack(); 1617 s_ephemeronStack = new CallbackStack();
1618 s_heapDoesNotContainCache = new HeapDoesNotContainCache(); 1618 s_heapDoesNotContainCache = new HeapDoesNotContainCache();
1619 s_markingVisitor = new MarkingVisitor<Visitor::GlobalMarking>(); 1619 s_markingVisitor = new MarkingVisitor<Visitor::GlobalMarking>();
1620 s_freePagePool = new FreePagePool(); 1620 s_freePagePool = new FreePagePool();
1621 s_orphanedPagePool = new OrphanedPagePool(); 1621 s_orphanedPagePool = new OrphanedPagePool();
1622 s_allocatedObjectSize = 0; 1622 s_allocatedObjectSize = 0;
1623 s_allocatedSpace = 0; 1623 s_allocatedSpace = 0;
1624 s_markedObjectSize = 0; 1624 s_markedObjectSize = 0;
1625 s_estimatedMarkingTimePerByte = 0.0; 1625 s_estimatedMarkingTimePerByte = 0.0;
1626 1626
(...skipping 14 matching lines...) Expand all
1641 1641
1642 ASSERT(!ThreadState::attachedThreads().size()); 1642 ASSERT(!ThreadState::attachedThreads().size());
1643 delete s_markingVisitor; 1643 delete s_markingVisitor;
1644 s_markingVisitor = nullptr; 1644 s_markingVisitor = nullptr;
1645 delete s_heapDoesNotContainCache; 1645 delete s_heapDoesNotContainCache;
1646 s_heapDoesNotContainCache = nullptr; 1646 s_heapDoesNotContainCache = nullptr;
1647 delete s_freePagePool; 1647 delete s_freePagePool;
1648 s_freePagePool = nullptr; 1648 s_freePagePool = nullptr;
1649 delete s_orphanedPagePool; 1649 delete s_orphanedPagePool;
1650 s_orphanedPagePool = nullptr; 1650 s_orphanedPagePool = nullptr;
1651 delete s_weakCallbackStack; 1651 delete s_globalWeakCallbackStack;
1652 s_weakCallbackStack = nullptr; 1652 s_globalWeakCallbackStack = nullptr;
1653 delete s_postMarkingCallbackStack; 1653 delete s_postMarkingCallbackStack;
1654 s_postMarkingCallbackStack = nullptr; 1654 s_postMarkingCallbackStack = nullptr;
1655 delete s_markingStack; 1655 delete s_markingStack;
1656 s_markingStack = nullptr; 1656 s_markingStack = nullptr;
1657 delete s_ephemeronStack; 1657 delete s_ephemeronStack;
1658 s_ephemeronStack = nullptr; 1658 s_ephemeronStack = nullptr;
1659 delete s_regionTree; 1659 delete s_regionTree;
1660 s_regionTree = nullptr; 1660 s_regionTree = nullptr;
1661 GCInfoTable::shutdown(); 1661 GCInfoTable::shutdown();
1662 ThreadState::shutdown(); 1662 ThreadState::shutdown();
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
1795 1795
1796 bool Heap::popAndInvokePostMarkingCallback(Visitor* visitor) 1796 bool Heap::popAndInvokePostMarkingCallback(Visitor* visitor)
1797 { 1797 {
1798 if (CallbackStack::Item* item = s_postMarkingCallbackStack->pop()) { 1798 if (CallbackStack::Item* item = s_postMarkingCallbackStack->pop()) {
1799 item->call(visitor); 1799 item->call(visitor);
1800 return true; 1800 return true;
1801 } 1801 }
1802 return false; 1802 return false;
1803 } 1803 }
1804 1804
1805 void Heap::pushWeakCellPointerCallback(void** cell, WeakPointerCallback callback ) 1805 void Heap::pushGlobalWeakCallback(void** cell, WeakCallback callback)
1806 { 1806 {
1807 ASSERT(!Heap::orphanedPagePool()->contains(cell)); 1807 ASSERT(!Heap::orphanedPagePool()->contains(cell));
1808 CallbackStack::Item* slot = s_weakCallbackStack->allocateEntry(); 1808 CallbackStack::Item* slot = s_globalWeakCallbackStack->allocateEntry();
1809 *slot = CallbackStack::Item(cell, callback); 1809 *slot = CallbackStack::Item(cell, callback);
1810 } 1810 }
1811 1811
1812 void Heap::pushWeakPointerCallback(void* closure, void* object, WeakPointerCallb ack callback) 1812 void Heap::pushThreadLocalWeakCallback(void* closure, void* object, WeakCallback callback)
1813 { 1813 {
1814 BasePage* page = pageFromObject(object); 1814 BasePage* page = pageFromObject(object);
1815 ASSERT(!page->orphaned()); 1815 ASSERT(!page->orphaned());
1816 ThreadState* state = page->heap()->threadState(); 1816 ThreadState* state = page->heap()->threadState();
1817 state->pushWeakPointerCallback(closure, callback); 1817 state->pushThreadLocalWeakCallback(closure, callback);
1818 } 1818 }
1819 1819
1820 bool Heap::popAndInvokeWeakPointerCallback(Visitor* visitor) 1820 bool Heap::popAndInvokeGlobalWeakCallback(Visitor* visitor)
1821 { 1821 {
1822 // For weak processing we should never reach orphaned pages since orphaned 1822 // For weak processing we should never reach orphaned pages since orphaned
1823 // pages are not traced and thus objects on those pages are never be 1823 // pages are not traced and thus objects on those pages are never be
1824 // registered as objects on orphaned pages. We cannot assert this here 1824 // registered as objects on orphaned pages. We cannot assert this here
1825 // since we might have an off-heap collection. We assert it in 1825 // since we might have an off-heap collection. We assert it in
1826 // Heap::pushWeakPointerCallback. 1826 // Heap::pushWeakCallback.
1827 if (CallbackStack::Item* item = s_weakCallbackStack->pop()) { 1827 if (CallbackStack::Item* item = s_globalWeakCallbackStack->pop()) {
1828 item->call(visitor); 1828 item->call(visitor);
1829 return true; 1829 return true;
1830 } 1830 }
1831 return false; 1831 return false;
1832 } 1832 }
1833 1833
1834 void Heap::registerWeakTable(void* table, EphemeronCallback iterationCallback, E phemeronCallback iterationDoneCallback) 1834 void Heap::registerWeakTable(void* table, EphemeronCallback iterationCallback, E phemeronCallback iterationDoneCallback)
1835 { 1835 {
1836 { 1836 {
1837 // Check that the ephemeron table being pushed onto the stack is not on 1837 // Check that the ephemeron table being pushed onto the stack is not on
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
2041 // Post-marking callbacks should not trace any objects and 2041 // Post-marking callbacks should not trace any objects and
2042 // therefore the marking stack should be empty after the 2042 // therefore the marking stack should be empty after the
2043 // post-marking callbacks. 2043 // post-marking callbacks.
2044 ASSERT(s_markingStack->isEmpty()); 2044 ASSERT(s_markingStack->isEmpty());
2045 } 2045 }
2046 2046
2047 void Heap::globalWeakProcessing(Visitor* markingVisitor) 2047 void Heap::globalWeakProcessing(Visitor* markingVisitor)
2048 { 2048 {
2049 TRACE_EVENT0("blink_gc", "Heap::globalWeakProcessing"); 2049 TRACE_EVENT0("blink_gc", "Heap::globalWeakProcessing");
2050 // Call weak callbacks on objects that may now be pointing to dead objects. 2050 // Call weak callbacks on objects that may now be pointing to dead objects.
2051 while (popAndInvokeWeakPointerCallback(markingVisitor)) { } 2051 while (popAndInvokeGlobalWeakCallback(markingVisitor)) { }
2052 2052
2053 // It is not permitted to trace pointers of live objects in the weak 2053 // It is not permitted to trace pointers of live objects in the weak
2054 // callback phase, so the marking stack should still be empty here. 2054 // callback phase, so the marking stack should still be empty here.
2055 ASSERT(s_markingStack->isEmpty()); 2055 ASSERT(s_markingStack->isEmpty());
2056 } 2056 }
2057 2057
2058 void Heap::collectAllGarbage() 2058 void Heap::collectAllGarbage()
2059 { 2059 {
2060 // FIXME: Oilpan: we should perform a single GC and everything 2060 // FIXME: Oilpan: we should perform a single GC and everything
2061 // should die. Unfortunately it is not the case for all objects 2061 // should die. Unfortunately it is not the case for all objects
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
2217 ASSERT(ThreadState::current()->isInGC()); 2217 ASSERT(ThreadState::current()->isInGC());
2218 2218
2219 s_allocatedObjectSize = 0; 2219 s_allocatedObjectSize = 0;
2220 s_markedObjectSize = 0; 2220 s_markedObjectSize = 0;
2221 s_externalObjectSizeAtLastGC = WTF::Partitions::totalSizeOfCommittedPages(); 2221 s_externalObjectSizeAtLastGC = WTF::Partitions::totalSizeOfCommittedPages();
2222 } 2222 }
2223 2223
2224 Visitor* Heap::s_markingVisitor; 2224 Visitor* Heap::s_markingVisitor;
2225 CallbackStack* Heap::s_markingStack; 2225 CallbackStack* Heap::s_markingStack;
2226 CallbackStack* Heap::s_postMarkingCallbackStack; 2226 CallbackStack* Heap::s_postMarkingCallbackStack;
2227 CallbackStack* Heap::s_weakCallbackStack; 2227 CallbackStack* Heap::s_globalWeakCallbackStack;
2228 CallbackStack* Heap::s_ephemeronStack; 2228 CallbackStack* Heap::s_ephemeronStack;
2229 HeapDoesNotContainCache* Heap::s_heapDoesNotContainCache; 2229 HeapDoesNotContainCache* Heap::s_heapDoesNotContainCache;
2230 bool Heap::s_shutdownCalled = false; 2230 bool Heap::s_shutdownCalled = false;
2231 bool Heap::s_lastGCWasConservative = false; 2231 bool Heap::s_lastGCWasConservative = false;
2232 FreePagePool* Heap::s_freePagePool; 2232 FreePagePool* Heap::s_freePagePool;
2233 OrphanedPagePool* Heap::s_orphanedPagePool; 2233 OrphanedPagePool* Heap::s_orphanedPagePool;
2234 Heap::RegionTree* Heap::s_regionTree = nullptr; 2234 Heap::RegionTree* Heap::s_regionTree = nullptr;
2235 size_t Heap::s_allocatedObjectSize = 0; 2235 size_t Heap::s_allocatedObjectSize = 0;
2236 size_t Heap::s_allocatedSpace = 0; 2236 size_t Heap::s_allocatedSpace = 0;
2237 size_t Heap::s_markedObjectSize = 0; 2237 size_t Heap::s_markedObjectSize = 0;
2238 // We don't want to use 0 KB for the initial value because it may end up 2238 // We don't want to use 0 KB for the initial value because it may end up
2239 // triggering the first GC of some thread too prematurely. 2239 // triggering the first GC of some thread too prematurely.
2240 size_t Heap::s_estimatedLiveObjectSize = 512 * 1024; 2240 size_t Heap::s_estimatedLiveObjectSize = 512 * 1024;
2241 size_t Heap::s_externalObjectSizeAtLastGC = 0; 2241 size_t Heap::s_externalObjectSizeAtLastGC = 0;
2242 double Heap::s_estimatedMarkingTimePerByte = 0.0; 2242 double Heap::s_estimatedMarkingTimePerByte = 0.0;
2243 2243
2244 } // namespace blink 2244 } // namespace blink
OLDNEW
« no previous file with comments | « Source/platform/heap/Heap.h ('k') | Source/platform/heap/HeapAllocator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698