Update comments in the global handles interface.

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

R=antonm@chromium.org

Review URL: http://codereview.chromium.org/7056068

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@8188 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
vitalyr@chromium.org 2011-06-06 16:18:59 +00:00
parent 37eb9b3031
commit da40f3da1d
2 changed files with 35 additions and 30 deletions

View File

@ -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()) {

View File

@ -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.