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

Side by Side Diff: src/heap/mark-compact.cc

Issue 2377513007: [heap] Decouple SpaceIterator from ObjectIterator. (Closed)
Patch Set: rebase Created 4 years, 2 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
« no previous file with comments | « src/heap/heap-inl.h ('k') | src/heap/spaces.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 // 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
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 1744 matching lines...) Expand 10 before | Expand all | Expand 10 after
4025 // The target is always in old space, we don't have to record the slot in 4026 // The target is always in old space, we don't have to record the slot in
4026 // the old-to-new remembered set. 4027 // the old-to-new remembered set.
4027 DCHECK(!heap()->InNewSpace(target)); 4028 DCHECK(!heap()->InNewSpace(target));
4028 RecordRelocSlot(host, &rinfo, target); 4029 RecordRelocSlot(host, &rinfo, target);
4029 } 4030 }
4030 } 4031 }
4031 } 4032 }
4032 4033
4033 } // namespace internal 4034 } // namespace internal
4034 } // namespace v8 4035 } // namespace v8
OLDNEW
« no previous file with comments | « src/heap/heap-inl.h ('k') | src/heap/spaces.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698