Revision: 8188
Author:   [email protected]
Date:     Mon Jun  6 09:18:59 2011
Log:      Update comments in the global handles interface.

(I also reordered functions in the .cc file to match the order in the
.h file.)

[email protected]

Review URL: http://codereview.chromium.org/7056068
http://code.google.com/p/v8/source/detail?r=8188

Modified:
 /branches/bleeding_edge/src/global-handles.cc
 /branches/bleeding_edge/src/global-handles.h

=======================================
--- /branches/bleeding_edge/src/global-handles.cc       Mon Jun  6 08:23:04 2011
+++ /branches/bleeding_edge/src/global-handles.cc       Mon Jun  6 09:18:59 2011
@@ -465,17 +465,6 @@
if (it.node()->IsWeakRetainer()) v->VisitPointer(it.node()->location());
   }
 }
-
-
-void GlobalHandles::IterateNewSpaceWeakIndependentRoots(ObjectVisitor* v) {
-  for (int i = 0; i < new_space_nodes_.length(); ++i) {
-    Node* node = new_space_nodes_[i];
-    ASSERT(node->is_in_new_space_list());
-    if (node->is_independent() && node->IsWeakRetainer()) {
-      v->VisitPointer(node->location());
-    }
-  }
-}


 void GlobalHandles::IterateWeakRoots(WeakReferenceGuest f,
@@ -495,6 +484,17 @@
     }
   }
 }
+
+
+void GlobalHandles::IterateNewSpaceStrongAndDependentRoots(ObjectVisitor* v) {
+  for (int i = 0; i < new_space_nodes_.length(); ++i) {
+    Node* node = new_space_nodes_[i];
+    if (node->IsStrongRetainer() ||
+        (node->IsWeakRetainer() && !node->is_independent())) {
+      v->VisitPointer(node->location());
+    }
+  }
+}


 void GlobalHandles::IdentifyNewSpaceWeakIndependentHandles(
@@ -508,6 +508,17 @@
     }
   }
 }
+
+
+void GlobalHandles::IterateNewSpaceWeakIndependentRoots(ObjectVisitor* v) {
+  for (int i = 0; i < new_space_nodes_.length(); ++i) {
+    Node* node = new_space_nodes_[i];
+    ASSERT(node->is_in_new_space_list());
+    if (node->is_independent() && node->IsWeakRetainer()) {
+      v->VisitPointer(node->location());
+    }
+  }
+}


 bool GlobalHandles::PostGarbageCollectionProcessing(
@@ -584,17 +595,6 @@
     }
   }
 }
-
-
-void GlobalHandles::IterateNewSpaceStrongAndDependentRoots(ObjectVisitor* v) {
-  for (int i = 0; i < new_space_nodes_.length(); ++i) {
-    Node* node = new_space_nodes_[i];
-    if (node->IsStrongRetainer() ||
-        (node->IsWeakRetainer() && !node->is_independent())) {
-      v->VisitPointer(node->location());
-    }
-  }
-}


 void GlobalHandles::IterateAllRootsWithClassIds(ObjectVisitor* v) {
=======================================
--- /branches/bleeding_edge/src/global-handles.h        Mon Jun  6 08:23:04 2011
+++ /branches/bleeding_edge/src/global-handles.h        Mon Jun  6 09:18:59 2011
@@ -162,9 +162,6 @@
   // Iterates over all strong handles.
   void IterateStrongRoots(ObjectVisitor* v);

-  // Iterates over all strong and dependent handles.
-  void IterateNewSpaceStrongAndDependentRoots(ObjectVisitor* v);
-
   // Iterates over all handles.
   void IterateAllRoots(ObjectVisitor* v);

@@ -174,9 +171,6 @@
   // Iterates over all weak roots in heap.
   void IterateWeakRoots(ObjectVisitor* v);

-  // Iterates over all weak independent roots in heap.
-  void IterateNewSpaceWeakIndependentRoots(ObjectVisitor* v);
-
   // Iterates over weak roots that are bound to a given callback.
   void IterateWeakRoots(WeakReferenceGuest f,
                         WeakReferenceCallback callback);
@@ -185,10 +179,21 @@
   // them as pending.
   void IdentifyWeakHandles(WeakSlotCallback f);

- // Find all weak independent handles satisfying the callback predicate, mark
-  // them as pending.
+  // NOTE: Three ...NewSpace... functions below are used during
+  // scavenge collections and iterate over sets of handles that are
+  // guaranteed to contain all handles holding new space objects (but
+  // may also include old space objects).
+
+  // Iterates over strong and dependent handles. See the node above.
+  void IterateNewSpaceStrongAndDependentRoots(ObjectVisitor* v);
+
+  // Finds weak independent handles satisfying the callback predicate
+  // and marks them as pending. See the note above.
   void IdentifyNewSpaceWeakIndependentHandles(WeakSlotCallbackWithHeap f);

+  // Iterates over weak independent handles. See the note above.
+  void IterateNewSpaceWeakIndependentRoots(ObjectVisitor* v);
+
   // Add an object group.
   // Should be only used in GC callback function before a collection.
   // All groups are destroyed after a mark-compact collection.

--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to