Bug 1094150 - make jitspew available in release builds. r=nbp
☠☠ backed out by fb4b0ee507c8 ☠ ☠
authorLars T Hansen <lhansen@mozilla.com>
Fri, 30 Oct 2015 12:04:10 +0100
changeset 306406 b3a8ba0c340f9ffe3858b8733b9182ccc5ff86bf
parent 306405 58593839ebcedb976068fca5901af41cf48912d9
child 306407 a6d9d8927dd23cb20637cb5ab5a0661c4ae4766e
push id1040
push userraliiev@mozilla.com
push dateMon, 29 Feb 2016 17:11:22 +0000
treeherdermozilla-release@8c3167321162 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnbp
bugs1094150
milestone45.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 1094150 - make jitspew available in release builds. r=nbp
js/src/configure.in
js/src/jit/BacktrackingAllocator.cpp
js/src/jit/BaselineBailouts.cpp
js/src/jit/BaselineDebugModeOSR.cpp
js/src/jit/C1Spewer.cpp
js/src/jit/C1Spewer.h
js/src/jit/CodeGenerator.cpp
js/src/jit/IonBuilder.cpp
js/src/jit/IonOptimizationLevels.h
js/src/jit/JitSpewer.cpp
js/src/jit/JitSpewer.h
js/src/jit/JitcodeMap.cpp
js/src/jit/MIR.cpp
js/src/jit/MIR.h
js/src/jit/Recover.cpp
js/src/moz.build
--- a/js/src/configure.in
+++ b/js/src/configure.in
@@ -3191,16 +3191,29 @@ dnl ====================================
 dnl vtune
 dnl ========================================================
 MOZ_ARG_ENABLE_BOOL(vtune,
 [  --enable-vtune          Enable vtune profiling. Implies --enable-profiling.],
     MOZ_VTUNE=1,
     MOZ_VTUNE= )
 
 dnl ========================================================
+dnl JitSpew.  Enabled by default in debug builds.
+dnl ========================================================
+MOZ_ARG_ENABLE_BOOL(jitspew,
+[  --enable-jitspew        Enable the Jit spew and IONFLAGS.],
+    JS_JITSPEW=1,
+    JS_JITSPEW= )
+if test -n "$MOZ_DEBUG"; then
+    JS_JITSPEW=1
+fi
+
+AC_SUBST(JS_JITSPEW)
+
+dnl ========================================================
 dnl Debug (see Bug 939505)
 dnl ========================================================
 if test -n "$MOZ_DEBUG"; then
     AC_DEFINE(JS_DEBUG)
 fi
 
 dnl ========================================================
 dnl Profiling
--- a/js/src/jit/BacktrackingAllocator.cpp
+++ b/js/src/jit/BacktrackingAllocator.cpp
@@ -1403,30 +1403,33 @@ BacktrackingAllocator::tryAllocateRegist
     }
 
     if (!aliasedConflicting.empty()) {
         // One or more aliased registers is allocated to another bundle
         // overlapping this one. Keep track of the conflicting set, and in the
         // case of multiple conflicting sets keep track of the set with the
         // lowest maximum spill weight.
 
+        // The #ifdef guards against "unused variable 'existing'" bustage.
+#ifdef JS_JITSPEW
         if (JitSpewEnabled(JitSpew_RegAlloc)) {
             if (aliasedConflicting.length() == 1) {
-                mozilla::DebugOnly<LiveBundle*> existing = aliasedConflicting[0];
+                LiveBundle* existing = aliasedConflicting[0];
                 JitSpew(JitSpew_RegAlloc, "  %s collides with %s [weight %lu]",
                         r.reg.name(), existing->toString(), computeSpillWeight(existing));
             } else {
                 JitSpew(JitSpew_RegAlloc, "  %s collides with the following", r.reg.name());
                 for (size_t i = 0; i < aliasedConflicting.length(); i++) {
-                    mozilla::DebugOnly<LiveBundle*> existing = aliasedConflicting[i];
+                    LiveBundle* existing = aliasedConflicting[i];
                     JitSpew(JitSpew_RegAlloc, "      %s [weight %lu]",
                             existing->toString(), computeSpillWeight(existing));
                 }
             }
         }
+#endif
 
         if (conflicting.empty()) {
             if (!conflicting.appendAll(aliasedConflicting))
                 return false;
         } else {
             if (maximumSpillWeight(aliasedConflicting) < maximumSpillWeight(conflicting)) {
                 conflicting.clear();
                 if (!conflicting.appendAll(aliasedConflicting))
--- a/js/src/jit/BaselineBailouts.cpp
+++ b/js/src/jit/BaselineBailouts.cpp
@@ -1415,22 +1415,24 @@ jit::BailoutIonToBaseline(JSContext* cx,
     });
 
     // The caller of the top frame must be one of the following:
     //      IonJS - Ion calling into Ion.
     //      BaselineStub - Baseline calling into Ion.
     //      Entry - Interpreter or other calling into Ion.
     //      Rectifier - Arguments rectifier calling into Ion.
     MOZ_ASSERT(iter.isBailoutJS());
-    mozilla::DebugOnly<FrameType> prevFrameType = iter.prevType();
+#if defined(DEBUG) || defined(JS_JITSPEW)
+    FrameType prevFrameType = iter.prevType();
     MOZ_ASSERT(prevFrameType == JitFrame_IonJS ||
                prevFrameType == JitFrame_BaselineStub ||
                prevFrameType == JitFrame_Entry ||
                prevFrameType == JitFrame_Rectifier ||
                prevFrameType == JitFrame_IonAccessorIC);
+#endif
 
     // All incoming frames are going to look like this:
     //
     //      +---------------+
     //      |     ...       |
     //      +---------------+
     //      |     Args      |
     //      |     ...       |
--- a/js/src/jit/BaselineDebugModeOSR.cpp
+++ b/js/src/jit/BaselineDebugModeOSR.cpp
@@ -282,17 +282,17 @@ CollectInterpreterStackScripts(JSContext
         if (obs.shouldRecompileOrInvalidate(script)) {
             if (!entries.append(DebugModeOSREntry(iter.frame()->script())))
                 return false;
         }
     }
     return true;
 }
 
-#ifdef DEBUG
+#ifdef JS_JITSPEW
 static const char*
 ICEntryKindToString(ICEntry::Kind kind)
 {
     switch (kind) {
       case ICEntry::Kind_Op:
         return "IC";
       case ICEntry::Kind_NonOp:
         return "non-op IC";
@@ -307,17 +307,17 @@ ICEntryKindToString(ICEntry::Kind kind)
       case ICEntry::Kind_DebugPrologue:
         return "debug prologue";
       case ICEntry::Kind_DebugEpilogue:
         return "debug epilogue";
       default:
         MOZ_CRASH("bad ICEntry kind");
     }
 }
-#endif // DEBUG
+#endif // JS_JITSPEW
 
 static void
 SpewPatchBaselineFrame(uint8_t* oldReturnAddress, uint8_t* newReturnAddress,
                        JSScript* script, ICEntry::Kind frameKind, jsbytecode* pc)
 {
     JitSpew(JitSpew_BaselineDebugModeOSR,
             "Patch return %p -> %p on BaselineJS frame (%s:%d) from %s at %s",
             oldReturnAddress, newReturnAddress, script->filename(), script->lineno(),
--- a/js/src/jit/C1Spewer.cpp
+++ b/js/src/jit/C1Spewer.cpp
@@ -1,15 +1,15 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
  * vim: set ts=8 sts=4 et sw=4 tw=99:
  * This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
-#ifdef DEBUG
+#ifdef JS_JITSPEW
 
 #include "jit/C1Spewer.h"
 
 #include "mozilla/SizePrintfMacros.h"
 
 #include <time.h>
 
 #include "jit/BacktrackingAllocator.h"
@@ -185,10 +185,10 @@ C1Spewer::spewPass(GenericPrinter& out, 
         for (LInstructionIterator i(block->lir()->begin()); i != block->lir()->end(); i++)
             DumpLIR(out, *i);
         out.printf("    end_LIR\n");
     }
 
     out.printf("  end_block\n");
 }
 
-#endif /* DEBUG */
+#endif /* JS_JITSPEW */
 
--- a/js/src/jit/C1Spewer.h
+++ b/js/src/jit/C1Spewer.h
@@ -2,17 +2,17 @@
  * vim: set ts=8 sts=4 et sw=4 tw=99:
  * This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef jit_C1Spewer_h
 #define jit_C1Spewer_h
 
-#ifdef DEBUG
+#ifdef JS_JITSPEW
 
 #include "NamespaceImports.h"
 
 #include "js/RootingAPI.h"
 #include "vm/Printer.h"
 
 namespace js {
 namespace jit {
@@ -41,11 +41,11 @@ class C1Spewer
     void spewPass(GenericPrinter& out, MBasicBlock* block);
     void spewRanges(GenericPrinter& out, BacktrackingAllocator* regalloc, LNode* ins);
     void spewRanges(GenericPrinter& out, MBasicBlock* block, BacktrackingAllocator* regalloc);
 };
 
 } // namespace jit
 } // namespace js
 
-#endif /* DEBUG */
+#endif /* JS_JITSPEW */
 
 #endif /* jit_C1Spewer_h */
--- a/js/src/jit/CodeGenerator.cpp
+++ b/js/src/jit/CodeGenerator.cpp
@@ -4094,28 +4094,30 @@ CodeGenerator::generateBody()
         current = graph.getBlock(i);
 
         // Don't emit any code for trivial blocks, containing just a goto. Such
         // blocks are created to split critical edges, and if we didn't end up
         // putting any instructions in them, we can skip them.
         if (current->isTrivial())
             continue;
 
-#ifdef DEBUG
+#ifdef JS_JITSPEW
         const char* filename = nullptr;
         size_t lineNumber = 0;
         unsigned columnNumber = 0;
         if (current->mir()->info().script()) {
             filename = current->mir()->info().script()->filename();
             if (current->mir()->pc())
                 lineNumber = PCToLineNumber(current->mir()->info().script(), current->mir()->pc(),
                                             &columnNumber);
         } else {
+#ifdef DEBUG
             lineNumber = current->mir()->lineno();
             columnNumber = current->mir()->columnIndex();
+#endif
         }
         JitSpew(JitSpew_Codegen, "# block%" PRIuSIZE " %s:%" PRIuSIZE ":%u%s:",
                 i, filename ? filename : "?", lineNumber, columnNumber,
                 current->mir()->isLoopHeader() ? " (loop header)" : "");
 #endif
 
         masm.bind(current->label());
 
@@ -4126,17 +4128,17 @@ CodeGenerator::generateBody()
                 return false;
         }
 
 #if defined(JS_ION_PERF)
         perfSpewer->startBasicBlock(current->mir(), masm);
 #endif
 
         for (LInstructionIterator iter = current->begin(); iter != current->end(); iter++) {
-#ifdef DEBUG
+#ifdef JS_JITSPEW
             JitSpewStart(JitSpew_Codegen, "instruction %s", iter->opName());
             if (const char* extra = iter->extraName())
                 JitSpewCont(JitSpew_Codegen, ":%s", extra);
             JitSpewFin(JitSpew_Codegen);
 #endif
 
             if (counts)
                 blockCounts->visitInstruction(*iter);
--- a/js/src/jit/IonBuilder.cpp
+++ b/js/src/jit/IonBuilder.cpp
@@ -798,17 +798,17 @@ IonBuilder::build()
     if (script()->hasBaselineScript())
         script()->baselineScript()->resetMaxInliningDepth();
 
     if (!setCurrentAndSpecializePhis(newBlock(pc)))
         return false;
     if (!current)
         return false;
 
-#ifdef DEBUG
+#ifdef JS_JITSPEW
     if (info().isAnalysis()) {
         JitSpew(JitSpew_IonScripts, "Analyzing script %s:%" PRIuSIZE " (%p) %s",
                 script()->filename(), script()->lineno(), (void*)script(),
                 AnalysisModeString(info().analysisMode()));
     } else {
         JitSpew(JitSpew_IonScripts, "%sompiling script %s:%" PRIuSIZE " (%p) (warmup-counter=%" PRIuSIZE ", level=%s)",
                 (script()->hasIonScript() ? "Rec" : "C"),
                 script()->filename(), script()->lineno(), (void*)script(),
--- a/js/src/jit/IonOptimizationLevels.h
+++ b/js/src/jit/IonOptimizationLevels.h
@@ -19,17 +19,17 @@ namespace jit {
 enum OptimizationLevel
 {
     Optimization_DontCompile,
     Optimization_Normal,
     Optimization_AsmJS,
     Optimization_Count
 };
 
-#ifdef DEBUG
+#ifdef JS_JITSPEW
 inline const char*
 OptimizationLevelString(OptimizationLevel level)
 {
     switch (level) {
       case Optimization_DontCompile:
         return "Optimization_DontCompile";
       case Optimization_Normal:
         return "Optimization_Normal";
--- a/js/src/jit/JitSpewer.cpp
+++ b/js/src/jit/JitSpewer.cpp
@@ -1,15 +1,15 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
  * vim: set ts=8 sts=4 et sw=4 tw=99:
  * This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
-#ifdef DEBUG
+#ifdef JS_JITSPEW
 
 #include "jit/JitSpewer.h"
 
 #include "mozilla/Atomics.h"
 
 #include "jit/Ion.h"
 #include "jit/MIR.h"
 #include "jit/MIRGenerator.h"
@@ -637,10 +637,10 @@ jit::EnableChannel(JitSpewChannel channe
 
 void
 jit::DisableChannel(JitSpewChannel channel)
 {
     MOZ_ASSERT(LoggingChecked);
     LoggingBits &= ~(1 << uint32_t(channel));
 }
 
-#endif /* DEBUG */
+#endif /* JS_JITSPEW */
 
--- a/js/src/jit/JitSpewer.h
+++ b/js/src/jit/JitSpewer.h
@@ -100,17 +100,17 @@ enum JitSpewChannel {
 
 class MIRGenerator;
 class TempAllocator;
 
 // The JitSpewer is only available on debug builds.
 // None of the global functions have effect on non-debug builds.
 static const int NULL_ID = -1;
 
-#ifdef DEBUG
+#ifdef JS_JITSPEW
 
 // Class made to hold the MIR and LIR graphs of an AsmJS / Ion compilation.
 class GraphSpewer
 {
   private:
     MIRGraph* graph_;
     LSprinter c1Printer_;
     LSprinter jsonPrinter_;
@@ -242,33 +242,33 @@ static inline void EnableChannel(JitSpew
 { }
 static inline void DisableChannel(JitSpewChannel)
 { }
 static inline void EnableIonDebugSyncLogging()
 { }
 static inline void EnableIonDebugAsyncLogging()
 { }
 
-#endif /* DEBUG */
+#endif /* JS_JITSPEW */
 
 template <JitSpewChannel Channel>
 class AutoDisableSpew
 {
     mozilla::DebugOnly<bool> enabled_;
 
   public:
     AutoDisableSpew()
       : enabled_(JitSpewEnabled(Channel))
     {
         DisableChannel(Channel);
     }
 
     ~AutoDisableSpew()
     {
-#ifdef DEBUG
+#ifdef JS_JITSPEW
         if (enabled_)
             EnableChannel(Channel);
 #endif
     }
 };
 
 } // namespace jit
 } // namespace js
--- a/js/src/jit/JitcodeMap.cpp
+++ b/js/src/jit/JitcodeMap.cpp
@@ -1385,18 +1385,20 @@ JitcodeRegionEntry::WriteRun(CompactBuff
         WriteDelta(writer, nativeDelta, bytecodeDelta);
 
         // Spew the bytecode in these ranges.
         if (curBytecodeOffset < nextBytecodeOffset) {
             JitSpewStart(JitSpew_Profiling, "      OPS: ");
             uint32_t curBc = curBytecodeOffset;
             while (curBc < nextBytecodeOffset) {
                 jsbytecode* pc = entry[i].tree->script()->offsetToPC(curBc);
-                mozilla::DebugOnly<JSOp> op = JSOp(*pc);
+#ifdef JS_JITSPEW
+                JSOp op = JSOp(*pc);
                 JitSpewCont(JitSpew_Profiling, "%s ", js_CodeName[op]);
+#endif
                 curBc += GetBytecodeLength(pc);
             }
             JitSpewFin(JitSpew_Profiling);
         }
         spewer.spewAndAdvance("      ");
 
         curNativeOffset = nextNativeOffset;
         curBytecodeOffset = nextBytecodeOffset;
--- a/js/src/jit/MIR.cpp
+++ b/js/src/jit/MIR.cpp
@@ -503,17 +503,17 @@ MDefinition::dumpLocation(GenericPrinter
 void
 MDefinition::dumpLocation() const
 {
     Fprinter out(stderr);
     dumpLocation(out);
     out.finish();
 }
 
-#ifdef DEBUG
+#if defined(DEBUG) || defined(JS_JITSPEW)
 size_t
 MDefinition::useCount() const
 {
     size_t count = 0;
     for (MUseIterator i(uses_.begin()); i != uses_.end(); i++)
         count++;
     return count;
 }
--- a/js/src/jit/MIR.h
+++ b/js/src/jit/MIR.h
@@ -683,17 +683,17 @@ class MDefinition : public MNode
         return !isEmittedAtUses();
     }
 
     // Removes a use at the given position
     void removeUse(MUse* use) {
         uses_.remove(use);
     }
 
-#ifdef DEBUG
+#if defined(DEBUG) || defined(JS_JITSPEW)
     // Number of uses of this instruction. This function is only available
     // in DEBUG mode since it requires traversing the list. Most users should
     // use hasUses() or hasOneUse() instead.
     size_t useCount() const;
 
     // Number of uses of this instruction (only counting MDefinitions, ignoring
     // MResumePoints). This function is only available in DEBUG mode since it
     // requires traversing the list. Most users should use hasUses() or
--- a/js/src/jit/Recover.cpp
+++ b/js/src/jit/Recover.cpp
@@ -112,17 +112,17 @@ MResumePoint::writeRecoverData(CompactBu
 #endif
 
     // Test if we honor the maximum of arguments at all times.  This is a sanity
     // check and not an algorithm limit. So check might be a bit too loose.  +4
     // to account for scope chain, return value, this value and maybe
     // arguments_object.
     MOZ_ASSERT(CountArgSlots(script, fun) < SNAPSHOT_MAX_NARGS + 4);
 
-#ifdef DEBUG
+#ifdef JS_JITSPEW
     uint32_t implicit = StartArgSlot(script);
 #endif
     uint32_t formalArgs = CountArgSlots(script, fun);
     uint32_t nallocs = formalArgs + script->nfixed() + exprStack;
 
     JitSpew(JitSpew_IonSnapshots, "Starting frame; implicit %u, formals %u, fixed %u, exprs %u",
             implicit, formalArgs - implicit, script->nfixed(), exprStack);
 
--- a/js/src/moz.build
+++ b/js/src/moz.build
@@ -611,16 +611,19 @@ DEFINES['EXPORT_JS_API'] = True
 if CONFIG['JS_HAS_CTYPES']:
     DEFINES['JS_HAS_CTYPES'] = True
     for var in ('DLL_PREFIX', 'DLL_SUFFIX'):
         DEFINES[var] = '"%s"' % CONFIG[var]
 
 if CONFIG['MOZ_LINKER']:
     DEFINES['MOZ_LINKER'] = True
 
+if CONFIG['JS_JITSPEW']:
+    DEFINES['JS_JITSPEW'] = True
+
 if CONFIG['_MSC_VER']:
     if CONFIG['CPU_ARCH'] == 'x86':
         SOURCES['builtin/RegExp.cpp'].no_pgo = True # Bug 772303
     elif CONFIG['CPU_ARCH'] == 'x86_64' and CONFIG['JS_HAS_CTYPES']:
         SOURCES['ctypes/CTypes.cpp'].no_pgo = True # Bug 810661
     # Prevent floating point errors caused by VC++ optimizations
     # XXX We should add this to CXXFLAGS, too?
     CFLAGS += ['-fp:precise']