Bug 1074911 - Replace JS_ASSERT by MOZ_ASSERT. r=jorendorff
Apply the following script
sed -i '
/JS_ASSERT(/ {
s/JS_ASSERT(/MOZ_ASSERT(/;
:b;
s/ \\$/\\/;
/;/ { p; d; };
n;
s/^/ /;
b b;
};
s/JS_ASSERT (/MOZ_ASSERT(/;
'
Except where the JS_ASSERT macro does not end with a semi-colon, where empty
lines are in the middle of the macro, and where the backslahes are always the
same-length after the expression.
This commit is contained in:
@@ -238,7 +238,7 @@ struct SortComparatorIds
|
||||
*lessOrEqualp = uint32_t(ca) <= uint32_t(cb);
|
||||
return true;
|
||||
}
|
||||
JS_ASSERT(ca == JS::SymbolCode::InSymbolRegistry || ca == JS::SymbolCode::UniqueSymbol);
|
||||
MOZ_ASSERT(ca == JS::SymbolCode::InSymbolRegistry || ca == JS::SymbolCode::UniqueSymbol);
|
||||
astr = JSID_TO_SYMBOL(a)->description();
|
||||
bstr = JSID_TO_SYMBOL(b)->description();
|
||||
if (!astr || !bstr) {
|
||||
@@ -485,7 +485,7 @@ NewPropertyIteratorObject(JSContext *cx, unsigned flags)
|
||||
if (!obj)
|
||||
return nullptr;
|
||||
|
||||
JS_ASSERT(obj->numFixedSlots() == JSObject::ITER_CLASS_NFIXED_SLOTS);
|
||||
MOZ_ASSERT(obj->numFixedSlots() == JSObject::ITER_CLASS_NFIXED_SLOTS);
|
||||
return &obj->as<PropertyIteratorObject>();
|
||||
}
|
||||
|
||||
@@ -552,7 +552,7 @@ RegisterEnumerator(JSContext *cx, PropertyIteratorObject *iterobj, NativeIterato
|
||||
if (ni->flags & JSITER_ENUMERATE) {
|
||||
ni->link(cx->compartment()->enumerators);
|
||||
|
||||
JS_ASSERT(!(ni->flags & JSITER_ACTIVE));
|
||||
MOZ_ASSERT(!(ni->flags & JSITER_ACTIVE));
|
||||
ni->flags |= JSITER_ACTIVE;
|
||||
}
|
||||
}
|
||||
@@ -561,7 +561,7 @@ static inline bool
|
||||
VectorToKeyIterator(JSContext *cx, HandleObject obj, unsigned flags, AutoIdVector &keys,
|
||||
uint32_t slength, uint32_t key, MutableHandleValue vp)
|
||||
{
|
||||
JS_ASSERT(!(flags & JSITER_FOREACH));
|
||||
MOZ_ASSERT(!(flags & JSITER_FOREACH));
|
||||
|
||||
if (obj) {
|
||||
if (obj->hasSingletonType() && !obj->setIteratedSingleton(cx))
|
||||
@@ -592,7 +592,7 @@ VectorToKeyIterator(JSContext *cx, HandleObject obj, unsigned flags, AutoIdVecto
|
||||
ni->shapes_array[ind++] = pobj->lastProperty();
|
||||
pobj = pobj->getProto();
|
||||
} while (pobj);
|
||||
JS_ASSERT(ind == slength);
|
||||
MOZ_ASSERT(ind == slength);
|
||||
}
|
||||
|
||||
iterobj->setNativeIterator(ni);
|
||||
@@ -613,7 +613,7 @@ bool
|
||||
js::VectorToValueIterator(JSContext *cx, HandleObject obj, unsigned flags, AutoIdVector &keys,
|
||||
MutableHandleValue vp)
|
||||
{
|
||||
JS_ASSERT(flags & JSITER_FOREACH);
|
||||
MOZ_ASSERT(flags & JSITER_FOREACH);
|
||||
|
||||
if (obj) {
|
||||
if (obj->hasSingletonType() && !obj->setIteratedSingleton(cx))
|
||||
@@ -763,7 +763,7 @@ js::GetIterator(JSContext *cx, HandleObject obj, unsigned flags, MutableHandleVa
|
||||
if (flags & JSITER_FOREACH) {
|
||||
if (MOZ_LIKELY(obj != nullptr) && !Snapshot(cx, obj, flags, &keys))
|
||||
return false;
|
||||
JS_ASSERT(shapes.empty());
|
||||
MOZ_ASSERT(shapes.empty());
|
||||
if (!VectorToValueIterator(cx, obj, flags, keys, vp))
|
||||
return false;
|
||||
} else {
|
||||
@@ -820,7 +820,7 @@ js::CreateItrResultObject(JSContext *cx, HandleValue value, bool done)
|
||||
bool
|
||||
js::ThrowStopIteration(JSContext *cx)
|
||||
{
|
||||
JS_ASSERT(!JS_IsExceptionPending(cx));
|
||||
MOZ_ASSERT(!JS_IsExceptionPending(cx));
|
||||
|
||||
// StopIteration isn't a constructor, but it's stored in GlobalObject
|
||||
// as one, out of laziness. Hence the GetBuiltinConstructor call here.
|
||||
@@ -861,7 +861,7 @@ IsIterator(HandleValue v)
|
||||
MOZ_ALWAYS_INLINE bool
|
||||
iterator_next_impl(JSContext *cx, CallArgs args)
|
||||
{
|
||||
JS_ASSERT(IsIterator(args.thisv()));
|
||||
MOZ_ASSERT(IsIterator(args.thisv()));
|
||||
|
||||
RootedObject thisObj(cx, &args.thisv().toObject());
|
||||
|
||||
@@ -1046,7 +1046,7 @@ js::CloseIterator(JSContext *cx, HandleObject obj)
|
||||
if (ni->flags & JSITER_ENUMERATE) {
|
||||
ni->unlink();
|
||||
|
||||
JS_ASSERT(ni->flags & JSITER_ACTIVE);
|
||||
MOZ_ASSERT(ni->flags & JSITER_ACTIVE);
|
||||
ni->flags &= ~JSITER_ACTIVE;
|
||||
|
||||
/*
|
||||
@@ -1268,7 +1268,7 @@ js::IteratorMore(JSContext *cx, HandleObject iterobj, MutableHandleValue rval)
|
||||
|
||||
/* Fetch and cache the next value from the iterator. */
|
||||
if (ni) {
|
||||
JS_ASSERT(!ni->isKeyIter());
|
||||
MOZ_ASSERT(!ni->isKeyIter());
|
||||
RootedId id(cx);
|
||||
RootedValue current(cx, StringValue(*ni->current()));
|
||||
if (!ValueToId<CanGC>(cx, current, &id))
|
||||
@@ -1334,7 +1334,7 @@ ForOfIterator::init(HandleValue iterable, NonIterableBehavior nonIterableBehavio
|
||||
if (!iterableObj)
|
||||
return false;
|
||||
|
||||
JS_ASSERT(index == NOT_ARRAY);
|
||||
MOZ_ASSERT(index == NOT_ARRAY);
|
||||
|
||||
// Check the PIC first for a match.
|
||||
if (iterableObj->is<ArrayObject>()) {
|
||||
@@ -1354,7 +1354,7 @@ ForOfIterator::init(HandleValue iterable, NonIterableBehavior nonIterableBehavio
|
||||
}
|
||||
}
|
||||
|
||||
JS_ASSERT(index == NOT_ARRAY);
|
||||
MOZ_ASSERT(index == NOT_ARRAY);
|
||||
|
||||
// The iterator is the result of calling obj[@@iterator]().
|
||||
InvokeArgs args(cx);
|
||||
@@ -1407,13 +1407,13 @@ ForOfIterator::initWithIterator(HandleValue aIterator)
|
||||
inline bool
|
||||
ForOfIterator::nextFromOptimizedArray(MutableHandleValue vp, bool *done)
|
||||
{
|
||||
JS_ASSERT(index != NOT_ARRAY);
|
||||
MOZ_ASSERT(index != NOT_ARRAY);
|
||||
|
||||
if (!CheckForInterrupt(cx_))
|
||||
return false;
|
||||
|
||||
JS_ASSERT(iterator->isNative());
|
||||
JS_ASSERT(iterator->is<ArrayObject>());
|
||||
MOZ_ASSERT(iterator->isNative());
|
||||
MOZ_ASSERT(iterator->is<ArrayObject>());
|
||||
|
||||
if (index >= iterator->as<ArrayObject>().length()) {
|
||||
vp.setUndefined();
|
||||
@@ -1437,7 +1437,7 @@ ForOfIterator::nextFromOptimizedArray(MutableHandleValue vp, bool *done)
|
||||
bool
|
||||
ForOfIterator::next(MutableHandleValue vp, bool *done)
|
||||
{
|
||||
JS_ASSERT(iterator);
|
||||
MOZ_ASSERT(iterator);
|
||||
|
||||
if (index != NOT_ARRAY) {
|
||||
ForOfPIC::Chain *stubChain = ForOfPIC::getOrCreate(cx_);
|
||||
@@ -1483,7 +1483,7 @@ ForOfIterator::next(MutableHandleValue vp, bool *done)
|
||||
bool
|
||||
ForOfIterator::materializeArrayIterator()
|
||||
{
|
||||
JS_ASSERT(index != NOT_ARRAY);
|
||||
MOZ_ASSERT(index != NOT_ARRAY);
|
||||
|
||||
const char *nameString = "ArrayValuesAt";
|
||||
|
||||
@@ -1516,14 +1516,14 @@ template<typename T>
|
||||
static void
|
||||
FinalizeGenerator(FreeOp *fop, JSObject *obj)
|
||||
{
|
||||
JS_ASSERT(obj->is<T>());
|
||||
MOZ_ASSERT(obj->is<T>());
|
||||
JSGenerator *gen = obj->as<T>().getGenerator();
|
||||
JS_ASSERT(gen);
|
||||
MOZ_ASSERT(gen);
|
||||
// gen is open when a script has not called its close method while
|
||||
// explicitly manipulating it.
|
||||
JS_ASSERT(gen->state == JSGEN_NEWBORN ||
|
||||
gen->state == JSGEN_CLOSED ||
|
||||
gen->state == JSGEN_OPEN);
|
||||
MOZ_ASSERT(gen->state == JSGEN_NEWBORN ||
|
||||
gen->state == JSGEN_CLOSED ||
|
||||
gen->state == JSGEN_OPEN);
|
||||
// If gen->state is JSGEN_CLOSED, gen->fp may be nullptr.
|
||||
if (gen->fp)
|
||||
JS_POISON(gen->fp, JS_SWEPT_FRAME_PATTERN, sizeof(InterpreterFrame));
|
||||
@@ -1581,7 +1581,7 @@ GeneratorHasMarkableFrame(JSGenerator *gen)
|
||||
static void
|
||||
SetGeneratorClosed(JSContext *cx, JSGenerator *gen)
|
||||
{
|
||||
JS_ASSERT(gen->state != JSGEN_CLOSED);
|
||||
MOZ_ASSERT(gen->state != JSGEN_CLOSED);
|
||||
if (GeneratorHasMarkableFrame(gen))
|
||||
GeneratorWriteBarrierPre(cx, gen);
|
||||
gen->state = JSGEN_CLOSED;
|
||||
@@ -1600,9 +1600,9 @@ template<typename T>
|
||||
static void
|
||||
TraceGenerator(JSTracer *trc, JSObject *obj)
|
||||
{
|
||||
JS_ASSERT(obj->is<T>());
|
||||
MOZ_ASSERT(obj->is<T>());
|
||||
JSGenerator *gen = obj->as<T>().getGenerator();
|
||||
JS_ASSERT(gen);
|
||||
MOZ_ASSERT(gen);
|
||||
if (GeneratorHasMarkableFrame(gen))
|
||||
MarkGeneratorFrame(trc, gen);
|
||||
}
|
||||
@@ -1698,10 +1698,10 @@ const Class StarGeneratorObject::class_ = {
|
||||
JSObject *
|
||||
js_NewGenerator(JSContext *cx, const InterpreterRegs &stackRegs)
|
||||
{
|
||||
JS_ASSERT(stackRegs.stackDepth() == 0);
|
||||
MOZ_ASSERT(stackRegs.stackDepth() == 0);
|
||||
InterpreterFrame *stackfp = stackRegs.fp();
|
||||
|
||||
JS_ASSERT(stackfp->script()->isGenerator());
|
||||
MOZ_ASSERT(stackfp->script()->isGenerator());
|
||||
|
||||
Rooted<GlobalObject*> global(cx, &stackfp->global());
|
||||
RootedObject obj(cx);
|
||||
@@ -1720,7 +1720,7 @@ js_NewGenerator(JSContext *cx, const InterpreterRegs &stackRegs)
|
||||
}
|
||||
obj = NewObjectWithGivenProto(cx, &StarGeneratorObject::class_, proto, global);
|
||||
} else {
|
||||
JS_ASSERT(stackfp->script()->isLegacyGenerator());
|
||||
MOZ_ASSERT(stackfp->script()->isLegacyGenerator());
|
||||
JSObject *proto = GlobalObject::getOrCreateLegacyGeneratorObjectPrototype(cx, global);
|
||||
if (!proto)
|
||||
return nullptr;
|
||||
@@ -1780,7 +1780,7 @@ SendToGenerator(JSContext *cx, JSGeneratorOp op, HandleObject obj,
|
||||
JSGenerator *gen, HandleValue arg, GeneratorKind generatorKind,
|
||||
MutableHandleValue rval)
|
||||
{
|
||||
JS_ASSERT(generatorKind == LegacyGenerator || generatorKind == StarGenerator);
|
||||
MOZ_ASSERT(generatorKind == LegacyGenerator || generatorKind == StarGenerator);
|
||||
|
||||
if (gen->state == JSGEN_RUNNING || gen->state == JSGEN_CLOSING) {
|
||||
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_NESTING_GENERATOR);
|
||||
@@ -1788,7 +1788,7 @@ SendToGenerator(JSContext *cx, JSGeneratorOp op, HandleObject obj,
|
||||
}
|
||||
|
||||
JSGeneratorState futureState;
|
||||
JS_ASSERT(gen->state == JSGEN_NEWBORN || gen->state == JSGEN_OPEN);
|
||||
MOZ_ASSERT(gen->state == JSGEN_NEWBORN || gen->state == JSGEN_OPEN);
|
||||
switch (op) {
|
||||
case JSGENOP_NEXT:
|
||||
case JSGENOP_SEND:
|
||||
@@ -1811,8 +1811,8 @@ SendToGenerator(JSContext *cx, JSGeneratorOp op, HandleObject obj,
|
||||
break;
|
||||
|
||||
default:
|
||||
JS_ASSERT(op == JSGENOP_CLOSE);
|
||||
JS_ASSERT(generatorKind == LegacyGenerator);
|
||||
MOZ_ASSERT(op == JSGENOP_CLOSE);
|
||||
MOZ_ASSERT(generatorKind == LegacyGenerator);
|
||||
cx->setPendingException(MagicValue(JS_GENERATOR_CLOSING));
|
||||
futureState = JSGEN_CLOSING;
|
||||
break;
|
||||
@@ -1831,8 +1831,8 @@ SendToGenerator(JSContext *cx, JSGeneratorOp op, HandleObject obj,
|
||||
* Yield is ordinarily infallible, but ok can be false here if a
|
||||
* Debugger.Frame.onPop hook fails.
|
||||
*/
|
||||
JS_ASSERT(gen->state == JSGEN_RUNNING);
|
||||
JS_ASSERT(op != JSGENOP_CLOSE);
|
||||
MOZ_ASSERT(gen->state == JSGEN_RUNNING);
|
||||
MOZ_ASSERT(op != JSGENOP_CLOSE);
|
||||
gen->fp->clearYielding();
|
||||
gen->state = JSGEN_OPEN;
|
||||
GeneratorWriteBarrierPost(cx, gen);
|
||||
@@ -1845,7 +1845,7 @@ SendToGenerator(JSContext *cx, JSGeneratorOp op, HandleObject obj,
|
||||
// Star generators return a {value:FOO, done:true} object.
|
||||
rval.set(gen->fp->returnValue());
|
||||
} else {
|
||||
JS_ASSERT(generatorKind == LegacyGenerator);
|
||||
MOZ_ASSERT(generatorKind == LegacyGenerator);
|
||||
|
||||
// Otherwise we discard the return value and throw a StopIteration
|
||||
// if needed.
|
||||
@@ -1923,7 +1923,7 @@ legacy_generator_throw(JSContext *cx, CallArgs args)
|
||||
static bool
|
||||
CloseLegacyGenerator(JSContext *cx, HandleObject obj, MutableHandleValue rval)
|
||||
{
|
||||
JS_ASSERT(obj->is<LegacyGeneratorObject>());
|
||||
MOZ_ASSERT(obj->is<LegacyGeneratorObject>());
|
||||
|
||||
JSGenerator *gen = obj->as<LegacyGeneratorObject>().getGenerator();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user