Index: src/mark-compact.cc |
diff --git a/src/mark-compact.cc b/src/mark-compact.cc |
index be70dc34d12c9447793b17e2f4453f9e4da8ae37..77675695b0d4226cfe0368fbcd62197c2425b3ff 100644 |
--- a/src/mark-compact.cc |
+++ b/src/mark-compact.cc |
@@ -71,14 +71,22 @@ MarkCompactCollector::MarkCompactCollector() : // NOLINT |
encountered_weak_maps_(NULL) { } |
-#ifdef DEBUG |
+// bool g_unmarked = false; |
class VerifyMarkingVisitor: public ObjectVisitor { |
public: |
void VisitPointers(Object** start, Object** end) { |
for (Object** current = start; current < end; current++) { |
if ((*current)->IsHeapObject()) { |
HeapObject* object = HeapObject::cast(*current); |
- ASSERT(HEAP->mark_compact_collector()->IsMarked(object)); |
+ /* |
mvstanton1
2012/10/11 12:22:45
debugging...will revert.
|
+ bool isMarked = HEAP->mark_compact_collector()->IsMarked(object); |
+ if(!isMarked) { |
+ printf("Found unmarked object at %p\n",(void *) current); |
+ object->Print(); |
+ g_unmarked = true; |
+ } |
+ */ |
+ CHECK(HEAP->mark_compact_collector()->IsMarked(object)); |
} |
} |
} |
@@ -95,8 +103,15 @@ static void VerifyMarking(Address bottom, Address top) { |
current += kPointerSize) { |
object = HeapObject::FromAddress(current); |
if (MarkCompactCollector::IsMarked(object)) { |
- ASSERT(current >= next_object_must_be_here_or_later); |
+ CHECK(current >= next_object_must_be_here_or_later); |
object->Iterate(&visitor); |
+ /* |
+ if(g_unmarked) { |
+ printf("The parent object is at %p\n",(void *) current); |
mvstanton1
2012/10/11 12:22:45
same here
|
+ object->Print(); |
+ g_unmarked = false; |
+ } |
+ */ |
next_object_must_be_here_or_later = current + object->Size(); |
} |
} |
@@ -108,14 +123,18 @@ static void VerifyMarking(NewSpace* space) { |
NewSpacePageIterator it(space->bottom(), end); |
// The bottom position is at the start of its page. Allows us to use |
// page->area_start() as start of range on all pages. |
- ASSERT_EQ(space->bottom(), |
+ CHECK_EQ(space->bottom(), |
NewSpacePage::FromAddress(space->bottom())->area_start()); |
+ |
+ // printf("VerifyMarking of NewSpace\n"); |
mvstanton1
2012/10/11 12:22:45
and here!
|
+ // printf("top: %p\t bottom: %p\n",space->top(),space->bottom()); |
while (it.has_next()) { |
NewSpacePage* page = it.next(); |
Address limit = it.has_next() ? page->area_end() : end; |
- ASSERT(limit == end || !page->Contains(end)); |
+ CHECK(limit == end || !page->Contains(end)); |
VerifyMarking(page->area_start(), limit); |
} |
+ // printf("End VerifyMarking of NewSpace\n"); |
} |
@@ -173,7 +192,7 @@ static void VerifyEvacuation(Address bottom, Address top) { |
current += kPointerSize) { |
object = HeapObject::FromAddress(current); |
if (MarkCompactCollector::IsMarked(object)) { |
- ASSERT(current >= next_object_must_be_here_or_later); |
+ CHECK(current >= next_object_must_be_here_or_later); |
object->Iterate(&visitor); |
next_object_must_be_here_or_later = current + object->Size(); |
} |
@@ -189,7 +208,7 @@ static void VerifyEvacuation(NewSpace* space) { |
NewSpacePage* page = it.next(); |
Address current = page->area_start(); |
Address limit = it.has_next() ? page->area_end() : space->top(); |
- ASSERT(limit == space->top() || !page->Contains(space->top())); |
+ CHECK(limit == space->top() || !page->Contains(space->top())); |
while (current < limit) { |
HeapObject* object = HeapObject::FromAddress(current); |
object->Iterate(&visitor); |
@@ -222,7 +241,7 @@ static void VerifyEvacuation(Heap* heap) { |
heap->IterateStrongRoots(&visitor, VISIT_ALL); |
} |
- |
+#ifdef DEBUG |
class VerifyNativeContextSeparationVisitor: public ObjectVisitor { |
public: |
VerifyNativeContextSeparationVisitor() : current_native_context_(NULL) {} |
@@ -384,11 +403,9 @@ void MarkCompactCollector::CollectGarbage() { |
ClearWeakMaps(); |
-#ifdef DEBUG |
if (FLAG_verify_heap) { |
VerifyMarking(heap_); |
} |
-#endif |
SweepSpaces(); |
@@ -406,7 +423,6 @@ void MarkCompactCollector::CollectGarbage() { |
} |
-#ifdef DEBUG |
void MarkCompactCollector::VerifyMarkbitsAreClean(PagedSpace* space) { |
PageIterator it(space); |
@@ -438,11 +454,10 @@ void MarkCompactCollector::VerifyMarkbitsAreClean() { |
LargeObjectIterator it(heap_->lo_space()); |
for (HeapObject* obj = it.Next(); obj != NULL; obj = it.Next()) { |
MarkBit mark_bit = Marking::MarkBitFrom(obj); |
- ASSERT(Marking::IsWhite(mark_bit)); |
- ASSERT_EQ(0, Page::FromAddress(obj->address())->LiveBytes()); |
+ CHECK(Marking::IsWhite(mark_bit)); |
+ CHECK_EQ(0, Page::FromAddress(obj->address())->LiveBytes()); |
} |
} |
-#endif |
static void ClearMarkbitsInPagedSpace(PagedSpace* space) { |
@@ -804,11 +819,9 @@ void MarkCompactCollector::Prepare(GCTracer* tracer) { |
space->PrepareForMarkCompact(); |
} |
-#ifdef DEBUG |
if (!was_marked_incrementally_ && FLAG_verify_heap) { |
VerifyMarkbitsAreClean(); |
} |
-#endif |
} |
@@ -3349,11 +3362,9 @@ void MarkCompactCollector::EvacuateNewSpaceAndCandidates() { |
heap_->isolate()->inner_pointer_to_code_cache()->Flush(); |
-#ifdef DEBUG |
if (FLAG_verify_heap) { |
VerifyEvacuation(heap_); |
} |
-#endif |
slots_buffer_allocator_.DeallocateChain(&migration_slots_buffer_); |
ASSERT(migration_slots_buffer_ == NULL); |