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

Unified Diff: src/heap/spaces.cc

Issue 2377513007: [heap] Decouple SpaceIterator from ObjectIterator. (Closed)
Patch Set: Created 4 years, 3 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 side-by-side diff with in-line comments
Download patch
« src/heap/spaces.h ('K') | « src/heap/spaces.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/heap/spaces.cc
diff --git a/src/heap/spaces.cc b/src/heap/spaces.cc
index 8982a2953273abbe35993b57ab63ee43d42ae0d7..467f0c921602ba13c7e751ceecb1aa4b684ade59 100644
--- a/src/heap/spaces.cc
+++ b/src/heap/spaces.cc
@@ -1430,6 +1430,10 @@ void PagedSpace::ReleasePage(Page* page) {
heap()->memory_allocator()->Free<MemoryAllocator::kPreFreeAndQueue>(page);
}
+std::unique_ptr<ObjectIterator> PagedSpace::GetObjectIterator() {
+ return std::unique_ptr<ObjectIterator>(new HeapObjectIterator(this));
+}
+
#ifdef DEBUG
void PagedSpace::Print() {}
#endif
@@ -1816,6 +1820,10 @@ void NewSpace::InlineAllocationStep(Address top, Address new_top,
}
}
+std::unique_ptr<ObjectIterator> NewSpace::GetObjectIterator() {
+ return std::unique_ptr<ObjectIterator>(new SemiSpaceIterator(this));
+}
+
#ifdef VERIFY_HEAP
// We do not use the SemiSpaceIterator because verification doesn't assume
// that it works (it depends on the invariants we are checking).
@@ -2089,6 +2097,11 @@ void SemiSpace::set_age_mark(Address mark) {
}
}
+std::unique_ptr<ObjectIterator> SemiSpace::GetObjectIterator() {
+ // Use the NewSpace::NewObjectIterator to iterate the ToSpace.
+ UNREACHABLE();
+ return std::unique_ptr<ObjectIterator>();
+}
#ifdef DEBUG
void SemiSpace::Print() {}
@@ -3141,6 +3154,9 @@ bool LargeObjectSpace::Contains(HeapObject* object) {
return owned;
}
+std::unique_ptr<ObjectIterator> LargeObjectSpace::GetObjectIterator() {
+ return std::unique_ptr<ObjectIterator>(new LargeObjectIterator(this));
+}
#ifdef VERIFY_HEAP
// We do not assume that the large object iterator works, because it depends
« src/heap/spaces.h ('K') | « src/heap/spaces.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698