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

Unified Diff: src/heap/spaces.cc

Issue 2377513007: [heap] Decouple SpaceIterator from ObjectIterator. (Closed)
Patch Set: rebase 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
« no previous file with comments | « 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 1879e0d44e7eb8b0a7039f37ce701307ba995589..a274fddf45d5b8fd2d31578ccc07bb416752e9e2 100644
--- a/src/heap/spaces.cc
+++ b/src/heap/spaces.cc
@@ -1431,6 +1431,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
@@ -1826,6 +1830,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).
@@ -2119,6 +2127,12 @@ void NewSpace::SealIntermediateGeneration() {
}
}
+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() {}
#endif
@@ -3170,6 +3184,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
« no previous file with comments | « src/heap/spaces.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698