mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-03 04:27:41 +00:00
Bug 647011: Sprinkle some DebugOnly in js/src. r=luke
This commit is contained in:
parent
6fc1821695
commit
a7c243271a
@ -1000,10 +1000,7 @@ js_DestroyContext(JSContext *cx, JSDestroyContextMode mode)
|
||||
* JSCONTEXT_DESTROY callback is not allowed to fail and must
|
||||
* return true.
|
||||
*/
|
||||
#ifdef DEBUG
|
||||
JSBool callbackStatus =
|
||||
#endif
|
||||
cxCallback(cx, JSCONTEXT_DESTROY);
|
||||
DebugOnly<JSBool> callbackStatus = cxCallback(cx, JSCONTEXT_DESTROY);
|
||||
JS_ASSERT(callbackStatus);
|
||||
}
|
||||
}
|
||||
|
@ -2510,10 +2510,8 @@ class AutoEnumStateRooter : private AutoGCRooter
|
||||
|
||||
~AutoEnumStateRooter() {
|
||||
if (!stateValue.isNull()) {
|
||||
#ifdef DEBUG
|
||||
JSBool ok =
|
||||
#endif
|
||||
obj->enumerate(context, JSENUMERATE_DESTROY, &stateValue, 0);
|
||||
DebugOnly<JSBool> ok =
|
||||
obj->enumerate(context, JSENUMERATE_DESTROY, &stateValue, 0);
|
||||
JS_ASSERT(ok);
|
||||
}
|
||||
}
|
||||
|
@ -850,9 +850,7 @@ OptimizeSpanDeps(JSContext *cx, JSCodeGenerator *cg)
|
||||
JSSrcNoteSpec *spec;
|
||||
uintN i, n, noteIndex;
|
||||
JSTryNode *tryNode;
|
||||
#ifdef DEBUG_brendan
|
||||
int passes = 0;
|
||||
#endif
|
||||
DebugOnly<int> passes = 0;
|
||||
|
||||
base = CG_BASE(cg);
|
||||
sdbase = cg->spanDeps;
|
||||
@ -4694,10 +4692,7 @@ js_EmitTree(JSContext *cx, JSCodeGenerator *cg, JSParseNode *pn)
|
||||
if (!EmitFunctionDefNop(cx, cg, index))
|
||||
return JS_FALSE;
|
||||
} else {
|
||||
#ifdef DEBUG
|
||||
BindingKind kind =
|
||||
#endif
|
||||
cg->bindings.lookup(cx, fun->atom, &slot);
|
||||
DebugOnly<BindingKind> kind = cg->bindings.lookup(cx, fun->atom, &slot);
|
||||
JS_ASSERT(kind == VARIABLE || kind == CONSTANT);
|
||||
JS_ASSERT(index < JS_BIT(20));
|
||||
pn->pn_index = index;
|
||||
|
@ -4798,9 +4798,7 @@ js_DefineNativeProperty(JSContext *cx, JSObject *obj, jsid id, const Value &valu
|
||||
* See bug 560998.
|
||||
*/
|
||||
if (obj->shape() == oldShape && obj->branded() && shape->slot != SHAPE_INVALID_SLOT) {
|
||||
#ifdef DEBUG
|
||||
const Shape *newshape =
|
||||
#endif
|
||||
DebugOnly<const Shape*> newshape =
|
||||
obj->methodWriteBarrier(cx, *shape, valueCopy);
|
||||
JS_ASSERT(newshape == shape);
|
||||
}
|
||||
@ -5154,9 +5152,7 @@ js_FindIdentifierBase(JSContext *cx, JSObject *scopeChain, jsid id)
|
||||
return obj;
|
||||
}
|
||||
JS_ASSERT_IF(obj->getParent(), pobj->getClass() == obj->getClass());
|
||||
#ifdef DEBUG
|
||||
PropertyCacheEntry *entry =
|
||||
#endif
|
||||
DebugOnly<PropertyCacheEntry*> entry =
|
||||
JS_PROPERTY_CACHE(cx).fill(cx, scopeChain, scopeIndex, protoIndex, pobj,
|
||||
(Shape *) prop);
|
||||
JS_ASSERT(entry);
|
||||
|
@ -265,10 +265,7 @@ Bindings::sharpSlotBase(JSContext *cx)
|
||||
#if JS_HAS_SHARP_VARS
|
||||
if (JSAtom *name = js_Atomize(cx, "#array", 6, 0)) {
|
||||
uintN index = uintN(-1);
|
||||
#ifdef DEBUG
|
||||
BindingKind kind =
|
||||
#endif
|
||||
lookup(cx, name, &index);
|
||||
DebugOnly<BindingKind> kind = lookup(cx, name, &index);
|
||||
JS_ASSERT(kind == VARIABLE);
|
||||
return int(index);
|
||||
}
|
||||
|
@ -6607,14 +6607,9 @@ ExecuteTree(JSContext* cx, TraceMonitor* tm, TreeFragment* f, uintN& inlineCallC
|
||||
JS_ASSERT_IF(lr->exitType == LOOP_EXIT, !lr->calldepth);
|
||||
|
||||
/* Restore interpreter state. */
|
||||
#ifdef DEBUG
|
||||
LEAVE_TREE_STATUS lts =
|
||||
#endif
|
||||
LeaveTree(tm, state, lr);
|
||||
#ifdef DEBUG
|
||||
DebugOnly<LEAVE_TREE_STATUS> lts = LeaveTree(tm, state, lr);
|
||||
JS_ASSERT_IF(lts == NO_DEEP_BAIL,
|
||||
*(uint64*)&tm->storage->global()[globalSlots] == 0xdeadbeefdeadbeefLL);
|
||||
#endif
|
||||
|
||||
*lrp = state.innermost;
|
||||
bool ok = !(state.builtinStatus & BUILTIN_ERROR);
|
||||
@ -6927,10 +6922,7 @@ LeaveTree(TraceMonitor *tm, TracerState& state, VMSideExit* lr)
|
||||
calldepth,
|
||||
(unsigned long long int)cycles);
|
||||
|
||||
#ifdef DEBUG
|
||||
int slots =
|
||||
#endif
|
||||
FlushNativeStackFrame(cx, innermost->calldepth, innermost->stackTypeMap(), stack);
|
||||
DebugOnly<int> slots = FlushNativeStackFrame(cx, innermost->calldepth, innermost->stackTypeMap(), stack);
|
||||
JS_ASSERT(unsigned(slots) == innermost->numStackSlots);
|
||||
|
||||
/*
|
||||
@ -6963,10 +6955,7 @@ LeaveTree(TraceMonitor *tm, TracerState& state, VMSideExit* lr)
|
||||
JS_ASSERT(innermost->root()->nGlobalTypes() == ngslots);
|
||||
JS_ASSERT(innermost->root()->nGlobalTypes() > innermost->numGlobalSlots);
|
||||
typeMap.ensure(ngslots);
|
||||
#ifdef DEBUG
|
||||
unsigned check_ngslots =
|
||||
#endif
|
||||
BuildGlobalTypeMapFromInnerTree(typeMap, innermost);
|
||||
DebugOnly<unsigned> check_ngslots = BuildGlobalTypeMapFromInnerTree(typeMap, innermost);
|
||||
JS_ASSERT(check_ngslots == ngslots);
|
||||
globalTypeMap = typeMap.data();
|
||||
}
|
||||
@ -8135,9 +8124,7 @@ TraceRecorder::callProp(JSObject* obj, JSProperty* prop, jsid id, Value*& vp,
|
||||
// Call objects do not yet have shape->isMethod() properties, but they
|
||||
// should. See bug 514046, for which this code is future-proof. Remove
|
||||
// this comment when that bug is fixed (so, FIXME: 514046).
|
||||
#ifdef DEBUG
|
||||
JSBool rv =
|
||||
#endif
|
||||
DebugOnly<JSBool> rv =
|
||||
js_GetPropertyHelper(cx, obj, shape->id,
|
||||
(op == JSOP_CALLNAME)
|
||||
? JSGET_NO_METHOD_BARRIER
|
||||
|
@ -45,6 +45,7 @@
|
||||
#define jsutil_h___
|
||||
|
||||
#include "jstypes.h"
|
||||
#include "mozilla/Util.h"
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
@ -463,6 +464,9 @@ JS_END_EXTERN_C
|
||||
* be used, though this is undesirable.
|
||||
*/
|
||||
namespace js {
|
||||
/* Import common mfbt declarations into "js". */
|
||||
using namespace mozilla;
|
||||
|
||||
class OffTheBooks {
|
||||
public:
|
||||
JS_DECLARE_NEW_METHODS(::js_malloc, JS_ALWAYS_INLINE static)
|
||||
|
@ -4153,9 +4153,7 @@ WatchdogMain(void *arg)
|
||||
PRIntervalTime sleepDuration = gWatchdogHasTimeout
|
||||
? gWatchdogTimeout - now
|
||||
: PR_INTERVAL_NO_TIMEOUT;
|
||||
#ifdef DEBUG
|
||||
PRStatus status =
|
||||
#endif
|
||||
DebugOnly<PRStatus> status =
|
||||
PR_WaitCondVar(gWatchdogWakeup, sleepDuration);
|
||||
JS_ASSERT(status == PR_SUCCESS);
|
||||
}
|
||||
|
16
mfbt/Util.h
16
mfbt/Util.h
@ -40,6 +40,8 @@
|
||||
#ifndef mozilla_Util_h_
|
||||
#define mozilla_Util_h_
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
/**
|
||||
@ -81,12 +83,16 @@ struct DebugOnly
|
||||
DebugOnly& operator=(const T&) {}
|
||||
#endif
|
||||
|
||||
// DebugOnly must always have a destructor or else it will
|
||||
// generate "unused variable" warnings, exactly what it's intended
|
||||
// to avoid!
|
||||
/*
|
||||
* DebugOnly must always have a destructor or else it will
|
||||
* generate "unused variable" warnings, exactly what it's intended
|
||||
* to avoid!
|
||||
*/
|
||||
~DebugOnly() {}
|
||||
};
|
||||
|
||||
} // namespace mozilla
|
||||
} /* namespace mozilla */
|
||||
|
||||
#endif // mozilla_Util_h_
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* mozilla_Util_h_ */
|
||||
|
Loading…
x
Reference in New Issue
Block a user