Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(495)

Unified Diff: src/heap.cc

Issue 11085015: Allow collection of DOM objects in minor GC cycles. (Closed) Base URL: git://github.com/v8/v8.git@master
Patch Set: Comments addressed Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« src/global-handles.cc ('K') | « src/heap.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/heap.cc
diff --git a/src/heap.cc b/src/heap.cc
index 0d2cc42402f4b3457b1d28340984069d452dbd7d..61d5a60353b5d75c85e099bb126372ede38f2b09 100644
--- a/src/heap.cc
+++ b/src/heap.cc
@@ -1331,6 +1331,14 @@ void Heap::Scavenge() {
scavenge_visitor.VisitPointer(BitCast<Object**>(&native_contexts_list_));
new_space_front = DoScavenge(&scavenge_visitor, new_space_front);
+
+ while (1) {
Michael Starzinger 2012/11/05 10:47:27 Can we rewrite this to not be an infinite loop? I
haraken 2012/11/05 12:42:07 Done.
+ if (!IterateObjectGroups(&scavenge_visitor))
+ break;
+ new_space_front = DoScavenge(&scavenge_visitor, new_space_front);
+ }
+ isolate()->global_handles()->RemoveObjectGroups();
+
isolate_->global_handles()->IdentifyNewSpaceWeakIndependentHandles(
&IsUnscavengedHeapObject);
isolate_->global_handles()->IterateNewSpaceWeakIndependentRoots(
@@ -1371,6 +1379,53 @@ void Heap::Scavenge() {
}
+bool Heap::IterateObjectGroups(ObjectVisitor* scavenge_visitor) {
haraken 2012/11/05 06:55:23 Note for review: The logic of this method is copie
Michael Starzinger 2012/11/05 10:47:27 Yes, I realized that. It would be cool to unify th
haraken 2012/11/05 12:42:07 Done.
+ 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;
+ }
+
+ // An object in the group is marked, so mark as grey all white heap
Michael Starzinger 2012/11/05 10:47:27 Can we drop the comment from this copy of the meth
haraken 2012/11/05 12:42:07 Done.
+ // objects in the group.
+ for (size_t j = 0; j < entry->length_; ++j) {
+ Object* object = *objects[j];
+ if (object->IsHeapObject()) {
+ scavenge_visitor->VisitPointer(&object);
+ changed = true;
+ }
+ }
+
+ // Once the entire group has been colored grey, set the object group
+ // to NULL so it won't be processed again.
Michael Starzinger 2012/11/05 10:47:27 Likewise.
haraken 2012/11/05 12:42:07 Done.
+ 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();
« src/global-handles.cc ('K') | « src/heap.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698