Reviewers: Michael Starzinger,
Description:
Ignore evacuation canditate pages when verifying spaces.
BUG=
Please review this at https://codereview.chromium.org/12529005/
SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge
Affected files:
M src/heap.cc
M src/mark-compact.cc
M src/spaces.h
M src/spaces.cc
Index: src/heap.cc
diff --git a/src/heap.cc b/src/heap.cc
index
4f85705fcdfe2d6aa5bf51372cb40e38e4e21cad..0f59cb290217a69bb93b4f60cce38ee06b98b41c
100644
--- a/src/heap.cc
+++ b/src/heap.cc
@@ -1131,16 +1131,16 @@ static void VerifyNonPointerSpacePointers() {
// do not expect them.
VerifyNonPointerSpacePointersVisitor v;
HeapObjectIterator code_it(HEAP->code_space());
- for (HeapObject* object = code_it.Next();
- object != NULL; object = code_it.Next())
+ for (HeapObject* object = code_it.NextIgnoreEvacuationCandidates();
+ object != NULL; object = code_it.NextIgnoreEvacuationCandidates())
object->Iterate(&v);
// The old data space was normally swept conservatively so that the
iterator
// doesn't work, so we normally skip the next bit.
if (!HEAP->old_data_space()->was_swept_conservatively()) {
HeapObjectIterator data_it(HEAP->old_data_space());
- for (HeapObject* object = data_it.Next();
- object != NULL; object = data_it.Next())
+ for (HeapObject* object = data_it.NextIgnoreEvacuationCandidates();
+ object != NULL; object = data_it.NextIgnoreEvacuationCandidates())
object->Iterate(&v);
}
}
Index: src/mark-compact.cc
diff --git a/src/mark-compact.cc b/src/mark-compact.cc
index
cbb9dfbff0cef15f00545fdd142e41dc9e18db49..1c2791d277f2ed42116281b56ea45bb6db6a3654
100644
--- a/src/mark-compact.cc
+++ b/src/mark-compact.cc
@@ -326,7 +326,9 @@ class VerifyNativeContextSeparationVisitor: public
ObjectVisitor {
static void VerifyNativeContextSeparation(Heap* heap) {
HeapObjectIterator it(heap->code_space());
- for (Object* object = it.Next(); object != NULL; object = it.Next()) {
+ for (Object* object = it.NextIgnoreEvacuationCandidates();
+ object != NULL;
+ object = it.NextIgnoreEvacuationCandidates()) {
VerifyNativeContextSeparationVisitor visitor;
Code::cast(object)->CodeIterateBody(&visitor);
}
@@ -482,9 +484,9 @@ void MarkCompactCollector::VerifyMarkbitsAreClean() {
void MarkCompactCollector::VerifyWeakEmbeddedMapsInOptimizedCode() {
HeapObjectIterator code_iterator(heap()->code_space());
- for (HeapObject* obj = code_iterator.Next();
+ for (HeapObject* obj = code_iterator.NextIgnoreEvacuationCandidates();
obj != NULL;
- obj = code_iterator.Next()) {
+ obj = code_iterator.NextIgnoreEvacuationCandidates()) {
Code* code = Code::cast(obj);
if (code->kind() != Code::OPTIMIZED_FUNCTION) continue;
if (code->marked_for_deoptimization()) continue;
@@ -495,9 +497,9 @@ void
MarkCompactCollector::VerifyWeakEmbeddedMapsInOptimizedCode() {
void MarkCompactCollector::VerifyOmittedPrototypeChecks() {
HeapObjectIterator iterator(heap()->map_space());
- for (HeapObject* obj = iterator.Next();
+ for (HeapObject* obj = iterator.NextIgnoreEvacuationCandidates();
obj != NULL;
- obj = iterator.Next()) {
+ obj = iterator.NextIgnoreEvacuationCandidates()) {
Map* map = Map::cast(obj);
map->VerifyOmittedPrototypeChecks();
}
Index: src/spaces.cc
diff --git a/src/spaces.cc b/src/spaces.cc
index
1861c5340391d50db9d7c2ac3e51ce6dd6f2d0da..a28720bff0527d4f6d4d69e3b8e8c4a323536372
100644
--- a/src/spaces.cc
+++ b/src/spaces.cc
@@ -100,14 +100,12 @@ void HeapObjectIterator::Initialize(PagedSpace* space,
// We have hit the end of the page and should advance to the next block of
// objects. This happens at the end of the page.
bool HeapObjectIterator::AdvanceToNextPage() {
- ASSERT(cur_addr_ == cur_end_);
if (page_mode_ == kOnePageOnly) return false;
Page* cur_page;
if (cur_addr_ == NULL) {
cur_page = space_->anchor();
} else {
cur_page = Page::FromAddress(cur_addr_ - 1);
- ASSERT(cur_addr_ == cur_page->area_end());
}
cur_page = cur_page->next_page();
if (cur_page == space_->anchor()) return false;
@@ -1104,7 +1102,9 @@ void PagedSpace::Verify(ObjectVisitor* visitor) {
Address end_of_previous_object = page->area_start();
Address top = page->area_end();
int black_size = 0;
- for (HeapObject* object = it.Next(); object != NULL; object =
it.Next()) {
+ for (HeapObject* object = it.NextIgnoreEvacuationCandidates();
+ object != NULL;
+ object = it.NextIgnoreEvacuationCandidates()) {
CHECK(end_of_previous_object <= object->address());
// The first word should be a map, and we expect all map pointers to
Index: src/spaces.h
diff --git a/src/spaces.h b/src/spaces.h
index
6ff3ee3694dccd769a61bbc35342b66a317342f7..a19dfd284491dfd52cd2a3f1006f92940c37ef34
100644
--- a/src/spaces.h
+++ b/src/spaces.h
@@ -1206,6 +1206,20 @@ class HeapObjectIterator: public ObjectIterator {
return NULL;
}
+ // Advance to the next object, skipping free spaces, evacuation
canditates,
+ // and other fillers and skipping the special garbage section of which
+ // there is one per space. Returns NULL when the iteration has ended.
+ inline HeapObject* NextIgnoreEvacuationCandidates() {
+ do {
+ if (cur_addr_ != 0 &&
+ !Page::FromAddress(cur_addr_ - 1)->IsEvacuationCandidate()) {
+ HeapObject* next_obj = FromCurrentPage();
+ if (next_obj != NULL) return next_obj;
+ }
+ } while (AdvanceToNextPage());
+ return NULL;
+ }
+
virtual HeapObject* next_object() {
return Next();
}
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.