Bug 1092110: Make a few functions and members debug only; r=dougc
authorBenjamin Bouvier <benj@benj.me>
Tue, 04 Nov 2014 15:30:45 +0100
changeset 213929 6e3bfcef5b4b6ec3fc977ae82164935a7b466b7d
parent 213928 9c0efc3d1207ffe3135a54ab963629bb736d304d
child 213930 0b1f0a4afb917af5c8a516439bbee40ad109ae3d
push id27768
push userkwierso@gmail.com
push dateWed, 05 Nov 2014 02:19:03 +0000
treeherdermozilla-central@a1823d3c7365 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdougc
bugs1092110
milestone36.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 1092110: Make a few functions and members debug only; r=dougc
js/src/jit/IonAnalysis.cpp
js/src/jit/shared/CodeGenerator-x86-shared.cpp
js/src/jsapi.cpp
js/src/jsscript.cpp
js/src/vm/SelfHosting.cpp
js/src/vm/Stack-inl.h
js/src/vm/Stack.h
js/src/vm/ThreadPool.cpp
js/src/vm/ThreadPool.h
--- a/js/src/jit/IonAnalysis.cpp
+++ b/js/src/jit/IonAnalysis.cpp
@@ -1972,29 +1972,29 @@ jit::AssertGraphCoherency(MIRGraph &grap
 #ifdef DEBUG
     if (!js_JitOptions.checkGraphConsistency)
         return;
     AssertBasicGraphCoherency(graph);
     AssertReversePostorder(graph);
 #endif
 }
 
+#ifdef DEBUG
 static void
 AssertResumePointDominatedByOperands(MResumePoint *resume)
 {
-#ifdef DEBUG
     for (size_t i = 0, e = resume->numOperands(); i < e; ++i) {
         MDefinition *op = resume->getOperand(i);
         if (op->type() == MIRType_MagicOptimizedArguments)
             continue;
         MOZ_ASSERT(op->block()->dominates(resume->block()),
                    "Resume point is not dominated by its operands");
     }
-#endif
 }
+#endif // DEBUG
 
 void
 jit::AssertExtendedGraphCoherency(MIRGraph &graph)
 {
     // Checks the basic GraphCoherency but also other conditions that
     // do not hold immediately (such as the fact that critical edges
     // are split)
 
--- a/js/src/jit/shared/CodeGenerator-x86-shared.cpp
+++ b/js/src/jit/shared/CodeGenerator-x86-shared.cpp
@@ -2204,18 +2204,17 @@ CodeGeneratorX86Shared::visitFloat32x4To
     FloatRegister out = ToFloatRegister(ins->output());
     masm.convertFloat32x4ToInt32x4(in, out);
     return true;
 }
 
 bool
 CodeGeneratorX86Shared::visitSimdValueInt32x4(LSimdValueInt32x4 *ins)
 {
-    MSimdValueX4 *mir = ins->mir();
-    MOZ_ASSERT(mir->type() == MIRType_Int32x4);
+    MOZ_ASSERT(ins->mir()->type() == MIRType_Int32x4);
 
     FloatRegister output = ToFloatRegister(ins->output());
     if (AssemblerX86Shared::HasSSE41()) {
         masm.movd(ToRegister(ins->getOperand(0)), output);
         for (size_t i = 1; i < 4; ++i) {
             Register r = ToRegister(ins->getOperand(i));
             masm.pinsrd(i, r, output);
         }
@@ -2230,22 +2229,20 @@ CodeGeneratorX86Shared::visitSimdValueIn
     masm.loadAlignedInt32x4(Address(StackPointer, 0), output);
     masm.freeStack(Simd128DataSize);
     return true;
 }
 
 bool
 CodeGeneratorX86Shared::visitSimdValueFloat32x4(LSimdValueFloat32x4 *ins)
 {
-    MSimdValueX4 *mir = ins->mir();
-    MOZ_ASSERT(mir->type() == MIRType_Float32x4);
-
-    FloatRegister output = ToFloatRegister(ins->output());
+    MOZ_ASSERT(ins->mir()->type() == MIRType_Float32x4);
+
     FloatRegister r0 = ToFloatRegister(ins->getOperand(0));
-    MOZ_ASSERT(r0 == output); // defineReuseInput(0)
+    MOZ_ASSERT(r0 == ToFloatRegister(ins->output())); // defineReuseInput(0)
 
     FloatRegister r1 = ToFloatRegister(ins->getTemp(0));
     FloatRegister r2 = ToFloatRegister(ins->getOperand(2));
     FloatRegister r3 = ToFloatRegister(ins->getOperand(3));
 
     masm.unpcklps(r3, r1);
     masm.unpcklps(r2, r0);
     masm.unpcklps(r1, r0);
@@ -2843,19 +2840,18 @@ CodeGeneratorX86Shared::visitSimdBinaryB
         return true;
     }
     MOZ_CRASH("unexpected SIMD bitwise op");
 }
 
 bool
 CodeGeneratorX86Shared::visitSimdShift(LSimdShift *ins)
 {
-    FloatRegister vec = ToFloatRegister(ins->vector());
     FloatRegister out = ToFloatRegister(ins->output());
-    MOZ_ASSERT(vec == out); // defineReuseInput(0);
+    MOZ_ASSERT(ToFloatRegister(ins->vector()) == out); // defineReuseInput(0);
 
     // TODO: If the shift count is greater than 31, this will just zero all
     // lanes by default for lsh and ursh, and set the count to 32 for rsh
     // (which will just extend the sign bit to all bits). Plain JS doesn't do
     // this: instead it only keeps the five low bits of the mask. Spec isn't
     // clear about that topic so this might need to be fixed. See also bug
     // 1068028.
     const LAllocation *val = ins->value();
--- a/js/src/jsapi.cpp
+++ b/js/src/jsapi.cpp
@@ -5594,28 +5594,30 @@ JS::GetSymbolCode(Handle<Symbol*> symbol
 }
 
 JS_PUBLIC_API(JS::Symbol *)
 JS::GetWellKnownSymbol(JSContext *cx, JS::SymbolCode which)
 {
     return cx->wellKnownSymbols().get(uint32_t(which));
 }
 
+#ifdef DEBUG
 static bool
 PropertySpecNameIsDigits(const char *s) {
     if (JS::PropertySpecNameIsSymbol(s))
         return false;
     if (!*s)
         return false;
     for (; *s; s++) {
         if (*s < '0' || *s > '9')
             return false;
     }
     return true;
 }
+#endif // DEBUG
 
 JS_PUBLIC_API(bool)
 JS::PropertySpecNameEqualsId(const char *name, HandleId id)
 {
     if (JS::PropertySpecNameIsSymbol(name)) {
         if (!JSID_IS_SYMBOL(id))
             return false;
         Symbol *sym = JSID_TO_SYMBOL(id);
--- a/js/src/jsscript.cpp
+++ b/js/src/jsscript.cpp
@@ -87,19 +87,19 @@ Bindings::initWithTemporaryStorage(Exclu
 {
     MOZ_ASSERT(!self->callObjShape_);
     MOZ_ASSERT(self->bindingArrayAndFlag_ == TEMPORARY_STORAGE_BIT);
     MOZ_ASSERT(!(uintptr_t(bindingArray) & TEMPORARY_STORAGE_BIT));
     MOZ_ASSERT(numArgs <= ARGC_LIMIT);
     MOZ_ASSERT(numVars <= LOCALNO_LIMIT);
     MOZ_ASSERT(numBlockScoped <= LOCALNO_LIMIT);
     MOZ_ASSERT(numBodyLevelLexicals <= LOCALNO_LIMIT);
-    uint64_t totalSlots = uint64_t(numVars) +
-                          uint64_t(numBodyLevelLexicals) +
-                          uint64_t(numBlockScoped);
+    mozilla::DebugOnly<uint64_t> totalSlots = uint64_t(numVars) +
+                                              uint64_t(numBodyLevelLexicals) +
+                                              uint64_t(numBlockScoped);
     MOZ_ASSERT(totalSlots <= LOCALNO_LIMIT);
     MOZ_ASSERT(UINT32_MAX - numArgs >= totalSlots);
 
     MOZ_ASSERT(numUnaliasedVars <= numVars);
     MOZ_ASSERT(numUnaliasedBodyLevelLexicals <= numBodyLevelLexicals);
 
     self->bindingArrayAndFlag_ = uintptr_t(bindingArray) | TEMPORARY_STORAGE_BIT;
     self->numArgs_ = numArgs;
--- a/js/src/vm/SelfHosting.cpp
+++ b/js/src/vm/SelfHosting.cpp
@@ -1,16 +1,18 @@
 /* -*- 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/. */
 
 #include "vm/SelfHosting.h"
 
+#include "mozilla/DebugOnly.h"
+
 #include "jscntxt.h"
 #include "jscompartment.h"
 #include "jsdate.h"
 #include "jsfriendapi.h"
 #include "jshashutil.h"
 #include "jsweakmap.h"
 #include "jswrapper.h"
 #include "selfhosted.out.h"
@@ -725,18 +727,17 @@ intrinsic_CloseClosingLegacyGeneratorObj
     MOZ_ASSERT(genObj->isClosing());
     genObj->setClosed();
     return true;
 }
 
 static bool
 intrinsic_ThrowStopIteration(JSContext *cx, unsigned argc, Value *vp)
 {
-    CallArgs args = CallArgsFromVp(argc, vp);
-    MOZ_ASSERT(args.length() == 0);
+    MOZ_ASSERT(CallArgsFromVp(argc, vp).length() == 0);
 
     return ThrowStopIteration(cx);
 }
 
 static bool
 intrinsic_GeneratorIsRunning(JSContext *cx, unsigned argc, Value *vp)
 {
     CallArgs args = CallArgsFromVp(argc, vp);
@@ -1498,17 +1499,17 @@ CloneValue(JSContext *cx, HandleValue se
             MOZ_CRASH();
         JSFlatString *selfHostedString = &selfHostedValue.toString()->asFlat();
         JSString *clone = CloneString(cx, selfHostedString);
         if (!clone)
             return false;
         vp.setString(clone);
     } else if (selfHostedValue.isSymbol()) {
         // Well-known symbols are shared.
-        JS::Symbol *sym = selfHostedValue.toSymbol();
+        mozilla::DebugOnly<JS::Symbol *> sym = selfHostedValue.toSymbol();
         MOZ_ASSERT(sym->isWellKnownSymbol());
         MOZ_ASSERT(cx->wellKnownSymbols().get(size_t(sym->code())) == sym);
         vp.set(selfHostedValue);
     } else {
         MOZ_CRASH("Self-hosting CloneValue can't clone given value.");
     }
     return true;
 }
--- a/js/src/vm/Stack-inl.h
+++ b/js/src/vm/Stack-inl.h
@@ -808,26 +808,25 @@ Activation::mostRecentProfiling()
     if (isProfiling())
         return this;
     return prevProfiling_;
 }
 
 InterpreterActivation::InterpreterActivation(RunState &state, JSContext *cx,
                                              InterpreterFrame *entryFrame)
   : Activation(cx, Interpreter),
-    state_(state),
     entryFrame_(entryFrame),
     opMask_(0)
 #ifdef DEBUG
   , oldFrameCount_(cx->runtime()->interpreterStack().frameCount_)
 #endif
 {
     regs_.prepareToRun(*entryFrame, state.script());
     MOZ_ASSERT(regs_.pc == state.script()->code());
-    MOZ_ASSERT_IF(entryFrame_->isEvalFrame(), state_.script()->isActiveEval());
+    MOZ_ASSERT_IF(entryFrame_->isEvalFrame(), state.script()->isActiveEval());
 }
 
 InterpreterActivation::~InterpreterActivation()
 {
     // Pop all inline frames.
     while (regs_.fp() != entryFrame_)
         popInlineFrame(regs_.fp());
 
--- a/js/src/vm/Stack.h
+++ b/js/src/vm/Stack.h
@@ -1156,17 +1156,16 @@ static_assert(EnableInterruptsPseudoOpco
 
 class InterpreterFrameIterator;
 class RunState;
 
 class InterpreterActivation : public Activation
 {
     friend class js::InterpreterFrameIterator;
 
-    RunState &state_;
     InterpreterRegs regs_;
     InterpreterFrame *entryFrame_;
     size_t opMask_; // For debugger interrupts, see js::Interpret.
 
 #ifdef DEBUG
     size_t oldFrameCount_;
 #endif
 
--- a/js/src/vm/ThreadPool.cpp
+++ b/js/src/vm/ThreadPool.cpp
@@ -254,18 +254,18 @@ ThreadPoolWorker::terminate(AutoLockMoni
 //
 // The |ThreadPool| starts up workers, submits work to them, and shuts
 // them down when requested.
 
 ThreadPool::ThreadPool(JSRuntime *rt)
   : activeWorkers_(0),
     joinBarrier_(nullptr),
     job_(nullptr),
+#ifdef DEBUG
     runtime_(rt),
-#ifdef DEBUG
     stolenSlices_(0),
 #endif
     pendingSlices_(0),
     isMainThreadActive_(false),
     chunkLock_(nullptr),
     timeOfLastAllocation_(0),
     freeChunks_(nullptr)
 { }
--- a/js/src/vm/ThreadPool.h
+++ b/js/src/vm/ThreadPool.h
@@ -173,19 +173,19 @@ class ThreadPool : public Monitor
 
     // The number of active workers. Should only access under lock.
     uint32_t activeWorkers_;
     PRCondVar *joinBarrier_;
 
     // The current job.
     ParallelJob *job_;
 
+#ifdef DEBUG
     // Initialized at startup only.
     JSRuntime *const runtime_;
-#ifdef DEBUG
     // Number of stolen slices in the last parallel job.
     mozilla::Atomic<uint32_t, mozilla::ReleaseAcquire> stolenSlices_;
 #endif
 
     // Number of pending slices in the current job.
     mozilla::Atomic<uint32_t, mozilla::ReleaseAcquire> pendingSlices_;
 
     // Whether the main thread is currently processing slices.