Fix for bug 584048 (Clean up cycle collection code) - add some edge names. r=bent.
authorPeter Van der Beken <peterv@propagandism.org>
Fri, 27 Feb 2009 15:48:25 +0100
changeset 67684 ed2f1691ff2f0606c8c8f752af13ed7c62be0b1b
parent 67683 b13ba30a481053d7190cb32ee172cafe7a7e9e2f
child 67685 5c7b908fc1ccef45c947b2b1495d852d0fc106f7
push id1
push userroot
push dateTue, 26 Apr 2011 22:38:44 +0000
treeherdermozilla-beta@bfdb6e623a36 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbent
bugs584048
milestone2.2a1pre
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Fix for bug 584048 (Clean up cycle collection code) - add some edge names. r=bent.
js/src/xpconnect/src/xpcwrappednative.cpp
--- a/js/src/xpconnect/src/xpcwrappednative.cpp
+++ b/js/src/xpconnect/src/xpcwrappednative.cpp
@@ -130,28 +130,30 @@ NS_CYCLE_COLLECTION_CLASSNAME(XPCWrapped
         // If our refcount is <= 1, our reference to the flat JS object is
         // considered "weak", and we're *not* going to traverse it.
         //
         // This reasoning is in line with the slightly confusing lifecycle rules
         // for XPCWrappedNatives, described in a larger comment below and also
         // on our wiki at http://wiki.mozilla.org/XPConnect_object_wrapping 
 
         JSObject *obj = tmp->GetFlatJSObjectPreserveColor();
+        NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mFlatJSObject");
         cb.NoteScriptChild(nsIProgrammingLanguage::JAVASCRIPT, obj);
     }
 
     XPCJSRuntime *rt = tmp->GetRuntime();
     TraverseExpandoObjectClosure closure = {
          rt->GetXPConnect()->GetCycleCollectionContext()->GetJSContext(),
          tmp,
          cb
     };
     rt->GetCompartmentMap().EnumerateRead(TraverseExpandoObjects, &closure);
 
     // XPCWrappedNative keeps its native object alive.
+    NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mIdentity");
     cb.NoteXPCOMChild(tmp->GetIdentityObject());
 
     tmp->NoteTearoffs(cb);
 
     return NS_OK;
 }
 
 void
@@ -166,16 +168,17 @@ XPCWrappedNative::NoteTearoffs(nsCycleCo
     for(chunk = &mFirstChunk; chunk; chunk = chunk->mNextChunk)
     {
         XPCWrappedNativeTearOff* to = chunk->mTearOffs;
         for(int i = XPC_WRAPPED_NATIVE_TEAROFFS_PER_CHUNK-1; i >= 0; i--, to++)
         {
             JSObject* jso = to->GetJSObject();
             if(!jso)
             {
+                NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "tearoff's mNative");
                 cb.NoteXPCOMChild(to->GetNative());
             }
         }
     }
 }
 
 #ifdef XPC_CHECK_CLASSINFO_CLAIMS
 static void DEBUG_CheckClassInfoClaims(XPCWrappedNative* wrapper);