Bug 646597 - Remove unneeded #ifdef DEBUG: use DebugOnly instead; r=bhackett
authorTerrence Cole <terrence@trainedmonkeystudios.org>
Sun, 04 Sep 2011 13:58:00 +0100
changeset 77832 a0a6800d3744fe8f47ea957d0e1b89e73640fe54
parent 77831 de62ed0f6b64fc0d5dde12f62931a0ec17c36d68
child 77833 d09cbf88c277e359162dcf2c93cf27f69113c1fb
push id78
push userclegnitto@mozilla.com
push dateFri, 16 Dec 2011 17:32:24 +0000
treeherdermozilla-release@79d24e644fdd [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbhackett
bugs646597
milestone9.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 646597 - Remove unneeded #ifdef DEBUG: use DebugOnly instead; r=bhackett Assignment to a DebugOnly variable results in a call to either the empty 'operator =' or to an empty implicit 1-arg constructor and empty copy constructor when in non-debug mode. Either of these get inlined and eliminated as dead code above -00, so there is no benefit to skipping this assignment for non-debug builds.
js/src/jsanalyze.cpp
mfbt/Util.h
--- a/js/src/jsanalyze.cpp
+++ b/js/src/jsanalyze.cpp
@@ -900,19 +900,17 @@ ScriptAnalysis::analyzeLifetimes(JSConte
                      * Extend all live variables at exception entry to the start of
                      * the try block.
                      */
                     for (unsigned i = 0; i < numSlots; i++) {
                         if (lifetimes[i].lifetime)
                             ensureVariable(lifetimes[i], startOffset - 1);
                     }
 
-#ifdef DEBUG
                     found = true;
-#endif
                     break;
                 }
             }
             JS_ASSERT(found);
         }
 
         switch (op) {
           case JSOP_GETARG:
--- a/mfbt/Util.h
+++ b/mfbt/Util.h
@@ -169,17 +169,17 @@ struct DebugOnly
     operator T&() { return value; }
     operator const T&() const { return value; }
 
     T& operator->() { return value; }
 
 #else
     DebugOnly() {}
     DebugOnly(const T&) {}
-    DebugOnly& operator=(const T&) {}   
+    DebugOnly& operator=(const T&) { return *this; }
 #endif
 
     /*
      * DebugOnly must always have a destructor or else it will
      * generate "unused variable" warnings, exactly what it's intended
      * to avoid!
      */
     ~DebugOnly() {}