Index: src/heap/mark-compact.cc |
diff --git a/src/heap/mark-compact.cc b/src/heap/mark-compact.cc |
index e9d5332aa34d8ad2f100aa34bba0f2a74510d575..279174b3b96e2746619bb84ed65ba42066dc8eed 100644 |
--- a/src/heap/mark-compact.cc |
+++ b/src/heap/mark-compact.cc |
@@ -1617,7 +1617,9 @@ class MarkCompactCollector::EvacuateNewSpaceVisitor final |
SlotsBuffer** evacuation_slots_buffer) |
: EvacuateVisitorBase(heap, evacuation_slots_buffer), |
buffer_(LocalAllocationBuffer::InvalidBuffer()), |
- space_to_allocate_(NEW_SPACE) {} |
+ space_to_allocate_(NEW_SPACE), |
+ promoted_size_(0), |
+ semispace_copied_size_(0) {} |
bool Visit(HeapObject* object) override { |
Heap::UpdateAllocationSiteFeedback(object, Heap::RECORD_SCRATCHPAD_SLOT); |
@@ -1630,7 +1632,7 @@ class MarkCompactCollector::EvacuateNewSpaceVisitor final |
heap_->array_buffer_tracker()->Promote( |
JSArrayBuffer::cast(target_object)); |
} |
- heap_->IncrementPromotedObjectsSize(size); |
+ promoted_size_ += size; |
return true; |
} |
HeapObject* target = nullptr; |
@@ -1641,10 +1643,13 @@ class MarkCompactCollector::EvacuateNewSpaceVisitor final |
if (V8_UNLIKELY(target->IsJSArrayBuffer())) { |
heap_->array_buffer_tracker()->MarkLive(JSArrayBuffer::cast(target)); |
} |
- heap_->IncrementSemiSpaceCopiedObjectSize(size); |
+ semispace_copied_size_ += size; |
return true; |
} |
+ intptr_t promoted_size() { return promoted_size_; } |
+ intptr_t semispace_copied_size() { return semispace_copied_size_; } |
+ |
private: |
enum NewSpaceAllocationMode { |
kNonstickyBailoutOldSpace, |
@@ -1742,6 +1747,8 @@ class MarkCompactCollector::EvacuateNewSpaceVisitor final |
LocalAllocationBuffer buffer_; |
AllocationSpace space_to_allocate_; |
+ intptr_t promoted_size_; |
+ intptr_t semispace_copied_size_; |
}; |
@@ -3096,23 +3103,34 @@ void MarkCompactCollector::EvacuateNewSpace() { |
new_space->Flip(); |
new_space->ResetAllocationInfo(); |
- int survivors_size = 0; |
- |
// First pass: traverse all objects in inactive semispace, remove marks, |
// migrate live objects and write forwarding addresses. This stage puts |
// new entries in the store buffer and may cause some pages to be marked |
// scan-on-scavenge. |
+#ifdef DEBUG |
+ int survivors_size = 0; |
+#endif // DEBUG |
NewSpacePageIterator it(from_bottom, from_top); |
EvacuateNewSpaceVisitor new_space_visitor(heap(), &migration_slots_buffer_); |
while (it.has_next()) { |
NewSpacePage* p = it.next(); |
+#ifdef DEBUG |
survivors_size += p->LiveBytes(); |
+#endif // DEBUG |
bool ok = VisitLiveObjects(p, &new_space_visitor, kClearMarkbits); |
USE(ok); |
DCHECK(ok); |
} |
+ DCHECK_EQ(survivors_size, new_space_visitor.promoted_size() + |
Michael Lippautz
2016/01/04 16:43:15
In theory we could remove this check (and the DEBU
Hannes Payer (out of office)
2016/01/04 17:30:45
We could make that CHECK part of verify new_space.
Michael Lippautz
2016/01/04 20:12:15
Moved the CHECK to a sub-part of VerifyMarking. (V
|
+ new_space_visitor.semispace_copied_size()); |
- heap_->IncrementYoungSurvivorsCounter(survivors_size); |
+ heap_->IncrementPromotedObjectsSize( |
+ static_cast<int>(new_space_visitor.promoted_size())); |
+ heap_->IncrementSemiSpaceCopiedObjectSize( |
+ static_cast<int>(new_space_visitor.semispace_copied_size())); |
+ heap_->IncrementYoungSurvivorsCounter( |
+ static_cast<int>(new_space_visitor.promoted_size()) + |
+ static_cast<int>(new_space_visitor.semispace_copied_size())); |
new_space->set_age_mark(new_space->top()); |
} |