| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef HeapCompact_h | 5 #ifndef HeapCompact_h |
| 6 #define HeapCompact_h | 6 #define HeapCompact_h |
| 7 | 7 |
| 8 #include "platform/PlatformExport.h" | 8 #include "platform/PlatformExport.h" |
| 9 #include "platform/heap/BlinkGC.h" | 9 #include "platform/heap/BlinkGC.h" |
| 10 #include "wtf/DataLog.h" | 10 #include "wtf/DataLog.h" |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 static const size_t kFreeListSizeThreshold = 512 * 1024; | 132 static const size_t kFreeListSizeThreshold = 512 * 1024; |
| 133 | 133 |
| 134 MovableObjectFixups& fixups(); | 134 MovableObjectFixups& fixups(); |
| 135 | 135 |
| 136 std::unique_ptr<MovableObjectFixups> m_fixups; | 136 std::unique_ptr<MovableObjectFixups> m_fixups; |
| 137 | 137 |
| 138 // Set to |true| when a compacting sweep will go ahead. | 138 // Set to |true| when a compacting sweep will go ahead. |
| 139 bool m_doCompact; | 139 bool m_doCompact; |
| 140 size_t m_gcCountSinceLastCompaction; | 140 size_t m_gcCountSinceLastCompaction; |
| 141 | 141 |
| 142 // Lock protecting finishedThreadCompaction() signalling. | |
| 143 Mutex m_mutex; | |
| 144 | |
| 145 // All threads performing a GC must synchronize on completion | |
| 146 // of all heap compactions. Not doing so risks one thread resuming | |
| 147 // the mutator, which could perform cross-thread access to a heap | |
| 148 // that's still in the process of being compacted. | |
| 149 ThreadCondition m_finished; | |
| 150 | |
| 151 // Number of heap threads participating in the compaction. | |
| 152 int m_threadCount; | |
| 153 | |
| 154 // Last reported freelist size, across all compactable arenas. | 142 // Last reported freelist size, across all compactable arenas. |
| 155 size_t m_freeListSize; | 143 size_t m_freeListSize; |
| 156 | 144 |
| 157 // If compacting, i'th heap arena will be compacted | 145 // If compacting, i'th heap arena will be compacted |
| 158 // if corresponding bit is set. Indexes are in | 146 // if corresponding bit is set. Indexes are in |
| 159 // the range of BlinkGC::ArenaIndices. | 147 // the range of BlinkGC::ArenaIndices. |
| 160 unsigned m_compactableArenas; | 148 unsigned m_compactableArenas; |
| 161 | 149 |
| 162 // Stats, number of (complete) pages freed/decommitted + | 150 // Stats, number of (complete) pages freed/decommitted + |
| 163 // bytes freed (which will include partial pages.) | 151 // bytes freed (which will include partial pages.) |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 #if DEBUG_HEAP_FREELIST == 2 | 184 #if DEBUG_HEAP_FREELIST == 2 |
| 197 #define LOG_HEAP_FREELIST_VERBOSE(msg, ...) \ | 185 #define LOG_HEAP_FREELIST_VERBOSE(msg, ...) \ |
| 198 LOG_HEAP_COMPACTION_INTERNAL(msg, ##__VA_ARGS__) | 186 LOG_HEAP_COMPACTION_INTERNAL(msg, ##__VA_ARGS__) |
| 199 #else | 187 #else |
| 200 #define LOG_HEAP_FREELIST_VERBOSE(msg, ...) \ | 188 #define LOG_HEAP_FREELIST_VERBOSE(msg, ...) \ |
| 201 do { \ | 189 do { \ |
| 202 } while (0) | 190 } while (0) |
| 203 #endif | 191 #endif |
| 204 | 192 |
| 205 #endif // HeapCompact_h | 193 #endif // HeapCompact_h |
| OLD | NEW |