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

Unified Diff: src/mark-compact.cc

Issue 6800003: Make object groups and implicit references a bit more lightweight. (Closed)
Patch Set: Created 9 years, 9 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
Index: src/mark-compact.cc
diff --git a/src/mark-compact.cc b/src/mark-compact.cc
index 73bf2f260bcfa0014cf3fa1f9a80a778a61c5213..96ed735df8a5c6f5b2831eb5da9057ff7e71ec0a 100644
--- a/src/mark-compact.cc
+++ b/src/mark-compact.cc
@@ -1217,13 +1217,14 @@ void MarkCompactCollector::MarkObjectGroups() {
List<ObjectGroup*>* object_groups =
heap()->isolate()->global_handles()->object_groups();
+ int last = 0;
for (int i = 0; i < object_groups->length(); i++) {
ObjectGroup* entry = object_groups->at(i);
- if (entry == NULL) continue;
+ ASSERT(entry != NULL);
- List<Object**>& objects = entry->objects_;
+ Object*** objects = entry->objects_;
bool group_marked = false;
- for (int j = 0; j < objects.length(); j++) {
+ for (size_t j = 0; j < entry->length_; j++) {
Object* object = *objects[j];
if (object->IsHeapObject() && HeapObject::cast(object)->IsMarked()) {
group_marked = true;
@@ -1231,21 +1232,24 @@ void MarkCompactCollector::MarkObjectGroups() {
}
}
- if (!group_marked) continue;
+ if (!group_marked) {
+ (*object_groups)[last++] = entry;
+ continue;
+ }
- // An object in the group is marked, so mark as gray all white heap
- // objects in the group.
- for (int j = 0; j < objects.length(); ++j) {
+ // An object in the group is marked, so mark all heap objects in
+ // the group.
+ for (size_t j = 0; j < entry->length_; ++j) {
if ((*objects[j])->IsHeapObject()) {
MarkObject(HeapObject::cast(*objects[j]));
}
}
- // Once the entire group has been colored gray, set the object group
- // to NULL so it won't be processed again.
- delete entry;
- object_groups->at(i) = NULL;
+ // Once the entire group has been marked, dispose it so it won't
+ // be processed again.
antonm 2011/04/06 11:01:48 nit: comment appears to be slightly incorrect: dis
Vitaly Repeshko 2011/04/06 19:11:01 Done.
+ entry->Dispose();
}
+ object_groups->Rewind(last);
}
@@ -1253,26 +1257,29 @@ void MarkCompactCollector::MarkImplicitRefGroups() {
List<ImplicitRefGroup*>* ref_groups =
heap()->isolate()->global_handles()->implicit_ref_groups();
+ int last = 0;
for (int i = 0; i < ref_groups->length(); i++) {
ImplicitRefGroup* entry = ref_groups->at(i);
- if (entry == NULL) continue;
+ ASSERT(entry != NULL);
- if (!entry->parent_->IsMarked()) continue;
+ if (!(*entry->parent_)->IsMarked()) {
+ (*ref_groups)[last++] = entry;
+ continue;
+ }
- List<Object**>& children = entry->children_;
- // A parent object is marked, so mark as gray all child white heap
- // objects.
- for (int j = 0; j < children.length(); ++j) {
+ Object*** children = entry->children_;
+ // A parent object is marked, so mark all child heap objects.
+ for (size_t j = 0; j < entry->length_; ++j) {
if ((*children[j])->IsHeapObject()) {
MarkObject(HeapObject::cast(*children[j]));
}
}
- // Once the entire group has been colored gray, set the group
- // to NULL so it won't be processed again.
- delete entry;
- ref_groups->at(i) = NULL;
+ // Once the entire group has been marked, dispose it so it won't
+ // be processed again.
antonm 2011/04/06 11:01:48 Ditto
Vitaly Repeshko 2011/04/06 19:11:01 Done.
+ entry->Dispose();
}
+ ref_groups->Rewind(last);
}
« src/global-handles.h ('K') | « src/global-handles.cc ('k') | src/profile-generator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698