| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project 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 #include "src/heap/mark-compact.h" | 5 #include "src/heap/mark-compact.h" |
| 6 | 6 |
| 7 #include "src/base/atomicops.h" | 7 #include "src/base/atomicops.h" |
| 8 #include "src/base/bits.h" | 8 #include "src/base/bits.h" |
| 9 #include "src/base/sys-info.h" | 9 #include "src/base/sys-info.h" |
| 10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
| (...skipping 2248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2259 | 2259 |
| 2260 private: | 2260 private: |
| 2261 ObjectStatsCollector live_collector_; | 2261 ObjectStatsCollector live_collector_; |
| 2262 ObjectStatsCollector dead_collector_; | 2262 ObjectStatsCollector dead_collector_; |
| 2263 }; | 2263 }; |
| 2264 | 2264 |
| 2265 void MarkCompactCollector::VisitAllObjects(HeapObjectVisitor* visitor) { | 2265 void MarkCompactCollector::VisitAllObjects(HeapObjectVisitor* visitor) { |
| 2266 SpaceIterator space_it(heap()); | 2266 SpaceIterator space_it(heap()); |
| 2267 HeapObject* obj = nullptr; | 2267 HeapObject* obj = nullptr; |
| 2268 while (space_it.has_next()) { | 2268 while (space_it.has_next()) { |
| 2269 ObjectIterator* it = space_it.next(); | 2269 std::unique_ptr<ObjectIterator> it(space_it.next()->GetObjectIterator()); |
| 2270 while ((obj = it->Next()) != nullptr) { | 2270 ObjectIterator* obj_it = it.get(); |
| 2271 while ((obj = obj_it->Next()) != nullptr) { |
| 2271 visitor->Visit(obj); | 2272 visitor->Visit(obj); |
| 2272 } | 2273 } |
| 2273 } | 2274 } |
| 2274 } | 2275 } |
| 2275 | 2276 |
| 2276 void MarkCompactCollector::RecordObjectStats() { | 2277 void MarkCompactCollector::RecordObjectStats() { |
| 2277 if (FLAG_track_gc_object_stats) { | 2278 if (FLAG_track_gc_object_stats) { |
| 2278 ObjectStatsVisitor visitor(heap(), heap()->live_object_stats_, | 2279 ObjectStatsVisitor visitor(heap(), heap()->live_object_stats_, |
| 2279 heap()->dead_object_stats_); | 2280 heap()->dead_object_stats_); |
| 2280 VisitAllObjects(&visitor); | 2281 VisitAllObjects(&visitor); |
| (...skipping 1761 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4042 // The target is always in old space, we don't have to record the slot in | 4043 // The target is always in old space, we don't have to record the slot in |
| 4043 // the old-to-new remembered set. | 4044 // the old-to-new remembered set. |
| 4044 DCHECK(!heap()->InNewSpace(target)); | 4045 DCHECK(!heap()->InNewSpace(target)); |
| 4045 RecordRelocSlot(host, &rinfo, target); | 4046 RecordRelocSlot(host, &rinfo, target); |
| 4046 } | 4047 } |
| 4047 } | 4048 } |
| 4048 } | 4049 } |
| 4049 | 4050 |
| 4050 } // namespace internal | 4051 } // namespace internal |
| 4051 } // namespace v8 | 4052 } // namespace v8 |
| OLD | NEW |