| 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 12 matching lines...) Expand all Loading... |
| 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #include "platform/heap/Heap.h" | 31 #include "platform/heap/Heap.h" |
| 32 | 32 |
| 33 #include "base/sys_info.h" | |
| 34 #include "platform/Histogram.h" | 33 #include "platform/Histogram.h" |
| 35 #include "platform/RuntimeEnabledFeatures.h" | 34 #include "platform/RuntimeEnabledFeatures.h" |
| 36 #include "platform/ScriptForbiddenScope.h" | 35 #include "platform/ScriptForbiddenScope.h" |
| 37 #include "platform/heap/BlinkGCMemoryDumpProvider.h" | 36 #include "platform/heap/BlinkGCMemoryDumpProvider.h" |
| 38 #include "platform/heap/CallbackStack.h" | 37 #include "platform/heap/CallbackStack.h" |
| 39 #include "platform/heap/MarkingVisitor.h" | 38 #include "platform/heap/MarkingVisitor.h" |
| 40 #include "platform/heap/PageMemory.h" | 39 #include "platform/heap/PageMemory.h" |
| 41 #include "platform/heap/PagePool.h" | 40 #include "platform/heap/PagePool.h" |
| 42 #include "platform/heap/SafePoint.h" | 41 #include "platform/heap/SafePoint.h" |
| 43 #include "platform/heap/ThreadState.h" | 42 #include "platform/heap/ThreadState.h" |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 | 98 |
| 100 void ThreadHeap::flushHeapDoesNotContainCache() { | 99 void ThreadHeap::flushHeapDoesNotContainCache() { |
| 101 m_heapDoesNotContainCache->flush(); | 100 m_heapDoesNotContainCache->flush(); |
| 102 } | 101 } |
| 103 | 102 |
| 104 void ProcessHeap::init() { | 103 void ProcessHeap::init() { |
| 105 s_shutdownComplete = false; | 104 s_shutdownComplete = false; |
| 106 s_totalAllocatedSpace = 0; | 105 s_totalAllocatedSpace = 0; |
| 107 s_totalAllocatedObjectSize = 0; | 106 s_totalAllocatedObjectSize = 0; |
| 108 s_totalMarkedObjectSize = 0; | 107 s_totalMarkedObjectSize = 0; |
| 109 s_isLowEndDevice = base::SysInfo::IsLowEndDevice(); | |
| 110 | 108 |
| 111 GCInfoTable::init(); | 109 GCInfoTable::init(); |
| 112 CallbackStackMemoryPool::instance().initialize(); | 110 CallbackStackMemoryPool::instance().initialize(); |
| 113 } | 111 } |
| 114 | 112 |
| 115 void ProcessHeap::resetHeapCounters() { | 113 void ProcessHeap::resetHeapCounters() { |
| 116 s_totalAllocatedObjectSize = 0; | 114 s_totalAllocatedObjectSize = 0; |
| 117 s_totalMarkedObjectSize = 0; | 115 s_totalMarkedObjectSize = 0; |
| 118 } | 116 } |
| 119 | 117 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 132 s_shutdownComplete = true; | 130 s_shutdownComplete = true; |
| 133 } | 131 } |
| 134 | 132 |
| 135 CrossThreadPersistentRegion& ProcessHeap::crossThreadPersistentRegion() { | 133 CrossThreadPersistentRegion& ProcessHeap::crossThreadPersistentRegion() { |
| 136 DEFINE_THREAD_SAFE_STATIC_LOCAL(CrossThreadPersistentRegion, persistentRegion, | 134 DEFINE_THREAD_SAFE_STATIC_LOCAL(CrossThreadPersistentRegion, persistentRegion, |
| 137 new CrossThreadPersistentRegion()); | 135 new CrossThreadPersistentRegion()); |
| 138 return persistentRegion; | 136 return persistentRegion; |
| 139 } | 137 } |
| 140 | 138 |
| 141 bool ProcessHeap::s_shutdownComplete = false; | 139 bool ProcessHeap::s_shutdownComplete = false; |
| 142 bool ProcessHeap::s_isLowEndDevice = false; | |
| 143 size_t ProcessHeap::s_totalAllocatedSpace = 0; | 140 size_t ProcessHeap::s_totalAllocatedSpace = 0; |
| 144 size_t ProcessHeap::s_totalAllocatedObjectSize = 0; | 141 size_t ProcessHeap::s_totalAllocatedObjectSize = 0; |
| 145 size_t ProcessHeap::s_totalMarkedObjectSize = 0; | 142 size_t ProcessHeap::s_totalMarkedObjectSize = 0; |
| 146 | 143 |
| 147 ThreadHeapStats::ThreadHeapStats() | 144 ThreadHeapStats::ThreadHeapStats() |
| 148 : m_allocatedSpace(0), | 145 : m_allocatedSpace(0), |
| 149 m_allocatedObjectSize(0), | 146 m_allocatedObjectSize(0), |
| 150 m_objectSizeAtLastGC(0), | 147 m_objectSizeAtLastGC(0), |
| 151 m_markedObjectSize(0), | 148 m_markedObjectSize(0), |
| 152 m_markedObjectSizeAtLastCompleteSweep(0), | 149 m_markedObjectSizeAtLastCompleteSweep(0), |
| (...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 644 ProcessHeap::decreaseTotalMarkedObjectSize(m_stats.markedObjectSize()); | 641 ProcessHeap::decreaseTotalMarkedObjectSize(m_stats.markedObjectSize()); |
| 645 | 642 |
| 646 m_stats.reset(); | 643 m_stats.reset(); |
| 647 for (ThreadState* state : m_threads) | 644 for (ThreadState* state : m_threads) |
| 648 state->resetHeapCounters(); | 645 state->resetHeapCounters(); |
| 649 } | 646 } |
| 650 | 647 |
| 651 ThreadHeap* ThreadHeap::s_mainThreadHeap = nullptr; | 648 ThreadHeap* ThreadHeap::s_mainThreadHeap = nullptr; |
| 652 | 649 |
| 653 } // namespace blink | 650 } // namespace blink |
| OLD | NEW |