| 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 "platform/wtf/DataLog.h" | 10 #include "platform/wtf/DataLog.h" |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 | 104 |
| 105 // Notify heap compaction that object at |from| has been relocated to.. |to|. | 105 // Notify heap compaction that object at |from| has been relocated to.. |to|. |
| 106 // (Called by the sweep compaction pass.) | 106 // (Called by the sweep compaction pass.) |
| 107 void Relocate(Address from, Address to); | 107 void Relocate(Address from, Address to); |
| 108 | 108 |
| 109 // For unit testing only: arrange for a compaction GC to be triggered | 109 // For unit testing only: arrange for a compaction GC to be triggered |
| 110 // next time a non-conservative GC is run. Sets the compact-next flag | 110 // next time a non-conservative GC is run. Sets the compact-next flag |
| 111 // to the new value, returning old. | 111 // to the new value, returning old. |
| 112 static bool ScheduleCompactionGCForTesting(bool); | 112 static bool ScheduleCompactionGCForTesting(bool); |
| 113 | 113 |
| 114 // Test-only: verify that one or more of the vector arenas are |
| 115 // in the process of being compacted. |
| 116 bool IsCompactingVectorArenas() { |
| 117 for (int i = BlinkGC::kVector1ArenaIndex; i <= BlinkGC::kVector4ArenaIndex; |
| 118 ++i) { |
| 119 if (IsCompactingArena(i)) |
| 120 return true; |
| 121 } |
| 122 return false; |
| 123 } |
| 124 |
| 114 private: | 125 private: |
| 115 class MovableObjectFixups; | 126 class MovableObjectFixups; |
| 116 | 127 |
| 117 HeapCompact(); | 128 HeapCompact(); |
| 118 | 129 |
| 119 // Sample the amount of fragmentation and heap memory currently residing | 130 // Sample the amount of fragmentation and heap memory currently residing |
| 120 // on the freelists of the arenas we're able to compact. The computed | 131 // on the freelists of the arenas we're able to compact. The computed |
| 121 // numbers will be subsequently used to determine if a heap compaction | 132 // numbers will be subsequently used to determine if a heap compaction |
| 122 // is on order (shouldCompact().) | 133 // is on order (shouldCompact().) |
| 123 void UpdateHeapResidency(ThreadState*); | 134 void UpdateHeapResidency(ThreadState*); |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 #if DEBUG_HEAP_FREELIST == 2 | 195 #if DEBUG_HEAP_FREELIST == 2 |
| 185 #define LOG_HEAP_FREELIST_VERBOSE(msg, ...) \ | 196 #define LOG_HEAP_FREELIST_VERBOSE(msg, ...) \ |
| 186 LOG_HEAP_COMPACTION_INTERNAL(msg, ##__VA_ARGS__) | 197 LOG_HEAP_COMPACTION_INTERNAL(msg, ##__VA_ARGS__) |
| 187 #else | 198 #else |
| 188 #define LOG_HEAP_FREELIST_VERBOSE(msg, ...) \ | 199 #define LOG_HEAP_FREELIST_VERBOSE(msg, ...) \ |
| 189 do { \ | 200 do { \ |
| 190 } while (0) | 201 } while (0) |
| 191 #endif | 202 #endif |
| 192 | 203 |
| 193 #endif // HeapCompact_h | 204 #endif // HeapCompact_h |
| OLD | NEW |