Back out debugging code for bug 500105.
authorPeter Van der Beken <peterv@propagandism.org>
Fri, 30 Jul 2010 11:57:19 +0200
changeset 48417 01877f113dab
parent 48416 db7e931c4410
child 48418 6f99979d11bf
push id14721
push userpvanderbeken@mozilla.com
push dateFri, 30 Jul 2010 13:59:38 +0000
treeherdermozilla-central@01877f113dab [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs500105
milestone2.0b3pre
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
Back out debugging code for bug 500105.
xpcom/base/nsCycleCollector.cpp
--- a/xpcom/base/nsCycleCollector.cpp
+++ b/xpcom/base/nsCycleCollector.cpp
@@ -164,25 +164,16 @@
 
 #define DEFAULT_SHUTDOWN_COLLECTIONS 5
 #ifdef DEBUG_CC
 #define SHUTDOWN_COLLECTIONS(params) params.mShutdownCollections
 #else
 #define SHUTDOWN_COLLECTIONS(params) DEFAULT_SHUTDOWN_COLLECTIONS
 #endif
 
-#define CC_RUNTIME_ABORT_IF_FALSE(_expr, _msg)                                \
-  PR_BEGIN_MACRO                                                              \
-    if (!(_expr)) {                                                           \
-      NS_ERROR(_msg);                                                         \
-      int *foo = (int*)nsnull;                                                \
-      *foo = 42;                                                              \
-    }                                                                         \
-  PR_END_MACRO
-
 // Various parameters of this collector can be tuned using environment
 // variables.
 
 struct nsCycleCollectorParams
 {
     PRBool mDoNothing;
 #ifdef DEBUG_CC
     PRBool mReportStats;
@@ -382,17 +373,16 @@ public:
             return mPointer->ptrInfo;
         }
         PRBool operator==(const Iterator& aOther) const
             { return mPointer == aOther.mPointer; }
         PRBool operator!=(const Iterator& aOther) const
             { return mPointer != aOther.mPointer; }
 
     private:
-        friend class EdgePool;
         PtrInfoOrBlock *mPointer;
     };
 
     class Builder;
     friend class Builder;
     class Builder {
     public:
         Builder(EdgePool &aPool)
@@ -420,17 +410,16 @@ public:
             (mCurrent++)->ptrInfo = aEdge;
         }
     private:
         // mBlockEnd points to space for null sentinel
         PtrInfoOrBlock *mCurrent, *mBlockEnd;
         Block **mNextBlockPtr;
     };
 
-    void CheckIterator(Iterator &aIterator);
 };
 
 #ifdef DEBUG_CC
 
 struct ReversedEdge {
     PtrInfo *mTarget;
     nsCString *mEdgeName;
     ReversedEdge *mNext;
@@ -628,18 +617,16 @@ public:
         }
     private:
         Block *mFirstBlock, *mCurBlock;
         // mNext is the next value we want to return, unless mNext == mBlockEnd
         // NB: mLast is a reference to allow enumerating while building!
         PtrInfo *mNext, *mBlockEnd, *&mLast;
     };
 
-    void CheckPtrInfo(PtrInfo *aPtrInfo);
-
 private:
     Block *mBlocks;
     PtrInfo *mLast;
 };
 
 
 class GCGraphBuilder;
 
@@ -1031,37 +1018,28 @@ struct nsCycleCollector
     void DestroyReversedEdges();
     void ShouldBeFreed(nsISupports *n);
     void WasFreed(nsISupports *n);
     PointerSet mExpectedGarbage;
 #endif
 };
 
 
-struct DoWalkDebugInfo
-{
-    PtrInfo *mCurrentPI;
-    EdgePool::Iterator mFirstChild;
-    EdgePool::Iterator mLastChild;
-    EdgePool::Iterator mCurrentChild;
-};
-
 /**
  * GraphWalker is templatized over a Visitor class that must provide
  * the following two methods:
  *
  * PRBool ShouldVisitNode(PtrInfo const *pi);
  * void VisitNode(PtrInfo *pi);
  */
 template <class Visitor>
 class GraphWalker
 {
 private:
     Visitor mVisitor;
-    DoWalkDebugInfo *mDebugInfo;
 
     void DoWalk(nsDeque &aQueue);
 
 public:
     void Walk(PtrInfo *s0);
     void WalkFromRoots(GCGraph &aGraph);
     // copy-constructing the visitor should be cheap, and less
     // indirection than using a reference
@@ -1251,82 +1229,30 @@ GraphWalker<Visitor>::WalkFromRoots(GCGr
     nsDeque queue;
     NodePool::Enumerator etor(aGraph.mNodes);
     for (PRUint32 i = 0; i < aGraph.mRootCount; ++i) {
         queue.Push(etor.GetNext());
     }
     DoWalk(queue);
 }
 
-void
-EdgePool::CheckIterator(Iterator &aIterator)
-{
-    PtrInfoOrBlock *iteratorPos = aIterator.mPointer;
-    CC_RUNTIME_ABORT_IF_FALSE(iteratorPos, "Iterator's pos is null.");
-
-    PtrInfoOrBlock *start = &mSentinelAndBlocks[0];
-    size_t sentinelOffset = 0;
-    PtrInfoOrBlock *end;
-    Block *nextBlockPtr;
-    do {
-        end = start + sentinelOffset;
-        nextBlockPtr = (end + 1)->block;
-        // We must be in a block of edges or on a sentinel.
-        if (iteratorPos >= start && iteratorPos <= end)
-            break;
-        sentinelOffset = Block::BlockSize - 2;
-    } while ((start = nextBlockPtr ? nextBlockPtr->Start() : nsnull));
-    CC_RUNTIME_ABORT_IF_FALSE(start, "Iterator doesn't point into EdgePool.");
-
-    // If the ptrInfo is null we need to be on the sentinel.
-    CC_RUNTIME_ABORT_IF_FALSE(iteratorPos->ptrInfo || iteratorPos == end,
-                              "iteratorPos points to null, but it's not a "
-                              "sentinel!");
-}
-
-void
-NodePool::CheckPtrInfo(PtrInfo *aPtrInfo)
-{
-    // Find out if pi is null.
-    CC_RUNTIME_ABORT_IF_FALSE(aPtrInfo, "Pointer is null.");
-
-    // Find out if pi is a dangling pointer.
-    Block *block = mBlocks;
-    do {
-        if(aPtrInfo >= &block->mEntries[0] &&
-           aPtrInfo <= &block->mEntries[BlockSize - 1])
-           break;
-    } while ((block = block->mNext));
-    CC_RUNTIME_ABORT_IF_FALSE(block, "Pointer is outside blocks.");
-}
-
 template <class Visitor>
 void
 GraphWalker<Visitor>::DoWalk(nsDeque &aQueue)
 {
     // Use a aQueue to match the breadth-first traversal used when we
     // built the graph, for hopefully-better locality.
-    DoWalkDebugInfo debugInfo;
-    mDebugInfo = &debugInfo;
-
     while (aQueue.GetSize() > 0) {
         PtrInfo *pi = static_cast<PtrInfo*>(aQueue.PopFront());
 
-        sCollector->mGraph.mNodes.CheckPtrInfo(pi);
-
-        debugInfo.mCurrentPI = pi;
         if (mVisitor.ShouldVisitNode(pi)) {
             mVisitor.VisitNode(pi);
-            debugInfo.mFirstChild = pi->mFirstChild;
-            debugInfo.mLastChild = pi->mLastChild;
-            debugInfo.mCurrentChild = pi->mFirstChild;
             for (EdgePool::Iterator child = pi->mFirstChild,
                                 child_end = pi->mLastChild;
-                 child != child_end; ++child, debugInfo.mCurrentChild = child) {
-                sCollector->mGraph.mEdges.CheckIterator(child);
+                 child != child_end; ++child) {
                 aQueue.Push(*child);
             }
         }
     };
 
 #ifdef DEBUG_CC
     sCollector->mStats.mWalkedGraph++;
 #endif