Bug 1013078 (part 1) - Remove some dead code left over from the removal of the Leaky tool. r=dbaron.
authorNicholas Nethercote <nnethercote@mozilla.com>
Tue, 20 May 2014 18:03:27 -0700
changeset 184036 372ed56353b5f1a3f81cab66ea745ef21fc44116
parent 184035 f611bb9c7cbdd364b2e0b91d1cdd3a885ae131e7
child 184037 47fbda634a67deb2df667a40121c92c8c205bee0
push id26810
push usercbook@mozilla.com
push dateWed, 21 May 2014 11:46:36 +0000
treeherdermozilla-central@50fb8c4db2fd [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdbaron
bugs1013078
milestone32.0a1
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
Bug 1013078 (part 1) - Remove some dead code left over from the removal of the Leaky tool. r=dbaron.
xpcom/base/nsTraceRefcnt.cpp
--- a/xpcom/base/nsTraceRefcnt.cpp
+++ b/xpcom/base/nsTraceRefcnt.cpp
@@ -85,22 +85,18 @@ static PRLock* gTraceLock;
 
 static PLHashTable* gBloatView;
 static PLHashTable* gTypesToLog;
 static PLHashTable* gObjectsToLog;
 static PLHashTable* gSerialNumbers;
 static intptr_t gNextSerialNumber;
 
 static bool gLogging;
-static bool gLogToLeaky;
 static bool gLogLeaksOnly;
 
-static void (*leakyLogAddRef)(void* p, int oldrc, int newrc);
-static void (*leakyLogRelease)(void* p, int oldrc, int newrc);
-
 #define BAD_TLS_INDEX ((unsigned)-1)
 
 // if gActivityTLS == BAD_TLS_INDEX, then we're
 // unitialized... otherwise this points to a NSPR TLS thread index
 // indicating whether addref activity is legal. If the PTR_TO_INT32 is 0 then
 // activity is ok, otherwise not!
 static unsigned gActivityTLS = BAD_TLS_INDEX;
 
@@ -738,44 +734,16 @@ InitTraceLog()
       gLogLeaksOnly = false;
     }
   }
 
   InitLog("XPCOM_MEM_REFCNT_LOG", "refcounts", &gRefcntsLog);
 
   InitLog("XPCOM_MEM_ALLOC_LOG", "new/delete", &gAllocLog);
 
-  defined = InitLog("XPCOM_MEM_LEAKY_LOG", "for leaky", &gLeakyLog);
-  if (defined) {
-    gLogToLeaky = true;
-    PRFuncPtr p = nullptr, q = nullptr;
-#ifdef HAVE_DLOPEN
-    {
-      PRLibrary* lib = nullptr;
-      p = PR_FindFunctionSymbolAndLibrary("__log_addref", &lib);
-      if (lib) {
-        PR_UnloadLibrary(lib);
-        lib = nullptr;
-      }
-      q = PR_FindFunctionSymbolAndLibrary("__log_release", &lib);
-      if (lib) {
-        PR_UnloadLibrary(lib);
-      }
-    }
-#endif
-    if (p && q) {
-      leakyLogAddRef = (void (*)(void*, int, int)) p;
-      leakyLogRelease = (void (*)(void*, int, int)) q;
-    } else {
-      gLogToLeaky = false;
-      fprintf(stdout, "### ERROR: XPCOM_MEM_LEAKY_LOG defined, but can't locate __log_addref and __log_release symbols\n");
-      fflush(stdout);
-    }
-  }
-
   const char* classes = getenv("XPCOM_MEM_LOG_CLASSES");
 
 #ifdef HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR
   if (classes) {
     InitLog("XPCOM_MEM_COMPTR_LOG", "nsCOMPtr", &gCOMPtrLog);
   } else {
     if (getenv("XPCOM_MEM_COMPTR_LOG")) {
       fprintf(stdout, "### XPCOM_MEM_COMPTR_LOG defined -- but XPCOM_MEM_LOG_CLASSES is not defined\n");
@@ -1053,25 +1021,21 @@ NS_LogAddRef(void* aPtr, nsrefcnt aRefcn
     bool loggingThisObject = (!gObjectsToLog || LogThisObj(serialno));
     if (aRefcnt == 1 && gAllocLog && loggingThisType && loggingThisObject) {
       fprintf(gAllocLog, "\n<%s> 0x%08X %" PRIdPTR " Create\n",
               aClazz, NS_PTR_TO_INT32(aPtr), serialno);
       nsTraceRefcnt::WalkTheStack(gAllocLog);
     }
 
     if (gRefcntsLog && loggingThisType && loggingThisObject) {
-      if (gLogToLeaky) {
-        (*leakyLogAddRef)(aPtr, aRefcnt - 1, aRefcnt);
-      } else {
-        // Can't use PR_LOG(), b/c it truncates the line
-        fprintf(gRefcntsLog,
-                "\n<%s> 0x%08X %" PRIuPTR " AddRef %" PRIuPTR "\n", aClazz, NS_PTR_TO_INT32(aPtr), serialno, aRefcnt);
-        nsTraceRefcnt::WalkTheStack(gRefcntsLog);
-        fflush(gRefcntsLog);
-      }
+      // Can't use PR_LOG(), b/c it truncates the line
+      fprintf(gRefcntsLog,
+              "\n<%s> 0x%08X %" PRIuPTR " AddRef %" PRIuPTR "\n", aClazz, NS_PTR_TO_INT32(aPtr), serialno, aRefcnt);
+      nsTraceRefcnt::WalkTheStack(gRefcntsLog);
+      fflush(gRefcntsLog);
     }
     UNLOCK_TRACELOG();
   }
 #endif
 }
 
 EXPORT_XPCOM_API(void)
 NS_LogRelease(void* aPtr, nsrefcnt aRefcnt, const char* aClazz)
@@ -1102,25 +1066,21 @@ NS_LogRelease(void* aPtr, nsrefcnt aRefc
       if (count) {
         (*count)--;
       }
 
     }
 
     bool loggingThisObject = (!gObjectsToLog || LogThisObj(serialno));
     if (gRefcntsLog && loggingThisType && loggingThisObject) {
-      if (gLogToLeaky) {
-        (*leakyLogRelease)(aPtr, aRefcnt + 1, aRefcnt);
-      } else {
-        // Can't use PR_LOG(), b/c it truncates the line
-        fprintf(gRefcntsLog,
-                "\n<%s> 0x%08X %" PRIuPTR " Release %" PRIuPTR "\n", aClazz, NS_PTR_TO_INT32(aPtr), serialno, aRefcnt);
-        nsTraceRefcnt::WalkTheStack(gRefcntsLog);
-        fflush(gRefcntsLog);
-      }
+      // Can't use PR_LOG(), b/c it truncates the line
+      fprintf(gRefcntsLog,
+              "\n<%s> 0x%08X %" PRIuPTR " Release %" PRIuPTR "\n", aClazz, NS_PTR_TO_INT32(aPtr), serialno, aRefcnt);
+      nsTraceRefcnt::WalkTheStack(gRefcntsLog);
+      fflush(gRefcntsLog);
     }
 
     // Here's the case where MOZ_COUNT_DTOR was not used,
     // yet we still want to see deletion information:
 
     if (aRefcnt == 0 && gAllocLog && loggingThisType && loggingThisObject) {
       fprintf(gAllocLog,
               "\n<%s> 0x%08X %" PRIdPTR " Destroy\n",