Bug 977688 - Get rid of CC_AbortIfNull. r=smaug
authorAndrew McCreight <continuation@gmail.com>
Fri, 28 Feb 2014 09:56:23 -0800
changeset 171593 1f082a704d6d0f7024286df961009883a1445f84
parent 171592 e637f7b15f5c8c8c3cbc3edc70a89980383e917c
child 171594 e40d71a7e80420a0ca25b95c9861f484ca4a36ed
child 171668 8abc76dedec2905c6b150ace5f6ffe3f07d82751
push id270
push userpvanderbeken@mozilla.com
push dateThu, 06 Mar 2014 09:24:21 +0000
reviewerssmaug
bugs977688
milestone30.0a1
Bug 977688 - Get rid of CC_AbortIfNull. r=smaug
xpcom/base/nsCycleCollector.cpp
--- a/xpcom/base/nsCycleCollector.cpp
+++ b/xpcom/base/nsCycleCollector.cpp
@@ -215,23 +215,16 @@ using namespace mozilla;
 //
 // MOZ_CC_RUN_DURING_SHUTDOWN: In non-DEBUG or builds, if this is set,
 // run cycle collections at shutdown.
 //
 // MOZ_CC_LOG_DIRECTORY: The directory in which logs are placed (such as
 // logs from MOZ_CC_LOG_ALL and MOZ_CC_LOG_SHUTDOWN, or other uses
 // of nsICycleCollectorListener)
 
-MOZ_NEVER_INLINE void
-CC_AbortIfNull(void *ptr)
-{
-    if (!ptr)
-        MOZ_CRASH();
-}
-
 // Various parameters of this collector can be tuned using environment
 // variables.
 
 struct nsCycleCollectorParams
 {
     bool mLogAll;
     bool mLogShutdown;
     bool mAllTracesAtShutdown;
@@ -1227,17 +1220,19 @@ class GraphWalker
 {
 private:
     Visitor mVisitor;
 
     void DoWalk(nsDeque &aQueue);
 
     void CheckedPush(nsDeque &aQueue, PtrInfo *pi)
     {
-        CC_AbortIfNull(pi);
+        if (!pi) {
+            MOZ_CRASH();
+        }
         if (!aQueue.Push(pi, fallible_t())) {
             mVisitor.Failed();
         }
     }
 
 public:
     void Walk(PtrInfo *s0);
     void WalkFromRoots(GCGraph &aGraph);
@@ -1313,17 +1308,16 @@ GraphWalker<Visitor>::WalkFromRoots(GCGr
 template <class Visitor>
 MOZ_NEVER_INLINE 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.
     while (aQueue.GetSize() > 0) {
         PtrInfo *pi = static_cast<PtrInfo*>(aQueue.PopFront());
-        CC_AbortIfNull(pi);
 
         if (pi->mParticipant && mVisitor.ShouldVisitNode(pi)) {
             mVisitor.VisitNode(pi);
             for (EdgePool::Iterator child = pi->FirstChild(),
                                 child_end = pi->LastChild();
                  child != child_end; ++child) {
                 CheckedPush(aQueue, *child);
             }
@@ -2531,17 +2525,20 @@ nsCycleCollector::MarkRoots(SliceBudget 
     AutoRestore<bool> ar(mScanInProgress);
     MOZ_ASSERT(!mScanInProgress);
     mScanInProgress = true;
     MOZ_ASSERT(mIncrementalPhase == GraphBuildingPhase);
     MOZ_ASSERT(mCurrNode);
 
     while (!aBudget.isOverBudget() && !mCurrNode->IsDone()) {
         PtrInfo *pi = mCurrNode->GetNext();
-        CC_AbortIfNull(pi);
+        if (!pi) {
+            MOZ_CRASH();
+        }
+
         // We need to call the builder's Traverse() method on deleted nodes, to
         // set their firstChild() that may be read by a prior non-deleted
         // neighbor.
         mBuilder->Traverse(pi);
         if (mCurrNode->AtBlockEnd()) {
             mBuilder->SetLastChild();
         }
         aBudget.step(kStep);