Index: src/heap/heap.cc |
diff --git a/src/heap/heap.cc b/src/heap/heap.cc |
index ef00aa07f0232732b4445522235de4854fc2d59a..0648b02ea0bd5b5eaa14bde177a6770586470a30 100644 |
--- a/src/heap/heap.cc |
+++ b/src/heap/heap.cc |
@@ -1695,6 +1695,16 @@ void Heap::Scavenge() { |
new_space_front = DoScavenge(&scavenge_visitor, new_space_front); |
} |
+ { |
+ // Copy objects marked black or grey by MarkCompact collector. |
Hannes Payer (out of office)
2016/05/20 07:34:41
Scavenge objects...
Marcel Hlopko
2016/05/20 14:31:41
Done.
|
+ TRACE_GC(tracer(), |
+ GCTracer::Scope::SCAVENGER_OBJECTS_MARKED_BY_MARK_COMPACT); |
+ if (incremental_marking()->IsMarking()) { |
+ IterateMarkedForScavenger(&scavenge_visitor); |
+ new_space_front = DoScavenge(&scavenge_visitor, new_space_front); |
+ } |
+ } |
+ |
if (FLAG_scavenge_reclaim_unmodified_objects) { |
isolate()->global_handles()->MarkNewSpaceWeakUnmodifiedObjectsPending( |
&IsUnscavengedHeapObject); |
@@ -3052,6 +3062,7 @@ void Heap::CreateFillerObjectAt(Address addr, int size, |
if (mode == ClearRecordedSlots::kYes) { |
ClearRecordedSlotRange(addr, addr + size); |
} |
+ |
// At this point, we may be deserializing the heap from a snapshot, and |
// none of the maps have been created yet and are NULL. |
DCHECK((filler->map() == NULL && !deserialization_complete_) || |
@@ -4840,6 +4851,20 @@ void Heap::IterateStrongRoots(ObjectVisitor* v, VisitMode mode) { |
// checking of the sync flag in the snapshot would fail. |
} |
+void Heap::IterateMarkedForScavenger(ObjectVisitor* visitor) { |
+ NewSpacePageIterator it(new_space_.from_space()); |
+ while (it.has_next()) { |
+ Page* page = it.next(); |
+ LiveObjectIterator<kAllLiveObjects> it(page); |
+ Object* object = nullptr; |
+ while ((object = it.Next()) != nullptr) { |
+ if (object->IsHeapObject()) { |
+ DCHECK(IsUnscavengedHeapObject(this, &object)); |
+ visitor->VisitPointer(&object); |
+ } |
+ } |
+ } |
+} |
// TODO(1236194): Since the heap size is configurable on the command line |
// and through the API, we should gracefully handle the case that the heap |