Bug 1094150 - more JitSpew channels. r=nbp
authorLars T Hansen <lhansen@mozilla.com>
Sat, 31 Oct 2015 13:15:00 +0100
changeset 304971 406ec8b601f0cc5795c0c10b851ebc17b856a89b
parent 304970 9e3455c9aa3c17d8a0c488071766396150ef7136
child 304972 4f4969ee790deaa5276525b897545b4772a7d95c
push id5513
push userraliiev@mozilla.com
push dateMon, 25 Jan 2016 13:55:34 +0000
treeherdermozilla-beta@5ee97dd05b5c [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 - more JitSpew channels. r=nbp
js/src/jit/BacktrackingAllocator.cpp
js/src/jit/BaselineBailouts.cpp
js/src/jit/Ion.cpp
js/src/jit/IonBuilder.cpp
js/src/jit/JitcodeMap.cpp
js/src/jit/LICM.cpp
js/src/jit/LIR.cpp
js/src/jit/LoopUnroller.cpp
js/src/jit/OptimizationTracking.cpp
js/src/jit/RangeAnalysis.cpp
js/src/jit/RegisterAllocator.cpp
js/src/jit/Safepoints.cpp
js/src/jit/SharedIC.cpp
js/src/jit/SharedIC.h
js/src/jit/ValueNumbering.cpp
js/src/jit/shared/CodeGenerator-shared.cpp
js/src/jit/shared/IonAssemblerBufferWithConstantPools.h
--- a/js/src/jit/BacktrackingAllocator.cpp
+++ b/js/src/jit/BacktrackingAllocator.cpp
@@ -3004,17 +3004,17 @@ BacktrackingAllocator::splitAcrossCalls(
         LiveRange* callRange = LiveRange::get(*iter);
         if (bundle->rangeFor(callRange->from()) && bundle->rangeFor(callRange->from().previous())) {
             if (!callPositions.append(callRange->from()))
                 return false;
         }
     }
     MOZ_ASSERT(callPositions.length());
 
-#ifdef DEBUG
+#ifdef JS_JITSPEW
     JitSpewStart(JitSpew_RegAlloc, "  split across calls at ");
     for (size_t i = 0; i < callPositions.length(); ++i)
         JitSpewCont(JitSpew_RegAlloc, "%s%u", i != 0 ? ", " : "", callPositions[i].bits());
     JitSpewFin(JitSpew_RegAlloc);
 #endif
 
     return splitAt(bundle, callPositions);
 }
--- a/js/src/jit/BaselineBailouts.cpp
+++ b/js/src/jit/BaselineBailouts.cpp
@@ -966,17 +966,19 @@ InitFromBailout(JSContext* cx, HandleScr
                 // For fun.apply({}, arguments) the reconstructStackDepth will
                 // have stackdepth 4, but it could be that we inlined the
                 // funapply. In that case exprStackSlots, will have the real
                 // arguments in the slots and not be 4.
                 MOZ_ASSERT(exprStackSlots == expectedDepth);
             }
         }
     }
+#endif
 
+#ifdef JS_JITSPEW
     JitSpew(JitSpew_BaselineBailouts, "      Resuming %s pc offset %d (op %s) (line %d) of %s:%" PRIuSIZE,
                 resumeAfter ? "after" : "at", (int) pcOff, js_CodeName[op],
                 PCToLineNumber(script, pc), script->filename(), script->lineno());
     JitSpew(JitSpew_BaselineBailouts, "      Bailout kind: %s",
             BailoutKindString(bailoutKind));
 #endif
 
     bool pushedNewTarget = op == JSOP_NEW;
--- a/js/src/jit/Ion.cpp
+++ b/js/src/jit/Ion.cpp
@@ -2827,17 +2827,17 @@ InvalidateActivation(FreeOp* fop, const 
         activations->asJit()->setCheckRegs(false);
 #endif
 
     size_t frameno = 1;
 
     for (JitFrameIterator it(activations); !it.done(); ++it, ++frameno) {
         MOZ_ASSERT_IF(frameno == 1, it.isExitFrame() || it.type() == JitFrame_Bailout);
 
-#ifdef DEBUG
+#ifdef JS_JITSPEW
         switch (it.type()) {
           case JitFrame_Exit:
           case JitFrame_LazyLink:
             JitSpew(JitSpew_IonInvalidate, "#%d exit frame @ %p", frameno, it.fp());
             break;
           case JitFrame_BaselineJS:
           case JitFrame_IonJS:
           case JitFrame_Bailout:
@@ -2877,17 +2877,17 @@ InvalidateActivation(FreeOp* fop, const 
             break;
           case JitFrame_IonAccessorIC:
             JitSpew(JitSpew_IonInvalidate, "#%d ion IC getter/setter frame @ %p", frameno, it.fp());
             break;
           case JitFrame_Entry:
             JitSpew(JitSpew_IonInvalidate, "#%d entry frame @ %p", frameno, it.fp());
             break;
         }
-#endif
+#endif // JS_JITSPEW
 
         if (!it.isIonScripted())
             continue;
 
         bool calledFromLinkStub = false;
         JitCode* lazyLinkStub = fop->runtime()->jitRuntime()->lazyLinkStub();
         if (it.returnAddressToFp() >= lazyLinkStub->raw() &&
             it.returnAddressToFp() < lazyLinkStub->rawEnd())
--- a/js/src/jit/IonBuilder.cpp
+++ b/js/src/jit/IonBuilder.cpp
@@ -184,22 +184,26 @@ IonBuilder::clearForBackEnd()
     gsn.purge();
     scopeCoordinateNameCache.purge();
 }
 
 bool
 IonBuilder::abort(const char* message, ...)
 {
     // Don't call PCToLineNumber in release builds.
-#ifdef DEBUG
+#ifdef JS_JITSPEW
     va_list ap;
     va_start(ap, message);
     abortFmt(message, ap);
     va_end(ap);
+# ifdef DEBUG
     JitSpew(JitSpew_IonAbort, "aborted @ %s:%d", script()->filename(), PCToLineNumber(script(), pc));
+# else
+    JitSpew(JitSpew_IonAbort, "aborted @ %s", script()->filename());
+# endif
 #endif
     trackActionableAbort(message);
     return false;
 }
 
 IonBuilder*
 IonBuilder::outermostBuilder()
 {
@@ -10577,17 +10581,17 @@ IonBuilder::annotateGetPropertyCache(MDe
             return false;
     }
 
     if (inlinePropTable->numEntries() == 0) {
         getPropCache->clearInlinePropertyTable();
         return true;
     }
 
-#ifdef DEBUG
+#ifdef JS_JITSPEW
     if (inlinePropTable->numEntries() > 0)
         JitSpew(JitSpew_Inlining, "Annotated GetPropertyCache with %d/%d inline cases",
                                     (int) inlinePropTable->numEntries(), (int) objCount);
 #endif
 
     // If we successfully annotated the GetPropertyCache and there are inline cases,
     // then keep a resume point of the state right before this instruction for use
     // later when we have to bail out to this point in the fallback case of a
--- a/js/src/jit/JitcodeMap.cpp
+++ b/js/src/jit/JitcodeMap.cpp
@@ -1267,17 +1267,17 @@ JitcodeRegionEntry::ExpectedRunLength(co
         curBytecodeOffset = nextBytecodeOffset;
     }
 
     return runLength;
 }
 
 struct JitcodeMapBufferWriteSpewer
 {
-#ifdef DEBUG
+#ifdef JS_JITSPEW
     CompactBufferWriter* writer;
     uint32_t startPos;
 
     static const uint32_t DumpMaxBytes = 50;
 
     explicit JitcodeMapBufferWriteSpewer(CompactBufferWriter& w)
       : writer(&w), startPos(writer->length())
     {}
@@ -1300,20 +1300,20 @@ struct JitcodeMapBufferWriteSpewer
         else
             buffer[bytes*3 - 1] = '\0';
 
         JitSpew(JitSpew_Profiling, "%s@%d[%d bytes] - %s", name, int(startPos), int(bytes), buffer);
 
         // Move to the end of the current buffer.
         startPos = writer->length();
     }
-#else // !DEBUG
+#else // !JS_JITSPEW
     explicit JitcodeMapBufferWriteSpewer(CompactBufferWriter& w) {}
     void spewAndAdvance(const char* name) {}
-#endif // DEBUG
+#endif // JS_JITSPEW
 };
 
 // Write a run, starting at the given NativeToBytecode entry, into the given buffer writer.
 /* static */ bool
 JitcodeRegionEntry::WriteRun(CompactBufferWriter& writer,
                              JSScript** scriptList, uint32_t scriptListSize,
                              uint32_t runLength, const CodeGeneratorShared::NativeToBytecode* entry)
 {
--- a/js/src/jit/LICM.cpp
+++ b/js/src/jit/LICM.cpp
@@ -22,17 +22,17 @@ LoopContainsPossibleCall(MIRGraph& graph
         MOZ_ASSERT(i != graph.rpoEnd(), "Reached end of graph searching for blocks in loop");
         MBasicBlock* block = *i;
         if (!block->isMarked())
             continue;
 
         for (auto insIter(block->begin()), insEnd(block->end()); insIter != insEnd; ++insIter) {
             MInstruction* ins = *insIter;
             if (ins->possiblyCalls()) {
-#ifdef DEBUG
+#ifdef JS_JITSPEW
                 JitSpew(JitSpew_LICM, "    Possile call found at %s%u", ins->opName(), ins->id());
 #endif
                 return true;
             }
         }
 
         if (block == backedge)
             break;
@@ -149,71 +149,71 @@ MoveDeferredOperands(MInstruction* ins, 
         MOZ_ASSERT(RequiresHoistedUse(op, hasCalls),
                    "Deferred loop-invariant operand is not cheap");
         MInstruction* opIns = op->toInstruction();
 
         // Recursively move the operands. Note that the recursion is bounded
         // because we require RequiresHoistedUse to be set at each level.
         MoveDeferredOperands(opIns, hoistPoint, hasCalls);
 
-#ifdef DEBUG
+#ifdef JS_JITSPEW
         JitSpew(JitSpew_LICM, "    Hoisting %s%u (now that a user will be hoisted)",
                 opIns->opName(), opIns->id());
 #endif
 
         opIns->block()->moveBefore(hoistPoint, opIns);
     }
 }
 
 static void
 VisitLoopBlock(MBasicBlock* block, MBasicBlock* header, MInstruction* hoistPoint, bool hasCalls)
 {
     for (auto insIter(block->begin()), insEnd(block->end()); insIter != insEnd; ) {
         MInstruction* ins = *insIter++;
 
         if (!IsHoistable(ins, header, hasCalls)) {
-#ifdef DEBUG
+#ifdef JS_JITSPEW
             if (IsHoistableIgnoringDependency(ins, hasCalls)) {
                 JitSpew(JitSpew_LICM, "    %s%u isn't hoistable due to dependency on %s%u",
                         ins->opName(), ins->id(),
                         ins->dependency()->opName(), ins->dependency()->id());
             }
 #endif
             continue;
         }
 
         // Don't hoist a cheap constant if it doesn't enable us to hoist one of
         // its uses. We want those instructions as close as possible to their
         // use, to minimize register pressure.
         if (RequiresHoistedUse(ins, hasCalls)) {
-#ifdef DEBUG
+#ifdef JS_JITSPEW
             JitSpew(JitSpew_LICM, "    %s%u will be hoisted only if its users are",
                     ins->opName(), ins->id());
 #endif
             continue;
         }
 
         // Hoist operands which were too cheap to hoist on their own.
         MoveDeferredOperands(ins, hoistPoint, hasCalls);
 
-#ifdef DEBUG
+#ifdef JS_JITSPEW
         JitSpew(JitSpew_LICM, "    Hoisting %s%u", ins->opName(), ins->id());
 #endif
 
         // Move the instruction to the hoistPoint.
         block->moveBefore(hoistPoint, ins);
     }
 }
 
 static void
 VisitLoop(MIRGraph& graph, MBasicBlock* header)
 {
     MInstruction* hoistPoint = header->loopPredecessor()->lastIns();
 
-#ifdef DEBUG
+#ifdef JS_JITSPEW
     JitSpew(JitSpew_LICM, "  Visiting loop with header block%u, hoisting to %s%u",
             header->id(), hoistPoint->opName(), hoistPoint->id());
 #endif
 
     MBasicBlock* backedge = header->backedge();
 
     // This indicates whether the loop contains calls or other things which
     // clobber most or all floating-point registers. In such loops,
--- a/js/src/jit/LIR.cpp
+++ b/js/src/jit/LIR.cpp
@@ -467,17 +467,17 @@ LNode::printOperands(GenericPrinter& out
 }
 
 void
 LInstruction::assignSnapshot(LSnapshot* snapshot)
 {
     MOZ_ASSERT(!snapshot_);
     snapshot_ = snapshot;
 
-#ifdef DEBUG
+#ifdef JS_JITSPEW
     if (JitSpewEnabled(JitSpew_IonSnapshots)) {
         JitSpewHeader(JitSpew_IonSnapshots);
         Fprinter& out = JitSpewPrinter();
         out.printf("Assigning snapshot %p to instruction %p (",
                    (void*)snapshot, (void*)this);
         printName(out);
         out.printf(")\n");
     }
--- a/js/src/jit/LoopUnroller.cpp
+++ b/js/src/jit/LoopUnroller.cpp
@@ -163,17 +163,17 @@ LoopUnroller::go(LoopIterationBound* bou
     for (size_t i = 0; i < ArrayLength(bodyBlocks); i++) {
         MBasicBlock* block = bodyBlocks[i];
         for (MInstructionIterator iter(block->begin()); iter != block->end(); iter++) {
             MInstruction* ins = *iter;
             if (ins->canClone())
                 continue;
             if (ins->isTest() || ins->isGoto() || ins->isInterruptCheck())
                 continue;
-#ifdef DEBUG
+#ifdef JS_JITSPEW
             JitSpew(JitSpew_Unrolling, "Aborting: can't clone instruction %s", ins->opName());
 #endif
             return;
         }
     }
 
     // Compute the linear inequality we will use for exiting the unrolled loop:
     //
--- a/js/src/jit/OptimizationTracking.cpp
+++ b/js/src/jit/OptimizationTracking.cpp
@@ -134,44 +134,44 @@ JS::TrackedTypeSiteString(TrackedTypeSit
         MOZ_CRASH("bad type site");
     }
 }
 
 void
 SpewTempOptimizationTypeInfoVector(const TempOptimizationTypeInfoVector* types,
                                    const char* indent = nullptr)
 {
-#ifdef DEBUG
+#ifdef JS_JITSPEW
     for (const OptimizationTypeInfo* t = types->begin(); t != types->end(); t++) {
         JitSpewStart(JitSpew_OptimizationTracking, "   %s%s of type %s, type set",
                      indent ? indent : "",
                      TrackedTypeSiteString(t->site()), StringFromMIRType(t->mirType()));
         for (uint32_t i = 0; i < t->types().length(); i++)
             JitSpewCont(JitSpew_OptimizationTracking, " %s", TypeSet::TypeString(t->types()[i]));
         JitSpewFin(JitSpew_OptimizationTracking);
     }
 #endif
 }
 
 void
 SpewTempOptimizationAttemptsVector(const TempOptimizationAttemptsVector* attempts,
                                    const char* indent = nullptr)
 {
-#ifdef DEBUG
+#ifdef JS_JITSPEW
     for (const OptimizationAttempt* a = attempts->begin(); a != attempts->end(); a++) {
         JitSpew(JitSpew_OptimizationTracking, "   %s%s: %s", indent ? indent : "",
                 TrackedStrategyString(a->strategy()), TrackedOutcomeString(a->outcome()));
     }
 #endif
 }
 
 void
 TrackedOptimizations::spew() const
 {
-#ifdef DEBUG
+#ifdef JS_JITSPEW
     SpewTempOptimizationTypeInfoVector(&types_);
     SpewTempOptimizationAttemptsVector(&attempts_);
 #endif
 }
 
 bool
 OptimizationTypeInfo::trackTypeSet(TemporaryTypeSet* typeSet)
 {
@@ -847,17 +847,17 @@ MaybeConstructorFromType(TypeSet::Type t
     if (!newScript && obj->maybeUnboxedLayout())
         newScript = obj->unboxedLayout().newScript();
     return newScript ? newScript->function() : nullptr;
 }
 
 static void
 SpewConstructor(TypeSet::Type ty, JSFunction* constructor)
 {
-#ifdef DEBUG
+#ifdef JS_JITSPEW
     if (!constructor->isInterpreted()) {
         JitSpew(JitSpew_OptimizationTracking, "   Unique type %s has native constructor",
                 TypeSet::TypeString(ty));
         return;
     }
 
     char buf[512];
     if (constructor->displayAtom())
@@ -878,17 +878,17 @@ SpewConstructor(TypeSet::Type ty, JSFunc
     JitSpew(JitSpew_OptimizationTracking, "   Unique type %s has constructor %s (%s:%" PRIuSIZE ")",
             TypeSet::TypeString(ty), buf, filename, lineno);
 #endif
 }
 
 static void
 SpewAllocationSite(TypeSet::Type ty, JSScript* script, uint32_t offset)
 {
-#ifdef DEBUG
+#ifdef JS_JITSPEW
     JitSpew(JitSpew_OptimizationTracking, "   Unique type %s has alloc site %s:%u",
             TypeSet::TypeString(ty), script->filename(),
             PCToLineNumber(script, script->offsetToPC(offset)));
 #endif
 }
 
 bool
 jit::WriteIonTrackedOptimizationsTable(JSContext* cx, CompactBufferWriter& writer,
@@ -898,17 +898,17 @@ jit::WriteIonTrackedOptimizationsTable(J
                                        uint32_t* numRegions,
                                        uint32_t* regionTableOffsetp,
                                        uint32_t* typesTableOffsetp,
                                        uint32_t* optimizationTableOffsetp,
                                        IonTrackedTypeVector* allTypes)
 {
     MOZ_ASSERT(unique.sorted());
 
-#ifdef DEBUG
+#ifdef JS_JITSPEW
     // Spew training data, which may be fed into a script to determine a good
     // encoding strategy.
     if (JitSpewEnabled(JitSpew_OptimizationTracking)) {
         JitSpewStart(JitSpew_OptimizationTracking, "=> Training data: ");
         for (const NativeToTrackedOptimizations* entry = start; entry != end; entry++) {
             JitSpewCont(JitSpew_OptimizationTracking, "%u,%u,%u ",
                         entry->startOffset.offset(), entry->endOffset.offset(),
                         unique.indexOf(entry->optimizations));
--- a/js/src/jit/RangeAnalysis.cpp
+++ b/js/src/jit/RangeAnalysis.cpp
@@ -107,17 +107,17 @@ IsDominatedUse(MBasicBlock* block, MUse*
     }
 
     return block->dominates(n->block());
 }
 
 static inline void
 SpewRange(MDefinition* def)
 {
-#ifdef DEBUG
+#ifdef JS_JITSPEW
     if (JitSpewEnabled(JitSpew_Range) && def->type() != MIRType_None && def->range()) {
         JitSpewHeader(JitSpew_Range);
         Fprinter& out = JitSpewPrinter();
         def->printName(out);
         out.printf(" has range ");
         def->range()->dump(out);
     }
 #endif
--- a/js/src/jit/RegisterAllocator.cpp
+++ b/js/src/jit/RegisterAllocator.cpp
@@ -78,20 +78,21 @@ AllocationIntegrityState::record()
     return seen.init();
 }
 
 bool
 AllocationIntegrityState::check(bool populateSafepoints)
 {
     MOZ_ASSERT(!instructions.empty());
 
-#ifdef DEBUG
+#ifdef JS_JITSPEW
     if (JitSpewEnabled(JitSpew_RegAlloc))
         dump();
-
+#endif
+#ifdef DEBUG
     for (size_t blockIndex = 0; blockIndex < graph.numBlocks(); blockIndex++) {
         LBlock* block = graph.getBlock(blockIndex);
 
         // Check that all instruction inputs and outputs have been assigned an allocation.
         for (LInstructionIterator iter = block->begin(); iter != block->end(); iter++) {
             LInstruction* ins = *iter;
 
             for (LInstruction::InputIterator alloc(*ins); alloc.more(); alloc.next())
--- a/js/src/jit/Safepoints.cpp
+++ b/js/src/jit/Safepoints.cpp
@@ -106,17 +106,17 @@ SafepointWriter::writeGcRegs(LSafepoint*
     }
 
     // GC registers are a subset of the spilled registers.
     MOZ_ASSERT((valueRegs.bits() & ~spilledGpr.bits()) == 0);
     MOZ_ASSERT((gc.bits() & ~spilledGpr.bits()) == 0);
 
     WriteFloatRegisterMask(stream_, spilledFloat.bits());
 
-#ifdef DEBUG
+#ifdef JS_JITSPEW
     if (JitSpewEnabled(JitSpew_Safepoints)) {
         for (GeneralRegisterForwardIterator iter(spilledGpr); iter.more(); iter++) {
             const char* type = gc.has(*iter)
                                ? "gc"
                                : slots.has(*iter)
                                  ? "slots"
                                  : valueRegs.has(*iter)
                                    ? "value"
@@ -158,17 +158,17 @@ MapSlotsToBitset(BitSet& stackSet, BitSe
     WriteBitset(argumentSet, stream);
 }
 
 void
 SafepointWriter::writeGcSlots(LSafepoint* safepoint)
 {
     LSafepoint::SlotList& slots = safepoint->gcSlots();
 
-#ifdef DEBUG
+#ifdef JS_JITSPEW
     for (uint32_t i = 0; i < slots.length(); i++)
         JitSpew(JitSpew_Safepoints, "    gc slot: %d", slots[i]);
 #endif
 
     MapSlotsToBitset(frameSlots_, argumentSlots_, stream_, slots);
 }
 
 void
@@ -176,29 +176,29 @@ SafepointWriter::writeSlotsOrElementsSlo
 {
     LSafepoint::SlotList& slots = safepoint->slotsOrElementsSlots();
 
     stream_.writeUnsigned(slots.length());
 
     for (uint32_t i = 0; i < slots.length(); i++) {
         if (!slots[i].stack)
             MOZ_CRASH();
-#ifdef DEBUG
+#ifdef JS_JITSPEW
         JitSpew(JitSpew_Safepoints, "    slots/elements slot: %d", slots[i].slot);
 #endif
         stream_.writeUnsigned(slots[i].slot);
     }
 }
 
 void
 SafepointWriter::writeValueSlots(LSafepoint* safepoint)
 {
     LSafepoint::SlotList& slots = safepoint->valueSlots();
 
-#ifdef DEBUG
+#ifdef JS_JITSPEW
     for (uint32_t i = 0; i < slots.length(); i++)
         JitSpew(JitSpew_Safepoints, "    gc value: %d", slots[i]);
 #endif
 
     MapSlotsToBitset(frameSlots_, argumentSlots_, stream_, slots);
 }
 
 #if defined(DEBUG) && defined(JS_NUNBOX32)
@@ -284,17 +284,17 @@ CanEncodeInfoInHeader(const LAllocation&
     return *out < MAX_INFO_VALUE;
 }
 
 void
 SafepointWriter::writeNunboxParts(LSafepoint* safepoint)
 {
     LSafepoint::NunboxList& entries = safepoint->nunboxParts();
 
-# ifdef DEBUG
+# ifdef JS_JITSPEW
     if (JitSpewEnabled(JitSpew_Safepoints)) {
         for (uint32_t i = 0; i < entries.length(); i++) {
             SafepointNunboxEntry& entry = entries[i];
             if (entry.type.isUse() || entry.payload.isUse())
                 continue;
             JitSpewHeader(JitSpew_Safepoints);
             Fprinter& out = JitSpewPrinter();
             out.printf("    nunbox (type in ");
--- a/js/src/jit/SharedIC.cpp
+++ b/js/src/jit/SharedIC.cpp
@@ -26,17 +26,17 @@
 #include "jit/MacroAssembler-inl.h"
 #include "vm/Interpreter-inl.h"
 
 using mozilla::BitwiseCast;
 
 namespace js {
 namespace jit {
 
-#ifdef DEBUG
+#ifdef JS_JITSPEW
 void
 FallbackICSpew(JSContext* cx, ICFallbackStub* stub, const char* fmt, ...)
 {
     if (JitSpewEnabled(JitSpew_BaselineICFallback)) {
         RootedScript script(cx, GetTopJitJSScript(cx));
         jsbytecode* pc = stub->icEntry()->pc(script);
 
         char fmtbuf[100];
@@ -76,17 +76,17 @@ TypeFallbackICSpew(JSContext* cx, ICType
                 script->lineno(),
                 script->pcToOffset(pc),
                 PCToLineNumber(script, pc),
                 script->getWarmUpCount(),
                 (int) stub->numOptimizedMonitorStubs(),
                 fmtbuf);
     }
 }
-#endif
+#endif // JS_JITSPEW
 
 ICFallbackStub*
 ICEntry::fallbackStub() const
 {
     return firstStub()->getChainFallback();
 }
 
 void
--- a/js/src/jit/SharedIC.h
+++ b/js/src/jit/SharedIC.h
@@ -192,17 +192,17 @@ namespace jit {
 class ICStub;
 class ICFallbackStub;
 
 #define FORWARD_DECLARE_STUBS(kindName) class IC##kindName;
     IC_BASELINE_STUB_KIND_LIST(FORWARD_DECLARE_STUBS)
     IC_SHARED_STUB_KIND_LIST(FORWARD_DECLARE_STUBS)
 #undef FORWARD_DECLARE_STUBS
 
-#ifdef DEBUG
+#ifdef JS_JITSPEW
 void FallbackICSpew(JSContext* cx, ICFallbackStub* stub, const char* fmt, ...);
 void TypeFallbackICSpew(JSContext* cx, ICTypeMonitor_Fallback* stub, const char* fmt, ...);
 #else
 #define FallbackICSpew(...)
 #define TypeFallbackICSpew(...)
 #endif
 
 //
--- a/js/src/jit/ValueNumbering.cpp
+++ b/js/src/jit/ValueNumbering.cpp
@@ -51,17 +51,17 @@ bool
 ValueNumberer::VisibleValues::ValueHasher::match(Key k, Lookup l)
 {
     // If one of the instructions depends on a store, and the other instruction
     // does not depend on the same store, the instructions are not congruent.
     if (k->dependency() != l->dependency())
         return false;
 
     bool congruent = k->congruentTo(l); // Ask the values themselves what they think.
-#ifdef DEBUG
+#ifdef JS_JITSPEW
     if (congruent != l->congruentTo(k)) {
        JitSpew(JitSpew_GVN, "      congruentTo relation is not symmetric between %s%u and %s%u!!",
                k->opName(), k->id(),
                l->opName(), l->id());
     }
 #endif
     return congruent;
 }
@@ -327,21 +327,22 @@ ValueNumberer::releaseOperands(MDefiniti
     }
     return true;
 }
 
 // Discard |def| and mine its operands for any subsequently dead defs.
 bool
 ValueNumberer::discardDef(MDefinition* def)
 {
-#ifdef DEBUG
+#ifdef JS_JITSPEW
     JitSpew(JitSpew_GVN, "      Discarding %s %s%u",
             def->block()->isMarked() ? "unreachable" : "dead",
             def->opName(), def->id());
-
+#endif
+#ifdef DEBUG
     MOZ_ASSERT(def != nextDef_, "Invalidating the MDefinition iterator");
     if (def->block()->isMarked()) {
         MOZ_ASSERT(!def->hasUses(), "Discarding def that still has uses");
     } else {
         MOZ_ASSERT(IsDiscardable(def), "Discarding non-discardable definition");
         MOZ_ASSERT(!values_.has(def), "Discarding a definition still in the set");
     }
 #endif
@@ -527,17 +528,17 @@ ValueNumberer::removePredecessorAndClean
                 origBackedgeForOSRFixup = block->backedge();
             } else {
                 // Deleting the entry into the loop makes the loop unreachable.
                 isUnreachableLoop = true;
                 JitSpew(JitSpew_GVN, "      "
                         "Loop with header block%u is no longer reachable",
                         block->id());
             }
-#ifdef DEBUG
+#ifdef JS_JITSPEW
         } else if (block->hasUniqueBackedge() && block->backedge() == pred) {
             JitSpew(JitSpew_GVN, "      Loop with header block%u is no longer a loop",
                     block->id());
 #endif
         }
     }
 
     // Actually remove the CFG edge.
@@ -643,17 +644,17 @@ ValueNumberer::leader(MDefinition* def)
             // dominator tree, so overwrite it.
             values_.overwrite(p, def);
         } else {
             // No match. Add a new entry.
             if (!values_.add(p, def))
                 return nullptr;
         }
 
-#ifdef DEBUG
+#ifdef JS_JITSPEW
         JitSpew(JitSpew_GVN, "      Recording %s%u", def->opName(), def->id());
 #endif
     }
 
     return def;
 }
 
 // Test whether |phi| is dominated by a congruent phi.
@@ -757,17 +758,17 @@ ValueNumberer::visitDefinition(MDefiniti
             return false;
 
         bool isNewInstruction = sim->block() == nullptr;
 
         // If |sim| doesn't belong to a block, insert it next to |def|.
         if (isNewInstruction)
             def->block()->insertAfter(def->toInstruction(), sim->toInstruction());
 
-#ifdef DEBUG
+#ifdef JS_JITSPEW
         JitSpew(JitSpew_GVN, "      Folded %s%u to %s%u",
                 def->opName(), def->id(), sim->opName(), sim->id());
 #endif
         MOZ_ASSERT(!sim->isDiscarded());
         ReplaceAllUsesWith(def, sim);
 
         // The node's foldsTo said |def| can be replaced by |rep|. If |def| is a
         // guard, then either |rep| is also a guard, or a guard isn't actually
@@ -799,17 +800,17 @@ ValueNumberer::visitDefinition(MDefiniti
         def->setDependency(dep);
 
     // Look for a dominating def which makes |def| redundant.
     MDefinition* rep = leader(def);
     if (rep != def) {
         if (rep == nullptr)
             return false;
         if (rep->updateForReplacement(def)) {
-#ifdef DEBUG
+#ifdef JS_JITSPEW
             JitSpew(JitSpew_GVN,
                     "      Replacing %s%u with %s%u",
                     def->opName(), def->id(), rep->opName(), rep->id());
 #endif
             ReplaceAllUsesWith(def, rep);
 
             // The node's congruentTo said |def| is congruent to |rep|, and it's
             // dominated by |rep|. If |def| is a guard, it's covered by |rep|,
@@ -843,17 +844,17 @@ ValueNumberer::visitControlInstruction(M
         return true;
 
     if (rep == nullptr)
         return false;
 
     MControlInstruction* newControl = rep->toControlInstruction();
     MOZ_ASSERT(!newControl->block(),
                "Control instruction replacement shouldn't already be in a block");
-#ifdef DEBUG
+#ifdef JS_JITSPEW
     JitSpew(JitSpew_GVN, "      Folded control instruction %s%u to %s%u",
             control->opName(), control->id(), newControl->opName(), graph_.getNumInstructionIds());
 #endif
 
     // If the simplification removes any CFG edges, update the CFG and remove
     // any blocks that become dead.
     size_t oldNumSuccs = control->numSuccessors();
     size_t newNumSuccs = newControl->numSuccessors();
--- a/js/src/jit/shared/CodeGenerator-shared.cpp
+++ b/js/src/jit/shared/CodeGenerator-shared.cpp
@@ -273,29 +273,29 @@ CodeGeneratorShared::addNativeToBytecode
     JitSpew(JitSpew_Profiling, " => Push new entry.");
     dumpNativeToBytecodeEntry(nativeToBytecodeList_.length() - 1);
     return true;
 }
 
 void
 CodeGeneratorShared::dumpNativeToBytecodeEntries()
 {
-#ifdef DEBUG
+#ifdef JS_JITSPEW
     InlineScriptTree* topTree = gen->info().inlineScriptTree();
     JitSpewStart(JitSpew_Profiling, "Native To Bytecode Entries for %s:%d\n",
                  topTree->script()->filename(), topTree->script()->lineno());
     for (unsigned i = 0; i < nativeToBytecodeList_.length(); i++)
         dumpNativeToBytecodeEntry(i);
 #endif
 }
 
 void
 CodeGeneratorShared::dumpNativeToBytecodeEntry(uint32_t idx)
 {
-#ifdef DEBUG
+#ifdef JS_JITSPEW
     NativeToBytecode& ref = nativeToBytecodeList_[idx];
     InlineScriptTree* tree = ref.tree;
     JSScript* script = tree->script();
     uint32_t nativeOffset = ref.nativeOffset.offset();
     unsigned nativeDelta = 0;
     unsigned pcDelta = 0;
     if (idx + 1 < nativeToBytecodeList_.length()) {
         NativeToBytecode* nextRef = &ref + 1;
--- a/js/src/jit/shared/IonAssemblerBufferWithConstantPools.h
+++ b/js/src/jit/shared/IonAssemblerBufferWithConstantPools.h
@@ -447,18 +447,18 @@ struct AssemblerBufferWithConstantPools 
         // check.
         MOZ_ASSERT_IF(numPoolEntries, !canNotPlacePool_);
 
         if (this->oom() && !this->bail())
             return BufferOffset();
 
         insertNopFill();
 
-#ifdef DEBUG
-        if (numPoolEntries) {
+#ifdef JS_JITSPEW
+        if (numPoolEntries && JitSpewEnabled(JitSpew_Pools)) {
             JitSpew(JitSpew_Pools, "[%d] Inserting %d entries into pool", id, numPoolEntries);
             JitSpewStart(JitSpew_Pools, "[%d] data is: 0x", id);
             size_t length = numPoolEntries * sizeof(PoolAllocUnit);
             for (unsigned idx = 0; idx < length; idx++) {
                 JitSpewCont(JitSpew_Pools, "%02x", data[length - idx - 1]);
                 if (((idx & 3) == 3) && (idx + 1 != length))
                     JitSpewCont(JitSpew_Pools, "_");
             }