Reviewers: antonm,
Description:
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]
Please review this at http://codereview.chromium.org/7056068/
SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge
Affected files:
M src/global-handles.h
M src/global-handles.cc
Index: src/global-handles.cc
diff --git a/src/global-handles.cc b/src/global-handles.cc
index
c96dd3cd8f32985c9bd42a7f81dce969a06a9729..87066faeaf64950a8349da385e36cd206b23bea6
100644
--- a/src/global-handles.cc
+++ b/src/global-handles.cc
@@ -467,17 +467,6 @@ void GlobalHandles::IterateWeakRoots(ObjectVisitor* v)
{
}
-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,
WeakReferenceCallback callback) {
for (NodeIterator it(this); !it.done(); it.Advance()) {
@@ -497,6 +486,17 @@ void
GlobalHandles::IdentifyWeakHandles(WeakSlotCallback f) {
}
+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(
WeakSlotCallbackWithHeap f) {
for (int i = 0; i < new_space_nodes_.length(); ++i) {
@@ -510,6 +510,17 @@ void
GlobalHandles::IdentifyNewSpaceWeakIndependentHandles(
}
+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(
GarbageCollector collector) {
// Process weak global handle callbacks. This must be done after the
@@ -586,17 +597,6 @@ void GlobalHandles::IterateAllRoots(ObjectVisitor* v) {
}
-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) {
for (NodeIterator it(this); !it.done(); it.Advance()) {
if (it.node()->has_wrapper_class_id() && it.node()->IsRetainer()) {
Index: src/global-handles.h
diff --git a/src/global-handles.h b/src/global-handles.h
index
9f3143f288d4841c03a09c8af16d221a48b64224..153d4dac1a2b1e7617d82359e64bdfbe3d704347
100644
--- a/src/global-handles.h
+++ b/src/global-handles.h
@@ -162,9 +162,6 @@ class GlobalHandles {
// 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 @@ class GlobalHandles {
// 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 @@ class GlobalHandles {
// 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