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

Unified Diff: src/heap/spaces-inl.h

Issue 2094753002: [heap] Use PageIterator in HeapObjectIterator (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 6 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.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/heap/spaces-inl.h
diff --git a/src/heap/spaces-inl.h b/src/heap/spaces-inl.h
index f2dbd893ada22935a3169702e76e82d17ee7d9f3..dbf3ffff2aae74fcfe3b4db10fb77b65e49f36b3 100644
--- a/src/heap/spaces-inl.h
+++ b/src/heap/spaces-inl.h
@@ -29,7 +29,8 @@ PageIteratorImpl<PAGE_TYPE> PageIteratorImpl<PAGE_TYPE>::operator++(int) {
}
NewSpacePageRange::NewSpacePageRange(Address start, Address limit)
- : start_(start), limit_(limit) {
+ : range_(Page::FromAddress(start),
+ Page::FromAllocationAreaAddress(limit)->next_page()) {
SemiSpace::AssertValidRange(start, limit);
}
@@ -70,25 +71,17 @@ HeapObject* SemiSpaceIterator::Next() {
return nullptr;
}
-
-HeapObject* SemiSpaceIterator::next_object() { return Next(); }
-
-
// -----------------------------------------------------------------------------
// HeapObjectIterator
HeapObject* HeapObjectIterator::Next() {
do {
HeapObject* next_obj = FromCurrentPage();
- if (next_obj != NULL) return next_obj;
+ if (next_obj != nullptr) return next_obj;
} while (AdvanceToNextPage());
- return NULL;
+ return nullptr;
}
-
-HeapObject* HeapObjectIterator::next_object() { return Next(); }
-
-
HeapObject* HeapObjectIterator::FromCurrentPage() {
while (cur_addr_ != cur_end_) {
if (cur_addr_ == space_->top() && cur_addr_ != space_->limit()) {
@@ -96,15 +89,9 @@ HeapObject* HeapObjectIterator::FromCurrentPage() {
continue;
}
HeapObject* obj = HeapObject::FromAddress(cur_addr_);
- int obj_size = obj->Size();
+ const int obj_size = obj->Size();
cur_addr_ += obj_size;
- DCHECK(cur_addr_ <= cur_end_);
- // TODO(hpayer): Remove the debugging code.
- if (cur_addr_ > cur_end_) {
- space_->heap()->isolate()->PushStackTraceAndDie(0xaaaaaaaa, obj, NULL,
- obj_size);
- }
-
+ DCHECK_LE(cur_addr_, cur_end_);
if (!obj->IsFiller()) {
if (obj->IsCode()) {
DCHECK_EQ(space_, space_->heap()->code_space());
@@ -115,7 +102,7 @@ HeapObject* HeapObjectIterator::FromCurrentPage() {
return obj;
}
}
- return NULL;
+ return nullptr;
}
// -----------------------------------------------------------------------------
« src/heap/spaces.h ('K') | « src/heap/spaces.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698