Index: src/heap.cc |
diff --git a/src/heap.cc b/src/heap.cc |
index 468a01d6949bc2cdf20928dcb4eb33da3af36400..a9adb6338d601fe88129e04d507ddd9e1789de55 100644 |
--- a/src/heap.cc |
+++ b/src/heap.cc |
@@ -1337,6 +1337,12 @@ void Heap::Scavenge() { |
scavenge_visitor.VisitPointer(BitCast<Object**>(&native_contexts_list_)); |
new_space_front = DoScavenge(&scavenge_visitor, new_space_front); |
+ |
+ while (IterateObjectGroups(&scavenge_visitor)) { |
+ new_space_front = DoScavenge(&scavenge_visitor, new_space_front); |
+ } |
+ isolate()->global_handles()->RemoveObjectGroups(); |
+ |
isolate_->global_handles()->IdentifyNewSpaceWeakIndependentHandles( |
&IsUnscavengedHeapObject); |
isolate_->global_handles()->IterateNewSpaceWeakIndependentRoots( |
@@ -1377,6 +1383,51 @@ void Heap::Scavenge() { |
} |
+// TODO(mstarzinger): Unify this method with |
+// MarkCompactCollector::MarkObjectGroups(). |
+bool Heap::IterateObjectGroups(ObjectVisitor* scavenge_visitor) { |
+ List<ObjectGroup*>* object_groups = |
+ isolate()->global_handles()->object_groups(); |
+ |
+ int last = 0; |
+ bool changed = false; |
+ for (int i = 0; i < object_groups->length(); i++) { |
+ ObjectGroup* entry = object_groups->at(i); |
+ ASSERT(entry != NULL); |
+ |
+ Object*** objects = entry->objects_; |
+ bool group_marked = false; |
+ for (size_t j = 0; j < entry->length_; j++) { |
+ Object* object = *objects[j]; |
+ if (object->IsHeapObject()) { |
+ if (!IsUnscavengedHeapObject(this, &object)) { |
+ group_marked = true; |
+ break; |
+ } |
+ } |
+ } |
+ |
+ if (!group_marked) { |
+ (*object_groups)[last++] = entry; |
+ continue; |
+ } |
+ |
+ for (size_t j = 0; j < entry->length_; ++j) { |
+ Object* object = *objects[j]; |
+ if (object->IsHeapObject()) { |
+ scavenge_visitor->VisitPointer(&object); |
+ changed = true; |
+ } |
+ } |
+ |
+ entry->Dispose(); |
+ object_groups->at(i) = NULL; |
+ } |
+ object_groups->Rewind(last); |
+ return changed; |
+} |
+ |
+ |
String* Heap::UpdateNewSpaceReferenceInExternalStringTableEntry(Heap* heap, |
Object** p) { |
MapWord first_word = HeapObject::cast(*p)->map_word(); |