From 28b2e29a7d7f7d42c3d1a96423275dc66930b21c Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Wed, 1 Oct 2014 10:58:30 +0200 Subject: [PATCH 01/63] Bug 1067679 - mingw fixup. --- netwerk/dns/GetAddrInfo.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/netwerk/dns/GetAddrInfo.cpp b/netwerk/dns/GetAddrInfo.cpp index 270e27345512..12ac74fe0c35 100644 --- a/netwerk/dns/GetAddrInfo.cpp +++ b/netwerk/dns/GetAddrInfo.cpp @@ -34,14 +34,14 @@ static PRLogModuleInfo *gGetAddrInfoLog = PR_NewLogModule("GetAddrInfo"); #endif #if DNSQUERY_AVAILABLE -// There is a bug in Windns.h where the type of parameter ppQueryResultsSet for +// There is a bug in windns.h where the type of parameter ppQueryResultsSet for // DnsQuery_A is dependent on UNICODE being set. It should *always* be // PDNS_RECORDA, but if UNICODE is set it is PDNS_RECORDW. To get around this // we make sure that UNICODE is unset. #undef UNICODE #include #undef GetAddrInfo -#include +#include #endif namespace mozilla { From 0bba571624e9defb365abefcbdff91a2488531f8 Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Wed, 1 Oct 2014 10:58:57 +0200 Subject: [PATCH 02/63] Bug 1057331 - mingw fixup (const char16_t*/char16ptr_t mismatch). --- gfx/thebes/gfxFont.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gfx/thebes/gfxFont.cpp b/gfx/thebes/gfxFont.cpp index dbd0fedb3f19..3a4b81ab1075 100644 --- a/gfx/thebes/gfxFont.cpp +++ b/gfx/thebes/gfxFont.cpp @@ -2897,7 +2897,7 @@ gfxFont::InitFakeSmallCapsRun(gfxContext *aContext, { NS_ConvertASCIItoUTF16 unicodeString(reinterpret_cast(aText), aLength); - return InitFakeSmallCapsRun(aContext, aTextRun, unicodeString.get(), + return InitFakeSmallCapsRun(aContext, aTextRun, static_cast(unicodeString.get()), aOffset, aLength, aMatchType, aOrientation, aScript, aSyntheticLower, aSyntheticUpper); } From 0d53e022f042536b649b8454ee208d77b1e5e644 Mon Sep 17 00:00:00 2001 From: Andrea Marchesini Date: Wed, 1 Oct 2014 10:52:46 +0100 Subject: [PATCH 03/63] Bug 1072116 - check the return value of createXPathNode(), r=peterv --- dom/xslt/tests/mochitest/mochitest.ini | 1 + dom/xslt/tests/mochitest/test_bug1072116.html | 37 +++++++++++++++++++ dom/xslt/xpath/XPathExpression.cpp | 5 +++ 3 files changed, 43 insertions(+) create mode 100644 dom/xslt/tests/mochitest/test_bug1072116.html diff --git a/dom/xslt/tests/mochitest/mochitest.ini b/dom/xslt/tests/mochitest/mochitest.ini index b7fb1860c1f8..e12f8da8dbc6 100644 --- a/dom/xslt/tests/mochitest/mochitest.ini +++ b/dom/xslt/tests/mochitest/mochitest.ini @@ -1,5 +1,6 @@ [DEFAULT] +[test_bug1072116.html] [test_bug319374.xhtml] [test_bug427060.html] [test_bug440974.html] diff --git a/dom/xslt/tests/mochitest/test_bug1072116.html b/dom/xslt/tests/mochitest/test_bug1072116.html new file mode 100644 index 000000000000..2d0624725032 --- /dev/null +++ b/dom/xslt/tests/mochitest/test_bug1072116.html @@ -0,0 +1,37 @@ + + + + + Test for Bug 1072116 + + + + +Mozilla Bug 1072116 +

+ +
+
+
+ + diff --git a/dom/xslt/xpath/XPathExpression.cpp b/dom/xslt/xpath/XPathExpression.cpp index c52d5ad58e4b..33b056661795 100644 --- a/dom/xslt/xpath/XPathExpression.cpp +++ b/dom/xslt/xpath/XPathExpression.cpp @@ -145,6 +145,11 @@ XPathExpression::EvaluateWithContext(nsINode& aContextNode, } nsAutoPtr contextNode(txXPathNativeNode::createXPathNode(&aContextNode)); + if (!contextNode) { + aRv.Throw(NS_ERROR_FAILURE); + return nullptr; + } + EvalContextImpl eContext(*contextNode, aContextPosition, aContextSize, mRecycler); nsRefPtr exprResult; From 5184091514d01d6b7e9078bf11b7d8c66609371e Mon Sep 17 00:00:00 2001 From: Christian Holler Date: Tue, 30 Sep 2014 14:59:41 +0200 Subject: [PATCH 04/63] Bug 982600 - Disable tests that only make sense with crashreporter. r=markh --HG-- extra : rebase_source : f67e498380f53cfe60a45431e300bc0937d2b6e9 --- browser/base/content/test/social/browser.ini | 1 + dom/ipc/tests/chrome.ini | 2 +- toolkit/components/thumbnails/test/browser.ini | 4 ++-- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/browser/base/content/test/social/browser.ini b/browser/base/content/test/social/browser.ini index 9ca011c55fb0..cf5f322d1514 100644 --- a/browser/base/content/test/social/browser.ini +++ b/browser/base/content/test/social/browser.ini @@ -55,3 +55,4 @@ skip-if = e10s # Bug 915547 (social providers don't install) skip-if = e10s # Bug 915547 (social providers don't install) [browser_social_window.js] [browser_social_workercrash.js] +skip-if = !crashreporter diff --git a/dom/ipc/tests/chrome.ini b/dom/ipc/tests/chrome.ini index 58acba9ffe09..0b43a07d1d61 100644 --- a/dom/ipc/tests/chrome.ini +++ b/dom/ipc/tests/chrome.ini @@ -4,4 +4,4 @@ support-files = process_error_contentscript.js [test_process_error.xul] -skip-if = buildapp == "mulet" +skip-if = buildapp == "mulet" || !crashreporter diff --git a/toolkit/components/thumbnails/test/browser.ini b/toolkit/components/thumbnails/test/browser.ini index 9d835ebae392..5b5a0906a3d2 100644 --- a/toolkit/components/thumbnails/test/browser.ini +++ b/toolkit/components/thumbnails/test/browser.ini @@ -12,9 +12,9 @@ support-files = [browser_thumbnails_bg_bad_url.js] [browser_thumbnails_bg_crash_during_capture.js] -skip-if = buildapp == 'mulet' +skip-if = buildapp == 'mulet' || !crashreporter [browser_thumbnails_bg_crash_while_idle.js] -skip-if = buildapp == 'mulet' +skip-if = buildapp == 'mulet' || !crashreporter [browser_thumbnails_bg_basic.js] [browser_thumbnails_bg_queueing.js] [browser_thumbnails_bg_timeout.js] From 276cd0a709e262fc61422b67a0658139e5479129 Mon Sep 17 00:00:00 2001 From: Till Schneidereit Date: Tue, 16 Sep 2014 10:01:09 -0400 Subject: [PATCH 05/63] Bug 1067459 - Only install a small subset of the standard builtins in the self-hosting global. r=jorendorff --- js/src/builtin/Intl.cpp | 17 +++----- js/src/builtin/Intl.js | 2 +- js/src/builtin/MapObject.cpp | 19 +++++++-- js/src/builtin/MapObject.h | 15 ++++--- js/src/builtin/Object.cpp | 20 ++++----- js/src/builtin/Object.h | 16 ++++++++ js/src/builtin/Utilities.js | 71 +++++--------------------------- js/src/jsapi.cpp | 18 --------- js/src/jsarray.cpp | 10 ++--- js/src/jsarray.h | 6 +++ js/src/jsdate.cpp | 8 ++-- js/src/jsdate.h | 11 +++++ js/src/jsfun.cpp | 4 +- js/src/jsfun.h | 3 ++ js/src/jsiter.cpp | 25 +++++++----- js/src/jsobj.cpp | 9 +++-- js/src/jsstr.cpp | 24 +++++------ js/src/jsstr.h | 20 +++++++++ js/src/jsweakmap.cpp | 42 ++++++++++++------- js/src/jsweakmap.h | 20 +++++++++ js/src/vm/GlobalObject.cpp | 51 +++++++++++++++++++++++ js/src/vm/GlobalObject.h | 3 ++ js/src/vm/SelfHosting.cpp | 76 +++++++++++++++++++++++++++++++---- js/src/vm/StructuredClone.cpp | 2 +- 24 files changed, 323 insertions(+), 169 deletions(-) diff --git a/js/src/builtin/Intl.cpp b/js/src/builtin/Intl.cpp index 2c6bfc587cb7..c19e5d372113 100644 --- a/js/src/builtin/Intl.cpp +++ b/js/src/builtin/Intl.cpp @@ -2055,17 +2055,12 @@ js_InitIntlClass(JSContext *cx, HandleObject obj) if (!JS_DefineFunctions(cx, Intl, intl_static_methods)) return nullptr; - // Skip initialization of the Intl constructors during initialization of the - // self-hosting global as we may get here before self-hosted code is compiled, - // and no core code refers to the Intl classes. - if (!cx->runtime()->isSelfHostingGlobal(cx->global())) { - if (!InitCollatorClass(cx, Intl, global)) - return nullptr; - if (!InitNumberFormatClass(cx, Intl, global)) - return nullptr; - if (!InitDateTimeFormatClass(cx, Intl, global)) - return nullptr; - } + if (!InitCollatorClass(cx, Intl, global)) + return nullptr; + if (!InitNumberFormatClass(cx, Intl, global)) + return nullptr; + if (!InitDateTimeFormatClass(cx, Intl, global)) + return nullptr; global->setConstructor(JSProto_Intl, ObjectValue(*Intl)); diff --git a/js/src/builtin/Intl.js b/js/src/builtin/Intl.js index aef7e86973d8..a76d247b077b 100644 --- a/js/src/builtin/Intl.js +++ b/js/src/builtin/Intl.js @@ -1274,7 +1274,7 @@ function InitializeCollator(collator, locales, options) { // Step 13, unrolled. var numericValue = GetOption(options, "numeric", "boolean", undefined, undefined); if (numericValue !== undefined) - numericValue = callFunction(std_Boolean_toString, numericValue); + numericValue = numericValue ? 'true' : 'false'; opt.kn = numericValue; var caseFirstValue = GetOption(options, "caseFirst", "string", ["upper", "lower", "false"], undefined); diff --git a/js/src/builtin/MapObject.cpp b/js/src/builtin/MapObject.cpp index 257a97988bfe..58a804869a4f 100644 --- a/js/src/builtin/MapObject.cpp +++ b/js/src/builtin/MapObject.cpp @@ -849,6 +849,7 @@ class MapIteratorObject : public JSObject static const JSFunctionSpec methods[]; static MapIteratorObject *create(JSContext *cx, HandleObject mapobj, ValueMap *data, MapObject::IteratorKind kind); + static bool next(JSContext *cx, unsigned argc, Value *vp); static void finalize(FreeOp *fop, JSObject *obj); private: @@ -856,7 +857,6 @@ class MapIteratorObject : public JSObject inline ValueMap::Range *range(); inline MapObject::IteratorKind kind() const; static bool next_impl(JSContext *cx, CallArgs args); - static bool next(JSContext *cx, unsigned argc, Value *vp); }; } /* anonymous namespace */ @@ -1157,7 +1157,8 @@ WriteBarrierPost(JSRuntime *rt, ValueSet *set, const Value &key) } bool -MapObject::entries(JSContext *cx, HandleObject obj, JS::AutoValueVector *entries) +MapObject::getKeysAndValuesInterleaved(JSContext *cx, HandleObject obj, + JS::AutoValueVector *entries) { ValueMap *map = obj->as().getData(); if (!map) @@ -1497,6 +1498,7 @@ class SetIteratorObject : public JSObject static const JSFunctionSpec methods[]; static SetIteratorObject *create(JSContext *cx, HandleObject setobj, ValueSet *data, SetObject::IteratorKind kind); + static bool next(JSContext *cx, unsigned argc, Value *vp); static void finalize(FreeOp *fop, JSObject *obj); private: @@ -1504,7 +1506,6 @@ class SetIteratorObject : public JSObject inline ValueSet::Range *range(); inline SetObject::IteratorKind kind() const; static bool next_impl(JSContext *cx, CallArgs args); - static bool next(JSContext *cx, unsigned argc, Value *vp); }; } /* anonymous namespace */ @@ -1966,3 +1967,15 @@ js_InitSetClass(JSContext *cx, HandleObject obj) { return SetObject::initClass(cx, obj); } + +const JSFunctionSpec selfhosting_collection_iterator_methods[] = { + JS_FN("std_Map_iterator_next", MapIteratorObject::next, 0, 0), + JS_FN("std_Set_iterator_next", SetIteratorObject::next, 0, 0), + JS_FS_END +}; + +bool +js::InitSelfHostingCollectionIteratorFunctions(JSContext *cx, HandleObject obj) +{ + return JS_DefineFunctions(cx, obj, selfhosting_collection_iterator_methods); +} diff --git a/js/src/builtin/MapObject.h b/js/src/builtin/MapObject.h index a6fec66db6fd..4b000c1eacb0 100644 --- a/js/src/builtin/MapObject.h +++ b/js/src/builtin/MapObject.h @@ -92,9 +92,11 @@ class MapObject : public JSObject { static JSObject *initClass(JSContext *cx, JSObject *obj); static const Class class_; - // Entries is every key followed by value. - static bool entries(JSContext *cx, HandleObject obj, JS::AutoValueVector *entries); + static bool getKeysAndValuesInterleaved(JSContext *cx, HandleObject obj, + JS::AutoValueVector *entries); + static bool entries(JSContext *cx, unsigned argc, Value *vp); static bool set(JSContext *cx, HandleObject obj, HandleValue key, HandleValue value); + static bool has(JSContext *cx, unsigned argc, Value *vp); static MapObject* create(JSContext *cx); private: @@ -115,7 +117,6 @@ class MapObject : public JSObject { static bool get_impl(JSContext *cx, CallArgs args); static bool get(JSContext *cx, unsigned argc, Value *vp); static bool has_impl(JSContext *cx, CallArgs args); - static bool has(JSContext *cx, unsigned argc, Value *vp); static bool set_impl(JSContext *cx, CallArgs args); static bool set(JSContext *cx, unsigned argc, Value *vp); static bool delete_impl(JSContext *cx, CallArgs args); @@ -125,7 +126,6 @@ class MapObject : public JSObject { static bool values_impl(JSContext *cx, CallArgs args); static bool values(JSContext *cx, unsigned argc, Value *vp); static bool entries_impl(JSContext *cx, CallArgs args); - static bool entries(JSContext *cx, unsigned argc, Value *vp); static bool clear_impl(JSContext *cx, CallArgs args); static bool clear(JSContext *cx, unsigned argc, Value *vp); }; @@ -137,7 +137,9 @@ class SetObject : public JSObject { static const Class class_; static bool keys(JSContext *cx, HandleObject obj, JS::AutoValueVector *keys); + static bool values(JSContext *cx, unsigned argc, Value *vp); static bool add(JSContext *cx, HandleObject obj, HandleValue key); + static bool has(JSContext *cx, unsigned argc, Value *vp); static SetObject* create(JSContext *cx); private: @@ -156,19 +158,20 @@ class SetObject : public JSObject { static bool size_impl(JSContext *cx, CallArgs args); static bool size(JSContext *cx, unsigned argc, Value *vp); static bool has_impl(JSContext *cx, CallArgs args); - static bool has(JSContext *cx, unsigned argc, Value *vp); static bool add_impl(JSContext *cx, CallArgs args); static bool add(JSContext *cx, unsigned argc, Value *vp); static bool delete_impl(JSContext *cx, CallArgs args); static bool delete_(JSContext *cx, unsigned argc, Value *vp); static bool values_impl(JSContext *cx, CallArgs args); - static bool values(JSContext *cx, unsigned argc, Value *vp); static bool entries_impl(JSContext *cx, CallArgs args); static bool entries(JSContext *cx, unsigned argc, Value *vp); static bool clear_impl(JSContext *cx, CallArgs args); static bool clear(JSContext *cx, unsigned argc, Value *vp); }; +extern bool +InitSelfHostingCollectionIteratorFunctions(JSContext *cx, js::HandleObject obj); + } /* namespace js */ extern JSObject * diff --git a/js/src/builtin/Object.cpp b/js/src/builtin/Object.cpp index 79ff568939bc..27c751a494bd 100644 --- a/js/src/builtin/Object.cpp +++ b/js/src/builtin/Object.cpp @@ -532,8 +532,8 @@ obj_lookupSetter(JSContext *cx, unsigned argc, Value *vp) #endif /* JS_OLD_GETTER_SETTER_METHODS */ /* ES5 15.2.3.2. */ -static bool -obj_getPrototypeOf(JSContext *cx, unsigned argc, Value *vp) +bool +js::obj_getPrototypeOf(JSContext *cx, unsigned argc, Value *vp) { CallArgs args = CallArgsFromVp(argc, vp); @@ -703,8 +703,8 @@ obj_unwatch(JSContext *cx, unsigned argc, Value *vp) #endif /* JS_HAS_OBJ_WATCHPOINT */ /* ECMA 15.2.4.5. */ -static bool -obj_hasOwnProperty(JSContext *cx, unsigned argc, Value *vp) +bool +js::obj_hasOwnProperty(JSContext *cx, unsigned argc, Value *vp) { CallArgs args = CallArgsFromVp(argc, vp); @@ -778,8 +778,8 @@ obj_isPrototypeOf(JSContext *cx, unsigned argc, Value *vp) } /* ES5 15.2.3.5: Object.create(O [, Properties]) */ -static bool -obj_create(JSContext *cx, unsigned argc, Value *vp) +bool +js::obj_create(JSContext *cx, unsigned argc, Value *vp) { CallArgs args = CallArgsFromVp(argc, vp); if (args.length() == 0) { @@ -826,8 +826,8 @@ obj_create(JSContext *cx, unsigned argc, Value *vp) return true; } -static bool -obj_getOwnPropertyDescriptor(JSContext *cx, unsigned argc, Value *vp) +bool +js::obj_getOwnPropertyDescriptor(JSContext *cx, unsigned argc, Value *vp) { CallArgs args = CallArgsFromVp(argc, vp); RootedObject obj(cx); @@ -951,8 +951,8 @@ GetOwnPropertyKeys(JSContext *cx, const JS::CallArgs &args, unsigned flags) } // namespace js -static bool -obj_getOwnPropertyNames(JSContext *cx, unsigned argc, Value *vp) +bool +js::obj_getOwnPropertyNames(JSContext *cx, unsigned argc, Value *vp) { CallArgs args = CallArgsFromVp(argc, vp); return GetOwnPropertyKeys(cx, args, JSITER_OWNONLY | JSITER_HIDDEN); diff --git a/js/src/builtin/Object.h b/js/src/builtin/Object.h index 5b46daa81246..489100ff7494 100644 --- a/js/src/builtin/Object.h +++ b/js/src/builtin/Object.h @@ -28,6 +28,22 @@ obj_construct(JSContext *cx, unsigned argc, JS::Value *vp); bool obj_valueOf(JSContext *cx, unsigned argc, JS::Value *vp); +// Object methods exposed so they can be installed in the self-hosting global. +bool +obj_create(JSContext *cx, unsigned argc, JS::Value *vp); + +bool +obj_getOwnPropertyNames(JSContext *cx, unsigned argc, JS::Value *vp); + +bool +obj_getOwnPropertyDescriptor(JSContext *cx, unsigned argc, JS::Value *vp); + +bool +obj_getPrototypeOf(JSContext *cx, unsigned argc, JS::Value *vp); + +bool +obj_hasOwnProperty(JSContext *cx, unsigned argc, JS::Value *vp); + // Exposed so SelfHosting.cpp can use it in the OwnPropertyKeys intrinsic bool GetOwnPropertyKeys(JSContext *cx, const JS::CallArgs &args, unsigned flags); diff --git a/js/src/builtin/Utilities.js b/js/src/builtin/Utilities.js index 8dc5faa6faf3..d620d5a6c6db 100644 --- a/js/src/builtin/Utilities.js +++ b/js/src/builtin/Utilities.js @@ -25,71 +25,18 @@ #include "SelfHostingDefines.h" -// Remove unsafe builtin functions. -Object.defineProperty = null; // See bug 988416. - -// Cache builtin functions so using them doesn't require cloning the whole object they're -// installed on. +// All C++-implemented standard builtins library functions used in self-hosted +// code are installed via the std_functions JSFunctionSpec[] in +// SelfHosting.cpp. // -// WARNING: Do not make std_ references to builtin constructors (like Array and -// Object) below. Setting `var std_Array = Array;`, for instance, would cause -// the entire Array constructor, including its prototype and methods, to be -// cloned into content compartments. -var std_Array_indexOf = ArrayIndexOf; -var std_Array_iterator = Array.prototype.iterator; -var std_Array_join = Array.prototype.join; -var std_Array_push = Array.prototype.push; -var std_Array_pop = Array.prototype.pop; -var std_Array_shift = Array.prototype.shift; -var std_Array_slice = Array.prototype.slice; -var std_Array_sort = Array.prototype.sort; -var std_Array_unshift = Array.prototype.unshift; -var std_Boolean_toString = Boolean.prototype.toString; -var Std_Date = Date; -var std_Date_now = Date.now; -var std_Date_valueOf = Date.prototype.valueOf; -var std_Function_bind = Function.prototype.bind; -var std_Function_apply = Function.prototype.apply; -var std_Math_floor = Math.floor; -var std_Math_max = Math.max; -var std_Math_min = Math.min; -var std_Math_abs = Math.abs; -var std_Math_imul = Math.imul; -var std_Math_log2 = Math.log2; -var std_Number_valueOf = Number.prototype.valueOf; -var std_Number_POSITIVE_INFINITY = Number.POSITIVE_INFINITY; -var std_Object_create = Object.create; -var std_Object_getOwnPropertyNames = Object.getOwnPropertyNames; -var std_Object_hasOwnProperty = Object.prototype.hasOwnProperty; -var std_Object_getPrototypeOf = Object.getPrototypeOf; -var std_Object_getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; -var std_RegExp_test = RegExp.prototype.test; -var std_String_fromCharCode = String.fromCharCode; -var std_String_charCodeAt = String.prototype.charCodeAt; -var std_String_indexOf = String.prototype.indexOf; -var std_String_lastIndexOf = String.prototype.lastIndexOf; -var std_String_match = String.prototype.match; -var std_String_replace = String.prototype.replace; -var std_String_split = String.prototype.split; -var std_String_startsWith = String.prototype.startsWith; -var std_String_substring = String.prototype.substring; -var std_String_toLowerCase = String.prototype.toLowerCase; -var std_String_toUpperCase = String.prototype.toUpperCase; -var std_WeakMap = WeakMap; -var std_WeakMap_get = WeakMap.prototype.get; -var std_WeakMap_has = WeakMap.prototype.has; -var std_WeakMap_set = WeakMap.prototype.set; -var std_WeakMap_clear = WeakMap.prototype.clear; -var std_WeakMap_delete = WeakMap.prototype.delete; -var std_Map_has = Map.prototype.has; -var std_Set_has = Set.prototype.has; +// The few items below here are either self-hosted or installing them under a +// std_Foo name would require ugly contortions, so they just get aliased here. var std_iterator = '@@iterator'; // FIXME: Change to be a symbol. +var std_Array_indexOf = ArrayIndexOf; +// WeakMap is a bare constructor without properties or methods. +var std_WeakMap = WeakMap; +// StopIteration is a bare constructor without properties or methods. var std_StopIteration = StopIteration; -var std_Map_iterator = Map.prototype[std_iterator]; -var std_Set_iterator = Set.prototype[std_iterator]; -var std_Map_iterator_next = Object.getPrototypeOf(Map()[std_iterator]()).next; -var std_Set_iterator_next = Object.getPrototypeOf(Set()[std_iterator]()).next; - /********** List specification type **********/ diff --git a/js/src/jsapi.cpp b/js/src/jsapi.cpp index 4c0876a89919..8a1ee5403015 100644 --- a/js/src/jsapi.cpp +++ b/js/src/jsapi.cpp @@ -3278,15 +3278,6 @@ JS_DefineProperties(JSContext *cx, HandleObject obj, const JSPropertySpec *ps) // native one. JS_ASSERT(!ps->getter.propertyOp.op && !ps->setter.propertyOp.op); JS_ASSERT(ps->flags & JSPROP_GETTER); - /* - * During creation of the self-hosting global, we ignore all - * self-hosted properties, as that means we're currently setting up - * the global object that the self-hosted code is then compiled - * in. That means that Self-hosted properties can't be used in the - * self-hosting global itself, right now. - */ - if (cx->runtime()->isSelfHostingGlobal(cx->global())) - continue; ok = DefineSelfHostedProperty(cx, obj, ps->name, ps->getter.selfHosted.funname, @@ -4129,15 +4120,6 @@ JS_DefineFunctions(JSContext *cx, HandleObject obj, const JSFunctionSpec *fs) if (fs->selfHostedName) { JS_ASSERT(!fs->call.op); JS_ASSERT(!fs->call.info); - /* - * During creation of the self-hosting global, we ignore all - * self-hosted functions, as that means we're currently setting up - * the global object that the self-hosted code is then compiled - * in. Self-hosted functions can access each other via their names, - * but not via the builtin classes they get installed into. - */ - if (cx->runtime()->isSelfHostingGlobal(cx->global())) - continue; RootedAtom shName(cx, Atomize(cx, fs->selfHostedName, strlen(fs->selfHostedName))); if (!shName) diff --git a/js/src/jsarray.cpp b/js/src/jsarray.cpp index a585800183f1..dd221669cc54 100644 --- a/js/src/jsarray.cpp +++ b/js/src/jsarray.cpp @@ -2246,8 +2246,8 @@ js::array_shift(JSContext *cx, unsigned argc, Value *vp) return SetLengthProperty(cx, obj, newlen); } -static bool -array_unshift(JSContext *cx, unsigned argc, Value *vp) +bool +js::array_unshift(JSContext *cx, unsigned argc, Value *vp) { CallArgs args = CallArgsFromVp(argc, vp); RootedObject obj(cx, ToObject(cx, args.thisv())); @@ -2702,8 +2702,8 @@ js::array_concat(JSContext *cx, unsigned argc, Value *vp) return SetLengthProperty(cx, narr, length); } -static bool -array_slice(JSContext *cx, unsigned argc, Value *vp) +bool +js::array_slice(JSContext *cx, unsigned argc, Value *vp) { CallArgs args = CallArgsFromVp(argc, vp); @@ -2981,7 +2981,7 @@ static const JSFunctionSpec array_methods[] = { JS_FN(js_toLocaleString_str,array_toLocaleString,0,0), /* Perl-ish methods. */ - JS_FN("join", js::array_join, 1,JSFUN_GENERIC_NATIVE), + JS_FN("join", array_join, 1,JSFUN_GENERIC_NATIVE), JS_FN("reverse", array_reverse, 0,JSFUN_GENERIC_NATIVE), JS_FN("sort", array_sort, 1,JSFUN_GENERIC_NATIVE), JS_FN("push", array_push, 1,JSFUN_GENERIC_NATIVE), diff --git a/js/src/jsarray.h b/js/src/jsarray.h index 7558f2c78e8f..1a960640e7e8 100644 --- a/js/src/jsarray.h +++ b/js/src/jsarray.h @@ -179,6 +179,12 @@ ArrayShiftMoveElements(JSObject *obj); extern bool array_shift(JSContext *cx, unsigned argc, js::Value *vp); +extern bool +array_unshift(JSContext *cx, unsigned argc, js::Value *vp); + +extern bool +array_slice(JSContext *cx, unsigned argc, js::Value *vp); + /* * Append the given (non-hole) value to the end of an array. The array must be * a newborn array -- that is, one which has not been exposed to script for diff --git a/js/src/jsdate.cpp b/js/src/jsdate.cpp index 55a8e78d7bfa..2b52e7b5f7bf 100644 --- a/js/src/jsdate.cpp +++ b/js/src/jsdate.cpp @@ -1195,8 +1195,8 @@ NowAsMillis() return (double) (PRMJ_Now() / PRMJ_USEC_PER_MSEC); } -static bool -date_now(JSContext *cx, unsigned argc, Value *vp) +bool +js::date_now(JSContext *cx, unsigned argc, Value *vp) { CallArgs args = CallArgsFromVp(argc, vp); args.rval().setDouble(NowAsMillis()); @@ -2863,8 +2863,8 @@ date_valueOf_impl(JSContext *cx, CallArgs args) return true; } -static bool -date_valueOf(JSContext *cx, unsigned argc, Value *vp) +bool +js::date_valueOf(JSContext *cx, unsigned argc, Value *vp) { CallArgs args = CallArgsFromVp(argc, vp); return CallNonGenericMethod(cx, args); diff --git a/js/src/jsdate.h b/js/src/jsdate.h index 5a033174ef91..e3985239f1d7 100644 --- a/js/src/jsdate.h +++ b/js/src/jsdate.h @@ -60,4 +60,15 @@ js_DateGetSeconds(JSObject *obj); bool js_Date(JSContext *cx, unsigned argc, JS::Value *vp); +namespace js { + +/* Date methods exposed so they can be installed in the self-hosting global. */ +bool +date_now(JSContext *cx, unsigned argc, JS::Value *vp); + +bool +date_valueOf(JSContext *cx, unsigned argc, JS::Value *vp); + +} /* namespace js */ + #endif /* jsdate_h */ diff --git a/js/src/jsfun.cpp b/js/src/jsfun.cpp index 52338da1f664..3715de7724c2 100644 --- a/js/src/jsfun.cpp +++ b/js/src/jsfun.cpp @@ -1582,8 +1582,8 @@ fun_isGenerator(JSContext *cx, unsigned argc, Value *vp) } /* ES5 15.3.4.5. */ -static bool -fun_bind(JSContext *cx, unsigned argc, Value *vp) +bool +js::fun_bind(JSContext *cx, unsigned argc, Value *vp) { CallArgs args = CallArgsFromVp(argc, vp); diff --git a/js/src/jsfun.h b/js/src/jsfun.h index 230fa8edf305..a6514b04785a 100644 --- a/js/src/jsfun.h +++ b/js/src/jsfun.h @@ -536,6 +536,9 @@ fun_resolve(JSContext *cx, HandleObject obj, HandleId id, MutableHandleObject ob extern bool fun_toString(JSContext *cx, unsigned argc, Value *vp); +extern bool +fun_bind(JSContext *cx, unsigned argc, Value *vp); + /* * Function extended with reserved slots for use by various kinds of functions. * Most functions do not have these extensions, but enough do that efficient diff --git a/js/src/jsiter.cpp b/js/src/jsiter.cpp index c0886a61f851..5d39e9d11a27 100644 --- a/js/src/jsiter.cpp +++ b/js/src/jsiter.cpp @@ -2099,17 +2099,24 @@ GlobalObject::initIteratorClasses(JSContext *cx, Handle global) global->setPrototype(JSProto_GeneratorFunction, ObjectValue(*genFunctionProto)); } - if (global->getPrototype(JSProto_StopIteration).isUndefined()) { - proto = global->createBlankPrototype(cx, &StopIterationObject::class_); - if (!proto || !JSObject::freeze(cx, proto)) - return false; + return GlobalObject::initStopIterationClass(cx, global); +} - // This should use a non-JSProtoKey'd slot, but this is easier for now. - if (!GlobalObject::initBuiltinConstructor(cx, global, JSProto_StopIteration, proto, proto)) - return false; +/* static */ bool +GlobalObject::initStopIterationClass(JSContext *cx, Handle global) +{ + if (!global->getPrototype(JSProto_StopIteration).isUndefined()) + return true; - global->setConstructor(JSProto_StopIteration, ObjectValue(*proto)); - } + RootedObject proto(cx, global->createBlankPrototype(cx, &StopIterationObject::class_)); + if (!proto || !JSObject::freeze(cx, proto)) + return false; + + // This should use a non-JSProtoKey'd slot, but this is easier for now. + if (!GlobalObject::initBuiltinConstructor(cx, global, JSProto_StopIteration, proto, proto)) + return false; + + global->setConstructor(JSProto_StopIteration, ObjectValue(*proto)); return true; } diff --git a/js/src/jsobj.cpp b/js/src/jsobj.cpp index e258ae4e3fce..fd1fbbf74212 100644 --- a/js/src/jsobj.cpp +++ b/js/src/jsobj.cpp @@ -136,7 +136,8 @@ FinishObjectClassInit(JSContext *cx, JS::HandleObject ctor, JS::HandleObject pro self->setOriginalEval(evalobj); RootedObject intrinsicsHolder(cx); - if (cx->runtime()->isSelfHostingGlobal(self)) { + bool isSelfHostingGlobal = cx->runtime()->isSelfHostingGlobal(self); + if (isSelfHostingGlobal) { intrinsicsHolder = self; } else { intrinsicsHolder = NewObjectWithGivenProto(cx, &JSObject::class_, proto, self, @@ -158,8 +159,10 @@ FinishObjectClassInit(JSContext *cx, JS::HandleObject ctor, JS::HandleObject pro * Define self-hosted functions after setting the intrinsics holder * (which is needed to define self-hosted functions) */ - if (!JS_DefineFunctions(cx, ctor, object_static_selfhosted_methods)) - return false; + if (!isSelfHostingGlobal) { + if (!JS_DefineFunctions(cx, ctor, object_static_selfhosted_methods)) + return false; + } /* * The global object should have |Object.prototype| as its [[Prototype]]. diff --git a/js/src/jsstr.cpp b/js/src/jsstr.cpp index b9ebfba31e94..0680516a1f35 100644 --- a/js/src/jsstr.cpp +++ b/js/src/jsstr.cpp @@ -627,8 +627,8 @@ DoSubstr(JSContext *cx, JSString *str, size_t begin, size_t len) return NewDependentString(cx, str, begin, len); } -static bool -str_substring(JSContext *cx, unsigned argc, Value *vp) +bool +js::str_substring(JSContext *cx, unsigned argc, Value *vp) { CallArgs args = CallArgsFromVp(argc, vp); @@ -755,8 +755,8 @@ ToLowerCaseHelper(JSContext *cx, CallReceiver call) return true; } -static bool -str_toLowerCase(JSContext *cx, unsigned argc, Value *vp) +bool +js::str_toLowerCase(JSContext *cx, unsigned argc, Value *vp) { return ToLowerCaseHelper(cx, CallArgsFromVp(argc, vp)); } @@ -906,8 +906,8 @@ ToUpperCaseHelper(JSContext *cx, CallReceiver call) return true; } -static bool -str_toUpperCase(JSContext *cx, unsigned argc, Value *vp) +bool +js::str_toUpperCase(JSContext *cx, unsigned argc, Value *vp) { return ToUpperCaseHelper(cx, CallArgsFromVp(argc, vp)); } @@ -1653,8 +1653,8 @@ str_contains(JSContext *cx, unsigned argc, Value *vp) } /* ES6 20120927 draft 15.5.4.7. */ -static bool -str_indexOf(JSContext *cx, unsigned argc, Value *vp) +bool +js::str_indexOf(JSContext *cx, unsigned argc, Value *vp) { CallArgs args = CallArgsFromVp(argc, vp); @@ -1726,8 +1726,8 @@ LastIndexOfImpl(const TextChar *text, size_t textLen, const PatChar *pat, size_t return -1; } -static bool -str_lastIndexOf(JSContext *cx, unsigned argc, Value *vp) +bool +js::str_lastIndexOf(JSContext *cx, unsigned argc, Value *vp) { CallArgs args = CallArgsFromVp(argc, vp); RootedString textstr(cx, ThisToStringForStringProto(cx, args)); @@ -1820,8 +1820,8 @@ HasSubstringAt(JSLinearString *text, JSLinearString *pat, size_t start) } /* ES6 20131108 draft 21.1.3.18. */ -static bool -str_startsWith(JSContext *cx, unsigned argc, Value *vp) +bool +js::str_startsWith(JSContext *cx, unsigned argc, Value *vp) { CallArgs args = CallArgsFromVp(argc, vp); diff --git a/js/src/jsstr.h b/js/src/jsstr.h index bfb627e8de6f..8da2775ca2ca 100644 --- a/js/src/jsstr.h +++ b/js/src/jsstr.h @@ -300,6 +300,26 @@ str_fromCharCode(JSContext *cx, unsigned argc, Value *vp); extern bool str_fromCharCode_one_arg(JSContext *cx, HandleValue code, MutableHandleValue rval); +/* String methods exposed so they can be installed in the self-hosting global. */ + +extern bool +str_indexOf(JSContext *cx, unsigned argc, Value *vp); + +extern bool +str_lastIndexOf(JSContext *cx, unsigned argc, Value *vp); + +extern bool +str_startsWith(JSContext *cx, unsigned argc, Value *vp); + +extern bool +str_substring(JSContext *cx, unsigned argc, Value *vp); + +extern bool +str_toLowerCase(JSContext *cx, unsigned argc, Value *vp); + +extern bool +str_toUpperCase(JSContext *cx, unsigned argc, Value *vp); + } /* namespace js */ extern bool diff --git a/js/src/jsweakmap.cpp b/js/src/jsweakmap.cpp index 405616d09658..444d0bef392b 100644 --- a/js/src/jsweakmap.cpp +++ b/js/src/jsweakmap.cpp @@ -238,8 +238,8 @@ WeakMap_has_impl(JSContext *cx, CallArgs args) return true; } -static bool -WeakMap_has(JSContext *cx, unsigned argc, Value *vp) +bool +js::WeakMap_has(JSContext *cx, unsigned argc, Value *vp) { CallArgs args = CallArgsFromVp(argc, vp); return CallNonGenericMethod(cx, args); @@ -259,8 +259,8 @@ WeakMap_clear_impl(JSContext *cx, CallArgs args) return true; } -static bool -WeakMap_clear(JSContext *cx, unsigned argc, Value *vp) +bool +js::WeakMap_clear(JSContext *cx, unsigned argc, Value *vp) { CallArgs args = CallArgsFromVp(argc, vp); return CallNonGenericMethod(cx, args); @@ -291,8 +291,8 @@ WeakMap_get_impl(JSContext *cx, CallArgs args) return true; } -static bool -WeakMap_get(JSContext *cx, unsigned argc, Value *vp) +bool +js::WeakMap_get(JSContext *cx, unsigned argc, Value *vp) { CallArgs args = CallArgsFromVp(argc, vp); return CallNonGenericMethod(cx, args); @@ -324,8 +324,8 @@ WeakMap_delete_impl(JSContext *cx, CallArgs args) return true; } -static bool -WeakMap_delete(JSContext *cx, unsigned argc, Value *vp) +bool +js::WeakMap_delete(JSContext *cx, unsigned argc, Value *vp) { CallArgs args = CallArgsFromVp(argc, vp); return CallNonGenericMethod(cx, args); @@ -433,8 +433,8 @@ WeakMap_set_impl(JSContext *cx, CallArgs args) return true; } -static bool -WeakMap_set(JSContext *cx, unsigned argc, Value *vp) +bool +js::WeakMap_set(JSContext *cx, unsigned argc, Value *vp) { CallArgs args = CallArgsFromVp(argc, vp); return CallNonGenericMethod(cx, args); @@ -570,8 +570,8 @@ static const JSFunctionSpec weak_map_methods[] = { JS_FS_END }; -JSObject * -js_InitWeakMapClass(JSContext *cx, HandleObject obj) +static JSObject * +InitWeakMapClass(JSContext *cx, HandleObject obj, bool defineMembers) { JS_ASSERT(obj->isNative()); @@ -589,11 +589,25 @@ js_InitWeakMapClass(JSContext *cx, HandleObject obj) if (!LinkConstructorAndPrototype(cx, ctor, weakMapProto)) return nullptr; - if (!DefinePropertiesAndFunctions(cx, weakMapProto, nullptr, weak_map_methods)) - return nullptr; + if (defineMembers) { + if (!DefinePropertiesAndFunctions(cx, weakMapProto, nullptr, weak_map_methods)) + return nullptr; + } if (!GlobalObject::initBuiltinConstructor(cx, global, JSProto_WeakMap, ctor, weakMapProto)) return nullptr; return weakMapProto; } +JSObject * +js_InitWeakMapClass(JSContext *cx, HandleObject obj) +{ + return InitWeakMapClass(cx, obj, true); +} + +JSObject * +js::InitBareWeakMapCtor(JSContext *cx, HandleObject obj) +{ + return InitWeakMapClass(cx, obj, false); +} + diff --git a/js/src/jsweakmap.h b/js/src/jsweakmap.h index e1900aeba659..2670516bcc2b 100644 --- a/js/src/jsweakmap.h +++ b/js/src/jsweakmap.h @@ -279,6 +279,26 @@ protected: } }; +/* WeakMap methods exposed so they can be installed in the self-hosting global. */ + +extern JSObject * +InitBareWeakMapCtor(JSContext *cx, js::HandleObject obj); + +extern bool +WeakMap_has(JSContext *cx, unsigned argc, Value *vp); + +extern bool +WeakMap_get(JSContext *cx, unsigned argc, Value *vp); + +extern bool +WeakMap_set(JSContext *cx, unsigned argc, Value *vp); + +extern bool +WeakMap_delete(JSContext *cx, unsigned argc, Value *vp); + +extern bool +WeakMap_clear(JSContext *cx, unsigned argc, Value *vp); + } /* namespace js */ extern JSObject * diff --git a/js/src/vm/GlobalObject.cpp b/js/src/vm/GlobalObject.cpp index f6d2951224fd..e2b20ad84559 100644 --- a/js/src/vm/GlobalObject.cpp +++ b/js/src/vm/GlobalObject.cpp @@ -284,6 +284,57 @@ GlobalObject::initStandardClasses(JSContext *cx, Handle global) return true; } +/** + * Initializes a builtin constructor and its prototype without defining any + * properties or functions on it. + * + * Used in self-hosting to install the few builtin constructors required by + * self-hosted builtins. + */ +static bool +InitBareBuiltinCtor(JSContext *cx, Handle global, JSProtoKey protoKey) +{ + MOZ_ASSERT(cx->runtime()->isSelfHostingGlobal(global)); + const Class *clasp = ProtoKeyToClass(protoKey); + RootedObject proto(cx); + proto = clasp->spec.createPrototype(cx, protoKey); + if (!proto) + return false; + + RootedObject ctor(cx, clasp->spec.createConstructor(cx, protoKey)); + if (!ctor) + return false; + + return GlobalObject::initBuiltinConstructor(cx, global, protoKey, ctor, proto); +} + +/** + * The self-hosting global only gets a small subset of all standard classes. + * Even those are only created as bare constructors without any properties + * or functions. + */ +/* static */ bool +GlobalObject::initSelfHostingBuiltins(JSContext *cx, Handle global, + const JSFunctionSpec *builtins) +{ + /* Define a top-level property 'undefined' with the undefined value. */ + if (!JSObject::defineProperty(cx, global, cx->names().undefined, UndefinedHandleValue, + JS_PropertyStub, JS_StrictPropertyStub, + JSPROP_PERMANENT | JSPROP_READONLY)) + { + return false; + } + + return InitBareBuiltinCtor(cx, global, JSProto_Array) && + InitBareBuiltinCtor(cx, global, JSProto_TypedArray) && + InitBareBuiltinCtor(cx, global, JSProto_Uint8Array) && + InitBareBuiltinCtor(cx, global, JSProto_Uint32Array) && + InitBareWeakMapCtor(cx, global) && + initStopIterationClass(cx, global) && + InitSelfHostingCollectionIteratorFunctions(cx, global) && + JS_DefineFunctions(cx, global, builtins); +} + /* static */ bool GlobalObject::isRuntimeCodeGenEnabled(JSContext *cx, Handle global) { diff --git a/js/src/vm/GlobalObject.h b/js/src/vm/GlobalObject.h index 6cc4bb68aa91..d8244f3102d1 100644 --- a/js/src/vm/GlobalObject.h +++ b/js/src/vm/GlobalObject.h @@ -611,6 +611,7 @@ class GlobalObject : public JSObject // Implemented in jsiter.cpp. static bool initIteratorClasses(JSContext *cx, Handle global); + static bool initStopIterationClass(JSContext *cx, Handle global); // Implemented in builtin/MapObject.cpp. static bool initMapIteratorProto(JSContext *cx, Handle global); @@ -626,6 +627,8 @@ class GlobalObject : public JSObject static bool initTypedObjectModule(JSContext *cx, Handle global); static bool initStandardClasses(JSContext *cx, Handle global); + static bool initSelfHostingBuiltins(JSContext *cx, Handle global, + const JSFunctionSpec *builtins); typedef js::Vector DebuggerVector; diff --git a/js/src/vm/SelfHosting.cpp b/js/src/vm/SelfHosting.cpp index 1d5198eceb56..264287e3d51a 100644 --- a/js/src/vm/SelfHosting.cpp +++ b/js/src/vm/SelfHosting.cpp @@ -8,9 +8,11 @@ #include "jscntxt.h" #include "jscompartment.h" +#include "jsdate.h" #include "jsfriendapi.h" #include "jshashutil.h" #include "jsobj.h" +#include "jsweakmap.h" #include "jswrapper.h" #include "selfhosted.out.h" @@ -803,7 +805,72 @@ js::intrinsic_IsConstructing(JSContext *cx, unsigned argc, Value *vp) return true; } +// The self-hosting global isn't initialized with the normal set of builtins. +// Instead, individual C++-implemented functions that're required by +// self-hosted code are defined as global functions. Accessing these +// functions via a content compartment's builtins would be unsafe, because +// content script might have changed the builtins' prototypes' members. +// Installing the whole set of builtins in the self-hosting compartment, OTOH, +// would be wasteful: it increases memory usage and initialization time for +// self-hosting compartment. +// +// Additionally, a set of C++-implemented helper functions is defined on the +// self-hosting global. static const JSFunctionSpec intrinsic_functions[] = { + JS_FN("std_Array_join", array_join, 1,0), + JS_FN("std_Array_push", array_push, 1,0), + JS_FN("std_Array_pop", array_pop, 0,0), + JS_FN("std_Array_shift", array_shift, 0,0), + JS_FN("std_Array_unshift", array_unshift, 1,0), + JS_FN("std_Array_slice", array_slice, 2,0), + JS_FN("std_Array_sort", array_sort, 1,0), + + JS_FN("std_Date_now", date_now, 0,0), + JS_FN("std_Date_valueOf", date_valueOf, 0,0), + + JS_FN("std_Function_bind", fun_bind, 1,0), + JS_FN("std_Function_apply", js_fun_apply, 1,0), + + JS_FN("std_Math_floor", math_floor, 1,0), + JS_FN("std_Math_max", math_max, 2,0), + JS_FN("std_Math_min", math_min, 2,0), + JS_FN("std_Math_abs", math_abs, 1,0), + JS_FN("std_Math_imul", math_imul, 2,0), + JS_FN("std_Math_log2", math_log2, 1,0), + + JS_FN("std_Map_has", MapObject::has, 1,0), + JS_FN("std_Map_iterator", MapObject::entries, 0,0), + + JS_FN("std_Number_valueOf", js_num_valueOf, 0,0), + + JS_FN("std_Object_create", obj_create, 2,0), + JS_FN("std_Object_getPrototypeOf", obj_getPrototypeOf, 1,0), + JS_FN("std_Object_getOwnPropertyNames", obj_getOwnPropertyNames, 1,0), + JS_FN("std_Object_getOwnPropertyDescriptor", obj_getOwnPropertyDescriptor, 2,0), + JS_FN("std_Object_hasOwnProperty", obj_hasOwnProperty, 2,0), + + JS_FN("std_Set_has", SetObject::has, 1,0), + JS_FN("std_Set_iterator", SetObject::values, 0,0), + + JS_FN("std_String_fromCharCode", str_fromCharCode, 1,0), + JS_FN("std_String_charCodeAt", js_str_charCodeAt, 1,0), + JS_FN("std_String_indexOf", str_indexOf, 1,0), + JS_FN("std_String_lastIndexOf", str_lastIndexOf, 1,0), + JS_FN("std_String_match", str_match, 1,0), + JS_FN("std_String_replace", str_replace, 2,0), + JS_FN("std_String_split", str_split, 2,0), + JS_FN("std_String_startsWith", str_startsWith, 2,0), + JS_FN("std_String_substring", str_substring, 2,0), + JS_FN("std_String_toLowerCase", str_toLowerCase, 0,0), + JS_FN("std_String_toUpperCase", str_toUpperCase, 0,0), + + JS_FN("std_WeakMap_has", WeakMap_has, 1,0), + JS_FN("std_WeakMap_get", WeakMap_get, 2,0), + JS_FN("std_WeakMap_set", WeakMap_set, 2,0), + JS_FN("std_WeakMap_delete", WeakMap_delete, 1,0), + JS_FN("std_WeakMap_clear", WeakMap_clear, 0,0), + + // Helper funtions after this point. JS_FN("ToObject", intrinsic_ToObject, 1,0), JS_FN("IsObject", intrinsic_IsObject, 1,0), JS_FN("ToInteger", intrinsic_ToInteger, 1,0), @@ -1013,15 +1080,8 @@ JSRuntime::initSelfHosting(JSContext *cx) Rooted shg(cx, &selfHostingGlobal_->as()); selfHostingGlobal_->compartment()->isSelfHosting = true; selfHostingGlobal_->compartment()->isSystem = true; - /* - * During initialization of standard classes for the self-hosting global, - * all self-hosted functions are ignored. Thus, we don't create cyclic - * dependencies in the order of initialization. - */ - if (!GlobalObject::initStandardClasses(cx, shg)) - return false; - if (!JS_DefineFunctions(cx, shg, intrinsic_functions)) + if (!GlobalObject::initSelfHostingBuiltins(cx, shg, intrinsic_functions)) return false; JS_FireOnNewGlobalObject(cx, shg); diff --git a/js/src/vm/StructuredClone.cpp b/js/src/vm/StructuredClone.cpp index 1ff2ddbe7cae..cf9d7b014569 100644 --- a/js/src/vm/StructuredClone.cpp +++ b/js/src/vm/StructuredClone.cpp @@ -976,7 +976,7 @@ JSStructuredCloneWriter::traverseMap(HandleObject obj) RootedObject unwrapped(context(), CheckedUnwrap(obj)); MOZ_ASSERT(unwrapped); JSAutoCompartment ac(context(), unwrapped); - if (!MapObject::entries(context(), unwrapped, &newEntries)) + if (!MapObject::getKeysAndValuesInterleaved(context(), unwrapped, &newEntries)) return false; } if (!context()->compartment()->wrap(context(), newEntries)) From a8f62204b1f8becf6f505e57379252248637f872 Mon Sep 17 00:00:00 2001 From: Bobby Holley Date: Wed, 1 Oct 2014 13:52:43 +0200 Subject: [PATCH 06/63] Bug 865948 - Tests. r=gabor --- js/xpconnect/tests/chrome/chrome.ini | 1 + js/xpconnect/tests/chrome/test_bug865948.xul | 36 ++++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 js/xpconnect/tests/chrome/test_bug865948.xul diff --git a/js/xpconnect/tests/chrome/chrome.ini b/js/xpconnect/tests/chrome/chrome.ini index 1f1860a5939c..b4e1681af93a 100644 --- a/js/xpconnect/tests/chrome/chrome.ini +++ b/js/xpconnect/tests/chrome/chrome.ini @@ -59,6 +59,7 @@ skip-if = buildapp == 'mulet' [test_bug858101.xul] skip-if = buildapp == 'mulet' [test_bug860494.xul] +[test_bug865948.xul] [test_bug866823.xul] [test_bug895340.xul] [test_bug932906.xul] diff --git a/js/xpconnect/tests/chrome/test_bug865948.xul b/js/xpconnect/tests/chrome/test_bug865948.xul new file mode 100644 index 000000000000..c3ec0e473c00 --- /dev/null +++ b/js/xpconnect/tests/chrome/test_bug865948.xul @@ -0,0 +1,36 @@ + + + + + + + + + diff --git a/js/xpconnect/crashtests/crashtests.list b/js/xpconnect/crashtests/crashtests.list index bb43dc925285..1c8c52fc7024 100644 --- a/js/xpconnect/crashtests/crashtests.list +++ b/js/xpconnect/crashtests/crashtests.list @@ -49,6 +49,7 @@ asserts(0-1) load 786142.html # We may hit bug 645229 here. load 797583.html load 806751.html load 833856.html +load 851418.html load 854604.html load 854139.html pref(dom.use_xbl_scopes_for_remote_xul,true) load 898939.html From 1c3945d0a6be0d50a17ff57e69a49605b66406a7 Mon Sep 17 00:00:00 2001 From: Gabor Krizsanits Date: Wed, 1 Oct 2014 14:13:53 +0200 Subject: [PATCH 09/63] Bug 877072 - Script execution order for imports. r=mrbkap --- content/base/public/nsIDocument.h | 13 +- content/base/src/ImportManager.cpp | 358 +++++++++++++++++- content/base/src/ImportManager.h | 133 ++++++- content/base/src/nsDocument.cpp | 3 + content/base/src/nsDocument.h | 34 +- content/base/src/nsScriptLoader.cpp | 39 +- content/base/src/nsScriptLoader.h | 8 +- content/html/content/moz.build | 1 + content/html/content/src/HTMLLinkElement.cpp | 11 +- .../content/test/imports/file_importA1.html | 11 + .../content/test/imports/file_importA2.html | 10 + .../content/test/imports/file_importB1.html | 11 + .../content/test/imports/file_importB2.html | 10 + .../content/test/imports/file_importC1.html | 11 + .../content/test/imports/file_importC10.html | 11 + .../content/test/imports/file_importC2.html | 11 + .../content/test/imports/file_importC3.html | 11 + .../content/test/imports/file_importC4.html | 11 + .../content/test/imports/file_importC5.html | 11 + .../content/test/imports/file_importC6.html | 11 + .../content/test/imports/file_importC7.html | 11 + .../content/test/imports/file_importC8.html | 11 + .../content/test/imports/file_importC9.html | 11 + .../content/test/imports/file_importD.html | 8 + .../content/test/imports/file_importE.html | 11 + .../html/content/test/imports/mochitest.ini | 20 + content/html/content/test/mochitest.ini | 4 + .../content/test/test_imports_nested.html | 41 ++ .../content/test/test_imports_nested_2.html | 56 +++ .../fetching/already-in-import-map.html.ini | 5 - 30 files changed, 850 insertions(+), 47 deletions(-) create mode 100644 content/html/content/test/imports/file_importA1.html create mode 100644 content/html/content/test/imports/file_importA2.html create mode 100644 content/html/content/test/imports/file_importB1.html create mode 100644 content/html/content/test/imports/file_importB2.html create mode 100644 content/html/content/test/imports/file_importC1.html create mode 100644 content/html/content/test/imports/file_importC10.html create mode 100644 content/html/content/test/imports/file_importC2.html create mode 100644 content/html/content/test/imports/file_importC3.html create mode 100644 content/html/content/test/imports/file_importC4.html create mode 100644 content/html/content/test/imports/file_importC5.html create mode 100644 content/html/content/test/imports/file_importC6.html create mode 100644 content/html/content/test/imports/file_importC7.html create mode 100644 content/html/content/test/imports/file_importC8.html create mode 100644 content/html/content/test/imports/file_importC9.html create mode 100644 content/html/content/test/imports/file_importD.html create mode 100644 content/html/content/test/imports/file_importE.html create mode 100644 content/html/content/test/imports/mochitest.ini create mode 100644 content/html/content/test/test_imports_nested.html create mode 100644 content/html/content/test/test_imports_nested_2.html delete mode 100644 testing/web-platform/meta/html-imports/fetching/already-in-import-map.html.ini diff --git a/content/base/public/nsIDocument.h b/content/base/public/nsIDocument.h index 4d04291b1169..5caba4352a11 100644 --- a/content/base/public/nsIDocument.h +++ b/content/base/public/nsIDocument.h @@ -134,8 +134,8 @@ typedef CallbackObjectHolder NodeFilterHolder; } // namespace mozilla #define NS_IDOCUMENT_IID \ -{ 0x613ea294, 0x0288, 0x48b4, \ - { 0x9e, 0x7b, 0x0f, 0xe9, 0x3f, 0x8c, 0xf8, 0x95 } } +{ 0x42a263db, 0x6ac6, 0x40ff, \ + { 0x89, 0xe2, 0x25, 0x12, 0xe4, 0xbc, 0x2d, 0x2d } } // Enum for requesting a particular type of document when creating a doc enum DocumentFlavor { @@ -2362,10 +2362,15 @@ public: // Each import tree has exactly one master document which is // the root of the tree, and owns the browser context. - virtual already_AddRefed MasterDocument() = 0; + virtual nsIDocument* MasterDocument() = 0; virtual void SetMasterDocument(nsIDocument* master) = 0; virtual bool IsMasterDocument() = 0; - virtual already_AddRefed ImportManager() = 0; + virtual mozilla::dom::ImportManager* ImportManager() = 0; + // We keep track of the order of sub imports were added to the document. + virtual bool HasSubImportLink(nsINode* aLink) = 0; + virtual uint32_t IndexOfSubImportLink(nsINode* aLink) = 0; + virtual void AddSubImportLink(nsINode* aLink) = 0; + virtual nsINode* GetSubImportLink(uint32_t aIdx) = 0; /* * Given a node, get a weak reference to it and append that reference to diff --git a/content/base/src/ImportManager.cpp b/content/base/src/ImportManager.cpp index a539b3dd27f7..7af448d4b67c 100644 --- a/content/base/src/ImportManager.cpp +++ b/content/base/src/ImportManager.cpp @@ -23,6 +23,10 @@ #include "nsScriptLoader.h" #include "nsNetUtil.h" +//----------------------------------------------------------------------------- +// AutoError +//----------------------------------------------------------------------------- + class AutoError { public: explicit AutoError(mozilla::dom::ImportLoader* loader, bool scriptsBlocked = true) @@ -49,6 +53,220 @@ private: namespace mozilla { namespace dom { +//----------------------------------------------------------------------------- +// ImportLoader::Updater +//----------------------------------------------------------------------------- + +void +ImportLoader::Updater::GetReferrerChain(nsINode* aNode, + nsTArray& aResult) +{ + // We fill up the array backward. First the last link: aNode. + MOZ_ASSERT(mLoader->mLinks.Contains(aNode)); + + aResult.AppendElement(aNode); + nsINode* node = aNode; + nsRefPtr manager = mLoader->Manager(); + for (ImportLoader* referrersLoader = manager->Find(node->OwnerDoc()); + referrersLoader; + referrersLoader = manager->Find(node->OwnerDoc())) + { + // Then walking up the main referrer chain and append each link + // to the array. + node = referrersLoader->GetMainReferrer(); + MOZ_ASSERT(node); + aResult.AppendElement(node); + } + + // The reversed order is more useful for consumers. + // XXX: This should probably go to nsTArray or some generic utility + // lib for our containers that we don't have... I would really like to + // get rid of this part... + uint32_t l = aResult.Length(); + for (uint32_t i = 0; i < l / 2; i++) { + Swap(aResult[i], aResult[l - i - 1]); + } +} + +bool +ImportLoader::Updater::ShouldUpdate(nsTArray& aNewPath) +{ + // Let's walk down on the main referrer chains of both the current main and + // the new link, and find the last pair of links that are from the same + // document. This is the junction point between the two referrer chain. Their + // order in the subimport list of that document will determine if we have to + // update the spanning tree or this new edge changes nothing in the script + // execution order. + nsTArray oldPath; + GetReferrerChain(mLoader->mLinks[mLoader->mMainReferrer], oldPath); + uint32_t max = std::min(oldPath.Length(), aNewPath.Length()); + MOZ_ASSERT(max > 0); + uint32_t lastCommonImportAncestor = 0; + + for (uint32_t i = 0; + i < max && oldPath[i]->OwnerDoc() == aNewPath[i]->OwnerDoc(); + i++) + { + lastCommonImportAncestor = i; + } + + MOZ_ASSERT(lastCommonImportAncestor < max); + nsINode* oldLink = oldPath[lastCommonImportAncestor]; + nsINode* newLink = aNewPath[lastCommonImportAncestor]; + + if ((lastCommonImportAncestor == max - 1) && + newLink == oldLink ) { + // If one chain contains the other entirely, then this is a simple cycle, + // nothing to be done here. + MOZ_ASSERT(oldPath.Length() != aNewPath.Length(), + "This would mean that new link == main referrer link"); + return false; + } + + MOZ_ASSERT(aNewPath != oldPath, + "How could this happen?"); + nsIDocument* doc = oldLink->OwnerDoc(); + MOZ_ASSERT(doc->HasSubImportLink(newLink)); + MOZ_ASSERT(doc->HasSubImportLink(oldLink)); + + return doc->IndexOfSubImportLink(newLink) < doc->IndexOfSubImportLink(oldLink); +} + +void +ImportLoader::Updater::UpdateMainReferrer(uint32_t aNewIdx) +{ + MOZ_ASSERT(aNewIdx < mLoader->mLinks.Length()); + nsINode* newMainReferrer = mLoader->mLinks[aNewIdx]; + + // This new link means we have to execute our scripts sooner... + // Let's make sure that unblocking a loader does not trigger a script execution. + // So we start with placing the new blockers and only then will we remove any + // blockers. + if (mLoader->IsBlocking()) { + // Our import parent is changed, let's block the new one and later unblock + // the old one. + newMainReferrer->OwnerDoc()->ScriptLoader()->AddExecuteBlocker(); + } + + if (mLoader->mDocument) { + // Our nearest predecessor has changed. So let's add the ScriptLoader to the + // new one if there is any. And remove it from the old one. + nsRefPtr manager = mLoader->Manager(); + nsScriptLoader* loader = mLoader->mDocument->ScriptLoader(); + ImportLoader*& pred = mLoader->mBlockingPredecessor; + ImportLoader* newPred = manager->GetNearestPredecessor(newMainReferrer); + if (pred) { + if (newPred) { + newPred->AddBlockedScriptLoader(loader); + } + pred->RemoveBlockedScriptLoader(loader); + } + } + + if (mLoader->IsBlocking()) { + mLoader->mImportParent->ScriptLoader()->RemoveExecuteBlocker(); + } + + // Finally update mMainReferrer to point to the newly added link. + mLoader->mMainReferrer = aNewIdx; + mLoader->mImportParent = newMainReferrer->OwnerDoc(); +} + +nsINode* +ImportLoader::Updater::NextDependant(nsINode* aCurrentLink, + nsTArray& aPath, + NodeTable& aVisitedNodes, bool aSkipChildren) +{ + // Depth first graph traversal. + if (!aSkipChildren) { + // "first child" + ImportLoader* loader = mLoader->Manager()->Find(aCurrentLink); + if (loader && loader->GetDocument()) { + nsINode* firstSubImport = loader->GetDocument()->GetSubImportLink(0); + if (firstSubImport && !aVisitedNodes.Contains(firstSubImport)) { + aPath.AppendElement(aCurrentLink); + aVisitedNodes.PutEntry(firstSubImport); + return firstSubImport; + } + } + } + + aPath.AppendElement(aCurrentLink); + // "(parent's) next sibling" + while(aPath.Length() > 1) { + aCurrentLink = aPath[aPath.Length() - 1]; + aPath.RemoveElementAt(aPath.Length() - 1); + + // Let's find the next "sibling" + ImportLoader* loader = mLoader->Manager()->Find(aCurrentLink->OwnerDoc()); + MOZ_ASSERT(loader && loader->GetDocument(), "How can this happend?"); + nsIDocument* doc = loader->GetDocument(); + MOZ_ASSERT(doc->HasSubImportLink(aCurrentLink)); + uint32_t idx = doc->IndexOfSubImportLink(aCurrentLink); + nsINode* next = doc->GetSubImportLink(idx + 1); + if (next) { + // Note: If we found an already visited link that means the parent links has + // closed the circle it's always the "first child" section that should find + // the first already visited node. Let's just assert that. + MOZ_ASSERT(!aVisitedNodes.Contains(next)); + aVisitedNodes.PutEntry(next); + return next; + } + } + + return nullptr; +} + +void +ImportLoader::Updater::UpdateDependants(nsINode* aNode, + nsTArray& aPath) +{ + NodeTable visitedNodes; + nsINode* current = aNode; + uint32_t initialLength = aPath.Length(); + bool neededUpdate = true; + while ((current = NextDependant(current, aPath, visitedNodes, !neededUpdate))) { + if (!current || aPath.Length() <= initialLength) { + break; + } + ImportLoader* loader = mLoader->Manager()->Find(current); + if (!loader) { + continue; + } + Updater& updater = loader->mUpdater; + neededUpdate = updater.ShouldUpdate(aPath); + if (neededUpdate) { + updater.UpdateMainReferrer(loader->mLinks.IndexOf(current)); + } + } +} + +void +ImportLoader::Updater::UpdateSpanningTree(nsINode* aNode) +{ + if (mLoader->mReady || mLoader->mStopped) { + // Scripts already executed, nothing to be done here. + return; + } + + if (mLoader->mLinks.Length() == 1) { + // If this is the first referrer, let's mark it. + mLoader->mMainReferrer = 0; + return; + } + + nsTArray newReferrerChain; + GetReferrerChain(aNode, newReferrerChain); + if (ShouldUpdate(newReferrerChain)) { + UpdateMainReferrer(mLoader->mLinks.Length() - 1); + UpdateDependants(aNode, newReferrerChain); + } +} + +//----------------------------------------------------------------------------- +// ImportLoader +//----------------------------------------------------------------------------- + NS_INTERFACE_MAP_BEGIN(ImportLoader) NS_INTERFACE_MAP_ENTRY(nsIStreamListener) NS_INTERFACE_MAP_ENTRY(nsIRequestObserver) @@ -66,10 +284,13 @@ NS_IMPL_CYCLE_COLLECTION(ImportLoader, ImportLoader::ImportLoader(nsIURI* aURI, nsIDocument* aImportParent) : mURI(aURI) , mImportParent(aImportParent) + , mBlockingPredecessor(nullptr) , mReady(false) , mStopped(false) , mBlockingScripts(false) -{} + , mUpdater(MOZ_THIS_IN_INITIALIZER_LIST()) +{ +} void ImportLoader::BlockScripts() @@ -84,9 +305,19 @@ ImportLoader::UnblockScripts() { MOZ_ASSERT(mBlockingScripts); mImportParent->ScriptLoader()->RemoveExecuteBlocker(); + for (uint32_t i = 0; i < mBlockedScriptLoaders.Length(); i++) { + mBlockedScriptLoaders[i]->RemoveExecuteBlocker(); + } + mBlockedScriptLoaders.Clear(); mBlockingScripts = false; } +void +ImportLoader::SetBlockingPredecessor(ImportLoader* aLoader) +{ + mBlockingPredecessor = aLoader; +} + void ImportLoader::DispatchEventIfFinished(nsINode* aNode) { @@ -99,6 +330,26 @@ ImportLoader::DispatchEventIfFinished(nsINode* aNode) } } +void +ImportLoader::AddBlockedScriptLoader(nsScriptLoader* aScriptLoader) +{ + if (mBlockedScriptLoaders.Contains(aScriptLoader)) { + return; + } + + aScriptLoader->AddExecuteBlocker(); + + // Let's keep track of the pending script loaders. + mBlockedScriptLoaders.AppendElement(aScriptLoader); +} + +bool +ImportLoader::RemoveBlockedScriptLoader(nsScriptLoader* aScriptLoader) +{ + aScriptLoader->RemoveExecuteBlocker(); + return mBlockedScriptLoaders.RemoveElement(aScriptLoader); +} + void ImportLoader::AddLinkElement(nsINode* aNode) { @@ -106,14 +357,15 @@ ImportLoader::AddLinkElement(nsINode* aNode) // refers to an import that is already finished loading or // stopped trying, we need to fire the corresponding event // on it. - mLinks.AppendObject(aNode); + mLinks.AppendElement(aNode); + mUpdater.UpdateSpanningTree(aNode); DispatchEventIfFinished(aNode); } void ImportLoader::RemoveLinkElement(nsINode* aNode) { - mLinks.RemoveObject(aNode); + mLinks.RemoveElement(aNode); } // Events has to be fired with a script runner, so mImport can @@ -159,8 +411,8 @@ void ImportLoader::Done() { mReady = true; - uint32_t count = mLinks.Count(); - for (uint32_t i = 0; i < count; i++) { + uint32_t l = mLinks.Length(); + for (uint32_t i = 0; i < l; i++) { DispatchLoadEvent(mLinks[i]); } UnblockScripts(); @@ -172,8 +424,8 @@ ImportLoader::Error(bool aUnblockScripts) { mDocument = nullptr; mStopped = true; - uint32_t count = mLinks.Count(); - for (uint32_t i = 0; i < count; i++) { + uint32_t l = mLinks.Length(); + for (uint32_t i = 0; i < l; i++) { DispatchErrorEvent(mLinks[i]); } if (aUnblockScripts) { @@ -391,7 +643,25 @@ ImportLoader::OnStartRequest(nsIRequest* aRequest, nsISupports* aContext) true); NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_ABORT_ERR); - // Let's start parser. + nsCOMPtr originalURI; + rv = channel->GetOriginalURI(getter_AddRefs(originalURI)); + NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_ABORT_ERR); + + nsCOMPtr URI; + rv = channel->GetURI(getter_AddRefs(URI)); + NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_ABORT_ERR); + MOZ_ASSERT(URI, "URI of a channel should never be null"); + + bool equals; + rv = URI->Equals(originalURI, &equals); + NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_ABORT_ERR); + + if (!equals) { + // In case of a redirection we must add the new URI to the import map. + Manager()->AddLoaderWithNewURI(this, URI); + } + + // Let's start the parser. mParserStreamListener = listener; rv = listener->OnStartRequest(aRequest, aContext); NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_ABORT_ERR); @@ -400,6 +670,10 @@ ImportLoader::OnStartRequest(nsIRequest* aRequest, nsISupports* aContext) return NS_OK; } +//----------------------------------------------------------------------------- +// ImportManager +//----------------------------------------------------------------------------- + NS_IMPL_CYCLE_COLLECTION(ImportManager, mImports) @@ -417,16 +691,78 @@ ImportManager::Get(nsIURI* aURI, nsINode* aNode, nsIDocument* aOrigDocument) // and start it up. nsRefPtr loader; mImports.Get(aURI, getter_AddRefs(loader)); - + bool needToStart = false; if (!loader) { loader = new ImportLoader(aURI, aOrigDocument); mImports.Put(aURI, loader); + needToStart = true; + } + + MOZ_ASSERT(loader); + // Let's keep track of the sub imports links in each document. It will + // be used later for scrip execution order calculation. (see UpdateSpanningTree) + // NOTE: removing and adding back the link to the tree somewhere else will + // NOT have an effect on script execution order. + if (!aOrigDocument->HasSubImportLink(aNode)) { + aOrigDocument->AddSubImportLink(aNode); + } + + loader->AddLinkElement(aNode); + + if (needToStart) { loader->Open(); } - loader->AddLinkElement(aNode); - MOZ_ASSERT(loader); + return loader.forget(); } +ImportLoader* +ImportManager::Find(nsIDocument* aImport) +{ + return mImports.GetWeak(aImport->GetDocumentURIObject()); +} + +ImportLoader* +ImportManager::Find(nsINode* aLink) +{ + HTMLLinkElement* linkElement = static_cast(aLink); + nsCOMPtr uri = linkElement->GetHrefURI(); + return mImports.GetWeak(uri); +} + +void +ImportManager::AddLoaderWithNewURI(ImportLoader* aLoader, nsIURI* aNewURI) +{ + mImports.Put(aNewURI, aLoader); +} + +nsRefPtr ImportManager::GetNearestPredecessor(nsINode* aNode) +{ + // Return the previous link if there is any in the same document. + nsIDocument* doc = aNode->OwnerDoc(); + int32_t idx = doc->IndexOfSubImportLink(aNode); + MOZ_ASSERT(idx != -1, "aNode must be a sub import link of its owner document"); + if (idx == 0) { + if (doc->IsMasterDocument()) { + // If there is no previous one, and it was the master document, then + // there is no predecessor. + return nullptr; + } + // Else we find the main referrer of the import parent of the link's document. + // And do a recursion. + ImportLoader* owner = Find(doc); + MOZ_ASSERT(owner); + nsCOMPtr mainReferrer = owner->GetMainReferrer(); + return GetNearestPredecessor(mainReferrer); + } + MOZ_ASSERT(idx > 0); + HTMLLinkElement* link = + static_cast(doc->GetSubImportLink(idx - 1)); + nsCOMPtr uri = link->GetHrefURI(); + nsRefPtr ret; + mImports.Get(uri, getter_AddRefs(ret)); + return ret; +} + } // namespace dom } // namespace mozilla diff --git a/content/base/src/ImportManager.h b/content/base/src/ImportManager.h index ba6199418046..4ce97ebc8e43 100644 --- a/content/base/src/ImportManager.h +++ b/content/base/src/ImportManager.h @@ -39,12 +39,13 @@ #ifndef mozilla_dom_ImportManager_h__ #define mozilla_dom_ImportManager_h__ -#include "nsCOMArray.h" +#include "nsTArray.h" #include "nsCycleCollectionParticipant.h" #include "nsIDOMEventListener.h" #include "nsIStreamListener.h" #include "nsIWeakReferenceUtils.h" #include "nsRefPtrHashtable.h" +#include "nsScriptLoader.h" #include "nsURIHashKey.h" class nsIDocument; @@ -58,11 +59,70 @@ namespace dom { class ImportManager; +typedef nsTHashtable> NodeTable; + class ImportLoader MOZ_FINAL : public nsIStreamListener , public nsIDOMEventListener { + + // A helper inner class to decouple the logic of updating the import graph + // after a new import link has been found by one of the parsers. + class Updater { + + public: + Updater(ImportLoader* aLoader) : mLoader(aLoader) + {} + + // After a new link is added that refers to this import, we + // have to update the spanning tree, since given this new link the + // priority of this import might be higher in the scripts + // execution order than before. It updates mMainReferrer, mImportParent, + // the corresponding pending ScriptRunners, etc. + // It also handles updating additional dependant loaders via the + // UpdateDependants calls. + // (NOTE: See GetMainReferrer about spanning tree.) + void UpdateSpanningTree(nsINode* aNode); + + private: + // Returns an array of links that forms a referring chain from + // the master document to this import. Each link in the array + // is marked as main referrer in the list. + void GetReferrerChain(nsINode* aNode, nsTArray& aResult); + + // Once we find a new referrer path to our import, we have to see if + // it changes the load order hence we have to do an update on the graph. + bool ShouldUpdate(nsTArray& aNewPath); + void UpdateMainReferrer(uint32_t newIdx); + + // It's a depth first graph traversal algorithm, for UpdateDependants. The + // nodes in the graph are the import link elements, and there is a directed + // edge from link1 to link2 if link2 is a subimport in the import document + // of link1. + // If the ImportLoader that aCurrentLink points to didn't need to be updated + // the algorithm skips its "children" (subimports). Note, that this graph can + // also contain cycles, aVisistedLinks is used to track the already visited + // links to avoid an infinite loop. + // aPath - (in/out) the referrer link chain of aCurrentLink when called, and + // of the next link when the function returns + // aVisitedLinks - (in/out) list of links that the traversal already visited + // (to handle cycles in the graph) + // aSkipChildren - when aCurrentLink points to an import that did not need + // to be updated, we can skip its sub-imports ('children') + nsINode* NextDependant(nsINode* aCurrentLink, + nsTArray& aPath, + NodeTable& aVisitedLinks, bool aSkipChildren); + + // When we find a new link that changes the load order of the known imports, + // we also have to check all the subimports of it, to see if they need an + // update too. (see test_imports_nested_2.html) + void UpdateDependants(nsINode* aNode, nsTArray& aPath); + + ImportLoader* mLoader; + }; + friend class ::AutoError; friend class ImportManager; + friend class Updater; public: ImportLoader(nsIURI* aURI, nsIDocument* aOriginDocument); @@ -83,11 +143,46 @@ public: bool IsReady() { return mReady; } bool IsStopped() { return mStopped; } bool IsBlocking() { return mBlockingScripts; } - already_AddRefed GetImport() - { - return mReady ? nsCOMPtr(mDocument).forget() : nullptr; + + ImportManager* Manager() { + MOZ_ASSERT(mDocument || mImportParent, "One of them should be always set"); + return (mDocument ? mDocument : mImportParent)->ImportManager(); } + // Simply getter for the import document. Can return a partially parsed + // document if called too early. + nsIDocument* GetDocument() + { + return mDocument; + } + + // Getter for the import document that is used in the spec. Returns + // nullptr if the import is not yet ready. + nsIDocument* GetImport() + { + return mReady ? mDocument : nullptr; + } + + // There is only one referring link that is marked as primary link per + // imports. This is the one that has to be taken into account when + // scrip execution order is determined. Links marked as primary link form + // a spanning tree in the import graph. (Eliminating the cycles and + // multiple parents.) This spanning tree is recalculated every time + // a new import link is added to the manager. + nsINode* GetMainReferrer() + { + return mLinks.IsEmpty() ? nullptr : mLinks[mMainReferrer]; + } + + // An import is not only blocked by its import children, but also + // by its predecessors. It's enough to find the closest predecessor + // and wait for that to run its scripts. We keep track of all the + // ScriptRunners that are waiting for this import. NOTE: updating + // the main referrer might change this list. + void AddBlockedScriptLoader(nsScriptLoader* aScriptLoader); + bool RemoveBlockedScriptLoader(nsScriptLoader* aScriptLoader); + void SetBlockingPredecessor(ImportLoader* aLoader); + private: ~ImportLoader() {} @@ -122,12 +217,25 @@ private: nsCOMPtr mURI; nsCOMPtr mParserStreamListener; nsCOMPtr mImportParent; + ImportLoader* mBlockingPredecessor; + // List of the LinkElements that are referring to this import // we need to keep track of them so we can fire event on them. - nsCOMArray mLinks; + nsTArray> mLinks; + + // List of pending ScriptLoaders that are waiting for this import + // to finish. + nsTArray> mBlockedScriptLoaders; + + // There is always exactly one referrer link that is flagged as + // the main referrer the primary link. This is the one that is + // used in the script execution order calculation. + // ("Branch" according to the spec.) + uint32_t mMainReferrer; bool mReady; bool mStopped; bool mBlockingScripts; + Updater mUpdater; }; class ImportManager MOZ_FINAL : public nsISupports @@ -142,9 +250,24 @@ public: NS_DECL_CYCLE_COLLECTING_ISUPPORTS NS_DECL_CYCLE_COLLECTION_CLASS(ImportManager) + // Finds the ImportLoader that belongs to aImport in the map. + ImportLoader* Find(nsIDocument* aImport); + + // Find the ImportLoader aLink refers to. + ImportLoader* Find(nsINode* aLink); + + void AddLoaderWithNewURI(ImportLoader* aLoader, nsIURI* aNewURI); + + // When a new import link is added, this getter either creates + // a new ImportLoader for it, or returns an existing one if + // it was already created and in the import map. already_AddRefed Get(nsIURI* aURI, nsINode* aNode, nsIDocument* aOriginDocument); + // It finds the predecessor for an import link node that runs its + // scripts the latest among its predecessors. + nsRefPtr GetNearestPredecessor(nsINode* aNode); + private: ImportMap mImports; }; diff --git a/content/base/src/nsDocument.cpp b/content/base/src/nsDocument.cpp index 8c0444e3f20d..f791e9f8d959 100644 --- a/content/base/src/nsDocument.cpp +++ b/content/base/src/nsDocument.cpp @@ -1997,6 +1997,8 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INTERNAL(nsDocument) NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mOnDemandBuiltInUASheets) NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mPreloadingImages) + NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mSubImportLinks) + for (uint32_t i = 0; i < tmp->mFrameRequestCallbacks.Length(); ++i) { NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mFrameRequestCallbacks[i]"); cb.NoteXPCOMChild(tmp->mFrameRequestCallbacks[i].mCallback.GetISupports()); @@ -2061,6 +2063,7 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsDocument) NS_IMPL_CYCLE_COLLECTION_UNLINK(mRegistry) NS_IMPL_CYCLE_COLLECTION_UNLINK(mMasterDocument) NS_IMPL_CYCLE_COLLECTION_UNLINK(mImportManager) + NS_IMPL_CYCLE_COLLECTION_UNLINK(mSubImportLinks) tmp->mParentDocument = nullptr; diff --git a/content/base/src/nsDocument.h b/content/base/src/nsDocument.h index efe1658c1a43..b89ed1d72222 100644 --- a/content/base/src/nsDocument.h +++ b/content/base/src/nsDocument.h @@ -1290,10 +1290,10 @@ public: mozilla::ErrorResult& rv) MOZ_OVERRIDE; virtual void UseRegistryFromDocument(nsIDocument* aDocument) MOZ_OVERRIDE; - virtual already_AddRefed MasterDocument() + virtual nsIDocument* MasterDocument() { - return mMasterDocument ? (nsCOMPtr(mMasterDocument)).forget() - : (nsCOMPtr(this)).forget(); + return mMasterDocument ? mMasterDocument.get() + : this; } virtual void SetMasterDocument(nsIDocument* master) @@ -1306,11 +1306,11 @@ public: return !mMasterDocument; } - virtual already_AddRefed ImportManager() + virtual mozilla::dom::ImportManager* ImportManager() { if (mImportManager) { MOZ_ASSERT(!mMasterDocument, "Only the master document has ImportManager set"); - return nsRefPtr(mImportManager).forget(); + return mImportManager.get(); } if (mMasterDocument) { @@ -1322,7 +1322,28 @@ public: // master document and this is the first import in it. // Let's create a new manager. mImportManager = new mozilla::dom::ImportManager(); - return nsRefPtr(mImportManager).forget(); + return mImportManager.get(); + } + + virtual bool HasSubImportLink(nsINode* aLink) + { + return mSubImportLinks.Contains(aLink); + } + + virtual uint32_t IndexOfSubImportLink(nsINode* aLink) + { + return mSubImportLinks.IndexOf(aLink); + } + + virtual void AddSubImportLink(nsINode* aLink) + { + mSubImportLinks.AppendElement(aLink); + } + + virtual nsINode* GetSubImportLink(uint32_t aIdx) + { + return aIdx < mSubImportLinks.Length() ? mSubImportLinks[aIdx].get() + : nullptr; } virtual void UnblockDOMContentLoaded() MOZ_OVERRIDE; @@ -1754,6 +1775,7 @@ private: nsCOMPtr mMasterDocument; nsRefPtr mImportManager; + nsTArray > mSubImportLinks; // Set to true when the document is possibly controlled by the ServiceWorker. // Used to prevent multiple requests to ServiceWorkerManager. diff --git a/content/base/src/nsScriptLoader.cpp b/content/base/src/nsScriptLoader.cpp index 4e60dc20b288..f11842915296 100644 --- a/content/base/src/nsScriptLoader.cpp +++ b/content/base/src/nsScriptLoader.cpp @@ -49,6 +49,7 @@ #include "nsSandboxFlags.h" #include "nsContentTypeParser.h" #include "nsINetworkPredictor.h" +#include "ImportManager.h" #include "mozilla/dom/EncodingUtils.h" #include "mozilla/CORSMode.h" @@ -1236,7 +1237,7 @@ nsScriptLoader::ReadyToExecuteScripts() if (!SelfReadyToExecuteScripts()) { return false; } - + for (nsIDocument* doc = mDocument; doc; doc = doc->GetParentDocument()) { nsScriptLoader* ancestor = doc->ScriptLoader(); if (!ancestor->SelfReadyToExecuteScripts() && @@ -1246,10 +1247,44 @@ nsScriptLoader::ReadyToExecuteScripts() } } + if (!mDocument->IsMasterDocument()) { + nsRefPtr im = mDocument->ImportManager(); + nsRefPtr loader = im->Find(mDocument); + MOZ_ASSERT(loader, "How can we have an import document without a loader?"); + + // The referring link that counts in the execution order calculation + // (in spec: flagged as branch) + nsCOMPtr referrer = loader->GetMainReferrer(); + MOZ_ASSERT(referrer, "There has to be a main referring link for each imports"); + + // Import documents are blocked by their import predecessors. We need to + // wait with script execution until all the predecessors are done. + // Technically it means we have to wait for the last one to finish, + // which is the neares one to us in the order. + nsRefPtr lastPred = im->GetNearestPredecessor(referrer); + if (!lastPred) { + // If there is no predecessor we can run. + return true; + } + + nsCOMPtr doc = lastPred->GetDocument(); + if (lastPred->IsBlocking() || !doc || (doc && !doc->ScriptLoader()->SelfReadyToExecuteScripts())) { + // Document has not been created yet or it was created but not ready. + // Either case we are blocked by it. The ImportLoader will take care + // of blocking us, and adding the pending child loader to the blocking + // ScriptLoader when it's possible (at this point the blocking loader + // might not have created the document/ScriptLoader) + lastPred->AddBlockedScriptLoader(this); + // As more imports are parsed, this can change, let's cache what we + // blocked, so it can be later updated if needed (see: ImportLoader::Updater). + loader->SetBlockingPredecessor(lastPred); + return false; + } + } + return true; } - // This function was copied from nsParser.cpp. It was simplified a bit. static bool DetectByteOrderMark(const unsigned char* aBytes, int32_t aLen, nsCString& oCharset) diff --git a/content/base/src/nsScriptLoader.h b/content/base/src/nsScriptLoader.h index 6f5e80b76d39..f0f48724c393 100644 --- a/content/base/src/nsScriptLoader.h +++ b/content/base/src/nsScriptLoader.h @@ -249,6 +249,10 @@ public: nsresult ProcessOffThreadRequest(nsScriptLoadRequest *aRequest, void **aOffThreadToken); + bool AddPendingChildLoader(nsScriptLoader* aChild) { + return mPendingChildLoaders.AppendElement(aChild) != nullptr; + } + private: virtual ~nsScriptLoader(); @@ -302,10 +306,6 @@ private: return mEnabled && !mBlockerCount; } - bool AddPendingChildLoader(nsScriptLoader* aChild) { - return mPendingChildLoaders.AppendElement(aChild) != nullptr; - } - nsresult AttemptAsyncScriptParse(nsScriptLoadRequest* aRequest); nsresult ProcessRequest(nsScriptLoadRequest* aRequest, void **aOffThreadToken = nullptr); diff --git a/content/html/content/moz.build b/content/html/content/moz.build index 140507dd7127..7318432f13ae 100644 --- a/content/html/content/moz.build +++ b/content/html/content/moz.build @@ -8,6 +8,7 @@ DIRS += ['public', 'src'] MOCHITEST_MANIFESTS += [ 'test/forms/mochitest.ini', + 'test/imports/mochitest.ini', 'test/mochitest.ini', ] diff --git a/content/html/content/src/HTMLLinkElement.cpp b/content/html/content/src/HTMLLinkElement.cpp index 1b03afb68646..5731763602e5 100644 --- a/content/html/content/src/HTMLLinkElement.cpp +++ b/content/html/content/src/HTMLLinkElement.cpp @@ -263,15 +263,6 @@ HTMLLinkElement::UpdateImport() return; } - // Until the script execution order is not sorted out for nested cases - // let's not allow them. - if (!doc->IsMasterDocument()) { - nsContentUtils::LogSimpleConsoleError( - NS_LITERAL_STRING("Nested imports are not supported yet"), - "Imports"); - return; - } - // 2. rel type should be import. nsAutoString rel; GetAttr(kNameSpaceID_None, nsGkAtoms::rel, rel); @@ -526,7 +517,7 @@ HTMLLinkElement::WrapNode(JSContext* aCx) already_AddRefed HTMLLinkElement::GetImport() { - return mImportLoader ? mImportLoader->GetImport() : nullptr; + return mImportLoader ? nsRefPtr(mImportLoader->GetImport()).forget() : nullptr; } } // namespace dom diff --git a/content/html/content/test/imports/file_importA1.html b/content/html/content/test/imports/file_importA1.html new file mode 100644 index 000000000000..ecce6f061232 --- /dev/null +++ b/content/html/content/test/imports/file_importA1.html @@ -0,0 +1,11 @@ + + + + + + + + + \ No newline at end of file diff --git a/content/html/content/test/imports/file_importA2.html b/content/html/content/test/imports/file_importA2.html new file mode 100644 index 000000000000..d03e80a4b41f --- /dev/null +++ b/content/html/content/test/imports/file_importA2.html @@ -0,0 +1,10 @@ + + + + + + + + \ No newline at end of file diff --git a/content/html/content/test/imports/file_importB1.html b/content/html/content/test/imports/file_importB1.html new file mode 100644 index 000000000000..82fb55f9f61e --- /dev/null +++ b/content/html/content/test/imports/file_importB1.html @@ -0,0 +1,11 @@ + + + + + + + + + \ No newline at end of file diff --git a/content/html/content/test/imports/file_importB2.html b/content/html/content/test/imports/file_importB2.html new file mode 100644 index 000000000000..01b6cc21584b --- /dev/null +++ b/content/html/content/test/imports/file_importB2.html @@ -0,0 +1,10 @@ + + + + + + + + \ No newline at end of file diff --git a/content/html/content/test/imports/file_importC1.html b/content/html/content/test/imports/file_importC1.html new file mode 100644 index 000000000000..9ac117e65c9b --- /dev/null +++ b/content/html/content/test/imports/file_importC1.html @@ -0,0 +1,11 @@ + + + + + + + + + \ No newline at end of file diff --git a/content/html/content/test/imports/file_importC10.html b/content/html/content/test/imports/file_importC10.html new file mode 100644 index 000000000000..801d0f085574 --- /dev/null +++ b/content/html/content/test/imports/file_importC10.html @@ -0,0 +1,11 @@ + + + + + + + + + \ No newline at end of file diff --git a/content/html/content/test/imports/file_importC2.html b/content/html/content/test/imports/file_importC2.html new file mode 100644 index 000000000000..f0193be44999 --- /dev/null +++ b/content/html/content/test/imports/file_importC2.html @@ -0,0 +1,11 @@ + + + + + + + + + \ No newline at end of file diff --git a/content/html/content/test/imports/file_importC3.html b/content/html/content/test/imports/file_importC3.html new file mode 100644 index 000000000000..eb942b707f5a --- /dev/null +++ b/content/html/content/test/imports/file_importC3.html @@ -0,0 +1,11 @@ + + + + + + + + + \ No newline at end of file diff --git a/content/html/content/test/imports/file_importC4.html b/content/html/content/test/imports/file_importC4.html new file mode 100644 index 000000000000..5a172772ad93 --- /dev/null +++ b/content/html/content/test/imports/file_importC4.html @@ -0,0 +1,11 @@ + + + + + + + + + \ No newline at end of file diff --git a/content/html/content/test/imports/file_importC5.html b/content/html/content/test/imports/file_importC5.html new file mode 100644 index 000000000000..c29dc24ba06f --- /dev/null +++ b/content/html/content/test/imports/file_importC5.html @@ -0,0 +1,11 @@ + + + + + + + + + \ No newline at end of file diff --git a/content/html/content/test/imports/file_importC6.html b/content/html/content/test/imports/file_importC6.html new file mode 100644 index 000000000000..a53b62bb45ef --- /dev/null +++ b/content/html/content/test/imports/file_importC6.html @@ -0,0 +1,11 @@ + + + + + + + + + \ No newline at end of file diff --git a/content/html/content/test/imports/file_importC7.html b/content/html/content/test/imports/file_importC7.html new file mode 100644 index 000000000000..1c7d60114e06 --- /dev/null +++ b/content/html/content/test/imports/file_importC7.html @@ -0,0 +1,11 @@ + + + + + + + + + \ No newline at end of file diff --git a/content/html/content/test/imports/file_importC8.html b/content/html/content/test/imports/file_importC8.html new file mode 100644 index 000000000000..04bef617d392 --- /dev/null +++ b/content/html/content/test/imports/file_importC8.html @@ -0,0 +1,11 @@ + + + + + + + + + \ No newline at end of file diff --git a/content/html/content/test/imports/file_importC9.html b/content/html/content/test/imports/file_importC9.html new file mode 100644 index 000000000000..1a27497557f5 --- /dev/null +++ b/content/html/content/test/imports/file_importC9.html @@ -0,0 +1,11 @@ + + + + + + + + + \ No newline at end of file diff --git a/content/html/content/test/imports/file_importD.html b/content/html/content/test/imports/file_importD.html new file mode 100644 index 000000000000..a4fbda536dd0 --- /dev/null +++ b/content/html/content/test/imports/file_importD.html @@ -0,0 +1,8 @@ + + + + + + \ No newline at end of file diff --git a/content/html/content/test/imports/file_importE.html b/content/html/content/test/imports/file_importE.html new file mode 100644 index 000000000000..6a8792acf2ad --- /dev/null +++ b/content/html/content/test/imports/file_importE.html @@ -0,0 +1,11 @@ + + + + + + + + + \ No newline at end of file diff --git a/content/html/content/test/imports/mochitest.ini b/content/html/content/test/imports/mochitest.ini new file mode 100644 index 000000000000..c1a863ea8483 --- /dev/null +++ b/content/html/content/test/imports/mochitest.ini @@ -0,0 +1,20 @@ +[DEFAULT] +support-files = + file_importA1.html + file_importA2.html + file_importB1.html + file_importB2.html + file_importC1.html + file_importC2.html + file_importC3.html + file_importC4.html + file_importC5.html + file_importC6.html + file_importC7.html + file_importC8.html + file_importC9.html + file_importC10.html + file_importD.html + file_importE.html + + diff --git a/content/html/content/test/mochitest.ini b/content/html/content/test/mochitest.ini index 824935e25093..860f741cdf52 100644 --- a/content/html/content/test/mochitest.ini +++ b/content/html/content/test/mochitest.ini @@ -463,6 +463,10 @@ skip-if = buildapp == 'b2g' || e10s # b2g(multiple concurrent window.open()s fai [test_imports_basics.html] [test_imports_redirect.html] [test_imports_nonhttp.html] +[test_imports_nested.html] +skip-if = toolkit == 'gonk' # nested imports fail on b2g emulator +[test_imports_nested_2.html] +skip-if = toolkit == 'gonk' # nested imports fail on b2g emulator [test_li_attributes_reflection.html] [test_link_attributes_reflection.html] [test_link_sizes.html] diff --git a/content/html/content/test/test_imports_nested.html b/content/html/content/test/test_imports_nested.html new file mode 100644 index 000000000000..518e5b741788 --- /dev/null +++ b/content/html/content/test/test_imports_nested.html @@ -0,0 +1,41 @@ + + + + + Test for Bug 877072 + + + + + + Mozilla Bug 877072 + + + + + + + + + + diff --git a/content/html/content/test/test_imports_nested_2.html b/content/html/content/test/test_imports_nested_2.html new file mode 100644 index 000000000000..8e8e57d684bb --- /dev/null +++ b/content/html/content/test/test_imports_nested_2.html @@ -0,0 +1,56 @@ + + + + + Test for Bug 877072 + + + + + + Mozilla Bug 877072 + + + + + + + + + + + + diff --git a/testing/web-platform/meta/html-imports/fetching/already-in-import-map.html.ini b/testing/web-platform/meta/html-imports/fetching/already-in-import-map.html.ini deleted file mode 100644 index 83ec5c0bd6cb..000000000000 --- a/testing/web-platform/meta/html-imports/fetching/already-in-import-map.html.ini +++ /dev/null @@ -1,5 +0,0 @@ -[already-in-import-map.html] - type: testharness - [If LOCATION is already in the import map, let IMPORT be the imported document for LOCATION and stop. (2)] - expected: FAIL - From 147f659091bc7399a4ef2654b1e5e007b0319813 Mon Sep 17 00:00:00 2001 From: Benjamin Bouvier Date: Wed, 1 Oct 2014 14:57:15 +0200 Subject: [PATCH 10/63] Bug 1073064: SIMD x86-x64 backend: Implement MSimdBinaryLogical; r=sunfish --- js/src/jit/LIR-Common.h | 22 +++++++ js/src/jit/LOpcodes.h | 1 + js/src/jit/Lowering.cpp | 15 ++++- js/src/jit/Lowering.h | 1 + js/src/jit/MIR.h | 43 ++++++++++++++ js/src/jit/MOpcodes.h | 1 + js/src/jit/ParallelSafetyAnalysis.cpp | 1 + js/src/jit/shared/Assembler-x86-shared.h | 24 ++++++++ js/src/jit/shared/BaseAssembler-x86-shared.h | 57 +++++++++++++++++++ .../jit/shared/CodeGenerator-x86-shared.cpp | 48 ++++++++++++++++ js/src/jit/shared/CodeGenerator-x86-shared.h | 1 + js/src/jit/shared/MacroAssembler-x86-shared.h | 19 +++++++ 12 files changed, 231 insertions(+), 2 deletions(-) diff --git a/js/src/jit/LIR-Common.h b/js/src/jit/LIR-Common.h index 6dd33f2f58b8..067dac9e7c2f 100644 --- a/js/src/jit/LIR-Common.h +++ b/js/src/jit/LIR-Common.h @@ -326,6 +326,28 @@ class LSimdBinaryBitwiseX4 : public LInstructionHelper<1, 2, 0> } }; +class LSimdShift : public LInstructionHelper<1, 2, 0> +{ + public: + LIR_HEADER(SimdShift) + LSimdShift(const LAllocation &vec, const LAllocation &val) { + setOperand(0, vec); + setOperand(1, val); + } + const LAllocation *vector() { + return getOperand(0); + } + const LAllocation *value() { + return getOperand(1); + } + MSimdShift::Operation operation() const { + return mir_->toSimdShift()->operation(); + } + MSimdShift *mir() const { + return mir_->toSimdShift(); + } +}; + // SIMD selection of lanes from two int32x4 or float32x4 arguments based on a // int32x4 argument. class LSimdSelect : public LInstructionHelper<1, 3, 0> diff --git a/js/src/jit/LOpcodes.h b/js/src/jit/LOpcodes.h index a3b27f21f835..574e2d63ddba 100644 --- a/js/src/jit/LOpcodes.h +++ b/js/src/jit/LOpcodes.h @@ -29,6 +29,7 @@ _(SimdBinaryArithIx4) \ _(SimdBinaryArithFx4) \ _(SimdBinaryBitwiseX4) \ + _(SimdShift) \ _(SimdSelect) \ _(Value) \ _(CloneLiteral) \ diff --git a/js/src/jit/Lowering.cpp b/js/src/jit/Lowering.cpp index c462f28dc014..0ef0210deda2 100644 --- a/js/src/jit/Lowering.cpp +++ b/js/src/jit/Lowering.cpp @@ -3844,14 +3844,25 @@ LIRGenerator::visitSimdBinaryBitwise(MSimdBinaryBitwise *ins) MOZ_ASSERT(IsSimdType(ins->type())); if (ins->type() == MIRType_Int32x4 || ins->type() == MIRType_Float32x4) { - LSimdBinaryBitwiseX4 *add = new(alloc()) LSimdBinaryBitwiseX4; - return lowerForFPU(add, ins, ins->lhs(), ins->rhs()); + LSimdBinaryBitwiseX4 *lir = new(alloc()) LSimdBinaryBitwiseX4; + return lowerForFPU(lir, ins, ins->lhs(), ins->rhs()); } MOZ_CRASH("Unknown SIMD kind when doing bitwise operations"); return false; } +bool +LIRGenerator::visitSimdShift(MSimdShift *ins) +{ + MOZ_ASSERT(ins->type() == MIRType_Int32x4); + + LUse vector = useRegisterAtStart(ins->lhs()); + LAllocation value = useRegisterOrConstant(ins->rhs()); + LSimdShift *lir = new(alloc()) LSimdShift(vector, value); + return defineReuseInput(lir, ins, 0); +} + bool LIRGenerator::visitLexicalCheck(MLexicalCheck *ins) { diff --git a/js/src/jit/Lowering.h b/js/src/jit/Lowering.h index 1d387bff0293..42a142e8e0f2 100644 --- a/js/src/jit/Lowering.h +++ b/js/src/jit/Lowering.h @@ -274,6 +274,7 @@ class LIRGenerator : public LIRGeneratorSpecific bool visitSimdBinaryComp(MSimdBinaryComp *ins); bool visitSimdBinaryArith(MSimdBinaryArith *ins); bool visitSimdBinaryBitwise(MSimdBinaryBitwise *ins); + bool visitSimdShift(MSimdShift *ins); bool visitSimdConstant(MSimdConstant *ins); bool visitSimdConvert(MSimdConvert *ins); bool visitSimdReinterpretCast(MSimdReinterpretCast *ins); diff --git a/js/src/jit/MIR.h b/js/src/jit/MIR.h index d89ef0ce23a8..acd18aaa9ce2 100644 --- a/js/src/jit/MIR.h +++ b/js/src/jit/MIR.h @@ -1721,6 +1721,49 @@ class MSimdBinaryBitwise : public MBinaryInstruction ALLOW_CLONE(MSimdBinaryBitwise) }; +class MSimdShift : public MBinaryInstruction +{ + public: + enum Operation { + lsh, + rsh, + ursh + }; + + private: + Operation operation_; + + MSimdShift(MDefinition *left, MDefinition *right, Operation op) + : MBinaryInstruction(left, right), operation_(op) + { + MOZ_ASSERT(left->type() == MIRType_Int32x4 && right->type() == MIRType_Int32); + setResultType(MIRType_Int32x4); + setMovable(); + } + + public: + INSTRUCTION_HEADER(SimdShift); + static MSimdShift *NewAsmJS(TempAllocator &alloc, MDefinition *left, + MDefinition *right, Operation op) + { + return new(alloc) MSimdShift(left, right, op); + } + + AliasSet getAliasSet() const { + return AliasSet::None(); + } + + Operation operation() const { return operation_; } + + bool congruentTo(const MDefinition *ins) const { + if (!binaryCongruentTo(ins)) + return false; + return operation_ == ins->toSimdShift()->operation(); + } + + ALLOW_CLONE(MSimdShift) +}; + class MSimdTernaryBitwise : public MTernaryInstruction { public: diff --git a/js/src/jit/MOpcodes.h b/js/src/jit/MOpcodes.h index ab1069cd397f..e1fd9fb196dc 100644 --- a/js/src/jit/MOpcodes.h +++ b/js/src/jit/MOpcodes.h @@ -23,6 +23,7 @@ namespace jit { _(SimdBinaryComp) \ _(SimdBinaryArith) \ _(SimdBinaryBitwise) \ + _(SimdShift) \ _(SimdTernaryBitwise) \ _(CloneLiteral) \ _(Parameter) \ diff --git a/js/src/jit/ParallelSafetyAnalysis.cpp b/js/src/jit/ParallelSafetyAnalysis.cpp index ad5aa7a8c96e..b502c67c7d6e 100644 --- a/js/src/jit/ParallelSafetyAnalysis.cpp +++ b/js/src/jit/ParallelSafetyAnalysis.cpp @@ -122,6 +122,7 @@ class ParallelSafetyVisitor : public MDefinitionVisitor SAFE_OP(SimdBinaryComp) SAFE_OP(SimdBinaryArith) SAFE_OP(SimdBinaryBitwise) + SAFE_OP(SimdShift) SAFE_OP(SimdTernaryBitwise) UNSAFE_OP(CloneLiteral) SAFE_OP(Parameter) diff --git a/js/src/jit/shared/Assembler-x86-shared.h b/js/src/jit/shared/Assembler-x86-shared.h index 8d9af33d380a..8ce9e55f3b45 100644 --- a/js/src/jit/shared/Assembler-x86-shared.h +++ b/js/src/jit/shared/Assembler-x86-shared.h @@ -1447,6 +1447,30 @@ class AssemblerX86Shared : public AssemblerShared JS_ASSERT(HasSSE2()); masm.psrlq_ir(shift.value, dest.code()); } + void pslld(FloatRegister src, FloatRegister dest) { + MOZ_ASSERT(HasSSE2()); + masm.pslld_rr(src.code(), dest.code()); + } + void pslld(Imm32 count, FloatRegister dest) { + MOZ_ASSERT(HasSSE2()); + masm.pslld_ir(count.value, dest.code()); + } + void psrad(FloatRegister src, FloatRegister dest) { + MOZ_ASSERT(HasSSE2()); + masm.psrad_rr(src.code(), dest.code()); + } + void psrad(Imm32 count, FloatRegister dest) { + MOZ_ASSERT(HasSSE2()); + masm.psrad_ir(count.value, dest.code()); + } + void psrld(FloatRegister src, FloatRegister dest) { + MOZ_ASSERT(HasSSE2()); + masm.psrld_rr(src.code(), dest.code()); + } + void psrld(Imm32 count, FloatRegister dest) { + MOZ_ASSERT(HasSSE2()); + masm.psrld_ir(count.value, dest.code()); + } void cvtsi2sd(const Operand &src, FloatRegister dest) { JS_ASSERT(HasSSE2()); diff --git a/js/src/jit/shared/BaseAssembler-x86-shared.h b/js/src/jit/shared/BaseAssembler-x86-shared.h index 9e996dcd47cf..38f0e9aa5e1c 100644 --- a/js/src/jit/shared/BaseAssembler-x86-shared.h +++ b/js/src/jit/shared/BaseAssembler-x86-shared.h @@ -327,6 +327,9 @@ private: OP2_MOVDQ_VsdWsd = 0x6F, OP2_MOVDQ_VdqWdq = 0x6F, OP2_PSHUFD_VdqWdqIb = 0x70, + OP2_PSLLD_UdqIb = 0x72, + OP2_PSRAD_UdqIb = 0x72, + OP2_PSRLD_UdqIb = 0x72, OP2_PSRLDQ_Vd = 0x73, OP2_PCMPEQW = 0x75, OP2_PCMPEQD_VdqWdq = 0x76, @@ -345,7 +348,10 @@ private: OP2_CMPPS_VpsWps = 0xC2, OP2_PEXTRW_GdUdIb = 0xC5, OP2_SHUFPS_VpsWpsIb = 0xC6, + OP2_PSRLD_VdqWdq = 0xD2, + OP2_PSRAD_VdqWdq = 0xE2, OP2_PXORDQ_VdqWdq = 0xEF, + OP2_PSLLD_VdqWdq = 0xF2, OP2_PSUBD_VdqWdq = 0xFA, OP2_PADDD_VdqWdq = 0xFE } TwoByteOpcodeID; @@ -2924,6 +2930,57 @@ public: m_formatter.immediate8(shift); } + void pslld_rr(XMMRegisterID src, XMMRegisterID dst) + { + spew("pslld %s, %s", + nameFPReg(src), nameFPReg(dst)); + m_formatter.prefix(PRE_SSE_66); + m_formatter.twoByteOp(OP2_PSLLD_VdqWdq, (RegisterID)dst, (RegisterID)src); + } + + void pslld_ir(int32_t count, XMMRegisterID dst) + { + spew("pslld $%d, %s", + count, nameFPReg(dst)); + m_formatter.prefix(PRE_SSE_66); + m_formatter.twoByteOp(OP2_PSLLD_UdqIb, (RegisterID)6, (RegisterID)dst); + m_formatter.immediate8(int8_t(count)); + } + + void psrad_rr(XMMRegisterID src, XMMRegisterID dst) + { + spew("psrad %s, %s", + nameFPReg(src), nameFPReg(dst)); + m_formatter.prefix(PRE_SSE_66); + m_formatter.twoByteOp(OP2_PSRAD_VdqWdq, (RegisterID)dst, (RegisterID)src); + } + + void psrad_ir(int32_t count, XMMRegisterID dst) + { + spew("psrad $%d, %s", + count, nameFPReg(dst)); + m_formatter.prefix(PRE_SSE_66); + m_formatter.twoByteOp(OP2_PSRAD_UdqIb, (RegisterID)4, (RegisterID)dst); + m_formatter.immediate8(int8_t(count)); + } + + void psrld_rr(XMMRegisterID src, XMMRegisterID dst) + { + spew("psrld %s, %s", + nameFPReg(src), nameFPReg(dst)); + m_formatter.prefix(PRE_SSE_66); + m_formatter.twoByteOp(OP2_PSRLD_VdqWdq, (RegisterID)dst, (RegisterID)src); + } + + void psrld_ir(int32_t count, XMMRegisterID dst) + { + spew("psrld $%d, %s", + count, nameFPReg(dst)); + m_formatter.prefix(PRE_SSE_66); + m_formatter.twoByteOp(OP2_PSRLD_UdqIb, (RegisterID)2, (RegisterID)dst); + m_formatter.immediate8(int8_t(count)); + } + void movmskpd_rr(XMMRegisterID src, RegisterID dst) { spew("movmskpd %s, %s", diff --git a/js/src/jit/shared/CodeGenerator-x86-shared.cpp b/js/src/jit/shared/CodeGenerator-x86-shared.cpp index cf03c54245f9..483ca47d5690 100644 --- a/js/src/jit/shared/CodeGenerator-x86-shared.cpp +++ b/js/src/jit/shared/CodeGenerator-x86-shared.cpp @@ -2530,6 +2530,54 @@ CodeGeneratorX86Shared::visitSimdBinaryBitwiseX4(LSimdBinaryBitwiseX4 *ins) 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); + + // 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(); + if (val->isConstant()) { + Imm32 count(ToInt32(val)); + switch (ins->operation()) { + case MSimdShift::lsh: + masm.packedLeftShiftByScalar(count, out); + return true; + case MSimdShift::rsh: + masm.packedRightShiftByScalar(count, out); + return true; + case MSimdShift::ursh: + masm.packedUnsignedRightShiftByScalar(count, out); + return true; + } + MOZ_CRASH("unexpected SIMD bitwise op"); + } + + MOZ_ASSERT(val->isRegister()); + FloatRegister tmp = ScratchFloat32Reg; + masm.movd(ToRegister(val), tmp); + + switch (ins->operation()) { + case MSimdShift::lsh: + masm.packedLeftShiftByScalar(tmp, out); + return true; + case MSimdShift::rsh: + masm.packedRightShiftByScalar(tmp, out); + return true; + case MSimdShift::ursh: + masm.packedUnsignedRightShiftByScalar(tmp, out); + return true; + } + MOZ_CRASH("unexpected SIMD bitwise op"); +} + bool CodeGeneratorX86Shared::visitSimdSelect(LSimdSelect *ins) { diff --git a/js/src/jit/shared/CodeGenerator-x86-shared.h b/js/src/jit/shared/CodeGenerator-x86-shared.h index 8ed8ec574112..6e7e4d010d2d 100644 --- a/js/src/jit/shared/CodeGenerator-x86-shared.h +++ b/js/src/jit/shared/CodeGenerator-x86-shared.h @@ -224,6 +224,7 @@ class CodeGeneratorX86Shared : public CodeGeneratorShared bool visitSimdBinaryArithIx4(LSimdBinaryArithIx4 *lir); bool visitSimdBinaryArithFx4(LSimdBinaryArithFx4 *lir); bool visitSimdBinaryBitwiseX4(LSimdBinaryBitwiseX4 *lir); + bool visitSimdShift(LSimdShift *lir); bool visitSimdSelect(LSimdSelect *ins); // Out of line visitors. diff --git a/js/src/jit/shared/MacroAssembler-x86-shared.h b/js/src/jit/shared/MacroAssembler-x86-shared.h index dd5a77eb5900..a1ba82bb0573 100644 --- a/js/src/jit/shared/MacroAssembler-x86-shared.h +++ b/js/src/jit/shared/MacroAssembler-x86-shared.h @@ -525,6 +525,25 @@ class MacroAssemblerX86Shared : public Assembler psubd(src, dest); } + void packedLeftShiftByScalar(FloatRegister src, FloatRegister dest) { + pslld(src, dest); + } + void packedLeftShiftByScalar(Imm32 count, FloatRegister dest) { + pslld(count, dest); + } + void packedRightShiftByScalar(FloatRegister src, FloatRegister dest) { + psrad(src, dest); + } + void packedRightShiftByScalar(Imm32 count, FloatRegister dest) { + psrad(count, dest); + } + void packedUnsignedRightShiftByScalar(FloatRegister src, FloatRegister dest) { + psrld(src, dest); + } + void packedUnsignedRightShiftByScalar(Imm32 count, FloatRegister dest) { + psrld(count, dest); + } + void loadAlignedFloat32x4(const Address &src, FloatRegister dest) { movaps(Operand(src), dest); } From 2938fafe538433ad449999b7ff0f5484b2a9803e Mon Sep 17 00:00:00 2001 From: Benjamin Bouvier Date: Wed, 1 Oct 2014 14:57:29 +0200 Subject: [PATCH 11/63] Bug 1073064: SIMD: Add int32x4.shift{left,right,rightLogical} to asm.js; r=luke --- js/src/asmjs/AsmJSValidate.cpp | 28 +++++++++++++++--- js/src/builtin/SIMD.h | 5 +++- js/src/jit-test/tests/asm.js/testSIMD.js | 36 +++++++++++++++++++++++- 3 files changed, 63 insertions(+), 6 deletions(-) diff --git a/js/src/asmjs/AsmJSValidate.cpp b/js/src/asmjs/AsmJSValidate.cpp index a114443c61bc..7bb112851435 100644 --- a/js/src/asmjs/AsmJSValidate.cpp +++ b/js/src/asmjs/AsmJSValidate.cpp @@ -2453,13 +2453,13 @@ class FunctionCompiler return ins; } - MDefinition *binarySimd(MDefinition *lhs, MDefinition *rhs, MSimdBinaryComp::Operation op) + template + MDefinition *binarySimd(MDefinition *lhs, MDefinition *rhs, typename T::Operation op) { if (inDeadCode()) return nullptr; - JS_ASSERT(IsSimdType(lhs->type()) && rhs->type() == lhs->type()); - MSimdBinaryComp *ins = MSimdBinaryComp::NewAsmJS(alloc(), lhs, rhs, op); + T *ins = T::NewAsmJS(alloc(), lhs, rhs, op); curBlock_->add(ins); return ins; } @@ -4875,7 +4875,20 @@ CheckSimdBinary(FunctionCompiler &f, ParseNode *call DefinitionVector argDefs; if (!CheckSimdCallArgs(f, call, 2, CheckArgIsSubtypeOf(retType), &argDefs)) return false; - *def = f.binarySimd(argDefs[0], argDefs[1], op); + *def = f.binarySimd(argDefs[0], argDefs[1], op); + *type = Type::Int32x4; + return true; +} + +template<> +inline bool +CheckSimdBinary(FunctionCompiler &f, ParseNode *call, Type retType, + MSimdShift::Operation op, MDefinition **def, Type *type) +{ + DefinitionVector argDefs; + if (!CheckSimdCallArgs(f, call, 2, CheckSimdVectorScalarArgs(retType), &argDefs)) + return false; + *def = f.binarySimd(argDefs[0], argDefs[1], op); *type = Type::Int32x4; return true; } @@ -4965,6 +4978,13 @@ CheckSimdOperationCall(FunctionCompiler &f, ParseNode *call, const ModuleCompile case AsmJSSimdOperation_fromFloat32x4Bits: return CheckSimdCast(f, call, Type::Float32x4, retType, def, type); + case AsmJSSimdOperation_shiftLeft: + return CheckSimdBinary(f, call, Type::Int32x4, MSimdShift::lsh, def, type); + case AsmJSSimdOperation_shiftRight: + return CheckSimdBinary(f, call, Type::Int32x4, MSimdShift::rsh, def, type); + case AsmJSSimdOperation_shiftRightLogical: + return CheckSimdBinary(f, call, Type::Int32x4, MSimdShift::ursh, def, type); + case AsmJSSimdOperation_splat: { DefinitionVector defs; Type formalType = retType.simdToCoercedScalarType(); diff --git a/js/src/builtin/SIMD.h b/js/src/builtin/SIMD.h index e884c66a10bd..6f777de5b575 100644 --- a/js/src/builtin/SIMD.h +++ b/js/src/builtin/SIMD.h @@ -115,7 +115,10 @@ #define FOREACH_INT32X4_SIMD_OP(_) \ _(fromFloat32x4) \ - _(fromFloat32x4Bits) + _(fromFloat32x4Bits) \ + _(shiftLeft) \ + _(shiftRight) \ + _(shiftRightLogical) #define FOREACH_FLOAT32X4_SIMD_OP(_) \ _(fromInt32x4) \ _(fromInt32x4Bits) \ diff --git a/js/src/jit-test/tests/asm.js/testSIMD.js b/js/src/jit-test/tests/asm.js/testSIMD.js index 1b01cb2a23a5..8143dcb61817 100644 --- a/js/src/jit-test/tests/asm.js/testSIMD.js +++ b/js/src/jit-test/tests/asm.js/testSIMD.js @@ -665,11 +665,45 @@ CheckF4(ANDF32, 'var x=f4(42, 13.37,-1.42, 23.10); var y=f4(19.89, 2.4, 8.15, 16 CheckF4(ORF32, 'var x=f4(42, 13.37,-1.42, 23.10); var y=f4(19.89, 2.4, 8.15, 16.36); x=orr(x,y)', bitwise.or( [42, 13.37, -1.42, 23.10], [19.89, 2.4, 8.15, 16.36])); CheckF4(XORF32, 'var x=f4(42, 13.37,-1.42, 23.10); var y=f4(19.89, 2.4, 8.15, 16.36); x=xorr(x,y)', bitwise.xor([42, 13.37, -1.42, 23.10], [19.89, 2.4, 8.15, 16.36])); +// Logical ops +const LSHI = 'var lsh=i4.shiftLeft;' +const RSHI = 'var rsh=i4.shiftRight;' +const URSHI = 'var ursh=i4.shiftRightLogical;' + +assertAsmTypeFail('glob', USE_ASM + I32 + F32 + FROUND + LSHI + "function f() {var x=f4(1,2,3,4); return i4(lsh(x,f32(42)));} return f"); +assertAsmTypeFail('glob', USE_ASM + I32 + F32 + FROUND + LSHI + "function f() {var x=f4(1,2,3,4); return i4(lsh(x,42));} return f"); +assertAsmTypeFail('glob', USE_ASM + I32 + FROUND + LSHI + "function f() {var x=i4(1,2,3,4); return i4(lsh(x,42.0));} return f"); +assertAsmTypeFail('glob', USE_ASM + I32 + FROUND + LSHI + "function f() {var x=i4(1,2,3,4); return i4(lsh(x,f32(42)));} return f"); + +var input = 'i4(0, 1, ' + INT32_MIN + ', ' + INT32_MAX + ')'; +var vinput = [0, 1, INT32_MIN, INT32_MAX]; + +// TODO: What to do for masks > 31? Should we keep only the five low bits of +// the mask (JS) or not (x86)? +// Behave as x86 for now, fix when more broadly specified. See also bug 1068028 +function Lsh(i) { if (i > 31) return () => 0; return function(x) { return (x << i) | 0 } } +function Rsh(i) { if (i > 31) return (x) => (x<0)?-1:0; return function(x) { return (x >> i) | 0 } } +function Ursh(i) { if (i > 31) return () => 0; return function(x) { return (x >>> i) | 0 } } + +var asmLsh = asmLink(asmCompile('glob', USE_ASM + I32 + LSHI + 'function f(x, y){x=x|0;y=y|0; var v=' + input + ';return i4(lsh(v, x+y))} return f;'), this) +var asmRsh = asmLink(asmCompile('glob', USE_ASM + I32 + RSHI + 'function f(x, y){x=x|0;y=y|0; var v=' + input + ';return i4(rsh(v, x+y))} return f;'), this) +var asmUrsh = asmLink(asmCompile('glob', USE_ASM + I32 + URSHI + 'function f(x, y){x=x|0;y=y|0; var v=' + input + ';return i4(ursh(v, x+y))} return f;'), this) + +for (var i = 1; i < 64; i++) { + CheckI4(LSHI, 'var x=' + input + '; x=lsh(x, ' + i + ')', vinput.map(Lsh(i))); + CheckI4(RSHI, 'var x=' + input + '; x=rsh(x, ' + i + ')', vinput.map(Rsh(i))); + CheckI4(URSHI, 'var x=' + input + '; x=ursh(x, ' + i + ')', vinput.map(Ursh(i))); + + assertEqX4(asmLsh(i, 3), vinput.map(Lsh(i + 3))); + assertEqX4(asmRsh(i, 3), vinput.map(Rsh(i + 3))); + assertEqX4(asmUrsh(i, 3), vinput.map(Ursh(i + 3))); +} + // Select const I32SEL = 'var i4sel = i4.select;' const F32SEL = 'var f4sel = f4.select;' -assertAsmTypeFail('glob', USE_ASM + F32 + I32SEL + "function f() {var m=f4(1,2,3,4); return i4(i4sel(x,x,x));} return f"); +assertAsmTypeFail('glob', USE_ASM + F32 + I32SEL + "function f() {var x=f4(1,2,3,4); return i4(i4sel(x,x,x));} return f"); assertAsmTypeFail('glob', USE_ASM + I32 + F32 + I32SEL + "function f() {var m=f4(1,2,3,4); var x=i4(1,2,3,4); return i4(i4sel(m,x,x));} return f"); assertAsmTypeFail('glob', USE_ASM + I32 + F32 + I32SEL + "function f() {var m=f4(1,2,3,4); var x=f4(1,2,3,4); return i4(i4sel(m,x,x));} return f"); assertAsmTypeFail('glob', USE_ASM + I32 + F32 + I32SEL + "function f() {var m=i4(1,2,3,4); var x=f4(1,2,3,4); return i4(i4sel(m,x,x));} return f"); From f0fd552d509df3f0960faa4314758386f3aae6b3 Mon Sep 17 00:00:00 2001 From: Bobby Holley Date: Wed, 1 Oct 2014 15:24:59 +0200 Subject: [PATCH 12/63] Bug 1065185 - Fix permissions tests. r=bz --- dom/permission/tests/file_framework.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/dom/permission/tests/file_framework.js b/dom/permission/tests/file_framework.js index e05d479946ae..9030be02c88d 100644 --- a/dom/permission/tests/file_framework.js +++ b/dom/permission/tests/file_framework.js @@ -168,11 +168,9 @@ function expandPermissions(aPerms) { var perms = []; aPerms.forEach(function(el) { var access = permTable[el].access ? "readwrite" : null; - var expanded = SpecialPowers.unwrap(expand(el, access)); - // COW arrays don't behave array-like enough, to allow - // using expanded.slice(0) here. + var expanded = expand(el, access); for (let i = 0; i < expanded.length; i++) { - perms.push(expanded[i]); + perms.push(SpecialPowers.unwrap(expanded[i])); } }); From 8772fe7363ee1765aeefccf88a8d973f11dd851e Mon Sep 17 00:00:00 2001 From: Bobby Holley Date: Wed, 1 Oct 2014 15:25:00 +0200 Subject: [PATCH 13/63] Bug 1065185 - Fix crash IPC tests. r=bz --- dom/ipc/tests/test_CrashService_crash.html | 6 +++--- dom/plugins/test/mochitest/utils.js | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/dom/ipc/tests/test_CrashService_crash.html b/dom/ipc/tests/test_CrashService_crash.html index ce94119bc54d..eb9afcf04964 100644 --- a/dom/ipc/tests/test_CrashService_crash.html +++ b/dom/ipc/tests/test_CrashService_crash.html @@ -55,10 +55,10 @@ SpecialPowers.pushPrefEnv({'set':[ // Finally, poll for the new crash record. function tryGetCrash() { info("Waiting for getCrashes"); - crashMan.getCrashes().then(function (crashes) { + crashMan.getCrashes().then(SpecialPowers.wrapCallback(function (crashes) { if (crashes.length) { is(crashes.length, 1, "There should be only one record"); - var crash = SpecialPowers.wrap(crashes[0]); + var crash = crashes[0]; ok(crash.isOfType(crashMan.PROCESS_TYPE_CONTENT, crashMan.CRASH_TYPE_CRASH), "Record should be a content crash"); @@ -75,7 +75,7 @@ SpecialPowers.pushPrefEnv({'set':[ else { setTimeout(tryGetCrash, 1000); } - }, function (err) { + }), function (err) { ok(false, "Error getting crashes: " + err); SimpleTest.finish(); }); diff --git a/dom/plugins/test/mochitest/utils.js b/dom/plugins/test/mochitest/utils.js index 2d7299cb69af..a20ec57d0225 100644 --- a/dom/plugins/test/mochitest/utils.js +++ b/dom/plugins/test/mochitest/utils.js @@ -69,7 +69,7 @@ function crashAndGetCrashServiceRecord(crashMethodName, callback) { // the new record. function tryGetCrash() { info("Waiting for getCrashes"); - crashMan.getCrashes().then(function (crashes) { + crashMan.getCrashes().then(SpecialPowers.wrapCallback(function (crashes) { if (crashes.length) { is(crashes.length, 1, "There should be only one record"); var crash = SpecialPowers.wrap(crashes[0]); @@ -86,7 +86,7 @@ function crashAndGetCrashServiceRecord(crashMethodName, callback) { else { setTimeout(tryGetCrash, 1000); } - }, function (err) { + }), function (err) { ok(false, "Error getting crashes: " + err); SimpleTest.finish(); }); From 09178596481073010b695325632a50b586597e33 Mon Sep 17 00:00:00 2001 From: Bobby Holley Date: Wed, 1 Oct 2014 15:25:00 +0200 Subject: [PATCH 14/63] Bug 1065185 - Fix extension manager test. r=bz --- .../extensions/test/mochitest/test_bug687194.html | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/toolkit/mozapps/extensions/test/mochitest/test_bug687194.html b/toolkit/mozapps/extensions/test/mochitest/test_bug687194.html index 010b8b6f3c8e..8f99ea73a2a3 100644 --- a/toolkit/mozapps/extensions/test/mochitest/test_bug687194.html +++ b/toolkit/mozapps/extensions/test/mochitest/test_bug687194.html @@ -60,11 +60,11 @@ "http://mochi.test:8888/tests/toolkit/mozapps/extensions/test/mochitest/file_bug687194.xpi" AddonManager.getInstallForURL(INSTALL_URI, (install) => { install = SpecialPowers.wrap(install); - install.addListener({ + install.addListener(SpecialPowers.wrapCallbackObject({ onInstallEnded: function(install, addon) { SimpleTest.executeSoon(() => test.next(addon)); } - }); + })); install.install(); }, "application/x-xpinstall"); @@ -75,14 +75,14 @@ lastResult = yield; is(lastResult.threw, false, "able to resolve after the installation"); - let listener = { + let listener = SpecialPowers.wrapCallbackObject({ onUninstalled: function(removedAddon) { - if (SpecialPowers.wrap(removedAddon).id === addon.id) { + if (removedAddon.id === addon.id) { AddonManager.removeAddonListener(listener); SimpleTest.executeSoon(() => test.next()); } } - }; + }); AddonManager.addAddonListener(listener); addon.uninstall(); From b14e0de12393e03fe2a6d9fcb3b79818d3ee9276 Mon Sep 17 00:00:00 2001 From: Bobby Holley Date: Wed, 1 Oct 2014 15:25:00 +0200 Subject: [PATCH 15/63] Bug 1065185 - Fix devtools actors. r=bz See browser/devtools/canvasdebugger/test/browser_canvas-actor-test-02.js. And note that we need to re-waive the result, otherwise we get failures in browser/devtools/canvasdebugger/test/browser_canvas-actor-test-10.js. See browser/devtools/shadereditor/test/browser_se_editors-contents.js for the webgls stuff. --- toolkit/devtools/server/actors/call-watcher.js | 14 +++++++++----- toolkit/devtools/server/actors/webgl.js | 4 +++- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/toolkit/devtools/server/actors/call-watcher.js b/toolkit/devtools/server/actors/call-watcher.js index b8483858af4b..990858480d73 100644 --- a/toolkit/devtools/server/actors/call-watcher.js +++ b/toolkit/devtools/server/actors/call-watcher.js @@ -412,11 +412,13 @@ let CallWatcherActor = exports.CallWatcherActor = protocol.ActorClass({ * Instruments a function on the specified target object. */ function overrideFunction(global, target, name, descriptor, callback) { - let originalFunc = target[name]; + // Invoking .apply on an unxrayed content function doesn't work, because + // the arguments array is inaccessible to it. Get Xrays back. + let originalFunc = Cu.unwaiveXrays(target[name]); Object.defineProperty(target, name, { value: function(...args) { - let result = originalFunc.apply(this, args); + let result = Cu.waiveXrays(originalFunc.apply(this, args)); if (self._recording) { let stack = getStack(name); @@ -435,13 +437,15 @@ let CallWatcherActor = exports.CallWatcherActor = protocol.ActorClass({ * Instruments a getter or setter on the specified target object. */ function overrideAccessor(global, target, name, descriptor, callback) { - let originalGetter = target.__lookupGetter__(name); - let originalSetter = target.__lookupSetter__(name); + // Invoking .apply on an unxrayed content function doesn't work, because + // the arguments array is inaccessible to it. Get Xrays back. + let originalGetter = Cu.unwaiveXrays(target.__lookupGetter__(name)); + let originalSetter = Cu.unwaiveXrays(target.__lookupSetter__(name)); Object.defineProperty(target, name, { get: function(...args) { if (!originalGetter) return undefined; - let result = originalGetter.apply(this, args); + let result = Cu.waiveXrays(originalGetter.apply(this, args)); if (self._recording) { let stack = getStack(name); diff --git a/toolkit/devtools/server/actors/webgl.js b/toolkit/devtools/server/actors/webgl.js index afeeb0d32d00..21e9165b08db 100644 --- a/toolkit/devtools/server/actors/webgl.js +++ b/toolkit/devtools/server/actors/webgl.js @@ -492,7 +492,9 @@ let WebGLInstrumenter = { if (glBreak) return undefined; } - let glResult = originalFunc.apply(this, glArgs); + // Invoking .apply on an unxrayed content function doesn't work, because + // the arguments array is inaccessible to it. Get Xrays back. + let glResult = Cu.waiveXrays(Cu.unwaiveXrays(originalFunc).apply(this, glArgs)); if (timing >= 0 && !observer.suppressHandlers) { let glBreak = observer[afterFuncName](glArgs, glResult, cache, proxy); From 224ca3b8ef75e53b59bf644c3c3d7a565023159a Mon Sep 17 00:00:00 2001 From: Bobby Holley Date: Wed, 1 Oct 2014 15:25:01 +0200 Subject: [PATCH 16/63] Bug 1065185 - Explicitly expose indexed properties in COW array test. r=bz --- js/xpconnect/tests/chrome/test_bug760109.xul | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/js/xpconnect/tests/chrome/test_bug760109.xul b/js/xpconnect/tests/chrome/test_bug760109.xul index d8045d464524..b71f094056c7 100644 --- a/js/xpconnect/tests/chrome/test_bug760109.xul +++ b/js/xpconnect/tests/chrome/test_bug760109.xul @@ -80,7 +80,11 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=760109 const Cu = Components.utils; var sb = new Cu.Sandbox('http://www.example.org'); sb.chromeArray = ['a', 'b', 'z']; - sb.chromeArray.__exposedProps__ = {}; + sb.chromeArray.__exposedProps__ = { length: 'rw' }; + for (var i = 0; i < 10; ++i) { + sb.chromeArray.__exposedProps__[i] = 'rw'; + } + sb.chromeObject = new SomeConstructor(); sb.ok = ok; sb.is = is; From 08fb1dfc9bb448bd3a6527174a047efd34f1a458 Mon Sep 17 00:00:00 2001 From: Bobby Holley Date: Wed, 1 Oct 2014 15:25:01 +0200 Subject: [PATCH 17/63] Bug 1065185 - Stop using Promise.jsm over SpecialPowers in marionette tests. r=bz --- dom/bluetooth/tests/marionette/head.js | 11 +++++++++-- dom/bluetooth2/tests/marionette/head.js | 11 +++++++++-- dom/cellbroadcast/tests/marionette/head.js | 10 +++++++++- dom/mobilemessage/tests/marionette/head.js | 10 +++++++++- dom/telephony/test/marionette/head.js | 11 ++++++++++- dom/tethering/tests/marionette/head.js | 11 +++++++++-- dom/voicemail/test/marionette/head.js | 10 +++++++++- dom/wifi/test/marionette/head.js | 10 +++++++++- 8 files changed, 73 insertions(+), 11 deletions(-) diff --git a/dom/bluetooth/tests/marionette/head.js b/dom/bluetooth/tests/marionette/head.js index 893ee78c060e..65fd7828a739 100644 --- a/dom/bluetooth/tests/marionette/head.js +++ b/dom/bluetooth/tests/marionette/head.js @@ -43,8 +43,15 @@ const BT_PAIRING_REQ = "bluetooth-pairing-request"; const BT_PAIRING_PASSKEY = 123456; const BT_PAIRING_PINCODE = "ABCDEFG"; -let Promise = - SpecialPowers.Cu.import("resource://gre/modules/Promise.jsm").Promise; +// Emulate Promise.jsm semantics. +Promise.defer = function() { return new Deferred(); } +function Deferred() { + this.promise = new Promise(function(resolve, reject) { + this.resolve = resolve; + this.reject = reject; + }.bind(this)); + Object.freeze(this); +} let bluetoothManager; diff --git a/dom/bluetooth2/tests/marionette/head.js b/dom/bluetooth2/tests/marionette/head.js index 07f456e6e8e3..ed5c5abe1693 100644 --- a/dom/bluetooth2/tests/marionette/head.js +++ b/dom/bluetooth2/tests/marionette/head.js @@ -36,8 +36,15 @@ const BDADDR_LOCAL = "ff:ff:ff:00:00:00"; // A user friendly name for remote BT device. const REMOTE_DEVICE_NAME = "Remote_BT_Device"; -let Promise = - SpecialPowers.Cu.import("resource://gre/modules/Promise.jsm").Promise; +// Emulate Promise.jsm semantics. +Promise.defer = function() { return new Deferred(); } +function Deferred() { + this.promise = new Promise(function(resolve, reject) { + this.resolve = resolve; + this.reject = reject; + }.bind(this)); + Object.freeze(this); +} let bluetoothManager; diff --git a/dom/cellbroadcast/tests/marionette/head.js b/dom/cellbroadcast/tests/marionette/head.js index 95d039cdbbdb..ed8de0446008 100644 --- a/dom/cellbroadcast/tests/marionette/head.js +++ b/dom/cellbroadcast/tests/marionette/head.js @@ -3,7 +3,15 @@ const {Cc: Cc, Ci: Ci, Cr: Cr, Cu: Cu} = SpecialPowers; -let Promise = Cu.import("resource://gre/modules/Promise.jsm").Promise; +// Emulate Promise.jsm semantics. +Promise.defer = function() { return new Deferred(); } +function Deferred() { + this.promise = new Promise(function(resolve, reject) { + this.resolve = resolve; + this.reject = reject; + }.bind(this)); + Object.freeze(this); +} const PDU_DCS_CODING_GROUP_BITS = 0xF0; const PDU_DCS_MSG_CODING_7BITS_ALPHABET = 0x00; diff --git a/dom/mobilemessage/tests/marionette/head.js b/dom/mobilemessage/tests/marionette/head.js index c78720415567..f4eb83882d41 100644 --- a/dom/mobilemessage/tests/marionette/head.js +++ b/dom/mobilemessage/tests/marionette/head.js @@ -3,7 +3,15 @@ const {Cc: Cc, Ci: Ci, Cr: Cr, Cu: Cu} = SpecialPowers; -let Promise = Cu.import("resource://gre/modules/Promise.jsm").Promise; +// Emulate Promise.jsm semantics. +Promise.defer = function() { return new Deferred(); } +function Deferred() { + this.promise = new Promise(function(resolve, reject) { + this.resolve = resolve; + this.reject = reject; + }.bind(this)); + Object.freeze(this); +} /** * Push a list of preference settings. Never reject. diff --git a/dom/telephony/test/marionette/head.js b/dom/telephony/test/marionette/head.js index 41481d7f1c0b..ea7ea2933ef6 100644 --- a/dom/telephony/test/marionette/head.js +++ b/dom/telephony/test/marionette/head.js @@ -1,7 +1,16 @@ /* Any copyright is dedicated to the Public Domain. * http://creativecommons.org/publicdomain/zero/1.0/ */ -let Promise = SpecialPowers.Cu.import("resource://gre/modules/Promise.jsm").Promise; +// Emulate Promise.jsm semantics. +Promise.defer = function() { return new Deferred(); } +function Deferred() { + this.promise = new Promise(function(resolve, reject) { + this.resolve = resolve; + this.reject = reject; + }.bind(this)); + Object.freeze(this); +} + let telephony; let conference; diff --git a/dom/tethering/tests/marionette/head.js b/dom/tethering/tests/marionette/head.js index 4e2c56808409..bd2731b64ec0 100644 --- a/dom/tethering/tests/marionette/head.js +++ b/dom/tethering/tests/marionette/head.js @@ -25,8 +25,15 @@ const TETHERING_SETTING_KEY = "1234567890"; const SETTINGS_RIL_DATA_ENABLED = 'ril.data.enabled'; -let Promise = - SpecialPowers.Cu.import("resource://gre/modules/Promise.jsm").Promise; +// Emulate Promise.jsm semantics. +Promise.defer = function() { return new Deferred(); } +function Deferred() { + this.promise = new Promise(function(resolve, reject) { + this.resolve = resolve; + this.reject = reject; + }.bind(this)); + Object.freeze(this); +} let gTestSuite = (function() { let suite = {}; diff --git a/dom/voicemail/test/marionette/head.js b/dom/voicemail/test/marionette/head.js index f3f8b1b17c74..b3d6041af26e 100644 --- a/dom/voicemail/test/marionette/head.js +++ b/dom/voicemail/test/marionette/head.js @@ -8,7 +8,15 @@ const {Cc: Cc, Ci: Ci, Cr: Cr, Cu: Cu} = SpecialPowers; let RIL = {}; Cu.import("resource://gre/modules/ril_consts.js", RIL); -let Promise = Cu.import("resource://gre/modules/Promise.jsm").Promise; +// Emulate Promise.jsm semantics. +Promise.defer = function() { return new Deferred(); } +function Deferred() { + this.promise = new Promise(function(resolve, reject) { + this.resolve = resolve; + this.reject = reject; + }.bind(this)); + Object.freeze(this); +} const MWI_PDU_PREFIX = "0000"; const MWI_PDU_UDH_PREFIX = "0040"; diff --git a/dom/wifi/test/marionette/head.js b/dom/wifi/test/marionette/head.js index c6981fd7181c..dd28995bae07 100644 --- a/dom/wifi/test/marionette/head.js +++ b/dom/wifi/test/marionette/head.js @@ -1,7 +1,15 @@ /* Any copyright is dedicated to the Public Domain. * http://creativecommons.org/publicdomain/zero/1.0/ */ -let Promise = SpecialPowers.Cu.import('resource://gre/modules/Promise.jsm').Promise; +// Emulate Promise.jsm semantics. +Promise.defer = function() { return new Deferred(); } +function Deferred() { + this.promise = new Promise(function(resolve, reject) { + this.resolve = resolve; + this.reject = reject; + }.bind(this)); + Object.freeze(this); +} const STOCK_HOSTAPD_NAME = 'goldfish-hostapd'; const HOSTAPD_CONFIG_PATH = '/data/misc/wifi/remote-hostapd/'; From af796350a0fdfc1441892adab8fc5738e4f43248 Mon Sep 17 00:00:00 2001 From: Bobby Holley Date: Wed, 1 Oct 2014 15:25:01 +0200 Subject: [PATCH 18/63] Bug 1065185 - Create a content Array rather than a chrome array when reading Icc contacts. r=hsinyi Right now, this array gets implicit __exposedProps__ for all of its indexed members (and .length). Instead, we should be creating the Array directly in the target Window. --- dom/system/gonk/RILContentHelper.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/dom/system/gonk/RILContentHelper.js b/dom/system/gonk/RILContentHelper.js index 0861ccbc7f54..e8524ba77657 100644 --- a/dom/system/gonk/RILContentHelper.js +++ b/dom/system/gonk/RILContentHelper.js @@ -799,7 +799,8 @@ RILContentHelper.prototype = { let window = this._windowsMap[message.requestId]; delete this._windowsMap[message.requestId]; let contacts = message.contacts; - let result = contacts.map(function(c) { + let result = new window.Array(); + contacts.forEach(function(c) { let prop = {name: [c.alphaId], tel: [{value: c.number}]}; if (c.email) { @@ -814,7 +815,7 @@ RILContentHelper.prototype = { let contact = new window.mozContact(prop); contact.id = c.contactId; - return contact; + result.push(contact); }); this.fireRequestSuccess(message.requestId, result); From 772919206ca89fa5c623af0f60e5051508f8cb73 Mon Sep 17 00:00:00 2001 From: Bobby Holley Date: Wed, 1 Oct 2014 15:25:01 +0200 Subject: [PATCH 19/63] Bug 1065185 - Create a content Array rather than a chrome Array in _convertWifiNetworks. r=chucklee --- dom/wifi/DOMWifiManager.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dom/wifi/DOMWifiManager.js b/dom/wifi/DOMWifiManager.js index e1a8f9b7cda0..300b06d1948c 100644 --- a/dom/wifi/DOMWifiManager.js +++ b/dom/wifi/DOMWifiManager.js @@ -160,7 +160,7 @@ DOMWifiManager.prototype = { }, _convertWifiNetworks: function(aNetworks) { - let networks = []; + let networks = new this._window.Array(); for (let i in aNetworks) { networks.push(this._convertWifiNetwork(aNetworks[i])); } From 4f51c3b48679d8dad0e6aabbb8d8cb2a9a766a1e Mon Sep 17 00:00:00 2001 From: Bobby Holley Date: Wed, 1 Oct 2014 15:25:01 +0200 Subject: [PATCH 20/63] Bug 1065185 - Do a better job of accessing privileged constants from voicemail marionette tests. r=bz --- dom/voicemail/test/marionette/head.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dom/voicemail/test/marionette/head.js b/dom/voicemail/test/marionette/head.js index b3d6041af26e..e9ba49a9f1e1 100644 --- a/dom/voicemail/test/marionette/head.js +++ b/dom/voicemail/test/marionette/head.js @@ -5,8 +5,8 @@ const {Cc: Cc, Ci: Ci, Cr: Cr, Cu: Cu} = SpecialPowers; -let RIL = {}; -Cu.import("resource://gre/modules/ril_consts.js", RIL); +let RIL = SpecialPowers.wrap(SpecialPowers.createBlankObject()); +SpecialPowers.Cu.import("resource://gre/modules/ril_consts.js", RIL); // Emulate Promise.jsm semantics. Promise.defer = function() { return new Deferred(); } From 16e0d8141442d3b1d4b5b60a9df45688d635bf03 Mon Sep 17 00:00:00 2001 From: Bobby Holley Date: Wed, 1 Oct 2014 15:25:02 +0200 Subject: [PATCH 21/63] Bug 1065185 - Turn off indexed/.length access on COW arrays. r=bz --- js/xpconnect/wrappers/AccessCheck.cpp | 8 -------- 1 file changed, 8 deletions(-) diff --git a/js/xpconnect/wrappers/AccessCheck.cpp b/js/xpconnect/wrappers/AccessCheck.cpp index b238dd217f6a..dcf9711d3417 100644 --- a/js/xpconnect/wrappers/AccessCheck.cpp +++ b/js/xpconnect/wrappers/AccessCheck.cpp @@ -248,14 +248,6 @@ ExposedPropertiesOnly::check(JSContext *cx, HandleObject wrapper, HandleId id, W if (!JS_HasPropertyById(cx, wrappedObject, exposedPropsId, &found)) return false; - // Always permit access to "length" and indexed properties of arrays. - if ((JS_IsArrayObject(cx, wrappedObject) || - JS_IsTypedArrayObject(wrappedObject)) && - ((JSID_IS_INT(id) && JSID_TO_INT(id) >= 0) || - (JSID_IS_STRING(id) && JS_FlatStringEqualsAscii(JSID_TO_FLAT_STRING(id), "length")))) { - return true; // Allow - } - // If no __exposedProps__ existed, deny access. if (!found) { return false; From 54f5d79815e7eaca0a180504a38bd737c42585bb Mon Sep 17 00:00:00 2001 From: Andrea Marchesini Date: Wed, 1 Oct 2014 14:55:33 +0100 Subject: [PATCH 22/63] Bug 1074963 - Constructor URLSearchParams() should preserve the order of pairs from passing argument, r=bz --- dom/base/URLSearchParams.cpp | 173 +++++++++++------------- dom/base/URLSearchParams.h | 16 +-- dom/base/test/test_urlSearchParams.html | 31 ++++- 3 files changed, 114 insertions(+), 106 deletions(-) diff --git a/dom/base/URLSearchParams.cpp b/dom/base/URLSearchParams.cpp index b9c30fe3f2b5..8115e8d3921f 100644 --- a/dom/base/URLSearchParams.cpp +++ b/dom/base/URLSearchParams.cpp @@ -51,7 +51,7 @@ URLSearchParams::Constructor(const GlobalObject& aGlobal, ErrorResult& aRv) { nsRefPtr sp = new URLSearchParams(); - aInit.mSearchParams.EnumerateRead(CopyEnumerator, sp); + sp->mSearchParams = aInit.mSearchParams; return sp.forget(); } @@ -207,20 +207,6 @@ URLSearchParams::ConvertString(const nsACString& aInput, nsAString& aOutput) } } -/* static */ PLDHashOperator -URLSearchParams::CopyEnumerator(const nsAString& aName, - nsTArray* aArray, - void *userData) -{ - URLSearchParams* aSearchParams = static_cast(userData); - - nsTArray* newArray = new nsTArray(); - newArray->AppendElements(*aArray); - - aSearchParams->mSearchParams.Put(aName, newArray); - return PL_DHASH_NEXT; -} - void URLSearchParams::AddObserver(URLSearchParamsObserver* aObserver) { @@ -245,38 +231,46 @@ URLSearchParams::RemoveObservers() void URLSearchParams::Get(const nsAString& aName, nsString& aRetval) { - nsTArray* array; - if (!mSearchParams.Get(aName, &array)) { - aRetval.Truncate(); - return; - } + aRetval.Truncate(); - aRetval.Assign(array->ElementAt(0)); + for (uint32_t i = 0, len = mSearchParams.Length(); i < len; ++i) { + if (mSearchParams[i].mKey.Equals(aName)) { + aRetval.Assign(mSearchParams[i].mValue); + break; + } + } } void URLSearchParams::GetAll(const nsAString& aName, nsTArray& aRetval) { - nsTArray* array; - if (!mSearchParams.Get(aName, &array)) { - return; - } + aRetval.Clear(); - aRetval.AppendElements(*array); + for (uint32_t i = 0, len = mSearchParams.Length(); i < len; ++i) { + if (mSearchParams[i].mKey.Equals(aName)) { + aRetval.AppendElement(mSearchParams[i].mValue); + } + } } void URLSearchParams::Set(const nsAString& aName, const nsAString& aValue) { - nsTArray* array; - if (!mSearchParams.Get(aName, &array)) { - array = new nsTArray(); - array->AppendElement(aValue); - mSearchParams.Put(aName, array); - } else { - array->ElementAt(0) = aValue; + Param* param = nullptr; + for (uint32_t i = 0, len = mSearchParams.Length(); i < len; ++i) { + if (mSearchParams[i].mKey.Equals(aName)) { + param = &mSearchParams[i]; + break; + } } + if (!param) { + param = mSearchParams.AppendElement(); + param->mKey = aName; + } + + param->mValue = aValue; + NotifyObservers(nullptr); } @@ -290,32 +284,39 @@ URLSearchParams::Append(const nsAString& aName, const nsAString& aValue) void URLSearchParams::AppendInternal(const nsAString& aName, const nsAString& aValue) { - nsTArray* array; - if (!mSearchParams.Get(aName, &array)) { - array = new nsTArray(); - mSearchParams.Put(aName, array); - } - - array->AppendElement(aValue); + Param* param = mSearchParams.AppendElement(); + param->mKey = aName; + param->mValue = aValue; } bool URLSearchParams::Has(const nsAString& aName) { - return mSearchParams.Get(aName, nullptr); + for (uint32_t i = 0, len = mSearchParams.Length(); i < len; ++i) { + if (mSearchParams[i].mKey.Equals(aName)) { + return true; + } + } + + return false; } void URLSearchParams::Delete(const nsAString& aName) { - nsTArray* array; - if (!mSearchParams.Get(aName, &array)) { - return; + bool found = false; + for (uint32_t i = 0; i < mSearchParams.Length();) { + if (mSearchParams[i].mKey.Equals(aName)) { + mSearchParams.RemoveElementAt(i); + found = true; + } else { + ++i; + } } - mSearchParams.Remove(aName); - - NotifyObservers(nullptr); + if (found) { + NotifyObservers(nullptr); + } } void @@ -324,67 +325,49 @@ URLSearchParams::DeleteAll() mSearchParams.Clear(); } -class MOZ_STACK_CLASS SerializeData +namespace { + +void SerializeString(const nsCString& aInput, nsAString& aValue) { -public: - SerializeData() - : mFirst(true) - {} + const unsigned char* p = (const unsigned char*) aInput.get(); - nsAutoString mValue; - bool mFirst; - - void Serialize(const nsCString& aInput) - { - const unsigned char* p = (const unsigned char*) aInput.get(); - - while (p && *p) { - // ' ' to '+' - if (*p == 0x20) { - mValue.Append(0x2B); - // Percent Encode algorithm - } else if (*p == 0x2A || *p == 0x2D || *p == 0x2E || - (*p >= 0x30 && *p <= 0x39) || - (*p >= 0x41 && *p <= 0x5A) || *p == 0x5F || - (*p >= 0x61 && *p <= 0x7A)) { - mValue.Append(*p); - } else { - mValue.AppendPrintf("%%%.2X", *p); - } - - ++p; + while (p && *p) { + // ' ' to '+' + if (*p == 0x20) { + aValue.Append(0x2B); + // Percent Encode algorithm + } else if (*p == 0x2A || *p == 0x2D || *p == 0x2E || + (*p >= 0x30 && *p <= 0x39) || + (*p >= 0x41 && *p <= 0x5A) || *p == 0x5F || + (*p >= 0x61 && *p <= 0x7A)) { + aValue.Append(*p); + } else { + aValue.AppendPrintf("%%%.2X", *p); } + + ++p; } -}; +} + +} // anonymous namespace void URLSearchParams::Serialize(nsAString& aValue) const { - SerializeData data; - mSearchParams.EnumerateRead(SerializeEnumerator, &data); - aValue.Assign(data.mValue); -} + aValue.Truncate(); + bool first = true; -/* static */ PLDHashOperator -URLSearchParams::SerializeEnumerator(const nsAString& aName, - nsTArray* aArray, - void *userData) -{ - SerializeData* data = static_cast(userData); - - for (uint32_t i = 0, len = aArray->Length(); i < len; ++i) { - if (data->mFirst) { - data->mFirst = false; + for (uint32_t i = 0, len = mSearchParams.Length(); i < len; ++i) { + if (first) { + first = false; } else { - data->mValue.Append('&'); + aValue.Append('&'); } - data->Serialize(NS_ConvertUTF16toUTF8(aName)); - data->mValue.Append('='); - data->Serialize(NS_ConvertUTF16toUTF8(aArray->ElementAt(i))); + SerializeString(NS_ConvertUTF16toUTF8(mSearchParams[i].mKey), aValue); + aValue.Append('='); + SerializeString(NS_ConvertUTF16toUTF8(mSearchParams[i].mValue), aValue); } - - return PL_DHASH_NEXT; } void diff --git a/dom/base/URLSearchParams.h b/dom/base/URLSearchParams.h index e141f53ddd2a..1fab838b4790 100644 --- a/dom/base/URLSearchParams.h +++ b/dom/base/URLSearchParams.h @@ -10,8 +10,6 @@ #include "mozilla/ErrorResult.h" #include "nsCycleCollectionParticipant.h" #include "nsWrapperCache.h" -#include "nsClassHashtable.h" -#include "nsHashKeys.h" #include "nsISupports.h" #include "nsIUnicodeDecoder.h" @@ -92,15 +90,13 @@ private: void NotifyObservers(URLSearchParamsObserver* aExceptObserver); - static PLDHashOperator - CopyEnumerator(const nsAString& aName, nsTArray* aArray, - void *userData); + struct Param + { + nsString mKey; + nsString mValue; + }; - static PLDHashOperator - SerializeEnumerator(const nsAString& aName, nsTArray* aArray, - void *userData); - - nsClassHashtable> mSearchParams; + nsTArray mSearchParams; nsTArray> mObservers; nsCOMPtr mDecoder; diff --git a/dom/base/test/test_urlSearchParams.html b/dom/base/test/test_urlSearchParams.html index be9e289c6eb2..c0761504a470 100644 --- a/dom/base/test/test_urlSearchParams.html +++ b/dom/base/test/test_urlSearchParams.html @@ -248,6 +248,33 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=887836 runTest(); } + function testOrdering() { + var a = new URLSearchParams("a=1&a=2&b=3&c=4&c=5&a=6"); + is(a.toString(), "a=1&a=2&b=3&c=4&c=5&a=6", "Order is correct"); + is(a.getAll('a').length, 3, "Correct length of getAll()"); + + var b = new URLSearchParams(); + b.append('a', '1'); + b.append('b', '2'); + b.append('a', '3'); + is(b.toString(), "a=1&b=2&a=3", "Order is correct"); + is(b.getAll('a').length, 2, "Correct length of getAll()"); + + runTest(); + } + + function testDelete() { + var a = new URLSearchParams("a=1&a=2&b=3&c=4&c=5&a=6"); + is(a.toString(), "a=1&a=2&b=3&c=4&c=5&a=6", "Order is correct"); + is(a.getAll('a').length, 3, "Correct length of getAll()"); + + a.delete('a'); + is(a.getAll('a').length, 0, "Correct length of getAll()"); + is(a.toString(), "b=3&c=4&c=5", "Order is correct"); + + runTest(); + } + var tests = [ testSimpleURLSearchParams, testCopyURLSearchParams, @@ -256,7 +283,9 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=887836 function() { testElement(document.getElementById('anchor')) }, function() { testElement(document.getElementById('area')) }, testEncoding, - testMultiURL + testMultiURL, + testOrdering, + testDelete ]; function runTest() { From eacbaf0a377cb8b1eafdac30c99cc04188158ed9 Mon Sep 17 00:00:00 2001 From: Sotaro Ikeda Date: Wed, 1 Oct 2014 07:16:32 -0700 Subject: [PATCH 23/63] Bug 1075136 - Initialize TileClient::mCompositableClient correctly r=nical --- gfx/layers/client/TiledContentClient.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gfx/layers/client/TiledContentClient.cpp b/gfx/layers/client/TiledContentClient.cpp index f622ca8d9d4f..bb17adf6d232 100644 --- a/gfx/layers/client/TiledContentClient.cpp +++ b/gfx/layers/client/TiledContentClient.cpp @@ -512,7 +512,7 @@ TileClient::TileClient(const TileClient& o) mFrontBufferOnWhite = o.mFrontBufferOnWhite; mBackLock = o.mBackLock; mFrontLock = o.mFrontLock; - mCompositableClient = nullptr; + mCompositableClient = o.mCompositableClient; #ifdef GFX_TILEDLAYER_DEBUG_OVERLAY mLastUpdate = o.mLastUpdate; #endif @@ -531,7 +531,7 @@ TileClient::operator=(const TileClient& o) mFrontBufferOnWhite = o.mFrontBufferOnWhite; mBackLock = o.mBackLock; mFrontLock = o.mFrontLock; - mCompositableClient = nullptr; + mCompositableClient = o.mCompositableClient; #ifdef GFX_TILEDLAYER_DEBUG_OVERLAY mLastUpdate = o.mLastUpdate; #endif From f79507ab2f8979fc267a293dd808409f2898a8bb Mon Sep 17 00:00:00 2001 From: Christoph Kerschbaumer Date: Wed, 13 Aug 2014 21:40:36 -0700 Subject: [PATCH 24/63] Bug 1000945 - CSP: Remove unused strings from csp.properties (r=sstamm) --- .../en-US/chrome/security/csp.properties | 60 ------------------- 1 file changed, 60 deletions(-) diff --git a/dom/locales/en-US/chrome/security/csp.properties b/dom/locales/en-US/chrome/security/csp.properties index 7ac1cbf2983f..35800705053a 100644 --- a/dom/locales/en-US/chrome/security/csp.properties +++ b/dom/locales/en-US/chrome/security/csp.properties @@ -20,9 +20,6 @@ CSPROViolationWithURI = The page's settings observed the loading of a resource a # LOCALIZATION NOTE (triedToSendReport): # %1$S is the URI we attempted to send a report to. triedToSendReport = Tried to send report to invalid URI: "%1$S" -# LOCALIZATION NOTE (errorWas): -# %1$S is the error resulting from attempting to send the report -errorWas = error was: "%1$S" # LOCALIZATION NOTE (couldNotParseReportURI): # %1$S is the report URI that could not be parsed couldNotParseReportURI = couldn't parse report URI: %1$S @@ -38,21 +35,9 @@ reportURInotHttpsOrHttp2 = The report URI (%1$S) should be an HTTP or HTTPS URI. # LOCALIZATION NOTE (reportURInotInReportOnlyHeader): # %1$S is the ETLD of the page with the policy reportURInotInReportOnlyHeader = This site (%1$S) has a Report-Only policy without a report URI. CSP will not block and cannot report violations of this policy. -# LOCALIZATION NOTE (pageCannotSendReportsTo): -# %1$S is the URI of the page with the policy -# %2$S is the report URI that could not be used -pageCannotSendReportsTo = page on %1$S cannot send reports to %2$S -allowOrDefaultSrcRequired = 'allow' or 'default-src' directive required but not present. Reverting to "default-src 'none'" # LOCALIZATION NOTE (failedToParseUnrecognizedSource): # %1$S is the CSP Source that could not be parsed failedToParseUnrecognizedSource = Failed to parse unrecognized source %1$S -# LOCALIZATION NOTE (reportPostRedirect): -# %1$S is the specified report URI before redirect -reportPostRedirect = Post of violation report to %1$S failed, as a redirect occurred -# LOCALIZATION NOTE (allowDirectiveIsDeprecated): -# Don't translate "allow" and "default-src" as they are keywords and part of -# the CSP protocol syntax. -allowDirectiveIsDeprecated = allow directive is deprecated, use the equivalent default-src directive instead # LOCALIZATION NOTE (inlineScriptBlocked): # inline script refers to JavaScript code that is embedded into the HTML document. inlineScriptBlocked = An attempt to execute inline scripts has been blocked @@ -70,39 +55,9 @@ hostNameMightBeKeyword = Interpreting %1$S as a hostname, not a keyword. If you notSupportingDirective = Not supporting directive '%1$S'. Directive and values will be ignored. # CSP Errors: -policyURINotAlone = policy-uri directive can only appear alone -noParentRequest = The policy-uri cannot be fetched without a parent request and a CSP. -# LOCALIZATION NOTE (policyURIParseError): -# %1$S is the URI that could not be parsed -policyURIParseError = could not parse URI in policy URI: %1$S -# LOCALIZATION NOTE (nonMatchingHost): -# %1$S is the URI host that does not match -nonMatchingHost = can't fetch policy uri from non-matching hostname: %1$S -# LOCALIZATION NOTE (nonMatchingPort): -# %1$S is the URI port that does not match -nonMatchingPort = can't fetch policy uri from non-matching port: %1$S -# LOCALIZATION NOTE (nonMatchingScheme): -# %1$S is the URI scheme that does not match -nonMatchingScheme = can't fetch policy uri from non-matching scheme: %1$S -# LOCALIZATION NOTE (errorFetchingPolicy): -# %1$S is the error that caused fetching to fail -errorFetchingPolicy = Error fetching policy-uri: %1$S -cspSourceNotURI = Provided argument is not an nsIURI -argumentIsNotString = Provided argument is not a string -selfDataNotProvided = Can't use 'self' if self data is not provided -# LOCALIZATION NOTE (uriWithoutScheme): -# %1$S is the URI without a scheme -uriWithoutScheme = can't parse a URI without a scheme: %1$S -selfKeywordNoSelfData = self keyword used, but no self data specified # LOCALIZATION NOTE (couldntParseInvalidSource): # %1$S is the source that could not be parsed couldntParseInvalidSource = Couldn't parse invalid source %1$S -# LOCALIZATION NOTE (hostSourceWithoutData): -# %1$S is the source -hostSourceWithoutData = Can't create host-only source %1$S without 'self' data -# LOCALIZATION NOTE (sourceWithoutData): -# %1$S is the source -sourceWithoutData = Can't create source %1$S without 'self' data # LOCALIZATION NOTE (couldntParseInvalidHost): # %1$S is the host that's invalid couldntParseInvalidHost = Couldn't parse invalid host %1$S @@ -112,21 +67,6 @@ couldntParseScheme = Couldn't parse scheme in %1$S # LOCALIZATION NOTE (couldntParsePort): # %1$S is the string source couldntParsePort = Couldn't parse port in %1$S -# LOCALIZATION NOTE (notIntersectPort): -# %1$S is one source we tried to intersect -# %2$S is the other -notIntersectPort = Could not intersect %1$S with %2$S due to port problems. -# LOCALIZATION NOTE (notIntersectScheme): -# %1$S is one source we tried to intersect -# %2$S is the other -notIntersectScheme = Could not intersect %1$S with %2$S due to scheme problems. -# LOCALIZATION NOTE (intersectingSourceWithUndefinedHost): -# %1$S is the source -intersectingSourceWithUndefinedHost = intersecting source with undefined host: %1$S -# LOCALIZATION NOTE (intersectingSourcesWithUndefinedHosts): -# %1$S is the first source -# %2$S is the second source -intersectingSourcesWithUndefinedHosts = intersecting two sources with undefined hosts: %1$S and %2$S # LOCALIZATION NOTE (duplicateDirective): # %1$S is the name of the duplicate directive duplicateDirective = Duplicate %1$S directives detected. All but the first instance will be ignored. From 6e36377de26e646827f27d5d8eea0a699c495938 Mon Sep 17 00:00:00 2001 From: Christoph Kerschbaumer Date: Sun, 21 Sep 2014 09:13:54 -0700 Subject: [PATCH 25/63] Bug 1070732 - CSP: log warning if csp-report is not sent using http or https (r=sstamm) --- content/base/src/nsCSPContext.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/content/base/src/nsCSPContext.cpp b/content/base/src/nsCSPContext.cpp index ed398ecad711..ccbb2fdd8464 100644 --- a/content/base/src/nsCSPContext.cpp +++ b/content/base/src/nsCSPContext.cpp @@ -692,6 +692,19 @@ nsCSPContext::SendReports(nsISupports* aBlockedContentSource, continue; // don't return yet, there may be more URIs } + // log a warning to console if scheme is not http or https + bool isHttpScheme = + (NS_SUCCEEDED(reportURI->SchemeIs("http", &isHttpScheme)) && isHttpScheme) || + (NS_SUCCEEDED(reportURI->SchemeIs("https", &isHttpScheme)) && isHttpScheme); + + if (!isHttpScheme) { + const char16_t* params[] = { reportURIs[r].get() }; + CSP_LogLocalizedStr(NS_LITERAL_STRING("reportURInotHttpsOrHttp2").get(), + params, ArrayLength(params), + aSourceFile, aScriptSample, aLineNum, 0, + nsIScriptError::errorFlag, "CSP", mInnerWindowID); + } + // make sure this is an anonymous request (no cookies) so in case the // policy URI is injected, it can't be abused for CSRF. nsLoadFlags flags; From 73c841fc10876589dcaed31f929dc7c6b9e0d873 Mon Sep 17 00:00:00 2001 From: mycoolclub Date: Wed, 1 Oct 2014 02:38:00 +0200 Subject: [PATCH 26/63] Bug 506815 - Replace old MouseTrailer code with TrackMouseEvent api. r=jimm --- widget/windows/nsToolkit.cpp | 128 ----------------------------------- widget/windows/nsToolkit.h | 37 ---------- widget/windows/nsWindow.cpp | 33 +++------ 3 files changed, 8 insertions(+), 190 deletions(-) diff --git a/widget/windows/nsToolkit.cpp b/widget/windows/nsToolkit.cpp index 5a3449be9ee3..933c5aec2aa2 100644 --- a/widget/windows/nsToolkit.cpp +++ b/widget/windows/nsToolkit.cpp @@ -33,8 +33,6 @@ StartAllowingD3D9(nsITimer *aTimer, void *aClosure) } } -MouseTrailer* nsToolkit::gMouseTrailer; - //------------------------------------------------------------------------- // // constructor @@ -48,8 +46,6 @@ nsToolkit::nsToolkit() nsToolkit::Startup(GetModuleHandle(nullptr)); #endif - gMouseTrailer = &mMouseTrailer; - if (XRE_GetWindowsEnvironment() == WindowsEnvironmentType_Desktop) { mD3D9Timer = do_CreateInstance("@mozilla.org/timer;1"); mD3D9Timer->InitWithFuncCallback(::StartAllowingD3D9, @@ -68,7 +64,6 @@ nsToolkit::nsToolkit() nsToolkit::~nsToolkit() { MOZ_COUNT_DTOR(nsToolkit); - gMouseTrailer = nullptr; } void @@ -110,126 +105,3 @@ nsToolkit* nsToolkit::GetToolkit() return gToolkit; } - - -//------------------------------------------------------------------------- -// -// -//------------------------------------------------------------------------- -MouseTrailer::MouseTrailer() : mMouseTrailerWindow(nullptr), mCaptureWindow(nullptr), - mIsInCaptureMode(false), mEnabled(true) -{ -} -//------------------------------------------------------------------------- -// -// -//------------------------------------------------------------------------- -MouseTrailer::~MouseTrailer() -{ - DestroyTimer(); -} -//------------------------------------------------------------------------- -// -// -//------------------------------------------------------------------------- -void MouseTrailer::SetMouseTrailerWindow(HWND aWnd) -{ - if (mMouseTrailerWindow != aWnd && mTimer) { - // Make sure TimerProc is fired at least once for the old window - TimerProc(nullptr, nullptr); - } - mMouseTrailerWindow = aWnd; - CreateTimer(); -} - -//------------------------------------------------------------------------- -// -// -//------------------------------------------------------------------------- -void MouseTrailer::SetCaptureWindow(HWND aWnd) -{ - mCaptureWindow = aWnd; - if (mCaptureWindow) { - mIsInCaptureMode = true; - } -} - -//------------------------------------------------------------------------- -// -// -//------------------------------------------------------------------------- -nsresult MouseTrailer::CreateTimer() -{ - if (mTimer || !mEnabled) { - return NS_OK; - } - - nsresult rv; - mTimer = do_CreateInstance("@mozilla.org/timer;1", &rv); - NS_ENSURE_SUCCESS(rv, rv); - - return mTimer->InitWithFuncCallback(TimerProc, nullptr, 200, - nsITimer::TYPE_REPEATING_SLACK); -} - -//------------------------------------------------------------------------- -// -// -//------------------------------------------------------------------------- -void MouseTrailer::DestroyTimer() -{ - if (mTimer) { - mTimer->Cancel(); - mTimer = nullptr; - } -} - -//------------------------------------------------------------------------- -// -// -//------------------------------------------------------------------------- -void MouseTrailer::TimerProc(nsITimer* aTimer, void* aClosure) -{ - MouseTrailer *mtrailer = nsToolkit::gMouseTrailer; - NS_ASSERTION(mtrailer, "MouseTrailer still firing after deletion!"); - - // Check to see if we are in mouse capture mode, - // Once capture ends we could still get back one more timer event. - // Capture could end outside our window. - // Also, for some reason when the mouse is on the frame it thinks that - // it is inside the window that is being captured. - if (mtrailer->mCaptureWindow) { - if (mtrailer->mCaptureWindow != mtrailer->mMouseTrailerWindow) { - return; - } - } else { - if (mtrailer->mIsInCaptureMode) { - // mMouseTrailerWindow could be bad from rolling over the frame, so clear - // it if we were capturing and now this is the first timer callback - // since we canceled the capture - mtrailer->mMouseTrailerWindow = nullptr; - mtrailer->mIsInCaptureMode = false; - return; - } - } - - if (mtrailer->mMouseTrailerWindow && ::IsWindow(mtrailer->mMouseTrailerWindow)) { - POINT mp; - DWORD pos = ::GetMessagePos(); - mp.x = GET_X_LPARAM(pos); - mp.y = GET_Y_LPARAM(pos); - HWND mouseWnd = ::WindowFromPoint(mp); - if (mtrailer->mMouseTrailerWindow != mouseWnd) { - // Notify someone that a mouse exit happened. - PostMessage(mtrailer->mMouseTrailerWindow, WM_MOUSELEAVE, 0, 0); - - // we are out of this window, destroy timer - mtrailer->DestroyTimer(); - mtrailer->mMouseTrailerWindow = nullptr; - } - } else { - mtrailer->DestroyTimer(); - mtrailer->mMouseTrailerWindow = nullptr; - } -} - diff --git a/widget/windows/nsToolkit.h b/widget/windows/nsToolkit.h index 5a983bd5316e..5f7d7fc5b25f 100644 --- a/widget/windows/nsToolkit.h +++ b/widget/windows/nsToolkit.h @@ -20,41 +20,6 @@ #define GET_Y_LPARAM(pt) (short(HIWORD(pt))) #endif -/** - * Makes sure exit/enter mouse messages are always dispatched. - * In the case where the mouse has exited the outer most window the - * only way to tell if it has exited is to set a timer and look at the - * mouse pointer to see if it is within the outer most window. - */ - -class MouseTrailer -{ -public: - HWND GetMouseTrailerWindow() { return mMouseTrailerWindow; } - HWND GetCaptureWindow() { return mCaptureWindow; } - - void SetMouseTrailerWindow(HWND aWnd); - void SetCaptureWindow(HWND aWnd); - void Disable() { mEnabled = false; DestroyTimer(); } - void Enable() { mEnabled = true; CreateTimer(); } - void DestroyTimer(); - - MouseTrailer(); - ~MouseTrailer(); -private: - - nsresult CreateTimer(); - - static void TimerProc(nsITimer* aTimer, void* aClosure); - - // Information for mouse enter/exit events - HWND mMouseTrailerWindow; - HWND mCaptureWindow; - bool mIsInCaptureMode; - bool mEnabled; - nsCOMPtr mTimer; -}; - /** * Wrapper around the thread running the message pump. * The toolkit abstraction is necessary because the message pump must @@ -73,7 +38,6 @@ public: static nsToolkit* GetToolkit(); static HINSTANCE mDllInstance; - static MouseTrailer *gMouseTrailer; static void Startup(HMODULE hModule); static void Shutdown(); @@ -83,7 +47,6 @@ protected: static nsToolkit* gToolkit; nsCOMPtr mD3D9Timer; - MouseTrailer mMouseTrailer; }; #endif // TOOLKIT_H diff --git a/widget/windows/nsWindow.cpp b/widget/windows/nsWindow.cpp index a1a6b90eaa5a..27d24862b0ca 100644 --- a/widget/windows/nsWindow.cpp +++ b/widget/windows/nsWindow.cpp @@ -3126,19 +3126,20 @@ NS_METHOD nsWindow::EnableDragDrop(bool aEnable) NS_METHOD nsWindow::CaptureMouse(bool aCapture) { - if (!nsToolkit::gMouseTrailer) { - NS_ERROR("nsWindow::CaptureMouse called after nsToolkit destroyed"); - return NS_OK; - } - + TRACKMOUSEEVENT mTrack; + mTrack.cbSize = sizeof(TRACKMOUSEEVENT); + mTrack.dwFlags = TME_LEAVE; + mTrack.dwHoverTime = 0; if (aCapture) { - nsToolkit::gMouseTrailer->SetCaptureWindow(mWnd); + mTrack.hwndTrack = mWnd; ::SetCapture(mWnd); } else { - nsToolkit::gMouseTrailer->SetCaptureWindow(nullptr); + mTrack.hwndTrack = nullptr; ::ReleaseCapture(); } sIsInMouseCapture = aCapture; + // Requests WM_MOUSELEAVE events for this window. + TrackMouseEvent(&mTrack); return NS_OK; } @@ -4004,12 +4005,7 @@ bool nsWindow::DispatchMouseEvent(uint32_t aEventType, WPARAM wParam, // call the event callback if (mWidgetListener) { - if (nsToolkit::gMouseTrailer) - nsToolkit::gMouseTrailer->Disable(); if (aEventType == NS_MOUSE_MOVE) { - if (nsToolkit::gMouseTrailer && !sIsInMouseCapture) { - nsToolkit::gMouseTrailer->SetMouseTrailerWindow(mWnd); - } nsIntRect rect; GetBounds(rect); rect.x = 0; @@ -4040,9 +4036,6 @@ bool nsWindow::DispatchMouseEvent(uint32_t aEventType, WPARAM wParam, result = DispatchWindowEvent(&event); - if (nsToolkit::gMouseTrailer) - nsToolkit::gMouseTrailer->Enable(); - // Release the widget with NS_IF_RELEASE() just in case // the context menu key code in EventListenerManager::HandleEvent() // released it already. @@ -6608,16 +6601,6 @@ void nsWindow::OnDestroy() IMEHandler::OnDestroyWindow(this); - // Turn off mouse trails if enabled. - MouseTrailer* mtrailer = nsToolkit::gMouseTrailer; - if (mtrailer) { - if (mtrailer->GetMouseTrailerWindow() == mWnd) - mtrailer->DestroyTimer(); - - if (mtrailer->GetCaptureWindow() == mWnd) - mtrailer->SetCaptureWindow(nullptr); - } - // Free GDI window class objects if (mBrush) { VERIFY(::DeleteObject(mBrush)); From 9ff43809eb2309b6458f4224ebe9fda4a838fdd6 Mon Sep 17 00:00:00 2001 From: Mike Quested Date: Wed, 1 Oct 2014 04:09:00 +0200 Subject: [PATCH 27/63] Bug 847072 - Regex test for Java plugin name, output "Java" instead of whole version string. r=mconley --- browser/modules/PluginContent.jsm | 3 +++ 1 file changed, 3 insertions(+) diff --git a/browser/modules/PluginContent.jsm b/browser/modules/PluginContent.jsm index 49c70e116367..efe7f91001cc 100644 --- a/browser/modules/PluginContent.jsm +++ b/browser/modules/PluginContent.jsm @@ -146,6 +146,9 @@ PluginContent.prototype = { makeNicePluginName : function (aName) { if (aName == "Shockwave Flash") return "Adobe Flash"; + // Regex checks if aName begins with "Java" + non-letter char + if (/^Java\W/.exec(aName)) + return "Java"; // Clean up the plugin name by stripping off parenthetical clauses, // trailing version numbers or "plugin". From 3716a62cd832b0f1417051f36eb3debb212b7ea6 Mon Sep 17 00:00:00 2001 From: James Long Date: Tue, 30 Sep 2014 10:03:00 +0200 Subject: [PATCH 28/63] Date: Fri Sep 26 11:30:08 2014 -0400 Bug 1056409 - move the sourceMapURL property to the Debugger.Source object. r=jorendorff --- content/base/test/chrome/test_bug765993.html | 2 +- js/src/doc/Debugger/Debugger.Script.md | 11 ----- js/src/doc/Debugger/Debugger.Source.md | 11 +++++ .../jit-test/tests/debug/Source-displayURL.js | 4 +- ...d.js => Source-sourceMapURL-deprecated.js} | 6 +-- ...sourceMapURL.js => Source-sourceMapURL.js} | 6 +-- js/src/vm/Debugger.cpp | 40 +++++++++---------- toolkit/devtools/server/actors/script.js | 6 +-- 8 files changed, 42 insertions(+), 44 deletions(-) rename js/src/jit-test/tests/debug/{Script-sourceMapURL-deprecated.js => Source-sourceMapURL-deprecated.js} (92%) rename js/src/jit-test/tests/debug/{Script-sourceMapURL.js => Source-sourceMapURL.js} (92%) diff --git a/content/base/test/chrome/test_bug765993.html b/content/base/test/chrome/test_bug765993.html index 650b1bee1656..26c39d0f2c38 100644 --- a/content/base/test/chrome/test_bug765993.html +++ b/content/base/test/chrome/test_bug765993.html @@ -46,7 +46,7 @@ window.onload = function () { }); ok(scripts.length > 0, "Should be able to find script"); - is(scripts[0].sourceMapURL, "foo.js.map"); + is(scripts[0].source.sourceMapURL, "foo.js.map"); SimpleTest.finish(); } diff --git a/js/src/doc/Debugger/Debugger.Script.md b/js/src/doc/Debugger/Debugger.Script.md index b0bd786c51f2..80ac2fd009a2 100644 --- a/js/src/doc/Debugger/Debugger.Script.md +++ b/js/src/doc/Debugger/Debugger.Script.md @@ -115,17 +115,6 @@ from its prototype: : This is `true` if this script's code is ECMAScript strict mode code, and `false` otherwise. -`sourceMapURL` -: If this script was produced by a minimizer or translated from some other - language, and we know the URL of a source map document relating - the source positions in this script to the corresponding source - positions in the original source, then this property's value is that - URL. Otherwise, this is `null`. - - (On the web, the translator may provide the source map URL in a - specially formatted comment in the JavaScript source code, or via a - header in the HTTP reply that carried the generated JavaScript.) - ## Function Properties of the Debugger.Script Prototype Object The functions described below may only be called with a `this` value diff --git a/js/src/doc/Debugger/Debugger.Source.md b/js/src/doc/Debugger/Debugger.Source.md index 70e80ffd4429..91e6a4ae31bb 100644 --- a/js/src/doc/Debugger/Debugger.Source.md +++ b/js/src/doc/Debugger/Debugger.Source.md @@ -74,6 +74,17 @@ from its prototype: `url` accessor on `Debugger.Source` instances for such sources should return `undefined`.) +`sourceMapURL` +: If this source was produced by a minimizer or translated from some other + language, and we know the URL of a source map document relating + the source positions in this source to the corresponding source + positions in the original source, then this property's value is that + URL. Otherwise, this is `null`. + + (On the web, the translator may provide the source map URL in a + specially formatted comment in the JavaScript source code, or via a + header in the HTTP reply that carried the generated JavaScript.) + `element` : The [`Debugger.Object`][object] instance referring to the DOM element to which this source code belongs, if any, or `undefined` if it belongs to no DOM diff --git a/js/src/jit-test/tests/debug/Source-displayURL.js b/js/src/jit-test/tests/debug/Source-displayURL.js index 51536d813889..a16a761860a4 100644 --- a/js/src/jit-test/tests/debug/Source-displayURL.js +++ b/js/src/jit-test/tests/debug/Source-displayURL.js @@ -78,7 +78,7 @@ var capturedSourceMapURL; dbg.onNewScript = function (script) { capturedScript = script; capturedDisplayURL = script.source.displayURL; - capturedSourceMapURL = script.sourceMapURL; + capturedSourceMapURL = script.source.sourceMapURL; dbg.onNewScript = undefined; }; var fun = gw.makeDebuggeeValue(g.Function('//# sourceURL=munge.js\n//# sourceMappingURL=grunge.map\n')); @@ -87,5 +87,5 @@ assertEq(capturedScript, fun.script); assertEq(capturedDisplayURL, fun.script.source.displayURL); assertEq(capturedDisplayURL, 'munge.js'); -assertEq(capturedSourceMapURL, fun.script.sourceMapURL); +assertEq(capturedSourceMapURL, fun.script.source.sourceMapURL); assertEq(capturedSourceMapURL, 'grunge.map'); diff --git a/js/src/jit-test/tests/debug/Script-sourceMapURL-deprecated.js b/js/src/jit-test/tests/debug/Source-sourceMapURL-deprecated.js similarity index 92% rename from js/src/jit-test/tests/debug/Script-sourceMapURL-deprecated.js rename to js/src/jit-test/tests/debug/Source-sourceMapURL-deprecated.js index 7e9e59971f43..fb01ccb0a67b 100644 --- a/js/src/jit-test/tests/debug/Script-sourceMapURL-deprecated.js +++ b/js/src/jit-test/tests/debug/Source-sourceMapURL-deprecated.js @@ -1,4 +1,4 @@ -// Script.prototype.sourceMapURL can be a string or null. +// Source.prototype.sourceMapURL can be a string or null. let g = newGlobal(); let dbg = new Debugger; @@ -6,7 +6,7 @@ let gw = dbg.addDebuggee(g); function getSourceMapURL() { let fw = gw.makeDebuggeeValue(g.f); - return fw.script.sourceMapURL; + return fw.script.source.sourceMapURL; } // Without a source map @@ -21,7 +21,7 @@ assertEq(getSourceMapURL(), 'file:///var/foo.js.map'); let fired = false; dbg.onDebuggerStatement = function (frame) { fired = true; - assertEq(frame.script.sourceMapURL, 'file:///var/bar.js.map'); + assertEq(frame.script.source.sourceMapURL, 'file:///var/bar.js.map'); }; g.evaluate('(function () { (function () { debugger; })(); })();', {sourceMapURL: 'file:///var/bar.js.map'}); diff --git a/js/src/jit-test/tests/debug/Script-sourceMapURL.js b/js/src/jit-test/tests/debug/Source-sourceMapURL.js similarity index 92% rename from js/src/jit-test/tests/debug/Script-sourceMapURL.js rename to js/src/jit-test/tests/debug/Source-sourceMapURL.js index 512b5205dc3e..c14004e9431d 100644 --- a/js/src/jit-test/tests/debug/Script-sourceMapURL.js +++ b/js/src/jit-test/tests/debug/Source-sourceMapURL.js @@ -1,4 +1,4 @@ -// Script.prototype.sourceMapURL can be a string or null. +// Source.prototype.sourceMapURL can be a string or null. let g = newGlobal(); let dbg = new Debugger; @@ -6,7 +6,7 @@ let gw = dbg.addDebuggee(g); function getSourceMapURL() { let fw = gw.makeDebuggeeValue(g.f); - return fw.script.sourceMapURL; + return fw.script.source.sourceMapURL; } // Without a source map @@ -21,7 +21,7 @@ assertEq(getSourceMapURL(), 'file:///var/foo.js.map'); let fired = false; dbg.onDebuggerStatement = function (frame) { fired = true; - assertEq(frame.script.sourceMapURL, 'file:///var/bar.js.map'); + assertEq(frame.script.source.sourceMapURL, 'file:///var/bar.js.map'); }; g.evaluate('(function () { (function () { debugger; })(); })();', {sourceMapURL: 'file:///var/bar.js.map'}); diff --git a/js/src/vm/Debugger.cpp b/js/src/vm/Debugger.cpp index ed59db54a0e2..55547bf1eada 100644 --- a/js/src/vm/Debugger.cpp +++ b/js/src/vm/Debugger.cpp @@ -3204,26 +3204,6 @@ DebuggerScript_getStaticLevel(JSContext *cx, unsigned argc, Value *vp) return true; } -static bool -DebuggerScript_getSourceMapUrl(JSContext *cx, unsigned argc, Value *vp) -{ - THIS_DEBUGSCRIPT_SCRIPT(cx, argc, vp, "(get sourceMapURL)", args, obj, script); - - ScriptSource *source = script->scriptSource(); - JS_ASSERT(source); - - if (source->hasSourceMapURL()) { - JSString *str = JS_NewUCStringCopyZ(cx, source->sourceMapURL()); - if (!str) - return false; - args.rval().setString(str); - } else { - args.rval().setNull(); - } - - return true; -} - static bool DebuggerScript_getGlobal(JSContext *cx, unsigned argc, Value *vp) { @@ -3954,7 +3934,6 @@ static const JSPropertySpec DebuggerScript_properties[] = { JS_PSG("sourceStart", DebuggerScript_getSourceStart, 0), JS_PSG("sourceLength", DebuggerScript_getSourceLength, 0), JS_PSG("staticLevel", DebuggerScript_getStaticLevel, 0), - JS_PSG("sourceMapURL", DebuggerScript_getSourceMapUrl, 0), JS_PSG("global", DebuggerScript_getGlobal, 0), JS_PS_END }; @@ -4222,6 +4201,24 @@ DebuggerSource_getIntroductionType(JSContext *cx, unsigned argc, Value *vp) return true; } +static bool +DebuggerSource_getSourceMapUrl(JSContext *cx, unsigned argc, Value *vp) +{ + THIS_DEBUGSOURCE_REFERENT(cx, argc, vp, "(get sourceMapURL)", args, obj, sourceObject); + + ScriptSource *ss = sourceObject->source(); + if (ss->hasSourceMapURL()) { + JSString *str = JS_NewUCStringCopyZ(cx, ss->sourceMapURL()); + if (!str) + return false; + args.rval().setString(str); + } else { + args.rval().setNull(); + } + + return true; +} + static const JSPropertySpec DebuggerSource_properties[] = { JS_PSG("text", DebuggerSource_getText, 0), JS_PSG("url", DebuggerSource_getUrl, 0), @@ -4231,6 +4228,7 @@ static const JSPropertySpec DebuggerSource_properties[] = { JS_PSG("introductionOffset", DebuggerSource_getIntroductionOffset, 0), JS_PSG("introductionType", DebuggerSource_getIntroductionType, 0), JS_PSG("elementAttributeName", DebuggerSource_getElementProperty, 0), + JS_PSG("sourceMapURL", DebuggerSource_getSourceMapUrl, 0), JS_PS_END }; diff --git a/toolkit/devtools/server/actors/script.js b/toolkit/devtools/server/actors/script.js index 586a4b6987f3..1636f7049d3d 100644 --- a/toolkit/devtools/server/actors/script.js +++ b/toolkit/devtools/server/actors/script.js @@ -4977,7 +4977,7 @@ ThreadSources.prototype = { * of an array of source actors for those. */ sourcesForScript: function (aScript) { - if (!this._useSourceMaps || !aScript.sourceMapURL) { + if (!this._useSourceMaps || !aScript.source.sourceMapURL) { return resolve([this._sourceForScript(aScript)].filter(isNotNull)); } @@ -5004,8 +5004,8 @@ ThreadSources.prototype = { * |aScript| must have a non-null sourceMapURL. */ sourceMap: function (aScript) { - dbg_assert(aScript.sourceMapURL, "Script should have a sourceMapURL"); - let sourceMapURL = this._normalize(aScript.sourceMapURL, aScript.url); + dbg_assert(aScript.source.sourceMapURL, "Script should have a sourceMapURL"); + let sourceMapURL = this._normalize(aScript.source.sourceMapURL, aScript.url); let map = this._fetchSourceMap(sourceMapURL, aScript.url) .then(aSourceMap => this.saveSourceMap(aSourceMap, aScript.url)); this._sourceMapsByGeneratedSource[aScript.url] = map; From 41db28879233c714b5cb9ec50b02f74cfdcca573 Mon Sep 17 00:00:00 2001 From: ziyunfei <446240525@qq.com> Date: Wed, 1 Oct 2014 04:30:00 +0200 Subject: [PATCH 29/63] Bug 1075294 - Object.seal() should return its argument with no conversion when the argument is a primitive value. r=till --- js/src/builtin/Object.cpp | 37 ++++++++++++++++-------------- js/src/tests/ecma_6/Object/seal.js | 21 +++++++++++++++++ 2 files changed, 41 insertions(+), 17 deletions(-) create mode 100644 js/src/tests/ecma_6/Object/seal.js diff --git a/js/src/builtin/Object.cpp b/js/src/builtin/Object.cpp index 27c751a494bd..10bdfb6a76f6 100644 --- a/js/src/builtin/Object.cpp +++ b/js/src/builtin/Object.cpp @@ -845,7 +845,7 @@ obj_keys(JSContext *cx, unsigned argc, Value *vp) { CallArgs args = CallArgsFromVp(argc, vp); - // steps 1-2 + // Steps 1-2. RootedObject obj(cx); if (!GetFirstArgumentAsObject(cx, args, "Object.keys", &obj)) return false; @@ -873,7 +873,7 @@ obj_keys(JSContext *cx, unsigned argc, Value *vp) namelist.infallibleAppend(StringValue(str)); } - // step 11 + // Step 11. JS_ASSERT(props.length() <= UINT32_MAX); JSObject *aobj = NewDenseCopiedArray(cx, uint32_t(namelist.length()), namelist.begin()); if (!aobj) @@ -919,17 +919,17 @@ namespace js { bool GetOwnPropertyKeys(JSContext *cx, const JS::CallArgs &args, unsigned flags) { - // steps 1-2 + // Steps 1-2. RootedObject obj(cx, ToObject(cx, args.get(0))); if (!obj) return false; - // steps 3-10 + // Steps 3-10. AutoIdVector keys(cx); if (!GetPropertyNames(cx, obj, flags, &keys)) return false; - // step 11 + // Step 11. AutoValueVector vals(cx); if (!vals.resize(keys.length())) return false; @@ -1021,10 +1021,10 @@ obj_isExtensible(JSContext *cx, unsigned argc, Value *vp) { CallArgs args = CallArgsFromVp(argc, vp); - // step 1 + // Step 1. bool extensible = false; - // step 2 + // Step 2. if (args.get(0).isObject()) { RootedObject obj(cx, &args.get(0).toObject()); if (!JSObject::isExtensible(cx, obj, &extensible)) @@ -1041,11 +1041,11 @@ obj_preventExtensions(JSContext *cx, unsigned argc, Value *vp) CallArgs args = CallArgsFromVp(argc, vp); args.rval().set(args.get(0)); - // step 1 + // Step 1. if (!args.get(0).isObject()) return true; - // steps 2-5 + // Steps 2-5. RootedObject obj(cx, &args.get(0).toObject()); return JSObject::preventExtensions(cx, obj); @@ -1070,10 +1070,10 @@ obj_isFrozen(JSContext *cx, unsigned argc, Value *vp) { CallArgs args = CallArgsFromVp(argc, vp); - // step 1 + // Step 1. bool frozen = true; - // step 2 + // Step 2. if (args.get(0).isObject()) { RootedObject obj(cx, &args.get(0).toObject()); if (!JSObject::isFrozen(cx, obj, &frozen)) @@ -1083,16 +1083,19 @@ obj_isFrozen(JSContext *cx, unsigned argc, Value *vp) return true; } +// ES6 draft rev27 (2014/08/24) 19.1.2.17 Object.seal(O) static bool obj_seal(JSContext *cx, unsigned argc, Value *vp) { CallArgs args = CallArgsFromVp(argc, vp); - RootedObject obj(cx); - if (!GetFirstArgumentAsObject(cx, args, "Object.seal", &obj)) - return false; + args.rval().set(args.get(0)); - args.rval().setObject(*obj); + // Step 1. + if (!args.get(0).isObject()) + return true; + // Steps 2-5. + RootedObject obj(cx, &args.get(0).toObject()); return JSObject::seal(cx, obj); } @@ -1102,10 +1105,10 @@ obj_isSealed(JSContext *cx, unsigned argc, Value *vp) { CallArgs args = CallArgsFromVp(argc, vp); - // step 1 + // Step 1. bool sealed = true; - // step 2 + // Step 2. if (args.get(0).isObject()) { RootedObject obj(cx, &args.get(0).toObject()); if (!JSObject::isSealed(cx, obj, &sealed)) diff --git a/js/src/tests/ecma_6/Object/seal.js b/js/src/tests/ecma_6/Object/seal.js new file mode 100644 index 000000000000..e325c80d9d90 --- /dev/null +++ b/js/src/tests/ecma_6/Object/seal.js @@ -0,0 +1,21 @@ +/* + * Any copyright is dedicated to the Public Domain. + * https://creativecommons.org/publicdomain/zero/1.0/ + */ + +var BUGNUMBER = 1075294; +var summary = "Object.seal() should return its argument with no conversion when the argument is a primitive value"; + +print(BUGNUMBER + ": " + summary); +assertEq(Object.seal(), undefined); +assertEq(Object.seal(undefined), undefined); +assertEq(Object.seal(null), null); +assertEq(Object.seal(1), 1); +assertEq(Object.seal("foo"), "foo"); +assertEq(Object.seal(true), true); +if (typeof Symbol === "function") { + assertEq(Object.seal(Symbol.for("foo")), Symbol.for("foo")); +} + +if (typeof reportCompare === "function") + reportCompare(true, true); From b4f9648437e185204a7bc65089fc13ceb980866b Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Wed, 1 Oct 2014 11:14:39 -0400 Subject: [PATCH 30/63] Bug 1065185 followup: expose the indexed prop we're trying to access in this test to reopen the CLOSED TREE --- js/xpconnect/tests/unit/test_bug853709.js | 1 + 1 file changed, 1 insertion(+) diff --git a/js/xpconnect/tests/unit/test_bug853709.js b/js/xpconnect/tests/unit/test_bug853709.js index 502c656425ea..6e80759ae546 100644 --- a/js/xpconnect/tests/unit/test_bug853709.js +++ b/js/xpconnect/tests/unit/test_bug853709.js @@ -7,6 +7,7 @@ function setupChromeSandbox() { get: function() { return _b; }, set: function(val) { _b = val; } }); this.chromeArr = [4, 2, 1]; + this.chromeArr["__exposedProps__"] = { "1": "rw" }; } function checkDefineThrows(sb, obj, prop, desc) { From d78e27f881169bacf4049543717e50ae8ab008bb Mon Sep 17 00:00:00 2001 From: "Carsten \"Tomcat\" Book" Date: Wed, 1 Oct 2014 17:16:42 +0200 Subject: [PATCH 31/63] Backed out changeset 0a308311d9a7 (bug 1056409) for wrong commit message on a CLOSED TREE --- content/base/test/chrome/test_bug765993.html | 2 +- js/src/doc/Debugger/Debugger.Script.md | 11 +++++ js/src/doc/Debugger/Debugger.Source.md | 11 ----- ...d.js => Script-sourceMapURL-deprecated.js} | 6 +-- ...sourceMapURL.js => Script-sourceMapURL.js} | 6 +-- .../jit-test/tests/debug/Source-displayURL.js | 4 +- js/src/vm/Debugger.cpp | 40 ++++++++++--------- toolkit/devtools/server/actors/script.js | 6 +-- 8 files changed, 44 insertions(+), 42 deletions(-) rename js/src/jit-test/tests/debug/{Source-sourceMapURL-deprecated.js => Script-sourceMapURL-deprecated.js} (92%) rename js/src/jit-test/tests/debug/{Source-sourceMapURL.js => Script-sourceMapURL.js} (92%) diff --git a/content/base/test/chrome/test_bug765993.html b/content/base/test/chrome/test_bug765993.html index 26c39d0f2c38..650b1bee1656 100644 --- a/content/base/test/chrome/test_bug765993.html +++ b/content/base/test/chrome/test_bug765993.html @@ -46,7 +46,7 @@ window.onload = function () { }); ok(scripts.length > 0, "Should be able to find script"); - is(scripts[0].source.sourceMapURL, "foo.js.map"); + is(scripts[0].sourceMapURL, "foo.js.map"); SimpleTest.finish(); } diff --git a/js/src/doc/Debugger/Debugger.Script.md b/js/src/doc/Debugger/Debugger.Script.md index 80ac2fd009a2..b0bd786c51f2 100644 --- a/js/src/doc/Debugger/Debugger.Script.md +++ b/js/src/doc/Debugger/Debugger.Script.md @@ -115,6 +115,17 @@ from its prototype: : This is `true` if this script's code is ECMAScript strict mode code, and `false` otherwise. +`sourceMapURL` +: If this script was produced by a minimizer or translated from some other + language, and we know the URL of a source map document relating + the source positions in this script to the corresponding source + positions in the original source, then this property's value is that + URL. Otherwise, this is `null`. + + (On the web, the translator may provide the source map URL in a + specially formatted comment in the JavaScript source code, or via a + header in the HTTP reply that carried the generated JavaScript.) + ## Function Properties of the Debugger.Script Prototype Object The functions described below may only be called with a `this` value diff --git a/js/src/doc/Debugger/Debugger.Source.md b/js/src/doc/Debugger/Debugger.Source.md index 91e6a4ae31bb..70e80ffd4429 100644 --- a/js/src/doc/Debugger/Debugger.Source.md +++ b/js/src/doc/Debugger/Debugger.Source.md @@ -74,17 +74,6 @@ from its prototype: `url` accessor on `Debugger.Source` instances for such sources should return `undefined`.) -`sourceMapURL` -: If this source was produced by a minimizer or translated from some other - language, and we know the URL of a source map document relating - the source positions in this source to the corresponding source - positions in the original source, then this property's value is that - URL. Otherwise, this is `null`. - - (On the web, the translator may provide the source map URL in a - specially formatted comment in the JavaScript source code, or via a - header in the HTTP reply that carried the generated JavaScript.) - `element` : The [`Debugger.Object`][object] instance referring to the DOM element to which this source code belongs, if any, or `undefined` if it belongs to no DOM diff --git a/js/src/jit-test/tests/debug/Source-sourceMapURL-deprecated.js b/js/src/jit-test/tests/debug/Script-sourceMapURL-deprecated.js similarity index 92% rename from js/src/jit-test/tests/debug/Source-sourceMapURL-deprecated.js rename to js/src/jit-test/tests/debug/Script-sourceMapURL-deprecated.js index fb01ccb0a67b..7e9e59971f43 100644 --- a/js/src/jit-test/tests/debug/Source-sourceMapURL-deprecated.js +++ b/js/src/jit-test/tests/debug/Script-sourceMapURL-deprecated.js @@ -1,4 +1,4 @@ -// Source.prototype.sourceMapURL can be a string or null. +// Script.prototype.sourceMapURL can be a string or null. let g = newGlobal(); let dbg = new Debugger; @@ -6,7 +6,7 @@ let gw = dbg.addDebuggee(g); function getSourceMapURL() { let fw = gw.makeDebuggeeValue(g.f); - return fw.script.source.sourceMapURL; + return fw.script.sourceMapURL; } // Without a source map @@ -21,7 +21,7 @@ assertEq(getSourceMapURL(), 'file:///var/foo.js.map'); let fired = false; dbg.onDebuggerStatement = function (frame) { fired = true; - assertEq(frame.script.source.sourceMapURL, 'file:///var/bar.js.map'); + assertEq(frame.script.sourceMapURL, 'file:///var/bar.js.map'); }; g.evaluate('(function () { (function () { debugger; })(); })();', {sourceMapURL: 'file:///var/bar.js.map'}); diff --git a/js/src/jit-test/tests/debug/Source-sourceMapURL.js b/js/src/jit-test/tests/debug/Script-sourceMapURL.js similarity index 92% rename from js/src/jit-test/tests/debug/Source-sourceMapURL.js rename to js/src/jit-test/tests/debug/Script-sourceMapURL.js index c14004e9431d..512b5205dc3e 100644 --- a/js/src/jit-test/tests/debug/Source-sourceMapURL.js +++ b/js/src/jit-test/tests/debug/Script-sourceMapURL.js @@ -1,4 +1,4 @@ -// Source.prototype.sourceMapURL can be a string or null. +// Script.prototype.sourceMapURL can be a string or null. let g = newGlobal(); let dbg = new Debugger; @@ -6,7 +6,7 @@ let gw = dbg.addDebuggee(g); function getSourceMapURL() { let fw = gw.makeDebuggeeValue(g.f); - return fw.script.source.sourceMapURL; + return fw.script.sourceMapURL; } // Without a source map @@ -21,7 +21,7 @@ assertEq(getSourceMapURL(), 'file:///var/foo.js.map'); let fired = false; dbg.onDebuggerStatement = function (frame) { fired = true; - assertEq(frame.script.source.sourceMapURL, 'file:///var/bar.js.map'); + assertEq(frame.script.sourceMapURL, 'file:///var/bar.js.map'); }; g.evaluate('(function () { (function () { debugger; })(); })();', {sourceMapURL: 'file:///var/bar.js.map'}); diff --git a/js/src/jit-test/tests/debug/Source-displayURL.js b/js/src/jit-test/tests/debug/Source-displayURL.js index a16a761860a4..51536d813889 100644 --- a/js/src/jit-test/tests/debug/Source-displayURL.js +++ b/js/src/jit-test/tests/debug/Source-displayURL.js @@ -78,7 +78,7 @@ var capturedSourceMapURL; dbg.onNewScript = function (script) { capturedScript = script; capturedDisplayURL = script.source.displayURL; - capturedSourceMapURL = script.source.sourceMapURL; + capturedSourceMapURL = script.sourceMapURL; dbg.onNewScript = undefined; }; var fun = gw.makeDebuggeeValue(g.Function('//# sourceURL=munge.js\n//# sourceMappingURL=grunge.map\n')); @@ -87,5 +87,5 @@ assertEq(capturedScript, fun.script); assertEq(capturedDisplayURL, fun.script.source.displayURL); assertEq(capturedDisplayURL, 'munge.js'); -assertEq(capturedSourceMapURL, fun.script.source.sourceMapURL); +assertEq(capturedSourceMapURL, fun.script.sourceMapURL); assertEq(capturedSourceMapURL, 'grunge.map'); diff --git a/js/src/vm/Debugger.cpp b/js/src/vm/Debugger.cpp index 55547bf1eada..ed59db54a0e2 100644 --- a/js/src/vm/Debugger.cpp +++ b/js/src/vm/Debugger.cpp @@ -3204,6 +3204,26 @@ DebuggerScript_getStaticLevel(JSContext *cx, unsigned argc, Value *vp) return true; } +static bool +DebuggerScript_getSourceMapUrl(JSContext *cx, unsigned argc, Value *vp) +{ + THIS_DEBUGSCRIPT_SCRIPT(cx, argc, vp, "(get sourceMapURL)", args, obj, script); + + ScriptSource *source = script->scriptSource(); + JS_ASSERT(source); + + if (source->hasSourceMapURL()) { + JSString *str = JS_NewUCStringCopyZ(cx, source->sourceMapURL()); + if (!str) + return false; + args.rval().setString(str); + } else { + args.rval().setNull(); + } + + return true; +} + static bool DebuggerScript_getGlobal(JSContext *cx, unsigned argc, Value *vp) { @@ -3934,6 +3954,7 @@ static const JSPropertySpec DebuggerScript_properties[] = { JS_PSG("sourceStart", DebuggerScript_getSourceStart, 0), JS_PSG("sourceLength", DebuggerScript_getSourceLength, 0), JS_PSG("staticLevel", DebuggerScript_getStaticLevel, 0), + JS_PSG("sourceMapURL", DebuggerScript_getSourceMapUrl, 0), JS_PSG("global", DebuggerScript_getGlobal, 0), JS_PS_END }; @@ -4201,24 +4222,6 @@ DebuggerSource_getIntroductionType(JSContext *cx, unsigned argc, Value *vp) return true; } -static bool -DebuggerSource_getSourceMapUrl(JSContext *cx, unsigned argc, Value *vp) -{ - THIS_DEBUGSOURCE_REFERENT(cx, argc, vp, "(get sourceMapURL)", args, obj, sourceObject); - - ScriptSource *ss = sourceObject->source(); - if (ss->hasSourceMapURL()) { - JSString *str = JS_NewUCStringCopyZ(cx, ss->sourceMapURL()); - if (!str) - return false; - args.rval().setString(str); - } else { - args.rval().setNull(); - } - - return true; -} - static const JSPropertySpec DebuggerSource_properties[] = { JS_PSG("text", DebuggerSource_getText, 0), JS_PSG("url", DebuggerSource_getUrl, 0), @@ -4228,7 +4231,6 @@ static const JSPropertySpec DebuggerSource_properties[] = { JS_PSG("introductionOffset", DebuggerSource_getIntroductionOffset, 0), JS_PSG("introductionType", DebuggerSource_getIntroductionType, 0), JS_PSG("elementAttributeName", DebuggerSource_getElementProperty, 0), - JS_PSG("sourceMapURL", DebuggerSource_getSourceMapUrl, 0), JS_PS_END }; diff --git a/toolkit/devtools/server/actors/script.js b/toolkit/devtools/server/actors/script.js index 1636f7049d3d..586a4b6987f3 100644 --- a/toolkit/devtools/server/actors/script.js +++ b/toolkit/devtools/server/actors/script.js @@ -4977,7 +4977,7 @@ ThreadSources.prototype = { * of an array of source actors for those. */ sourcesForScript: function (aScript) { - if (!this._useSourceMaps || !aScript.source.sourceMapURL) { + if (!this._useSourceMaps || !aScript.sourceMapURL) { return resolve([this._sourceForScript(aScript)].filter(isNotNull)); } @@ -5004,8 +5004,8 @@ ThreadSources.prototype = { * |aScript| must have a non-null sourceMapURL. */ sourceMap: function (aScript) { - dbg_assert(aScript.source.sourceMapURL, "Script should have a sourceMapURL"); - let sourceMapURL = this._normalize(aScript.source.sourceMapURL, aScript.url); + dbg_assert(aScript.sourceMapURL, "Script should have a sourceMapURL"); + let sourceMapURL = this._normalize(aScript.sourceMapURL, aScript.url); let map = this._fetchSourceMap(sourceMapURL, aScript.url) .then(aSourceMap => this.saveSourceMap(aSourceMap, aScript.url)); this._sourceMapsByGeneratedSource[aScript.url] = map; From b55f40845dd83186be455999fd988654aa045214 Mon Sep 17 00:00:00 2001 From: Bobby Holley Date: Wed, 1 Oct 2014 17:22:14 +0200 Subject: [PATCH 32/63] Bug 1067009 - Const-correct a few jsapi methods. r=billm --- js/src/jsapi.cpp | 4 ++-- js/src/jsapi.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/js/src/jsapi.cpp b/js/src/jsapi.cpp index 8a1ee5403015..a94fa6c7c7bd 100644 --- a/js/src/jsapi.cpp +++ b/js/src/jsapi.cpp @@ -5824,7 +5824,7 @@ JS_ClearDateCaches(JSContext *cx) * Regular Expressions. */ JS_PUBLIC_API(JSObject *) -JS_NewRegExpObject(JSContext *cx, HandleObject obj, char *bytes, size_t length, unsigned flags) +JS_NewRegExpObject(JSContext *cx, HandleObject obj, const char *bytes, size_t length, unsigned flags) { AssertHeapIsIdle(cx); CHECK_REQUEST(cx); @@ -5842,7 +5842,7 @@ JS_NewRegExpObject(JSContext *cx, HandleObject obj, char *bytes, size_t length, } JS_PUBLIC_API(JSObject *) -JS_NewUCRegExpObject(JSContext *cx, HandleObject obj, char16_t *chars, size_t length, +JS_NewUCRegExpObject(JSContext *cx, HandleObject obj, const char16_t *chars, size_t length, unsigned flags) { AssertHeapIsIdle(cx); diff --git a/js/src/jsapi.h b/js/src/jsapi.h index defabeddce12..7a2d52646f89 100644 --- a/js/src/jsapi.h +++ b/js/src/jsapi.h @@ -4759,11 +4759,11 @@ JS_ClearDateCaches(JSContext *cx); #define JSREG_STICKY 0x08u /* only match starting at lastIndex */ extern JS_PUBLIC_API(JSObject *) -JS_NewRegExpObject(JSContext *cx, JS::HandleObject obj, char *bytes, size_t length, +JS_NewRegExpObject(JSContext *cx, JS::HandleObject obj, const char *bytes, size_t length, unsigned flags); extern JS_PUBLIC_API(JSObject *) -JS_NewUCRegExpObject(JSContext *cx, JS::HandleObject obj, char16_t *chars, size_t length, +JS_NewUCRegExpObject(JSContext *cx, JS::HandleObject obj, const char16_t *chars, size_t length, unsigned flags); extern JS_PUBLIC_API(bool) From 663ee61ddad662ad7000be9f58ab79c5f1922dc1 Mon Sep 17 00:00:00 2001 From: Bobby Holley Date: Wed, 1 Oct 2014 17:22:15 +0200 Subject: [PATCH 33/63] Bug 1067009 - Make JSAPI RegExp accessors work correctly proxies. r=billm --- js/src/jsapi.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/js/src/jsapi.cpp b/js/src/jsapi.cpp index a94fa6c7c7bd..a9d70c370d98 100644 --- a/js/src/jsapi.cpp +++ b/js/src/jsapi.cpp @@ -5954,7 +5954,10 @@ JS_GetRegExpFlags(JSContext *cx, HandleObject obj) AssertHeapIsIdle(cx); CHECK_REQUEST(cx); - return obj->as().getFlags(); + RegExpGuard shared(cx); + if (!RegExpToShared(cx, obj, &shared)) + return false; + return shared.re()->getFlags(); } JS_PUBLIC_API(JSString *) @@ -5963,7 +5966,10 @@ JS_GetRegExpSource(JSContext *cx, HandleObject obj) AssertHeapIsIdle(cx); CHECK_REQUEST(cx); - return obj->as().getSource(); + RegExpGuard shared(cx); + if (!RegExpToShared(cx, obj, &shared)) + return nullptr; + return shared.re()->getSource(); } /************************************************************************/ From 34e7aaf7986360e103a8c882c0bdb7ff2de331dc Mon Sep 17 00:00:00 2001 From: Bobby Holley Date: Wed, 1 Oct 2014 17:22:15 +0200 Subject: [PATCH 34/63] Bug 1067009 - Don't assume that someRegExp.source is an atom. r=billm --- js/src/builtin/RegExp.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/js/src/builtin/RegExp.cpp b/js/src/builtin/RegExp.cpp index b4da353b7f7e..24cea0bafe88 100644 --- a/js/src/builtin/RegExp.cpp +++ b/js/src/builtin/RegExp.cpp @@ -255,7 +255,9 @@ CompileRegExpObject(JSContext *cx, RegExpObjectBuilder &builder, CallArgs args) if (!JSObject::getProperty(cx, sourceObj, sourceObj, cx->names().source, &v)) return false; - Rooted sourceAtom(cx, &v.toString()->asAtom()); + // For proxies like CPOWs, we can't assume the result of a property get + // for 'source' is atomized. + Rooted sourceAtom(cx, AtomizeString(cx, v.toString())); RegExpObject *reobj = builder.build(sourceAtom, flags); if (!reobj) return false; From 17638a1eeda669f9cf017dd9cb36439a7faec9e3 Mon Sep 17 00:00:00 2001 From: Bobby Holley Date: Wed, 1 Oct 2014 17:22:15 +0200 Subject: [PATCH 35/63] Bug 1067009 - Implement regexp_toShared for CPOWs. r=billm --- js/ipc/JavaScriptBase.h | 8 ++++++++ js/ipc/PJavaScript.ipdl | 1 + js/ipc/WrapperAnswer.cpp | 25 +++++++++++++++++++++++++ js/ipc/WrapperAnswer.h | 1 + js/ipc/WrapperOwner.cpp | 32 ++++++++++++++++++++++++++++++++ js/ipc/WrapperOwner.h | 4 ++++ js/src/jsfriendapi.h | 4 ++++ js/src/vm/RegExpObject.cpp | 6 ++++++ 8 files changed, 81 insertions(+) diff --git a/js/ipc/JavaScriptBase.h b/js/ipc/JavaScriptBase.h index 79624efaaf41..6754d5bb088e 100644 --- a/js/ipc/JavaScriptBase.h +++ b/js/ipc/JavaScriptBase.h @@ -97,6 +97,9 @@ class JavaScriptBase : public WrapperOwner, public WrapperAnswer, public Base bool AnswerClassName(const uint64_t &objId, nsString *result) { return Answer::AnswerClassName(ObjectId::deserialize(objId), result); } + bool AnswerRegExpToShared(const uint64_t &objId, ReturnStatus *rs, nsString *source, uint32_t *flags) { + return Answer::AnswerRegExpToShared(ObjectId::deserialize(objId), rs, source, flags); + } bool AnswerGetPropertyNames(const uint64_t &objId, const uint32_t &flags, ReturnStatus *rs, nsTArray *names) { @@ -191,6 +194,11 @@ class JavaScriptBase : public WrapperOwner, public WrapperAnswer, public Base return Base::CallClassName(objId.serialize(), result); } + bool CallRegExpToShared(const ObjectId &objId, ReturnStatus *rs, + nsString *source, uint32_t *flags) { + return Base::CallRegExpToShared(objId.serialize(), rs, source, flags); + } + bool CallGetPropertyNames(const ObjectId &objId, const uint32_t &flags, ReturnStatus *rs, nsTArray *names) { return Base::CallGetPropertyNames(objId.serialize(), flags, rs, names); diff --git a/js/ipc/PJavaScript.ipdl b/js/ipc/PJavaScript.ipdl index 9e79afa8a039..6efb0a8b06a4 100644 --- a/js/ipc/PJavaScript.ipdl +++ b/js/ipc/PJavaScript.ipdl @@ -40,6 +40,7 @@ both: rpc HasInstance(uint64_t objId, JSVariant v) returns (ReturnStatus rs, bool has); rpc ObjectClassIs(uint64_t objId, uint32_t classValue) returns (bool result); rpc ClassName(uint64_t objId) returns (nsString name); + rpc RegExpToShared(uint64_t objId) returns (ReturnStatus rs, nsString source, uint32_t flags); rpc GetPropertyNames(uint64_t objId, uint32_t flags) returns (ReturnStatus rs, nsString[] names); rpc InstanceOf(uint64_t objId, JSIID iid) returns (ReturnStatus rs, bool instanceof); diff --git a/js/ipc/WrapperAnswer.cpp b/js/ipc/WrapperAnswer.cpp index 90153dc6f888..5fb3e45040d1 100644 --- a/js/ipc/WrapperAnswer.cpp +++ b/js/ipc/WrapperAnswer.cpp @@ -552,6 +552,31 @@ WrapperAnswer::AnswerClassName(const ObjectId &objId, nsString *name) return true; } +bool +WrapperAnswer::AnswerRegExpToShared(const ObjectId &objId, ReturnStatus *rs, + nsString *source, uint32_t *flags) +{ + AutoSafeJSContext cx; + RootedObject obj(cx, findObjectById(cx, objId)); + if (!obj) + return fail(cx, rs); + + JSAutoCompartment ac(cx, obj); + MOZ_RELEASE_ASSERT(JS_ObjectIsRegExp(cx, obj)); + + RootedString sourceJSStr(cx, JS_GetRegExpSource(cx, obj)); + if (!sourceJSStr) + return fail(cx, rs); + nsAutoJSString sourceStr; + if (!sourceStr.init(cx, sourceJSStr)) + return fail(cx, rs); + source->Assign(sourceStr); + + *flags = JS_GetRegExpFlags(cx, obj); + + return ok(rs); +} + bool WrapperAnswer::AnswerGetPropertyNames(const ObjectId &objId, const uint32_t &flags, ReturnStatus *rs, nsTArray *names) diff --git a/js/ipc/WrapperAnswer.h b/js/ipc/WrapperAnswer.h index 3f425ce717ed..9bc998c078d6 100644 --- a/js/ipc/WrapperAnswer.h +++ b/js/ipc/WrapperAnswer.h @@ -52,6 +52,7 @@ class WrapperAnswer : public virtual JavaScriptShared bool AnswerObjectClassIs(const ObjectId &objId, const uint32_t &classValue, bool *result); bool AnswerClassName(const ObjectId &objId, nsString *result); + bool AnswerRegExpToShared(const ObjectId &objId, ReturnStatus *rs, nsString *source, uint32_t *flags); bool AnswerGetPropertyNames(const ObjectId &objId, const uint32_t &flags, ReturnStatus *rs, nsTArray *names); diff --git a/js/ipc/WrapperOwner.cpp b/js/ipc/WrapperOwner.cpp index f13aff354942..97fff1b6a59f 100644 --- a/js/ipc/WrapperOwner.cpp +++ b/js/ipc/WrapperOwner.cpp @@ -91,6 +91,7 @@ class CPOWProxyHandler : public BaseProxyHandler virtual bool objectClassIs(HandleObject obj, js::ESClassValue classValue, JSContext *cx) const MOZ_OVERRIDE; virtual const char* className(JSContext *cx, HandleObject proxy) const MOZ_OVERRIDE; + virtual bool regexp_toShared(JSContext *cx, HandleObject proxy, RegExpGuard *g) const MOZ_OVERRIDE; virtual void finalize(JSFreeOp *fop, JSObject *proxy) const MOZ_OVERRIDE; virtual void objectMoved(JSObject *proxy, const JSObject *old) const MOZ_OVERRIDE; virtual bool isCallable(JSObject *obj) const MOZ_OVERRIDE; @@ -651,6 +652,37 @@ WrapperOwner::className(JSContext *cx, HandleObject proxy) return ToNewCString(name); } +bool +CPOWProxyHandler::regexp_toShared(JSContext *cx, HandleObject proxy, RegExpGuard *g) const +{ + FORWARD(regexp_toShared, (cx, proxy, g)); +} + +bool +WrapperOwner::regexp_toShared(JSContext *cx, HandleObject proxy, RegExpGuard *g) +{ + ObjectId objId = idOf(proxy); + + ReturnStatus status; + nsString source; + unsigned flags = 0; + if (!CallRegExpToShared(objId, &status, &source, &flags)) + return ipcfail(cx); + + LOG_STACK(); + + if (!ok(cx, status)) + return false; + + RootedObject regexp(cx); + RootedObject global(cx, JS::CurrentGlobalOrNull(cx)); + regexp = JS_NewUCRegExpObject(cx, global, source.get(), source.Length(), flags); + if (!regexp) + return false; + + return js::RegExpToSharedNonInline(cx, regexp, g); +} + void CPOWProxyHandler::finalize(JSFreeOp *fop, JSObject *proxy) const { diff --git a/js/ipc/WrapperOwner.h b/js/ipc/WrapperOwner.h index b70e7446d6c1..98e55355d02c 100644 --- a/js/ipc/WrapperOwner.h +++ b/js/ipc/WrapperOwner.h @@ -11,6 +11,7 @@ #include "JavaScriptShared.h" #include "mozilla/ipc/ProtocolUtils.h" #include "js/Class.h" +#include "jsproxy.h" #ifdef XP_WIN #undef GetClassName @@ -55,6 +56,7 @@ class WrapperOwner : public virtual JavaScriptShared // SpiderMonkey Extensions. bool isExtensible(JSContext *cx, JS::HandleObject proxy, bool *extensible); + bool regexp_toShared(JSContext *cx, JS::HandleObject proxy, js::RegExpGuard *g); bool callOrConstruct(JSContext *cx, JS::HandleObject proxy, const JS::CallArgs &args, bool construct); bool hasInstance(JSContext *cx, JS::HandleObject proxy, JS::MutableHandleValue v, bool *bp); @@ -140,6 +142,8 @@ class WrapperOwner : public virtual JavaScriptShared virtual bool CallObjectClassIs(const ObjectId &objId, const uint32_t &classValue, bool *result) = 0; virtual bool CallClassName(const ObjectId &objId, nsString *result) = 0; + virtual bool CallRegExpToShared(const ObjectId &objId, ReturnStatus *rs, nsString *source, + uint32_t *flags) = 0; virtual bool CallGetPropertyNames(const ObjectId &objId, const uint32_t &flags, ReturnStatus *rs, nsTArray *names) = 0; diff --git a/js/src/jsfriendapi.h b/js/src/jsfriendapi.h index 89e6c7d6dc86..0793200d71d9 100644 --- a/js/src/jsfriendapi.h +++ b/js/src/jsfriendapi.h @@ -1157,6 +1157,10 @@ extern JS_FRIEND_API(unsigned) GetEnterCompartmentDepth(JSContext* cx); #endif +class RegExpGuard; +extern JS_FRIEND_API(bool) +RegExpToSharedNonInline(JSContext *cx, JS::HandleObject regexp, RegExpGuard *shared); + /* Implemented in jswrapper.cpp. */ typedef enum NukeReferencesToWindow { NukeWindowReferences, diff --git a/js/src/vm/RegExpObject.cpp b/js/src/vm/RegExpObject.cpp index 5a06e1728244..57afd176f7d4 100644 --- a/js/src/vm/RegExpObject.cpp +++ b/js/src/vm/RegExpObject.cpp @@ -973,3 +973,9 @@ js::CloneScriptRegExpObject(JSContext *cx, RegExpObject &reobj) RootedAtom source(cx, reobj.getSource()); return RegExpObject::createNoStatics(cx, source, reobj.getFlags(), nullptr, cx->tempLifoAlloc()); } + +JS_FRIEND_API(bool) +js::RegExpToSharedNonInline(JSContext *cx, HandleObject obj, js::RegExpGuard *g) +{ + return RegExpToShared(cx, obj, g); +} From 9ef010d50c1399a8ceccf22274ed9b5dd070e29d Mon Sep 17 00:00:00 2001 From: Bobby Holley Date: Wed, 1 Oct 2014 17:22:16 +0200 Subject: [PATCH 36/63] Bug 1067009 - Tests. r=billm --- content/base/test/chrome/cpows_child.js | 6 ++++++ content/base/test/chrome/cpows_parent.xul | 16 ++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/content/base/test/chrome/cpows_child.js b/content/base/test/chrome/cpows_child.js index fffbe2b7d664..3617a69410ea 100644 --- a/content/base/test/chrome/cpows_child.js +++ b/content/base/test/chrome/cpows_child.js @@ -13,6 +13,7 @@ var is_remote; dom_test(); xray_test(); compartment_test(); + regexp_test(); sync_test(); async_test(); rpc_test(); @@ -143,6 +144,11 @@ function compartment_test() testParentObject: testParentObject }); } +function regexp_test() +{ + sendSyncMessage("cpows:regexp_test", {}, { regexp: /myRegExp/g }); +} + function sync_test() { dump('beginning cpow sync test\n'); diff --git a/content/base/test/chrome/cpows_parent.xul b/content/base/test/chrome/cpows_parent.xul index cb1ba0d14710..6c11ca5721aa 100644 --- a/content/base/test/chrome/cpows_parent.xul +++ b/content/base/test/chrome/cpows_parent.xul @@ -233,6 +233,21 @@ results.forEach((x) => is(x.result, "PASS", x.message)); } + function recvRegExpTest(message) { + let regexp = message.objects.regexp; + + // These work generically. + is(regexp.toString(), "/myRegExp/g", "toString works right"); + ok(regexp.test("I like myRegExp to match"), "No false positives"); + ok(!regexp.test("asdfsdf"), "No false positives"); + + // These go over regexp_toShared. + is("filler myRegExp filler".search(regexp), 7, "String.prototype.match works right"); + var shell = /x/; + shell.compile(regexp); + is(regexp.toString(), shell.toString(), ".compile works right"); + } + let savedWilldieObj; let wontDie = {f:2, __exposedProps__: {"f": "r"}}; function recvLifetimeTest1(message) { @@ -286,6 +301,7 @@ mm.addMessageListener("cpows:dom_test_after_gc", recvDomTestAfterGC); mm.addMessageListener("cpows:xray_test", recvXrayTest); mm.addMessageListener("cpows:compartment_test", recvCompartmentTest); + mm.addMessageListener("cpows:regexp_test", recvRegExpTest); mm.addMessageListener("cpows:lifetime_test_1", recvLifetimeTest1); mm.addMessageListener("cpows:lifetime_test_2", recvLifetimeTest2); mm.loadFrameScript("chrome://mochitests/content/chrome/content/base/test/chrome/cpows_child.js", true); From 6408e7ff163a5638a09b3aff685bd1812cad1c1b Mon Sep 17 00:00:00 2001 From: Till Schneidereit Date: Tue, 30 Sep 2014 01:17:55 +0200 Subject: [PATCH 37/63] Bug 1067942 - Change error message for attempted getter-only property writes to include the property name. r=terrence,Ms2ger --HG-- extra : rebase_source : ebe2b8d794145d96198235151de70b2b3dbc846e --- .../source/test/test-ui-action-button.js | 2 +- addon-sdk/source/test/test-ui-sidebar.js | 2 +- .../source/test/test-ui-toggle-button.js | 2 +- js/src/js.msg | 2 +- js/src/jscntxtinlines.h | 2 +- js/src/jsobj.cpp | 22 +++++++++++-------- js/src/jsobj.h | 2 +- js/src/vm/Shape-inl.h | 2 +- js/xpconnect/src/XPCQuickStubs.cpp | 2 +- 9 files changed, 21 insertions(+), 17 deletions(-) diff --git a/addon-sdk/source/test/test-ui-action-button.js b/addon-sdk/source/test/test-ui-action-button.js index 6dd76ff9a72a..9083b35be908 100644 --- a/addon-sdk/source/test/test-ui-action-button.js +++ b/addon-sdk/source/test/test-ui-action-button.js @@ -253,7 +253,7 @@ exports['test button global state updated'] = function(assert) { // check read-only properties assert.throws(() => button.id = 'another-id', - /^setting a property that has only a getter/, + /^setting getter-only property/, 'id cannot be set at runtime'); assert.equal(button.id, 'my-button-4', diff --git a/addon-sdk/source/test/test-ui-sidebar.js b/addon-sdk/source/test/test-ui-sidebar.js index 3342f9ceb474..0737e275f0b8 100644 --- a/addon-sdk/source/test/test-ui-sidebar.js +++ b/addon-sdk/source/test/test-ui-sidebar.js @@ -1074,7 +1074,7 @@ exports.testSidebarGettersAndSettersAfterDestroy = function(assert) { assert.equal(sidebar.id, undefined, 'sidebar after destroy has no id'); assert.throws(() => sidebar.id = 'foo-tang', - /^setting a property that has only a getter/, + /^setting getter-only property/, 'id cannot be set at runtime'); assert.equal(sidebar.id, undefined, 'sidebar after destroy has no id'); diff --git a/addon-sdk/source/test/test-ui-toggle-button.js b/addon-sdk/source/test/test-ui-toggle-button.js index 03c2e084b217..930491df6240 100644 --- a/addon-sdk/source/test/test-ui-toggle-button.js +++ b/addon-sdk/source/test/test-ui-toggle-button.js @@ -263,7 +263,7 @@ exports['test button global state updated'] = function(assert) { // check read-only properties assert.throws(() => button.id = 'another-id', - /^setting a property that has only a getter/, + /^setting getter-only property/, 'id cannot be set at runtime'); assert.equal(button.id, 'my-button-4', diff --git a/js/src/js.msg b/js/src/js.msg index 248286b6a081..79680e57de9e 100644 --- a/js/src/js.msg +++ b/js/src/js.msg @@ -63,7 +63,7 @@ MSG_DEF(JSMSG_BAD_GETTER_OR_SETTER, 1, JSEXN_TYPEERR, "invalid {0} usage") MSG_DEF(JSMSG_BAD_ARRAY_LENGTH, 0, JSEXN_RANGEERR, "invalid array length") MSG_DEF(JSMSG_REDECLARED_VAR, 2, JSEXN_TYPEERR, "redeclaration of {0} {1}") MSG_DEF(JSMSG_UNDECLARED_VAR, 1, JSEXN_REFERENCEERR, "assignment to undeclared variable {0}") -MSG_DEF(JSMSG_GETTER_ONLY, 0, JSEXN_TYPEERR, "setting a property that has only a getter") +MSG_DEF(JSMSG_GETTER_ONLY, 1, JSEXN_TYPEERR, "setting getter-only property {0}") MSG_DEF(JSMSG_UNDEFINED_PROP, 1, JSEXN_REFERENCEERR, "reference to undefined property {0}") MSG_DEF(JSMSG_INVALID_MAP_ITERABLE, 0, JSEXN_TYPEERR, "iterable for map should have array-like objects") MSG_DEF(JSMSG_NESTING_GENERATOR, 0, JSEXN_TYPEERR, "already executing generator") diff --git a/js/src/jscntxtinlines.h b/js/src/jscntxtinlines.h index e2e080a36f20..3bd52725556f 100644 --- a/js/src/jscntxtinlines.h +++ b/js/src/jscntxtinlines.h @@ -335,7 +335,7 @@ CallSetter(JSContext *cx, HandleObject obj, HandleId id, StrictPropertyOp op, un } if (attrs & JSPROP_GETTER) - return js_ReportGetterOnlyAssignment(cx, strict); + return js_ReportGetterOnlyAssignment(cx, id, strict); return CallJSPropertyOpSetter(cx, op, obj, id, strict, vp); } diff --git a/js/src/jsobj.cpp b/js/src/jsobj.cpp index fd1fbbf74212..41967a5f0111 100644 --- a/js/src/jsobj.cpp +++ b/js/src/jsobj.cpp @@ -5008,7 +5008,7 @@ js::NativeSet(typename ExecutionModeTraits::ContextType cxArg, * or throw if we're in strict mode. */ if (!shape->hasGetterValue() && shape->hasDefaultSetter()) - return js_ReportGetterOnlyAssignment(cx, strict); + return js_ReportGetterOnlyAssignment(cx, shape->propid(), strict); } RootedValue ovp(cx, vp); @@ -5511,7 +5511,7 @@ baseops::SetPropertyHelper(typename ExecutionModeTraits::ContextType cxArg if (mode == ParallelExecution) return !strict; - return js_ReportGetterOnlyAssignment(cxArg->asJSContext(), strict); + return js_ReportGetterOnlyAssignment(cxArg->asJSContext(), id, strict); } } else { JS_ASSERT(shape->isDataDescriptor()); @@ -6172,14 +6172,18 @@ js_GetObjectSlotName(JSTracer *trc, char *buf, size_t bufsize) } bool -js_ReportGetterOnlyAssignment(JSContext *cx, bool strict) +js_ReportGetterOnlyAssignment(JSContext *cx, jsid id, bool strict) { - return JS_ReportErrorFlagsAndNumber(cx, - strict - ? JSREPORT_ERROR - : JSREPORT_WARNING | JSREPORT_STRICT, - js_GetErrorMessage, nullptr, - JSMSG_GETTER_ONLY); + RootedValue val(cx, IdToValue(id)); + return js_ReportValueErrorFlags(cx, + strict + ? JSREPORT_ERROR + : JSREPORT_WARNING | JSREPORT_STRICT, + JSMSG_GETTER_ONLY, + JSDVG_IGNORE_STACK, + val, + js::NullPtr(), + nullptr, nullptr); } #ifdef DEBUG diff --git a/js/src/jsobj.h b/js/src/jsobj.h index 988c5d0a296f..ae2f2351965c 100644 --- a/js/src/jsobj.h +++ b/js/src/jsobj.h @@ -1598,7 +1598,7 @@ extern void js_GetObjectSlotName(JSTracer *trc, char *buf, size_t bufsize); extern bool -js_ReportGetterOnlyAssignment(JSContext *cx, bool strict); +js_ReportGetterOnlyAssignment(JSContext *cx, jsid id, bool strict); namespace js { diff --git a/js/src/vm/Shape-inl.h b/js/src/vm/Shape-inl.h index 75e8a3d342a8..ff8f3541d0aa 100644 --- a/js/src/vm/Shape-inl.h +++ b/js/src/vm/Shape-inl.h @@ -96,7 +96,7 @@ Shape::set(JSContext* cx, HandleObject obj, HandleObject receiver, bool strict, } if (attrs & JSPROP_GETTER) - return js_ReportGetterOnlyAssignment(cx, strict); + return js_ReportGetterOnlyAssignment(cx, propid(), strict); RootedId id(cx, propid()); diff --git a/js/xpconnect/src/XPCQuickStubs.cpp b/js/xpconnect/src/XPCQuickStubs.cpp index eb1ad532b60a..ea117aaf6892 100644 --- a/js/xpconnect/src/XPCQuickStubs.cpp +++ b/js/xpconnect/src/XPCQuickStubs.cpp @@ -394,7 +394,7 @@ xpc_qsGetterOnlyNativeStub(JSContext *cx, unsigned argc, jsval *vp) JSREPORT_WARNING | JSREPORT_STRICT | JSREPORT_STRICT_MODE_ERROR, js_GetErrorMessage, nullptr, - JSMSG_GETTER_ONLY); + JSMSG_GETTER_ONLY, ""); } xpc_qsDOMString::xpc_qsDOMString(JSContext *cx, HandleValue v, From 9c18e9fc86830f69edcf406b3e3884cb7ff8912f Mon Sep 17 00:00:00 2001 From: Ryan VanderMeulen Date: Wed, 1 Oct 2014 12:33:30 -0400 Subject: [PATCH 38/63] Backed out 11 changesets (bug 1065185) for Gaia Python integration test failures on a CLOSED TREE. Backed out changeset a45d02c3b4e8 (bug 1065185) Backed out changeset bb7b8b0da990 (bug 1065185) Backed out changeset 7672d57acbad (bug 1065185) Backed out changeset fbdb5bead639 (bug 1065185) Backed out changeset 54d6077015da (bug 1065185) Backed out changeset e2528549de9d (bug 1065185) Backed out changeset 981c0b7c897d (bug 1065185) Backed out changeset 903fbf9bb0c7 (bug 1065185) Backed out changeset 76e863b63dd8 (bug 1065185) Backed out changeset 6871aff5d103 (bug 1065185) Backed out changeset cc213ad991a8 (bug 1065185) --- dom/bluetooth/tests/marionette/head.js | 11 ++--------- dom/bluetooth2/tests/marionette/head.js | 11 ++--------- dom/cellbroadcast/tests/marionette/head.js | 10 +--------- dom/ipc/tests/test_CrashService_crash.html | 6 +++--- dom/mobilemessage/tests/marionette/head.js | 10 +--------- dom/permission/tests/file_framework.js | 6 ++++-- dom/plugins/test/mochitest/utils.js | 4 ++-- dom/system/gonk/RILContentHelper.js | 5 ++--- dom/telephony/test/marionette/head.js | 11 +---------- dom/tethering/tests/marionette/head.js | 11 ++--------- dom/voicemail/test/marionette/head.js | 14 +++----------- dom/wifi/DOMWifiManager.js | 2 +- dom/wifi/test/marionette/head.js | 10 +--------- js/xpconnect/tests/chrome/test_bug760109.xul | 6 +----- js/xpconnect/tests/unit/test_bug853709.js | 1 - js/xpconnect/wrappers/AccessCheck.cpp | 8 ++++++++ toolkit/devtools/server/actors/call-watcher.js | 14 +++++--------- toolkit/devtools/server/actors/webgl.js | 4 +--- .../extensions/test/mochitest/test_bug687194.html | 10 +++++----- 19 files changed, 45 insertions(+), 109 deletions(-) diff --git a/dom/bluetooth/tests/marionette/head.js b/dom/bluetooth/tests/marionette/head.js index 65fd7828a739..893ee78c060e 100644 --- a/dom/bluetooth/tests/marionette/head.js +++ b/dom/bluetooth/tests/marionette/head.js @@ -43,15 +43,8 @@ const BT_PAIRING_REQ = "bluetooth-pairing-request"; const BT_PAIRING_PASSKEY = 123456; const BT_PAIRING_PINCODE = "ABCDEFG"; -// Emulate Promise.jsm semantics. -Promise.defer = function() { return new Deferred(); } -function Deferred() { - this.promise = new Promise(function(resolve, reject) { - this.resolve = resolve; - this.reject = reject; - }.bind(this)); - Object.freeze(this); -} +let Promise = + SpecialPowers.Cu.import("resource://gre/modules/Promise.jsm").Promise; let bluetoothManager; diff --git a/dom/bluetooth2/tests/marionette/head.js b/dom/bluetooth2/tests/marionette/head.js index ed5c5abe1693..07f456e6e8e3 100644 --- a/dom/bluetooth2/tests/marionette/head.js +++ b/dom/bluetooth2/tests/marionette/head.js @@ -36,15 +36,8 @@ const BDADDR_LOCAL = "ff:ff:ff:00:00:00"; // A user friendly name for remote BT device. const REMOTE_DEVICE_NAME = "Remote_BT_Device"; -// Emulate Promise.jsm semantics. -Promise.defer = function() { return new Deferred(); } -function Deferred() { - this.promise = new Promise(function(resolve, reject) { - this.resolve = resolve; - this.reject = reject; - }.bind(this)); - Object.freeze(this); -} +let Promise = + SpecialPowers.Cu.import("resource://gre/modules/Promise.jsm").Promise; let bluetoothManager; diff --git a/dom/cellbroadcast/tests/marionette/head.js b/dom/cellbroadcast/tests/marionette/head.js index ed8de0446008..95d039cdbbdb 100644 --- a/dom/cellbroadcast/tests/marionette/head.js +++ b/dom/cellbroadcast/tests/marionette/head.js @@ -3,15 +3,7 @@ const {Cc: Cc, Ci: Ci, Cr: Cr, Cu: Cu} = SpecialPowers; -// Emulate Promise.jsm semantics. -Promise.defer = function() { return new Deferred(); } -function Deferred() { - this.promise = new Promise(function(resolve, reject) { - this.resolve = resolve; - this.reject = reject; - }.bind(this)); - Object.freeze(this); -} +let Promise = Cu.import("resource://gre/modules/Promise.jsm").Promise; const PDU_DCS_CODING_GROUP_BITS = 0xF0; const PDU_DCS_MSG_CODING_7BITS_ALPHABET = 0x00; diff --git a/dom/ipc/tests/test_CrashService_crash.html b/dom/ipc/tests/test_CrashService_crash.html index eb9afcf04964..ce94119bc54d 100644 --- a/dom/ipc/tests/test_CrashService_crash.html +++ b/dom/ipc/tests/test_CrashService_crash.html @@ -55,10 +55,10 @@ SpecialPowers.pushPrefEnv({'set':[ // Finally, poll for the new crash record. function tryGetCrash() { info("Waiting for getCrashes"); - crashMan.getCrashes().then(SpecialPowers.wrapCallback(function (crashes) { + crashMan.getCrashes().then(function (crashes) { if (crashes.length) { is(crashes.length, 1, "There should be only one record"); - var crash = crashes[0]; + var crash = SpecialPowers.wrap(crashes[0]); ok(crash.isOfType(crashMan.PROCESS_TYPE_CONTENT, crashMan.CRASH_TYPE_CRASH), "Record should be a content crash"); @@ -75,7 +75,7 @@ SpecialPowers.pushPrefEnv({'set':[ else { setTimeout(tryGetCrash, 1000); } - }), function (err) { + }, function (err) { ok(false, "Error getting crashes: " + err); SimpleTest.finish(); }); diff --git a/dom/mobilemessage/tests/marionette/head.js b/dom/mobilemessage/tests/marionette/head.js index f4eb83882d41..c78720415567 100644 --- a/dom/mobilemessage/tests/marionette/head.js +++ b/dom/mobilemessage/tests/marionette/head.js @@ -3,15 +3,7 @@ const {Cc: Cc, Ci: Ci, Cr: Cr, Cu: Cu} = SpecialPowers; -// Emulate Promise.jsm semantics. -Promise.defer = function() { return new Deferred(); } -function Deferred() { - this.promise = new Promise(function(resolve, reject) { - this.resolve = resolve; - this.reject = reject; - }.bind(this)); - Object.freeze(this); -} +let Promise = Cu.import("resource://gre/modules/Promise.jsm").Promise; /** * Push a list of preference settings. Never reject. diff --git a/dom/permission/tests/file_framework.js b/dom/permission/tests/file_framework.js index 9030be02c88d..e05d479946ae 100644 --- a/dom/permission/tests/file_framework.js +++ b/dom/permission/tests/file_framework.js @@ -168,9 +168,11 @@ function expandPermissions(aPerms) { var perms = []; aPerms.forEach(function(el) { var access = permTable[el].access ? "readwrite" : null; - var expanded = expand(el, access); + var expanded = SpecialPowers.unwrap(expand(el, access)); + // COW arrays don't behave array-like enough, to allow + // using expanded.slice(0) here. for (let i = 0; i < expanded.length; i++) { - perms.push(SpecialPowers.unwrap(expanded[i])); + perms.push(expanded[i]); } }); diff --git a/dom/plugins/test/mochitest/utils.js b/dom/plugins/test/mochitest/utils.js index a20ec57d0225..2d7299cb69af 100644 --- a/dom/plugins/test/mochitest/utils.js +++ b/dom/plugins/test/mochitest/utils.js @@ -69,7 +69,7 @@ function crashAndGetCrashServiceRecord(crashMethodName, callback) { // the new record. function tryGetCrash() { info("Waiting for getCrashes"); - crashMan.getCrashes().then(SpecialPowers.wrapCallback(function (crashes) { + crashMan.getCrashes().then(function (crashes) { if (crashes.length) { is(crashes.length, 1, "There should be only one record"); var crash = SpecialPowers.wrap(crashes[0]); @@ -86,7 +86,7 @@ function crashAndGetCrashServiceRecord(crashMethodName, callback) { else { setTimeout(tryGetCrash, 1000); } - }), function (err) { + }, function (err) { ok(false, "Error getting crashes: " + err); SimpleTest.finish(); }); diff --git a/dom/system/gonk/RILContentHelper.js b/dom/system/gonk/RILContentHelper.js index e8524ba77657..0861ccbc7f54 100644 --- a/dom/system/gonk/RILContentHelper.js +++ b/dom/system/gonk/RILContentHelper.js @@ -799,8 +799,7 @@ RILContentHelper.prototype = { let window = this._windowsMap[message.requestId]; delete this._windowsMap[message.requestId]; let contacts = message.contacts; - let result = new window.Array(); - contacts.forEach(function(c) { + let result = contacts.map(function(c) { let prop = {name: [c.alphaId], tel: [{value: c.number}]}; if (c.email) { @@ -815,7 +814,7 @@ RILContentHelper.prototype = { let contact = new window.mozContact(prop); contact.id = c.contactId; - result.push(contact); + return contact; }); this.fireRequestSuccess(message.requestId, result); diff --git a/dom/telephony/test/marionette/head.js b/dom/telephony/test/marionette/head.js index ea7ea2933ef6..41481d7f1c0b 100644 --- a/dom/telephony/test/marionette/head.js +++ b/dom/telephony/test/marionette/head.js @@ -1,16 +1,7 @@ /* Any copyright is dedicated to the Public Domain. * http://creativecommons.org/publicdomain/zero/1.0/ */ -// Emulate Promise.jsm semantics. -Promise.defer = function() { return new Deferred(); } -function Deferred() { - this.promise = new Promise(function(resolve, reject) { - this.resolve = resolve; - this.reject = reject; - }.bind(this)); - Object.freeze(this); -} - +let Promise = SpecialPowers.Cu.import("resource://gre/modules/Promise.jsm").Promise; let telephony; let conference; diff --git a/dom/tethering/tests/marionette/head.js b/dom/tethering/tests/marionette/head.js index bd2731b64ec0..4e2c56808409 100644 --- a/dom/tethering/tests/marionette/head.js +++ b/dom/tethering/tests/marionette/head.js @@ -25,15 +25,8 @@ const TETHERING_SETTING_KEY = "1234567890"; const SETTINGS_RIL_DATA_ENABLED = 'ril.data.enabled'; -// Emulate Promise.jsm semantics. -Promise.defer = function() { return new Deferred(); } -function Deferred() { - this.promise = new Promise(function(resolve, reject) { - this.resolve = resolve; - this.reject = reject; - }.bind(this)); - Object.freeze(this); -} +let Promise = + SpecialPowers.Cu.import("resource://gre/modules/Promise.jsm").Promise; let gTestSuite = (function() { let suite = {}; diff --git a/dom/voicemail/test/marionette/head.js b/dom/voicemail/test/marionette/head.js index e9ba49a9f1e1..f3f8b1b17c74 100644 --- a/dom/voicemail/test/marionette/head.js +++ b/dom/voicemail/test/marionette/head.js @@ -5,18 +5,10 @@ const {Cc: Cc, Ci: Ci, Cr: Cr, Cu: Cu} = SpecialPowers; -let RIL = SpecialPowers.wrap(SpecialPowers.createBlankObject()); -SpecialPowers.Cu.import("resource://gre/modules/ril_consts.js", RIL); +let RIL = {}; +Cu.import("resource://gre/modules/ril_consts.js", RIL); -// Emulate Promise.jsm semantics. -Promise.defer = function() { return new Deferred(); } -function Deferred() { - this.promise = new Promise(function(resolve, reject) { - this.resolve = resolve; - this.reject = reject; - }.bind(this)); - Object.freeze(this); -} +let Promise = Cu.import("resource://gre/modules/Promise.jsm").Promise; const MWI_PDU_PREFIX = "0000"; const MWI_PDU_UDH_PREFIX = "0040"; diff --git a/dom/wifi/DOMWifiManager.js b/dom/wifi/DOMWifiManager.js index 300b06d1948c..e1a8f9b7cda0 100644 --- a/dom/wifi/DOMWifiManager.js +++ b/dom/wifi/DOMWifiManager.js @@ -160,7 +160,7 @@ DOMWifiManager.prototype = { }, _convertWifiNetworks: function(aNetworks) { - let networks = new this._window.Array(); + let networks = []; for (let i in aNetworks) { networks.push(this._convertWifiNetwork(aNetworks[i])); } diff --git a/dom/wifi/test/marionette/head.js b/dom/wifi/test/marionette/head.js index dd28995bae07..c6981fd7181c 100644 --- a/dom/wifi/test/marionette/head.js +++ b/dom/wifi/test/marionette/head.js @@ -1,15 +1,7 @@ /* Any copyright is dedicated to the Public Domain. * http://creativecommons.org/publicdomain/zero/1.0/ */ -// Emulate Promise.jsm semantics. -Promise.defer = function() { return new Deferred(); } -function Deferred() { - this.promise = new Promise(function(resolve, reject) { - this.resolve = resolve; - this.reject = reject; - }.bind(this)); - Object.freeze(this); -} +let Promise = SpecialPowers.Cu.import('resource://gre/modules/Promise.jsm').Promise; const STOCK_HOSTAPD_NAME = 'goldfish-hostapd'; const HOSTAPD_CONFIG_PATH = '/data/misc/wifi/remote-hostapd/'; diff --git a/js/xpconnect/tests/chrome/test_bug760109.xul b/js/xpconnect/tests/chrome/test_bug760109.xul index b71f094056c7..d8045d464524 100644 --- a/js/xpconnect/tests/chrome/test_bug760109.xul +++ b/js/xpconnect/tests/chrome/test_bug760109.xul @@ -80,11 +80,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=760109 const Cu = Components.utils; var sb = new Cu.Sandbox('http://www.example.org'); sb.chromeArray = ['a', 'b', 'z']; - sb.chromeArray.__exposedProps__ = { length: 'rw' }; - for (var i = 0; i < 10; ++i) { - sb.chromeArray.__exposedProps__[i] = 'rw'; - } - + sb.chromeArray.__exposedProps__ = {}; sb.chromeObject = new SomeConstructor(); sb.ok = ok; sb.is = is; diff --git a/js/xpconnect/tests/unit/test_bug853709.js b/js/xpconnect/tests/unit/test_bug853709.js index 6e80759ae546..502c656425ea 100644 --- a/js/xpconnect/tests/unit/test_bug853709.js +++ b/js/xpconnect/tests/unit/test_bug853709.js @@ -7,7 +7,6 @@ function setupChromeSandbox() { get: function() { return _b; }, set: function(val) { _b = val; } }); this.chromeArr = [4, 2, 1]; - this.chromeArr["__exposedProps__"] = { "1": "rw" }; } function checkDefineThrows(sb, obj, prop, desc) { diff --git a/js/xpconnect/wrappers/AccessCheck.cpp b/js/xpconnect/wrappers/AccessCheck.cpp index dcf9711d3417..b238dd217f6a 100644 --- a/js/xpconnect/wrappers/AccessCheck.cpp +++ b/js/xpconnect/wrappers/AccessCheck.cpp @@ -248,6 +248,14 @@ ExposedPropertiesOnly::check(JSContext *cx, HandleObject wrapper, HandleId id, W if (!JS_HasPropertyById(cx, wrappedObject, exposedPropsId, &found)) return false; + // Always permit access to "length" and indexed properties of arrays. + if ((JS_IsArrayObject(cx, wrappedObject) || + JS_IsTypedArrayObject(wrappedObject)) && + ((JSID_IS_INT(id) && JSID_TO_INT(id) >= 0) || + (JSID_IS_STRING(id) && JS_FlatStringEqualsAscii(JSID_TO_FLAT_STRING(id), "length")))) { + return true; // Allow + } + // If no __exposedProps__ existed, deny access. if (!found) { return false; diff --git a/toolkit/devtools/server/actors/call-watcher.js b/toolkit/devtools/server/actors/call-watcher.js index 990858480d73..b8483858af4b 100644 --- a/toolkit/devtools/server/actors/call-watcher.js +++ b/toolkit/devtools/server/actors/call-watcher.js @@ -412,13 +412,11 @@ let CallWatcherActor = exports.CallWatcherActor = protocol.ActorClass({ * Instruments a function on the specified target object. */ function overrideFunction(global, target, name, descriptor, callback) { - // Invoking .apply on an unxrayed content function doesn't work, because - // the arguments array is inaccessible to it. Get Xrays back. - let originalFunc = Cu.unwaiveXrays(target[name]); + let originalFunc = target[name]; Object.defineProperty(target, name, { value: function(...args) { - let result = Cu.waiveXrays(originalFunc.apply(this, args)); + let result = originalFunc.apply(this, args); if (self._recording) { let stack = getStack(name); @@ -437,15 +435,13 @@ let CallWatcherActor = exports.CallWatcherActor = protocol.ActorClass({ * Instruments a getter or setter on the specified target object. */ function overrideAccessor(global, target, name, descriptor, callback) { - // Invoking .apply on an unxrayed content function doesn't work, because - // the arguments array is inaccessible to it. Get Xrays back. - let originalGetter = Cu.unwaiveXrays(target.__lookupGetter__(name)); - let originalSetter = Cu.unwaiveXrays(target.__lookupSetter__(name)); + let originalGetter = target.__lookupGetter__(name); + let originalSetter = target.__lookupSetter__(name); Object.defineProperty(target, name, { get: function(...args) { if (!originalGetter) return undefined; - let result = Cu.waiveXrays(originalGetter.apply(this, args)); + let result = originalGetter.apply(this, args); if (self._recording) { let stack = getStack(name); diff --git a/toolkit/devtools/server/actors/webgl.js b/toolkit/devtools/server/actors/webgl.js index 21e9165b08db..afeeb0d32d00 100644 --- a/toolkit/devtools/server/actors/webgl.js +++ b/toolkit/devtools/server/actors/webgl.js @@ -492,9 +492,7 @@ let WebGLInstrumenter = { if (glBreak) return undefined; } - // Invoking .apply on an unxrayed content function doesn't work, because - // the arguments array is inaccessible to it. Get Xrays back. - let glResult = Cu.waiveXrays(Cu.unwaiveXrays(originalFunc).apply(this, glArgs)); + let glResult = originalFunc.apply(this, glArgs); if (timing >= 0 && !observer.suppressHandlers) { let glBreak = observer[afterFuncName](glArgs, glResult, cache, proxy); diff --git a/toolkit/mozapps/extensions/test/mochitest/test_bug687194.html b/toolkit/mozapps/extensions/test/mochitest/test_bug687194.html index 8f99ea73a2a3..010b8b6f3c8e 100644 --- a/toolkit/mozapps/extensions/test/mochitest/test_bug687194.html +++ b/toolkit/mozapps/extensions/test/mochitest/test_bug687194.html @@ -60,11 +60,11 @@ "http://mochi.test:8888/tests/toolkit/mozapps/extensions/test/mochitest/file_bug687194.xpi" AddonManager.getInstallForURL(INSTALL_URI, (install) => { install = SpecialPowers.wrap(install); - install.addListener(SpecialPowers.wrapCallbackObject({ + install.addListener({ onInstallEnded: function(install, addon) { SimpleTest.executeSoon(() => test.next(addon)); } - })); + }); install.install(); }, "application/x-xpinstall"); @@ -75,14 +75,14 @@ lastResult = yield; is(lastResult.threw, false, "able to resolve after the installation"); - let listener = SpecialPowers.wrapCallbackObject({ + let listener = { onUninstalled: function(removedAddon) { - if (removedAddon.id === addon.id) { + if (SpecialPowers.wrap(removedAddon).id === addon.id) { AddonManager.removeAddonListener(listener); SimpleTest.executeSoon(() => test.next()); } } - }); + }; AddonManager.addAddonListener(listener); addon.uninstall(); From bc57adfb175d053ad3a249feea6b6d36a4327945 Mon Sep 17 00:00:00 2001 From: Bill McCloskey Date: Wed, 1 Oct 2014 09:58:54 -0700 Subject: [PATCH 39/63] Bug 1071409 - Eliminate potential CPOW hang (r=dvander) --- ipc/glue/MessageChannel.cpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/ipc/glue/MessageChannel.cpp b/ipc/glue/MessageChannel.cpp index 8ba8b2c55ea4..7e4fef35b9ed 100644 --- a/ipc/glue/MessageChannel.cpp +++ b/ipc/glue/MessageChannel.cpp @@ -731,11 +731,19 @@ MessageChannel::SendAndWait(Message* aMsg, Message* aReply) return false; } - if (mPendingUrgentRequest && !ProcessPendingUrgentRequest()) - return false; + // We need to make sure that all messages deposited in mPendingRPCCall + // and mPendingUrgentRequest are dispatched before we leave this + // function. Otherwise, there's nothing to wake us up and force us to + // dispatch them. + while (mPendingUrgentRequest) { + if (!ProcessPendingUrgentRequest()) + return false; + } - if (mPendingRPCCall && !ProcessPendingRPCCall()) - return false; + while (mPendingRPCCall) { + if (!ProcessPendingRPCCall()) + return false; + } if (mRecvd) { NS_ABORT_IF_FALSE(mRecvd->is_reply(), "expected reply"); From 775c7c7a42bfa457091f469ff2e7c4858ecc501d Mon Sep 17 00:00:00 2001 From: Bill McCloskey Date: Wed, 1 Oct 2014 09:58:56 -0700 Subject: [PATCH 40/63] Bug 1059007 - [e10s] Enable most session store tests (r=ttaubert) --- browser/components/sessionstore/test/browser.ini | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/browser/components/sessionstore/test/browser.ini b/browser/components/sessionstore/test/browser.ini index d862e14a481e..63899ac6344b 100644 --- a/browser/components/sessionstore/test/browser.ini +++ b/browser/components/sessionstore/test/browser.ini @@ -8,7 +8,6 @@ # browser_580512.js is disabled for leaking browser windows (bug 752467) [DEFAULT] -skip-if = e10s support-files = head.js content.js @@ -67,6 +66,7 @@ support-files = [browser_capabilities.js] [browser_cleaner.js] [browser_dying_cache.js] +skip-if = e10s [browser_dynamic_frames.js] [browser_form_restore_events.js] [browser_formdata.js] @@ -83,10 +83,13 @@ skip-if = buildapp == 'mulet' [browser_privatetabs.js] [browser_scrollPositions.js] [browser_sessionHistory.js] +skip-if = e10s [browser_sessionStorage.js] +skip-if = e10s [browser_swapDocShells.js] skip-if = e10s # See bug 918634 [browser_telemetry.js] +skip-if = e10s [browser_upgrade_backup.js] [browser_windowRestore_perwindowpb.js] [browser_248970_b_perwindowpb.js] @@ -104,8 +107,10 @@ skip-if = true skip-if = true [browser_394759_behavior.js] [browser_394759_perwindowpb.js] +skip-if = e10s [browser_394759_purge.js] [browser_423132.js] +skip-if = e10s [browser_447951.js] [browser_454908.js] [browser_456342.js] @@ -119,6 +124,7 @@ skip-if = true [browser_467409-backslashplosion.js] [browser_477657.js] [browser_480893.js] +skip-if = e10s [browser_485482.js] [browser_485563.js] [browser_490040.js] From dbb11fdd672582f2d77c9187f5f3668b2f69146e Mon Sep 17 00:00:00 2001 From: Ryan VanderMeulen Date: Wed, 1 Oct 2014 13:04:02 -0400 Subject: [PATCH 41/63] Backed out changeset 11f95edf23a4 (bug 1073615) for frequent mochitest-bc timeouts. --- content/media/MediaStreamGraph.cpp | 49 +++++-------------- content/media/MediaStreamGraphImpl.h | 5 -- content/media/webaudio/AudioContext.cpp | 6 +++ content/media/webaudio/AudioContext.h | 1 + .../webaudio/test/test_mozaudiochannel.html | 18 ++++--- dom/webidl/AudioContext.webidl | 4 +- 6 files changed, 33 insertions(+), 50 deletions(-) diff --git a/content/media/MediaStreamGraph.cpp b/content/media/MediaStreamGraph.cpp index f033ce576f5e..fc7f1e6577bb 100644 --- a/content/media/MediaStreamGraph.cpp +++ b/content/media/MediaStreamGraph.cpp @@ -63,7 +63,7 @@ PRLogModuleInfo* gMediaStreamGraphLog; /** * The singleton graph instance. */ -static nsDataHashtable gGraphs; +static MediaStreamGraphImpl* gGraph; MediaStreamGraphImpl::~MediaStreamGraphImpl() { @@ -1633,10 +1633,9 @@ MediaStreamGraphImpl::RunInStableState(bool aSourceIsMSG) NS_DispatchToMainThread(event); LIFECYCLE_LOG("Disconnecting MediaStreamGraph %p", this); - MediaStreamGraphImpl* graph; - if (gGraphs.Get(mAudioChannel, &graph) && graph == this) { + if (this == gGraph) { // null out gGraph if that's the graph being shut down - gGraphs.Remove(mAudioChannel); + gGraph = nullptr; } } } else { @@ -1787,12 +1786,9 @@ MediaStreamGraphImpl::AppendMessage(ControlMessage* aMessage) delete aMessage; if (IsEmpty() && mLifecycleState >= LIFECYCLE_WAITING_FOR_STREAM_DESTRUCTION) { - - MediaStreamGraphImpl* graph; - if (gGraphs.Get(mAudioChannel, &graph) && graph == this) { - gGraphs.Remove(mAudioChannel); + if (gGraph == this) { + gGraph = nullptr; } - Destroy(); } return; @@ -2740,7 +2736,6 @@ MediaStreamGraphImpl::MediaStreamGraphImpl(bool aRealtime, #ifdef DEBUG , mCanRunMessagesSynchronously(false) #endif - , mAudioChannel(static_cast(aChannel)) { #ifdef PR_LOGGING if (!gMediaStreamGraphLog) { @@ -2779,26 +2774,15 @@ NS_IMPL_ISUPPORTS(MediaStreamGraphShutdownObserver, nsIObserver) static bool gShutdownObserverRegistered = false; -namespace { - -PLDHashOperator -ForceShutdownEnumerator(const uint32_t& /* aAudioChannel */, - MediaStreamGraphImpl* aGraph, - void* /* aUnused */) -{ - aGraph->ForceShutDown(); - return PL_DHASH_NEXT; -} - -} // anonymous namespace - NS_IMETHODIMP MediaStreamGraphShutdownObserver::Observe(nsISupports *aSubject, const char *aTopic, const char16_t *aData) { if (strcmp(aTopic, NS_XPCOM_SHUTDOWN_OBSERVER_ID) == 0) { - gGraphs.EnumerateRead(ForceShutdownEnumerator, nullptr); + if (gGraph) { + gGraph->ForceShutDown(); + } nsContentUtils::UnregisterShutdownObserver(this); gShutdownObserverRegistered = false; } @@ -2810,10 +2794,7 @@ MediaStreamGraph::GetInstance(DOMMediaStream::TrackTypeHints aHint, dom::AudioCh { NS_ASSERTION(NS_IsMainThread(), "Main thread only"); - uint32_t channel = static_cast(aChannel); - MediaStreamGraphImpl* graph = nullptr; - - if (!gGraphs.Get(channel, &graph)) { + if (!gGraph) { if (!gShutdownObserverRegistered) { gShutdownObserverRegistered = true; nsContentUtils::RegisterShutdownObserver(new MediaStreamGraphShutdownObserver()); @@ -2821,13 +2802,12 @@ MediaStreamGraph::GetInstance(DOMMediaStream::TrackTypeHints aHint, dom::AudioCh CubebUtils::InitPreferredSampleRate(); - graph = new MediaStreamGraphImpl(true, CubebUtils::PreferredSampleRate(), aHint, aChannel); - gGraphs.Put(channel, graph); + gGraph = new MediaStreamGraphImpl(true, CubebUtils::PreferredSampleRate(), aHint, aChannel); - STREAM_LOG(PR_LOG_DEBUG, ("Starting up MediaStreamGraph %p", graph)); + STREAM_LOG(PR_LOG_DEBUG, ("Starting up MediaStreamGraph %p", gGraph)); } - return graph; + return gGraph; } MediaStreamGraph* @@ -2998,10 +2978,7 @@ MediaStreamGraph::CreateAudioNodeStream(AudioNodeEngine* aEngine, bool MediaStreamGraph::IsNonRealtime() const { - const MediaStreamGraphImpl* impl = static_cast(this); - MediaStreamGraphImpl* graph; - - return !gGraphs.Get(impl->AudioChannel(), &graph) || graph != impl; + return this != gGraph; } void diff --git a/content/media/MediaStreamGraphImpl.h b/content/media/MediaStreamGraphImpl.h index e8193ce64f7b..690dc6ff8bfd 100644 --- a/content/media/MediaStreamGraphImpl.h +++ b/content/media/MediaStreamGraphImpl.h @@ -654,8 +654,6 @@ public: nsRefPtr mFarendObserverRef; #endif - uint32_t AudioChannel() const { return mAudioChannel; } - private: virtual ~MediaStreamGraphImpl(); @@ -689,9 +687,6 @@ private: bool mCanRunMessagesSynchronously; #endif - // We use uint32_t instead AudioChannel because this is just used as key for - // the hashtable gGraphs. - uint32_t mAudioChannel; }; } diff --git a/content/media/webaudio/AudioContext.cpp b/content/media/webaudio/AudioContext.cpp index 929cbbda687e..fe249abe72b4 100644 --- a/content/media/webaudio/AudioContext.cpp +++ b/content/media/webaudio/AudioContext.cpp @@ -648,6 +648,12 @@ AudioContext::MozAudioChannelType() const return mDestination->MozAudioChannelType(); } +void +AudioContext::SetMozAudioChannelType(AudioChannel aValue, ErrorResult& aRv) +{ + mDestination->SetMozAudioChannelType(aValue, aRv); +} + AudioChannel AudioContext::TestAudioChannelInAudioNodeStream() { diff --git a/content/media/webaudio/AudioContext.h b/content/media/webaudio/AudioContext.h index d266c6f38480..857f66e790c9 100644 --- a/content/media/webaudio/AudioContext.h +++ b/content/media/webaudio/AudioContext.h @@ -222,6 +222,7 @@ public: JSObject* GetGlobalJSObject() const; AudioChannel MozAudioChannelType() const; + void SetMozAudioChannelType(AudioChannel aValue, ErrorResult& aRv); AudioChannel TestAudioChannelInAudioNodeStream(); diff --git a/content/media/webaudio/test/test_mozaudiochannel.html b/content/media/webaudio/test/test_mozaudiochannel.html index be6794432bea..bfe19b33bb34 100644 --- a/content/media/webaudio/test/test_mozaudiochannel.html +++ b/content/media/webaudio/test/test_mozaudiochannel.html @@ -18,23 +18,27 @@ function test_basic() { // Default is(ac.mozAudioChannelType, "normal", "Default ac channel == 'normal'"); + // random wrong channel + ac.mozAudioChannelType = "foo"; + is(ac.mozAudioChannelType, "normal", "Default ac channel == 'normal'"); + // Unpermitted channels - ac = new AudioContext("content"); + ac.mozAudioChannelType = "content"; is(ac.mozAudioChannelType, "normal", "Default ac channel == 'normal'"); - ac = new AudioContext("notification"); + ac.mozAudioChannelType = "notification"; is(ac.mozAudioChannelType, "normal", "Default ac channel == 'normal'"); - ac = new AudioContext("alarm"); + ac.mozAudioChannelType = "alarm"; is(ac.mozAudioChannelType, "normal", "Default ac channel == 'normal'"); - ac = new AudioContext("telephony"); + ac.mozAudioChannelType = "telephony"; is(ac.mozAudioChannelType, "normal", "Default ac channel == 'normal'"); - ac = new AudioContext("ringer"); + ac.mozAudioChannelType = "ringer"; is(ac.mozAudioChannelType, "normal", "Default ac channel == 'normal'"); - ac = new AudioContext("publicnotification"); + ac.mozAudioChannelType = "publicnotification"; is(ac.mozAudioChannelType, "normal", "Default ac channel == 'normal'"); runTest(); @@ -52,7 +56,7 @@ function test_permission(aChannel) { SpecialPowers.pushPermissions( [{ "type": "audio-channel-" + aChannel, "allow": true, "context": document }], function() { - var ac = new AudioContext(aChannel); + ac.mozAudioChannelType = aChannel; is(ac.mozAudioChannelType, aChannel, "Default ac channel == '" + aChannel + "'"); var channel = SpecialPowers.wrap(ac).testAudioChannelInAudioNodeStream(); diff --git a/dom/webidl/AudioContext.webidl b/dom/webidl/AudioContext.webidl index 6ad60b850a8b..bf51646abfee 100644 --- a/dom/webidl/AudioContext.webidl +++ b/dom/webidl/AudioContext.webidl @@ -78,8 +78,8 @@ interface AudioContext : EventTarget { // Mozilla extensions partial interface AudioContext { // Read AudioChannel.webidl for more information about this attribute. - [Pref="media.useAudioChannelService"] - readonly attribute AudioChannel mozAudioChannelType; + [Pref="media.useAudioChannelService", SetterThrows] + attribute AudioChannel mozAudioChannelType; // These 2 events are dispatched when the AudioContext object is muted by // the AudioChannelService. It's call 'interrupt' because when this event is From 6636444d56b2751ab6c01325dc2e65bba3dd1696 Mon Sep 17 00:00:00 2001 From: Kartikaya Gupta Date: Wed, 1 Oct 2014 13:13:02 -0400 Subject: [PATCH 42/63] Bug 1074944 - Add Inverse functions on Matrix and Matrix4x4. r=Bas --- gfx/2d/Matrix.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/gfx/2d/Matrix.h b/gfx/2d/Matrix.h index 8e2055c9f4a0..fc1060ac31ac 100644 --- a/gfx/2d/Matrix.h +++ b/gfx/2d/Matrix.h @@ -11,6 +11,7 @@ #include "Point.h" #include #include "mozilla/Attributes.h" +#include "mozilla/DebugOnly.h" namespace mozilla { namespace gfx { @@ -186,6 +187,14 @@ public: return true; } + Matrix Inverse() const + { + Matrix clone = *this; + DebugOnly inverted = clone.Invert(); + MOZ_ASSERT(inverted, "Attempted to get the inverse of a non-invertible matrix"); + return clone; + } + Float Determinant() const { return _11 * _22 - _12 * _21; @@ -671,6 +680,14 @@ public: bool Invert(); + Matrix4x4 Inverse() const + { + Matrix4x4 clone = *this; + DebugOnly inverted = clone.Invert(); + MOZ_ASSERT(inverted, "Attempted to get the inverse of a non-invertible matrix"); + return clone; + } + void Normalize() { for (int i = 0; i < 4; i++) { From 2a13eb6ad0e48e9016f228cc8df56fa23d53c5b1 Mon Sep 17 00:00:00 2001 From: Kartikaya Gupta Date: Wed, 1 Oct 2014 13:13:05 -0400 Subject: [PATCH 43/63] Bug 1074944 - Update APZ code to use Matrix4x4::Inverse() where possible. r=nical --- gfx/layers/apz/src/APZCTreeManager.cpp | 27 ++++++------------- gfx/layers/apz/src/AsyncPanZoomController.cpp | 5 ++-- .../composite/AsyncCompositionManager.cpp | 13 ++++----- 3 files changed, 15 insertions(+), 30 deletions(-) diff --git a/gfx/layers/apz/src/APZCTreeManager.cpp b/gfx/layers/apz/src/APZCTreeManager.cpp index 31b2f1dfaf38..3ae43311b648 100644 --- a/gfx/layers/apz/src/APZCTreeManager.cpp +++ b/gfx/layers/apz/src/APZCTreeManager.cpp @@ -902,17 +902,13 @@ TransformDisplacement(APZCTreeManager* aTreeManager, AsyncPanZoomController* aTarget, ScreenPoint& aStartPoint, ScreenPoint& aEndPoint) { - Matrix4x4 transformToApzc; - // Convert start and end points to untransformed screen coordinates. - transformToApzc = aTreeManager->GetScreenToApzcTransform(aSource); - Matrix4x4 untransformToApzc = transformToApzc; - untransformToApzc.Invert(); + Matrix4x4 untransformToApzc = aTreeManager->GetScreenToApzcTransform(aSource).Inverse(); ApplyTransform(&aStartPoint, untransformToApzc); ApplyTransform(&aEndPoint, untransformToApzc); // Convert start and end points to aTarget's transformed screen coordinates. - transformToApzc = aTreeManager->GetScreenToApzcTransform(aTarget); + Matrix4x4 transformToApzc = aTreeManager->GetScreenToApzcTransform(aTarget); ApplyTransform(&aStartPoint, transformToApzc); ApplyTransform(&aEndPoint, transformToApzc); } @@ -1192,8 +1188,7 @@ APZCTreeManager::GetAPZCAtPoint(AsyncPanZoomController* aApzc, // to aApzc's parent layer's layer coordinates. // It is PC.Inverse() * OC.Inverse() * NC.Inverse() * MC.Inverse() at recursion level for L, // and RC.Inverse() * QC.Inverse() at recursion level for P. - Matrix4x4 ancestorUntransform = aApzc->GetAncestorTransform(); - ancestorUntransform.Invert(); + Matrix4x4 ancestorUntransform = aApzc->GetAncestorTransform().Inverse(); // Hit testing for this layer takes place in our parent layer coordinates, // since the composition bounds (used to initialize the visible rect against @@ -1207,9 +1202,7 @@ APZCTreeManager::GetAPZCAtPoint(AsyncPanZoomController* aApzc, // to aApzc's CSS-transformed layer coordinates. // It is PC.Inverse() * OC.Inverse() * NC.Inverse() * MC.Inverse() * LA.Inverse() at L // and RC.Inverse() * QC.Inverse() * PA.Inverse() at P. - Matrix4x4 asyncUntransform = aApzc->GetCurrentAsyncTransform(); - asyncUntransform.Invert(); - Matrix4x4 childUntransform = ancestorUntransform * asyncUntransform; + Matrix4x4 childUntransform = ancestorUntransform * Matrix4x4(aApzc->GetCurrentAsyncTransform()).Inverse(); Point4D hitTestPointForChildLayers = childUntransform.ProjectPoint(aHitTestPoint); APZCTM_LOG("Untransformed %f %f to layer coordinates %f %f for APZC %p\n", aHitTestPoint.x, aHitTestPoint.y, @@ -1356,19 +1349,16 @@ APZCTreeManager::GetScreenToApzcTransform(const AsyncPanZoomController *aApzc) c // leftmost matrix in a multiplication is applied first. // ancestorUntransform is PC.Inverse() * OC.Inverse() * NC.Inverse() * MC.Inverse() - Matrix4x4 ancestorUntransform = aApzc->GetAncestorTransform(); - ancestorUntransform.Invert(); + Matrix4x4 ancestorUntransform = aApzc->GetAncestorTransform().Inverse(); // result is initialized to PC.Inverse() * OC.Inverse() * NC.Inverse() * MC.Inverse() result = ancestorUntransform; for (AsyncPanZoomController* parent = aApzc->GetParent(); parent; parent = parent->GetParent()) { // ancestorUntransform is updated to RC.Inverse() * QC.Inverse() when parent == P - ancestorUntransform = parent->GetAncestorTransform(); - ancestorUntransform.Invert(); + ancestorUntransform = parent->GetAncestorTransform().Inverse(); // asyncUntransform is updated to PA.Inverse() when parent == P - Matrix4x4 asyncUntransform = parent->GetCurrentAsyncTransform(); - asyncUntransform.Invert(); + Matrix4x4 asyncUntransform = Matrix4x4(parent->GetCurrentAsyncTransform()).Inverse(); // untransformSinceLastApzc is RC.Inverse() * QC.Inverse() * PA.Inverse() Matrix4x4 untransformSinceLastApzc = ancestorUntransform * asyncUntransform; @@ -1400,8 +1390,7 @@ APZCTreeManager::GetApzcToGeckoTransform(const AsyncPanZoomController *aApzc) co // leftmost matrix in a multiplication is applied first. // asyncUntransform is LA.Inverse() - Matrix4x4 asyncUntransform = aApzc->GetCurrentAsyncTransform(); - asyncUntransform.Invert(); + Matrix4x4 asyncUntransform = Matrix4x4(aApzc->GetCurrentAsyncTransform()).Inverse(); // aTransformToGeckoOut is initialized to LA.Inverse() * LD * MC * NC * OC * PC result = asyncUntransform * aApzc->GetTransformToLastDispatchedPaint() * aApzc->GetAncestorTransform(); diff --git a/gfx/layers/apz/src/AsyncPanZoomController.cpp b/gfx/layers/apz/src/AsyncPanZoomController.cpp index 504c7197e17b..b45658aef75d 100644 --- a/gfx/layers/apz/src/AsyncPanZoomController.cpp +++ b/gfx/layers/apz/src/AsyncPanZoomController.cpp @@ -1742,9 +1742,8 @@ static void TransformVector(const Matrix4x4& aTransform, void AsyncPanZoomController::ToGlobalScreenCoordinates(ScreenPoint* aVector, const ScreenPoint& aAnchor) const { if (APZCTreeManager* treeManagerLocal = GetApzcTreeManager()) { - Matrix4x4 transform = treeManagerLocal->GetScreenToApzcTransform(this); - transform.Invert(); - TransformVector(transform, aVector, aAnchor); + Matrix4x4 apzcToScreen = treeManagerLocal->GetScreenToApzcTransform(this).Inverse(); + TransformVector(apzcToScreen, aVector, aAnchor); } } diff --git a/gfx/layers/composite/AsyncCompositionManager.cpp b/gfx/layers/composite/AsyncCompositionManager.cpp index 018ec02a9b1f..b81fc041d6f6 100644 --- a/gfx/layers/composite/AsyncCompositionManager.cpp +++ b/gfx/layers/composite/AsyncCompositionManager.cpp @@ -308,8 +308,7 @@ AsyncCompositionManager::AlignFixedAndStickyLayers(Layer* aLayer, if (newCumulativeTransform.IsSingular()) { return; } - Matrix newCumulativeTransformInverse = newCumulativeTransform; - newCumulativeTransformInverse.Invert(); + Matrix newCumulativeTransformInverse = newCumulativeTransform.Inverse(); // Now work out the translation necessary to make sure the layer doesn't // move given the new sub-tree root transform. @@ -699,9 +698,7 @@ ApplyAsyncTransformToScrollbarForContent(Layer* aScrollbar, Matrix4x4 asyncTransform = apzc->GetCurrentAsyncTransform(); Matrix4x4 nontransientTransform = apzc->GetNontransientAsyncTransform(); - Matrix4x4 nontransientUntransform = nontransientTransform; - nontransientUntransform.Invert(); - Matrix4x4 transientTransform = asyncTransform * nontransientUntransform; + Matrix4x4 transientTransform = asyncTransform * nontransientTransform.Inverse(); // |transientTransform| represents the amount by which we have scrolled and // zoomed since the last paint. Because the scrollbar was sized and positioned based @@ -736,15 +733,15 @@ ApplyAsyncTransformToScrollbarForContent(Layer* aScrollbar, // the content. This is needed because otherwise that transient async transform is // part of the effective transform of this scrollbar, and the scrollbar will jitter // as the content scrolls. - transientTransform.Invert(); - transform = transform * transientTransform; + Matrix4x4 transientUntransform = transientTransform.Inverse(); + transform = transform * transientUntransform; // We also need to make a corresponding change on the clip rect of all the // layers on the ancestor chain from the scrollbar layer up to but not // including the layer with the async transform. Otherwise the scrollbar // shifts but gets clipped and so appears to flicker. for (Layer* ancestor = aScrollbar; ancestor != aContent.GetLayer(); ancestor = ancestor->GetParent()) { - TransformClipRect(ancestor, transientTransform); + TransformClipRect(ancestor, transientUntransform); } } From 206d7d6d49f72d94e14e1c2ff65cf68cb4b79a73 Mon Sep 17 00:00:00 2001 From: "Nicolas B. Pierron" Date: Wed, 1 Oct 2014 19:17:51 +0200 Subject: [PATCH 44/63] 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. --- js/ipc/JavaScriptShared.cpp | 2 +- js/ipc/WrapperOwner.cpp | 2 +- js/public/HashTable.h | 2 +- js/public/HeapAPI.h | 4 +- js/public/Id.h | 4 +- js/public/ProfilingFrameIterator.h | 4 +- js/public/RootingAPI.h | 2 +- js/src/asmjs/AsmJSFrameIterator.cpp | 76 +-- js/src/asmjs/AsmJSFrameIterator.h | 4 +- js/src/asmjs/AsmJSLink.cpp | 14 +- js/src/asmjs/AsmJSModule.cpp | 116 ++--- js/src/asmjs/AsmJSModule.h | 242 ++++----- js/src/asmjs/AsmJSSignalHandlers.cpp | 12 +- js/src/asmjs/AsmJSValidate.cpp | 392 +++++++-------- js/src/asmjs/AsmJSValidate.h | 2 +- js/src/builtin/Eval.cpp | 22 +- js/src/builtin/Intl.cpp | 72 +-- js/src/builtin/MapObject.cpp | 42 +- js/src/builtin/Object.cpp | 2 +- js/src/builtin/RegExp.cpp | 28 +- js/src/builtin/SIMD.cpp | 10 +- js/src/builtin/SymbolObject.cpp | 2 +- js/src/builtin/TestingFunctions.cpp | 10 +- js/src/builtin/TypedObject.cpp | 178 +++---- js/src/builtin/TypedObject.h | 6 +- js/src/ctypes/CTypes.cpp | 218 ++++----- js/src/ctypes/CTypes.h | 10 +- js/src/ctypes/Library.cpp | 2 +- js/src/devtools/sharkctl.cpp | 14 +- js/src/ds/FixedSizeHash.h | 2 +- js/src/ds/InlineMap.h | 50 +- js/src/ds/LifoAlloc.cpp | 18 +- js/src/ds/LifoAlloc.h | 36 +- js/src/ds/Sort.h | 6 +- js/src/ds/SplayTree.h | 24 +- js/src/frontend/BytecodeCompiler.cpp | 26 +- js/src/frontend/BytecodeEmitter.cpp | 460 +++++++++--------- js/src/frontend/FoldConstants.cpp | 20 +- js/src/frontend/FullParseHandler.h | 40 +- js/src/frontend/NameFunctions.cpp | 6 +- js/src/frontend/ParseMaps.cpp | 4 +- js/src/frontend/ParseMaps.h | 36 +- js/src/frontend/ParseNode-inl.h | 4 +- js/src/frontend/ParseNode.cpp | 40 +- js/src/frontend/ParseNode.h | 106 ++-- js/src/frontend/Parser-inl.h | 2 +- js/src/frontend/Parser.cpp | 294 +++++------ js/src/frontend/Parser.h | 2 +- js/src/frontend/SharedContext.h | 14 +- js/src/frontend/TokenStream.cpp | 46 +- js/src/frontend/TokenStream.h | 52 +- js/src/gc/Barrier.cpp | 4 +- js/src/gc/Barrier.h | 64 +-- js/src/gc/FindSCCs.h | 10 +- js/src/gc/ForkJoinNursery-inl.h | 6 +- js/src/gc/ForkJoinNursery.cpp | 68 +-- js/src/gc/GCInternals.h | 2 +- js/src/gc/GCRuntime.h | 16 +- js/src/gc/GCTrace.cpp | 6 +- js/src/gc/Heap.h | 136 +++--- js/src/gc/Iteration.cpp | 4 +- js/src/gc/Marking.cpp | 154 +++--- js/src/gc/Marking.h | 4 +- js/src/gc/Nursery-inl.h | 4 +- js/src/gc/Nursery.cpp | 52 +- js/src/gc/Nursery.h | 16 +- js/src/gc/RootMarking.cpp | 16 +- js/src/gc/Statistics.cpp | 10 +- js/src/gc/Statistics.h | 2 +- js/src/gc/StoreBuffer.cpp | 32 +- js/src/gc/StoreBuffer.h | 22 +- js/src/gc/Tracer.cpp | 68 +-- js/src/gc/Tracer.h | 18 +- js/src/gc/Verifier.cpp | 10 +- js/src/gc/Zone.cpp | 12 +- js/src/gc/Zone.h | 20 +- js/src/gdb/README | 2 +- .../irregexp/NativeRegExpMacroAssembler.cpp | 40 +- js/src/irregexp/RegExpAST.cpp | 4 +- js/src/irregexp/RegExpEngine.cpp | 188 +++---- js/src/irregexp/RegExpEngine.h | 16 +- js/src/irregexp/RegExpInterpreter.cpp | 10 +- js/src/irregexp/RegExpMacroAssembler.cpp | 34 +- js/src/irregexp/RegExpMacroAssembler.h | 4 +- js/src/irregexp/RegExpParser.cpp | 32 +- js/src/irregexp/RegExpParser.h | 10 +- js/src/irregexp/RegExpStack.cpp | 2 +- js/src/irregexp/RegExpStack.h | 2 +- js/src/jit/AliasAnalysis.cpp | 8 +- js/src/jit/BacktrackingAllocator.cpp | 82 ++-- js/src/jit/BacktrackingAllocator.h | 4 +- js/src/jit/Bailouts.cpp | 18 +- js/src/jit/Bailouts.h | 2 +- js/src/jit/BaselineBailouts.cpp | 116 ++--- js/src/jit/BaselineCompiler.cpp | 54 +- js/src/jit/BaselineFrame-inl.h | 14 +- js/src/jit/BaselineFrame.cpp | 16 +- js/src/jit/BaselineFrame.h | 22 +- js/src/jit/BaselineFrameInfo.cpp | 16 +- js/src/jit/BaselineFrameInfo.h | 26 +- js/src/jit/BaselineIC.cpp | 414 ++++++++-------- js/src/jit/BaselineIC.h | 152 +++--- js/src/jit/BaselineInspector.cpp | 16 +- js/src/jit/BaselineInspector.h | 10 +- js/src/jit/BaselineJIT.cpp | 82 ++-- js/src/jit/BaselineJIT.h | 12 +- js/src/jit/BitSet.cpp | 30 +- js/src/jit/BitSet.h | 18 +- js/src/jit/BytecodeAnalysis.cpp | 16 +- js/src/jit/BytecodeAnalysis.h | 4 +- js/src/jit/CodeGenerator.cpp | 240 ++++----- js/src/jit/CompactBuffer.h | 12 +- js/src/jit/CompileInfo-inl.h | 2 +- js/src/jit/CompileInfo.h | 36 +- js/src/jit/CompileWrappers.cpp | 2 +- js/src/jit/EffectiveAddressAnalysis.cpp | 2 +- js/src/jit/ExecutableAllocator.h | 20 +- js/src/jit/FixedList.h | 6 +- js/src/jit/InlineList.h | 38 +- js/src/jit/Ion.cpp | 130 ++--- js/src/jit/IonAllocPolicy.h | 6 +- js/src/jit/IonAnalysis.cpp | 168 +++---- js/src/jit/IonBuilder.cpp | 454 ++++++++--------- js/src/jit/IonBuilder.h | 16 +- js/src/jit/IonCaches.cpp | 260 +++++----- js/src/jit/IonCaches.h | 40 +- js/src/jit/IonCode.h | 36 +- js/src/jit/IonFrames-inl.h | 10 +- js/src/jit/IonFrames.cpp | 100 ++-- js/src/jit/IonFrames.h | 20 +- js/src/jit/IonInstrumentation.h | 2 +- js/src/jit/IonLinker.h | 4 +- js/src/jit/IonMacroAssembler.cpp | 64 +-- js/src/jit/IonMacroAssembler.h | 32 +- js/src/jit/IonOptimizationLevels.cpp | 8 +- js/src/jit/IonOptimizationLevels.h | 4 +- js/src/jit/IonTypes.h | 16 +- js/src/jit/JSONSpewer.cpp | 4 +- js/src/jit/JitCompartment.h | 24 +- js/src/jit/JitFrameIterator-inl.h | 2 +- js/src/jit/JitFrameIterator.h | 12 +- js/src/jit/JitSpewer.cpp | 10 +- js/src/jit/JitcodeMap.cpp | 68 +-- js/src/jit/JitcodeMap.h | 94 ++-- js/src/jit/LIR-Common.h | 28 +- js/src/jit/LIR.cpp | 12 +- js/src/jit/LIR.h | 94 ++-- js/src/jit/Label.h | 10 +- js/src/jit/LinearScan.cpp | 126 ++--- js/src/jit/LiveRangeAllocator.cpp | 52 +- js/src/jit/LiveRangeAllocator.h | 48 +- js/src/jit/LoopUnroller.cpp | 22 +- js/src/jit/Lowering.cpp | 414 ++++++++-------- js/src/jit/MCallOptimize.cpp | 22 +- js/src/jit/MIR.cpp | 114 ++--- js/src/jit/MIR.h | 274 +++++------ js/src/jit/MIRGenerator.h | 8 +- js/src/jit/MIRGraph.cpp | 142 +++--- js/src/jit/MIRGraph.h | 36 +- js/src/jit/MoveResolver.cpp | 2 +- js/src/jit/MoveResolver.h | 16 +- js/src/jit/ParallelFunctions.cpp | 26 +- js/src/jit/ParallelSafetyAnalysis.cpp | 10 +- js/src/jit/PerfSpewer.cpp | 22 +- js/src/jit/RangeAnalysis.cpp | 62 +-- js/src/jit/RangeAnalysis.h | 34 +- js/src/jit/RegisterAllocator.cpp | 34 +- js/src/jit/RegisterAllocator.h | 14 +- js/src/jit/RegisterSets.h | 48 +- js/src/jit/Registers.h | 6 +- js/src/jit/RematerializedFrame.cpp | 2 +- js/src/jit/RematerializedFrame.h | 8 +- js/src/jit/Safepoints.cpp | 20 +- js/src/jit/Snapshots.cpp | 4 +- js/src/jit/Snapshots.h | 28 +- js/src/jit/StackSlotAllocator.h | 4 +- js/src/jit/StupidAllocator.cpp | 10 +- js/src/jit/TypePolicy.cpp | 54 +- js/src/jit/TypedObjectPrediction.cpp | 10 +- js/src/jit/TypedObjectPrediction.h | 6 +- js/src/jit/VMFunctions.cpp | 90 ++-- js/src/jit/VMFunctions.h | 12 +- js/src/jit/arm/Architecture-arm.h | 26 +- js/src/jit/arm/Assembler-arm.cpp | 200 ++++---- js/src/jit/arm/Assembler-arm.h | 84 ++-- js/src/jit/arm/Bailouts-arm.cpp | 12 +- js/src/jit/arm/BaselineHelpers-arm.h | 20 +- js/src/jit/arm/BaselineIC-arm.cpp | 4 +- js/src/jit/arm/CodeGenerator-arm.cpp | 82 ++-- js/src/jit/arm/Lowering-arm.cpp | 40 +- js/src/jit/arm/MacroAssembler-arm.cpp | 198 ++++---- js/src/jit/arm/MacroAssembler-arm.h | 24 +- js/src/jit/arm/MoveEmitter-arm.cpp | 28 +- js/src/jit/arm/Trampoline-arm.cpp | 22 +- js/src/jit/mips/Architecture-mips.h | 6 +- js/src/jit/mips/CodeGenerator-mips.cpp | 2 +- js/src/jit/mips/Lowering-mips.cpp | 2 +- js/src/jit/mips/MacroAssembler-mips.cpp | 14 +- js/src/jit/mips/MacroAssembler-mips.h | 4 +- js/src/jit/shared/Assembler-shared.h | 54 +- js/src/jit/shared/Assembler-x86-shared.cpp | 2 +- js/src/jit/shared/Assembler-x86-shared.h | 198 ++++---- .../jit/shared/AssemblerBuffer-x86-shared.h | 2 +- js/src/jit/shared/BaseAssembler-x86-shared.h | 6 +- js/src/jit/shared/BaselineCompiler-shared.cpp | 6 +- js/src/jit/shared/BaselineCompiler-shared.h | 6 +- js/src/jit/shared/CodeGenerator-shared-inl.h | 16 +- js/src/jit/shared/CodeGenerator-shared.cpp | 90 ++-- js/src/jit/shared/CodeGenerator-shared.h | 24 +- .../jit/shared/CodeGenerator-x86-shared.cpp | 74 +-- js/src/jit/shared/LIR-x86-shared.h | 4 +- js/src/jit/shared/Lowering-shared-inl.h | 30 +- js/src/jit/shared/Lowering-shared.cpp | 8 +- js/src/jit/shared/Lowering-x86-shared.cpp | 20 +- .../jit/shared/MacroAssembler-x86-shared.cpp | 20 +- js/src/jit/shared/MacroAssembler-x86-shared.h | 14 +- js/src/jit/shared/MoveEmitter-x86-shared.cpp | 52 +- js/src/jit/x64/Architecture-x64.h | 8 +- js/src/jit/x64/Assembler-x64.cpp | 20 +- js/src/jit/x64/Assembler-x64.h | 4 +- js/src/jit/x64/BaselineHelpers-x64.h | 4 +- js/src/jit/x64/BaselineIC-x64.cpp | 12 +- js/src/jit/x64/CodeGenerator-x64.cpp | 18 +- js/src/jit/x64/Lowering-x64.cpp | 16 +- js/src/jit/x64/MacroAssembler-x64.cpp | 34 +- js/src/jit/x64/MacroAssembler-x64.h | 82 ++-- js/src/jit/x64/Trampoline-x64.cpp | 18 +- js/src/jit/x86/Architecture-x86.h | 8 +- js/src/jit/x86/Assembler-x86.cpp | 2 +- js/src/jit/x86/Assembler-x86.h | 32 +- js/src/jit/x86/Bailouts-x86.cpp | 12 +- js/src/jit/x86/BaselineHelpers-x86.h | 6 +- js/src/jit/x86/BaselineIC-x86.cpp | 10 +- js/src/jit/x86/CodeGenerator-x86.cpp | 30 +- js/src/jit/x86/LIR-x86.h | 2 +- js/src/jit/x86/Lowering-x86.cpp | 24 +- js/src/jit/x86/MacroAssembler-x86.cpp | 32 +- js/src/jit/x86/MacroAssembler-x86.h | 80 +-- js/src/jit/x86/Trampoline-x86.cpp | 14 +- .../testCallNonGenericMethodOnProxy.cpp | 2 +- js/src/jsapi-tests/testLooselyEqual.cpp | 4 +- js/src/jsapi-tests/testOOM.cpp | 2 +- js/src/jsapi-tests/testParseJSON.cpp | 4 +- js/src/jsapi-tests/testSetProperty.cpp | 2 +- js/src/jsapi-tests/tests.h | 10 +- js/src/jsapi.cpp | 214 ++++---- js/src/jsapi.h | 40 +- js/src/jsarray.cpp | 86 ++-- js/src/jsarray.h | 2 +- js/src/jsatom.cpp | 16 +- js/src/jsatom.h | 2 +- js/src/jsatominlines.h | 6 +- js/src/jsbool.cpp | 12 +- js/src/jscntxt.cpp | 76 +-- js/src/jscntxt.h | 34 +- js/src/jscntxtinlines.h | 18 +- js/src/jscompartment.cpp | 60 +-- js/src/jscompartment.h | 6 +- js/src/jscompartmentinlines.h | 6 +- js/src/jsdate.cpp | 32 +- js/src/jsdtoa.cpp | 40 +- js/src/jsexn.cpp | 8 +- js/src/jsexn.h | 8 +- js/src/jsfriendapi.cpp | 46 +- js/src/jsfriendapi.h | 20 +- js/src/jsfun.cpp | 110 ++--- js/src/jsfun.h | 70 +-- js/src/jsgc.cpp | 446 ++++++++--------- js/src/jsgc.h | 58 +-- js/src/jsgcinlines.h | 70 +-- js/src/jsinfer.cpp | 188 +++---- js/src/jsinfer.h | 44 +- js/src/jsinferinlines.h | 66 +-- js/src/jsiter.cpp | 74 +-- js/src/jsiter.h | 8 +- js/src/jsmath.cpp | 6 +- js/src/jsnativestack.cpp | 2 +- js/src/jsnativestack.h | 2 +- js/src/jsnum.cpp | 72 +-- js/src/jsobj.cpp | 274 +++++------ js/src/jsobj.h | 80 +-- js/src/jsobjinlines.h | 84 ++-- js/src/json.cpp | 12 +- js/src/jsonparser.cpp | 66 +-- js/src/jsonparser.h | 18 +- js/src/jsopcode.cpp | 110 ++--- js/src/jsopcode.h | 10 +- js/src/jsprf.cpp | 22 +- js/src/jspropertytree.cpp | 62 +-- js/src/jspropertytree.h | 12 +- js/src/jsproxy.h | 16 +- js/src/jsreflect.cpp | 148 +++--- js/src/jsscript.cpp | 228 ++++----- js/src/jsscript.h | 108 ++-- js/src/jsscriptinlines.h | 16 +- js/src/jsstr.cpp | 84 ++-- js/src/jsstr.h | 6 +- js/src/jsutil.cpp | 4 +- js/src/jsutil.h | 10 +- js/src/jswatchpoint.cpp | 14 +- js/src/jsweakcache.h | 8 +- js/src/jsweakmap.cpp | 30 +- js/src/jsweakmap.h | 8 +- js/src/jswrapper.h | 2 +- js/src/perf/pm_linux.cpp | 2 +- js/src/proxy/BaseProxyHandler.cpp | 8 +- js/src/proxy/CrossCompartmentWrapper.cpp | 22 +- js/src/proxy/DirectProxyHandler.cpp | 8 +- js/src/proxy/Proxy.cpp | 34 +- js/src/proxy/ScriptedDirectProxyHandler.cpp | 12 +- js/src/proxy/ScriptedIndirectProxyHandler.cpp | 24 +- js/src/proxy/Wrapper.cpp | 8 +- js/src/shell/js.cpp | 82 ++-- js/src/shell/jsheaptools.cpp | 6 +- js/src/shell/jsoptparse.cpp | 14 +- js/src/shell/jsoptparse.h | 8 +- js/src/vm/ArgumentsObject-inl.h | 6 +- js/src/vm/ArgumentsObject.cpp | 36 +- js/src/vm/ArgumentsObject.h | 12 +- js/src/vm/ArrayBufferObject.cpp | 60 +-- js/src/vm/ArrayBufferObject.h | 2 +- js/src/vm/ArrayObject-inl.h | 2 +- js/src/vm/ArrayObject.h | 4 +- js/src/vm/CallNonGenericMethod.cpp | 2 +- js/src/vm/CharacterEncoding.cpp | 18 +- js/src/vm/Compression.cpp | 24 +- js/src/vm/Debugger-inl.h | 2 +- js/src/vm/Debugger.cpp | 188 +++---- js/src/vm/Debugger.h | 20 +- js/src/vm/ForkJoin.cpp | 62 +-- js/src/vm/GlobalObject.cpp | 20 +- js/src/vm/GlobalObject.h | 42 +- js/src/vm/HelperThreads.cpp | 104 ++-- js/src/vm/HelperThreads.h | 24 +- js/src/vm/Interpreter-inl.h | 32 +- js/src/vm/Interpreter.cpp | 152 +++--- js/src/vm/Interpreter.h | 6 +- js/src/vm/MatchPairs.h | 14 +- js/src/vm/MemoryMetrics.cpp | 6 +- js/src/vm/ObjectImpl-inl.h | 4 +- js/src/vm/ObjectImpl.cpp | 6 +- js/src/vm/ObjectImpl.h | 46 +- js/src/vm/OldDebugAPI.cpp | 4 +- js/src/vm/PIC.cpp | 18 +- js/src/vm/PIC.h | 18 +- js/src/vm/PosixNSPR.cpp | 8 +- js/src/vm/ProxyObject.cpp | 2 +- js/src/vm/ProxyObject.h | 10 +- js/src/vm/RegExpObject.cpp | 62 +-- js/src/vm/RegExpObject.h | 8 +- js/src/vm/RegExpStatics.cpp | 10 +- js/src/vm/RegExpStatics.h | 56 +-- js/src/vm/Runtime-inl.h | 12 +- js/src/vm/Runtime.cpp | 30 +- js/src/vm/Runtime.h | 56 +-- js/src/vm/SPSProfiler.cpp | 32 +- js/src/vm/SPSProfiler.h | 30 +- js/src/vm/SavedStacks.cpp | 14 +- js/src/vm/ScopeObject-inl.h | 18 +- js/src/vm/ScopeObject.cpp | 136 +++--- js/src/vm/ScopeObject.h | 42 +- js/src/vm/SelfHosting.cpp | 100 ++-- js/src/vm/Shape-inl.h | 6 +- js/src/vm/Shape.cpp | 154 +++--- js/src/vm/Shape.h | 82 ++-- js/src/vm/SharedArrayObject.cpp | 18 +- js/src/vm/SharedArrayObject.h | 2 +- js/src/vm/SharedTypedArrayObject.cpp | 24 +- js/src/vm/SharedTypedArrayObject.h | 2 +- js/src/vm/Stack-inl.h | 60 +-- js/src/vm/Stack.cpp | 164 +++---- js/src/vm/Stack.h | 106 ++-- js/src/vm/String-inl.h | 38 +- js/src/vm/String.cpp | 16 +- js/src/vm/String.h | 72 +-- js/src/vm/StringBuffer.cpp | 4 +- js/src/vm/StringObject-inl.h | 4 +- js/src/vm/StringObject.h | 2 +- js/src/vm/StructuredClone.cpp | 62 +-- js/src/vm/ThreadPool.cpp | 2 +- js/src/vm/TraceLogging.cpp | 16 +- js/src/vm/TypedArrayObject.cpp | 88 ++-- js/src/vm/TypedArrayObject.h | 12 +- js/src/vm/Xdr.cpp | 2 +- js/src/vm/Xdr.h | 8 +- 385 files changed, 8439 insertions(+), 8439 deletions(-) diff --git a/js/ipc/JavaScriptShared.cpp b/js/ipc/JavaScriptShared.cpp index 7468c5439ea9..9fb6eab3ee62 100644 --- a/js/ipc/JavaScriptShared.cpp +++ b/js/ipc/JavaScriptShared.cpp @@ -418,7 +418,7 @@ JavaScriptShared::fromDescriptor(JSContext *cx, Handle des if (!toVariant(cx, desc.value(), &out->value())) return false; - JS_ASSERT(desc.object()); + MOZ_ASSERT(desc.object()); if (!toObjectVariant(cx, desc.object(), &out->obj())) return false; diff --git a/js/ipc/WrapperOwner.cpp b/js/ipc/WrapperOwner.cpp index 97fff1b6a59f..906f7a55a9da 100644 --- a/js/ipc/WrapperOwner.cpp +++ b/js/ipc/WrapperOwner.cpp @@ -897,7 +897,7 @@ bool WrapperOwner::toObjectVariant(JSContext *cx, JSObject *objArg, ObjectVariant *objVarp) { RootedObject obj(cx, objArg); - JS_ASSERT(obj); + MOZ_ASSERT(obj); // We always save objects unwrapped in the CPOW table. If we stored // wrappers, then the wrapper might be GCed while the target remained alive. diff --git a/js/public/HashTable.h b/js/public/HashTable.h index b958c8e9cc42..4ef0d138b153 100644 --- a/js/public/HashTable.h +++ b/js/public/HashTable.h @@ -959,7 +959,7 @@ class HashTable : private AllocPolicy // a new key at the new Lookup position. |front()| is invalid after // this operation until the next call to |popFront()|. void rekeyFront(const Lookup &l, const Key &k) { - JS_ASSERT(&k != &HashPolicy::getKey(this->cur->get())); + MOZ_ASSERT(&k != &HashPolicy::getKey(this->cur->get())); Ptr p(*this->cur, table_); table_.rekeyWithoutRehash(p, l, k); rekeyed = true; diff --git a/js/public/HeapAPI.h b/js/public/HeapAPI.h index c7b71892ce70..37784136957b 100644 --- a/js/public/HeapAPI.h +++ b/js/public/HeapAPI.h @@ -260,7 +260,7 @@ IsInsideNursery(const js::gc::Cell *cell) addr &= ~js::gc::ChunkMask; addr |= js::gc::ChunkLocationOffset; uint32_t location = *reinterpret_cast(addr); - JS_ASSERT(location != 0); + MOZ_ASSERT(location != 0); return location & ChunkLocationAnyNursery; #else return false; @@ -278,7 +278,7 @@ GetTenuredGCThingZone(void *thing) { MOZ_ASSERT(thing); #ifdef JSGC_GENERATIONAL - JS_ASSERT(!js::gc::IsInsideNursery((js::gc::Cell *)thing)); + MOZ_ASSERT(!js::gc::IsInsideNursery((js::gc::Cell *)thing)); #endif return js::gc::GetGCThingArena(thing)->zone; } diff --git a/js/public/Id.h b/js/public/Id.h index f2d89df5bd94..38473456fdbf 100644 --- a/js/public/Id.h +++ b/js/public/Id.h @@ -127,8 +127,8 @@ SYMBOL_TO_JSID(JS::Symbol *sym) jsid id; MOZ_ASSERT(sym != nullptr); MOZ_ASSERT((size_t(sym) & JSID_TYPE_MASK) == 0); - JS_ASSERT(!js::gc::IsInsideNursery(JS::AsCell(sym))); - JS_ASSERT(!JS::IsPoisonedPtr(sym)); + MOZ_ASSERT(!js::gc::IsInsideNursery(JS::AsCell(sym))); + MOZ_ASSERT(!JS::IsPoisonedPtr(sym)); JSID_BITS(id) = (size_t(sym) | JSID_TYPE_SYMBOL); return id; } diff --git a/js/public/ProfilingFrameIterator.h b/js/public/ProfilingFrameIterator.h index 0cb573402cfc..52bb3a4f3014 100644 --- a/js/public/ProfilingFrameIterator.h +++ b/js/public/ProfilingFrameIterator.h @@ -34,11 +34,11 @@ class JS_PUBLIC_API(ProfilingFrameIterator) static const unsigned StorageSpace = 6 * sizeof(void*); mozilla::AlignedStorage storage_; js::AsmJSProfilingFrameIterator &asmJSIter() { - JS_ASSERT(!done()); + MOZ_ASSERT(!done()); return *reinterpret_cast(storage_.addr()); } const js::AsmJSProfilingFrameIterator &asmJSIter() const { - JS_ASSERT(!done()); + MOZ_ASSERT(!done()); return *reinterpret_cast(storage_.addr()); } diff --git a/js/public/RootingAPI.h b/js/public/RootingAPI.h index 554c853e3750..5b7f76431fa5 100644 --- a/js/public/RootingAPI.h +++ b/js/public/RootingAPI.h @@ -670,7 +670,7 @@ struct GCMethods static gc::Cell *asGCThingOrNull(JSObject *v) { if (!v) return nullptr; - JS_ASSERT(uintptr_t(v) > 32); + MOZ_ASSERT(uintptr_t(v) > 32); return reinterpret_cast(v); } static bool needsPostBarrier(JSObject *v) { diff --git a/js/src/asmjs/AsmJSFrameIterator.cpp b/js/src/asmjs/AsmJSFrameIterator.cpp index 1d196e4c4a20..d427bc4c0dbc 100644 --- a/js/src/asmjs/AsmJSFrameIterator.cpp +++ b/js/src/asmjs/AsmJSFrameIterator.cpp @@ -54,7 +54,7 @@ AsmJSFrameIterator::AsmJSFrameIterator(const AsmJSActivation &activation) void AsmJSFrameIterator::operator++() { - JS_ASSERT(!done()); + MOZ_ASSERT(!done()); DebugOnly oldfp = fp_; fp_ += callsite_->stackDepth(); JS_ASSERT_IF(module_->profilingEnabled(), fp_ == CallerFPFromFP(oldfp)); @@ -67,17 +67,17 @@ AsmJSFrameIterator::settle() void *returnAddress = ReturnAddressFromFP(fp_); const AsmJSModule::CodeRange *codeRange = module_->lookupCodeRange(returnAddress); - JS_ASSERT(codeRange); + MOZ_ASSERT(codeRange); codeRange_ = codeRange; switch (codeRange->kind()) { case AsmJSModule::CodeRange::Function: callsite_ = module_->lookupCallSite(returnAddress); - JS_ASSERT(callsite_); + MOZ_ASSERT(callsite_); break; case AsmJSModule::CodeRange::Entry: fp_ = nullptr; - JS_ASSERT(done()); + MOZ_ASSERT(done()); break; case AsmJSModule::CodeRange::IonFFI: case AsmJSModule::CodeRange::SlowFFI: @@ -91,14 +91,14 @@ AsmJSFrameIterator::settle() JSAtom * AsmJSFrameIterator::functionDisplayAtom() const { - JS_ASSERT(!done()); + MOZ_ASSERT(!done()); return reinterpret_cast(codeRange_)->functionName(*module_); } unsigned AsmJSFrameIterator::computeLine(uint32_t *column) const { - JS_ASSERT(!done()); + MOZ_ASSERT(!done()); if (column) *column = callsite_->column(); return callsite_->line(); @@ -176,14 +176,14 @@ GenerateProfilingPrologue(MacroAssembler &masm, unsigned framePushed, AsmJSExit: masm.bind(begin); PushRetAddr(masm); - JS_ASSERT(PushedRetAddr == masm.currentOffset() - offsetAtBegin); + MOZ_ASSERT(PushedRetAddr == masm.currentOffset() - offsetAtBegin); masm.loadAsmJSActivation(scratch); masm.push(Address(scratch, AsmJSActivation::offsetOfFP())); - JS_ASSERT(PushedFP == masm.currentOffset() - offsetAtBegin); + MOZ_ASSERT(PushedFP == masm.currentOffset() - offsetAtBegin); masm.storePtr(StackPointer, Address(scratch, AsmJSActivation::offsetOfFP())); - JS_ASSERT(StoredFP == masm.currentOffset() - offsetAtBegin); + MOZ_ASSERT(StoredFP == masm.currentOffset() - offsetAtBegin); } if (reason != AsmJSExit::None) @@ -290,7 +290,7 @@ void js::GenerateAsmJSFunctionEpilogue(MacroAssembler &masm, unsigned framePushed, AsmJSFunctionLabels *labels) { - JS_ASSERT(masm.framePushed() == framePushed); + MOZ_ASSERT(masm.framePushed() == framePushed); #if defined(JS_CODEGEN_ARM) // Flush pending pools so they do not get dumped between the profilingReturn @@ -379,7 +379,7 @@ js::GenerateAsmJSExitEpilogue(MacroAssembler &masm, unsigned framePushed, AsmJSE Label *profilingReturn) { // Inverse of GenerateAsmJSExitPrologue: - JS_ASSERT(masm.framePushed() == framePushed); + MOZ_ASSERT(masm.framePushed() == framePushed); GenerateProfilingEpilogue(masm, framePushed, reason, profilingReturn); masm.setFramePushed(0); } @@ -404,19 +404,19 @@ AssertMatchesCallSite(const AsmJSModule &module, const AsmJSModule::CodeRange *c { #ifdef DEBUG const AsmJSModule::CodeRange *callerCodeRange = module.lookupCodeRange(callerPC); - JS_ASSERT(callerCodeRange); + MOZ_ASSERT(callerCodeRange); if (callerCodeRange->isEntry()) { - JS_ASSERT(callerFP == nullptr); + MOZ_ASSERT(callerFP == nullptr); return; } const CallSite *callsite = module.lookupCallSite(callerPC); if (calleeCodeRange->isThunk()) { - JS_ASSERT(!callsite); - JS_ASSERT(callerCodeRange->isFunction()); + MOZ_ASSERT(!callsite); + MOZ_ASSERT(callerCodeRange->isFunction()); } else { - JS_ASSERT(callsite); - JS_ASSERT(callerFP == (uint8_t*)fp + callsite->stackDepth()); + MOZ_ASSERT(callsite); + MOZ_ASSERT(callerFP == (uint8_t*)fp + callsite->stackDepth()); } #endif } @@ -429,7 +429,7 @@ AsmJSProfilingFrameIterator::initFromFP(const AsmJSActivation &activation) // If a signal was handled while entering an activation, the frame will // still be null. if (!fp) { - JS_ASSERT(done()); + MOZ_ASSERT(done()); return; } @@ -443,7 +443,7 @@ AsmJSProfilingFrameIterator::initFromFP(const AsmJSActivation &activation) // - for interrupts, we just accept that we'll lose the innermost frame. void *pc = ReturnAddressFromFP(fp); const AsmJSModule::CodeRange *codeRange = module_->lookupCodeRange(pc); - JS_ASSERT(codeRange); + MOZ_ASSERT(codeRange); codeRange_ = codeRange; stackAddress_ = fp; @@ -477,7 +477,7 @@ AsmJSProfilingFrameIterator::initFromFP(const AsmJSActivation &activation) if (exitReason_ == AsmJSExit::None) exitReason_ = AsmJSExit::Interrupt; - JS_ASSERT(!done()); + MOZ_ASSERT(!done()); } typedef JS::ProfilingFrameIterator::RegisterState RegisterState; @@ -496,7 +496,7 @@ AsmJSProfilingFrameIterator::AsmJSProfilingFrameIterator(const AsmJSActivation & // profiling will be enabled when the module becomes inactive and gets // called again). if (!module_->profilingEnabled()) { - JS_ASSERT(done()); + MOZ_ASSERT(done()); return; } @@ -527,9 +527,9 @@ AsmJSProfilingFrameIterator::AsmJSProfilingFrameIterator(const AsmJSActivation & // prologue/epilogue, as generated by GenerateProfiling(Prologue|Epilogue) // below. uint32_t offsetInModule = ((uint8_t*)state.pc) - module_->codeBase(); - JS_ASSERT(offsetInModule < module_->codeBytes()); - JS_ASSERT(offsetInModule >= codeRange->begin()); - JS_ASSERT(offsetInModule < codeRange->end()); + MOZ_ASSERT(offsetInModule < module_->codeBytes()); + MOZ_ASSERT(offsetInModule >= codeRange->begin()); + MOZ_ASSERT(offsetInModule < codeRange->end()); uint32_t offsetInCodeRange = offsetInModule - codeRange->begin(); void **sp = (void**)state.sp; #if defined(JS_CODEGEN_ARM) || defined(JS_CODEGEN_MIPS) @@ -544,7 +544,7 @@ AsmJSProfilingFrameIterator::AsmJSProfilingFrameIterator(const AsmJSActivation & callerFP_ = fp; AssertMatchesCallSite(*module_, codeRange, callerPC_, callerFP_, sp - 1); } else if (offsetInCodeRange < StoredFP) { - JS_ASSERT(fp == CallerFPFromFP(sp)); + MOZ_ASSERT(fp == CallerFPFromFP(sp)); callerPC_ = ReturnAddressFromFP(sp); callerFP_ = CallerFPFromFP(sp); AssertMatchesCallSite(*module_, codeRange, callerPC_, callerFP_, sp); @@ -559,7 +559,7 @@ AsmJSProfilingFrameIterator::AsmJSProfilingFrameIterator(const AsmJSActivation & // The entry trampoline is the final frame in an AsmJSActivation. The entry // trampoline also doesn't GenerateAsmJSPrologue/Epilogue so we can't use // the general unwinding logic below. - JS_ASSERT(!fp); + MOZ_ASSERT(!fp); callerPC_ = nullptr; callerFP_ = nullptr; break; @@ -567,7 +567,7 @@ AsmJSProfilingFrameIterator::AsmJSProfilingFrameIterator(const AsmJSActivation & case AsmJSModule::CodeRange::Inline: { // The throw stub clears AsmJSActivation::fp on it's way out. if (!fp) { - JS_ASSERT(done()); + MOZ_ASSERT(done()); return; } @@ -583,35 +583,35 @@ AsmJSProfilingFrameIterator::AsmJSProfilingFrameIterator(const AsmJSActivation & codeRange_ = codeRange; stackAddress_ = state.sp; - JS_ASSERT(!done()); + MOZ_ASSERT(!done()); } void AsmJSProfilingFrameIterator::operator++() { if (exitReason_ != AsmJSExit::None) { - JS_ASSERT(codeRange_); + MOZ_ASSERT(codeRange_); exitReason_ = AsmJSExit::None; - JS_ASSERT(!done()); + MOZ_ASSERT(!done()); return; } if (!callerPC_) { - JS_ASSERT(!callerFP_); + MOZ_ASSERT(!callerFP_); codeRange_ = nullptr; - JS_ASSERT(done()); + MOZ_ASSERT(done()); return; } - JS_ASSERT(callerPC_); + MOZ_ASSERT(callerPC_); const AsmJSModule::CodeRange *codeRange = module_->lookupCodeRange(callerPC_); - JS_ASSERT(codeRange); + MOZ_ASSERT(codeRange); codeRange_ = codeRange; switch (codeRange->kind()) { case AsmJSModule::CodeRange::Entry: - JS_ASSERT(callerFP_ == nullptr); - JS_ASSERT(callerPC_ != nullptr); + MOZ_ASSERT(callerFP_ == nullptr); + MOZ_ASSERT(callerPC_ != nullptr); callerPC_ = nullptr; break; case AsmJSModule::CodeRange::Function: @@ -627,7 +627,7 @@ AsmJSProfilingFrameIterator::operator++() break; } - JS_ASSERT(!done()); + MOZ_ASSERT(!done()); } static const char * @@ -665,7 +665,7 @@ BuiltinToName(AsmJSExit::BuiltinKind builtin) const char * AsmJSProfilingFrameIterator::label() const { - JS_ASSERT(!done()); + MOZ_ASSERT(!done()); // Use the same string for both time inside and under so that the two // entries will be coalesced by the profiler. diff --git a/js/src/asmjs/AsmJSFrameIterator.h b/js/src/asmjs/AsmJSFrameIterator.h index f8aaea2859a3..bc7e0b846c92 100644 --- a/js/src/asmjs/AsmJSFrameIterator.h +++ b/js/src/asmjs/AsmJSFrameIterator.h @@ -116,7 +116,7 @@ namespace AsmJSExit return ReasonKind(uint16_t(reason)); } static inline BuiltinKind ExtractBuiltinKind(Reason reason) { - JS_ASSERT(ExtractReasonKind(reason) == Reason_Builtin); + MOZ_ASSERT(ExtractReasonKind(reason) == Reason_Builtin); return BuiltinKind(uint16_t(reason >> 16)); } } @@ -146,7 +146,7 @@ class AsmJSProfilingFrameIterator void operator++(); bool done() const { return !codeRange_; } - void *stackAddress() const { JS_ASSERT(!done()); return stackAddress_; } + void *stackAddress() const { MOZ_ASSERT(!done()); return stackAddress_; } const char *label() const; }; diff --git a/js/src/asmjs/AsmJSLink.cpp b/js/src/asmjs/AsmJSLink.cpp index eeaac8f268c1..1e3ea00b38ca 100644 --- a/js/src/asmjs/AsmJSLink.cpp +++ b/js/src/asmjs/AsmJSLink.cpp @@ -129,7 +129,7 @@ static bool ValidateGlobalVariable(JSContext *cx, const AsmJSModule &module, AsmJSModule::Global &global, HandleValue importVal) { - JS_ASSERT(global.which() == AsmJSModule::Global::Variable); + MOZ_ASSERT(global.which() == AsmJSModule::Global::Variable); void *datum = module.globalVarToGlobalDatum(global); @@ -435,7 +435,7 @@ LinkModuleToHeap(JSContext *cx, AsmJSModule &module, Handle msg( JS_smprintf("ArrayBuffer byteLength of 0x%x is less than 0x%x (which is the " @@ -777,7 +777,7 @@ SendFunctionsToVTune(JSContext *cx, AsmJSModule &module) uint8_t *start = base + func.pod.startCodeOffset; uint8_t *end = base + func.pod.endCodeOffset; - JS_ASSERT(end >= start); + MOZ_ASSERT(end >= start); unsigned method_id = iJIT_GetNewMethodID(); if (method_id == 0) @@ -820,7 +820,7 @@ SendFunctionsToPerf(JSContext *cx, AsmJSModule &module) const AsmJSModule::ProfiledFunction &func = module.profiledFunction(i); uintptr_t start = base + (unsigned long) func.pod.startCodeOffset; uintptr_t end = base + (unsigned long) func.pod.endCodeOffset; - JS_ASSERT(end >= start); + MOZ_ASSERT(end >= start); size_t size = end - start; JSAutoByteString bytes; @@ -908,7 +908,7 @@ CreateExportObject(JSContext *cx, Handle moduleObj) if (!fun) return nullptr; - JS_ASSERT(func.maybeFieldName() != nullptr); + MOZ_ASSERT(func.maybeFieldName() != nullptr); RootedId id(cx, NameToId(func.maybeFieldName())); RootedValue val(cx, ObjectValue(*fun)); if (!DefineNativeProperty(cx, obj, id, val, nullptr, nullptr, JSPROP_ENUMERATE)) @@ -1174,7 +1174,7 @@ js::AsmJSFunctionToString(JSContext *cx, HandleFunction fun) // asm.js functions cannot have been created with a Function constructor // as they belong within a module. - JS_ASSERT(!(begin == 0 && end == source->length() && source->argumentsNotIncluded())); + MOZ_ASSERT(!(begin == 0 && end == source->length() && source->argumentsNotIncluded())); if (!out.append("function ")) return nullptr; @@ -1185,7 +1185,7 @@ js::AsmJSFunctionToString(JSContext *cx, HandleFunction fun) // the function name and the rest (arguments + body). // asm.js functions can't be anonymous - JS_ASSERT(fun->atom()); + MOZ_ASSERT(fun->atom()); if (!out.append(fun->atom())) return nullptr; diff --git a/js/src/asmjs/AsmJSModule.cpp b/js/src/asmjs/AsmJSModule.cpp index 5df20f2c4c04..6b2dfb3d6256 100644 --- a/js/src/asmjs/AsmJSModule.cpp +++ b/js/src/asmjs/AsmJSModule.cpp @@ -59,7 +59,7 @@ using mozilla::Swap; static uint8_t * AllocateExecutableMemory(ExclusiveContext *cx, size_t totalBytes) { - JS_ASSERT(totalBytes % AsmJSPageSize == 0); + MOZ_ASSERT(totalBytes % AsmJSPageSize == 0); #ifdef XP_WIN void *p = VirtualAlloc(nullptr, totalBytes, MEM_COMMIT, PAGE_EXECUTE_READWRITE); @@ -204,7 +204,7 @@ struct CallSiteRetAddrOffset const CallSite * AsmJSModule::lookupCallSite(void *returnAddress) const { - JS_ASSERT(isFinished()); + MOZ_ASSERT(isFinished()); uint32_t target = ((uint8_t*)returnAddress) - code_; size_t lowerBound = 0; @@ -243,7 +243,7 @@ operator<(size_t pcOffset, const AsmJSModule::CodeRange &rhs) const AsmJSModule::CodeRange * AsmJSModule::lookupCodeRange(void *pc) const { - JS_ASSERT(isFinished()); + MOZ_ASSERT(isFinished()); uint32_t target = ((uint8_t*)pc) - code_; size_t lowerBound = 0; @@ -268,8 +268,8 @@ struct HeapAccessOffset const AsmJSHeapAccess * AsmJSModule::lookupHeapAccess(void *pc) const { - JS_ASSERT(isFinished()); - JS_ASSERT(containsFunctionPC(pc)); + MOZ_ASSERT(isFinished()); + MOZ_ASSERT(containsFunctionPC(pc)); uint32_t target = ((uint8_t*)pc) - code_; size_t lowerBound = 0; @@ -286,12 +286,12 @@ bool AsmJSModule::finish(ExclusiveContext *cx, TokenStream &tokenStream, MacroAssembler &masm, const Label &interruptLabel) { - JS_ASSERT(isFinishedWithFunctionBodies() && !isFinished()); + MOZ_ASSERT(isFinishedWithFunctionBodies() && !isFinished()); uint32_t endBeforeCurly = tokenStream.currentToken().pos.end; uint32_t endAfterCurly = tokenStream.peekTokenPos().end; - JS_ASSERT(endBeforeCurly >= srcBodyStart_); - JS_ASSERT(endAfterCurly >= srcBodyStart_); + MOZ_ASSERT(endBeforeCurly >= srcBodyStart_); + MOZ_ASSERT(endAfterCurly >= srcBodyStart_); pod.srcLength_ = endBeforeCurly - srcStart_; pod.srcLengthWithRightBrace_ = endAfterCurly - srcStart_; @@ -304,21 +304,21 @@ AsmJSModule::finish(ExclusiveContext *cx, TokenStream &tokenStream, MacroAssembl // units of pages. pod.totalBytes_ = AlignBytes(pod.codeBytes_ + globalDataBytes(), AsmJSPageSize); - JS_ASSERT(!code_); + MOZ_ASSERT(!code_); code_ = AllocateExecutableMemory(cx, pod.totalBytes_); if (!code_) return false; // Copy the code from the MacroAssembler into its final resting place in the // AsmJSModule. - JS_ASSERT(uintptr_t(code_) % AsmJSPageSize == 0); + MOZ_ASSERT(uintptr_t(code_) % AsmJSPageSize == 0); masm.executableCopy(code_); // c.f. JitCode::copyFrom - JS_ASSERT(masm.jumpRelocationTableBytes() == 0); - JS_ASSERT(masm.dataRelocationTableBytes() == 0); - JS_ASSERT(masm.preBarrierTableBytes() == 0); - JS_ASSERT(!masm.hasEnteredExitFrame()); + MOZ_ASSERT(masm.jumpRelocationTableBytes() == 0); + MOZ_ASSERT(masm.dataRelocationTableBytes() == 0); + MOZ_ASSERT(masm.preBarrierTableBytes() == 0); + MOZ_ASSERT(!masm.hasEnteredExitFrame()); // Copy over metadata, making sure to update all offsets on ARM. @@ -352,7 +352,7 @@ AsmJSModule::finish(ExclusiveContext *cx, TokenStream &tokenStream, MacroAssembl for (size_t i = 0; i < builtinThunkOffsets_.length(); i++) builtinThunkOffsets_[i] = masm.actualOffset(builtinThunkOffsets_[i]); #endif - JS_ASSERT(pod.functionBytes_ % AsmJSPageSize == 0); + MOZ_ASSERT(pod.functionBytes_ % AsmJSPageSize == 0); // Absolute link metadata: absolute addresses that refer to some fixed // address in the address space. @@ -452,7 +452,7 @@ AsmJSModule::finish(ExclusiveContext *cx, TokenStream &tokenStream, MacroAssembl void AsmJSModule::setAutoFlushICacheRange() { - JS_ASSERT(isFinished()); + MOZ_ASSERT(isFinished()); AutoFlushICache::setRange(uintptr_t(code_), pod.codeBytes_); } @@ -703,8 +703,8 @@ AddressOf(AsmJSImmKind kind, ExclusiveContext *cx) void AsmJSModule::staticallyLink(ExclusiveContext *cx) { - JS_ASSERT(isFinished()); - JS_ASSERT(!isStaticallyLinked()); + MOZ_ASSERT(isFinished()); + MOZ_ASSERT(!isStaticallyLinked()); // Process staticLinkData_ @@ -739,15 +739,15 @@ AsmJSModule::staticallyLink(ExclusiveContext *cx) exitDatum.ionScript = nullptr; } - JS_ASSERT(isStaticallyLinked()); + MOZ_ASSERT(isStaticallyLinked()); } void AsmJSModule::initHeap(Handle heap, JSContext *cx) { - JS_ASSERT(IsValidAsmJSHeapLength(heap->byteLength())); - JS_ASSERT(dynamicallyLinked_); - JS_ASSERT(!maybeHeap_); + MOZ_ASSERT(IsValidAsmJSHeapLength(heap->byteLength())); + MOZ_ASSERT(dynamicallyLinked_); + MOZ_ASSERT(!maybeHeap_); maybeHeap_ = heap; heapDatum() = heap->dataPointer(); @@ -761,7 +761,7 @@ AsmJSModule::initHeap(Handle heap, JSContext *cx X86Assembler::setPointer(access.patchLengthAt(code_), heapLength); void *addr = access.patchOffsetAt(code_); uint32_t disp = reinterpret_cast(X86Assembler::getPointer(addr)); - JS_ASSERT(disp <= INT32_MAX); + MOZ_ASSERT(disp <= INT32_MAX); X86Assembler::setPointer(addr, (void *)(heapOffset + disp)); } #elif defined(JS_CODEGEN_X64) @@ -825,7 +825,7 @@ AsmJSModule::restoreToInitialState(uint8_t *prevCode, const jit::AsmJSHeapAccess &access = heapAccesses_[i]; void *addr = access.patchOffsetAt(code_); uint8_t *ptr = reinterpret_cast(X86Assembler::getPointer(addr)); - JS_ASSERT(ptr >= ptrBase); + MOZ_ASSERT(ptr >= ptrBase); X86Assembler::setPointer(addr, (void *)(ptr - ptrBase)); } #endif @@ -876,7 +876,7 @@ AsmJSModuleObject::create(ExclusiveContext *cx, ScopedJSDeletePtr * AsmJSModule & AsmJSModuleObject::module() const { - JS_ASSERT(is()); + MOZ_ASSERT(is()); return *(AsmJSModule *)getReservedSlot(MODULE_SLOT).toPrivate(); } @@ -1207,23 +1207,23 @@ AsmJSModule::CodeRange::CodeRange(uint32_t nameIndex, uint32_t lineNumber, u.kind_ = Function; setDeltas(l.entry.offset(), l.profilingJump.offset(), l.profilingEpilogue.offset()); - JS_ASSERT(l.begin.offset() < l.entry.offset()); - JS_ASSERT(l.entry.offset() < l.profilingJump.offset()); - JS_ASSERT(l.profilingJump.offset() < l.profilingEpilogue.offset()); - JS_ASSERT(l.profilingEpilogue.offset() < l.profilingReturn.offset()); - JS_ASSERT(l.profilingReturn.offset() < l.end.offset()); + MOZ_ASSERT(l.begin.offset() < l.entry.offset()); + MOZ_ASSERT(l.entry.offset() < l.profilingJump.offset()); + MOZ_ASSERT(l.profilingJump.offset() < l.profilingEpilogue.offset()); + MOZ_ASSERT(l.profilingEpilogue.offset() < l.profilingReturn.offset()); + MOZ_ASSERT(l.profilingReturn.offset() < l.end.offset()); } void AsmJSModule::CodeRange::setDeltas(uint32_t entry, uint32_t profilingJump, uint32_t profilingEpilogue) { - JS_ASSERT(entry - begin_ <= UINT8_MAX); + MOZ_ASSERT(entry - begin_ <= UINT8_MAX); u.func.beginToEntry_ = entry - begin_; - JS_ASSERT(profilingReturn_ - profilingJump <= UINT8_MAX); + MOZ_ASSERT(profilingReturn_ - profilingJump <= UINT8_MAX); u.func.profilingJumpToProfilingReturn_ = profilingReturn_ - profilingJump; - JS_ASSERT(profilingReturn_ - profilingEpilogue <= UINT8_MAX); + MOZ_ASSERT(profilingReturn_ - profilingEpilogue <= UINT8_MAX); u.func.profilingEpilogueToProfilingReturn_ = profilingReturn_ - profilingEpilogue; } @@ -1233,8 +1233,8 @@ AsmJSModule::CodeRange::CodeRange(Kind kind, uint32_t begin, uint32_t end) { u.kind_ = kind; - JS_ASSERT(begin_ <= end_); - JS_ASSERT(u.kind_ == Entry || u.kind_ == Inline); + MOZ_ASSERT(begin_ <= end_); + MOZ_ASSERT(u.kind_ == Entry || u.kind_ == Inline); } AsmJSModule::CodeRange::CodeRange(Kind kind, uint32_t begin, uint32_t profilingReturn, uint32_t end) @@ -1244,9 +1244,9 @@ AsmJSModule::CodeRange::CodeRange(Kind kind, uint32_t begin, uint32_t profilingR { u.kind_ = kind; - JS_ASSERT(begin_ < profilingReturn_); - JS_ASSERT(profilingReturn_ < end_); - JS_ASSERT(u.kind_ == IonFFI || u.kind_ == SlowFFI || u.kind_ == Interrupt); + MOZ_ASSERT(begin_ < profilingReturn_); + MOZ_ASSERT(profilingReturn_ < end_); + MOZ_ASSERT(u.kind_ == IonFFI || u.kind_ == SlowFFI || u.kind_ == Interrupt); } AsmJSModule::CodeRange::CodeRange(AsmJSExit::BuiltinKind builtin, uint32_t begin, @@ -1258,8 +1258,8 @@ AsmJSModule::CodeRange::CodeRange(AsmJSExit::BuiltinKind builtin, uint32_t begin u.kind_ = Thunk; u.thunk.target_ = builtin; - JS_ASSERT(begin_ < profilingReturn_); - JS_ASSERT(profilingReturn_ < end_); + MOZ_ASSERT(begin_ < profilingReturn_); + MOZ_ASSERT(profilingReturn_ < end_); } void @@ -1556,7 +1556,7 @@ AsmJSModule::clone(JSContext *cx, ScopedJSDeletePtr *moduleOut) con void AsmJSModule::setProfilingEnabled(bool enabled, JSContext *cx) { - JS_ASSERT(isDynamicallyLinked()); + MOZ_ASSERT(isDynamicallyLinked()); if (profilingEnabled_ == enabled) return; @@ -1674,24 +1674,24 @@ AsmJSModule::setProfilingEnabled(bool enabled, JSContext *cx) // 0x90. The offset is relative to the address of the instruction after // the jump. 0x66 0x90 is the canonical two-byte nop. ptrdiff_t jumpImmediate = profilingEpilogue - jump - 2; - JS_ASSERT(jumpImmediate > 0 && jumpImmediate <= 127); + MOZ_ASSERT(jumpImmediate > 0 && jumpImmediate <= 127); if (enabled) { - JS_ASSERT(jump[0] == 0x66); - JS_ASSERT(jump[1] == 0x90); + MOZ_ASSERT(jump[0] == 0x66); + MOZ_ASSERT(jump[1] == 0x90); jump[0] = 0xeb; jump[1] = jumpImmediate; } else { - JS_ASSERT(jump[0] == 0xeb); - JS_ASSERT(jump[1] == jumpImmediate); + MOZ_ASSERT(jump[0] == 0xeb); + MOZ_ASSERT(jump[1] == jumpImmediate); jump[0] = 0x66; jump[1] = 0x90; } #elif defined(JS_CODEGEN_ARM) if (enabled) { - JS_ASSERT(reinterpret_cast(jump)->is()); + MOZ_ASSERT(reinterpret_cast(jump)->is()); new (jump) InstBImm(BOffImm(profilingEpilogue - jump), Assembler::Always); } else { - JS_ASSERT(reinterpret_cast(jump)->is()); + MOZ_ASSERT(reinterpret_cast(jump)->is()); new (jump) InstNOP(); } #elif defined(JS_CODEGEN_MIPS) @@ -1727,7 +1727,7 @@ AsmJSModule::setProfilingEnabled(bool enabled, JSContext *cx) const AsmJSModule::CodeRange *codeRange = lookupCodeRange(caller); if (codeRange->isThunk()) continue; - JS_ASSERT(codeRange->isFunction()); + MOZ_ASSERT(codeRange->isFunction()); Assembler::PatchDataWithValueCheck(CodeLocationLabel(caller), PatchedImmPtr(to), PatchedImmPtr(from)); @@ -1740,8 +1740,8 @@ AsmJSModule::setProfilingEnabled(bool enabled, JSContext *cx) void AsmJSModule::protectCode(JSRuntime *rt) const { - JS_ASSERT(isDynamicallyLinked()); - JS_ASSERT(rt->currentThreadOwnsInterruptLock()); + MOZ_ASSERT(isDynamicallyLinked()); + MOZ_ASSERT(rt->currentThreadOwnsInterruptLock()); codeIsProtected_ = true; @@ -1764,8 +1764,8 @@ AsmJSModule::protectCode(JSRuntime *rt) const void AsmJSModule::unprotectCode(JSRuntime *rt) const { - JS_ASSERT(isDynamicallyLinked()); - JS_ASSERT(rt->currentThreadOwnsInterruptLock()); + MOZ_ASSERT(isDynamicallyLinked()); + MOZ_ASSERT(rt->currentThreadOwnsInterruptLock()); codeIsProtected_ = false; @@ -1785,8 +1785,8 @@ AsmJSModule::unprotectCode(JSRuntime *rt) const bool AsmJSModule::codeIsProtected(JSRuntime *rt) const { - JS_ASSERT(isDynamicallyLinked()); - JS_ASSERT(rt->currentThreadOwnsInterruptLock()); + MOZ_ASSERT(isDynamicallyLinked()); + MOZ_ASSERT(rt->currentThreadOwnsInterruptLock()); return codeIsProtected_; } @@ -1910,7 +1910,7 @@ class ModuleCharsForStore : ModuleChars public: bool init(AsmJSParser &parser) { - JS_ASSERT(beginOffset(parser) < endOffset(parser)); + MOZ_ASSERT(beginOffset(parser) < endOffset(parser)); uncompressedSize_ = (endOffset(parser) - beginOffset(parser)) * sizeof(char16_t); size_t maxCompressedSize = LZ4::maxCompressedSize(uncompressedSize_); @@ -2004,7 +2004,7 @@ class ModuleCharsForLookup : ModuleChars bool match(AsmJSParser &parser) const { const char16_t *parseBegin = parser.tokenStream.rawBase() + beginOffset(parser); const char16_t *parseLimit = parser.tokenStream.rawLimit(); - JS_ASSERT(parseLimit >= parseBegin); + MOZ_ASSERT(parseLimit >= parseBegin); if (uint32_t(parseLimit - parseBegin) < chars_.length()) return false; if (!PodEqual(chars_.begin(), parseBegin, chars_.length())) @@ -2094,7 +2094,7 @@ js::StoreAsmJSModuleInCache(AsmJSParser &parser, cursor = moduleChars.serialize(cursor); cursor = module.serialize(cursor); - JS_ASSERT(cursor == entry.memory + serializedSize); + MOZ_ASSERT(cursor == entry.memory + serializedSize); return true; } diff --git a/js/src/asmjs/AsmJSModule.h b/js/src/asmjs/AsmJSModule.h index 45bc4fc8bda5..d33a04f84893 100644 --- a/js/src/asmjs/AsmJSModule.h +++ b/js/src/asmjs/AsmJSModule.h @@ -134,7 +134,7 @@ class AsmJSNumLit AsmJSNumLit lit; lit.which_ = w; lit.value.scalar_ = v; - JS_ASSERT(!lit.isSimd()); + MOZ_ASSERT(!lit.isSimd()); return lit; } @@ -142,7 +142,7 @@ class AsmJSNumLit AsmJSNumLit lit; lit.which_ = w; lit.value.simd_ = c; - JS_ASSERT(lit.isSimd()); + MOZ_ASSERT(lit.isSimd()); return lit; } @@ -151,22 +151,22 @@ class AsmJSNumLit } int32_t toInt32() const { - JS_ASSERT(which_ == Fixnum || which_ == NegativeInt || which_ == BigUnsigned); + MOZ_ASSERT(which_ == Fixnum || which_ == NegativeInt || which_ == BigUnsigned); return value.scalar_.toInt32(); } double toDouble() const { - JS_ASSERT(which_ == Double); + MOZ_ASSERT(which_ == Double); return value.scalar_.toDouble(); } float toFloat() const { - JS_ASSERT(which_ == Float); + MOZ_ASSERT(which_ == Float); return float(value.scalar_.toDouble()); } Value scalarValue() const { - JS_ASSERT(which_ != OutOfRangeInt); + MOZ_ASSERT(which_ != OutOfRangeInt); return value.scalar_; } @@ -175,7 +175,7 @@ class AsmJSNumLit } const jit::SimdConstant &simdValue() const { - JS_ASSERT(isSimd()); + MOZ_ASSERT(isSimd()); return value.simd_; } @@ -254,82 +254,82 @@ class AsmJSModule return pod.which_; } uint32_t varIndex() const { - JS_ASSERT(pod.which_ == Variable); + MOZ_ASSERT(pod.which_ == Variable); return pod.u.var.index_; } VarInitKind varInitKind() const { - JS_ASSERT(pod.which_ == Variable); + MOZ_ASSERT(pod.which_ == Variable); return pod.u.var.initKind_; } const AsmJSNumLit &varInitNumLit() const { - JS_ASSERT(pod.which_ == Variable); - JS_ASSERT(pod.u.var.initKind_ == InitConstant); + MOZ_ASSERT(pod.which_ == Variable); + MOZ_ASSERT(pod.u.var.initKind_ == InitConstant); return pod.u.var.u.numLit_; } AsmJSCoercion varInitCoercion() const { - JS_ASSERT(pod.which_ == Variable); - JS_ASSERT(pod.u.var.initKind_ == InitImport); + MOZ_ASSERT(pod.which_ == Variable); + MOZ_ASSERT(pod.u.var.initKind_ == InitImport); return pod.u.var.u.coercion_; } PropertyName *varImportField() const { - JS_ASSERT(pod.which_ == Variable); - JS_ASSERT(pod.u.var.initKind_ == InitImport); + MOZ_ASSERT(pod.which_ == Variable); + MOZ_ASSERT(pod.u.var.initKind_ == InitImport); return name_; } PropertyName *ffiField() const { - JS_ASSERT(pod.which_ == FFI); + MOZ_ASSERT(pod.which_ == FFI); return name_; } uint32_t ffiIndex() const { - JS_ASSERT(pod.which_ == FFI); + MOZ_ASSERT(pod.which_ == FFI); return pod.u.ffiIndex_; } PropertyName *viewName() const { - JS_ASSERT(pod.which_ == ArrayView); + MOZ_ASSERT(pod.which_ == ArrayView); return name_; } Scalar::Type viewType() const { - JS_ASSERT(pod.which_ == ArrayView); + MOZ_ASSERT(pod.which_ == ArrayView); return pod.u.viewType_; } PropertyName *mathName() const { - JS_ASSERT(pod.which_ == MathBuiltinFunction); + MOZ_ASSERT(pod.which_ == MathBuiltinFunction); return name_; } AsmJSMathBuiltinFunction mathBuiltinFunction() const { - JS_ASSERT(pod.which_ == MathBuiltinFunction); + MOZ_ASSERT(pod.which_ == MathBuiltinFunction); return pod.u.mathBuiltinFunc_; } AsmJSSimdType simdCtorType() const { - JS_ASSERT(pod.which_ == SimdCtor); + MOZ_ASSERT(pod.which_ == SimdCtor); return pod.u.simdCtorType_; } PropertyName *simdCtorName() const { - JS_ASSERT(pod.which_ == SimdCtor); + MOZ_ASSERT(pod.which_ == SimdCtor); return name_; } PropertyName *simdOperationName() const { - JS_ASSERT(pod.which_ == SimdOperation); + MOZ_ASSERT(pod.which_ == SimdOperation); return name_; } AsmJSSimdOperation simdOperation() const { - JS_ASSERT(pod.which_ == SimdOperation); + MOZ_ASSERT(pod.which_ == SimdOperation); return pod.u.simdOp.which_; } AsmJSSimdType simdOperationType() const { - JS_ASSERT(pod.which_ == SimdOperation); + MOZ_ASSERT(pod.which_ == SimdOperation); return pod.u.simdOp.type_; } PropertyName *constantName() const { - JS_ASSERT(pod.which_ == Constant); + MOZ_ASSERT(pod.which_ == Constant); return name_; } ConstantKind constantKind() const { - JS_ASSERT(pod.which_ == Constant); + MOZ_ASSERT(pod.which_ == Constant); return pod.u.constant.kind_; } double constantValue() const { - JS_ASSERT(pod.which_ == Constant); + MOZ_ASSERT(pod.which_ == Constant); return pod.u.constant.value_; } @@ -361,11 +361,11 @@ class AsmJSModule return globalDataOffset_; } void initInterpOffset(unsigned off) { - JS_ASSERT(!interpCodeOffset_); + MOZ_ASSERT(!interpCodeOffset_); interpCodeOffset_ = off; } void initIonOffset(unsigned off) { - JS_ASSERT(!ionCodeOffset_); + MOZ_ASSERT(!ionCodeOffset_); ionCodeOffset_ = off; } void updateOffsets(jit::MacroAssembler &masm) { @@ -449,7 +449,7 @@ class AsmJSModule } void initCodeOffset(unsigned off) { - JS_ASSERT(pod.codeOffset_ == UINT32_MAX); + MOZ_ASSERT(pod.codeOffset_ == UINT32_MAX); pod.codeOffset_ = off; } void updateCodeOffset(jit::MacroAssembler &masm) { @@ -529,42 +529,42 @@ class AsmJSModule return begin_; } uint32_t entry() const { - JS_ASSERT(isFunction()); + MOZ_ASSERT(isFunction()); return begin_ + u.func.beginToEntry_; } uint32_t end() const { return end_; } uint32_t profilingJump() const { - JS_ASSERT(isFunction()); + MOZ_ASSERT(isFunction()); return profilingReturn_ - u.func.profilingJumpToProfilingReturn_; } uint32_t profilingEpilogue() const { - JS_ASSERT(isFunction()); + MOZ_ASSERT(isFunction()); return profilingReturn_ - u.func.profilingEpilogueToProfilingReturn_; } uint32_t profilingReturn() const { - JS_ASSERT(isFunction() || isFFI() || isInterrupt() || isThunk()); + MOZ_ASSERT(isFunction() || isFFI() || isInterrupt() || isThunk()); return profilingReturn_; } uint32_t functionNameIndex() const { - JS_ASSERT(isFunction()); + MOZ_ASSERT(isFunction()); return nameIndex_; } PropertyName *functionName(const AsmJSModule &module) const { - JS_ASSERT(isFunction()); + MOZ_ASSERT(isFunction()); return module.names_[nameIndex_].name(); } const char *functionProfilingLabel(const AsmJSModule &module) const { - JS_ASSERT(isFunction()); + MOZ_ASSERT(isFunction()); return module.profilingLabels_[nameIndex_].get(); } uint32_t functionLineNumber() const { - JS_ASSERT(isFunction()); + MOZ_ASSERT(isFunction()); return lineNumber_; } AsmJSExit::BuiltinKind thunkTarget() const { - JS_ASSERT(isThunk()); + MOZ_ASSERT(isThunk()); return AsmJSExit::BuiltinKind(u.thunk.target_); } }; @@ -618,7 +618,7 @@ class AsmJSModule unsigned line = 0, unsigned column = 0) : name(name) { - JS_ASSERT(name->isTenured()); + MOZ_ASSERT(name->isTenured()); pod.startCodeOffset = start; pod.endCodeOffset = end; @@ -648,7 +648,7 @@ class AsmJSModule : ProfiledFunction(name, start, end), endInlineCodeOffset(endInline), blocks(mozilla::Move(blocksVector)) { - JS_ASSERT(name->isTenured()); + MOZ_ASSERT(name->isTenured()); } ProfiledBlocksFunction(ProfiledBlocksFunction &©) @@ -677,7 +677,7 @@ class AsmJSModule #elif defined(JS_CODEGEN_ARM) // On ARM, CodeLabels are only used to label raw pointers, so in // all cases on ARM, a RelativePatch means patching a raw pointer. - JS_ASSERT(kind == CodeLabel || kind == RawPointer); + MOZ_ASSERT(kind == CodeLabel || kind == RawPointer); #endif // On X64 and X86, all RelativePatch-es are patched as raw pointers. } @@ -707,11 +707,11 @@ class AsmJSModule public: OffsetVector &operator[](size_t i) { - JS_ASSERT(i < jit::AsmJSImm_Limit); + MOZ_ASSERT(i < jit::AsmJSImm_Limit); return array_[i]; } const OffsetVector &operator[](size_t i) const { - JS_ASSERT(i < jit::AsmJSImm_Limit); + MOZ_ASSERT(i < jit::AsmJSImm_Limit); return array_[i]; } @@ -815,7 +815,7 @@ class AsmJSModule // These functions may be used as soon as the module is constructed: ScriptSource *scriptSource() const { - JS_ASSERT(scriptSource_); + MOZ_ASSERT(scriptSource_); return scriptSource_; } bool strict() const { @@ -871,17 +871,17 @@ class AsmJSModule // module prologue (before the function bodies): void initGlobalArgumentName(PropertyName *n) { - JS_ASSERT(!isFinishedWithModulePrologue()); + MOZ_ASSERT(!isFinishedWithModulePrologue()); JS_ASSERT_IF(n, n->isTenured()); globalArgumentName_ = n; } void initImportArgumentName(PropertyName *n) { - JS_ASSERT(!isFinishedWithModulePrologue()); + MOZ_ASSERT(!isFinishedWithModulePrologue()); JS_ASSERT_IF(n, n->isTenured()); importArgumentName_ = n; } void initBufferArgumentName(PropertyName *n) { - JS_ASSERT(!isFinishedWithModulePrologue()); + MOZ_ASSERT(!isFinishedWithModulePrologue()); JS_ASSERT_IF(n, n->isTenured()); bufferArgumentName_ = n; } @@ -895,7 +895,7 @@ class AsmJSModule return bufferArgumentName_; } bool addGlobalVarInit(const AsmJSNumLit &lit, uint32_t *globalIndex) { - JS_ASSERT(!isFinishedWithModulePrologue()); + MOZ_ASSERT(!isFinishedWithModulePrologue()); Global g(Global::Variable, nullptr); g.pod.u.var.initKind_ = Global::InitConstant; g.pod.u.var.u.numLit_ = lit; @@ -926,7 +926,7 @@ class AsmJSModule MOZ_MAKE_COMPILER_ASSUME_IS_UNREACHABLE("unexpected AsmJSCoercion"); } bool addGlobalVarImport(PropertyName *name, AsmJSCoercion coercion, uint32_t *globalIndex) { - JS_ASSERT(!isFinishedWithModulePrologue()); + MOZ_ASSERT(!isFinishedWithModulePrologue()); Global g(Global::Variable, name); g.pod.u.var.initKind_ = Global::InitImport; g.pod.u.var.u.coercion_ = coercion; @@ -936,7 +936,7 @@ class AsmJSModule return globals_.append(g); } bool addFFI(PropertyName *field, uint32_t *ffiIndex) { - JS_ASSERT(!isFinishedWithModulePrologue()); + MOZ_ASSERT(!isFinishedWithModulePrologue()); if (pod.numFFIs_ == UINT32_MAX) return false; Global g(Global::FFI, field); @@ -944,20 +944,20 @@ class AsmJSModule return globals_.append(g); } bool addArrayView(Scalar::Type vt, PropertyName *field) { - JS_ASSERT(!isFinishedWithModulePrologue()); + MOZ_ASSERT(!isFinishedWithModulePrologue()); pod.hasArrayView_ = true; Global g(Global::ArrayView, field); g.pod.u.viewType_ = vt; return globals_.append(g); } bool addMathBuiltinFunction(AsmJSMathBuiltinFunction func, PropertyName *field) { - JS_ASSERT(!isFinishedWithModulePrologue()); + MOZ_ASSERT(!isFinishedWithModulePrologue()); Global g(Global::MathBuiltinFunction, field); g.pod.u.mathBuiltinFunc_ = func; return globals_.append(g); } bool addMathBuiltinConstant(double value, PropertyName *field) { - JS_ASSERT(!isFinishedWithModulePrologue()); + MOZ_ASSERT(!isFinishedWithModulePrologue()); Global g(Global::Constant, field); g.pod.u.constant.value_ = value; g.pod.u.constant.kind_ = Global::MathConstant; @@ -975,7 +975,7 @@ class AsmJSModule return globals_.append(g); } bool addGlobalConstant(double value, PropertyName *name) { - JS_ASSERT(!isFinishedWithModulePrologue()); + MOZ_ASSERT(!isFinishedWithModulePrologue()); Global g(Global::Constant, name); g.pod.u.constant.value_ = value; g.pod.u.constant.kind_ = Global::GlobalConstant; @@ -991,16 +991,16 @@ class AsmJSModule /*************************************************************************/ void startFunctionBodies() { - JS_ASSERT(!isFinishedWithModulePrologue()); + MOZ_ASSERT(!isFinishedWithModulePrologue()); pod.funcPtrTableAndExitBytes_ = 0; - JS_ASSERT(isFinishedWithModulePrologue()); + MOZ_ASSERT(isFinishedWithModulePrologue()); } /*************************************************************************/ // These functions are called while parsing/compiling function bodies: void requireHeapLengthToBeAtLeast(uint32_t len) { - JS_ASSERT(isFinishedWithModulePrologue() && !isFinishedWithFunctionBodies()); + MOZ_ASSERT(isFinishedWithModulePrologue() && !isFinishedWithFunctionBodies()); len = RoundUpToNextValidAsmJSHeapLength(len); if (len > pod.minHeapLength_) pod.minHeapLength_ = len; @@ -1014,8 +1014,8 @@ class AsmJSModule bool addFunctionCodeRange(PropertyName *name, uint32_t lineNumber, const AsmJSFunctionLabels &labels) { - JS_ASSERT(!isFinished()); - JS_ASSERT(name->isTenured()); + MOZ_ASSERT(!isFinished()); + MOZ_ASSERT(name->isTenured()); if (names_.length() >= UINT32_MAX) return false; uint32_t nameIndex = names_.length(); @@ -1028,7 +1028,7 @@ class AsmJSModule codeRanges_.append(CodeRange(builtin, begin, profilingReturn, end)); } bool addExit(unsigned ffiIndex, unsigned *exitIndex) { - JS_ASSERT(isFinishedWithModulePrologue() && !isFinishedWithFunctionBodies()); + MOZ_ASSERT(isFinishedWithModulePrologue() && !isFinishedWithFunctionBodies()); if (SIZE_MAX - pod.funcPtrTableAndExitBytes_ < sizeof(ExitDatum)) return false; uint32_t globalDataOffset = globalDataBytes(); @@ -1038,20 +1038,20 @@ class AsmJSModule return exits_.append(Exit(ffiIndex, globalDataOffset)); } unsigned numExits() const { - JS_ASSERT(isFinishedWithModulePrologue()); + MOZ_ASSERT(isFinishedWithModulePrologue()); return exits_.length(); } Exit &exit(unsigned i) { - JS_ASSERT(isFinishedWithModulePrologue()); + MOZ_ASSERT(isFinishedWithModulePrologue()); return exits_[i]; } const Exit &exit(unsigned i) const { - JS_ASSERT(isFinishedWithModulePrologue()); + MOZ_ASSERT(isFinishedWithModulePrologue()); return exits_[i]; } bool addFuncPtrTable(unsigned numElems, uint32_t *globalDataOffset) { - JS_ASSERT(isFinishedWithModulePrologue() && !isFinished()); - JS_ASSERT(IsPowerOfTwo(numElems)); + MOZ_ASSERT(isFinishedWithModulePrologue() && !isFinished()); + MOZ_ASSERT(IsPowerOfTwo(numElems)); if (SIZE_MAX - pod.funcPtrTableAndExitBytes_ < numElems * sizeof(void*)) return false; *globalDataOffset = globalDataBytes(); @@ -1061,23 +1061,23 @@ class AsmJSModule return true; } bool addFunctionCounts(jit::IonScriptCounts *counts) { - JS_ASSERT(isFinishedWithModulePrologue() && !isFinishedWithFunctionBodies()); + MOZ_ASSERT(isFinishedWithModulePrologue() && !isFinishedWithFunctionBodies()); return functionCounts_.append(counts); } #if defined(MOZ_VTUNE) || defined(JS_ION_PERF) bool addProfiledFunction(PropertyName *name, unsigned codeStart, unsigned codeEnd, unsigned line, unsigned column) { - JS_ASSERT(isFinishedWithModulePrologue() && !isFinishedWithFunctionBodies()); + MOZ_ASSERT(isFinishedWithModulePrologue() && !isFinishedWithFunctionBodies()); ProfiledFunction func(name, codeStart, codeEnd, line, column); return profiledFunctions_.append(func); } unsigned numProfiledFunctions() const { - JS_ASSERT(isFinishedWithModulePrologue()); + MOZ_ASSERT(isFinishedWithModulePrologue()); return profiledFunctions_.length(); } ProfiledFunction &profiledFunction(unsigned i) { - JS_ASSERT(isFinishedWithModulePrologue()); + MOZ_ASSERT(isFinishedWithModulePrologue()); return profiledFunctions_[i]; } #endif @@ -1085,16 +1085,16 @@ class AsmJSModule bool addProfiledBlocks(PropertyName *name, unsigned codeBegin, unsigned inlineEnd, unsigned codeEnd, jit::BasicBlocksVector &basicBlocks) { - JS_ASSERT(isFinishedWithModulePrologue() && !isFinishedWithFunctionBodies()); + MOZ_ASSERT(isFinishedWithModulePrologue() && !isFinishedWithFunctionBodies()); ProfiledBlocksFunction func(name, codeBegin, inlineEnd, codeEnd, basicBlocks); return perfProfiledBlocksFunctions_.append(mozilla::Move(func)); } unsigned numPerfBlocksFunctions() const { - JS_ASSERT(isFinishedWithModulePrologue()); + MOZ_ASSERT(isFinishedWithModulePrologue()); return perfProfiledBlocksFunctions_.length(); } ProfiledBlocksFunction &perfProfiledBlocksFunction(unsigned i) { - JS_ASSERT(isFinishedWithModulePrologue()); + MOZ_ASSERT(isFinishedWithModulePrologue()); return perfProfiledBlocksFunctions_[i]; } #endif @@ -1104,9 +1104,9 @@ class AsmJSModule // This function is called after compiling the function bodies (before // compiling entries/exits) to record the extent of compiled function code. void finishFunctionBodies(size_t functionBytes) { - JS_ASSERT(isFinishedWithModulePrologue() && !isFinishedWithFunctionBodies()); + MOZ_ASSERT(isFinishedWithModulePrologue() && !isFinishedWithFunctionBodies()); pod.functionBytes_ = functionBytes; - JS_ASSERT(isFinishedWithFunctionBodies()); + MOZ_ASSERT(isFinishedWithFunctionBodies()); } /*************************************************************************/ @@ -1124,23 +1124,23 @@ class AsmJSModule // NB: funcSrcBegin/funcSrcEnd are given relative to the ScriptSource // (the entire file) and ExportedFunctions store offsets relative to // the beginning of the module (so that they are caching-invariant). - JS_ASSERT(isFinishedWithFunctionBodies() && !isFinished()); - JS_ASSERT(srcStart_ < funcSrcBegin); - JS_ASSERT(funcSrcBegin < funcSrcEnd); + MOZ_ASSERT(isFinishedWithFunctionBodies() && !isFinished()); + MOZ_ASSERT(srcStart_ < funcSrcBegin); + MOZ_ASSERT(funcSrcBegin < funcSrcEnd); ExportedFunction func(name, funcSrcBegin - srcStart_, funcSrcEnd - srcStart_, maybeFieldName, mozilla::Move(argCoercions), returnType); return exports_.length() < UINT32_MAX && exports_.append(mozilla::Move(func)); } unsigned numExportedFunctions() const { - JS_ASSERT(isFinishedWithFunctionBodies()); + MOZ_ASSERT(isFinishedWithFunctionBodies()); return exports_.length(); } const ExportedFunction &exportedFunction(unsigned i) const { - JS_ASSERT(isFinishedWithFunctionBodies()); + MOZ_ASSERT(isFinishedWithFunctionBodies()); return exports_[i]; } ExportedFunction &exportedFunction(unsigned i) { - JS_ASSERT(isFinishedWithFunctionBodies()); + MOZ_ASSERT(isFinishedWithFunctionBodies()); return exports_[i]; } @@ -1159,50 +1159,50 @@ class AsmJSModule // These accessor functions can be used after finish(): bool hasArrayView() const { - JS_ASSERT(isFinished()); + MOZ_ASSERT(isFinished()); return pod.hasArrayView_; } unsigned numFFIs() const { - JS_ASSERT(isFinished()); + MOZ_ASSERT(isFinished()); return pod.numFFIs_; } uint32_t srcEndBeforeCurly() const { - JS_ASSERT(isFinished()); + MOZ_ASSERT(isFinished()); return srcStart_ + pod.srcLength_; } uint32_t srcEndAfterCurly() const { - JS_ASSERT(isFinished()); + MOZ_ASSERT(isFinished()); return srcStart_ + pod.srcLengthWithRightBrace_; } uint8_t *codeBase() const { - JS_ASSERT(isFinished()); - JS_ASSERT(uintptr_t(code_) % AsmJSPageSize == 0); + MOZ_ASSERT(isFinished()); + MOZ_ASSERT(uintptr_t(code_) % AsmJSPageSize == 0); return code_; } size_t functionBytes() const { - JS_ASSERT(isFinished()); + MOZ_ASSERT(isFinished()); return pod.functionBytes_; } size_t codeBytes() const { - JS_ASSERT(isFinished()); + MOZ_ASSERT(isFinished()); return pod.codeBytes_; } bool containsFunctionPC(void *pc) const { - JS_ASSERT(isFinished()); + MOZ_ASSERT(isFinished()); return pc >= code_ && pc < (code_ + functionBytes()); } bool containsCodePC(void *pc) const { - JS_ASSERT(isFinished()); + MOZ_ASSERT(isFinished()); return pc >= code_ && pc < (code_ + codeBytes()); } uint8_t *interpExitTrampoline(const Exit &exit) const { - JS_ASSERT(isFinished()); - JS_ASSERT(exit.interpCodeOffset_); + MOZ_ASSERT(isFinished()); + MOZ_ASSERT(exit.interpCodeOffset_); return code_ + exit.interpCodeOffset_; } uint8_t *ionExitTrampoline(const Exit &exit) const { - JS_ASSERT(isFinished()); - JS_ASSERT(exit.ionCodeOffset_); + MOZ_ASSERT(isFinished()); + MOZ_ASSERT(exit.ionCodeOffset_); return code_ + exit.ionCodeOffset_; } @@ -1231,11 +1231,11 @@ class AsmJSModule // while type checking function bodies (as exits and uses of // function-pointer tables are encountered). size_t offsetOfGlobalData() const { - JS_ASSERT(isFinished()); + MOZ_ASSERT(isFinished()); return pod.codeBytes_; } uint8_t *globalData() const { - JS_ASSERT(isFinished()); + MOZ_ASSERT(isFinished()); return code_ + offsetOfGlobalData(); } size_t globalSimdVarsOffset() const { @@ -1265,7 +1265,7 @@ class AsmJSModule return sizeof(void*); } uint8_t *&heapDatum() const { - JS_ASSERT(isFinished()); + MOZ_ASSERT(isFinished()); return *(uint8_t**)(globalData() + heapGlobalDataOffset()); } static unsigned nan64GlobalDataOffset() { @@ -1285,24 +1285,24 @@ class AsmJSModule *(float *)(globalData() + nan32GlobalDataOffset()) = GenericNaN(); } unsigned globalSimdVarIndexToGlobalDataOffset(unsigned i) const { - JS_ASSERT(isFinishedWithModulePrologue()); - JS_ASSERT(i < pod.numGlobalSimdVars_); + MOZ_ASSERT(isFinishedWithModulePrologue()); + MOZ_ASSERT(i < pod.numGlobalSimdVars_); return globalSimdVarsOffset() + i * jit::Simd128DataSize; } unsigned globalScalarVarIndexToGlobalDataOffset(unsigned i) const { - JS_ASSERT(isFinishedWithModulePrologue()); - JS_ASSERT(i < pod.numGlobalScalarVars_); + MOZ_ASSERT(isFinishedWithModulePrologue()); + MOZ_ASSERT(i < pod.numGlobalScalarVars_); return globalSimdVarsOffset() + pod.numGlobalSimdVars_ * jit::Simd128DataSize + i * sizeof(uint64_t); } void *globalScalarVarIndexToGlobalDatum(unsigned i) const { - JS_ASSERT(isFinished()); + MOZ_ASSERT(isFinished()); return (void *)(globalData() + globalScalarVarIndexToGlobalDataOffset(i)); } void *globalSimdVarIndexToGlobalDatum(unsigned i) const { - JS_ASSERT(isFinished()); + MOZ_ASSERT(isFinished()); return (void *)(globalData() + globalSimdVarIndexToGlobalDataOffset(i)); } void *globalVarToGlobalDatum(const Global &g) const { @@ -1313,26 +1313,26 @@ class AsmJSModule : globalScalarVarIndexToGlobalDatum(index); } - JS_ASSERT(g.varInitKind() == Global::VarInitKind::InitImport); + MOZ_ASSERT(g.varInitKind() == Global::VarInitKind::InitImport); return IsSimdCoercion(g.varInitCoercion()) ? globalSimdVarIndexToGlobalDatum(index) : globalScalarVarIndexToGlobalDatum(index); } uint8_t **globalDataOffsetToFuncPtrTable(unsigned globalDataOffset) const { - JS_ASSERT(isFinished()); - JS_ASSERT(globalDataOffset < globalDataBytes()); + MOZ_ASSERT(isFinished()); + MOZ_ASSERT(globalDataOffset < globalDataBytes()); return (uint8_t **)(globalData() + globalDataOffset); } unsigned exitIndexToGlobalDataOffset(unsigned exitIndex) const { - JS_ASSERT(isFinishedWithModulePrologue()); + MOZ_ASSERT(isFinishedWithModulePrologue()); return exits_[exitIndex].globalDataOffset(); } ExitDatum &exitIndexToGlobalDatum(unsigned exitIndex) const { - JS_ASSERT(isFinished()); + MOZ_ASSERT(isFinished()); return *(ExitDatum *)(globalData() + exitIndexToGlobalDataOffset(exitIndex)); } void detachIonCompilation(size_t exitIndex) const { - JS_ASSERT(isFinished()); + MOZ_ASSERT(isFinished()); ExitDatum &exitDatum = exitIndexToGlobalDatum(exitIndex); exitDatum.exit = interpExitTrampoline(exit(exitIndex)); exitDatum.ionScript = nullptr; @@ -1342,7 +1342,7 @@ class AsmJSModule // These functions are called after finish() but before staticallyLink(): bool addRelativeLink(RelativeLink link) { - JS_ASSERT(isFinished() && !isStaticallyLinked()); + MOZ_ASSERT(isFinished() && !isStaticallyLinked()); return staticLinkData_.relativeLinks.append(link); } @@ -1371,9 +1371,9 @@ class AsmJSModule // variables. A given asm.js module cannot be dynamically linked more than // once so, if JS tries, the module is cloned. void setIsDynamicallyLinked() { - JS_ASSERT(!isDynamicallyLinked()); + MOZ_ASSERT(!isDynamicallyLinked()); dynamicallyLinked_ = true; - JS_ASSERT(isDynamicallyLinked()); + MOZ_ASSERT(isDynamicallyLinked()); } void initHeap(Handle heap, JSContext *cx); bool clone(JSContext *cx, ScopedJSDeletePtr *moduleOut) const; @@ -1385,27 +1385,27 @@ class AsmJSModule // Functions that can be called after dynamic linking succeeds: CodePtr entryTrampoline(const ExportedFunction &func) const { - JS_ASSERT(isDynamicallyLinked()); + MOZ_ASSERT(isDynamicallyLinked()); return JS_DATA_TO_FUNC_PTR(CodePtr, code_ + func.pod.codeOffset_); } uint8_t *interruptExit() const { - JS_ASSERT(isDynamicallyLinked()); + MOZ_ASSERT(isDynamicallyLinked()); return interruptExit_; } uint8_t *maybeHeap() const { - JS_ASSERT(isDynamicallyLinked()); + MOZ_ASSERT(isDynamicallyLinked()); return heapDatum(); } ArrayBufferObjectMaybeShared *maybeHeapBufferObject() const { - JS_ASSERT(isDynamicallyLinked()); + MOZ_ASSERT(isDynamicallyLinked()); return maybeHeap_; } size_t heapLength() const { - JS_ASSERT(isDynamicallyLinked()); + MOZ_ASSERT(isDynamicallyLinked()); return maybeHeap_ ? maybeHeap_->byteLength() : 0; } bool profilingEnabled() const { - JS_ASSERT(isDynamicallyLinked()); + MOZ_ASSERT(isDynamicallyLinked()); return profilingEnabled_; } void setProfilingEnabled(bool enabled, JSContext *cx); diff --git a/js/src/asmjs/AsmJSSignalHandlers.cpp b/js/src/asmjs/AsmJSSignalHandlers.cpp index 70177419ce53..2fae613a9abd 100644 --- a/js/src/asmjs/AsmJSSignalHandlers.cpp +++ b/js/src/asmjs/AsmJSSignalHandlers.cpp @@ -185,13 +185,13 @@ class AutoSetHandlingSignal explicit AutoSetHandlingSignal(JSRuntime *rt) : rt(rt) { - JS_ASSERT(!rt->handlingSignal); + MOZ_ASSERT(!rt->handlingSignal); rt->handlingSignal = true; } ~AutoSetHandlingSignal() { - JS_ASSERT(rt->handlingSignal); + MOZ_ASSERT(rt->handlingSignal); rt->handlingSignal = false; } }; @@ -439,7 +439,7 @@ HandleException(PEXCEPTION_POINTERS exception) uint8_t **ppc = ContextToPC(context); uint8_t *pc = *ppc; - JS_ASSERT(pc == record->ExceptionAddress); + MOZ_ASSERT(pc == record->ExceptionAddress); if (record->NumberParameters < 2) return false; @@ -825,7 +825,7 @@ AsmJSMachExceptionHandler::uninstall() } if (port_ != MACH_PORT_NULL) { DebugOnly kret = mach_port_destroy(mach_task_self(), port_); - JS_ASSERT(kret == KERN_SUCCESS); + MOZ_ASSERT(kret == KERN_SUCCESS); port_ = MACH_PORT_NULL; } } @@ -833,7 +833,7 @@ AsmJSMachExceptionHandler::uninstall() bool AsmJSMachExceptionHandler::install(JSRuntime *rt) { - JS_ASSERT(!installed()); + MOZ_ASSERT(!installed()); kern_return_t kret; mach_port_t thread; @@ -1056,7 +1056,7 @@ js::RequestInterruptForAsmJSCode(JSRuntime *rt, int interruptModeRaw) if (!activation) return; - JS_ASSERT(rt->currentThreadOwnsInterruptLock()); + MOZ_ASSERT(rt->currentThreadOwnsInterruptLock()); activation->module().protectCode(rt); } diff --git a/js/src/asmjs/AsmJSValidate.cpp b/js/src/asmjs/AsmJSValidate.cpp index 7bb112851435..1b6524287338 100644 --- a/js/src/asmjs/AsmJSValidate.cpp +++ b/js/src/asmjs/AsmJSValidate.cpp @@ -81,106 +81,106 @@ NextNode(ParseNode *pn) static inline ParseNode * UnaryKid(ParseNode *pn) { - JS_ASSERT(pn->isArity(PN_UNARY)); + MOZ_ASSERT(pn->isArity(PN_UNARY)); return pn->pn_kid; } static inline ParseNode * ReturnExpr(ParseNode *pn) { - JS_ASSERT(pn->isKind(PNK_RETURN)); + MOZ_ASSERT(pn->isKind(PNK_RETURN)); return UnaryKid(pn); } static inline ParseNode * BinaryRight(ParseNode *pn) { - JS_ASSERT(pn->isArity(PN_BINARY)); + MOZ_ASSERT(pn->isArity(PN_BINARY)); return pn->pn_right; } static inline ParseNode * BinaryLeft(ParseNode *pn) { - JS_ASSERT(pn->isArity(PN_BINARY)); + MOZ_ASSERT(pn->isArity(PN_BINARY)); return pn->pn_left; } static inline ParseNode * TernaryKid1(ParseNode *pn) { - JS_ASSERT(pn->isArity(PN_TERNARY)); + MOZ_ASSERT(pn->isArity(PN_TERNARY)); return pn->pn_kid1; } static inline ParseNode * TernaryKid2(ParseNode *pn) { - JS_ASSERT(pn->isArity(PN_TERNARY)); + MOZ_ASSERT(pn->isArity(PN_TERNARY)); return pn->pn_kid2; } static inline ParseNode * TernaryKid3(ParseNode *pn) { - JS_ASSERT(pn->isArity(PN_TERNARY)); + MOZ_ASSERT(pn->isArity(PN_TERNARY)); return pn->pn_kid3; } static inline ParseNode * ListHead(ParseNode *pn) { - JS_ASSERT(pn->isArity(PN_LIST)); + MOZ_ASSERT(pn->isArity(PN_LIST)); return pn->pn_head; } static inline unsigned ListLength(ParseNode *pn) { - JS_ASSERT(pn->isArity(PN_LIST)); + MOZ_ASSERT(pn->isArity(PN_LIST)); return pn->pn_count; } static inline ParseNode * CallCallee(ParseNode *pn) { - JS_ASSERT(pn->isKind(PNK_CALL)); + MOZ_ASSERT(pn->isKind(PNK_CALL)); return ListHead(pn); } static inline unsigned CallArgListLength(ParseNode *pn) { - JS_ASSERT(pn->isKind(PNK_CALL)); - JS_ASSERT(ListLength(pn) >= 1); + MOZ_ASSERT(pn->isKind(PNK_CALL)); + MOZ_ASSERT(ListLength(pn) >= 1); return ListLength(pn) - 1; } static inline ParseNode * CallArgList(ParseNode *pn) { - JS_ASSERT(pn->isKind(PNK_CALL)); + MOZ_ASSERT(pn->isKind(PNK_CALL)); return NextNode(ListHead(pn)); } static inline ParseNode * VarListHead(ParseNode *pn) { - JS_ASSERT(pn->isKind(PNK_VAR) || pn->isKind(PNK_CONST)); + MOZ_ASSERT(pn->isKind(PNK_VAR) || pn->isKind(PNK_CONST)); return ListHead(pn); } static inline ParseNode * CaseExpr(ParseNode *pn) { - JS_ASSERT(pn->isKind(PNK_CASE) || pn->isKind(PNK_DEFAULT)); + MOZ_ASSERT(pn->isKind(PNK_CASE) || pn->isKind(PNK_DEFAULT)); return BinaryLeft(pn); } static inline ParseNode * CaseBody(ParseNode *pn) { - JS_ASSERT(pn->isKind(PNK_CASE) || pn->isKind(PNK_DEFAULT)); + MOZ_ASSERT(pn->isKind(PNK_CASE) || pn->isKind(PNK_DEFAULT)); return BinaryRight(pn); } @@ -193,15 +193,15 @@ IsExpressionStatement(ParseNode *pn) static inline ParseNode * ExpressionStatementExpr(ParseNode *pn) { - JS_ASSERT(pn->isKind(PNK_SEMI)); + MOZ_ASSERT(pn->isKind(PNK_SEMI)); return UnaryKid(pn); } static inline PropertyName * LoopControlMaybeLabel(ParseNode *pn) { - JS_ASSERT(pn->isKind(PNK_BREAK) || pn->isKind(PNK_CONTINUE)); - JS_ASSERT(pn->isArity(PN_NULLARY)); + MOZ_ASSERT(pn->isKind(PNK_BREAK) || pn->isKind(PNK_CONTINUE)); + MOZ_ASSERT(pn->isArity(PN_NULLARY)); return pn->as().label(); } @@ -220,52 +220,52 @@ LabeledStatementStatement(ParseNode *pn) static double NumberNodeValue(ParseNode *pn) { - JS_ASSERT(pn->isKind(PNK_NUMBER)); + MOZ_ASSERT(pn->isKind(PNK_NUMBER)); return pn->pn_dval; } static bool NumberNodeHasFrac(ParseNode *pn) { - JS_ASSERT(pn->isKind(PNK_NUMBER)); + MOZ_ASSERT(pn->isKind(PNK_NUMBER)); return pn->pn_u.number.decimalPoint == HasDecimal; } static ParseNode * DotBase(ParseNode *pn) { - JS_ASSERT(pn->isKind(PNK_DOT)); - JS_ASSERT(pn->isArity(PN_NAME)); + MOZ_ASSERT(pn->isKind(PNK_DOT)); + MOZ_ASSERT(pn->isArity(PN_NAME)); return pn->expr(); } static PropertyName * DotMember(ParseNode *pn) { - JS_ASSERT(pn->isKind(PNK_DOT)); - JS_ASSERT(pn->isArity(PN_NAME)); + MOZ_ASSERT(pn->isKind(PNK_DOT)); + MOZ_ASSERT(pn->isArity(PN_NAME)); return pn->pn_atom->asPropertyName(); } static ParseNode * ElemBase(ParseNode *pn) { - JS_ASSERT(pn->isKind(PNK_ELEM)); + MOZ_ASSERT(pn->isKind(PNK_ELEM)); return BinaryLeft(pn); } static ParseNode * ElemIndex(ParseNode *pn) { - JS_ASSERT(pn->isKind(PNK_ELEM)); + MOZ_ASSERT(pn->isKind(PNK_ELEM)); return BinaryRight(pn); } static inline JSFunction * FunctionObject(ParseNode *fn) { - JS_ASSERT(fn->isKind(PNK_FUNCTION)); - JS_ASSERT(fn->isArity(PN_CODE)); + MOZ_ASSERT(fn->isKind(PNK_FUNCTION)); + MOZ_ASSERT(fn->isArity(PN_CODE)); return fn->pn_funbox->function(); } @@ -280,9 +280,9 @@ FunctionName(ParseNode *fn) static inline ParseNode * FunctionStatementList(ParseNode *fn) { - JS_ASSERT(fn->pn_body->isKind(PNK_ARGSBODY)); + MOZ_ASSERT(fn->pn_body->isKind(PNK_ARGSBODY)); ParseNode *last = fn->pn_body->last(); - JS_ASSERT(last->isKind(PNK_STATEMENTLIST)); + MOZ_ASSERT(last->isKind(PNK_STATEMENTLIST)); return last; } @@ -298,14 +298,14 @@ IsNormalObjectField(ExclusiveContext *cx, ParseNode *pn) static inline PropertyName * ObjectNormalFieldName(ExclusiveContext *cx, ParseNode *pn) { - JS_ASSERT(IsNormalObjectField(cx, pn)); + MOZ_ASSERT(IsNormalObjectField(cx, pn)); return BinaryLeft(pn)->name(); } static inline ParseNode * ObjectNormalFieldInitializer(ExclusiveContext *cx, ParseNode *pn) { - JS_ASSERT(IsNormalObjectField(cx, pn)); + MOZ_ASSERT(IsNormalObjectField(cx, pn)); return BinaryRight(pn); } @@ -318,7 +318,7 @@ IsDefinition(ParseNode *pn) static inline ParseNode * MaybeDefinitionInitializer(ParseNode *pn) { - JS_ASSERT(IsDefinition(pn)); + MOZ_ASSERT(IsDefinition(pn)); return pn->expr(); } @@ -370,7 +370,7 @@ ParseVarOrConstStatement(AsmJSParser &parser, ParseNode **var) if (!*var) return false; - JS_ASSERT((*var)->isKind(PNK_VAR) || (*var)->isKind(PNK_CONST)); + MOZ_ASSERT((*var)->isKind(PNK_VAR) || (*var)->isKind(PNK_CONST)); return true; } @@ -404,8 +404,8 @@ class Type public: Type() : which_(Which(-1)) {} static Type Of(const AsmJSNumLit &lit) { - JS_ASSERT(lit.hasType()); - JS_ASSERT(Type::Which(lit.which()) >= Fixnum && Type::Which(lit.which()) <= Float32x4); + MOZ_ASSERT(lit.hasType()); + MOZ_ASSERT(Type::Which(lit.which()) >= Fixnum && Type::Which(lit.which()) <= Float32x4); Type t; t.which_ = Type::Which(lit.which()); return t; @@ -535,7 +535,7 @@ class Type } Type simdToScalarType() const { - JS_ASSERT(isSimd()); + MOZ_ASSERT(isSimd()); switch (which_) { case Int32x4: return Int; @@ -559,7 +559,7 @@ class Type } Type simdToCoercedScalarType() const { - JS_ASSERT(isSimd()); + MOZ_ASSERT(isSimd()); switch (which_) { case Int32x4: return Intish; @@ -583,7 +583,7 @@ class Type } AsmJSSimdType simdToSimdType() const { - JS_ASSERT(isSimd()); + MOZ_ASSERT(isSimd()); switch (which_) { case Int32x4: return AsmJSSimdType_int32x4; @@ -770,7 +770,7 @@ class VarType } } static VarType Of(const AsmJSNumLit &lit) { - JS_ASSERT(lit.hasType()); + MOZ_ASSERT(lit.hasType()); VarType v; switch (lit.which()) { case AsmJSNumLit::Fixnum: @@ -823,7 +823,7 @@ class VarType MOZ_MAKE_COMPILER_ASSUME_IS_UNREACHABLE("VarType can only be Int, SIMD, Double or Float"); } static VarType FromCheckedType(Type type) { - JS_ASSERT(type.isInt() || type.isMaybeDouble() || type.isFloatish() || type.isSimd()); + MOZ_ASSERT(type.isInt() || type.isMaybeDouble() || type.isFloatish() || type.isSimd()); if (type.isMaybeDouble()) return Double; else if (type.isFloatish()) @@ -874,14 +874,14 @@ class ABIArgIter public: explicit ABIArgIter(const VecT &types) : types_(types), i_(0) { settle(); } - void operator++(int) { JS_ASSERT(!done()); i_++; settle(); } + void operator++(int) { MOZ_ASSERT(!done()); i_++; settle(); } bool done() const { return i_ == types_.length(); } - ABIArg *operator->() { JS_ASSERT(!done()); return &gen_.current(); } - ABIArg &operator*() { JS_ASSERT(!done()); return gen_.current(); } + ABIArg *operator->() { MOZ_ASSERT(!done()); return &gen_.current(); } + ABIArg &operator*() { MOZ_ASSERT(!done()); return gen_.current(); } - unsigned index() const { JS_ASSERT(!done()); return i_; } - MIRType mirType() const { JS_ASSERT(!done()); return ToMIRType(types_[i_]); } + unsigned index() const { MOZ_ASSERT(!done()); return i_; } + MIRType mirType() const { MOZ_ASSERT(!done()); return ToMIRType(types_[i_]); } uint32_t stackBytesConsumedSoFar() const { return gen_.stackBytesConsumedSoFar(); } }; @@ -1060,14 +1060,14 @@ class MOZ_STACK_CLASS ModuleCompiler bool defined() const { return defined_; } void define(ModuleCompiler &m, ParseNode *fn) { - JS_ASSERT(!defined_); + MOZ_ASSERT(!defined_); defined_ = true; srcBegin_ = fn->pn_pos.begin; srcEnd_ = fn->pn_pos.end; } - uint32_t srcBegin() const { JS_ASSERT(defined_); return srcBegin_; } - uint32_t srcEnd() const { JS_ASSERT(defined_); return srcEnd_; } + uint32_t srcBegin() const { MOZ_ASSERT(defined_); return srcBegin_; } + uint32_t srcEnd() const { MOZ_ASSERT(defined_); return srcEnd_; } Signature &sig() { return sig_; } const Signature &sig() const { return sig_; } Label &entry() const { return *entry_; } @@ -1121,59 +1121,59 @@ class MOZ_STACK_CLASS ModuleCompiler return which_; } VarType varOrConstType() const { - JS_ASSERT(which_ == Variable || which_ == ConstantLiteral || which_ == ConstantImport); + MOZ_ASSERT(which_ == Variable || which_ == ConstantLiteral || which_ == ConstantImport); return VarType(u.varOrConst.type_); } uint32_t varOrConstIndex() const { - JS_ASSERT(which_ == Variable || which_ == ConstantImport); + MOZ_ASSERT(which_ == Variable || which_ == ConstantImport); return u.varOrConst.index_; } bool isConst() const { return which_ == ConstantLiteral || which_ == ConstantImport; } AsmJSNumLit constLiteralValue() const { - JS_ASSERT(which_ == ConstantLiteral); + MOZ_ASSERT(which_ == ConstantLiteral); return u.varOrConst.literalValue_; } uint32_t funcIndex() const { - JS_ASSERT(which_ == Function); + MOZ_ASSERT(which_ == Function); return u.funcIndex_; } uint32_t funcPtrTableIndex() const { - JS_ASSERT(which_ == FuncPtrTable); + MOZ_ASSERT(which_ == FuncPtrTable); return u.funcPtrTableIndex_; } unsigned ffiIndex() const { - JS_ASSERT(which_ == FFI); + MOZ_ASSERT(which_ == FFI); return u.ffiIndex_; } Scalar::Type viewType() const { - JS_ASSERT(which_ == ArrayView); + MOZ_ASSERT(which_ == ArrayView); return u.viewType_; } bool isMathFunction() const { return which_ == MathBuiltinFunction; } AsmJSMathBuiltinFunction mathBuiltinFunction() const { - JS_ASSERT(which_ == MathBuiltinFunction); + MOZ_ASSERT(which_ == MathBuiltinFunction); return u.mathBuiltinFunc_; } bool isSimdCtor() const { return which_ == SimdCtor; } AsmJSSimdType simdCtorType() const { - JS_ASSERT(which_ == SimdCtor); + MOZ_ASSERT(which_ == SimdCtor); return u.simdCtorType_; } bool isSimdOperation() const { return which_ == SimdOperation; } AsmJSSimdOperation simdOperation() const { - JS_ASSERT(which_ == SimdOperation); + MOZ_ASSERT(which_ == SimdOperation); return u.simdOp.which_; } AsmJSSimdType simdOperationType() const { - JS_ASSERT(which_ == SimdOperation); + MOZ_ASSERT(which_ == SimdOperation); return u.simdOp.type_; } }; @@ -1203,8 +1203,8 @@ class MOZ_STACK_CLASS ModuleCompiler unsigned globalDataOffset() const { return globalDataOffset_; } bool initialized() const { return !elems_.empty(); } - void initElems(FuncPtrVector &&elems) { elems_ = Move(elems); JS_ASSERT(initialized()); } - unsigned numElems() const { JS_ASSERT(initialized()); return elems_.length(); } + void initElems(FuncPtrVector &&elems) { elems_ = Move(elems); MOZ_ASSERT(initialized()); } + unsigned numElems() const { MOZ_ASSERT(initialized()); return elems_.length(); } const Func &elem(unsigned i) const { return *elems_[i]; } }; @@ -1356,12 +1356,12 @@ class MOZ_STACK_CLASS ModuleCompiler finishedFunctionBodies_(false), supportsSimd_(cx->jitSupportsSimd()) { - JS_ASSERT(moduleFunctionNode_->pn_funbox == parser.pc->sc->asFunctionBox()); + MOZ_ASSERT(moduleFunctionNode_->pn_funbox == parser.pc->sc->asFunctionBox()); } ~ModuleCompiler() { if (errorString_) { - JS_ASSERT(errorOffset_ != UINT32_MAX); + MOZ_ASSERT(errorOffset_ != UINT32_MAX); tokenStream().reportAsmJSError(errorOffset_, JSMSG_USE_ASM_TYPE_FAIL, errorString_.get()); @@ -1430,9 +1430,9 @@ class MOZ_STACK_CLASS ModuleCompiler } bool failOffset(uint32_t offset, const char *str) { - JS_ASSERT(!errorString_); - JS_ASSERT(errorOffset_ == UINT32_MAX); - JS_ASSERT(str); + MOZ_ASSERT(!errorString_); + MOZ_ASSERT(errorOffset_ == UINT32_MAX); + MOZ_ASSERT(str); errorOffset_ = offset; errorString_ = DuplicateString(cx_, str); return false; @@ -1451,9 +1451,9 @@ class MOZ_STACK_CLASS ModuleCompiler } bool failfVA(ParseNode *pn, const char *fmt, va_list ap) { - JS_ASSERT(!errorString_); - JS_ASSERT(errorOffset_ == UINT32_MAX); - JS_ASSERT(fmt); + MOZ_ASSERT(!errorString_); + MOZ_ASSERT(errorOffset_ == UINT32_MAX); + MOZ_ASSERT(fmt); errorOffset_ = pn ? pn->pn_pos.begin : tokenStream().currentToken().pos.end; errorString_.reset(JS_vsmprintf(fmt, ap)); return false; @@ -1582,7 +1582,7 @@ class MOZ_STACK_CLASS ModuleCompiler return globals_.putNew(varName, global); } bool addFunction(PropertyName *name, Signature &&sig, Func **func) { - JS_ASSERT(!finishedFunctionBodies_); + MOZ_ASSERT(!finishedFunctionBodies_); Global *global = moduleLifo_.new_(Global::Function); if (!global) return false; @@ -1764,20 +1764,20 @@ class MOZ_STACK_CLASS ModuleCompiler // for sanity, stub code (particularly the interrupt stub) is not. // Protection works at page granularity, so we need to ensure that no // stub code gets into the function code pages. - JS_ASSERT(!finishedFunctionBodies_); + MOZ_ASSERT(!finishedFunctionBodies_); masm_.align(AsmJSPageSize); module_->finishFunctionBodies(masm_.currentOffset()); finishedFunctionBodies_ = true; } bool finishGeneratingEntry(unsigned exportIndex, Label *begin) { - JS_ASSERT(finishedFunctionBodies_); + MOZ_ASSERT(finishedFunctionBodies_); module_->exportedFunction(exportIndex).initCodeOffset(begin->offset()); uint32_t end = masm_.currentOffset(); return module_->addCodeRange(AsmJSModule::CodeRange::Entry, begin->offset(), end); } bool finishGeneratingInterpExit(unsigned exitIndex, Label *begin, Label *profilingReturn) { - JS_ASSERT(finishedFunctionBodies_); + MOZ_ASSERT(finishedFunctionBodies_); uint32_t beg = begin->offset(); module_->exit(exitIndex).initInterpOffset(beg); uint32_t pret = profilingReturn->offset(); @@ -1785,7 +1785,7 @@ class MOZ_STACK_CLASS ModuleCompiler return module_->addCodeRange(AsmJSModule::CodeRange::SlowFFI, beg, pret, end); } bool finishGeneratingIonExit(unsigned exitIndex, Label *begin, Label *profilingReturn) { - JS_ASSERT(finishedFunctionBodies_); + MOZ_ASSERT(finishedFunctionBodies_); uint32_t beg = begin->offset(); module_->exit(exitIndex).initIonOffset(beg); uint32_t pret = profilingReturn->offset(); @@ -1793,19 +1793,19 @@ class MOZ_STACK_CLASS ModuleCompiler return module_->addCodeRange(AsmJSModule::CodeRange::IonFFI, beg, pret, end); } bool finishGeneratingInterrupt(Label *begin, Label *profilingReturn) { - JS_ASSERT(finishedFunctionBodies_); + MOZ_ASSERT(finishedFunctionBodies_); uint32_t beg = begin->offset(); uint32_t pret = profilingReturn->offset(); uint32_t end = masm_.currentOffset(); return module_->addCodeRange(AsmJSModule::CodeRange::Interrupt, beg, pret, end); } bool finishGeneratingInlineStub(Label *begin) { - JS_ASSERT(finishedFunctionBodies_); + MOZ_ASSERT(finishedFunctionBodies_); uint32_t end = masm_.currentOffset(); return module_->addCodeRange(AsmJSModule::CodeRange::Inline, begin->offset(), end); } bool finishGeneratingBuiltinThunk(AsmJSExit::BuiltinKind builtin, Label *begin, Label *pret) { - JS_ASSERT(finishedFunctionBodies_); + MOZ_ASSERT(finishedFunctionBodies_); uint32_t end = masm_.currentOffset(); return module_->addBuiltinThunkCodeRange(builtin, begin->offset(), pret->offset(), end); } @@ -1997,7 +1997,7 @@ IsSimdLiteral(ModuleCompiler &m, ParseNode *pn) arg = NextNode(arg); } - JS_ASSERT(arg == nullptr); + MOZ_ASSERT(arg == nullptr); return true; } @@ -2016,7 +2016,7 @@ IsNumericLiteral(ModuleCompiler &m, ParseNode *pn) static double ExtractNumericNonFloatValue(ParseNode *pn, ParseNode **out = nullptr) { - JS_ASSERT(IsNumericNonFloatLiteral(pn)); + MOZ_ASSERT(IsNumericNonFloatLiteral(pn)); if (pn->isKind(PNK_NEG)) { pn = UnaryKid(pn); @@ -2031,7 +2031,7 @@ ExtractNumericNonFloatValue(ParseNode *pn, ParseNode **out = nullptr) static AsmJSNumLit ExtractSimdValue(ModuleCompiler &m, ParseNode *pn) { - JS_ASSERT(IsSimdLiteral(m, pn)); + MOZ_ASSERT(IsSimdLiteral(m, pn)); AsmJSSimdType type; JS_ALWAYS_TRUE(IsSimdTuple(m, pn, &type)); @@ -2039,22 +2039,22 @@ ExtractSimdValue(ModuleCompiler &m, ParseNode *pn) ParseNode *arg = CallArgList(pn); switch (type) { case AsmJSSimdType_int32x4: { - JS_ASSERT(SimdTypeToLength(type) == 4); + MOZ_ASSERT(SimdTypeToLength(type) == 4); int32_t val[4]; for (size_t i = 0; i < 4; i++, arg = NextNode(arg)) { uint32_t u32; JS_ALWAYS_TRUE(IsLiteralInt(m, arg, &u32)); val[i] = int32_t(u32); } - JS_ASSERT(arg== nullptr); + MOZ_ASSERT(arg== nullptr); return AsmJSNumLit::Create(AsmJSNumLit::Int32x4, SimdConstant::CreateX4(val)); } case AsmJSSimdType_float32x4: { - JS_ASSERT(SimdTypeToLength(type) == 4); + MOZ_ASSERT(SimdTypeToLength(type) == 4); float val[4]; for (size_t i = 0; i < 4; i++, arg = NextNode(arg)) val[i] = float(ExtractNumericNonFloatValue(arg)); - JS_ASSERT(arg == nullptr); + MOZ_ASSERT(arg == nullptr); return AsmJSNumLit::Create(AsmJSNumLit::Float32x4, SimdConstant::CreateX4(val)); } } @@ -2065,7 +2065,7 @@ ExtractSimdValue(ModuleCompiler &m, ParseNode *pn) static AsmJSNumLit ExtractNumericLiteral(ModuleCompiler &m, ParseNode *pn) { - JS_ASSERT(IsNumericLiteral(m, pn)); + MOZ_ASSERT(IsNumericLiteral(m, pn)); if (pn->isKind(PNK_CALL)) { // Float literals are explicitly coerced and thus the coerced literal may be @@ -2076,7 +2076,7 @@ ExtractNumericLiteral(ModuleCompiler &m, ParseNode *pn) return AsmJSNumLit::Create(AsmJSNumLit::Float, DoubleValue(d)); } - JS_ASSERT(CallArgListLength(pn) == 4); + MOZ_ASSERT(CallArgListLength(pn) == 4); return ExtractSimdValue(m, pn); } @@ -2088,8 +2088,8 @@ ExtractNumericLiteral(ModuleCompiler &m, ParseNode *pn) return AsmJSNumLit::Create(AsmJSNumLit::Double, DoubleValue(d)); // The syntactic checks above rule out these double values. - JS_ASSERT(!IsNegativeZero(d)); - JS_ASSERT(!IsNaN(d)); + MOZ_ASSERT(!IsNegativeZero(d)); + MOZ_ASSERT(!IsNaN(d)); // Although doubles can only *precisely* represent 53-bit integers, they // can *imprecisely* represent integers much bigger than an int64_t. @@ -2104,10 +2104,10 @@ ExtractNumericLiteral(ModuleCompiler &m, ParseNode *pn) if (i64 >= 0) { if (i64 <= INT32_MAX) return AsmJSNumLit::Create(AsmJSNumLit::Fixnum, Int32Value(i64)); - JS_ASSERT(i64 <= UINT32_MAX); + MOZ_ASSERT(i64 <= UINT32_MAX); return AsmJSNumLit::Create(AsmJSNumLit::BigUnsigned, Int32Value(uint32_t(i64))); } - JS_ASSERT(i64 >= INT32_MIN); + MOZ_ASSERT(i64 >= INT32_MIN); return AsmJSNumLit::Create(AsmJSNumLit::NegativeInt, Int32Value(i64)); } @@ -2241,12 +2241,12 @@ class FunctionCompiler { #ifdef DEBUG if (!m().hasError() && cx()->isJSContext() && !cx()->asJSContext()->isExceptionPending()) { - JS_ASSERT(loopStack_.empty()); - JS_ASSERT(unlabeledBreaks_.empty()); - JS_ASSERT(unlabeledContinues_.empty()); - JS_ASSERT(labeledBreaks_.empty()); - JS_ASSERT(labeledContinues_.empty()); - JS_ASSERT(inDeadCode()); + MOZ_ASSERT(loopStack_.empty()); + MOZ_ASSERT(unlabeledBreaks_.empty()); + MOZ_ASSERT(unlabeledContinues_.empty()); + MOZ_ASSERT(labeledBreaks_.empty()); + MOZ_ASSERT(labeledContinues_.empty()); + MOZ_ASSERT(inDeadCode()); } #endif } @@ -2273,7 +2273,7 @@ class FunctionCompiler bool prepareToEmitMIR(const VarTypeVector &argTypes) { - JS_ASSERT(locals_.count() == argTypes.length() + varInitializers_.length()); + MOZ_ASSERT(locals_.count() == argTypes.length() + varInitializers_.length()); alloc_ = lifo_.new_(&lifo_); ionContext_.emplace(m_.cx(), alloc_); @@ -2332,9 +2332,9 @@ class FunctionCompiler /************************* Read-only interface (after local scope setup) */ - MIRGenerator & mirGen() const { JS_ASSERT(mirGen_); return *mirGen_; } - MIRGraph & mirGraph() const { JS_ASSERT(graph_); return *graph_; } - CompileInfo & info() const { JS_ASSERT(info_); return *info_; } + MIRGenerator & mirGen() const { MOZ_ASSERT(mirGen_); return *mirGen_; } + MIRGraph & mirGraph() const { MOZ_ASSERT(graph_); return *graph_; } + CompileInfo & info() const { MOZ_ASSERT(info_); return *info_; } const Local *lookupLocal(PropertyName *name) const { @@ -2433,8 +2433,8 @@ class FunctionCompiler if (inDeadCode()) return nullptr; - JS_ASSERT(IsSimdType(lhs->type()) && rhs->type() == lhs->type()); - JS_ASSERT(lhs->type() == type); + MOZ_ASSERT(IsSimdType(lhs->type()) && rhs->type() == lhs->type()); + MOZ_ASSERT(lhs->type() == type); MSimdBinaryArith *ins = MSimdBinaryArith::NewAsmJS(alloc(), lhs, rhs, op, type); curBlock_->add(ins); return ins; @@ -2446,8 +2446,8 @@ class FunctionCompiler if (inDeadCode()) return nullptr; - JS_ASSERT(IsSimdType(lhs->type()) && rhs->type() == lhs->type()); - JS_ASSERT(lhs->type() == type); + MOZ_ASSERT(IsSimdType(lhs->type()) && rhs->type() == lhs->type()); + MOZ_ASSERT(lhs->type() == type); MSimdBinaryBitwise *ins = MSimdBinaryBitwise::NewAsmJS(alloc(), lhs, rhs, op, type); curBlock_->add(ins); return ins; @@ -2508,7 +2508,7 @@ class FunctionCompiler if (inDeadCode()) return nullptr; - JS_ASSERT(IsSimdType(type)); + MOZ_ASSERT(IsSimdType(type)); MSimdSplatX4 *ins = MSimdSplatX4::New(alloc(), type, v); curBlock_->add(ins); return ins; @@ -2629,7 +2629,7 @@ class FunctionCompiler { if (inDeadCode()) return; - JS_ASSERT(!global.isConst()); + MOZ_ASSERT(!global.isConst()); unsigned globalDataOffset; if (IsSimdType(v->type())) @@ -2659,8 +2659,8 @@ class FunctionCompiler if (inDeadCode()) return nullptr; - JS_ASSERT(IsSimdType(base->type())); - JS_ASSERT(!IsSimdType(type)); + MOZ_ASSERT(IsSimdType(base->type())); + MOZ_ASSERT(!IsSimdType(type)); MSimdExtractElement *ins = MSimdExtractElement::NewAsmJS(alloc(), base, type, lane); curBlock_->add(ins); return ins; @@ -2671,7 +2671,7 @@ class FunctionCompiler if (inDeadCode()) return nullptr; - JS_ASSERT(IsSimdType(base->type())); + MOZ_ASSERT(IsSimdType(base->type())); MSimdSignMask *ins = MSimdSignMask::NewAsmJS(alloc(), base); curBlock_->add(ins); return ins; @@ -2684,7 +2684,7 @@ class FunctionCompiler if (inDeadCode()) return nullptr; - JS_ASSERT(IsSimdType(type)); + MOZ_ASSERT(IsSimdType(type)); T *ins = T::New(alloc(), type, x, y, z, w); curBlock_->add(ins); return ins; @@ -2921,7 +2921,7 @@ class FunctionCompiler void assertCurrentBlockIs(MBasicBlock *block) { if (inDeadCode()) return; - JS_ASSERT(curBlock_ == block); + MOZ_ASSERT(curBlock_ == block); } bool appendThenBlock(BlockVector *thenBlocks) @@ -2979,7 +2979,7 @@ class FunctionCompiler { if (inDeadCode()) return; - JS_ASSERT(curBlock_->stackDepth() == info().firstStackSlot()); + MOZ_ASSERT(curBlock_->stackDepth() == info().firstStackSlot()); curBlock_->push(def); } @@ -2987,7 +2987,7 @@ class FunctionCompiler { if (inDeadCode()) return nullptr; - JS_ASSERT(curBlock_->stackDepth() == info().firstStackSlot() + 1); + MOZ_ASSERT(curBlock_->stackDepth() == info().firstStackSlot() + 1); return curBlock_->pop(); } @@ -3019,7 +3019,7 @@ class FunctionCompiler *afterLoop = nullptr; return true; } - JS_ASSERT(curBlock_->loopDepth() > 0); + MOZ_ASSERT(curBlock_->loopDepth() > 0); MBasicBlock *body; if (!newBlock(curBlock_, &body, bodyPn)) return false; @@ -3039,7 +3039,7 @@ class FunctionCompiler ParseNode *popLoop() { ParseNode *pn = loopStack_.popCopy(); - JS_ASSERT(!unlabeledContinues_.has(pn)); + MOZ_ASSERT(!unlabeledContinues_.has(pn)); breakableStack_.popBack(); return pn; } @@ -3049,15 +3049,15 @@ class FunctionCompiler { ParseNode *pn = popLoop(); if (!loopEntry) { - JS_ASSERT(!afterLoop); - JS_ASSERT(inDeadCode()); - JS_ASSERT(!unlabeledBreaks_.has(pn)); + MOZ_ASSERT(!afterLoop); + MOZ_ASSERT(inDeadCode()); + MOZ_ASSERT(!unlabeledBreaks_.has(pn)); return true; } - JS_ASSERT(loopEntry->loopDepth() == loopStack_.length() + 1); + MOZ_ASSERT(loopEntry->loopDepth() == loopStack_.length() + 1); JS_ASSERT_IF(afterLoop, afterLoop->loopDepth() == loopStack_.length()); if (curBlock_) { - JS_ASSERT(curBlock_->loopDepth() == loopStack_.length() + 1); + MOZ_ASSERT(curBlock_->loopDepth() == loopStack_.length() + 1); curBlock_->end(MGoto::New(alloc(), loopEntry)); if (!loopEntry->setBackedgeAsmJS(curBlock_)) return false; @@ -3072,13 +3072,13 @@ class FunctionCompiler { ParseNode *pn = popLoop(); if (!loopEntry) { - JS_ASSERT(inDeadCode()); - JS_ASSERT(!unlabeledBreaks_.has(pn)); + MOZ_ASSERT(inDeadCode()); + MOZ_ASSERT(!unlabeledBreaks_.has(pn)); return true; } - JS_ASSERT(loopEntry->loopDepth() == loopStack_.length() + 1); + MOZ_ASSERT(loopEntry->loopDepth() == loopStack_.length() + 1); if (curBlock_) { - JS_ASSERT(curBlock_->loopDepth() == loopStack_.length() + 1); + MOZ_ASSERT(curBlock_->loopDepth() == loopStack_.length() + 1); if (cond->isConstant()) { if (cond->toConstant()->valueToBoolean()) { curBlock_->end(MGoto::New(alloc(), loopEntry)); @@ -3203,7 +3203,7 @@ class FunctionCompiler MIRGenerator *extractMIR() { - JS_ASSERT(mirGen_ != nullptr); + MOZ_ASSERT(mirGen_ != nullptr); MIRGenerator *mirGen = mirGen_; mirGen_ = nullptr; return mirGen; @@ -3260,7 +3260,7 @@ class FunctionCompiler curBlock_ = next; *createdJoinBlock = true; } - JS_ASSERT(curBlock_->begin() == curBlock_->end()); + MOZ_ASSERT(curBlock_->begin() == curBlock_->end()); if (!mirGen_->ensureBallast()) return false; } @@ -3419,7 +3419,7 @@ CheckModuleArguments(ModuleCompiler &m, ParseNode *fn) static bool CheckPrecedingStatements(ModuleCompiler &m, ParseNode *stmtList) { - JS_ASSERT(stmtList->isKind(PNK_STATEMENTLIST)); + MOZ_ASSERT(stmtList->isKind(PNK_STATEMENTLIST)); if (ListLength(stmtList) != 0) return m.fail(ListHead(stmtList), "invalid asm.js statement"); @@ -4047,7 +4047,7 @@ CheckArrayAccess(FunctionCompiler &f, ParseNode *elem, Scalar::Type *viewType, if (TypedArrayShift(*viewType) != 0) return f.fail(indexExpr, "index expression isn't shifted; must be an Int8/Uint8 access"); - JS_ASSERT(mask == -1); + MOZ_ASSERT(mask == -1); bool folded = false; if (indexExpr->isKind(PNK_BITAND)) @@ -4093,7 +4093,7 @@ CheckLoadArray(FunctionCompiler &f, ParseNode *elem, MDefinition **def, Type *ty static bool CheckDotAccess(FunctionCompiler &f, ParseNode *elem, MDefinition **def, Type *type) { - JS_ASSERT(elem->isKind(PNK_DOT)); + MOZ_ASSERT(elem->isKind(PNK_DOT)); ParseNode *base = DotBase(elem); MDefinition *baseDef; @@ -4214,7 +4214,7 @@ CheckAssignName(FunctionCompiler &f, ParseNode *lhs, ParseNode *rhs, MDefinition static bool CheckAssign(FunctionCompiler &f, ParseNode *assign, MDefinition **def, Type *type) { - JS_ASSERT(assign->isKind(PNK_ASSIGN)); + MOZ_ASSERT(assign->isKind(PNK_ASSIGN)); ParseNode *lhs = BinaryLeft(assign); ParseNode *rhs = BinaryRight(assign); @@ -4432,7 +4432,7 @@ CheckSignatureAgainstExisting(ModuleCompiler &m, ParseNode *usepn, const Signatu sig.retType().toType().toChars(), existing.retType().toType().toChars()); } - JS_ASSERT(sig == existing); + MOZ_ASSERT(sig == existing); return true; } @@ -4665,7 +4665,7 @@ CheckMathFRound(FunctionCompiler &f, ParseNode *callNode, MDefinition **def, Mat if (!CheckCoercionArg(f, argNode, AsmJS_FRound, &argDef, &argType)) return false; - JS_ASSERT(argType == Type::Float); + MOZ_ASSERT(argType == Type::Float); *def = argDef; *type = MathRetType::Float; return true; @@ -5012,7 +5012,7 @@ static bool CheckSimdCtorCall(FunctionCompiler &f, ParseNode *call, const ModuleCompiler::Global *global, MDefinition **def, Type *type) { - JS_ASSERT(call->isKind(PNK_CALL)); + MOZ_ASSERT(call->isKind(PNK_CALL)); AsmJSCoercion coercion; ParseNode *argNode; @@ -5039,7 +5039,7 @@ CheckSimdCtorCall(FunctionCompiler &f, ParseNode *call, const ModuleCompiler::Gl static bool CheckUncoercedCall(FunctionCompiler &f, ParseNode *expr, MDefinition **def, Type *type) { - JS_ASSERT(expr->isKind(PNK_CALL)); + MOZ_ASSERT(expr->isKind(PNK_CALL)); const ModuleCompiler::Global *global; if (IsCallToGlobal(f.m(), expr, &global)) { @@ -5145,12 +5145,12 @@ CheckCoercedSimdCall(FunctionCompiler &f, ParseNode *call, const ModuleCompiler: if (!CheckSimdCtorCall(f, call, global, def, type)) return false; } else { - JS_ASSERT(global->isSimdOperation()); + MOZ_ASSERT(global->isSimdOperation()); if (!CheckSimdOperationCall(f, call, global, def, type)) return false; } - JS_ASSERT(type->isSimd()); + MOZ_ASSERT(type->isSimd()); return CoerceResult(f, call, retType, *def, *type, def, type); } @@ -5201,7 +5201,7 @@ CheckCoercedCall(FunctionCompiler &f, ParseNode *call, RetType retType, MDefinit static bool CheckPos(FunctionCompiler &f, ParseNode *pos, MDefinition **def, Type *type) { - JS_ASSERT(pos->isKind(PNK_POS)); + MOZ_ASSERT(pos->isKind(PNK_POS)); ParseNode *operand = UnaryKid(pos); if (operand->isKind(PNK_CALL)) @@ -5218,7 +5218,7 @@ CheckPos(FunctionCompiler &f, ParseNode *pos, MDefinition **def, Type *type) static bool CheckNot(FunctionCompiler &f, ParseNode *expr, MDefinition **def, Type *type) { - JS_ASSERT(expr->isKind(PNK_NOT)); + MOZ_ASSERT(expr->isKind(PNK_NOT)); ParseNode *operand = UnaryKid(expr); MDefinition *operandDef; @@ -5237,7 +5237,7 @@ CheckNot(FunctionCompiler &f, ParseNode *expr, MDefinition **def, Type *type) static bool CheckNeg(FunctionCompiler &f, ParseNode *expr, MDefinition **def, Type *type) { - JS_ASSERT(expr->isKind(PNK_NEG)); + MOZ_ASSERT(expr->isKind(PNK_NEG)); ParseNode *operand = UnaryKid(expr); MDefinition *operandDef; @@ -5269,7 +5269,7 @@ CheckNeg(FunctionCompiler &f, ParseNode *expr, MDefinition **def, Type *type) static bool CheckCoerceToInt(FunctionCompiler &f, ParseNode *expr, MDefinition **def, Type *type) { - JS_ASSERT(expr->isKind(PNK_BITNOT)); + MOZ_ASSERT(expr->isKind(PNK_BITNOT)); ParseNode *operand = UnaryKid(expr); MDefinition *operandDef; @@ -5294,7 +5294,7 @@ CheckCoerceToInt(FunctionCompiler &f, ParseNode *expr, MDefinition **def, Type * static bool CheckBitNot(FunctionCompiler &f, ParseNode *neg, MDefinition **def, Type *type) { - JS_ASSERT(neg->isKind(PNK_BITNOT)); + MOZ_ASSERT(neg->isKind(PNK_BITNOT)); ParseNode *operand = UnaryKid(neg); if (operand->isKind(PNK_BITNOT)) @@ -5316,7 +5316,7 @@ CheckBitNot(FunctionCompiler &f, ParseNode *neg, MDefinition **def, Type *type) static bool CheckComma(FunctionCompiler &f, ParseNode *comma, MDefinition **def, Type *type) { - JS_ASSERT(comma->isKind(PNK_COMMA)); + MOZ_ASSERT(comma->isKind(PNK_COMMA)); ParseNode *operands = ListHead(comma); ParseNode *pn = operands; @@ -5341,7 +5341,7 @@ CheckComma(FunctionCompiler &f, ParseNode *comma, MDefinition **def, Type *type) static bool CheckConditional(FunctionCompiler &f, ParseNode *ternary, MDefinition **def, Type *type) { - JS_ASSERT(ternary->isKind(PNK_CONDITIONAL)); + MOZ_ASSERT(ternary->isKind(PNK_CONDITIONAL)); ParseNode *cond = TernaryKid1(ternary); ParseNode *thenExpr = TernaryKid2(ternary); ParseNode *elseExpr = TernaryKid3(ternary); @@ -5423,7 +5423,7 @@ IsValidIntMultiplyConstant(ModuleCompiler &m, ParseNode *expr) static bool CheckMultiply(FunctionCompiler &f, ParseNode *star, MDefinition **def, Type *type) { - JS_ASSERT(star->isKind(PNK_STAR)); + MOZ_ASSERT(star->isKind(PNK_STAR)); ParseNode *lhs = BinaryLeft(star); ParseNode *rhs = BinaryRight(star); @@ -5466,7 +5466,7 @@ CheckAddOrSub(FunctionCompiler &f, ParseNode *expr, MDefinition **def, Type *typ { JS_CHECK_RECURSION_DONT_REPORT(f.cx(), return f.m().failOverRecursed()); - JS_ASSERT(expr->isKind(PNK_ADD) || expr->isKind(PNK_SUB)); + MOZ_ASSERT(expr->isKind(PNK_ADD) || expr->isKind(PNK_SUB)); ParseNode *lhs = BinaryLeft(expr); ParseNode *rhs = BinaryRight(expr); @@ -5528,7 +5528,7 @@ CheckAddOrSub(FunctionCompiler &f, ParseNode *expr, MDefinition **def, Type *typ static bool CheckDivOrMod(FunctionCompiler &f, ParseNode *expr, MDefinition **def, Type *type) { - JS_ASSERT(expr->isKind(PNK_DIV) || expr->isKind(PNK_MOD)); + MOZ_ASSERT(expr->isKind(PNK_DIV) || expr->isKind(PNK_MOD)); ParseNode *lhs = BinaryLeft(expr); ParseNode *rhs = BinaryRight(expr); @@ -5581,8 +5581,8 @@ CheckDivOrMod(FunctionCompiler &f, ParseNode *expr, MDefinition **def, Type *typ static bool CheckComparison(FunctionCompiler &f, ParseNode *comp, MDefinition **def, Type *type) { - JS_ASSERT(comp->isKind(PNK_LT) || comp->isKind(PNK_LE) || comp->isKind(PNK_GT) || - comp->isKind(PNK_GE) || comp->isKind(PNK_EQ) || comp->isKind(PNK_NE)); + MOZ_ASSERT(comp->isKind(PNK_LT) || comp->isKind(PNK_LE) || comp->isKind(PNK_GT) || + comp->isKind(PNK_GE) || comp->isKind(PNK_EQ) || comp->isKind(PNK_NE)); ParseNode *lhs = BinaryLeft(comp); ParseNode *rhs = BinaryRight(comp); @@ -5743,7 +5743,7 @@ CheckStatement(FunctionCompiler &f, ParseNode *stmt, LabelVector *maybeLabels = static bool CheckExprStatement(FunctionCompiler &f, ParseNode *exprStmt) { - JS_ASSERT(exprStmt->isKind(PNK_SEMI)); + MOZ_ASSERT(exprStmt->isKind(PNK_SEMI)); ParseNode *expr = UnaryKid(exprStmt); if (!expr) @@ -5761,7 +5761,7 @@ CheckExprStatement(FunctionCompiler &f, ParseNode *exprStmt) static bool CheckWhile(FunctionCompiler &f, ParseNode *whileStmt, const LabelVector *maybeLabels) { - JS_ASSERT(whileStmt->isKind(PNK_WHILE)); + MOZ_ASSERT(whileStmt->isKind(PNK_WHILE)); ParseNode *cond = BinaryLeft(whileStmt); ParseNode *body = BinaryRight(whileStmt); @@ -5793,7 +5793,7 @@ CheckWhile(FunctionCompiler &f, ParseNode *whileStmt, const LabelVector *maybeLa static bool CheckFor(FunctionCompiler &f, ParseNode *forStmt, const LabelVector *maybeLabels) { - JS_ASSERT(forStmt->isKind(PNK_FOR)); + MOZ_ASSERT(forStmt->isKind(PNK_FOR)); ParseNode *forHead = BinaryLeft(forStmt); ParseNode *body = BinaryRight(forStmt); @@ -5850,7 +5850,7 @@ CheckFor(FunctionCompiler &f, ParseNode *forStmt, const LabelVector *maybeLabels static bool CheckDoWhile(FunctionCompiler &f, ParseNode *whileStmt, const LabelVector *maybeLabels) { - JS_ASSERT(whileStmt->isKind(PNK_DOWHILE)); + MOZ_ASSERT(whileStmt->isKind(PNK_DOWHILE)); ParseNode *body = BinaryLeft(whileStmt); ParseNode *cond = BinaryRight(whileStmt); @@ -5878,7 +5878,7 @@ CheckDoWhile(FunctionCompiler &f, ParseNode *whileStmt, const LabelVector *maybe static bool CheckLabel(FunctionCompiler &f, ParseNode *labeledStmt, LabelVector *maybeLabels) { - JS_ASSERT(labeledStmt->isKind(PNK_LABEL)); + MOZ_ASSERT(labeledStmt->isKind(PNK_LABEL)); PropertyName *label = LabeledStatementLabel(labeledStmt); ParseNode *stmt = LabeledStatementStatement(labeledStmt); @@ -5924,7 +5924,7 @@ static bool CheckIfConditional(FunctionCompiler &f, ParseNode *conditional, ParseNode *thenStmt, ParseNode *elseOrJoinStmt, MBasicBlock **thenBlock, MBasicBlock **elseOrJoinBlock) { - JS_ASSERT(conditional->isKind(PNK_CONDITIONAL)); + MOZ_ASSERT(conditional->isKind(PNK_CONDITIONAL)); // a ? b : c <=> (a && b) || (!a && c) // b is always referred to the AND condition, as we need A and B to reach this test, @@ -6004,7 +6004,7 @@ CheckIfConditional(FunctionCompiler &f, ParseNode *conditional, ParseNode *thenS // We might not be on the thenBlock in one case if (ifTrueBlock == elseOrJoinBlock) { - JS_ASSERT(skipAndTest && andTestLiteral == 0); + MOZ_ASSERT(skipAndTest && andTestLiteral == 0); f.switchToElse(*thenBlock); } @@ -6052,7 +6052,7 @@ CheckIf(FunctionCompiler &f, ParseNode *ifStmt) ParseNode *nextStmt = NextNode(ifStmt); recurse: - JS_ASSERT(ifStmt->isKind(PNK_IF)); + MOZ_ASSERT(ifStmt->isKind(PNK_IF)); ParseNode *cond = TernaryKid1(ifStmt); ParseNode *thenStmt = TernaryKid2(ifStmt); ParseNode *elseStmt = TernaryKid3(ifStmt); @@ -6119,7 +6119,7 @@ static bool CheckDefaultAtEnd(FunctionCompiler &f, ParseNode *stmt) { for (; stmt; stmt = NextNode(stmt)) { - JS_ASSERT(stmt->isKind(PNK_CASE) || stmt->isKind(PNK_DEFAULT)); + MOZ_ASSERT(stmt->isKind(PNK_CASE) || stmt->isKind(PNK_DEFAULT)); if (stmt->isKind(PNK_DEFAULT) && NextNode(stmt) != nullptr) return f.fail(stmt, "default label must be at the end"); } @@ -6165,7 +6165,7 @@ CheckSwitchRange(FunctionCompiler &f, ParseNode *stmt, int32_t *low, int32_t *hi static bool CheckSwitch(FunctionCompiler &f, ParseNode *switchStmt) { - JS_ASSERT(switchStmt->isKind(PNK_SWITCH)); + MOZ_ASSERT(switchStmt->isKind(PNK_SWITCH)); ParseNode *switchExpr = BinaryLeft(switchStmt); ParseNode *switchBody = BinaryRight(switchStmt); @@ -6289,7 +6289,7 @@ CheckReturn(FunctionCompiler &f, ParseNode *returnStmt) static bool CheckStatementList(FunctionCompiler &f, ParseNode *stmtList) { - JS_ASSERT(stmtList->isKind(PNK_STATEMENTLIST)); + MOZ_ASSERT(stmtList->isKind(PNK_STATEMENTLIST)); for (ParseNode *stmt = ListHead(stmtList); stmt; stmt = NextNode(stmt)) { if (!CheckStatement(f, stmt)) @@ -6331,7 +6331,7 @@ ParseFunction(ModuleCompiler &m, ParseNode **fnOut) TokenStream &tokenStream = m.tokenStream(); DebugOnly tk = tokenStream.getToken(); - JS_ASSERT(tk == TOK_FUNCTION); + MOZ_ASSERT(tk == TOK_FUNCTION); RootedPropertyName name(m.cx()); @@ -6546,12 +6546,12 @@ class ParallelCompilationGuard ParallelCompilationGuard() : parallelState_(false) {} ~ParallelCompilationGuard() { if (parallelState_) { - JS_ASSERT(HelperThreadState().asmJSCompilationInProgress == true); + MOZ_ASSERT(HelperThreadState().asmJSCompilationInProgress == true); HelperThreadState().asmJSCompilationInProgress = false; } } bool claim() { - JS_ASSERT(!parallelState_); + MOZ_ASSERT(!parallelState_); if (!HelperThreadState().asmJSCompilationInProgress.compareExchange(false, true)) return false; parallelState_ = true; @@ -6652,8 +6652,8 @@ CheckFunctionsParallel(ModuleCompiler &m, ParallelGroupState &group) #ifdef DEBUG { AutoLockHelperThreadState lock; - JS_ASSERT(HelperThreadState().asmJSWorklist().empty()); - JS_ASSERT(HelperThreadState().asmJSFinishedList().empty()); + MOZ_ASSERT(HelperThreadState().asmJSWorklist().empty()); + MOZ_ASSERT(HelperThreadState().asmJSFinishedList().empty()); } #endif HelperThreadState().resetAsmJSFailureState(); @@ -6688,16 +6688,16 @@ CheckFunctionsParallel(ModuleCompiler &m, ParallelGroupState &group) if (!CheckAllFunctionsDefined(m)) return false; - JS_ASSERT(group.outstandingJobs == 0); - JS_ASSERT(group.compiledJobs == m.numFunctions()); + MOZ_ASSERT(group.outstandingJobs == 0); + MOZ_ASSERT(group.compiledJobs == m.numFunctions()); #ifdef DEBUG { AutoLockHelperThreadState lock; - JS_ASSERT(HelperThreadState().asmJSWorklist().empty()); - JS_ASSERT(HelperThreadState().asmJSFinishedList().empty()); + MOZ_ASSERT(HelperThreadState().asmJSWorklist().empty()); + MOZ_ASSERT(HelperThreadState().asmJSFinishedList().empty()); } #endif - JS_ASSERT(!HelperThreadState().asmJSFailed()); + MOZ_ASSERT(!HelperThreadState().asmJSFailed()); return true; } @@ -6710,7 +6710,7 @@ CancelOutstandingJobs(ModuleCompiler &m, ParallelGroupState &group) // return, and thereby remove the LifoAllocs, none of that memory can be in // use or reachable by helpers. - JS_ASSERT(group.outstandingJobs >= 0); + MOZ_ASSERT(group.outstandingJobs >= 0); if (!group.outstandingJobs) return; @@ -6728,7 +6728,7 @@ CancelOutstandingJobs(ModuleCompiler &m, ParallelGroupState &group) group.outstandingJobs -= HelperThreadState().harvestFailedAsmJSJobs(); // Any remaining tasks are therefore undergoing active compilation. - JS_ASSERT(group.outstandingJobs >= 0); + MOZ_ASSERT(group.outstandingJobs >= 0); while (group.outstandingJobs > 0) { HelperThreadState().wait(GlobalHelperThreadState::CONSUMER); @@ -6737,9 +6737,9 @@ CancelOutstandingJobs(ModuleCompiler &m, ParallelGroupState &group) HelperThreadState().asmJSFinishedList().clear(); } - JS_ASSERT(group.outstandingJobs == 0); - JS_ASSERT(HelperThreadState().asmJSWorklist().empty()); - JS_ASSERT(HelperThreadState().asmJSFinishedList().empty()); + MOZ_ASSERT(group.outstandingJobs == 0); + MOZ_ASSERT(HelperThreadState().asmJSWorklist().empty()); + MOZ_ASSERT(HelperThreadState().asmJSFinishedList().empty()); } static const size_t LIFO_ALLOC_PARALLEL_CHUNK_SIZE = 1 << 12; @@ -6880,7 +6880,7 @@ CheckModuleExportFunction(ModuleCompiler &m, ParseNode *returnExpr) static bool CheckModuleExportObject(ModuleCompiler &m, ParseNode *object) { - JS_ASSERT(object->isKind(PNK_OBJECT)); + MOZ_ASSERT(object->isKind(PNK_OBJECT)); for (ParseNode *pn = ListHead(object); pn; pn = NextNode(pn)) { if (!IsNormalObjectField(m.cx(), pn)) @@ -6942,7 +6942,7 @@ CheckModuleReturn(ModuleCompiler &m) static void AssertStackAlignment(MacroAssembler &masm, uint32_t alignment) { - JS_ASSERT((sizeof(AsmJSFrame) + masm.framePushed()) % alignment == 0); + MOZ_ASSERT((sizeof(AsmJSFrame) + masm.framePushed()) % alignment == 0); masm.assertStackAlignment(alignment); } @@ -7022,7 +7022,7 @@ GenerateEntry(ModuleCompiler &m, unsigned exportIndex) // the asm.js callee (which does not preserve non-volatile registers). masm.setFramePushed(0); masm.PushRegsInMask(NonVolatileRegs, NonVolatileSimdRegs); - JS_ASSERT(masm.framePushed() == FramePushedAfterSave); + MOZ_ASSERT(masm.framePushed() == FramePushedAfterSave); // ARM and MIPS have a globally-pinned GlobalReg (x64 uses RIP-relative // addressing, x86 uses immediates in effective addresses). For the @@ -7055,7 +7055,7 @@ GenerateEntry(ModuleCompiler &m, unsigned exportIndex) // this on two paths: normal return and exceptional return. Since // loadAsmJSActivation uses GlobalReg, we must do this after loading // GlobalReg. - JS_ASSERT(masm.framePushed() == FramePushedForEntrySP); + MOZ_ASSERT(masm.framePushed() == FramePushedForEntrySP); masm.loadAsmJSActivation(scratch); masm.storePtr(StackPointer, Address(scratch, AsmJSActivation::offsetOfEntrySP())); @@ -7167,7 +7167,7 @@ GenerateEntry(ModuleCompiler &m, unsigned exportIndex) // Restore clobbered non-volatile registers of the caller. masm.PopRegsInMask(NonVolatileRegs, NonVolatileSimdRegs); - JS_ASSERT(masm.framePushed() == 0); + MOZ_ASSERT(masm.framePushed() == 0); masm.move32(Imm32(true), ReturnReg); masm.ret(); @@ -7202,7 +7202,7 @@ FillArgumentArray(ModuleCompiler &m, const VarTypeVector &argTypes, masm.memIntToValue(src, dstAddr); #endif } else { - JS_ASSERT(i.mirType() == MIRType_Double); + MOZ_ASSERT(i.mirType() == MIRType_Double); Address src(StackPointer, offsetToCallerStackArgs + i->offsetFromArgBase()); masm.loadDouble(src, ScratchDoubleReg); masm.canonicalizeDouble(ScratchDoubleReg); @@ -7218,7 +7218,7 @@ GenerateFFIInterpExit(ModuleCompiler &m, const ModuleCompiler::ExitDescriptor &e unsigned exitIndex, Label *throwLabel) { MacroAssembler &masm = m.masm(); - JS_ASSERT(masm.framePushed() == 0); + MOZ_ASSERT(masm.framePushed() == 0); // Argument types for InvokeFromAsmJS_*: static const MIRType typeArray[] = { MIRType_Pointer, // exitDatum @@ -7270,7 +7270,7 @@ GenerateFFIInterpExit(ModuleCompiler &m, const ModuleCompiler::ExitDescriptor &e masm.storePtr(scratch, Address(StackPointer, i->offsetFromArgBase())); } i++; - JS_ASSERT(i.done()); + MOZ_ASSERT(i.done()); // Make the call, test whether it succeeded, and extract the return value. AssertStackAlignment(masm, ABIStackAlignment); @@ -7398,7 +7398,7 @@ GenerateFFIIonExit(ModuleCompiler &m, const ModuleCompiler::ExitDescriptor &exit unsigned offsetToCallerStackArgs = framePushed + sizeof(AsmJSFrame); FillArgumentArray(m, exit.sig().args(), argOffset, offsetToCallerStackArgs, scratch); argOffset += exit.sig().args().length() * sizeof(Value); - JS_ASSERT(argOffset == offsetToIonArgs + ionArgBytes); + MOZ_ASSERT(argOffset == offsetToIonArgs + ionArgBytes); // 6. Store asm.js pinned registers #if defined(JS_CODEGEN_X64) @@ -7416,7 +7416,7 @@ GenerateFFIIonExit(ModuleCompiler &m, const ModuleCompiler::ExitDescriptor &exit // // This sequence requires four registers, and needs to preserve the 'callee' // register, so there are five live registers. - JS_ASSERT(callee == AsmJSIonExitRegCallee); + MOZ_ASSERT(callee == AsmJSIonExitRegCallee); Register reg0 = AsmJSIonExitRegE0; Register reg1 = AsmJSIonExitRegE1; Register reg2 = AsmJSIonExitRegE2; @@ -7457,8 +7457,8 @@ GenerateFFIIonExit(ModuleCompiler &m, const ModuleCompiler::ExitDescriptor &exit // // This sequence needs three registers, and must preserve the JSReturnReg_Data and // JSReturnReg_Type, so there are five live registers. - JS_ASSERT(JSReturnReg_Data == AsmJSIonExitRegReturnData); - JS_ASSERT(JSReturnReg_Type == AsmJSIonExitRegReturnType); + MOZ_ASSERT(JSReturnReg_Data == AsmJSIonExitRegReturnData); + MOZ_ASSERT(JSReturnReg_Type == AsmJSIonExitRegReturnType); Register reg0 = AsmJSIonExitRegD0; Register reg1 = AsmJSIonExitRegD1; Register reg2 = AsmJSIonExitRegD2; @@ -7482,7 +7482,7 @@ GenerateFFIIonExit(ModuleCompiler &m, const ModuleCompiler::ExitDescriptor &exit masm.storePtr(reg2, Address(reg0, offsetOfJitJSContext)); } - JS_ASSERT(masm.framePushed() == framePushed); + MOZ_ASSERT(masm.framePushed() == framePushed); #if defined(JS_CODEGEN_X64) masm.loadPtr(Address(StackPointer, savedHeapOffset), HeapReg); #elif defined(JS_CODEGEN_ARM) || defined(JS_CODEGEN_MIPS) @@ -7533,7 +7533,7 @@ GenerateFFIIonExit(ModuleCompiler &m, const ModuleCompiler::ExitDescriptor &exit masm.storePtr(scratch, Address(StackPointer, i->offsetFromArgBase())); } i++; - JS_ASSERT(i.done()); + MOZ_ASSERT(i.done()); // Call coercion function AssertStackAlignment(masm, ABIStackAlignment); @@ -7556,7 +7556,7 @@ GenerateFFIIonExit(ModuleCompiler &m, const ModuleCompiler::ExitDescriptor &exit masm.setFramePushed(0); } - JS_ASSERT(masm.framePushed() == 0); + MOZ_ASSERT(masm.framePushed() == 0); return m.finishGeneratingIonExit(exitIndex, &begin, &profilingReturn) && !masm.oom(); } @@ -7591,7 +7591,7 @@ static bool GenerateBuiltinThunk(ModuleCompiler &m, AsmJSExit::BuiltinKind builtin) { MacroAssembler &masm = m.masm(); - JS_ASSERT(masm.framePushed() == 0); + MOZ_ASSERT(masm.framePushed() == 0); MIRTypeVector argTypes(m.cx()); switch (builtin) { @@ -7647,7 +7647,7 @@ GenerateBuiltinThunk(ModuleCompiler &m, AsmJSExit::BuiltinKind builtin) masm.load32(srcAddr, ABIArgGenerator::NonArg_VolatileReg); masm.store32(ABIArgGenerator::NonArg_VolatileReg, dstAddr); } else { - JS_ASSERT(i.mirType() == MIRType_Double); + MOZ_ASSERT(i.mirType() == MIRType_Double); masm.loadDouble(srcAddr, ScratchDoubleReg); masm.storeDouble(ScratchDoubleReg, dstAddr); } @@ -7764,7 +7764,7 @@ GenerateAsyncInterruptExit(ModuleCompiler &m, Label *throwLabel) // Pop resumePC into PC. Clobber HeapReg to make the jump and restore it // during jump delay slot. - JS_ASSERT(Imm16::IsInSignedRange(AsmJSModule::heapGlobalDataOffset() - AsmJSGlobalRegBias)); + MOZ_ASSERT(Imm16::IsInSignedRange(AsmJSModule::heapGlobalDataOffset() - AsmJSGlobalRegBias)); masm.pop(HeapReg); masm.as_jr(HeapReg); masm.loadPtr(Address(GlobalReg, AsmJSModule::heapGlobalDataOffset() - AsmJSGlobalRegBias), @@ -7871,7 +7871,7 @@ GenerateThrowStub(ModuleCompiler &m, Label *throwLabel) masm.loadPtr(Address(scratch, AsmJSActivation::offsetOfEntrySP()), StackPointer); masm.Pop(scratch); masm.PopRegsInMask(NonVolatileRegs, NonVolatileSimdRegs); - JS_ASSERT(masm.framePushed() == 0); + MOZ_ASSERT(masm.framePushed() == 0); masm.mov(ImmWord(0), ReturnReg); masm.ret(); @@ -8062,7 +8062,7 @@ js::ValidateAsmJS(ExclusiveContext *cx, AsmJSParser &parser, ParseNode *stmtList if (!moduleFun) return false; - JS_ASSERT(funbox->function()->isInterpreted()); + MOZ_ASSERT(funbox->function()->isInterpreted()); funbox->object = moduleFun; *validated = true; diff --git a/js/src/asmjs/AsmJSValidate.h b/js/src/asmjs/AsmJSValidate.h index 325a926774e3..8214d64381d3 100644 --- a/js/src/asmjs/AsmJSValidate.h +++ b/js/src/asmjs/AsmJSValidate.h @@ -75,7 +75,7 @@ RoundUpToNextValidAsmJSHeapLength(uint32_t length) if (length <= 16 * 1024 * 1024) return mozilla::RoundUpPow2(length); - JS_ASSERT(length <= 0xff000000); + MOZ_ASSERT(length <= 0xff000000); return (length + 0x00ffffff) & ~0x00ffffff; } diff --git a/js/src/builtin/Eval.cpp b/js/src/builtin/Eval.cpp index ad985495e938..cb7d0ef1faa4 100644 --- a/js/src/builtin/Eval.cpp +++ b/js/src/builtin/Eval.cpp @@ -32,7 +32,7 @@ AssertInnerizedScopeChain(JSContext *cx, JSObject &scopeobj) #ifdef DEBUG RootedObject obj(cx); for (obj = &scopeobj; obj; obj = obj->enclosingScope()) - JS_ASSERT(GetInnerObject(obj) == obj); + MOZ_ASSERT(GetInnerObject(obj) == obj); #endif } @@ -63,7 +63,7 @@ EvalCacheHashPolicy::match(const EvalCacheEntry &cacheEntry, const EvalCacheLook { JSScript *script = cacheEntry.script; - JS_ASSERT(IsEvalCacheCandidate(script)); + MOZ_ASSERT(IsEvalCacheCandidate(script)); // Get the source string passed for safekeeping in the atom map // by the prior eval to frontend::CompileScript. @@ -125,7 +125,7 @@ class EvalScriptGuard void setNewScript(JSScript *script) { // JSScript::initFromEmitter has already called js_CallNewScriptHook. - JS_ASSERT(!script_ && script); + MOZ_ASSERT(!script_ && script); script_ = script; script_->setActiveEval(); } @@ -135,7 +135,7 @@ class EvalScriptGuard } HandleScript script() { - JS_ASSERT(script_); + MOZ_ASSERT(script_); return script_; } }; @@ -244,8 +244,8 @@ static bool EvalKernel(JSContext *cx, const CallArgs &args, EvalType evalType, AbstractFramePtr caller, HandleObject scopeobj, jsbytecode *pc) { - JS_ASSERT((evalType == INDIRECT_EVAL) == !caller); - JS_ASSERT((evalType == INDIRECT_EVAL) == !pc); + MOZ_ASSERT((evalType == INDIRECT_EVAL) == !caller); + MOZ_ASSERT((evalType == INDIRECT_EVAL) == !pc); JS_ASSERT_IF(evalType == INDIRECT_EVAL, scopeobj->is()); AssertInnerizedScopeChain(cx, *scopeobj); @@ -284,7 +284,7 @@ EvalKernel(JSContext *cx, const CallArgs &args, EvalType evalType, AbstractFrame return false; thisv = caller.thisValue(); } else { - JS_ASSERT(args.callee().global() == *scopeobj); + MOZ_ASSERT(args.callee().global() == *scopeobj); staticLevel = 0; // Use the global as 'this', modulo outerization. @@ -425,7 +425,7 @@ js::DirectEvalStringFromIon(JSContext *cx, // Primitive 'this' values should have been filtered out by Ion. If boxed, // the calling frame cannot be updated to store the new object. - JS_ASSERT(thisValue.isObject() || thisValue.isUndefined() || thisValue.isNull()); + MOZ_ASSERT(thisValue.isObject() || thisValue.isUndefined() || thisValue.isNull()); return ExecuteKernel(cx, esg.script(), *scopeobj, thisValue, ExecuteType(DIRECT_EVAL), NullFramePtr() /* evalInFrame */, vp.address()); @@ -462,9 +462,9 @@ js::DirectEval(JSContext *cx, const CallArgs &args) ScriptFrameIter iter(cx); AbstractFramePtr caller = iter.abstractFramePtr(); - JS_ASSERT(caller.scopeChain()->global().valueIsEval(args.calleev())); - JS_ASSERT(JSOp(*iter.pc()) == JSOP_EVAL || - JSOp(*iter.pc()) == JSOP_SPREADEVAL); + MOZ_ASSERT(caller.scopeChain()->global().valueIsEval(args.calleev())); + MOZ_ASSERT(JSOp(*iter.pc()) == JSOP_EVAL || + JSOp(*iter.pc()) == JSOP_SPREADEVAL); JS_ASSERT_IF(caller.isFunctionFrame(), caller.compartment() == caller.callee()->compartment()); diff --git a/js/src/builtin/Intl.cpp b/js/src/builtin/Intl.cpp index c19e5d372113..c505366de585 100644 --- a/js/src/builtin/Intl.cpp +++ b/js/src/builtin/Intl.cpp @@ -401,8 +401,8 @@ IntlInitialize(JSContext *cx, HandleObject obj, Handle initialize RootedValue initializerValue(cx); if (!GlobalObject::getIntrinsicValue(cx, cx->global(), initializer, &initializerValue)) return false; - JS_ASSERT(initializerValue.isObject()); - JS_ASSERT(initializerValue.toObject().is()); + MOZ_ASSERT(initializerValue.isObject()); + MOZ_ASSERT(initializerValue.toObject().is()); InvokeArgs args(cx); if (!args.init(3)) @@ -477,8 +477,8 @@ GetInternals(JSContext *cx, HandleObject obj, MutableHandleObject internals) RootedValue getInternalsValue(cx); if (!GlobalObject::getIntrinsicValue(cx, cx->global(), cx->names().getInternals, &getInternalsValue)) return false; - JS_ASSERT(getInternalsValue.isObject()); - JS_ASSERT(getInternalsValue.toObject().is()); + MOZ_ASSERT(getInternalsValue.isObject()); + MOZ_ASSERT(getInternalsValue.toObject().is()); InvokeArgs args(cx); if (!args.init(1)) @@ -660,7 +660,7 @@ bool js::intl_Collator(JSContext *cx, unsigned argc, Value *vp) { CallArgs args = CallArgsFromVp(argc, vp); - JS_ASSERT(args.length() == 2); + MOZ_ASSERT(args.length() == 2); // intl_Collator is an intrinsic for self-hosted JavaScript, so it cannot // be used with "new", but it still has to be treated as a constructor. return Collator(cx, args, true); @@ -744,7 +744,7 @@ bool js::intl_Collator_availableLocales(JSContext *cx, unsigned argc, Value *vp) { CallArgs args = CallArgsFromVp(argc, vp); - JS_ASSERT(args.length() == 0); + MOZ_ASSERT(args.length() == 0); RootedValue result(cx); if (!intl_availableLocales(cx, ucol_countAvailable, ucol_getAvailable, &result)) @@ -757,8 +757,8 @@ bool js::intl_availableCollations(JSContext *cx, unsigned argc, Value *vp) { CallArgs args = CallArgsFromVp(argc, vp); - JS_ASSERT(args.length() == 1); - JS_ASSERT(args[0].isString()); + MOZ_ASSERT(args.length() == 1); + MOZ_ASSERT(args[0].isString()); JSAutoByteString locale(cx, args[0].toString()); if (!locale) @@ -899,7 +899,7 @@ NewUCollator(JSContext *cx, HandleObject collator) uStrength = UCOL_PRIMARY; uCaseLevel = UCOL_ON; } else { - JS_ASSERT(equal(sensitivity, "variant")); + MOZ_ASSERT(equal(sensitivity, "variant")); uStrength = UCOL_TERTIARY; } @@ -929,7 +929,7 @@ NewUCollator(JSContext *cx, HandleObject collator) else if (equal(caseFirst, "lower")) uCaseFirst = UCOL_LOWER_FIRST; else - JS_ASSERT(equal(caseFirst, "false")); + MOZ_ASSERT(equal(caseFirst, "false")); } UErrorCode status = U_ZERO_ERROR; @@ -957,8 +957,8 @@ NewUCollator(JSContext *cx, HandleObject collator) static bool intl_CompareStrings(JSContext *cx, UCollator *coll, HandleString str1, HandleString str2, MutableHandleValue result) { - JS_ASSERT(str1); - JS_ASSERT(str2); + MOZ_ASSERT(str1); + MOZ_ASSERT(str2); if (str1 == str2) { result.setInt32(0); @@ -994,10 +994,10 @@ bool js::intl_CompareStrings(JSContext *cx, unsigned argc, Value *vp) { CallArgs args = CallArgsFromVp(argc, vp); - JS_ASSERT(args.length() == 3); - JS_ASSERT(args[0].isObject()); - JS_ASSERT(args[1].isString()); - JS_ASSERT(args[2].isString()); + MOZ_ASSERT(args.length() == 3); + MOZ_ASSERT(args[0].isObject()); + MOZ_ASSERT(args[1].isString()); + MOZ_ASSERT(args[2].isString()); RootedObject collator(cx, &args[0].toObject()); @@ -1149,7 +1149,7 @@ bool js::intl_NumberFormat(JSContext *cx, unsigned argc, Value *vp) { CallArgs args = CallArgsFromVp(argc, vp); - JS_ASSERT(args.length() == 2); + MOZ_ASSERT(args.length() == 2); // intl_NumberFormat is an intrinsic for self-hosted JavaScript, so it // cannot be used with "new", but it still has to be treated as a // constructor. @@ -1235,7 +1235,7 @@ bool js::intl_NumberFormat_availableLocales(JSContext *cx, unsigned argc, Value *vp) { CallArgs args = CallArgsFromVp(argc, vp); - JS_ASSERT(args.length() == 0); + MOZ_ASSERT(args.length() == 0); RootedValue result(cx); if (!intl_availableLocales(cx, unum_countAvailable, unum_getAvailable, &result)) @@ -1248,8 +1248,8 @@ bool js::intl_numberingSystem(JSContext *cx, unsigned argc, Value *vp) { CallArgs args = CallArgsFromVp(argc, vp); - JS_ASSERT(args.length() == 1); - JS_ASSERT(args[0].isString()); + MOZ_ASSERT(args.length() == 1); + MOZ_ASSERT(args[0].isString()); JSAutoByteString locale(cx, args[0].toString()); if (!locale) @@ -1337,13 +1337,13 @@ NewUNumberFormat(JSContext *cx, HandleObject numberFormat) } else if (equal(currencyDisplay, "symbol")) { uStyle = UNUM_CURRENCY; } else { - JS_ASSERT(equal(currencyDisplay, "name")); + MOZ_ASSERT(equal(currencyDisplay, "name")); uStyle = UNUM_CURRENCY_PLURAL; } } else if (equal(style, "percent")) { uStyle = UNUM_PERCENT; } else { - JS_ASSERT(equal(style, "decimal")); + MOZ_ASSERT(equal(style, "decimal")); uStyle = UNUM_DECIMAL; } @@ -1455,9 +1455,9 @@ bool js::intl_FormatNumber(JSContext *cx, unsigned argc, Value *vp) { CallArgs args = CallArgsFromVp(argc, vp); - JS_ASSERT(args.length() == 2); - JS_ASSERT(args[0].isObject()); - JS_ASSERT(args[1].isNumber()); + MOZ_ASSERT(args.length() == 2); + MOZ_ASSERT(args[0].isObject()); + MOZ_ASSERT(args[1].isNumber()); RootedObject numberFormat(cx, &args[0].toObject()); @@ -1606,7 +1606,7 @@ bool js::intl_DateTimeFormat(JSContext *cx, unsigned argc, Value *vp) { CallArgs args = CallArgsFromVp(argc, vp); - JS_ASSERT(args.length() == 2); + MOZ_ASSERT(args.length() == 2); // intl_DateTimeFormat is an intrinsic for self-hosted JavaScript, so it // cannot be used with "new", but it still has to be treated as a // constructor. @@ -1691,7 +1691,7 @@ bool js::intl_DateTimeFormat_availableLocales(JSContext *cx, unsigned argc, Value *vp) { CallArgs args = CallArgsFromVp(argc, vp); - JS_ASSERT(args.length() == 0); + MOZ_ASSERT(args.length() == 0); RootedValue result(cx); if (!intl_availableLocales(cx, udat_countAvailable, udat_getAvailable, &result)) @@ -1718,8 +1718,8 @@ bool js::intl_availableCalendars(JSContext *cx, unsigned argc, Value *vp) { CallArgs args = CallArgsFromVp(argc, vp); - JS_ASSERT(args.length() == 1); - JS_ASSERT(args[0].isString()); + MOZ_ASSERT(args.length() == 1); + MOZ_ASSERT(args[0].isString()); JSAutoByteString locale(cx, args[0].toString()); if (!locale) @@ -1783,9 +1783,9 @@ bool js::intl_patternForSkeleton(JSContext *cx, unsigned argc, Value *vp) { CallArgs args = CallArgsFromVp(argc, vp); - JS_ASSERT(args.length() == 2); - JS_ASSERT(args[0].isString()); - JS_ASSERT(args[1].isString()); + MOZ_ASSERT(args.length() == 2); + MOZ_ASSERT(args[0].isString()); + MOZ_ASSERT(args[1].isString()); JSAutoByteString locale(cx, args[0].toString()); if (!locale) @@ -1956,9 +1956,9 @@ bool js::intl_FormatDateTime(JSContext *cx, unsigned argc, Value *vp) { CallArgs args = CallArgsFromVp(argc, vp); - JS_ASSERT(args.length() == 2); - JS_ASSERT(args[0].isObject()); - JS_ASSERT(args[1].isNumber()); + MOZ_ASSERT(args.length() == 2); + MOZ_ASSERT(args[0].isObject()); + MOZ_ASSERT(args[1].isNumber()); RootedObject dateTimeFormat(cx, &args[0].toObject()); @@ -2034,7 +2034,7 @@ static const JSFunctionSpec intl_static_methods[] = { JSObject * js_InitIntlClass(JSContext *cx, HandleObject obj) { - JS_ASSERT(obj->is()); + MOZ_ASSERT(obj->is()); Rooted global(cx, &obj->as()); // The constructors above need to be able to determine whether they've been diff --git a/js/src/builtin/MapObject.cpp b/js/src/builtin/MapObject.cpp index 58a804869a4f..5b1dae3747a2 100644 --- a/js/src/builtin/MapObject.cpp +++ b/js/src/builtin/MapObject.cpp @@ -798,8 +798,8 @@ HashableValue::setValue(JSContext *cx, HandleValue v) value = v; } - JS_ASSERT(value.isUndefined() || value.isNull() || value.isBoolean() || value.isNumber() || - value.isString() || value.isSymbol() || value.isObject()); + MOZ_ASSERT(value.isUndefined() || value.isNull() || value.isBoolean() || value.isNumber() || + value.isString() || value.isSymbol() || value.isObject()); return true; } @@ -820,8 +820,8 @@ HashableValue::operator==(const HashableValue &other) const #ifdef DEBUG bool same; - JS_ASSERT(SameValue(nullptr, value, other.value, &same)); - JS_ASSERT(same == b); + MOZ_ASSERT(SameValue(nullptr, value, other.value, &same)); + MOZ_ASSERT(same == b); #endif return b; } @@ -891,7 +891,7 @@ inline MapObject::IteratorKind MapIteratorObject::kind() const { int32_t i = getSlot(KindSlot).toInt32(); - JS_ASSERT(i == MapObject::Keys || i == MapObject::Values || i == MapObject::Entries); + MOZ_ASSERT(i == MapObject::Keys || i == MapObject::Values || i == MapObject::Entries); return MapObject::IteratorKind(i); } @@ -1123,8 +1123,8 @@ class OrderedHashTableRef : public gc::BufferableRef explicit OrderedHashTableRef(TableType *t, const Value &k) : table(t), key(k) {} void mark(JSTracer *trc) { - JS_ASSERT(UnbarrieredHashPolicy::hash(key) == - HashableValue::Hasher::hash(*reinterpret_cast(&key))); + MOZ_ASSERT(UnbarrieredHashPolicy::hash(key) == + HashableValue::Hasher::hash(*reinterpret_cast(&key))); Value prior = key; gc::MarkValueUnbarriered(trc, &key, "ordered hash table key"); table->rekeyOneEntry(prior, key); @@ -1289,15 +1289,15 @@ MapObject::is(HandleValue v) ValueMap & MapObject::extract(CallReceiver call) { - JS_ASSERT(call.thisv().isObject()); - JS_ASSERT(call.thisv().toObject().hasClass(&MapObject::class_)); + MOZ_ASSERT(call.thisv().isObject()); + MOZ_ASSERT(call.thisv().toObject().hasClass(&MapObject::class_)); return *call.thisv().toObject().as().getData(); } bool MapObject::size_impl(JSContext *cx, CallArgs args) { - JS_ASSERT(MapObject::is(args.thisv())); + MOZ_ASSERT(MapObject::is(args.thisv())); ValueMap &map = extract(args); JS_STATIC_ASSERT(sizeof map.count() <= sizeof(uint32_t)); @@ -1315,7 +1315,7 @@ MapObject::size(JSContext *cx, unsigned argc, Value *vp) bool MapObject::get_impl(JSContext *cx, CallArgs args) { - JS_ASSERT(MapObject::is(args.thisv())); + MOZ_ASSERT(MapObject::is(args.thisv())); ValueMap &map = extract(args); ARG0_KEY(cx, args, key); @@ -1337,7 +1337,7 @@ MapObject::get(JSContext *cx, unsigned argc, Value *vp) bool MapObject::has_impl(JSContext *cx, CallArgs args) { - JS_ASSERT(MapObject::is(args.thisv())); + MOZ_ASSERT(MapObject::is(args.thisv())); ValueMap &map = extract(args); ARG0_KEY(cx, args, key); @@ -1355,7 +1355,7 @@ MapObject::has(JSContext *cx, unsigned argc, Value *vp) bool MapObject::set_impl(JSContext *cx, CallArgs args) { - JS_ASSERT(MapObject::is(args.thisv())); + MOZ_ASSERT(MapObject::is(args.thisv())); ValueMap &map = extract(args); ARG0_KEY(cx, args, key); @@ -1388,7 +1388,7 @@ MapObject::delete_impl(JSContext *cx, CallArgs args) // makeEmpty clears the value by doing e->value = Value(), and in the case // of a ValueMap, Value() means RelocatableValue(), which is the same as // RelocatableValue(UndefinedValue()). - JS_ASSERT(MapObject::is(args.thisv())); + MOZ_ASSERT(MapObject::is(args.thisv())); ValueMap &map = extract(args); ARG0_KEY(cx, args, key); @@ -1540,7 +1540,7 @@ inline SetObject::IteratorKind SetIteratorObject::kind() const { int32_t i = getSlot(KindSlot).toInt32(); - JS_ASSERT(i == SetObject::Values || i == SetObject::Entries); + MOZ_ASSERT(i == SetObject::Values || i == SetObject::Entries); return SetObject::IteratorKind(i); } @@ -1818,15 +1818,15 @@ SetObject::is(HandleValue v) ValueSet & SetObject::extract(CallReceiver call) { - JS_ASSERT(call.thisv().isObject()); - JS_ASSERT(call.thisv().toObject().hasClass(&SetObject::class_)); + MOZ_ASSERT(call.thisv().isObject()); + MOZ_ASSERT(call.thisv().toObject().hasClass(&SetObject::class_)); return *static_cast(call.thisv().toObject()).getData(); } bool SetObject::size_impl(JSContext *cx, CallArgs args) { - JS_ASSERT(is(args.thisv())); + MOZ_ASSERT(is(args.thisv())); ValueSet &set = extract(args); JS_STATIC_ASSERT(sizeof set.count() <= sizeof(uint32_t)); @@ -1844,7 +1844,7 @@ SetObject::size(JSContext *cx, unsigned argc, Value *vp) bool SetObject::has_impl(JSContext *cx, CallArgs args) { - JS_ASSERT(is(args.thisv())); + MOZ_ASSERT(is(args.thisv())); ValueSet &set = extract(args); ARG0_KEY(cx, args, key); @@ -1862,7 +1862,7 @@ SetObject::has(JSContext *cx, unsigned argc, Value *vp) bool SetObject::add_impl(JSContext *cx, CallArgs args) { - JS_ASSERT(is(args.thisv())); + MOZ_ASSERT(is(args.thisv())); ValueSet &set = extract(args); ARG0_KEY(cx, args, key); @@ -1885,7 +1885,7 @@ SetObject::add(JSContext *cx, unsigned argc, Value *vp) bool SetObject::delete_impl(JSContext *cx, CallArgs args) { - JS_ASSERT(is(args.thisv())); + MOZ_ASSERT(is(args.thisv())); ValueSet &set = extract(args); ARG0_KEY(cx, args, key); diff --git a/js/src/builtin/Object.cpp b/js/src/builtin/Object.cpp index 10bdfb6a76f6..3d08d2d22306 100644 --- a/js/src/builtin/Object.cpp +++ b/js/src/builtin/Object.cpp @@ -874,7 +874,7 @@ obj_keys(JSContext *cx, unsigned argc, Value *vp) } // Step 11. - JS_ASSERT(props.length() <= UINT32_MAX); + MOZ_ASSERT(props.length() <= UINT32_MAX); JSObject *aobj = NewDenseCopiedArray(cx, uint32_t(namelist.length()), namelist.begin()); if (!aobj) return false; diff --git a/js/src/builtin/RegExp.cpp b/js/src/builtin/RegExp.cpp index 24cea0bafe88..27599a09037f 100644 --- a/js/src/builtin/RegExp.cpp +++ b/js/src/builtin/RegExp.cpp @@ -26,7 +26,7 @@ bool js::CreateRegExpMatchResult(JSContext *cx, HandleString input, const MatchPairs &matches, MutableHandleValue rval) { - JS_ASSERT(input); + MOZ_ASSERT(input); /* * Create the (slow) result array for a match. @@ -44,7 +44,7 @@ js::CreateRegExpMatchResult(JSContext *cx, HandleString input, const MatchPairs return false; size_t numPairs = matches.length(); - JS_ASSERT(numPairs > 0); + MOZ_ASSERT(numPairs > 0); RootedObject arr(cx, NewDenseFullyAllocatedArrayWithTemplate(cx, numPairs, templateObject)); if (!arr) @@ -55,7 +55,7 @@ js::CreateRegExpMatchResult(JSContext *cx, HandleString input, const MatchPairs const MatchPair &pair = matches[i]; if (pair.isUndefined()) { - JS_ASSERT(i != 0); /* Since we had a match, first pair must be present. */ + MOZ_ASSERT(i != 0); /* Since we had a match, first pair must be present. */ arr->setDenseInitializedLength(i + 1); arr->initDenseElementWithType(cx, i, UndefinedValue()); } else { @@ -81,11 +81,11 @@ js::CreateRegExpMatchResult(JSContext *cx, HandleString input, const MatchPairs RootedId id(cx, NameToId(cx->names().index)); if (!baseops::GetProperty(cx, arr, id, &test)) return false; - JS_ASSERT(test == arr->nativeGetSlot(0)); + MOZ_ASSERT(test == arr->nativeGetSlot(0)); id = NameToId(cx->names().input); if (!baseops::GetProperty(cx, arr, id, &test)) return false; - JS_ASSERT(test == arr->nativeGetSlot(1)); + MOZ_ASSERT(test == arr->nativeGetSlot(1)); #endif rval.setObject(*arr); @@ -316,7 +316,7 @@ IsRegExp(HandleValue v) MOZ_ALWAYS_INLINE bool regexp_compile_impl(JSContext *cx, CallArgs args) { - JS_ASSERT(IsRegExp(args.thisv())); + MOZ_ASSERT(IsRegExp(args.thisv())); RegExpObjectBuilder builder(cx, &args.thisv().toObject().as()); return CompileRegExpObject(cx, builder, args); } @@ -355,7 +355,7 @@ regexp_construct(JSContext *cx, unsigned argc, Value *vp) MOZ_ALWAYS_INLINE bool regexp_toString_impl(JSContext *cx, CallArgs args) { - JS_ASSERT(IsRegExp(args.thisv())); + MOZ_ASSERT(IsRegExp(args.thisv())); JSString *str = args.thisv().toObject().as().toString(cx); if (!str) @@ -504,7 +504,7 @@ static const JSPropertySpec regexp_static_props[] = { JSObject * js_InitRegExpClass(JSContext *cx, HandleObject obj) { - JS_ASSERT(obj->isNative()); + MOZ_ASSERT(obj->isNative()); Rooted global(cx, &obj->as()); @@ -685,9 +685,9 @@ bool js::regexp_exec_no_statics(JSContext *cx, unsigned argc, Value *vp) { CallArgs args = CallArgsFromVp(argc, vp); - JS_ASSERT(args.length() == 2); - JS_ASSERT(IsRegExp(args[0])); - JS_ASSERT(args[1].isString()); + MOZ_ASSERT(args.length() == 2); + MOZ_ASSERT(IsRegExp(args[0])); + MOZ_ASSERT(args[1].isString()); RootedObject regexp(cx, &args[0].toObject()); RootedString string(cx, args[1].toString()); @@ -724,9 +724,9 @@ bool js::regexp_test_no_statics(JSContext *cx, unsigned argc, Value *vp) { CallArgs args = CallArgsFromVp(argc, vp); - JS_ASSERT(args.length() == 2); - JS_ASSERT(IsRegExp(args[0])); - JS_ASSERT(args[1].isString()); + MOZ_ASSERT(args.length() == 2); + MOZ_ASSERT(IsRegExp(args[0])); + MOZ_ASSERT(args[1].isString()); RootedObject regexp(cx, &args[0].toObject()); RootedString string(cx, args[1].toString()); diff --git a/js/src/builtin/SIMD.cpp b/js/src/builtin/SIMD.cpp index 70f826a360cd..f9cdd9b47abd 100644 --- a/js/src/builtin/SIMD.cpp +++ b/js/src/builtin/SIMD.cpp @@ -704,7 +704,7 @@ SIMDObject::initClass(JSContext *cx, Handle global) JSObject * js_InitSIMDClass(JSContext *cx, HandleObject obj) { - JS_ASSERT(obj->is()); + MOZ_ASSERT(obj->is()); Rooted global(cx, &obj->as()); return SIMDObject::initClass(cx, global); } @@ -715,7 +715,7 @@ js::CreateSimd(JSContext *cx, typename V::Elem *data) { typedef typename V::Elem Elem; Rooted typeDescr(cx, &V::GetTypeDescr(*cx->global())); - JS_ASSERT(typeDescr); + MOZ_ASSERT(typeDescr); Rooted result(cx, OutlineTypedObject::createZeroed(cx, typeDescr, 0)); if (!result) @@ -961,7 +961,7 @@ FuncWith(JSContext *cx, unsigned argc, Value *vp) for (unsigned i = 0; i < V::lanes; i++) result[i] = OpWith::apply(i, withAsNumber, val[i]); } else { - JS_ASSERT(args[1].isBoolean()); + MOZ_ASSERT(args[1].isBoolean()); bool withAsBool = args[1].toBoolean(); for (unsigned i = 0; i < V::lanes; i++) result[i] = OpWith::apply(i, withAsBool, val[i]); @@ -984,7 +984,7 @@ FuncShuffle(JSContext *cx, unsigned argc, Value *vp) const uint32_t SELECT_SHIFT = FloorLog2(V::lanes); const uint32_t SELECT_MASK = V::lanes - 1; const int32_t MAX_MASK_VALUE = int32_t(pow(double(V::lanes), double(V::lanes))) - 1; - JS_ASSERT(MAX_MASK_VALUE > 0); + MOZ_ASSERT(MAX_MASK_VALUE > 0); Elem result[V::lanes]; if (args.length() == 2) { @@ -1001,7 +1001,7 @@ FuncShuffle(JSContext *cx, unsigned argc, Value *vp) for (unsigned i = 0; i < V::lanes; i++) result[i] = val[(maskArg >> (i * SELECT_SHIFT)) & SELECT_MASK]; } else { - JS_ASSERT(args.length() == 3); + MOZ_ASSERT(args.length() == 3); if (!IsVectorObject(args[0]) || !IsVectorObject(args[1]) || !args[2].isInt32()) return ErrorBadArgs(cx); diff --git a/js/src/builtin/SymbolObject.cpp b/js/src/builtin/SymbolObject.cpp index aefbc52d1e5b..53aff60d0648 100644 --- a/js/src/builtin/SymbolObject.cpp +++ b/js/src/builtin/SymbolObject.cpp @@ -191,7 +191,7 @@ SymbolObject::toString_impl(JSContext *cx, CallArgs args) { // steps 1-3 HandleValue thisv = args.thisv(); - JS_ASSERT(IsSymbol(thisv)); + MOZ_ASSERT(IsSymbol(thisv)); Rooted sym(cx, thisv.isSymbol() ? thisv.toSymbol() : thisv.toObject().as().unbox()); diff --git a/js/src/builtin/TestingFunctions.cpp b/js/src/builtin/TestingFunctions.cpp index 07798feab1bb..db174892a9ea 100644 --- a/js/src/builtin/TestingFunctions.cpp +++ b/js/src/builtin/TestingFunctions.cpp @@ -726,7 +726,7 @@ class CountHeapTracer static void CountHeapNotify(JSTracer *trc, void **thingp, JSGCTraceKind kind) { - JS_ASSERT(trc->callback == CountHeapNotify); + MOZ_ASSERT(trc->callback == CountHeapNotify); CountHeapTracer *countTracer = (CountHeapTracer *)trc; void *thing = *thingp; @@ -1164,7 +1164,7 @@ js::testingFunc_inParallelSection(JSContext *cx, unsigned argc, jsval *vp) // If we were actually *in* a parallel section, then this function // would be inlined to TRUE in ion-generated code. - JS_ASSERT(!InParallelSection()); + MOZ_ASSERT(!InParallelSection()); args.rval().setBoolean(false); return true; } @@ -1408,7 +1408,7 @@ class CloneBufferObject : public JSObject { } void setData(uint64_t *aData) { - JS_ASSERT(!data()); + MOZ_ASSERT(!data()); setReservedSlot(DATA_SLOT, PrivateValue(aData)); } @@ -1417,7 +1417,7 @@ class CloneBufferObject : public JSObject { } void setNBytes(size_t nbytes) { - JS_ASSERT(nbytes <= UINT32_MAX); + MOZ_ASSERT(nbytes <= UINT32_MAX); setReservedSlot(LENGTH_SLOT, Int32Value(nbytes)); } @@ -1472,7 +1472,7 @@ class CloneBufferObject : public JSObject { static bool getCloneBuffer_impl(JSContext* cx, CallArgs args) { Rooted obj(cx, &args.thisv().toObject().as()); - JS_ASSERT(args.length() == 0); + MOZ_ASSERT(args.length() == 0); if (!obj->data()) { args.rval().setUndefined(); diff --git a/js/src/builtin/TypedObject.cpp b/js/src/builtin/TypedObject.cpp index c4d974d67993..513e43ff746e 100644 --- a/js/src/builtin/TypedObject.cpp +++ b/js/src/builtin/TypedObject.cpp @@ -74,7 +74,7 @@ ToObjectIf(HandleValue value) static inline CheckedInt32 roundUpToAlignment(CheckedInt32 address, int32_t align) { - JS_ASSERT(IsPowerOfTwo(align)); + MOZ_ASSERT(IsPowerOfTwo(align)); // Note: Be careful to order operators such that we first make the // value smaller and then larger, so that we don't get false @@ -384,7 +384,7 @@ js::ReferenceTypeDescr::call(JSContext *cx, unsigned argc, Value *vp) { CallArgs args = CallArgsFromVp(argc, vp); - JS_ASSERT(args.callee().is()); + MOZ_ASSERT(args.callee().is()); Rooted descr(cx, &args.callee().as()); if (args.length() < 1) { @@ -1161,7 +1161,7 @@ StructTypeDescr::fieldOffset(size_t index) const { JSObject &fieldOffsets = getReservedSlot(JS_DESCR_SLOT_STRUCT_FIELD_OFFSETS).toObject(); - JS_ASSERT(index < fieldOffsets.getDenseInitializedLength()); + MOZ_ASSERT(index < fieldOffsets.getDenseInitializedLength()); return AssertedCast(fieldOffsets.getDenseElement(index).toInt32()); } @@ -1170,7 +1170,7 @@ StructTypeDescr::maybeForwardedFieldOffset(size_t index) const { JSObject &fieldOffsets = *MaybeForwarded(&getReservedSlot(JS_DESCR_SLOT_STRUCT_FIELD_OFFSETS).toObject()); - JS_ASSERT(index < fieldOffsets.getDenseInitializedLength()); + MOZ_ASSERT(index < fieldOffsets.getDenseInitializedLength()); return AssertedCast(fieldOffsets.getDenseElement(index).toInt32()); } @@ -1179,7 +1179,7 @@ StructTypeDescr::fieldDescr(size_t index) const { JSObject &fieldDescrs = getReservedSlot(JS_DESCR_SLOT_STRUCT_FIELD_TYPES).toObject(); - JS_ASSERT(index < fieldDescrs.getDenseInitializedLength()); + MOZ_ASSERT(index < fieldDescrs.getDenseInitializedLength()); return fieldDescrs.getDenseElement(index).toObject().as(); } @@ -1188,7 +1188,7 @@ StructTypeDescr::maybeForwardedFieldDescr(size_t index) const { JSObject &fieldDescrs = *MaybeForwarded(&getReservedSlot(JS_DESCR_SLOT_STRUCT_FIELD_TYPES).toObject()); - JS_ASSERT(index < fieldDescrs.getDenseInitializedLength()); + MOZ_ASSERT(index < fieldDescrs.getDenseInitializedLength()); JSObject &descr = *MaybeForwarded(&fieldDescrs.getDenseElement(index).toObject()); return descr.as(); @@ -1444,7 +1444,7 @@ GlobalObject::initTypedObjectModule(JSContext *cx, Handle global) JSObject * js_InitTypedObjectModuleObject(JSContext *cx, HandleObject obj) { - JS_ASSERT(obj->is()); + MOZ_ASSERT(obj->is()); Rooted global(cx, &obj->as()); return global->getOrCreateTypedObjectModule(cx); } @@ -1476,8 +1476,8 @@ TypedObject::offset() const int32_t TypedObject::length() const { - JS_ASSERT(typeDescr().kind() == type::SizedArray || - typeDescr().kind() == type::UnsizedArray); + MOZ_ASSERT(typeDescr().kind() == type::SizedArray || + typeDescr().kind() == type::UnsizedArray); if (is()) return typeDescr().as().length(); @@ -1487,7 +1487,7 @@ TypedObject::length() const uint8_t * TypedObject::typedMem() const { - JS_ASSERT(isAttached()); + MOZ_ASSERT(isAttached()); if (is()) return as().inlineTypedMem(); @@ -1575,8 +1575,8 @@ OutlineTypedObject::createUnattachedWithClass(JSContext *cx, HandleTypeDescr type, int32_t length) { - JS_ASSERT(clasp == &TransparentTypedObject::class_ || - clasp == &OutlineOpaqueTypedObject::class_); + MOZ_ASSERT(clasp == &TransparentTypedObject::class_ || + clasp == &OutlineOpaqueTypedObject::class_); RootedObject proto(cx, PrototypeForTypeDescr(cx, type)); if (!proto) @@ -1597,8 +1597,8 @@ OutlineTypedObject::createUnattachedWithClass(JSContext *cx, void OutlineTypedObject::attach(JSContext *cx, ArrayBufferObject &buffer, int32_t offset) { - JS_ASSERT(offset >= 0); - JS_ASSERT((size_t) (offset + size()) <= buffer.byteLength()); + MOZ_ASSERT(offset >= 0); + MOZ_ASSERT((size_t) (offset + size()) <= buffer.byteLength()); if (!buffer.addView(cx, this)) CrashAtUnhandlableOOM("TypedObject::attach"); @@ -1611,7 +1611,7 @@ OutlineTypedObject::attach(JSContext *cx, ArrayBufferObject &buffer, int32_t off void OutlineTypedObject::attach(JSContext *cx, TypedObject &typedObj, int32_t offset) { - JS_ASSERT(typedObj.isAttached()); + MOZ_ASSERT(typedObj.isAttached()); JSObject *owner = &typedObj; if (typedObj.is()) { @@ -1622,7 +1622,7 @@ OutlineTypedObject::attach(JSContext *cx, TypedObject &typedObj, int32_t offset) if (owner->is()) { attach(cx, owner->as(), offset); } else { - JS_ASSERT(owner->is()); + MOZ_ASSERT(owner->is()); initPrivate(owner->as().inlineTypedMem() + offset); PostBarrierTypedArrayObject(this); @@ -1656,8 +1656,8 @@ TypedObjLengthFromType(TypeDescr &descr) OutlineTypedObject::createDerived(JSContext *cx, HandleSizedTypeDescr type, HandleTypedObject typedObj, int32_t offset) { - JS_ASSERT(offset <= typedObj->size()); - JS_ASSERT(offset + type->size() <= typedObj->size()); + MOZ_ASSERT(offset <= typedObj->size()); + MOZ_ASSERT(offset + type->size() <= typedObj->size()); int32_t length = TypedObjLengthFromType(*type); @@ -1807,7 +1807,7 @@ bool TypedObject::obj_lookupGeneric(JSContext *cx, HandleObject obj, HandleId id, MutableHandleObject objp, MutableHandleShape propp) { - JS_ASSERT(obj->is()); + MOZ_ASSERT(obj->is()); Rooted descr(cx, &obj->as().typeDescr()); switch (descr->kind()) { @@ -1869,7 +1869,7 @@ bool TypedObject::obj_lookupElement(JSContext *cx, HandleObject obj, uint32_t index, MutableHandleObject objp, MutableHandleShape propp) { - JS_ASSERT(obj->is()); + MOZ_ASSERT(obj->is()); MarkNonNativePropertyFound(propp); objp.set(obj); return true; @@ -1926,7 +1926,7 @@ bool TypedObject::obj_getGeneric(JSContext *cx, HandleObject obj, HandleObject receiver, HandleId id, MutableHandleValue vp) { - JS_ASSERT(obj->is()); + MOZ_ASSERT(obj->is()); Rooted typedObj(cx, &obj->as()); // Dispatch elements to obj_getElement: @@ -1993,7 +1993,7 @@ bool TypedObject::obj_getElement(JSContext *cx, HandleObject obj, HandleObject receiver, uint32_t index, MutableHandleValue vp) { - JS_ASSERT(obj->is()); + MOZ_ASSERT(obj->is()); Rooted typedObj(cx, &obj->as()); Rooted descr(cx, &typedObj->typeDescr()); @@ -2030,7 +2030,7 @@ TypedObject::obj_getArrayElement(JSContext *cx, uint32_t index, MutableHandleValue vp) { - JS_ASSERT(typeDescr->is()); + MOZ_ASSERT(typeDescr->is()); if (index >= (size_t) typedObj->length()) { vp.setUndefined(); @@ -2046,7 +2046,7 @@ bool TypedObject::obj_setGeneric(JSContext *cx, HandleObject obj, HandleId id, MutableHandleValue vp, bool strict) { - JS_ASSERT(obj->is()); + MOZ_ASSERT(obj->is()); Rooted typedObj(cx, &obj->as()); uint32_t index; @@ -2099,7 +2099,7 @@ bool TypedObject::obj_setElement(JSContext *cx, HandleObject obj, uint32_t index, MutableHandleValue vp, bool strict) { - JS_ASSERT(obj->is()); + MOZ_ASSERT(obj->is()); Rooted typedObj(cx, &obj->as()); Rooted descr(cx, &typedObj->typeDescr()); @@ -2128,7 +2128,7 @@ TypedObject::obj_setArrayElement(JSContext *cx, uint32_t index, MutableHandleValue vp) { - JS_ASSERT(descr->is()); + MOZ_ASSERT(descr->is()); if (index >= (size_t) typedObj->length()) { JS_ReportErrorNumber(cx, js_GetErrorMessage, @@ -2247,7 +2247,7 @@ TypedObject::obj_enumerate(JSContext *cx, HandleObject obj, JSIterateOp enum_op, { int32_t index; - JS_ASSERT(obj->is()); + MOZ_ASSERT(obj->is()); Rooted typedObj(cx, &obj->as()); Rooted descr(cx, &typedObj->typeDescr()); switch (descr->kind()) { @@ -2283,7 +2283,7 @@ TypedObject::obj_enumerate(JSContext *cx, HandleObject obj, JSIterateOp enum_op, idp.set(INT_TO_JSID(index)); statep.setInt32(index + 1); } else { - JS_ASSERT(index == typedObj->length()); + MOZ_ASSERT(index == typedObj->length()); statep.setNull(); } @@ -2340,7 +2340,7 @@ OutlineTypedObject::offsetOfDataSlot() // number of slots, so no problem there. gc::AllocKind allocKind = gc::GetGCObjectKind(&TransparentTypedObject::class_); size_t nfixed = gc::GetGCKindSlots(allocKind); - JS_ASSERT(DATA_SLOT == nfixed - 1); + MOZ_ASSERT(DATA_SLOT == nfixed - 1); #endif return JSObject::getPrivateDataOffset(DATA_SLOT); @@ -2489,8 +2489,8 @@ CheckOffset(int32_t offset, int32_t alignment, int32_t bufferLength) { - JS_ASSERT(size >= 0); - JS_ASSERT(alignment >= 0); + MOZ_ASSERT(size >= 0); + MOZ_ASSERT(alignment >= 0); // No negative offsets. if (offset < 0) @@ -2516,7 +2516,7 @@ TypedObject::constructSized(JSContext *cx, unsigned int argc, Value *vp) { CallArgs args = CallArgsFromVp(argc, vp); - JS_ASSERT(args.callee().is()); + MOZ_ASSERT(args.callee().is()); Rooted callee(cx, &args.callee().as()); // Typed object constructors for sized types are overloaded in @@ -2610,7 +2610,7 @@ TypedObject::constructUnsized(JSContext *cx, unsigned int argc, Value *vp) { CallArgs args = CallArgsFromVp(argc, vp); - JS_ASSERT(args.callee().is()); + MOZ_ASSERT(args.callee().is()); Rooted callee(cx); callee = &args.callee().as(); @@ -2769,8 +2769,8 @@ bool js::NewOpaqueTypedObject(JSContext *cx, unsigned argc, Value *vp) { CallArgs args = CallArgsFromVp(argc, vp); - JS_ASSERT(args.length() == 1); - JS_ASSERT(args[0].isObject() && args[0].toObject().is()); + MOZ_ASSERT(args.length() == 1); + MOZ_ASSERT(args[0].isObject() && args[0].toObject().is()); Rooted descr(cx, &args[0].toObject().as()); int32_t length = TypedObjLengthFromType(*descr); @@ -2786,10 +2786,10 @@ bool js::NewDerivedTypedObject(JSContext *cx, unsigned argc, Value *vp) { CallArgs args = CallArgsFromVp(argc, vp); - JS_ASSERT(args.length() == 3); - JS_ASSERT(args[0].isObject() && args[0].toObject().is()); - JS_ASSERT(args[1].isObject() && args[1].toObject().is()); - JS_ASSERT(args[2].isInt32()); + MOZ_ASSERT(args.length() == 3); + MOZ_ASSERT(args[0].isObject() && args[0].toObject().is()); + MOZ_ASSERT(args[1].isObject() && args[1].toObject().is()); + MOZ_ASSERT(args[2].isInt32()); Rooted descr(cx, &args[0].toObject().as()); Rooted typedObj(cx, &args[1].toObject().as()); @@ -2808,12 +2808,12 @@ bool js::AttachTypedObject(ThreadSafeContext *cx, unsigned argc, Value *vp) { CallArgs args = CallArgsFromVp(argc, vp); - JS_ASSERT(args.length() == 3); - JS_ASSERT(args[2].isInt32()); + MOZ_ASSERT(args.length() == 3); + MOZ_ASSERT(args[2].isInt32()); OutlineTypedObject &handle = args[0].toObject().as(); TypedObject &target = args[1].toObject().as(); - JS_ASSERT(!handle.isAttached()); + MOZ_ASSERT(!handle.isAttached()); size_t offset = args[2].toInt32(); if (cx->isForkJoinContext()) { @@ -2833,14 +2833,14 @@ bool js::SetTypedObjectOffset(ThreadSafeContext *, unsigned argc, Value *vp) { CallArgs args = CallArgsFromVp(argc, vp); - JS_ASSERT(args.length() == 2); - JS_ASSERT(args[0].isObject() && args[0].toObject().is()); - JS_ASSERT(args[1].isInt32()); + MOZ_ASSERT(args.length() == 2); + MOZ_ASSERT(args[0].isObject() && args[0].toObject().is()); + MOZ_ASSERT(args[1].isInt32()); OutlineTypedObject &typedObj = args[0].toObject().as(); int32_t offset = args[1].toInt32(); - JS_ASSERT(typedObj.isAttached()); + MOZ_ASSERT(typedObj.isAttached()); int32_t oldOffset = typedObj.offset(); typedObj.setPrivate((typedObj.typedMem() - oldOffset) + offset); @@ -2865,8 +2865,8 @@ bool js::ObjectIsTypeDescr(ThreadSafeContext *, unsigned argc, Value *vp) { CallArgs args = CallArgsFromVp(argc, vp); - JS_ASSERT(args.length() == 1); - JS_ASSERT(args[0].isObject()); + MOZ_ASSERT(args.length() == 1); + MOZ_ASSERT(args[0].isObject()); args.rval().setBoolean(args[0].toObject().is()); return true; } @@ -2878,8 +2878,8 @@ bool js::ObjectIsTypedObject(ThreadSafeContext *, unsigned argc, Value *vp) { CallArgs args = CallArgsFromVp(argc, vp); - JS_ASSERT(args.length() == 1); - JS_ASSERT(args[0].isObject()); + MOZ_ASSERT(args.length() == 1); + MOZ_ASSERT(args[0].isObject()); args.rval().setBoolean(args[0].toObject().is()); return true; } @@ -2892,7 +2892,7 @@ bool js::ObjectIsOpaqueTypedObject(ThreadSafeContext *, unsigned argc, Value *vp) { CallArgs args = CallArgsFromVp(argc, vp); - JS_ASSERT(args.length() == 1); + MOZ_ASSERT(args.length() == 1); args.rval().setBoolean(!args[0].toObject().is()); return true; } @@ -2905,7 +2905,7 @@ bool js::ObjectIsTransparentTypedObject(ThreadSafeContext *, unsigned argc, Value *vp) { CallArgs args = CallArgsFromVp(argc, vp); - JS_ASSERT(args.length() == 1); + MOZ_ASSERT(args.length() == 1); args.rval().setBoolean(args[0].toObject().is()); return true; } @@ -2918,9 +2918,9 @@ bool js::TypeDescrIsSimpleType(ThreadSafeContext *, unsigned argc, Value *vp) { CallArgs args = CallArgsFromVp(argc, vp); - JS_ASSERT(args.length() == 1); - JS_ASSERT(args[0].isObject()); - JS_ASSERT(args[0].toObject().is()); + MOZ_ASSERT(args.length() == 1); + MOZ_ASSERT(args[0].isObject()); + MOZ_ASSERT(args[0].toObject().is()); args.rval().setBoolean(args[0].toObject().is()); return true; } @@ -2933,9 +2933,9 @@ bool js::TypeDescrIsArrayType(ThreadSafeContext *, unsigned argc, Value *vp) { CallArgs args = CallArgsFromVp(argc, vp); - JS_ASSERT(args.length() == 1); - JS_ASSERT(args[0].isObject()); - JS_ASSERT(args[0].toObject().is()); + MOZ_ASSERT(args.length() == 1); + MOZ_ASSERT(args[0].isObject()); + MOZ_ASSERT(args[0].toObject().is()); JSObject& obj = args[0].toObject(); args.rval().setBoolean(obj.is() || obj.is()); @@ -2950,9 +2950,9 @@ bool js::TypeDescrIsSizedArrayType(ThreadSafeContext *, unsigned argc, Value *vp) { CallArgs args = CallArgsFromVp(argc, vp); - JS_ASSERT(args.length() == 1); - JS_ASSERT(args[0].isObject()); - JS_ASSERT(args[0].toObject().is()); + MOZ_ASSERT(args.length() == 1); + MOZ_ASSERT(args[0].isObject()); + MOZ_ASSERT(args[0].toObject().is()); args.rval().setBoolean(args[0].toObject().is()); return true; } @@ -2965,9 +2965,9 @@ bool js::TypeDescrIsUnsizedArrayType(ThreadSafeContext *, unsigned argc, Value *vp) { CallArgs args = CallArgsFromVp(argc, vp); - JS_ASSERT(args.length() == 1); - JS_ASSERT(args[0].isObject()); - JS_ASSERT(args[0].toObject().is()); + MOZ_ASSERT(args.length() == 1); + MOZ_ASSERT(args[0].isObject()); + MOZ_ASSERT(args[0].toObject().is()); args.rval().setBoolean(args[0].toObject().is()); return true; } @@ -2993,8 +2993,8 @@ bool js::ClampToUint8(ThreadSafeContext *, unsigned argc, Value *vp) { CallArgs args = CallArgsFromVp(argc, vp); - JS_ASSERT(args.length() == 1); - JS_ASSERT(args[0].isNumber()); + MOZ_ASSERT(args.length() == 1); + MOZ_ASSERT(args[0].isNumber()); args.rval().setNumber(ClampDoubleToUint8(args[0].toNumber())); return true; } @@ -3007,7 +3007,7 @@ js::GetTypedObjectModule(JSContext *cx, unsigned argc, Value *vp) { CallArgs args = CallArgsFromVp(argc, vp); Rooted global(cx, cx->global()); - JS_ASSERT(global); + MOZ_ASSERT(global); args.rval().setObject(global->getTypedObjectModule()); return true; } @@ -3017,7 +3017,7 @@ js::GetFloat32x4TypeDescr(JSContext *cx, unsigned argc, Value *vp) { CallArgs args = CallArgsFromVp(argc, vp); Rooted global(cx, cx->global()); - JS_ASSERT(global); + MOZ_ASSERT(global); args.rval().setObject(global->float32x4TypeDescr()); return true; } @@ -3027,7 +3027,7 @@ js::GetInt32x4TypeDescr(JSContext *cx, unsigned argc, Value *vp) { CallArgs args = CallArgsFromVp(argc, vp); Rooted global(cx, cx->global()); - JS_ASSERT(global); + MOZ_ASSERT(global); args.rval().setObject(global->int32x4TypeDescr()); return true; } @@ -3037,16 +3037,16 @@ bool js::StoreScalar##T::Func(ThreadSafeContext *, unsigned argc, Value *vp) \ { \ CallArgs args = CallArgsFromVp(argc, vp); \ - JS_ASSERT(args.length() == 3); \ - JS_ASSERT(args[0].isObject() && args[0].toObject().is()); \ - JS_ASSERT(args[1].isInt32()); \ - JS_ASSERT(args[2].isNumber()); \ + MOZ_ASSERT(args.length() == 3); \ + MOZ_ASSERT(args[0].isObject() && args[0].toObject().is()); \ + MOZ_ASSERT(args[1].isInt32()); \ + MOZ_ASSERT(args[2].isNumber()); \ \ TypedObject &typedObj = args[0].toObject().as(); \ int32_t offset = args[1].toInt32(); \ \ /* Should be guaranteed by the typed objects API: */ \ - JS_ASSERT(offset % MOZ_ALIGNOF(T) == 0); \ + MOZ_ASSERT(offset % MOZ_ALIGNOF(T) == 0); \ \ T *target = reinterpret_cast(typedObj.typedMem(offset)); \ double d = args[2].toNumber(); \ @@ -3064,15 +3064,15 @@ bool js::StoreReference##T::Func(ThreadSafeContext *, unsigned argc, Value *vp) \ { \ CallArgs args = CallArgsFromVp(argc, vp); \ - JS_ASSERT(args.length() == 3); \ - JS_ASSERT(args[0].isObject() && args[0].toObject().is()); \ - JS_ASSERT(args[1].isInt32()); \ + MOZ_ASSERT(args.length() == 3); \ + MOZ_ASSERT(args[0].isObject() && args[0].toObject().is()); \ + MOZ_ASSERT(args[1].isInt32()); \ \ TypedObject &typedObj = args[0].toObject().as(); \ int32_t offset = args[1].toInt32(); \ \ /* Should be guaranteed by the typed objects API: */ \ - JS_ASSERT(offset % MOZ_ALIGNOF(T) == 0); \ + MOZ_ASSERT(offset % MOZ_ALIGNOF(T) == 0); \ \ T *target = reinterpret_cast(typedObj.typedMem(offset)); \ store(target, args[2]); \ @@ -3089,15 +3089,15 @@ bool js::LoadScalar##T::Func(ThreadSafeContext *, unsigned argc, Value *vp) \ { \ CallArgs args = CallArgsFromVp(argc, vp); \ - JS_ASSERT(args.length() == 2); \ - JS_ASSERT(args[0].isObject() && args[0].toObject().is()); \ - JS_ASSERT(args[1].isInt32()); \ + MOZ_ASSERT(args.length() == 2); \ + MOZ_ASSERT(args[0].isObject() && args[0].toObject().is()); \ + MOZ_ASSERT(args[1].isInt32()); \ \ TypedObject &typedObj = args[0].toObject().as(); \ int32_t offset = args[1].toInt32(); \ \ /* Should be guaranteed by the typed objects API: */ \ - JS_ASSERT(offset % MOZ_ALIGNOF(T) == 0); \ + MOZ_ASSERT(offset % MOZ_ALIGNOF(T) == 0); \ \ T *target = reinterpret_cast(typedObj.typedMem(offset)); \ args.rval().setNumber((double) *target); \ @@ -3112,15 +3112,15 @@ bool js::LoadReference##T::Func(ThreadSafeContext *, unsigned argc, Value *vp) \ { \ CallArgs args = CallArgsFromVp(argc, vp); \ - JS_ASSERT(args.length() == 2); \ - JS_ASSERT(args[0].isObject() && args[0].toObject().is()); \ - JS_ASSERT(args[1].isInt32()); \ + MOZ_ASSERT(args.length() == 2); \ + MOZ_ASSERT(args[0].isObject() && args[0].toObject().is()); \ + MOZ_ASSERT(args[1].isInt32()); \ \ TypedObject &typedObj = args[0].toObject().as(); \ int32_t offset = args[1].toInt32(); \ \ /* Should be guaranteed by the typed objects API: */ \ - JS_ASSERT(offset % MOZ_ALIGNOF(T) == 0); \ + MOZ_ASSERT(offset % MOZ_ALIGNOF(T) == 0); \ \ T *target = reinterpret_cast(typedObj.typedMem(offset)); \ load(target, args.rval()); \ @@ -3144,14 +3144,14 @@ StoreReferenceHeapValue::store(HeapValue *heap, const Value &v) void StoreReferenceHeapPtrObject::store(HeapPtrObject *heap, const Value &v) { - JS_ASSERT(v.isObjectOrNull()); // or else Store_object is being misused + MOZ_ASSERT(v.isObjectOrNull()); // or else Store_object is being misused *heap = v.toObjectOrNull(); } void StoreReferenceHeapPtrString::store(HeapPtrString *heap, const Value &v) { - JS_ASSERT(v.isString()); // or else Store_string is being misused + MOZ_ASSERT(v.isString()); // or else Store_string is being misused *heap = v.toString(); } @@ -3288,7 +3288,7 @@ js::MemoryInitVisitor::visitReference(ReferenceTypeDescr &descr, uint8_t *mem) void SizedTypeDescr::initInstances(const JSRuntime *rt, uint8_t *mem, size_t length) { - JS_ASSERT(length >= 1); + MOZ_ASSERT(length >= 1); MemoryInitVisitor visitor(rt); diff --git a/js/src/builtin/TypedObject.h b/js/src/builtin/TypedObject.h index fc625fc97220..de8f8389e7be 100644 --- a/js/src/builtin/TypedObject.h +++ b/js/src/builtin/TypedObject.h @@ -648,7 +648,7 @@ class TypedObject : public ArrayBufferViewObject // 0-sized value. (In other words, we maintain the invariant // that `offset + size <= size()` -- this is always checked in // the caller's side.) - JS_ASSERT(offset <= (size_t) size()); + MOZ_ASSERT(offset <= (size_t) size()); return typedMem() + offset; } @@ -767,10 +767,10 @@ class InlineOpaqueTypedObject : public TypedObject static gc::AllocKind allocKindForTypeDescriptor(TypeDescr *descr) { size_t nbytes = descr->as().size(); - JS_ASSERT(nbytes <= MaximumSize); + MOZ_ASSERT(nbytes <= MaximumSize); size_t dataSlots = AlignBytes(nbytes, sizeof(Value) / sizeof(Value)); - JS_ASSERT(nbytes <= dataSlots * sizeof(Value)); + MOZ_ASSERT(nbytes <= dataSlots * sizeof(Value)); return gc::GetGCObjectKind(dataSlots); } diff --git a/js/src/ctypes/CTypes.cpp b/js/src/ctypes/CTypes.cpp index 281e2a79da14..cd9bf664d754 100644 --- a/js/src/ctypes/CTypes.cpp +++ b/js/src/ctypes/CTypes.cpp @@ -917,8 +917,8 @@ InitCTypeClass(JSContext* cx, HandleObject parent) RootedObject fnproto(cx); if (!JS_GetPrototype(cx, ctor, &fnproto)) return nullptr; - JS_ASSERT(ctor); - JS_ASSERT(fnproto); + MOZ_ASSERT(ctor); + MOZ_ASSERT(fnproto); // Set up ctypes.CType.prototype. RootedObject prototype(cx, JS_NewObject(cx, &sCTypeProtoClass, fnproto, parent)); @@ -968,7 +968,7 @@ InitCDataClass(JSContext* cx, HandleObject parent, HandleObject CTypeProto) return nullptr; RootedObject ctor(cx, JS_GetFunctionObject(fun)); - JS_ASSERT(ctor); + MOZ_ASSERT(ctor); // Set up ctypes.CData.__proto__ === ctypes.CType.prototype. // (Note that 'ctypes.CData instanceof Function' is still true, thanks to the @@ -1114,7 +1114,7 @@ InitInt64Class(JSContext* cx, // Redefine the 'join' function as an extended native and stash // ctypes.{Int64,UInt64}.prototype in a reserved slot of the new function. - JS_ASSERT(clasp == &sInt64ProtoClass || clasp == &sUInt64ProtoClass); + MOZ_ASSERT(clasp == &sInt64ProtoClass || clasp == &sUInt64ProtoClass); JSNative native = (clasp == &sInt64ProtoClass) ? Int64::Join : UInt64::Join; JSFunction* fun = js::DefineFunctionWithReserved(cx, ctor, "join", native, 2, CTYPESFN_FLAGS); @@ -1335,7 +1335,7 @@ IsCTypesGlobal(HandleValue v) JSCTypesCallbacks* GetCallbacks(JSObject* obj) { - JS_ASSERT(IsCTypesGlobal(obj)); + MOZ_ASSERT(IsCTypesGlobal(obj)); jsval result = JS_GetReservedSlot(obj, SLOT_CALLBACKS); if (result.isUndefined()) @@ -1419,8 +1419,8 @@ JS_InitCTypesClass(JSContext* cx, HandleObject global) JS_PUBLIC_API(void) JS_SetCTypesCallbacks(JSObject *ctypesObj, JSCTypesCallbacks* callbacks) { - JS_ASSERT(callbacks); - JS_ASSERT(IsCTypesGlobal(ctypesObj)); + MOZ_ASSERT(callbacks); + MOZ_ASSERT(IsCTypesGlobal(ctypesObj)); // Set the callbacks on a reserved slot. JS_SetReservedSlot(ctypesObj, SLOT_CALLBACKS, PRIVATE_TO_JSVAL(callbacks)); @@ -1728,7 +1728,7 @@ jsvalToInteger(JSContext* cx, jsval val, IntegerType* result) if (val.isBoolean()) { // Implicitly promote boolean values to 0 or 1, like C. *result = val.toBoolean(); - JS_ASSERT(*result == 0 || *result == 1); + MOZ_ASSERT(*result == 0 || *result == 1); return true; } // Don't silently convert null to an integer. It's probably a mistake. @@ -2092,7 +2092,7 @@ IntegerToString(IntegerType i, int radix, Vector& result) if (isNegative) *--cp = '-'; - JS_ASSERT(cp >= buffer); + MOZ_ASSERT(cp >= buffer); result.append(cp, end); } @@ -2127,9 +2127,9 @@ ConvertToJS(JSContext* cx, bool ownResult, MutableHandleValue result) { - JS_ASSERT(!parentObj || CData::IsCData(parentObj)); - JS_ASSERT(!parentObj || !ownResult); - JS_ASSERT(!wantPrimitive || !ownResult); + MOZ_ASSERT(!parentObj || CData::IsCData(parentObj)); + MOZ_ASSERT(!parentObj || !ownResult); + MOZ_ASSERT(!wantPrimitive || !ownResult); TypeCode typeCode = CType::GetTypeCode(typeObj); @@ -2282,7 +2282,7 @@ ImplicitConvert(JSContext* cx, bool* freePointer) { RootedObject targetType(cx, targetType_); - JS_ASSERT(CType::IsSizeDefined(targetType)); + MOZ_ASSERT(CType::IsSizeDefined(targetType)); // First, check if val is either a CData object or a CDataFinalizer // of type targetType. @@ -3251,7 +3251,7 @@ CType::Create(JSContext* cx, RootedValue size(cx, size_); RootedValue align(cx, align_); RootedObject parent(cx, JS_GetParent(typeProto)); - JS_ASSERT(parent); + MOZ_ASSERT(parent); // Create a CType object with the properties and slots common to all CTypes. // Each type object 't' has: @@ -3422,7 +3422,7 @@ CType::Trace(JSTracer* trc, JSObject* obj) return; FunctionInfo* fninfo = static_cast(slot.toPrivate()); - JS_ASSERT(fninfo); + MOZ_ASSERT(fninfo); // Identify our objects to the tracer. JS_CallObjectTracer(trc, &fninfo->mABI, "abi"); @@ -3453,7 +3453,7 @@ CType::IsCTypeProto(JSObject* obj) TypeCode CType::GetTypeCode(JSObject* typeObj) { - JS_ASSERT(IsCType(typeObj)); + MOZ_ASSERT(IsCType(typeObj)); jsval result = JS_GetReservedSlot(typeObj, SLOT_TYPECODE); return TypeCode(result.toInt32()); @@ -3462,7 +3462,7 @@ CType::GetTypeCode(JSObject* typeObj) bool CType::TypesEqual(JSObject* t1, JSObject* t2) { - JS_ASSERT(IsCType(t1) && IsCType(t2)); + MOZ_ASSERT(IsCType(t1) && IsCType(t2)); // Fast path: check for object equality. if (t1 == t2) @@ -3531,7 +3531,7 @@ CType::TypesEqual(JSObject* t1, JSObject* t2) bool CType::GetSafeSize(JSObject* obj, size_t* result) { - JS_ASSERT(CType::IsCType(obj)); + MOZ_ASSERT(CType::IsCType(obj)); jsval size = JS_GetReservedSlot(obj, SLOT_SIZE); @@ -3546,18 +3546,18 @@ CType::GetSafeSize(JSObject* obj, size_t* result) return true; } - JS_ASSERT(size.isUndefined()); + MOZ_ASSERT(size.isUndefined()); return false; } size_t CType::GetSize(JSObject* obj) { - JS_ASSERT(CType::IsCType(obj)); + MOZ_ASSERT(CType::IsCType(obj)); jsval size = JS_GetReservedSlot(obj, SLOT_SIZE); - JS_ASSERT(!size.isUndefined()); + MOZ_ASSERT(!size.isUndefined()); // The "size" property can be an int, a double, or JSVAL_VOID // (for arrays of undefined length), and must always fit in a size_t. @@ -3570,20 +3570,20 @@ CType::GetSize(JSObject* obj) bool CType::IsSizeDefined(JSObject* obj) { - JS_ASSERT(CType::IsCType(obj)); + MOZ_ASSERT(CType::IsCType(obj)); jsval size = JS_GetReservedSlot(obj, SLOT_SIZE); // The "size" property can be an int, a double, or JSVAL_VOID // (for arrays of undefined length), and must always fit in a size_t. - JS_ASSERT(size.isInt32() || size.isDouble() || size.isUndefined()); + MOZ_ASSERT(size.isInt32() || size.isDouble() || size.isUndefined()); return !size.isUndefined(); } size_t CType::GetAlignment(JSObject* obj) { - JS_ASSERT(CType::IsCType(obj)); + MOZ_ASSERT(CType::IsCType(obj)); jsval slot = JS_GetReservedSlot(obj, SLOT_ALIGN); return static_cast(slot.toInt32()); @@ -3592,7 +3592,7 @@ CType::GetAlignment(JSObject* obj) ffi_type* CType::GetFFIType(JSContext* cx, JSObject* obj) { - JS_ASSERT(CType::IsCType(obj)); + MOZ_ASSERT(CType::IsCType(obj)); jsval slot = JS_GetReservedSlot(obj, SLOT_FFITYPE); @@ -3623,7 +3623,7 @@ CType::GetFFIType(JSContext* cx, JSObject* obj) JSString* CType::GetName(JSContext* cx, HandleObject obj) { - JS_ASSERT(CType::IsCType(obj)); + MOZ_ASSERT(CType::IsCType(obj)); jsval string = JS_GetReservedSlot(obj, SLOT_NAME); if (!string.isUndefined()) @@ -3644,8 +3644,8 @@ CType::GetProtoFromCtor(JSObject* obj, CTypeProtoSlot slot) // on the type constructor. jsval protoslot = js::GetFunctionNativeReserved(obj, SLOT_FN_CTORPROTO); JSObject* proto = &protoslot.toObject(); - JS_ASSERT(proto); - JS_ASSERT(CType::IsCTypeProto(proto)); + MOZ_ASSERT(proto); + MOZ_ASSERT(CType::IsCTypeProto(proto)); // Get the desired prototype. jsval result = JS_GetReservedSlot(proto, slot); @@ -3655,19 +3655,19 @@ CType::GetProtoFromCtor(JSObject* obj, CTypeProtoSlot slot) JSObject* CType::GetProtoFromType(JSContext* cx, JSObject* objArg, CTypeProtoSlot slot) { - JS_ASSERT(IsCType(objArg)); + MOZ_ASSERT(IsCType(objArg)); RootedObject obj(cx, objArg); // Get the prototype of the type object. RootedObject proto(cx); if (!JS_GetPrototype(cx, obj, &proto)) return nullptr; - JS_ASSERT(proto); - JS_ASSERT(CType::IsCTypeProto(proto)); + MOZ_ASSERT(proto); + MOZ_ASSERT(CType::IsCTypeProto(proto)); // Get the requested ctypes.{Pointer,Array,Struct,Function}Type.prototype. jsval result = JS_GetReservedSlot(proto, slot); - JS_ASSERT(result.isObject()); + MOZ_ASSERT(result.isObject()); return &result.toObject(); } @@ -3827,12 +3827,12 @@ CType::ToSource(JSContext* cx, unsigned argc, jsval* vp) bool CType::HasInstance(JSContext* cx, HandleObject obj, MutableHandleValue v, bool* bp) { - JS_ASSERT(CType::IsCType(obj)); + MOZ_ASSERT(CType::IsCType(obj)); jsval slot = JS_GetReservedSlot(obj, SLOT_PROTO); JS::Rooted prototype(cx, &slot.toObject()); - JS_ASSERT(prototype); - JS_ASSERT(CData::IsCDataProto(prototype)); + MOZ_ASSERT(prototype); + MOZ_ASSERT(CData::IsCDataProto(prototype)); *bp = false; if (v.isPrimitive()) @@ -3855,17 +3855,17 @@ CType::HasInstance(JSContext* cx, HandleObject obj, MutableHandleValue v, bool* static JSObject* CType::GetGlobalCTypes(JSContext* cx, JSObject* objArg) { - JS_ASSERT(CType::IsCType(objArg)); + MOZ_ASSERT(CType::IsCType(objArg)); RootedObject obj(cx, objArg); RootedObject objTypeProto(cx); if (!JS_GetPrototype(cx, obj, &objTypeProto)) return nullptr; - JS_ASSERT(objTypeProto); - JS_ASSERT(CType::IsCTypeProto(objTypeProto)); + MOZ_ASSERT(objTypeProto); + MOZ_ASSERT(CType::IsCTypeProto(objTypeProto)); jsval valCTypes = JS_GetReservedSlot(objTypeProto, SLOT_CTYPES); - JS_ASSERT(valCTypes.isObject()); + MOZ_ASSERT(valCTypes.isObject()); return &valCTypes.toObject(); } @@ -4068,10 +4068,10 @@ PointerType::ConstructData(JSContext* cx, JSObject* PointerType::GetBaseType(JSObject* obj) { - JS_ASSERT(CType::GetTypeCode(obj) == TYPE_pointer); + MOZ_ASSERT(CType::GetTypeCode(obj) == TYPE_pointer); jsval type = JS_GetReservedSlot(obj, SLOT_TARGET_T); - JS_ASSERT(!type.isNull()); + MOZ_ASSERT(!type.isNull()); return &type.toObject(); } @@ -4415,19 +4415,19 @@ ArrayType::ConstructData(JSContext* cx, JSObject* ArrayType::GetBaseType(JSObject* obj) { - JS_ASSERT(CType::IsCType(obj)); - JS_ASSERT(CType::GetTypeCode(obj) == TYPE_array); + MOZ_ASSERT(CType::IsCType(obj)); + MOZ_ASSERT(CType::GetTypeCode(obj) == TYPE_array); jsval type = JS_GetReservedSlot(obj, SLOT_ELEMENT_T); - JS_ASSERT(!type.isNull()); + MOZ_ASSERT(!type.isNull()); return &type.toObject(); } bool ArrayType::GetSafeLength(JSObject* obj, size_t* result) { - JS_ASSERT(CType::IsCType(obj)); - JS_ASSERT(CType::GetTypeCode(obj) == TYPE_array); + MOZ_ASSERT(CType::IsCType(obj)); + MOZ_ASSERT(CType::GetTypeCode(obj) == TYPE_array); jsval length = JS_GetReservedSlot(obj, SLOT_LENGTH); @@ -4442,19 +4442,19 @@ ArrayType::GetSafeLength(JSObject* obj, size_t* result) return true; } - JS_ASSERT(length.isUndefined()); + MOZ_ASSERT(length.isUndefined()); return false; } size_t ArrayType::GetLength(JSObject* obj) { - JS_ASSERT(CType::IsCType(obj)); - JS_ASSERT(CType::GetTypeCode(obj) == TYPE_array); + MOZ_ASSERT(CType::IsCType(obj)); + MOZ_ASSERT(CType::GetTypeCode(obj) == TYPE_array); jsval length = JS_GetReservedSlot(obj, SLOT_LENGTH); - JS_ASSERT(!length.isUndefined()); + MOZ_ASSERT(!length.isUndefined()); // The "length" property can be an int, a double, or JSVAL_VOID // (for arrays of undefined length), and must always fit in a size_t. @@ -4467,9 +4467,9 @@ ArrayType::GetLength(JSObject* obj) ffi_type* ArrayType::BuildFFIType(JSContext* cx, JSObject* obj) { - JS_ASSERT(CType::IsCType(obj)); - JS_ASSERT(CType::GetTypeCode(obj) == TYPE_array); - JS_ASSERT(CType::IsSizeDefined(obj)); + MOZ_ASSERT(CType::IsCType(obj)); + MOZ_ASSERT(CType::GetTypeCode(obj) == TYPE_array); + MOZ_ASSERT(CType::IsSizeDefined(obj)); JSObject* baseType = ArrayType::GetBaseType(obj); ffi_type* ffiBaseType = CType::GetFFIType(cx, baseType); @@ -4551,7 +4551,7 @@ ArrayType::LengthGetter(JSContext* cx, JS::CallArgs args) obj = CData::GetCType(obj); args.rval().set(JS_GetReservedSlot(obj, SLOT_LENGTH)); - JS_ASSERT(args.rval().isNumber() || args.rval().isUndefined()); + MOZ_ASSERT(args.rval().isNumber() || args.rval().isUndefined()); return true; } @@ -4963,9 +4963,9 @@ StructType::DefineInternal(JSContext* cx, JSObject* typeObj_, JSObject* fieldsOb ffi_type* StructType::BuildFFIType(JSContext* cx, JSObject* obj) { - JS_ASSERT(CType::IsCType(obj)); - JS_ASSERT(CType::GetTypeCode(obj) == TYPE_struct); - JS_ASSERT(CType::IsSizeDefined(obj)); + MOZ_ASSERT(CType::IsCType(obj)); + MOZ_ASSERT(CType::GetTypeCode(obj) == TYPE_struct); + MOZ_ASSERT(CType::IsSizeDefined(obj)); const FieldInfoHash* fields = GetFieldInfo(obj); size_t len = fields->count(); @@ -4999,8 +4999,8 @@ StructType::BuildFFIType(JSContext* cx, JSObject* obj) } else { // Represent an empty struct as having a size of 1 byte, just like C++. - JS_ASSERT(structSize == 1); - JS_ASSERT(structAlign == 1); + MOZ_ASSERT(structSize == 1); + MOZ_ASSERT(structAlign == 1); elements = cx->pod_malloc(2); if (!elements) { JS_ReportOutOfMemory(cx); @@ -5020,9 +5020,9 @@ StructType::BuildFFIType(JSContext* cx, JSObject* obj) ffiType->size = 0; ffiType->alignment = 0; ffi_status status = ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 0, ffiType.get(), nullptr); - JS_ASSERT(status == FFI_OK); - JS_ASSERT(structSize == ffiType->size); - JS_ASSERT(structAlign == ffiType->alignment); + MOZ_ASSERT(status == FFI_OK); + MOZ_ASSERT(structSize == ffiType->size); + MOZ_ASSERT(structAlign == ffiType->alignment); #else // Fill in the ffi_type's size and align fields. This makes libffi treat the // type as initialized; it will not recompute the values. (We assume @@ -5151,11 +5151,11 @@ StructType::ConstructData(JSContext* cx, const FieldInfoHash* StructType::GetFieldInfo(JSObject* obj) { - JS_ASSERT(CType::IsCType(obj)); - JS_ASSERT(CType::GetTypeCode(obj) == TYPE_struct); + MOZ_ASSERT(CType::IsCType(obj)); + MOZ_ASSERT(CType::GetTypeCode(obj) == TYPE_struct); jsval slot = JS_GetReservedSlot(obj, SLOT_FIELDINFO); - JS_ASSERT(!slot.isUndefined() && slot.toPrivate()); + MOZ_ASSERT(!slot.isUndefined() && slot.toPrivate()); return static_cast(slot.toPrivate()); } @@ -5163,8 +5163,8 @@ StructType::GetFieldInfo(JSObject* obj) const FieldInfo* StructType::LookupField(JSContext* cx, JSObject* obj, JSFlatString *name) { - JS_ASSERT(CType::IsCType(obj)); - JS_ASSERT(CType::GetTypeCode(obj) == TYPE_struct); + MOZ_ASSERT(CType::IsCType(obj)); + MOZ_ASSERT(CType::GetTypeCode(obj) == TYPE_struct); FieldInfoHash::Ptr ptr = GetFieldInfo(obj)->lookup(name); if (ptr) @@ -5181,9 +5181,9 @@ StructType::LookupField(JSContext* cx, JSObject* obj, JSFlatString *name) JSObject* StructType::BuildFieldsArray(JSContext* cx, JSObject* obj) { - JS_ASSERT(CType::IsCType(obj)); - JS_ASSERT(CType::GetTypeCode(obj) == TYPE_struct); - JS_ASSERT(CType::IsSizeDefined(obj)); + MOZ_ASSERT(CType::IsCType(obj)); + MOZ_ASSERT(CType::GetTypeCode(obj) == TYPE_struct); + MOZ_ASSERT(CType::IsSizeDefined(obj)); const FieldInfoHash* fields = GetFieldInfo(obj); size_t len = fields->count(); @@ -5432,7 +5432,7 @@ PrepareType(JSContext* cx, jsval type) } // libffi cannot pass types of zero size by value. - JS_ASSERT(CType::GetSize(result) != 0); + MOZ_ASSERT(CType::GetSize(result) != 0); return result; } @@ -5460,7 +5460,7 @@ PrepareReturnType(JSContext* cx, jsval type) } // libffi cannot pass types of zero size by value. - JS_ASSERT(typeCode == TYPE_void_t || CType::GetSize(result) != 0); + MOZ_ASSERT(typeCode == TYPE_void_t || CType::GetSize(result) != 0); return result; } @@ -5738,7 +5738,7 @@ FunctionType::ConstructData(JSContext* cx, HandleObject thisObj, jsval errVal) { - JS_ASSERT(CType::GetTypeCode(typeObj) == TYPE_function); + MOZ_ASSERT(CType::GetTypeCode(typeObj) == TYPE_function); PRFuncPtr* data = static_cast(CData::GetData(dataObj)); @@ -5967,11 +5967,11 @@ FunctionType::Call(JSContext* cx, FunctionInfo* FunctionType::GetFunctionInfo(JSObject* obj) { - JS_ASSERT(CType::IsCType(obj)); - JS_ASSERT(CType::GetTypeCode(obj) == TYPE_function); + MOZ_ASSERT(CType::IsCType(obj)); + MOZ_ASSERT(CType::GetTypeCode(obj) == TYPE_function); jsval slot = JS_GetReservedSlot(obj, SLOT_FNINFO); - JS_ASSERT(!slot.isUndefined() && slot.toPrivate()); + MOZ_ASSERT(!slot.isUndefined() && slot.toPrivate()); return static_cast(slot.toPrivate()); } @@ -6057,7 +6057,7 @@ CClosure::Create(JSContext* cx, PRFuncPtr* fnptr) { RootedValue errVal(cx, errVal_); - JS_ASSERT(fnObj); + MOZ_ASSERT(fnObj); RootedObject result(cx, JS_NewObject(cx, &sCClosureClass, NullPtr(), NullPtr())); if (!result) @@ -6065,8 +6065,8 @@ CClosure::Create(JSContext* cx, // Get the FunctionInfo from the FunctionType. FunctionInfo* fninfo = FunctionType::GetFunctionInfo(typeObj); - JS_ASSERT(!fninfo->mIsVariadic); - JS_ASSERT(GetABICode(fninfo->mABI) != ABI_WINAPI); + MOZ_ASSERT(!fninfo->mIsVariadic); + MOZ_ASSERT(GetABICode(fninfo->mABI) != ABI_WINAPI); AutoPtr cinfo(cx->new_(JS_GetRuntime(cx))); if (!cinfo) { @@ -6079,8 +6079,8 @@ CClosure::Create(JSContext* cx, RootedObject proto(cx); if (!JS_GetPrototype(cx, typeObj, &proto)) return nullptr; - JS_ASSERT(proto); - JS_ASSERT(CType::IsCTypeProto(proto)); + MOZ_ASSERT(proto); + MOZ_ASSERT(CType::IsCTypeProto(proto)); // Get a JSContext for use with the closure. cinfo->cx = js::DefaultJSContext(JS_GetRuntime(cx)); @@ -6099,7 +6099,7 @@ CClosure::Create(JSContext* cx, // With the exception of void, the FunctionType constructor ensures that // the return type has a defined size. - JS_ASSERT(CType::IsSizeDefined(fninfo->mReturnType)); + MOZ_ASSERT(CType::IsSizeDefined(fninfo->mReturnType)); // Allocate a buffer for the return value. size_t rvSize = CType::GetSize(fninfo->mReturnType); @@ -6179,10 +6179,10 @@ CClosure::Finalize(JSFreeOp *fop, JSObject* obj) void CClosure::ClosureStub(ffi_cif* cif, void* result, void** args, void* userData) { - JS_ASSERT(cif); - JS_ASSERT(result); - JS_ASSERT(args); - JS_ASSERT(userData); + MOZ_ASSERT(cif); + MOZ_ASSERT(result); + MOZ_ASSERT(args); + MOZ_ASSERT(userData); // Retrieve the essentials from our closure object. ClosureInfo* cinfo = static_cast(userData); @@ -6204,7 +6204,7 @@ CClosure::ClosureStub(ffi_cif* cif, void* result, void** args, void* userData) // Assert that our CIFs agree. FunctionInfo* fninfo = FunctionType::GetFunctionInfo(typeObj); - JS_ASSERT(cif == &fninfo->mCIF); + MOZ_ASSERT(cif == &fninfo->mCIF); TypeCode typeCode = CType::GetTypeCode(fninfo->mReturnType); @@ -6277,7 +6277,7 @@ CClosure::ClosureStub(ffi_cif* cif, void* result, void** args, void* userData) // type, due to libffi alignment issues (see above). But it should never // be smaller. size_t copySize = CType::GetSize(fninfo->mReturnType); - JS_ASSERT(copySize <= rvSize); + MOZ_ASSERT(copySize <= rvSize); memcpy(result, cinfo->errResult, copySize); } else { // Bad case: not much we can do here. The rv is already zeroed out, so we @@ -6346,19 +6346,19 @@ CData::Create(JSContext* cx, void* source, bool ownResult) { - JS_ASSERT(typeObj); - JS_ASSERT(CType::IsCType(typeObj)); - JS_ASSERT(CType::IsSizeDefined(typeObj)); - JS_ASSERT(ownResult || source); + MOZ_ASSERT(typeObj); + MOZ_ASSERT(CType::IsCType(typeObj)); + MOZ_ASSERT(CType::IsSizeDefined(typeObj)); + MOZ_ASSERT(ownResult || source); JS_ASSERT_IF(refObj && CData::IsCData(refObj), !ownResult); // Get the 'prototype' property from the type. jsval slot = JS_GetReservedSlot(typeObj, SLOT_PROTO); - JS_ASSERT(slot.isObject()); + MOZ_ASSERT(slot.isObject()); RootedObject proto(cx, &slot.toObject()); RootedObject parent(cx, JS_GetParent(typeObj)); - JS_ASSERT(parent); + MOZ_ASSERT(parent); RootedObject dataObj(cx, JS_NewObject(cx, &sCDataClass, proto, parent)); if (!dataObj) @@ -6431,24 +6431,24 @@ CData::Finalize(JSFreeOp *fop, JSObject* obj) JSObject* CData::GetCType(JSObject* dataObj) { - JS_ASSERT(CData::IsCData(dataObj)); + MOZ_ASSERT(CData::IsCData(dataObj)); jsval slot = JS_GetReservedSlot(dataObj, SLOT_CTYPE); JSObject* typeObj = slot.toObjectOrNull(); - JS_ASSERT(CType::IsCType(typeObj)); + MOZ_ASSERT(CType::IsCType(typeObj)); return typeObj; } void* CData::GetData(JSObject* dataObj) { - JS_ASSERT(CData::IsCData(dataObj)); + MOZ_ASSERT(CData::IsCData(dataObj)); jsval slot = JS_GetReservedSlot(dataObj, SLOT_DATA); void** buffer = static_cast(slot.toPrivate()); - JS_ASSERT(buffer); - JS_ASSERT(*buffer); + MOZ_ASSERT(buffer); + MOZ_ASSERT(*buffer); return *buffer; } @@ -7230,19 +7230,19 @@ CDataFinalizer::Methods::Dispose(JSContext* cx, unsigned argc, jsval *vp) } jsval valType = JS_GetReservedSlot(obj, SLOT_DATAFINALIZER_VALTYPE); - JS_ASSERT(valType.isObject()); + MOZ_ASSERT(valType.isObject()); JSObject *objCTypes = CType::GetGlobalCTypes(cx, &valType.toObject()); if (!objCTypes) return false; jsval valCodePtrType = JS_GetReservedSlot(obj, SLOT_DATAFINALIZER_CODETYPE); - JS_ASSERT(valCodePtrType.isObject()); + MOZ_ASSERT(valCodePtrType.isObject()); JSObject *objCodePtrType = &valCodePtrType.toObject(); JSObject *objCodeType = PointerType::GetBaseType(objCodePtrType); - JS_ASSERT(objCodeType); - JS_ASSERT(CType::GetTypeCode(objCodeType) == TYPE_function); + MOZ_ASSERT(objCodeType); + MOZ_ASSERT(CType::GetTypeCode(objCodeType) == TYPE_function); RootedObject resultType(cx, FunctionType::GetFunctionInfo(objCodeType)->mReturnType); RootedValue result(cx, JSVAL_VOID); @@ -7319,7 +7319,7 @@ CDataFinalizer::Cleanup(CDataFinalizer::Private *p, JSObject *obj) return; // No slots to clean up } - JS_ASSERT(CDataFinalizer::IsCDataFinalizer(obj)); + MOZ_ASSERT(CDataFinalizer::IsCDataFinalizer(obj)); JS_SetPrivate(obj, nullptr); for (int i = 0; i < CDATAFINALIZER_SLOTS; ++i) { @@ -7371,7 +7371,7 @@ Int64Base::Finalize(JSFreeOp *fop, JSObject* obj) uint64_t Int64Base::GetInt(JSObject* obj) { - JS_ASSERT(Int64::IsInt64(obj) || UInt64::IsUInt64(obj)); + MOZ_ASSERT(Int64::IsInt64(obj) || UInt64::IsUInt64(obj)); jsval slot = JS_GetReservedSlot(obj, SLOT_INT64); return *static_cast(slot.toPrivate()); @@ -7466,7 +7466,7 @@ Int64::Construct(JSContext* cx, RootedObject callee(cx, &args.callee()); ASSERT_OK(JS_GetProperty(cx, callee, "prototype", &slot)); RootedObject proto(cx, slot.toObjectOrNull()); - JS_ASSERT(JS_GetClass(proto) == &sInt64ProtoClass); + MOZ_ASSERT(JS_GetClass(proto) == &sInt64ProtoClass); JSObject* result = Int64Base::Construct(cx, proto, i, false); if (!result) @@ -7604,7 +7604,7 @@ Int64::Join(JSContext* cx, unsigned argc, jsval* vp) jsval slot = js::GetFunctionNativeReserved(callee, SLOT_FN_INT64PROTO); RootedObject proto(cx, &slot.toObject()); - JS_ASSERT(JS_GetClass(proto) == &sInt64ProtoClass); + MOZ_ASSERT(JS_GetClass(proto) == &sInt64ProtoClass); JSObject* result = Int64Base::Construct(cx, proto, i, false); if (!result) @@ -7636,7 +7636,7 @@ UInt64::Construct(JSContext* cx, RootedObject callee(cx, &args.callee()); ASSERT_OK(JS_GetProperty(cx, callee, "prototype", &slot)); RootedObject proto(cx, &slot.toObject()); - JS_ASSERT(JS_GetClass(proto) == &sUInt64ProtoClass); + MOZ_ASSERT(JS_GetClass(proto) == &sUInt64ProtoClass); JSObject* result = Int64Base::Construct(cx, proto, u, true); if (!result) @@ -7770,7 +7770,7 @@ UInt64::Join(JSContext* cx, unsigned argc, jsval* vp) jsval slot = js::GetFunctionNativeReserved(callee, SLOT_FN_INT64PROTO); RootedObject proto(cx, &slot.toObject()); - JS_ASSERT(JS_GetClass(proto) == &sUInt64ProtoClass); + MOZ_ASSERT(JS_GetClass(proto) == &sUInt64ProtoClass); JSObject* result = Int64Base::Construct(cx, proto, u, true); if (!result) diff --git a/js/src/ctypes/CTypes.h b/js/src/ctypes/CTypes.h index 319a19a6b61a..7e971661675b 100644 --- a/js/src/ctypes/CTypes.h +++ b/js/src/ctypes/CTypes.h @@ -41,7 +41,7 @@ public: // via the constructor AutoPtr(T*). T* get() { return mPtr; } - void set(T* other) { JS_ASSERT(mPtr == nullptr); mPtr = other; } + void set(T* other) { MOZ_ASSERT(mPtr == nullptr); mPtr = other; } T* forget() { T* result = mPtr; mPtr = nullptr; return result; } self_type& operator=(T* rhs) { mPtr = rhs; return *this; } @@ -94,7 +94,7 @@ template void AppendString(Vector &v, JSString* str) { - JS_ASSERT(str); + MOZ_ASSERT(str); JSLinearString *linear = str->ensureLinear(nullptr); if (!linear) return; @@ -109,7 +109,7 @@ template void AppendString(Vector &v, JSString* str) { - JS_ASSERT(str); + MOZ_ASSERT(str); size_t vlen = v.length(); size_t alen = str->length(); if (!v.resize(vlen + alen)) @@ -153,7 +153,7 @@ template void PrependString(Vector &v, JSString* str) { - JS_ASSERT(str); + MOZ_ASSERT(str); size_t vlen = v.length(); size_t alen = str->length(); if (!v.resize(vlen + alen)) @@ -195,7 +195,7 @@ DeflateStringToUTF8Buffer(JSContext *maybecx, const CharT *src, size_t srclen, MOZ_ALWAYS_INLINE void ASSERT_OK(bool ok) { - JS_ASSERT(ok); + MOZ_ASSERT(ok); } // for JS error reporting diff --git a/js/src/ctypes/Library.cpp b/js/src/ctypes/Library.cpp index 275f8c9c0438..8ea8d766cf44 100644 --- a/js/src/ctypes/Library.cpp +++ b/js/src/ctypes/Library.cpp @@ -175,7 +175,7 @@ Library::IsLibrary(JSObject* obj) PRLibrary* Library::GetLibrary(JSObject* obj) { - JS_ASSERT(IsLibrary(obj)); + MOZ_ASSERT(IsLibrary(obj)); jsval slot = JS_GetReservedSlot(obj, SLOT_LIBRARY); return static_cast(slot.toPrivate()); diff --git a/js/src/devtools/sharkctl.cpp b/js/src/devtools/sharkctl.cpp index 86fdfc936d22..963bf1d59815 100644 --- a/js/src/devtools/sharkctl.cpp +++ b/js/src/devtools/sharkctl.cpp @@ -86,8 +86,8 @@ Connect(mach_port_t shark_port) msg.unk1 = 1; msg.pid = getpid(); - JS_ASSERT(RECV_SIZEOF(struct chud_client_acquire_msg) == 0x24); - JS_ASSERT(sizeof(msg) == 0x2c); + MOZ_ASSERT(RECV_SIZEOF(struct chud_client_acquire_msg) == 0x24); + MOZ_ASSERT(sizeof(msg) == 0x2c); mach_msg_return_t result = mach_msg(&msg.hdr, MACH_SEND_MSG | MACH_RCV_MSG, RECV_SIZEOF(struct chud_client_acquire_msg), sizeof(msg), reply_port, 0, 0); @@ -118,7 +118,7 @@ Start(mach_port_t shark_port, uint32_t name) msg.unk6 = 1; msg.name1 = name; - JS_ASSERT(sizeof(msg) == 0x34); + MOZ_ASSERT(sizeof(msg) == 0x34); mach_msg_return_t result = mach_msg(&msg.hdr, MACH_SEND_MSG | MACH_RCV_MSG, sizeof(msg), 0x30, reply_port, 0, 0); mig_dealloc_reply_port(reply_port); @@ -138,8 +138,8 @@ Stop(mach_port_t shark_port) msg.hdr.msgh_reserved = 0; msg.hdr.msgh_id = SHARK_MSG_STOP; - JS_ASSERT(RECV_SIZEOF(struct chud_client_stop_msg) == 0x18); - JS_ASSERT(sizeof(msg) == 0x2c); + MOZ_ASSERT(RECV_SIZEOF(struct chud_client_stop_msg) == 0x18); + MOZ_ASSERT(sizeof(msg) == 0x2c); mach_msg_return_t result = mach_msg(&msg.hdr, MACH_SEND_MSG | MACH_RCV_MSG, RECV_SIZEOF(struct chud_client_stop_msg), sizeof(msg), reply_port, 0, 0); @@ -163,8 +163,8 @@ Disconnect(mach_port_t shark_port) msg.unk1 = 1; msg.pid = getpid(); - JS_ASSERT(RECV_SIZEOF(struct chud_client_release_msg) == 0x24); - JS_ASSERT(sizeof(msg) == 0x2c); + MOZ_ASSERT(RECV_SIZEOF(struct chud_client_release_msg) == 0x24); + MOZ_ASSERT(sizeof(msg) == 0x2c); mach_msg_return_t result = mach_msg(&msg.hdr, MACH_SEND_MSG | MACH_RCV_MSG, RECV_SIZEOF(struct chud_client_release_msg), sizeof(msg), reply_port, 0, 0); diff --git a/js/src/ds/FixedSizeHash.h b/js/src/ds/FixedSizeHash.h index 5a6985de7ecf..9dc373010742 100644 --- a/js/src/ds/FixedSizeHash.h +++ b/js/src/ds/FixedSizeHash.h @@ -50,7 +50,7 @@ class FixedSizeHashSet : entries(), lastOperations(), numOperations(0) { JS_STATIC_ASSERT(Capacity > 0); - JS_ASSERT(HashPolicy::isCleared(entries[0])); + MOZ_ASSERT(HashPolicy::isCleared(entries[0])); } bool lookup(const Lookup &lookup, T *pentry) diff --git a/js/src/ds/InlineMap.h b/js/src/ds/InlineMap.h index f84e99b2f34b..86626a990299 100644 --- a/js/src/ds/InlineMap.h +++ b/js/src/ds/InlineMap.h @@ -51,14 +51,14 @@ class InlineMap } bool switchToMap() { - JS_ASSERT(inlNext == InlineElems); + MOZ_ASSERT(inlNext == InlineElems); if (map.initialized()) { map.clear(); } else { if (!map.init(count())) return false; - JS_ASSERT(map.initialized()); + MOZ_ASSERT(map.initialized()); } for (InlineElem *it = inl, *end = inl + inlNext; it != end; ++it) { @@ -67,8 +67,8 @@ class InlineMap } inlNext = InlineElems + 1; - JS_ASSERT(map.count() == inlCount); - JS_ASSERT(usingMap()); + MOZ_ASSERT(map.count() == inlCount); + MOZ_ASSERT(usingMap()); return true; } @@ -133,12 +133,12 @@ class InlineMap } K &key() { - JS_ASSERT(found()); + MOZ_ASSERT(found()); return isInlinePtr ? inlPtr->key : mapPtr->key(); } V &value() { - JS_ASSERT(found()); + MOZ_ASSERT(found()); return isInlinePtr ? inlPtr->value : mapPtr->value(); } }; /* class Ptr */ @@ -175,7 +175,7 @@ class InlineMap } V &value() { - JS_ASSERT(found()); + MOZ_ASSERT(found()); if (isInlinePtr) return inlAddPtr->value; return mapAddPtr->value(); @@ -200,17 +200,17 @@ class InlineMap } const WordMap &asMap() const { - JS_ASSERT(isMap()); + MOZ_ASSERT(isMap()); return map; } const InlineElem *asInline() const { - JS_ASSERT(!isMap()); + MOZ_ASSERT(!isMap()); return inl; } const InlineElem *inlineEnd() const { - JS_ASSERT(!isMap()); + MOZ_ASSERT(!isMap()); return inl + inlNext; } @@ -247,18 +247,18 @@ class InlineMap MOZ_ALWAYS_INLINE bool add(AddPtr &p, const K &key, const V &value) { - JS_ASSERT(!p); + MOZ_ASSERT(!p); if (p.isInlinePtr) { InlineElem *addPtr = p.inlAddPtr; - JS_ASSERT(addPtr == inl + inlNext); + MOZ_ASSERT(addPtr == inl + inlNext); /* Switching to map mode before we add this pointer. */ if (addPtr == inl + InlineElems) return switchAndAdd(key, value); - JS_ASSERT(!p.found()); - JS_ASSERT(uintptr_t(inl + inlNext) == uintptr_t(p.inlAddPtr)); + MOZ_ASSERT(!p.found()); + MOZ_ASSERT(uintptr_t(inl + inlNext) == uintptr_t(p.inlAddPtr)); p.inlAddPtr->key = key; p.inlAddPtr->value = value; ++inlCount; @@ -280,15 +280,15 @@ class InlineMap } void remove(Ptr p) { - JS_ASSERT(p); + MOZ_ASSERT(p); if (p.isInlinePtr) { - JS_ASSERT(inlCount > 0); - JS_ASSERT(p.inlPtr->key != nullptr); + MOZ_ASSERT(inlCount > 0); + MOZ_ASSERT(p.inlPtr->key != nullptr); p.inlPtr->key = nullptr; --inlCount; return; } - JS_ASSERT(map.initialized() && usingMap()); + MOZ_ASSERT(map.initialized() && usingMap()); map.remove(p.mapPtr); } @@ -310,7 +310,7 @@ class InlineMap : cur(nullptr), end(nullptr), /* Avoid GCC 4.3.3 over-warning. */ isInline(false) { mapRange = r; - JS_ASSERT(!isInlineRange()); + MOZ_ASSERT(!isInlineRange()); } Range(const InlineElem *begin, const InlineElem *end_) @@ -318,11 +318,11 @@ class InlineMap end(const_cast(end_)), isInline(true) { advancePastNulls(cur); - JS_ASSERT(isInlineRange()); + MOZ_ASSERT(isInlineRange()); } bool checkInlineRangeInvariants() const { - JS_ASSERT(uintptr_t(cur) <= uintptr_t(end)); + MOZ_ASSERT(uintptr_t(cur) <= uintptr_t(end)); JS_ASSERT_IF(cur != end, cur->key != nullptr); return true; } @@ -336,12 +336,12 @@ class InlineMap InlineElem *newCur = begin; while (newCur < end && nullptr == newCur->key) ++newCur; - JS_ASSERT(uintptr_t(newCur) <= uintptr_t(end)); + MOZ_ASSERT(uintptr_t(newCur) <= uintptr_t(end)); cur = newCur; } void bumpCurPtr() { - JS_ASSERT(isInlineRange()); + MOZ_ASSERT(isInlineRange()); advancePastNulls(cur + 1); } @@ -353,14 +353,14 @@ class InlineMap } Entry front() { - JS_ASSERT(!empty()); + MOZ_ASSERT(!empty()); if (isInlineRange()) return Entry(cur->key, cur->value); return Entry(mapRange.front().key(), mapRange.front().value()); } void popFront() { - JS_ASSERT(!empty()); + MOZ_ASSERT(!empty()); if (isInlineRange()) bumpCurPtr(); else diff --git a/js/src/ds/LifoAlloc.cpp b/js/src/ds/LifoAlloc.cpp index 950858089cbc..2cc13db6f04d 100644 --- a/js/src/ds/LifoAlloc.cpp +++ b/js/src/ds/LifoAlloc.cpp @@ -19,7 +19,7 @@ namespace detail { BumpChunk * BumpChunk::new_(size_t chunkSize) { - JS_ASSERT(RoundUpPow2(chunkSize) == chunkSize); + MOZ_ASSERT(RoundUpPow2(chunkSize) == chunkSize); void *mem = js_malloc(chunkSize); if (!mem) return nullptr; @@ -28,7 +28,7 @@ BumpChunk::new_(size_t chunkSize) // We assume that the alignment of sAlign is less than that of // the underlying memory allocator -- creating a new BumpChunk should // always satisfy the sAlign alignment constraint. - JS_ASSERT(AlignPtr(result->bump) == result->bump); + MOZ_ASSERT(AlignPtr(result->bump) == result->bump); return result; } @@ -69,7 +69,7 @@ LifoAlloc::freeAll() // Nb: maintaining curSize_ correctly isn't easy. Fortunately, this is an // excellent sanity check. - JS_ASSERT(curSize_ == 0); + MOZ_ASSERT(curSize_ == 0); } LifoAlloc::BumpChunk * @@ -108,13 +108,13 @@ LifoAlloc::getOrCreateChunk(size_t n) if (!first) { latest = first = last = newChunk; } else { - JS_ASSERT(latest && !latest->next()); + MOZ_ASSERT(latest && !latest->next()); latest->setNext(newChunk); latest = last = newChunk; } size_t computedChunkSize = newChunk->computedSizeOfIncludingThis(); - JS_ASSERT(computedChunkSize == chunkSize); + MOZ_ASSERT(computedChunkSize == chunkSize); incrementCurSize(computedChunkSize); return newChunk; @@ -123,8 +123,8 @@ LifoAlloc::getOrCreateChunk(size_t n) void LifoAlloc::transferFrom(LifoAlloc *other) { - JS_ASSERT(!markCount); - JS_ASSERT(!other->markCount); + MOZ_ASSERT(!markCount); + MOZ_ASSERT(!other->markCount); if (!other->first) return; @@ -141,8 +141,8 @@ LifoAlloc::transferFrom(LifoAlloc *other) void LifoAlloc::transferUnusedFrom(LifoAlloc *other) { - JS_ASSERT(!markCount); - JS_ASSERT(latest == first); + MOZ_ASSERT(!markCount); + MOZ_ASSERT(latest == first); if (other->markCount || !other->first) return; diff --git a/js/src/ds/LifoAlloc.h b/js/src/ds/LifoAlloc.h index 7601a50a6462..efcfeeae4bab 100644 --- a/js/src/ds/LifoAlloc.h +++ b/js/src/ds/LifoAlloc.h @@ -38,7 +38,7 @@ AlignPtr(void *orig) "LIFO_ALLOC_ALIGN must be a power of two"); char *result = (char *) ((uintptr_t(orig) + (LIFO_ALLOC_ALIGN - 1)) & (~LIFO_ALLOC_ALIGN + 1)); - JS_ASSERT(uintptr_t(result) % LIFO_ALLOC_ALIGN == 0); + MOZ_ASSERT(uintptr_t(result) % LIFO_ALLOC_ALIGN == 0); return result; } @@ -58,18 +58,18 @@ class BumpChunk limit(bump + bumpSpaceSize), next_(nullptr), bumpSpaceSize(bumpSpaceSize) { - JS_ASSERT(bump == AlignPtr(bump)); + MOZ_ASSERT(bump == AlignPtr(bump)); } void setBump(void *ptr) { - JS_ASSERT(bumpBase() <= ptr); - JS_ASSERT(ptr <= limit); + MOZ_ASSERT(bumpBase() <= ptr); + MOZ_ASSERT(ptr <= limit); #if defined(DEBUG) || defined(MOZ_HAVE_MEM_CHECKS) char* prevBump = bump; #endif bump = static_cast(ptr); #ifdef DEBUG - JS_ASSERT(contains(prevBump)); + MOZ_ASSERT(contains(prevBump)); // Clobber the now-free space. if (prevBump > bump) @@ -109,8 +109,8 @@ class BumpChunk void *mark() const { return bump; } void release(void *mark) { - JS_ASSERT(contains(mark)); - JS_ASSERT(mark <= bump); + MOZ_ASSERT(contains(mark)); + MOZ_ASSERT(mark <= bump); setBump(mark); } @@ -137,7 +137,7 @@ class BumpChunk if (MOZ_UNLIKELY(newBump < bump)) return nullptr; - JS_ASSERT(canAlloc(n)); // Ensure consistency between "can" and "try". + MOZ_ASSERT(canAlloc(n)); // Ensure consistency between "can" and "try". setBump(newBump); return aligned; } @@ -178,7 +178,7 @@ class LifoAlloc BumpChunk *getOrCreateChunk(size_t n); void reset(size_t defaultChunkSize) { - JS_ASSERT(mozilla::RoundUpPow2(defaultChunkSize) == defaultChunkSize); + MOZ_ASSERT(mozilla::RoundUpPow2(defaultChunkSize) == defaultChunkSize); first = latest = last = nullptr; defaultChunkSize_ = defaultChunkSize; markCount = 0; @@ -187,7 +187,7 @@ class LifoAlloc // Append unused chunks to the end of this LifoAlloc. void appendUnused(BumpChunk *start, BumpChunk *end) { - JS_ASSERT(start && end); + MOZ_ASSERT(start && end); if (last) last->setNext(start); else @@ -198,7 +198,7 @@ class LifoAlloc // Append used chunks to the end of this LifoAlloc. We act as if all the // chunks in |this| are used, even if they're not, so memory may be wasted. void appendUsed(BumpChunk *start, BumpChunk *latest, BumpChunk *end) { - JS_ASSERT(start && latest && end); + MOZ_ASSERT(start && latest && end); if (last) last->setNext(start); else @@ -213,7 +213,7 @@ class LifoAlloc peakSize_ = curSize_; } void decrementCurSize(size_t size) { - JS_ASSERT(curSize_ >= size); + MOZ_ASSERT(curSize_ >= size); curSize_ -= size; } @@ -226,7 +226,7 @@ class LifoAlloc // Steal allocated chunks from |other|. void steal(LifoAlloc *other) { - JS_ASSERT(!other->markCount); + MOZ_ASSERT(!other->markCount); // Copy everything from |other| to |this| except for |peakSize_|, which // requires some care. @@ -342,7 +342,7 @@ class LifoAlloc } void releaseAll() { - JS_ASSERT(!markCount); + MOZ_ASSERT(!markCount); latest = first; if (latest) latest->resetBump(); @@ -412,7 +412,7 @@ class LifoAlloc // If there is not enough room in the remaining block for |size|, // advance to the next block and update the position. void ensureSpaceAndAlignment(size_t size) { - JS_ASSERT(!empty()); + MOZ_ASSERT(!empty()); char *aligned = detail::AlignPtr(position_); if (aligned + size > chunk_->end()) { chunk_ = chunk_->next(); @@ -420,7 +420,7 @@ class LifoAlloc } else { position_ = aligned; } - JS_ASSERT(uintptr_t(position_) + size <= uintptr_t(chunk_->end())); + MOZ_ASSERT(uintptr_t(position_) + size <= uintptr_t(chunk_->end())); } public: @@ -497,7 +497,7 @@ class LifoAllocScope } void releaseEarly() { - JS_ASSERT(shouldRelease); + MOZ_ASSERT(shouldRelease); lifoAlloc->release(mark); shouldRelease = false; } @@ -538,7 +538,7 @@ class LifoAllocPolicy T *n = pod_malloc(newSize); if (fb == Fallible && !n) return nullptr; - JS_ASSERT(!(oldSize & mozilla::tl::MulOverflowMask::value)); + MOZ_ASSERT(!(oldSize & mozilla::tl::MulOverflowMask::value)); memcpy(n, p, Min(oldSize * sizeof(T), newSize * sizeof(T))); return n; } diff --git a/js/src/ds/Sort.h b/js/src/ds/Sort.h index 39dfbdfd193d..46d8dd4da170 100644 --- a/js/src/ds/Sort.h +++ b/js/src/ds/Sort.h @@ -17,7 +17,7 @@ template MOZ_ALWAYS_INLINE void CopyNonEmptyArray(T *dst, const T *src, size_t nelems) { - JS_ASSERT(nelems != 0); + MOZ_ASSERT(nelems != 0); const T *end = src + nelems; do { *dst++ = *src++; @@ -29,8 +29,8 @@ template MOZ_ALWAYS_INLINE bool MergeArrayRuns(T *dst, const T *src, size_t run1, size_t run2, Comparator c) { - JS_ASSERT(run1 >= 1); - JS_ASSERT(run2 >= 1); + MOZ_ASSERT(run1 >= 1); + MOZ_ASSERT(run2 >= 1); /* Copy runs already in sorted order. */ const T *b = src + run1; diff --git a/js/src/ds/SplayTree.h b/js/src/ds/SplayTree.h index 1595beb18383..31d38d6ab736 100644 --- a/js/src/ds/SplayTree.h +++ b/js/src/ds/SplayTree.h @@ -93,10 +93,10 @@ class SplayTree int cmp = C::compare(v, last->item); // Don't tolerate duplicate elements. - JS_ASSERT(cmp); + MOZ_ASSERT(cmp); Node *&parentPointer = (cmp < 0) ? last->left : last->right; - JS_ASSERT(!parentPointer); + MOZ_ASSERT(!parentPointer); parentPointer = element; element->parent = last; @@ -108,10 +108,10 @@ class SplayTree void remove(const T &v) { Node *last = lookup(v); - JS_ASSERT(last && C::compare(v, last->item) == 0); + MOZ_ASSERT(last && C::compare(v, last->item) == 0); splay(last); - JS_ASSERT(last == root); + MOZ_ASSERT(last == root); // Find another node which can be swapped in for the root: either the // rightmost child of the root's left, or the leftmost child of the @@ -158,7 +158,7 @@ class SplayTree Node *lookup(const T &v) { - JS_ASSERT(root); + MOZ_ASSERT(root); Node *node = root, *parent; do { parent = node; @@ -195,13 +195,13 @@ class SplayTree // Rotate the element until it is at the root of the tree. Performing // the rotations in this fashion preserves the amortized balancing of // the tree. - JS_ASSERT(node); + MOZ_ASSERT(node); while (node != root) { Node *parent = node->parent; if (parent == root) { // Zig rotation. rotate(node); - JS_ASSERT(node == root); + MOZ_ASSERT(node == root); return; } Node *grandparent = parent->parent; @@ -231,7 +231,7 @@ class SplayTree node->right->parent = parent; node->right = parent; } else { - JS_ASSERT(parent->right == node); + MOZ_ASSERT(parent->right == node); // x y // a y ==> x c // b c a b @@ -269,18 +269,18 @@ class SplayTree if (!enableCheckCoherency) return nullptr; if (!node) { - JS_ASSERT(!root); + MOZ_ASSERT(!root); return nullptr; } JS_ASSERT_IF(!node->parent, node == root); JS_ASSERT_IF(minimum, C::compare(minimum->item, node->item) < 0); if (node->left) { - JS_ASSERT(node->left->parent == node); + MOZ_ASSERT(node->left->parent == node); Node *leftMaximum = checkCoherency(node->left, minimum); - JS_ASSERT(C::compare(leftMaximum->item, node->item) < 0); + MOZ_ASSERT(C::compare(leftMaximum->item, node->item) < 0); } if (node->right) { - JS_ASSERT(node->right->parent == node); + MOZ_ASSERT(node->right->parent == node); return checkCoherency(node->right, node); } return node; diff --git a/js/src/frontend/BytecodeCompiler.cpp b/js/src/frontend/BytecodeCompiler.cpp index f1d703ef8b9d..3f854fa93eef 100644 --- a/js/src/frontend/BytecodeCompiler.cpp +++ b/js/src/frontend/BytecodeCompiler.cpp @@ -215,7 +215,7 @@ frontend::CompileScript(ExclusiveContext *cx, LifoAlloc *alloc, HandleObject sco unsigned staticLevel /* = 0 */, SourceCompressionTask *extraSct /* = nullptr */) { - JS_ASSERT(srcBuf.get()); + MOZ_ASSERT(srcBuf.get()); RootedString source(cx, source_); @@ -346,7 +346,7 @@ frontend::CompileScript(ExclusiveContext *cx, LifoAlloc *alloc, HandleObject sco if (tt <= TOK_EOF) { if (tt == TOK_EOF) break; - JS_ASSERT(tt == TOK_ERROR); + MOZ_ASSERT(tt == TOK_ERROR); return nullptr; } @@ -375,12 +375,12 @@ frontend::CompileScript(ExclusiveContext *cx, LifoAlloc *alloc, HandleObject sco script->bindings.numBlockScoped()); if (!pc->init(parser.tokenStream)) return nullptr; - JS_ASSERT(parser.pc == pc.ptr()); + MOZ_ASSERT(parser.pc == pc.ptr()); pn = parser.statement(); } if (!pn) { - JS_ASSERT(!parser.hadAbortedSyntaxParse()); + MOZ_ASSERT(!parser.hadAbortedSyntaxParse()); return nullptr; } } @@ -464,7 +464,7 @@ frontend::CompileScript(ExclusiveContext *cx, LifoAlloc *alloc, HandleObject sco bool frontend::CompileLazyFunction(JSContext *cx, Handle lazy, const char16_t *chars, size_t length) { - JS_ASSERT(cx->compartment() == lazy->functionNonDelazifying()->compartment()); + MOZ_ASSERT(cx->compartment() == lazy->functionNonDelazifying()->compartment()); CompileOptions options(cx, lazy->version()); options.setMutedErrors(lazy->mutedErrors()) @@ -485,7 +485,7 @@ frontend::CompileLazyFunction(JSContext *cx, Handle lazy, const cha uint32_t staticLevel = lazy->staticLevel(cx); Rooted fun(cx, lazy->functionNonDelazifying()); - JS_ASSERT(!lazy->isLegacyGenerator()); + MOZ_ASSERT(!lazy->isLegacyGenerator()); ParseNode *pn = parser.standaloneLazyFunction(fun, staticLevel, lazy->strict(), lazy->generatorKind()); if (!pn) @@ -496,7 +496,7 @@ frontend::CompileLazyFunction(JSContext *cx, Handle lazy, const cha RootedObject enclosingScope(cx, lazy->enclosingScope()); RootedScriptSource sourceObject(cx, lazy->sourceObject()); - JS_ASSERT(sourceObject); + MOZ_ASSERT(sourceObject); Rooted script(cx, JSScript::Create(cx, enclosingScope, false, options, staticLevel, @@ -547,7 +547,7 @@ CompileFunctionBody(JSContext *cx, MutableHandleFunction fun, const ReadOnlyComp ScriptSource *ss = sourceObject->source(); SourceCompressionTask sct(cx); - JS_ASSERT(!options.sourceIsLazy); + MOZ_ASSERT(!options.sourceIsLazy); if (!cx->compartment()->options().discardSource()) { if (!ss->setSourceCopy(cx, srcBuf, true, &sct)) return false; @@ -564,7 +564,7 @@ CompileFunctionBody(JSContext *cx, MutableHandleFunction fun, const ReadOnlyComp (LazyScript *) nullptr); } - JS_ASSERT(!options.forEval); + MOZ_ASSERT(!options.forEval); Parser parser(cx, &cx->tempLifoAlloc(), options, srcBuf.get(), srcBuf.length(), @@ -573,8 +573,8 @@ CompileFunctionBody(JSContext *cx, MutableHandleFunction fun, const ReadOnlyComp parser.sct = &sct; parser.ss = ss; - JS_ASSERT(fun); - JS_ASSERT(fun->isTenured()); + MOZ_ASSERT(fun); + MOZ_ASSERT(fun->isTenured()); fun->setArgCount(formals.length()); @@ -622,7 +622,7 @@ CompileFunctionBody(JSContext *cx, MutableHandleFunction fun, const ReadOnlyComp return false; if (fn->pn_funbox->function()->isInterpreted()) { - JS_ASSERT(fun == fn->pn_funbox->function()); + MOZ_ASSERT(fun == fn->pn_funbox->function()); Rooted script(cx, JSScript::Create(cx, js::NullPtr(), false, options, /* staticLevel = */ 0, sourceObject, @@ -651,7 +651,7 @@ CompileFunctionBody(JSContext *cx, MutableHandleFunction fun, const ReadOnlyComp return false; } else { fun.set(fn->pn_funbox->function()); - JS_ASSERT(IsAsmJSModuleNative(fun->native())); + MOZ_ASSERT(IsAsmJSModuleNative(fun->native())); } if (!sct.complete()) diff --git a/js/src/frontend/BytecodeEmitter.cpp b/js/src/frontend/BytecodeEmitter.cpp index 7c571324d128..b61caf2b128d 100644 --- a/js/src/frontend/BytecodeEmitter.cpp +++ b/js/src/frontend/BytecodeEmitter.cpp @@ -78,12 +78,12 @@ struct frontend::StmtInfoBCE : public StmtInfoBase */ ptrdiff_t &gosubs() { - JS_ASSERT(type == STMT_FINALLY); + MOZ_ASSERT(type == STMT_FINALLY); return breaks; } ptrdiff_t &guardJump() { - JS_ASSERT(type == STMT_TRY || type == STMT_FINALLY); + MOZ_ASSERT(type == STMT_TRY || type == STMT_FINALLY); return continues; } }; @@ -102,7 +102,7 @@ struct LoopStmtInfo : public StmtInfoBCE explicit LoopStmtInfo(ExclusiveContext *cx) : StmtInfoBCE(cx) {} static LoopStmtInfo* fromStmtInfo(StmtInfoBCE *stmt) { - JS_ASSERT(stmt->isLoop()); + MOZ_ASSERT(stmt->isLoop()); return static_cast(stmt); } }; @@ -191,7 +191,7 @@ UpdateDepth(ExclusiveContext *cx, BytecodeEmitter *bce, ptrdiff_t target) int ndefs = StackDefs(nullptr, pc); bce->stackDepth -= nuses; - JS_ASSERT(bce->stackDepth >= 0); + MOZ_ASSERT(bce->stackDepth >= 0); bce->stackDepth += ndefs; if ((uint32_t)bce->stackDepth > bce->maxStackDepth) bce->maxStackDepth = bce->stackDepth; @@ -229,8 +229,8 @@ frontend::Emit3(ExclusiveContext *cx, BytecodeEmitter *bce, JSOp op, jsbytecode jsbytecode op2) { /* These should filter through EmitVarOp. */ - JS_ASSERT(!IsArgOp(op)); - JS_ASSERT(!IsLocalOp(op)); + MOZ_ASSERT(!IsArgOp(op)); + MOZ_ASSERT(!IsLocalOp(op)); ptrdiff_t offset = EmitCheck(cx, bce, 3); if (offset < 0) @@ -301,7 +301,7 @@ EmitCall(ExclusiveContext *cx, BytecodeEmitter *bce, JSOp op, uint16_t argc, Par static bool EmitDupAt(ExclusiveContext *cx, BytecodeEmitter *bce, unsigned slot) { - JS_ASSERT(slot < unsigned(bce->stackDepth)); + MOZ_ASSERT(slot < unsigned(bce->stackDepth)); // The slot's position on the operand stack, measured from the top. unsigned slotFromTop = bce->stackDepth - 1 - slot; if (slotFromTop >= JS_BIT(24)) { @@ -369,7 +369,7 @@ EmitBackPatchOp(ExclusiveContext *cx, BytecodeEmitter *bce, ptrdiff_t *lastp) offset = bce->offset(); delta = offset - *lastp; *lastp = offset; - JS_ASSERT(delta > 0); + MOZ_ASSERT(delta > 0); return EmitJump(cx, bce, JSOP_BACKPATCH, delta); } @@ -473,7 +473,7 @@ EmitLoopEntry(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *nextpn) } LoopStmtInfo *loop = LoopStmtInfo::fromStmtInfo(bce->topStmt); - JS_ASSERT(loop->loopDepth > 0); + MOZ_ASSERT(loop->loopDepth > 0); uint8_t loopDepthAndFlags = PackLoopEntryDepthHintAndFlags(loop->loopDepth, loop->canIonOsr); return Emit2(cx, bce, JSOP_LOOPENTRY, loopDepthAndFlags) >= 0; @@ -509,7 +509,7 @@ CheckTypeSet(ExclusiveContext *cx, BytecodeEmitter *bce, JSOp op) static bool FlushPops(ExclusiveContext *cx, BytecodeEmitter *bce, int *npops) { - JS_ASSERT(*npops != 0); + MOZ_ASSERT(*npops != 0); EMIT_UINT16_IMM_OP(JSOP_POPN, *npops); *npops = 0; return true; @@ -544,7 +544,7 @@ class NonLocalExitScope { if (bce->staticScope) { StmtInfoBCE *stmt = bce->topStmt; while (1) { - JS_ASSERT(stmt); + MOZ_ASSERT(stmt); if (stmt->isNestedScope) { openScopeIndex = stmt->blockScopeIndex; break; @@ -594,7 +594,7 @@ NonLocalExitScope::prepareForNonLocalJump(StmtInfoBCE *toStmt) case STMT_WITH: if (Emit1(cx, bce, JSOP_LEAVEWITH) < 0) return false; - JS_ASSERT(stmt->isNestedScope); + MOZ_ASSERT(stmt->isNestedScope); if (!popScopeForNonLocalExit(stmt->blockScopeIndex)) return false; break; @@ -627,7 +627,7 @@ NonLocalExitScope::prepareForNonLocalJump(StmtInfoBCE *toStmt) } if (stmt->isBlockScope) { - JS_ASSERT(stmt->isNestedScope); + MOZ_ASSERT(stmt->isNestedScope); StaticBlockObject &blockObj = stmt->staticBlock(); if (Emit1(cx, bce, JSOP_DEBUGLEAVEBLOCK) < 0) return false; @@ -697,14 +697,14 @@ static void PushStatementBCE(BytecodeEmitter *bce, StmtInfoBCE *stmt, StmtType type, ptrdiff_t top) { PushStatementInner(bce, stmt, type, top); - JS_ASSERT(!stmt->isLoop()); + MOZ_ASSERT(!stmt->isLoop()); } static void PushLoopStatement(BytecodeEmitter *bce, LoopStmtInfo *stmt, StmtType type, ptrdiff_t top) { PushStatementInner(bce, stmt, type, top); - JS_ASSERT(stmt->isLoop()); + MOZ_ASSERT(stmt->isLoop()); LoopStmtInfo *downLoop = nullptr; for (StmtInfoBCE *outer = stmt->down; outer; outer = outer->down) { @@ -745,7 +745,7 @@ EnclosingStaticScope(BytecodeEmitter *bce) return bce->staticScope; if (!bce->sc->isFunctionBox()) { - JS_ASSERT(!bce->parent); + MOZ_ASSERT(!bce->parent); return nullptr; } @@ -769,7 +769,7 @@ ComputeAliasedSlots(ExclusiveContext *cx, BytecodeEmitter *bce, HandlenumVariables(); i++) { Definition *dn = blockObj->definitionParseNode(i); - JS_ASSERT(dn->isDefn()); + MOZ_ASSERT(dn->isDefn()); if (!dn->pn_cookie.set(bce->parser->tokenStream, dn->pn_cookie.level(), blockObj->blockIndexToLocalIndex(dn->frameSlot()))) { @@ -778,9 +778,9 @@ ComputeAliasedSlots(ExclusiveContext *cx, BytecodeEmitter *bce, Handledn_uses; pnu; pnu = pnu->pn_link) { - JS_ASSERT(pnu->pn_lexdef == dn); - JS_ASSERT(!(pnu->pn_dflags & PND_BOUND)); - JS_ASSERT(pnu->pn_cookie.isFree()); + MOZ_ASSERT(pnu->pn_lexdef == dn); + MOZ_ASSERT(!(pnu->pn_dflags & PND_BOUND)); + MOZ_ASSERT(pnu->pn_cookie.isFree()); } #endif @@ -816,8 +816,8 @@ ComputeLocalOffset(ExclusiveContext *cx, BytecodeEmitter *bce, HandlenumVariables() - <= nbodyfixed + bce->script->bindings.numBlockScoped()); + MOZ_ASSERT(localOffset + blockObj->numVariables() + <= nbodyfixed + bce->script->bindings.numBlockScoped()); blockObj->setLocalOffset(localOffset); } @@ -891,7 +891,7 @@ EnterNestedScope(ExclusiveContext *cx, BytecodeEmitter *bce, StmtInfoBCE *stmt, break; } case STMT_WITH: - JS_ASSERT(scopeObj->is()); + MOZ_ASSERT(scopeObj->is()); if (!EmitInternedObjectOp(cx, scopeObjectIndex, JSOP_ENTERWITH, bce)) return false; break; @@ -912,7 +912,7 @@ EnterNestedScope(ExclusiveContext *cx, BytecodeEmitter *bce, StmtInfoBCE *stmt, PushStatementBCE(bce, stmt, stmtType, bce->offset()); scopeObj->initEnclosingNestedScope(EnclosingStaticScope(bce)); FinishPushNestedScope(bce, stmt, *scopeObj); - JS_ASSERT(stmt->isNestedScope); + MOZ_ASSERT(stmt->isNestedScope); stmt->isBlockScope = (stmtType == STMT_BLOCK); return true; @@ -938,18 +938,18 @@ PopStatementBCE(ExclusiveContext *cx, BytecodeEmitter *bce) static bool LeaveNestedScope(ExclusiveContext *cx, BytecodeEmitter *bce, StmtInfoBCE *stmt) { - JS_ASSERT(stmt == bce->topStmt); - JS_ASSERT(stmt->isNestedScope); - JS_ASSERT(stmt->isBlockScope == !(stmt->type == STMT_WITH)); + MOZ_ASSERT(stmt == bce->topStmt); + MOZ_ASSERT(stmt->isNestedScope); + MOZ_ASSERT(stmt->isBlockScope == !(stmt->type == STMT_WITH)); uint32_t blockScopeIndex = stmt->blockScopeIndex; #ifdef DEBUG - JS_ASSERT(bce->blockScopeList.list[blockScopeIndex].length == 0); + MOZ_ASSERT(bce->blockScopeList.list[blockScopeIndex].length == 0); uint32_t blockObjIndex = bce->blockScopeList.list[blockScopeIndex].index; ObjectBox *blockObjBox = bce->objectList.find(blockObjIndex); NestedScopeObject *staticScope = &blockObjBox->object->as(); - JS_ASSERT(stmt->staticScope == staticScope); - JS_ASSERT(staticScope == bce->staticScope); + MOZ_ASSERT(stmt->staticScope == staticScope); + MOZ_ASSERT(staticScope == bce->staticScope); JS_ASSERT_IF(!stmt->isBlockScope, staticScope->is()); #endif @@ -973,7 +973,7 @@ static bool EmitIndex32(ExclusiveContext *cx, JSOp op, uint32_t index, BytecodeEmitter *bce) { const size_t len = 1 + UINT32_INDEX_LEN; - JS_ASSERT(len == size_t(js_CodeSpec[op].length)); + MOZ_ASSERT(len == size_t(js_CodeSpec[op].length)); ptrdiff_t offset = EmitCheck(cx, bce, len); if (offset < 0) return false; @@ -990,7 +990,7 @@ static bool EmitIndexOp(ExclusiveContext *cx, JSOp op, uint32_t index, BytecodeEmitter *bce) { const size_t len = js_CodeSpec[op].length; - JS_ASSERT(len >= 1 + UINT32_INDEX_LEN); + MOZ_ASSERT(len >= 1 + UINT32_INDEX_LEN); ptrdiff_t offset = EmitCheck(cx, bce, len); if (offset < 0) return false; @@ -1006,7 +1006,7 @@ EmitIndexOp(ExclusiveContext *cx, JSOp op, uint32_t index, BytecodeEmitter *bce) static bool EmitAtomOp(ExclusiveContext *cx, JSAtom *atom, JSOp op, BytecodeEmitter *bce) { - JS_ASSERT(JOF_OPTYPE(op) == JOF_ATOM); + MOZ_ASSERT(JOF_OPTYPE(op) == JOF_ATOM); if (op == JSOP_GETPROP && atom == cx->names().length) { /* Specialize length accesses for the interpreter. */ @@ -1023,15 +1023,15 @@ EmitAtomOp(ExclusiveContext *cx, JSAtom *atom, JSOp op, BytecodeEmitter *bce) static bool EmitAtomOp(ExclusiveContext *cx, ParseNode *pn, JSOp op, BytecodeEmitter *bce) { - JS_ASSERT(pn->pn_atom != nullptr); + MOZ_ASSERT(pn->pn_atom != nullptr); return EmitAtomOp(cx, pn->pn_atom, op, bce); } static bool EmitInternedObjectOp(ExclusiveContext *cx, uint32_t index, JSOp op, BytecodeEmitter *bce) { - JS_ASSERT(JOF_OPTYPE(op) == JOF_OBJECT); - JS_ASSERT(index < bce->objectList.length); + MOZ_ASSERT(JOF_OPTYPE(op) == JOF_OBJECT); + MOZ_ASSERT(index < bce->objectList.length); return EmitIndex32(cx, op, index, bce); } @@ -1066,8 +1066,8 @@ EmitRegExp(ExclusiveContext *cx, uint32_t index, BytecodeEmitter *bce) static bool EmitLocalOp(ExclusiveContext *cx, BytecodeEmitter *bce, JSOp op, uint32_t slot) { - JS_ASSERT(JOF_OPTYPE(op) != JOF_SCOPECOORD); - JS_ASSERT(IsLocalOp(op)); + MOZ_ASSERT(JOF_OPTYPE(op) != JOF_SCOPECOORD); + MOZ_ASSERT(IsLocalOp(op)); ptrdiff_t off = EmitN(cx, bce, op, LOCALNO_LEN); if (off < 0) @@ -1081,7 +1081,7 @@ static bool EmitUnaliasedVarOp(ExclusiveContext *cx, JSOp op, uint32_t slot, MaybeCheckLexical checkLexical, BytecodeEmitter *bce) { - JS_ASSERT(JOF_OPTYPE(op) != JOF_SCOPECOORD); + MOZ_ASSERT(JOF_OPTYPE(op) != JOF_SCOPECOORD); if (IsLocalOp(op)) { if (checkLexical) { @@ -1093,7 +1093,7 @@ EmitUnaliasedVarOp(ExclusiveContext *cx, JSOp op, uint32_t slot, MaybeCheckLexic return EmitLocalOp(cx, bce, op, slot); } - JS_ASSERT(IsArgOp(op)); + MOZ_ASSERT(IsArgOp(op)); ptrdiff_t off = EmitN(cx, bce, op, ARGNO_LEN); if (off < 0) return false; @@ -1105,10 +1105,10 @@ EmitUnaliasedVarOp(ExclusiveContext *cx, JSOp op, uint32_t slot, MaybeCheckLexic static bool EmitScopeCoordOp(ExclusiveContext *cx, BytecodeEmitter *bce, JSOp op, ScopeCoordinate sc) { - JS_ASSERT(JOF_OPTYPE(op) == JOF_SCOPECOORD); + MOZ_ASSERT(JOF_OPTYPE(op) == JOF_SCOPECOORD); unsigned n = SCOPECOORD_HOPS_LEN + SCOPECOORD_SLOT_LEN; - JS_ASSERT(int(n) + 1 /* op */ == js_CodeSpec[op].length); + MOZ_ASSERT(int(n) + 1 /* op */ == js_CodeSpec[op].length); ptrdiff_t off = EmitN(cx, bce, op, n); if (off < 0) @@ -1264,8 +1264,8 @@ EmitAliasedVarOp(ExclusiveContext *cx, JSOp op, ParseNode *pn, BytecodeEmitter * bceOfDef = bceOfDef->parent; } } else { - JS_ASSERT(pn->isDefn()); - JS_ASSERT(pn->pn_cookie.level() == bce->script->staticLevel()); + MOZ_ASSERT(pn->isDefn()); + MOZ_ASSERT(pn->pn_cookie.level() == bce->script->staticLevel()); } /* @@ -1281,7 +1281,7 @@ EmitAliasedVarOp(ExclusiveContext *cx, JSOp op, ParseNode *pn, BytecodeEmitter * return false; JS_ALWAYS_TRUE(LookupAliasedNameSlot(bceOfDef, bceOfDef->script, pn->name(), &sc)); } else { - JS_ASSERT(IsLocalOp(pn->getOp()) || pn->isKind(PNK_FUNCTION)); + MOZ_ASSERT(IsLocalOp(pn->getOp()) || pn->isKind(PNK_FUNCTION)); uint32_t local = pn->pn_cookie.slot(); if (local < bceOfDef->script->bindings.numBodyLevelLocals()) { if (!AssignHops(bce, pn, skippedScopes + DynamicNestedScopeDepth(bceOfDef), &sc)) @@ -1289,7 +1289,7 @@ EmitAliasedVarOp(ExclusiveContext *cx, JSOp op, ParseNode *pn, BytecodeEmitter * JS_ALWAYS_TRUE(LookupAliasedNameSlot(bceOfDef, bceOfDef->script, pn->name(), &sc)); } else { JS_ASSERT_IF(bce->sc->isFunctionBox(), local <= bceOfDef->script->bindings.numLocals()); - JS_ASSERT(bceOfDef->staticScope->is()); + MOZ_ASSERT(bceOfDef->staticScope->is()); Rooted b(cx, &bceOfDef->staticScope->as()); while (local < b->localOffset()) { if (b->needsClone()) @@ -1308,8 +1308,8 @@ EmitAliasedVarOp(ExclusiveContext *cx, JSOp op, ParseNode *pn, BytecodeEmitter * static bool EmitVarOp(ExclusiveContext *cx, ParseNode *pn, JSOp op, BytecodeEmitter *bce) { - JS_ASSERT(pn->isKind(PNK_FUNCTION) || pn->isKind(PNK_NAME)); - JS_ASSERT(!pn->pn_cookie.isFree()); + MOZ_ASSERT(pn->isKind(PNK_FUNCTION) || pn->isKind(PNK_NAME)); + MOZ_ASSERT(!pn->pn_cookie.isFree()); if (IsAliasedVarOp(op)) { ScopeCoordinate sc; @@ -1321,7 +1321,7 @@ EmitVarOp(ExclusiveContext *cx, ParseNode *pn, JSOp op, BytecodeEmitter *bce) JS_ASSERT_IF(pn->isKind(PNK_NAME), IsArgOp(op) || IsLocalOp(op)); if (!bce->isAliasedName(pn)) { - JS_ASSERT(pn->isUsed() || pn->isDefn()); + MOZ_ASSERT(pn->isUsed() || pn->isDefn()); JS_ASSERT_IF(pn->isUsed(), pn->pn_cookie.level() == 0); JS_ASSERT_IF(pn->isDefn(), pn->pn_cookie.level() == bce->script->staticLevel()); return EmitUnaliasedVarOp(cx, op, pn->pn_cookie.slot(), NodeNeedsCheckLexical(pn), bce); @@ -1340,8 +1340,8 @@ EmitVarOp(ExclusiveContext *cx, ParseNode *pn, JSOp op, BytecodeEmitter *bce) static JSOp GetIncDecInfo(ParseNodeKind kind, bool *post) { - JS_ASSERT(kind == PNK_POSTINCREMENT || kind == PNK_PREINCREMENT || - kind == PNK_POSTDECREMENT || kind == PNK_PREDECREMENT); + MOZ_ASSERT(kind == PNK_POSTINCREMENT || kind == PNK_PREINCREMENT || + kind == PNK_POSTDECREMENT || kind == PNK_PREDECREMENT); *post = kind == PNK_POSTINCREMENT || kind == PNK_POSTDECREMENT; return (kind == PNK_POSTINCREMENT || kind == PNK_PREINCREMENT) ? JSOP_ADD : JSOP_SUB; } @@ -1350,9 +1350,9 @@ static bool EmitVarIncDec(ExclusiveContext *cx, ParseNode *pn, BytecodeEmitter *bce) { JSOp op = pn->pn_kid->getOp(); - JS_ASSERT(IsArgOp(op) || IsLocalOp(op) || IsAliasedVarOp(op)); - JS_ASSERT(pn->pn_kid->isKind(PNK_NAME)); - JS_ASSERT(!pn->pn_kid->pn_cookie.isFree()); + MOZ_ASSERT(IsArgOp(op) || IsLocalOp(op) || IsAliasedVarOp(op)); + MOZ_ASSERT(pn->pn_kid->isKind(PNK_NAME)); + MOZ_ASSERT(!pn->pn_kid->pn_cookie.isFree()); bool post; JSOp binop = GetIncDecInfo(pn->getKind(), &post); @@ -1391,9 +1391,9 @@ bool BytecodeEmitter::isAliasedName(ParseNode *pn) { Definition *dn = pn->resolve(); - JS_ASSERT(dn->isDefn()); - JS_ASSERT(!dn->isPlaceholder()); - JS_ASSERT(dn->isBound()); + MOZ_ASSERT(dn->isDefn()); + MOZ_ASSERT(!dn->isPlaceholder()); + MOZ_ASSERT(dn->isBound()); /* If dn is in an enclosing function, it is definitely aliased. */ if (dn->pn_cookie.level() != script->staticLevel()) @@ -1591,7 +1591,7 @@ TryConvertFreeName(BytecodeEmitter *bce, ParseNode *pn) static bool BindNameToSlotHelper(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn) { - JS_ASSERT(pn->isKind(PNK_NAME)); + MOZ_ASSERT(pn->isKind(PNK_NAME)); JS_ASSERT_IF(pn->isKind(PNK_FUNCTION), pn->isBound()); @@ -1601,8 +1601,8 @@ BindNameToSlotHelper(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn) /* JSOP_CALLEE is pre-bound by definition. */ JSOp op = pn->getOp(); - JS_ASSERT(op != JSOP_CALLEE); - JS_ASSERT(JOF_OPTYPE(op) == JOF_ATOM); + MOZ_ASSERT(op != JSOP_CALLEE); + MOZ_ASSERT(JOF_OPTYPE(op) == JOF_ATOM); /* * The parser already linked name uses to definitions when (where not @@ -1610,9 +1610,9 @@ BindNameToSlotHelper(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn) */ Definition *dn; if (pn->isUsed()) { - JS_ASSERT(pn->pn_cookie.isFree()); + MOZ_ASSERT(pn->pn_cookie.isFree()); dn = pn->pn_lexdef; - JS_ASSERT(dn->isDefn()); + MOZ_ASSERT(dn->isDefn()); pn->pn_dflags |= (dn->pn_dflags & PND_CONST); } else if (pn->isDefn()) { dn = (Definition *) pn; @@ -1649,7 +1649,7 @@ BindNameToSlotHelper(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn) if (dn->pn_cookie.isFree()) { if (HandleScript caller = bce->evalCaller) { - JS_ASSERT(bce->script->compileAndGo()); + MOZ_ASSERT(bce->script->compileAndGo()); /* * Don't generate upvars on the left side of a for loop. See @@ -1696,10 +1696,10 @@ BindNameToSlotHelper(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn) * * x will get (level = 0, slot = 2) and y will get (level = 1, slot = 0). */ - JS_ASSERT(!pn->isDefn()); - JS_ASSERT(pn->isUsed()); - JS_ASSERT(pn->pn_lexdef); - JS_ASSERT(pn->pn_cookie.isFree()); + MOZ_ASSERT(!pn->isDefn()); + MOZ_ASSERT(pn->isUsed()); + MOZ_ASSERT(pn->pn_lexdef); + MOZ_ASSERT(pn->pn_cookie.isFree()); /* * We are compiling a function body and may be able to optimize name @@ -1713,7 +1713,7 @@ BindNameToSlotHelper(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn) case JSOP_SETNAME: op = JSOP_SETARG; break; default: MOZ_CRASH("arg"); } - JS_ASSERT(!pn->isConst()); + MOZ_ASSERT(!pn->isConst()); break; case Definition::VAR: @@ -1728,8 +1728,8 @@ BindNameToSlotHelper(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn) break; case Definition::NAMED_LAMBDA: { - JS_ASSERT(dn->isOp(JSOP_CALLEE)); - JS_ASSERT(op != JSOP_CALLEE); + MOZ_ASSERT(dn->isOp(JSOP_CALLEE)); + MOZ_ASSERT(op != JSOP_CALLEE); /* * Currently, the ALIASEDVAR ops do not support accessing the @@ -1739,8 +1739,8 @@ BindNameToSlotHelper(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn) return true; DebugOnly fun = bce->sc->asFunctionBox()->function(); - JS_ASSERT(fun->isLambda()); - JS_ASSERT(pn->pn_atom == fun->atom()); + MOZ_ASSERT(fun->isLambda()); + MOZ_ASSERT(pn->pn_atom == fun->atom()); /* * Leave pn->isOp(JSOP_NAME) if bce->fun is heavyweight to @@ -1808,7 +1808,7 @@ BindNameToSlotHelper(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn) return true; } - JS_ASSERT(!pn->isOp(op)); + MOZ_ASSERT(!pn->isOp(op)); pn->setOp(op); if (!pn->pn_cookie.set(bce->parser->tokenStream, skip, dn->pn_cookie.slot())) return false; @@ -2164,7 +2164,7 @@ EmitNewInit(ExclusiveContext *cx, BytecodeEmitter *bce, JSProtoKey key) static bool IteratorResultShape(ExclusiveContext *cx, BytecodeEmitter *bce, unsigned *shape) { - JS_ASSERT(bce->script->compileAndGo()); + MOZ_ASSERT(bce->script->compileAndGo()); RootedObject obj(cx); gc::AllocKind kind = GuessObjectGCKind(2); @@ -2237,7 +2237,7 @@ EmitNameOp(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn, bool callC return false; } else { if (!pn->pn_cookie.isFree()) { - JS_ASSERT(JOF_OPTYPE(op) != JOF_ATOM); + MOZ_ASSERT(JOF_OPTYPE(op) != JOF_ATOM); if (!EmitVarOp(cx, pn, op, bce)) return false; } else { @@ -2263,7 +2263,7 @@ EmitNameOp(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn, bool callC static bool EmitPropLHS(ExclusiveContext *cx, ParseNode *pn, JSOp op, BytecodeEmitter *bce) { - JS_ASSERT(pn->isKind(PNK_DOT)); + MOZ_ASSERT(pn->isKind(PNK_DOT)); ParseNode *pn2 = pn->maybeExpr(); /* @@ -2278,7 +2278,7 @@ EmitPropLHS(ExclusiveContext *cx, ParseNode *pn, JSOp op, BytecodeEmitter *bce) for (;;) { /* Reverse pndot->pn_expr to point up, not down. */ pndot->pn_offset = top; - JS_ASSERT(!pndot->isUsed()); + MOZ_ASSERT(!pndot->isUsed()); pndown = pndot->pn_expr; pndot->pn_expr = pnup; if (!pndown->isKind(PNK_DOT)) @@ -2311,7 +2311,7 @@ EmitPropLHS(ExclusiveContext *cx, ParseNode *pn, JSOp op, BytecodeEmitter *bce) static bool EmitPropOp(ExclusiveContext *cx, ParseNode *pn, JSOp op, BytecodeEmitter *bce) { - JS_ASSERT(pn->isArity(PN_NAME)); + MOZ_ASSERT(pn->isArity(PN_NAME)); if (!EmitPropLHS(cx, pn, op, bce)) return false; @@ -2331,7 +2331,7 @@ EmitPropOp(ExclusiveContext *cx, ParseNode *pn, JSOp op, BytecodeEmitter *bce) static bool EmitPropIncDec(ExclusiveContext *cx, ParseNode *pn, BytecodeEmitter *bce) { - JS_ASSERT(pn->pn_kid->getKind() == PNK_DOT); + MOZ_ASSERT(pn->pn_kid->getKind() == PNK_DOT); bool post; JSOp binop = GetIncDecInfo(pn->getKind(), &post); @@ -2412,7 +2412,7 @@ EmitNameIncDec(ExclusiveContext *cx, ParseNode *pn, BytecodeEmitter *bce) static bool EmitElemOperands(ExclusiveContext *cx, ParseNode *pn, JSOp op, BytecodeEmitter *bce) { - JS_ASSERT(pn->isArity(PN_BINARY)); + MOZ_ASSERT(pn->isArity(PN_BINARY)); if (!EmitTree(cx, bce, pn->pn_left)) return false; if (op == JSOP_CALLELEM && Emit1(cx, bce, JSOP_DUP) < 0) @@ -2447,7 +2447,7 @@ EmitElemOp(ExclusiveContext *cx, ParseNode *pn, JSOp op, BytecodeEmitter *bce) static bool EmitElemIncDec(ExclusiveContext *cx, ParseNode *pn, BytecodeEmitter *bce) { - JS_ASSERT(pn->pn_kid->getKind() == PNK_ELEM); + MOZ_ASSERT(pn->pn_kid->getKind() == PNK_ELEM); if (!EmitElemOperands(cx, pn->pn_kid, JSOP_GETELEM, bce)) return false; @@ -2616,7 +2616,7 @@ EmitSwitch(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn) defaultOffset = -1; pn2 = pn->pn_right; - JS_ASSERT(pn2->isKind(PNK_LEXICALSCOPE) || pn2->isKind(PNK_STATEMENTLIST)); + MOZ_ASSERT(pn2->isKind(PNK_LEXICALSCOPE) || pn2->isKind(PNK_STATEMENTLIST)); /* Push the discriminant. */ if (!EmitTree(cx, bce, pn->pn_left)) @@ -2632,7 +2632,7 @@ EmitSwitch(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn) /* Advance pn2 to refer to the switch case list. */ pn2 = pn2->expr(); } else { - JS_ASSERT(pn2->isKind(PNK_STATEMENTLIST)); + MOZ_ASSERT(pn2->isKind(PNK_STATEMENTLIST)); top = bce->offset(); PushStatementBCE(bce, &stmtInfo, STMT_SWITCH, top); } @@ -2670,11 +2670,11 @@ EmitSwitch(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn) continue; } - JS_ASSERT(pn3->isKind(PNK_CASE)); + MOZ_ASSERT(pn3->isKind(PNK_CASE)); if (switchOp == JSOP_CONDSWITCH) continue; - JS_ASSERT(switchOp == JSOP_TABLESWITCH); + MOZ_ASSERT(switchOp == JSOP_TABLESWITCH); pn4 = pn3->pn_left; @@ -2753,7 +2753,7 @@ EmitSwitch(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn) switchSize = 0; noteIndex = NewSrcNote3(cx, bce, SRC_CONDSWITCH, 0, 0); } else { - JS_ASSERT(switchOp == JSOP_TABLESWITCH); + MOZ_ASSERT(switchOp == JSOP_TABLESWITCH); /* 3 offsets (len, low, high) before the table, 1 per entry. */ switchSize = (size_t)(JUMP_OFFSET_LEN * (3 + tableLength)); @@ -2782,7 +2782,7 @@ EmitSwitch(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn) return false; } if (!pn4) { - JS_ASSERT(pn3->isKind(PNK_DEFAULT)); + MOZ_ASSERT(pn3->isKind(PNK_DEFAULT)); continue; } caseNoteIndex = NewSrcNote2(cx, bce, SRC_NEXTCASE, 0); @@ -2824,7 +2824,7 @@ EmitSwitch(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn) if (defaultOffset < 0) return false; } else { - JS_ASSERT(switchOp == JSOP_TABLESWITCH); + MOZ_ASSERT(switchOp == JSOP_TABLESWITCH); pc = bce->code(top + JUMP_OFFSET_LEN); /* Fill in switch bounds, which we know fit in 16-bit offsets. */ @@ -2845,16 +2845,16 @@ EmitSwitch(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn) if (pn3->isKind(PNK_DEFAULT)) continue; - JS_ASSERT(pn3->isKind(PNK_CASE)); + MOZ_ASSERT(pn3->isKind(PNK_CASE)); pn4 = pn3->pn_left; - JS_ASSERT(pn4->getKind() == PNK_NUMBER); + MOZ_ASSERT(pn4->getKind() == PNK_NUMBER); int32_t i = int32_t(pn4->pn_dval); - JS_ASSERT(double(i) == pn4->pn_dval); + MOZ_ASSERT(double(i) == pn4->pn_dval); i -= low; - JS_ASSERT(uint32_t(i) < tableLength); + MOZ_ASSERT(uint32_t(i) < tableLength); table[i] = pn3; } } @@ -2878,12 +2878,12 @@ EmitSwitch(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn) } /* We better have set "off" by now. */ - JS_ASSERT(off != -1); + MOZ_ASSERT(off != -1); /* Set the default offset (to end of switch if no default). */ if (switchOp == JSOP_CONDSWITCH) { pc = nullptr; - JS_ASSERT(defaultOffset != -1); + MOZ_ASSERT(defaultOffset != -1); SET_JUMP_OFFSET(bce->code(defaultOffset), off - (defaultOffset - top)); } else { pc = bce->code(top); @@ -2951,7 +2951,7 @@ frontend::EmitFunctionScript(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNo FunctionBox *funbox = bce->sc->asFunctionBox(); if (funbox->argumentsHasLocalBinding()) { - JS_ASSERT(bce->offset() == 0); /* See JSScript::argumentsBytecode. */ + MOZ_ASSERT(bce->offset() == 0); /* See JSScript::argumentsBytecode. */ bce->switchToProlog(); if (Emit1(cx, bce, JSOP_ARGUMENTS) < 0) return false; @@ -3026,12 +3026,12 @@ frontend::EmitFunctionScript(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNo */ if (runOnce) { bce->script->setTreatAsRunOnce(); - JS_ASSERT(!bce->script->hasRunOnce()); + MOZ_ASSERT(!bce->script->hasRunOnce()); } /* Initialize fun->script() so that the debugger has a valid fun->script(). */ RootedFunction fun(cx, bce->script->functionNonDelazifying()); - JS_ASSERT(fun->isInterpreted()); + MOZ_ASSERT(fun->isInterpreted()); if (fun->isInterpretedLazy()) fun->setUnlazifiedScript(bce->script); @@ -3101,7 +3101,7 @@ EmitDestructuringDeclsWithEmitter(ExclusiveContext *cx, BytecodeEmitter *bce, JS continue; ParseNode *target = element; if (element->isKind(PNK_SPREAD)) { - JS_ASSERT(element->pn_kid->isKind(PNK_NAME)); + MOZ_ASSERT(element->pn_kid->isKind(PNK_NAME)); target = element->pn_kid; } if (target->isKind(PNK_NAME)) { @@ -3137,11 +3137,11 @@ EmitDestructuringDeclsWithEmitter(ExclusiveContext *cx, BytecodeEmitter *bce, JS bool EmitDestructuringDecl(ExclusiveContext *cx, BytecodeEmitter *bce, JSOp prologOp, ParseNode *pn) { - JS_ASSERT(pn->isKind(PNK_NAME)); + MOZ_ASSERT(pn->isKind(PNK_NAME)); if (!BindNameToSlot(cx, bce, pn)) return false; - JS_ASSERT(!pn->isOp(JSOP_CALLEE)); + MOZ_ASSERT(!pn->isOp(JSOP_CALLEE)); return MaybeEmitVarDecl(cx, bce, prologOp, pn, nullptr); } @@ -3190,7 +3190,7 @@ EmitDestructuringOpsHelper(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode static bool EmitDestructuringLHS(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn, VarEmitOption emitOption) { - JS_ASSERT(emitOption != DefineVars); + MOZ_ASSERT(emitOption != DefineVars); // Now emit the lvalue opcode sequence. If the lvalue is a nested // destructuring initialiser-form, call ourselves to handle it, then pop @@ -3210,8 +3210,8 @@ EmitDestructuringLHS(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn, } else if (emitOption == PushInitialValues) { // The lhs is a simple name so the to-be-destructured value is // its initial value and there is nothing to do. - JS_ASSERT(pn->getOp() == JSOP_SETLOCAL || pn->getOp() == JSOP_INITLEXICAL); - JS_ASSERT(pn->pn_dflags & PND_BOUND); + MOZ_ASSERT(pn->getOp() == JSOP_SETLOCAL || pn->getOp() == JSOP_INITLEXICAL); + MOZ_ASSERT(pn->pn_dflags & PND_BOUND); } else { switch (pn->getKind()) { case PNK_NAME: @@ -3291,7 +3291,7 @@ EmitDestructuringLHS(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn, break; case PNK_CALL: - JS_ASSERT(pn->pn_xflags & PNX_SETCALL); + MOZ_ASSERT(pn->pn_xflags & PNX_SETCALL); if (!EmitTree(cx, bce, pn)) return false; @@ -3445,7 +3445,7 @@ EmitDestructuringOpsArrayHelper(ExclusiveContext *cx, BytecodeEmitter *bce, Pars * before destructuring z. This gives the loop invariant that * the to-be-destructured-value is always on top of the stack. */ - JS_ASSERT((bce->stackDepth - bce->stackDepth) >= -1); + MOZ_ASSERT((bce->stackDepth - bce->stackDepth) >= -1); uint32_t pickDistance = (uint32_t)((bce->stackDepth + 1) - depthBefore); if (pickDistance > 0) { if (pickDistance > UINT8_MAX) { @@ -3512,7 +3512,7 @@ EmitDestructuringOpsObjectHelper(ExclusiveContext *cx, BytecodeEmitter *bce, Par needsGetElem = false; } } else { - JS_ASSERT(key->isKind(PNK_COMPUTED_NAME)); + MOZ_ASSERT(key->isKind(PNK_COMPUTED_NAME)); if (!EmitTree(cx, bce, key->pn_kid)) // ... OBJ OBJ KEY return false; } @@ -3561,7 +3561,7 @@ EmitDestructuringOpsObjectHelper(ExclusiveContext *cx, BytecodeEmitter *bce, Par // // so that we can continue, ready to destruct z from OBJ. Pick OBJ out // of the stack, moving it to the top, to accomplish this. - JS_ASSERT((bce->stackDepth - bce->stackDepth) >= -1); + MOZ_ASSERT((bce->stackDepth - bce->stackDepth) >= -1); uint32_t pickDistance = (uint32_t)((bce->stackDepth + 1) - depthBefore); if (pickDistance > 0) { if (pickDistance > UINT8_MAX) { @@ -3623,7 +3623,7 @@ EmitDestructuringOps(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *patt static bool EmitTemplateString(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn) { - JS_ASSERT(pn->isArity(PN_LIST)); + MOZ_ASSERT(pn->isArity(PN_LIST)); for (ParseNode *pn2 = pn->pn_head; pn2 != NULL; pn2 = pn2->pn_next) { if (pn2->getKind() != PNK_STRING && pn2->getKind() != PNK_TEMPLATE_STRING) { @@ -3654,8 +3654,8 @@ static bool EmitVariables(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn, VarEmitOption emitOption, bool isLetExpr = false) { - JS_ASSERT(pn->isArity(PN_LIST)); - JS_ASSERT(isLetExpr == (emitOption == PushInitialValues)); + MOZ_ASSERT(pn->isArity(PN_LIST)); + MOZ_ASSERT(isLetExpr == (emitOption == PushInitialValues)); ParseNode *next; for (ParseNode *pn2 = pn->pn_head; ; pn2 = next) { @@ -3681,7 +3681,7 @@ EmitVariables(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn, VarEmit // Otherwise this is emitting destructuring let binding // initialization for a legacy comprehension expression. See // EmitForInOrOfVariables. - JS_ASSERT(pn->pn_count == 1); + MOZ_ASSERT(pn->pn_count == 1); if (emitOption == DefineVars) { if (!EmitDestructuringDecls(cx, bce, pn->getOp(), pn2)) return false; @@ -3704,9 +3704,9 @@ EmitVariables(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn, VarEmit * (var x = i in o)...', this will cause the entire 'var [a, b] = * i' to be hoisted out of the loop. */ - JS_ASSERT(pn2->isKind(PNK_ASSIGN)); - JS_ASSERT(pn2->isOp(JSOP_NOP)); - JS_ASSERT(emitOption != DefineVars); + MOZ_ASSERT(pn2->isKind(PNK_ASSIGN)); + MOZ_ASSERT(pn2->isOp(JSOP_NOP)); + MOZ_ASSERT(emitOption != DefineVars); /* * To allow the front end to rewrite var f = x; as f = x; when a @@ -3753,17 +3753,17 @@ EmitVariables(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn, VarEmit JSOp op; op = pn2->getOp(); - JS_ASSERT(op != JSOP_CALLEE); - JS_ASSERT(!pn2->pn_cookie.isFree() || !pn->isOp(JSOP_NOP)); + MOZ_ASSERT(op != JSOP_CALLEE); + MOZ_ASSERT(!pn2->pn_cookie.isFree() || !pn->isOp(JSOP_NOP)); jsatomid atomIndex; if (!MaybeEmitVarDecl(cx, bce, pn->getOp(), pn2, &atomIndex)) return false; if (pn3) { - JS_ASSERT(emitOption != DefineVars); + MOZ_ASSERT(emitOption != DefineVars); if (op == JSOP_SETNAME || op == JSOP_SETGNAME || op == JSOP_SETINTRINSIC) { - JS_ASSERT(emitOption != PushInitialValues); + MOZ_ASSERT(emitOption != PushInitialValues); JSOp bindOp; if (op == JSOP_SETNAME) bindOp = JSOP_BINDNAME; @@ -3861,7 +3861,7 @@ EmitAssignment(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *lhs, JSOp return false; break; case PNK_ELEM: - JS_ASSERT(lhs->isArity(PN_BINARY)); + MOZ_ASSERT(lhs->isArity(PN_BINARY)); if (!EmitTree(cx, bce, lhs->pn_left)) return false; if (!EmitTree(cx, bce, lhs->pn_right)) @@ -3872,18 +3872,18 @@ EmitAssignment(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *lhs, JSOp case PNK_OBJECT: break; case PNK_CALL: - JS_ASSERT(lhs->pn_xflags & PNX_SETCALL); + MOZ_ASSERT(lhs->pn_xflags & PNX_SETCALL); if (!EmitTree(cx, bce, lhs)) return false; if (Emit1(cx, bce, JSOP_POP) < 0) return false; break; default: - JS_ASSERT(0); + MOZ_ASSERT(0); } if (op != JSOP_NOP) { - JS_ASSERT(rhs); + MOZ_ASSERT(rhs); switch (lhs->getKind()) { case PNK_NAME: if (lhs->isConst()) { @@ -3894,7 +3894,7 @@ EmitAssignment(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *lhs, JSOp if (!EmitIndex32(cx, lhs->getOp(), atomIndex, bce)) return false; } else { - JS_ASSERT(JOF_OPTYPE(lhs->getOp()) != JOF_ATOM); + MOZ_ASSERT(JOF_OPTYPE(lhs->getOp()) != JOF_ATOM); if (!EmitVarOp(cx, lhs, lhs->getOp(), bce)) return false; } @@ -3904,11 +3904,11 @@ EmitAssignment(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *lhs, JSOp if (!EmitIndex32(cx, JSOP_GETXPROP, atomIndex, bce)) return false; } else if (lhs->isOp(JSOP_SETGNAME)) { - JS_ASSERT(lhs->pn_cookie.isFree()); + MOZ_ASSERT(lhs->pn_cookie.isFree()); if (!EmitAtomOp(cx, lhs, JSOP_GETGNAME, bce)) return false; } else if (lhs->isOp(JSOP_SETINTRINSIC)) { - JS_ASSERT(lhs->pn_cookie.isFree()); + MOZ_ASSERT(lhs->pn_cookie.isFree()); if (!EmitAtomOp(cx, lhs, JSOP_GETINTRINSIC, bce)) return false; } else { @@ -3943,7 +3943,7 @@ EmitAssignment(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *lhs, JSOp * popped the call's return value. Push a random value to make sure * the stack depth is correct. */ - JS_ASSERT(lhs->pn_xflags & PNX_SETCALL); + MOZ_ASSERT(lhs->pn_xflags & PNX_SETCALL); if (Emit1(cx, bce, JSOP_NULL) < 0) return false; break; @@ -4006,7 +4006,7 @@ EmitAssignment(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *lhs, JSOp break; case PNK_CALL: /* Do nothing. The JSOP_SETCALL we emitted will always throw. */ - JS_ASSERT(lhs->pn_xflags & PNX_SETCALL); + MOZ_ASSERT(lhs->pn_xflags & PNX_SETCALL); break; case PNK_ELEM: if (Emit1(cx, bce, JSOP_SETELEM) < 0) @@ -4018,7 +4018,7 @@ EmitAssignment(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *lhs, JSOp return false; break; default: - JS_ASSERT(0); + MOZ_ASSERT(0); } return true; } @@ -4060,7 +4060,7 @@ ParseNode::getConstantValue(ExclusiveContext *cx, AllowConstantObjects allowObje count = pn_count - 1; pn = pn_head->pn_next; } else { - JS_ASSERT(isOp(JSOP_NEWINIT) && !(pn_xflags & PNX_NONCONST)); + MOZ_ASSERT(isOp(JSOP_NEWINIT) && !(pn_xflags & PNX_NONCONST)); count = pn_count; pn = pn_head; } @@ -4078,15 +4078,15 @@ ParseNode::getConstantValue(ExclusiveContext *cx, AllowConstantObjects allowObje if (!JSObject::defineGeneric(cx, obj, id, value, nullptr, nullptr, JSPROP_ENUMERATE)) return false; } - JS_ASSERT(idx == count); + MOZ_ASSERT(idx == count); types::FixArrayType(cx, obj); vp.setObject(*obj); return true; } case PNK_OBJECT: { - JS_ASSERT(isOp(JSOP_NEWINIT)); - JS_ASSERT(!(pn_xflags & PNX_NONCONST)); + MOZ_ASSERT(isOp(JSOP_NEWINIT)); + MOZ_ASSERT(!(pn_xflags & PNX_NONCONST)); if (allowObjects == DontAllowObjects) return false; @@ -4107,8 +4107,8 @@ ParseNode::getConstantValue(ExclusiveContext *cx, AllowConstantObjects allowObje if (pnid->isKind(PNK_NUMBER)) { idvalue = NumberValue(pnid->pn_dval); } else { - JS_ASSERT(pnid->isKind(PNK_NAME) || pnid->isKind(PNK_STRING)); - JS_ASSERT(pnid->pn_atom != cx->names().proto); + MOZ_ASSERT(pnid->isKind(PNK_NAME) || pnid->isKind(PNK_STRING)); + MOZ_ASSERT(pnid->pn_atom != cx->names().proto); idvalue = StringValue(pnid->pn_atom); } @@ -4175,7 +4175,7 @@ EmitCallSiteObject(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn) if (!pn->getConstantValue(cx, ParseNode::AllowObjects, &value)) return false; - JS_ASSERT(value.isObject()); + MOZ_ASSERT(value.isObject()); ObjectBox *objbox1 = bce->parser->newObjectBox(&value.toObject()); if (!objbox1) @@ -4184,7 +4184,7 @@ EmitCallSiteObject(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn) if (!pn->as().getRawArrayValue(cx, &value)) return false; - JS_ASSERT(value.isObject()); + MOZ_ASSERT(value.isObject()); ObjectBox *objbox2 = bce->parser->newObjectBox(&value.toObject()); if (!objbox2) @@ -4217,12 +4217,12 @@ EmitCatch(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn) * and save the block object atom. */ StmtInfoBCE *stmt = bce->topStmt; - JS_ASSERT(stmt->type == STMT_BLOCK && stmt->isBlockScope); + MOZ_ASSERT(stmt->type == STMT_BLOCK && stmt->isBlockScope); stmt->type = STMT_CATCH; /* Go up one statement info record to the TRY or FINALLY record. */ stmt = stmt->down; - JS_ASSERT(stmt->type == STMT_TRY || stmt->type == STMT_FINALLY); + MOZ_ASSERT(stmt->type == STMT_TRY || stmt->type == STMT_FINALLY); /* Pick up the pending exception and bind it to the catch variable. */ if (Emit1(cx, bce, JSOP_EXCEPTION) < 0) @@ -4247,7 +4247,7 @@ EmitCatch(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn) case PNK_NAME: /* Inline and specialize BindNameToSlot for pn2. */ - JS_ASSERT(!pn2->pn_cookie.isFree()); + MOZ_ASSERT(!pn2->pn_cookie.isFree()); if (!EmitVarOp(cx, pn2, JSOP_INITLEXICAL, bce)) return false; if (Emit1(cx, bce, JSOP_POP) < 0) @@ -4255,7 +4255,7 @@ EmitCatch(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn) break; default: - JS_ASSERT(0); + MOZ_ASSERT(0); } // If there is a guard expression, emit it and arrange to jump to the next @@ -4337,7 +4337,7 @@ EmitTry(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn) ptrdiff_t tryStart = bce->offset(); if (!EmitTree(cx, bce, pn->pn_kid1)) return false; - JS_ASSERT(depth == bce->stackDepth); + MOZ_ASSERT(depth == bce->stackDepth); // GOSUB to finally, if present. if (pn->pn_kid3) { @@ -4384,10 +4384,10 @@ EmitTry(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn) // capturing exceptions thrown from catch{} blocks. // for (ParseNode *pn3 = pn2->pn_head; pn3; pn3 = pn3->pn_next) { - JS_ASSERT(bce->stackDepth == depth); + MOZ_ASSERT(bce->stackDepth == depth); // Emit the lexical scope and catch body. - JS_ASSERT(pn3->isKind(PNK_LEXICALSCOPE)); + MOZ_ASSERT(pn3->isKind(PNK_LEXICALSCOPE)); if (!EmitTree(cx, bce, pn3)) return false; @@ -4395,7 +4395,7 @@ EmitTry(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn) if (pn->pn_kid3) { if (EmitBackPatchOp(cx, bce, &stmtInfo.gosubs()) < 0) return false; - JS_ASSERT(bce->stackDepth == depth); + MOZ_ASSERT(bce->stackDepth == depth); } // Jump over the remaining catch blocks. This will get fixed @@ -4421,7 +4421,7 @@ EmitTry(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn) } } - JS_ASSERT(bce->stackDepth == depth); + MOZ_ASSERT(bce->stackDepth == depth); // Emit the finally handler, if there is one. ptrdiff_t finallyStart = 0; @@ -4443,7 +4443,7 @@ EmitTry(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn) { return false; } - JS_ASSERT(bce->stackDepth == depth); + MOZ_ASSERT(bce->stackDepth == depth); } if (!PopStatementBCE(cx, bce)) return false; @@ -4494,7 +4494,7 @@ EmitIf(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn) * chains, so we must mutate stmtInfo back into a STMT_IF record. * Also we need a note offset for SRC_IF_ELSE to help IonMonkey. */ - JS_ASSERT(stmtInfo.type == STMT_ELSE); + MOZ_ASSERT(stmtInfo.type == STMT_ELSE); stmtInfo.type = STMT_IF; stmtInfo.update = top; if (!SetSrcNoteOffset(cx, bce, noteIndex, 0, jmp - beq)) @@ -4590,11 +4590,11 @@ EmitIf(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn) MOZ_NEVER_INLINE static bool EmitLet(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pnLet) { - JS_ASSERT(pnLet->isArity(PN_BINARY)); + MOZ_ASSERT(pnLet->isArity(PN_BINARY)); ParseNode *varList = pnLet->pn_left; - JS_ASSERT(varList->isArity(PN_LIST)); + MOZ_ASSERT(varList->isArity(PN_LIST)); ParseNode *letBody = pnLet->pn_right; - JS_ASSERT(letBody->isLet() && letBody->isKind(PNK_LEXICALSCOPE)); + MOZ_ASSERT(letBody->isLet() && letBody->isKind(PNK_LEXICALSCOPE)); int letHeadDepth = bce->stackDepth; @@ -4623,7 +4623,7 @@ EmitLet(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pnLet) MOZ_NEVER_INLINE static bool EmitLexicalScope(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn) { - JS_ASSERT(pn->isKind(PNK_LEXICALSCOPE)); + MOZ_ASSERT(pn->isKind(PNK_LEXICALSCOPE)); StmtInfoBCE stmtInfo(cx); if (!EnterBlockScope(cx, bce, &stmtInfo, pn->pn_objbox, JSOP_UNINITIALIZED, 0)) @@ -4718,7 +4718,7 @@ EmitForInOrOfVariables(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn static bool EmitForOf(ExclusiveContext *cx, BytecodeEmitter *bce, StmtType type, ParseNode *pn, ptrdiff_t top) { - JS_ASSERT(type == STMT_FOR_OF_LOOP || type == STMT_SPREAD); + MOZ_ASSERT(type == STMT_FOR_OF_LOOP || type == STMT_SPREAD); JS_ASSERT_IF(type == STMT_FOR_OF_LOOP, pn && pn->pn_left->isKind(PNK_FOROF)); JS_ASSERT_IF(type == STMT_SPREAD, !pn); @@ -4793,7 +4793,7 @@ EmitForOf(ExclusiveContext *cx, BytecodeEmitter *bce, StmtType type, ParseNode * return false; // The stack should be balanced around the assignment opcode sequence. - JS_ASSERT(bce->stackDepth == loopDepth); + MOZ_ASSERT(bce->stackDepth == loopDepth); // Emit code for the loop body. if (!EmitTree(cx, bce, forBody)) @@ -4808,7 +4808,7 @@ EmitForOf(ExclusiveContext *cx, BytecodeEmitter *bce, StmtType type, ParseNode * if (Emit1(cx, bce, JSOP_INITELEM_INC) < 0) // ITER ARR (I+1) return false; - JS_ASSERT(bce->stackDepth == loopDepth - 1); + MOZ_ASSERT(bce->stackDepth == loopDepth - 1); // STMT_SPREAD never contain continue, so do not set "update" offset. } @@ -4838,7 +4838,7 @@ EmitForOf(ExclusiveContext *cx, BytecodeEmitter *bce, StmtType type, ParseNode * if (beq < 0) return false; - JS_ASSERT(bce->stackDepth == loopDepth); + MOZ_ASSERT(bce->stackDepth == loopDepth); // Let Ion know where the closing jump of this loop is. if (!SetSrcNoteOffset(cx, bce, (unsigned)noteIndex, 0, beq - jmp)) @@ -4885,7 +4885,7 @@ EmitForIn(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn, ptrdiff_t t * object depending on the loop variant (for-in, for-each-in, or * destructuring for-in). */ - JS_ASSERT(pn->isOp(JSOP_ITER)); + MOZ_ASSERT(pn->isOp(JSOP_ITER)); if (Emit2(cx, bce, JSOP_ITER, (uint8_t) pn->pn_iflags) < 0) return false; @@ -4934,7 +4934,7 @@ EmitForIn(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn, ptrdiff_t t return false; /* The stack should be balanced around the assignment opcode sequence. */ - JS_ASSERT(bce->stackDepth == loopDepth); + MOZ_ASSERT(bce->stackDepth == loopDepth); /* Emit code for the loop body. */ if (!EmitTree(cx, bce, forBody)) @@ -5046,7 +5046,7 @@ EmitNormalFor(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn, ptrdiff return false; /* Set the second note offset so we can find the update part. */ - JS_ASSERT(noteIndex != -1); + MOZ_ASSERT(noteIndex != -1); ptrdiff_t tmp2 = bce->offset(); /* Set loop and enclosing "update" offsets, for continue. */ @@ -5082,7 +5082,7 @@ EmitNormalFor(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn, ptrdiff if (forHead->pn_kid2) { /* Fix up the goto from top to target the loop condition. */ - JS_ASSERT(jmp >= 0); + MOZ_ASSERT(jmp >= 0); SetJumpOffsetAt(bce, jmp); if (!EmitLoopEntry(cx, bce, forHead->pn_kid2)) return false; @@ -5121,7 +5121,7 @@ EmitFor(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn, ptrdiff_t top if (pn->pn_left->isKind(PNK_FOROF)) return EmitForOf(cx, bce, STMT_FOR_OF_LOOP, pn, top); - JS_ASSERT(pn->pn_left->isKind(PNK_FORHEAD)); + MOZ_ASSERT(pn->pn_left->isKind(PNK_FORHEAD)); return EmitNormalFor(cx, bce, pn, top); } @@ -5139,8 +5139,8 @@ EmitFunc(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn) */ if (pn->pn_dflags & PND_EMITTEDFUNCTION) { JS_ASSERT_IF(fun->hasScript(), fun->nonLazyScript()); - JS_ASSERT(pn->functionIsHoisted()); - JS_ASSERT(bce->sc->isFunctionBox()); + MOZ_ASSERT(pn->functionIsHoisted()); + MOZ_ASSERT(bce->sc->isFunctionBox()); return true; } @@ -5214,7 +5214,7 @@ EmitFunc(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn) script->setUsesArgumentsAndApply(); } } else { - JS_ASSERT(IsAsmJSModuleNative(fun->native())); + MOZ_ASSERT(IsAsmJSModuleNative(fun->native())); } /* Make the function object a literal in the outer script's pool. */ @@ -5239,9 +5239,9 @@ EmitFunc(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn) * definitions can be scheduled before generating the rest of code. */ if (!bce->sc->isFunctionBox()) { - JS_ASSERT(pn->pn_cookie.isFree()); - JS_ASSERT(pn->getOp() == JSOP_NOP); - JS_ASSERT(!bce->topStmt); + MOZ_ASSERT(pn->pn_cookie.isFree()); + MOZ_ASSERT(pn->getOp() == JSOP_NOP); + MOZ_ASSERT(!bce->topStmt); bce->switchToProlog(); if (!EmitIndex32(cx, JSOP_DEFFUN, index, bce)) return false; @@ -5253,14 +5253,14 @@ EmitFunc(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn) BindingIter bi(bce->script); while (bi->name() != fun->atom()) bi++; - JS_ASSERT(bi->kind() == Binding::VARIABLE || bi->kind() == Binding::CONSTANT || - bi->kind() == Binding::ARGUMENT); - JS_ASSERT(bi.frameIndex() < JS_BIT(20)); + MOZ_ASSERT(bi->kind() == Binding::VARIABLE || bi->kind() == Binding::CONSTANT || + bi->kind() == Binding::ARGUMENT); + MOZ_ASSERT(bi.frameIndex() < JS_BIT(20)); #endif pn->pn_index = index; if (!EmitIndexOp(cx, JSOP_LAMBDA, index, bce)) return false; - JS_ASSERT(pn->getOp() == JSOP_GETLOCAL || pn->getOp() == JSOP_GETARG); + MOZ_ASSERT(pn->getOp() == JSOP_GETLOCAL || pn->getOp() == JSOP_GETARG); JSOp setOp = pn->getOp() == JSOP_GETLOCAL ? JSOP_SETLOCAL : JSOP_SETARG; if (!EmitVarOp(cx, pn, setOp, bce)) return false; @@ -5481,8 +5481,8 @@ EmitReturn(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn) static bool EmitYieldStar(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *iter) { - JS_ASSERT(bce->sc->isFunctionBox()); - JS_ASSERT(bce->sc->asFunctionBox()->isStarGenerator()); + MOZ_ASSERT(bce->sc->isFunctionBox()); + MOZ_ASSERT(bce->sc->asFunctionBox()->isStarGenerator()); if (!EmitTree(cx, bce, iter)) // ITERABLE return false; @@ -5499,7 +5499,7 @@ EmitYieldStar(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *iter) CheckTypeSet(cx, bce, JSOP_CALL); int depth = bce->stackDepth; - JS_ASSERT(depth >= 1); + MOZ_ASSERT(depth >= 1); // Initial send value is undefined. if (Emit1(cx, bce, JSOP_UNDEFINED) < 0) // ITER RECEIVED @@ -5515,7 +5515,7 @@ EmitYieldStar(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *iter) if (noteIndex < 0 || Emit1(cx, bce, JSOP_TRY) < 0) return false; ptrdiff_t tryStart = bce->offset(); // tryStart: - JS_ASSERT(bce->stackDepth == depth + 1); + MOZ_ASSERT(bce->stackDepth == depth + 1); // Yield RESULT as-is, without re-boxing. if (Emit1(cx, bce, JSOP_YIELD) < 0) // ITER RECEIVED @@ -5569,7 +5569,7 @@ EmitYieldStar(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *iter) if (EmitCall(cx, bce, JSOP_CALL, 1, iter) < 0) // ITER RESULT return false; CheckTypeSet(cx, bce, JSOP_CALL); - JS_ASSERT(bce->stackDepth == depth + 1); + MOZ_ASSERT(bce->stackDepth == depth + 1); ptrdiff_t checkResult = -1; if (EmitBackPatchOp(cx, bce, &checkResult) < 0) // goto checkResult return false; @@ -5606,7 +5606,7 @@ EmitYieldStar(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *iter) if (EmitCall(cx, bce, JSOP_CALL, 1, iter) < 0) // ITER RESULT return false; CheckTypeSet(cx, bce, JSOP_CALL); - JS_ASSERT(bce->stackDepth == depth + 1); + MOZ_ASSERT(bce->stackDepth == depth + 1); if (!BackPatch(cx, bce, checkResult, bce->code().end(), JSOP_GOTO)) // checkResult: return false; @@ -5627,7 +5627,7 @@ EmitYieldStar(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *iter) if (!EmitAtomOp(cx, cx->names().value, JSOP_GETPROP, bce)) // VALUE return false; - JS_ASSERT(bce->stackDepth == depth); + MOZ_ASSERT(bce->stackDepth == depth); return true; } @@ -5635,7 +5635,7 @@ EmitYieldStar(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *iter) static bool EmitStatementList(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn, ptrdiff_t top) { - JS_ASSERT(pn->isArity(PN_LIST)); + MOZ_ASSERT(pn->isArity(PN_LIST)); StmtInfoBCE stmtInfo(cx); PushStatementBCE(bce, &stmtInfo, STMT_BLOCK, top); @@ -5656,7 +5656,7 @@ EmitStatementList(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn, ptr static bool EmitStatement(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn) { - JS_ASSERT(pn->isKind(PNK_SEMI)); + MOZ_ASSERT(pn->isKind(PNK_SEMI)); ParseNode *pn2 = pn->pn_kid; if (!pn2) @@ -5677,7 +5677,7 @@ EmitStatement(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn) bool wantval = false; bool useful = false; if (bce->sc->isFunctionBox()) { - JS_ASSERT(!bce->script->noScriptRval()); + MOZ_ASSERT(!bce->script->noScriptRval()); } else { useful = wantval = !bce->script->noScriptRval(); } @@ -5896,7 +5896,7 @@ EmitCallOrNew(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn) * accessed via foo.caller indirection), as multiple executions * will just cause the inner scripts to be repeatedly cloned. */ - JS_ASSERT(!bce->emittingRunOnceLambda); + MOZ_ASSERT(!bce->emittingRunOnceLambda); if (bce->checkSingletonContext() || (!bce->isInLoop() && bce->isRunOnceLambda())) { bce->emittingRunOnceLambda = true; if (!EmitTree(cx, bce, pn2)) @@ -5989,8 +5989,8 @@ EmitLogical(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn) return true; } - JS_ASSERT(pn->isArity(PN_LIST)); - JS_ASSERT(pn->pn_head->pn_next->pn_next); + MOZ_ASSERT(pn->isArity(PN_LIST)); + MOZ_ASSERT(pn->pn_head->pn_next->pn_next); /* Left-associative operator chain: avoid too much recursion. */ ParseNode *pn2 = pn->pn_head; @@ -6050,12 +6050,12 @@ EmitIncOrDec(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn) return false; break; case PNK_CALL: - JS_ASSERT(pn2->pn_xflags & PNX_SETCALL); + MOZ_ASSERT(pn2->pn_xflags & PNX_SETCALL); if (!EmitTree(cx, bce, pn2)) return false; break; default: - JS_ASSERT(pn2->isKind(PNK_NAME)); + MOZ_ASSERT(pn2->isKind(PNK_NAME)); pn2->setOp(JSOP_SETNAME); if (!BindNameToSlot(cx, bce, pn2)) return false; @@ -6084,7 +6084,7 @@ EmitIncOrDec(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn) return false; } } else { - JS_ASSERT(JOF_OPTYPE(op) == JOF_ATOM); + MOZ_ASSERT(JOF_OPTYPE(op) == JOF_ATOM); if (maySet) { if (!EmitNameIncDec(cx, pn, bce)) return false; @@ -6146,7 +6146,7 @@ EmitLabeledStatement(ExclusiveContext *cx, BytecodeEmitter *bce, const LabeledSt static bool EmitSyntheticStatements(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn, ptrdiff_t top) { - JS_ASSERT(pn->isArity(PN_LIST)); + MOZ_ASSERT(pn->isArity(PN_LIST)); StmtInfoBCE stmtInfo(cx); PushStatementBCE(bce, &stmtInfo, STMT_SEQ, top); ParseNode *pn2 = pn->pn_head; @@ -6188,7 +6188,7 @@ EmitConditionalExpression(ExclusiveContext *cx, BytecodeEmitter *bce, Conditiona * code generation, which must use the stack depth to compute local * stack indexes correctly. */ - JS_ASSERT(bce->stackDepth > 0); + MOZ_ASSERT(bce->stackDepth > 0); bce->stackDepth--; if (!EmitTree(cx, bce, &conditional.elseExpression())) return false; @@ -6260,7 +6260,7 @@ EmitObject(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn) isIndex = true; } } else { - JS_ASSERT(key->isKind(PNK_COMPUTED_NAME)); + MOZ_ASSERT(key->isKind(PNK_COMPUTED_NAME)); if (!EmitTree(cx, bce, key->pn_kid)) return false; isIndex = true; @@ -6289,14 +6289,14 @@ EmitObject(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn) if (Emit1(cx, bce, op) < 0) return false; } else { - JS_ASSERT(key->isKind(PNK_NAME) || key->isKind(PNK_STRING)); + MOZ_ASSERT(key->isKind(PNK_NAME) || key->isKind(PNK_STRING)); jsatomid index; if (!bce->makeAtomIndex(key->pn_atom, &index)) return false; if (obj) { - JS_ASSERT(!obj->inDictionaryMode()); + MOZ_ASSERT(!obj->inDictionaryMode()); Rooted id(cx, AtomToId(key->pn_atom)); RootedValue undefinedValue(cx, UndefinedValue()); if (!DefineNativeProperty(cx, obj, id, undefinedValue, nullptr, @@ -6351,7 +6351,7 @@ EmitArrayComp(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn) * bce->arrayCompDepth, then simply traverse the PNK_FOR node and * its kids under pn2 to generate this comprehension. */ - JS_ASSERT(bce->stackDepth > 0); + MOZ_ASSERT(bce->stackDepth > 0); uint32_t saveDepth = bce->arrayCompDepth; bce->arrayCompDepth = (uint32_t) (bce->stackDepth - 1); if (!EmitTree(cx, bce, pn->pn_head)) @@ -6442,7 +6442,7 @@ EmitArray(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn, uint32_t co SET_UINT24(bce->code(off), atomIndex); } } - JS_ASSERT(atomIndex == count); + MOZ_ASSERT(atomIndex == count); if (afterSpread) { if (Emit1(cx, bce, JSOP_POP) < 0) // ARRAY return false; @@ -6476,7 +6476,7 @@ EmitUnary(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn) static bool EmitDefaults(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn) { - JS_ASSERT(pn->isKind(PNK_ARGSBODY)); + MOZ_ASSERT(pn->isKind(PNK_ARGSBODY)); ParseNode *arg, *pnlast = pn->last(); for (arg = pn->pn_head; arg != pnlast; arg = arg->pn_next) { @@ -6541,8 +6541,8 @@ frontend::EmitTree(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn) if (pnlast->pn_xflags & PNX_DESTRUCT) { // Assign the destructuring arguments before defining any functions, // see bug 419662. - JS_ASSERT(pnchild->isKind(PNK_SEMI)); - JS_ASSERT(pnchild->pn_kid->isKind(PNK_VAR) || pnchild->pn_kid->isKind(PNK_CONST)); + MOZ_ASSERT(pnchild->isKind(PNK_SEMI)); + MOZ_ASSERT(pnchild->pn_kid->isKind(PNK_VAR) || pnchild->pn_kid->isKind(PNK_CONST)); if (!EmitTree(cx, bce, pnchild)) return false; pnchild = pnchild->pn_next; @@ -6552,7 +6552,7 @@ frontend::EmitTree(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn) ParseNode *rest = nullptr; bool restIsDefn = false; if (fun->hasRest()) { - JS_ASSERT(!bce->sc->asFunctionBox()->argumentsHasLocalBinding()); + MOZ_ASSERT(!bce->sc->asFunctionBox()->argumentsHasLocalBinding()); // Defaults with a rest parameter need special handling. The // rest parameter needs to be undefined while defaults are being @@ -6599,7 +6599,7 @@ frontend::EmitTree(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn) return false; if (pn2->pn_next == pnlast && fun->hasRest() && !hasDefaults) { // Fill rest parameter. We handled the case with defaults above. - JS_ASSERT(!bce->sc->asFunctionBox()->argumentsHasLocalBinding()); + MOZ_ASSERT(!bce->sc->asFunctionBox()->argumentsHasLocalBinding()); bce->switchToProlog(); if (Emit1(cx, bce, JSOP_REST) < 0) return false; @@ -6689,7 +6689,7 @@ frontend::EmitTree(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn) break; case PNK_YIELD: - JS_ASSERT(bce->sc->isFunctionBox()); + MOZ_ASSERT(bce->sc->isFunctionBox()); if (bce->sc->asFunctionBox()->isStarGenerator()) { if (!EmitPrepareIteratorResult(cx, bce)) return false; @@ -6966,11 +6966,11 @@ frontend::EmitTree(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn) break; case PNK_NOP: - JS_ASSERT(pn->getArity() == PN_NULLARY); + MOZ_ASSERT(pn->getArity() == PN_NULLARY); break; default: - JS_ASSERT(0); + MOZ_ASSERT(0); } /* bce->emitLevel == 1 means we're last on the stack, so finish up. */ @@ -7074,8 +7074,8 @@ frontend::AddToSrcNoteDelta(ExclusiveContext *cx, BytecodeEmitter *bce, jssrcnot * Called only from FinishTakingSrcNotes to add to main script note * deltas, and only by a small positive amount. */ - JS_ASSERT(bce->current == &bce->main); - JS_ASSERT((unsigned) delta < (unsigned) SN_XDELTA_LIMIT); + MOZ_ASSERT(bce->current == &bce->main); + MOZ_ASSERT((unsigned) delta < (unsigned) SN_XDELTA_LIMIT); ptrdiff_t base = SN_DELTA(sn); ptrdiff_t limit = SN_IS_XDELTA(sn) ? SN_XDELTA_LIMIT : SN_DELTA_LIMIT; @@ -7104,8 +7104,8 @@ SetSrcNoteOffset(ExclusiveContext *cx, BytecodeEmitter *bce, unsigned index, uns /* Find the offset numbered which (i.e., skip exactly which offsets). */ jssrcnote *sn = notes.begin() + index; - JS_ASSERT(SN_TYPE(sn) != SRC_XDELTA); - JS_ASSERT((int) which < js_SrcNoteSpec[SN_TYPE(sn)].arity); + MOZ_ASSERT(SN_TYPE(sn) != SRC_XDELTA); + MOZ_ASSERT((int) which < js_SrcNoteSpec[SN_TYPE(sn)].arity); for (sn++; which; sn++, which--) { if (*sn & SN_4BYTE_OFFSET_FLAG) sn += 3; @@ -7144,7 +7144,7 @@ SetSrcNoteOffset(ExclusiveContext *cx, BytecodeEmitter *bce, unsigned index, uns bool frontend::FinishTakingSrcNotes(ExclusiveContext *cx, BytecodeEmitter *bce, uint32_t *out) { - JS_ASSERT(bce->current == &bce->main); + MOZ_ASSERT(bce->current == &bce->main); unsigned prologCount = bce->prolog.notes.length(); if (prologCount && bce->prolog.currentLine != bce->firstLine) { @@ -7161,7 +7161,7 @@ frontend::FinishTakingSrcNotes(ExclusiveContext *cx, BytecodeEmitter *bce, uint3 * that came at and after the last annotated bytecode. */ ptrdiff_t offset = bce->prologOffset() - bce->prolog.lastNoteOffset; - JS_ASSERT(offset >= 0); + MOZ_ASSERT(offset >= 0); if (offset > 0 && bce->main.notes.length() != 0) { /* NB: Use as much of the first main note's delta as we can. */ jssrcnote *sn = bce->main.notes.begin(); @@ -7205,7 +7205,7 @@ frontend::CopySrcNotes(BytecodeEmitter *bce, jssrcnote *destination, uint32_t ns void CGConstList::finish(ConstArray *array) { - JS_ASSERT(length() == array->length); + MOZ_ASSERT(length() == array->length); for (unsigned i = 0; i < length(); i++) array->vector[i] = list[i]; @@ -7256,7 +7256,7 @@ CGConstList::finish(ConstArray *array) unsigned CGObjectList::add(ObjectBox *objbox) { - JS_ASSERT(!objbox->emitLink); + MOZ_ASSERT(!objbox->emitLink); objbox->emitLink = lastbox; lastbox = objbox; return length++; @@ -7265,7 +7265,7 @@ CGObjectList::add(ObjectBox *objbox) unsigned CGObjectList::indexOf(JSObject *obj) { - JS_ASSERT(length > 0); + MOZ_ASSERT(length > 0); unsigned index = length - 1; for (ObjectBox *box = lastbox; box->object != obj; box = box->emitLink) index--; @@ -7275,23 +7275,23 @@ CGObjectList::indexOf(JSObject *obj) void CGObjectList::finish(ObjectArray *array) { - JS_ASSERT(length <= INDEX_LIMIT); - JS_ASSERT(length == array->length); + MOZ_ASSERT(length <= INDEX_LIMIT); + MOZ_ASSERT(length == array->length); js::HeapPtrObject *cursor = array->vector + array->length; ObjectBox *objbox = lastbox; do { --cursor; - JS_ASSERT(!*cursor); + MOZ_ASSERT(!*cursor); *cursor = objbox->object; } while ((objbox = objbox->emitLink) != nullptr); - JS_ASSERT(cursor == array->vector); + MOZ_ASSERT(cursor == array->vector); } ObjectBox* CGObjectList::find(uint32_t index) { - JS_ASSERT(index < length); + MOZ_ASSERT(index < length); ObjectBox *box = lastbox; for (unsigned n = length - 1; n > index; n--) box = box->emitLink; @@ -7301,9 +7301,9 @@ CGObjectList::find(uint32_t index) bool CGTryNoteList::append(JSTryNoteKind kind, uint32_t stackDepth, size_t start, size_t end) { - JS_ASSERT(start <= end); - JS_ASSERT(size_t(uint32_t(start)) == start); - JS_ASSERT(size_t(uint32_t(end)) == end); + MOZ_ASSERT(start <= end); + MOZ_ASSERT(size_t(uint32_t(start)) == start); + MOZ_ASSERT(size_t(uint32_t(end)) == end); JSTryNote note; note.kind = kind; @@ -7317,7 +7317,7 @@ CGTryNoteList::append(JSTryNoteKind kind, uint32_t stackDepth, size_t start, siz void CGTryNoteList::finish(TryNoteArray *array) { - JS_ASSERT(length() == array->length); + MOZ_ASSERT(length() == array->length); for (unsigned i = 0; i < length(); i++) array->vector[i] = list[i]; @@ -7339,12 +7339,12 @@ CGBlockScopeList::append(uint32_t scopeObject, uint32_t offset, uint32_t parent) uint32_t CGBlockScopeList::findEnclosingScope(uint32_t index) { - JS_ASSERT(index < length()); - JS_ASSERT(list[index].index != BlockScopeNote::NoBlockScopeIndex); + MOZ_ASSERT(index < length()); + MOZ_ASSERT(list[index].index != BlockScopeNote::NoBlockScopeIndex); DebugOnly pos = list[index].start; while (index--) { - JS_ASSERT(list[index].start <= pos); + MOZ_ASSERT(list[index].start <= pos); if (list[index].length == 0) { // We are looking for the nearest enclosing live scope. If the // scope contains POS, it should still be open, so its length should @@ -7353,7 +7353,7 @@ CGBlockScopeList::findEnclosingScope(uint32_t index) } else { // Conversely, if the length is not zero, it should not contain // POS. - JS_ASSERT(list[index].start + list[index].length <= pos); + MOZ_ASSERT(list[index].start + list[index].length <= pos); } } @@ -7363,9 +7363,9 @@ CGBlockScopeList::findEnclosingScope(uint32_t index) void CGBlockScopeList::recordEnd(uint32_t index, uint32_t offset) { - JS_ASSERT(index < length()); - JS_ASSERT(offset >= list[index].start); - JS_ASSERT(list[index].length == 0); + MOZ_ASSERT(index < length()); + MOZ_ASSERT(offset >= list[index].start); + MOZ_ASSERT(list[index].length == 0); list[index].length = offset - list[index].start; } @@ -7373,7 +7373,7 @@ CGBlockScopeList::recordEnd(uint32_t index, uint32_t offset) void CGBlockScopeList::finish(BlockScopeArray *array) { - JS_ASSERT(length() == array->length); + MOZ_ASSERT(length() == array->length); for (unsigned i = 0; i < length(); i++) array->vector[i] = list[i]; @@ -7392,7 +7392,7 @@ const JSSrcNoteSpec js_SrcNoteSpec[] = { static int SrcNoteArity(jssrcnote *sn) { - JS_ASSERT(SN_TYPE(sn) < SRC_LAST); + MOZ_ASSERT(SN_TYPE(sn) < SRC_LAST); return js_SrcNoteSpec[SN_TYPE(sn)].arity; } @@ -7414,8 +7414,8 @@ JS_FRIEND_API(ptrdiff_t) js_GetSrcNoteOffset(jssrcnote *sn, unsigned which) { /* Find the offset numbered which (i.e., skip exactly which offsets). */ - JS_ASSERT(SN_TYPE(sn) != SRC_XDELTA); - JS_ASSERT((int) which < SrcNoteArity(sn)); + MOZ_ASSERT(SN_TYPE(sn) != SRC_XDELTA); + MOZ_ASSERT((int) which < SrcNoteArity(sn)); for (sn++; which; sn++, which--) { if (*sn & SN_4BYTE_OFFSET_FLAG) sn += 3; diff --git a/js/src/frontend/FoldConstants.cpp b/js/src/frontend/FoldConstants.cpp index 8839cd627b93..be6bb4e1b314 100644 --- a/js/src/frontend/FoldConstants.cpp +++ b/js/src/frontend/FoldConstants.cpp @@ -140,7 +140,7 @@ FoldBinaryNumeric(ExclusiveContext *cx, JSOp op, ParseNode *pn1, ParseNode *pn2, double d, d2; int32_t i, j; - JS_ASSERT(pn1->isKind(PNK_NUMBER) && pn2->isKind(PNK_NUMBER)); + MOZ_ASSERT(pn1->isKind(PNK_NUMBER) && pn2->isKind(PNK_NUMBER)); d = pn1->pn_dval; d2 = pn2->pn_dval; switch (op) { @@ -289,7 +289,7 @@ Fold(ExclusiveContext *cx, ParseNode **pnp, return true; } else { // Note: pn_body is nullptr for functions which are being lazily parsed. - JS_ASSERT(pn->getKind() == PNK_FUNCTION); + MOZ_ASSERT(pn->getKind() == PNK_FUNCTION); if (pn->pn_body) { if (!Fold(cx, &pn->pn_body, handler, options, pn->pn_funbox->inGenexpLambda, SyntacticContext::Other)) @@ -497,7 +497,7 @@ Fold(ExclusiveContext *cx, ParseNode **pnp, if (sc == SyntacticContext::Condition) { if (pn->isArity(PN_LIST)) { ParseNode **listp = &pn->pn_head; - JS_ASSERT(*listp == pn1); + MOZ_ASSERT(*listp == pn1); uint32_t orig = pn->pn_count; do { Truthiness t = Boolish(pn1); @@ -514,7 +514,7 @@ Fold(ExclusiveContext *cx, ParseNode **pnp, pn1->pn_next = nullptr; break; } - JS_ASSERT((t == Truthy) == pn->isKind(PNK_AND)); + MOZ_ASSERT((t == Truthy) == pn->isKind(PNK_AND)); if (pn->pn_count == 1) break; *listp = pn1->pn_next; @@ -527,7 +527,7 @@ Fold(ExclusiveContext *cx, ParseNode **pnp, if (pn->pn_count == 2) { pn2 = pn1->pn_next; pn1->pn_next = nullptr; - JS_ASSERT(!pn2->pn_next); + MOZ_ASSERT(!pn2->pn_next); pn->setArity(PN_BINARY); pn->pn_left = pn1; pn->pn_right = pn2; @@ -549,7 +549,7 @@ Fold(ExclusiveContext *cx, ParseNode **pnp, ReplaceNode(pnp, pn1); pn = pn1; } else { - JS_ASSERT((t == Truthy) == pn->isKind(PNK_AND)); + MOZ_ASSERT((t == Truthy) == pn->isKind(PNK_AND)); handler.freeTree(pn1); ReplaceNode(pnp, pn2); pn = pn2; @@ -579,7 +579,7 @@ Fold(ExclusiveContext *cx, ParseNode **pnp, goto do_binary_op; case PNK_ADDASSIGN: - JS_ASSERT(pn->isOp(JSOP_ADD)); + MOZ_ASSERT(pn->isOp(JSOP_ADD)); /* FALL THROUGH */ case PNK_ADD: if (pn->isArity(PN_LIST)) { @@ -676,7 +676,7 @@ Fold(ExclusiveContext *cx, ParseNode **pnp, } /* Handle a binary string concatenation. */ - JS_ASSERT(pn->isArity(PN_BINARY)); + MOZ_ASSERT(pn->isArity(PN_BINARY)); if (pn1->isKind(PNK_STRING) || pn2->isKind(PNK_STRING)) { if (!FoldType(cx, !pn1->isKind(PNK_STRING) ? pn1 : pn2, PNK_STRING)) return false; @@ -710,7 +710,7 @@ Fold(ExclusiveContext *cx, ParseNode **pnp, case PNK_MOD: do_binary_op: if (pn->isArity(PN_LIST)) { - JS_ASSERT(pn->pn_count > 2); + MOZ_ASSERT(pn->pn_count > 2); for (pn2 = pn1; pn2; pn2 = pn2->pn_next) { if (!FoldType(cx, pn2, PNK_NUMBER)) return false; @@ -734,7 +734,7 @@ Fold(ExclusiveContext *cx, ParseNode **pnp, } } } else { - JS_ASSERT(pn->isArity(PN_BINARY)); + MOZ_ASSERT(pn->isArity(PN_BINARY)); if (!FoldType(cx, pn1, PNK_NUMBER) || !FoldType(cx, pn2, PNK_NUMBER)) { return false; diff --git a/js/src/frontend/FullParseHandler.h b/js/src/frontend/FullParseHandler.h index dc6fb91a02b0..ce3524f7110d 100644 --- a/js/src/frontend/FullParseHandler.h +++ b/js/src/frontend/FullParseHandler.h @@ -29,7 +29,7 @@ class FullParseHandler bool foldConstants; ParseNode *allocParseNode(size_t size) { - JS_ASSERT(size == sizeof(ParseNode)); + MOZ_ASSERT(size == sizeof(ParseNode)); return static_cast(allocator.allocNode()); } @@ -232,8 +232,8 @@ class FullParseHandler // Expressions ParseNode *newArrayComprehension(ParseNode *body, unsigned blockid, const TokenPos &pos) { - JS_ASSERT(pos.begin <= body->pn_pos.begin); - JS_ASSERT(body->pn_pos.end <= pos.end); + MOZ_ASSERT(pos.begin <= body->pn_pos.begin); + MOZ_ASSERT(body->pn_pos.end <= pos.end); ParseNode *pn = new_(PNK_ARRAYCOMP, pos); if (!pn) return nullptr; @@ -300,7 +300,7 @@ class FullParseHandler bool addPropertyDefinition(ParseNode *literal, ParseNode *name, ParseNode *expr, bool isShorthand = false) { - JS_ASSERT(literal->isArity(PN_LIST)); + MOZ_ASSERT(literal->isArity(PN_LIST)); ParseNode *propdef = newBinary(isShorthand ? PNK_SHORTHAND : PNK_COLON, name, expr, JSOP_INITPROP); if (isShorthand) @@ -313,7 +313,7 @@ class FullParseHandler bool addMethodDefinition(ParseNode *literal, ParseNode *name, ParseNode *fn, JSOp op) { - JS_ASSERT(literal->isArity(PN_LIST)); + MOZ_ASSERT(literal->isArity(PN_LIST)); literal->pn_xflags |= PNX_NONCONST; ParseNode *propdef = newBinary(PNK_COLON, name, fn, op); @@ -334,7 +334,7 @@ class FullParseHandler template void addStatementToList(ParseNode *list, ParseNode *stmt, PC *pc) { - JS_ASSERT(list->isKind(PNK_STATEMENTLIST)); + MOZ_ASSERT(list->isKind(PNK_STATEMENTLIST)); if (stmt->isKind(PNK_FUNCTION)) { if (pc->atBodyLevel()) { @@ -381,7 +381,7 @@ class FullParseHandler } ParseNode *newExprStatement(ParseNode *expr, uint32_t end) { - JS_ASSERT(expr->pn_pos.end <= end); + MOZ_ASSERT(expr->pn_pos.end <= end); return new_(PNK_SEMI, JSOP_NOP, TokenPos(expr->pn_pos.begin, end), expr); } @@ -420,7 +420,7 @@ class FullParseHandler ParseNode *newForHead(ParseNodeKind kind, ParseNode *pn1, ParseNode *pn2, ParseNode *pn3, const TokenPos &pos) { - JS_ASSERT(kind == PNK_FORIN || kind == PNK_FOROF || kind == PNK_FORHEAD); + MOZ_ASSERT(kind == PNK_FORIN || kind == PNK_FOROF || kind == PNK_FORHEAD); return new_(kind, JSOP_NOP, pn1, pn2, pn3, pos); } @@ -458,7 +458,7 @@ class FullParseHandler } ParseNode *newThrowStatement(ParseNode *expr, const TokenPos &pos) { - JS_ASSERT(pos.encloses(expr->pn_pos)); + MOZ_ASSERT(pos.encloses(expr->pn_pos)); return new_(PNK_THROW, JSOP_THROW, pos, expr); } @@ -489,7 +489,7 @@ class FullParseHandler pn->pn_body = kid; } void setFunctionBox(ParseNode *pn, FunctionBox *funbox) { - JS_ASSERT(pn->isKind(PNK_FUNCTION)); + MOZ_ASSERT(pn->isKind(PNK_FUNCTION)); pn->pn_funbox = funbox; } void addFunctionArgument(ParseNode *pn, ParseNode *argpn) { @@ -510,7 +510,7 @@ class FullParseHandler } void setBeginPosition(ParseNode *pn, uint32_t begin) { pn->pn_pos.begin = begin; - JS_ASSERT(pn->pn_pos.begin <= pn->pn_pos.end); + MOZ_ASSERT(pn->pn_pos.begin <= pn->pn_pos.end); } void setEndPosition(ParseNode *pn, ParseNode *oth) { @@ -518,7 +518,7 @@ class FullParseHandler } void setEndPosition(ParseNode *pn, uint32_t end) { pn->pn_pos.end = end; - JS_ASSERT(pn->pn_pos.begin <= pn->pn_pos.end); + MOZ_ASSERT(pn->pn_pos.begin <= pn->pn_pos.end); } void setPosition(ParseNode *pn, const TokenPos &pos) { @@ -558,7 +558,7 @@ class FullParseHandler pn->pn_dflags |= flag; } void setListFlag(ParseNode *pn, unsigned flag) { - JS_ASSERT(pn->isArity(PN_LIST)); + MOZ_ASSERT(pn->isArity(PN_LIST)); pn->pn_xflags |= flag; } ParseNode *setInParens(ParseNode *pn) { @@ -602,10 +602,10 @@ class FullParseHandler } void linkUseToDef(ParseNode *pn, Definition *dn) { - JS_ASSERT(!pn->isUsed()); - JS_ASSERT(!pn->isDefn()); - JS_ASSERT(pn != dn->dn_uses); - JS_ASSERT(dn->isDefn()); + MOZ_ASSERT(!pn->isUsed()); + MOZ_ASSERT(!pn->isDefn()); + MOZ_ASSERT(pn != dn->dn_uses); + MOZ_ASSERT(dn->isDefn()); pn->pn_link = dn->dn_uses; dn->dn_uses = pn; dn->pn_dflags |= pn->pn_dflags & PND_USE2DEF_FLAGS; @@ -618,8 +618,8 @@ class FullParseHandler void deoptimizeUsesWithin(Definition *dn, const TokenPos &pos) { for (ParseNode *pnu = dn->dn_uses; pnu; pnu = pnu->pn_link) { - JS_ASSERT(pnu->isUsed()); - JS_ASSERT(!pnu->isDefn()); + MOZ_ASSERT(pnu->isUsed()); + MOZ_ASSERT(!pnu->isDefn()); if (pnu->pn_pos.begin >= pos.begin && pnu->pn_pos.end <= pos.end) pnu->pn_dflags |= PND_DEOPTIMIZED; } @@ -652,7 +652,7 @@ class FullParseHandler return lazyOuterFunction_; } JSFunction *nextLazyInnerFunction() { - JS_ASSERT(lazyInnerFunctionIndex < lazyOuterFunction()->numInnerFunctions()); + MOZ_ASSERT(lazyInnerFunctionIndex < lazyOuterFunction()->numInnerFunctions()); return lazyOuterFunction()->innerFunctions()[lazyInnerFunctionIndex++]; } }; diff --git a/js/src/frontend/NameFunctions.cpp b/js/src/frontend/NameFunctions.cpp index f8c053586d8c..6a1eced88f4f 100644 --- a/js/src/frontend/NameFunctions.cpp +++ b/js/src/frontend/NameFunctions.cpp @@ -160,7 +160,7 @@ class NameResolver default: /* Save any other nodes we encounter on the way up. */ - JS_ASSERT(*size < MaxParents); + MOZ_ASSERT(*size < MaxParents); nameable[(*size)++] = cur; break; } @@ -175,7 +175,7 @@ class NameResolver * assign to the function's displayAtom field */ bool resolveFun(ParseNode *pn, HandleAtom prefix, MutableHandleAtom retAtom) { - JS_ASSERT(pn != nullptr && pn->isKind(PNK_FUNCTION)); + MOZ_ASSERT(pn != nullptr && pn->isKind(PNK_FUNCTION)); RootedFunction fun(cx, pn->pn_funbox->function()); StringBuffer buf(cx); @@ -334,7 +334,7 @@ class NameResolver return false; break; case PN_CODE: - JS_ASSERT(cur->isKind(PNK_FUNCTION)); + MOZ_ASSERT(cur->isKind(PNK_FUNCTION)); if (!resolve(cur->pn_body, prefix)) return false; break; diff --git a/js/src/frontend/ParseMaps.cpp b/js/src/frontend/ParseMaps.cpp index ec670eaa4900..c04106198805 100644 --- a/js/src/frontend/ParseMaps.cpp +++ b/js/src/frontend/ParseMaps.cpp @@ -117,7 +117,7 @@ frontend::InitAtomMap(frontend::AtomIndexMap *indices, HeapPtrAtom *atoms) for (WordMap::Range r = wm.all(); !r.empty(); r.popFront()) { JSAtom *atom = r.front().key(); jsatomid index = r.front().value(); - JS_ASSERT(index < indices->count()); + MOZ_ASSERT(index < indices->count()); atoms[index].init(atom); } } else { @@ -126,7 +126,7 @@ frontend::InitAtomMap(frontend::AtomIndexMap *indices, HeapPtrAtom *atoms) JSAtom *atom = it->key; if (!atom) continue; - JS_ASSERT(it->value < indices->count()); + MOZ_ASSERT(it->value < indices->count()); atoms[it->value].init(atom); } } diff --git a/js/src/frontend/ParseMaps.h b/js/src/frontend/ParseMaps.h index ba3a448cd7bf..9a6d3f80c201 100644 --- a/js/src/frontend/ParseMaps.h +++ b/js/src/frontend/ParseMaps.h @@ -56,7 +56,7 @@ class ParseMapPool void checkInvariants(); void recycle(void *map) { - JS_ASSERT(map); + MOZ_ASSERT(map); #ifdef DEBUG bool ok = false; /* Make sure the map is in |all| but not already in |recyclable|. */ @@ -66,11 +66,11 @@ class ParseMapPool break; } } - JS_ASSERT(ok); + MOZ_ASSERT(ok); for (void **it = recyclable.begin(), **end = recyclable.end(); it != end; ++it) - JS_ASSERT(*it != map); + MOZ_ASSERT(*it != map); #endif - JS_ASSERT(recyclable.length() < all.length()); + MOZ_ASSERT(recyclable.length() < all.length()); recyclable.infallibleAppend(map); /* Reserved in allocateFresh. */ } @@ -139,7 +139,7 @@ struct AtomThingMapPtr bool hasMap() const { return map_; } Map *getMap() { return map_; } - void setMap(Map *newMap) { JS_ASSERT(!map_); map_ = newMap; } + void setMap(Map *newMap) { MOZ_ASSERT(!map_); map_ = newMap; } void clearMap() { map_ = nullptr; } Map *operator->() { return map_; } @@ -246,7 +246,7 @@ class DefinitionList } u; Node *firstNode() const { - JS_ASSERT(isMultiple()); + MOZ_ASSERT(isMultiple()); return (Node *) (u.bits & ~0x1); } @@ -276,7 +276,7 @@ class DefinitionList Range() : node(nullptr), bits(0) {} void popFront() { - JS_ASSERT(!empty()); + MOZ_ASSERT(!empty()); if (!node) { bits = 0; return; @@ -287,7 +287,7 @@ class DefinitionList template typename ParseHandler::DefinitionNode front() { - JS_ASSERT(!empty()); + MOZ_ASSERT(!empty()); return ParseHandler::definitionFromBits(bits); } @@ -303,13 +303,13 @@ class DefinitionList explicit DefinitionList(uintptr_t bits) { u.bits = bits; - JS_ASSERT(!isMultiple()); + MOZ_ASSERT(!isMultiple()); } explicit DefinitionList(Node *node) { u.head = node; u.bits |= 0x1; - JS_ASSERT(isMultiple()); + MOZ_ASSERT(isMultiple()); } bool isMultiple() const { return (u.bits & 0x1) != 0; } @@ -434,7 +434,7 @@ class AtomDecls /* Return the definition at the head of the chain for |atom|. */ DefinitionNode lookupFirst(JSAtom *atom) const { - JS_ASSERT(map); + MOZ_ASSERT(map); AtomDefnListPtr p = map->lookup(atom); if (!p) return ParseHandler::nullDefinition(); @@ -443,7 +443,7 @@ class AtomDecls /* Perform a lookup that can iterate over the definitions associated with |atom|. */ DefinitionList::Range lookupMulti(JSAtom *atom) const { - JS_ASSERT(map); + MOZ_ASSERT(map); if (AtomDefnListPtr p = map->lookup(atom)) return p.value().all(); return DefinitionList::Range(); @@ -451,11 +451,11 @@ class AtomDecls /* Add-or-update a known-unique definition for |atom|. */ bool addUnique(JSAtom *atom, DefinitionNode defn) { - JS_ASSERT(map); + MOZ_ASSERT(map); AtomDefnListAddPtr p = map->lookupForAdd(atom); if (!p) return map->add(p, atom, DefinitionList(ParseHandler::definitionToBits(defn))); - JS_ASSERT(!p.value().isMultiple()); + MOZ_ASSERT(!p.value().isMultiple()); p.value() = DefinitionList(ParseHandler::definitionToBits(defn)); return true; } @@ -464,15 +464,15 @@ class AtomDecls /* Updating the definition for an entry that is known to exist is infallible. */ void updateFirst(JSAtom *atom, DefinitionNode defn) { - JS_ASSERT(map); + MOZ_ASSERT(map); AtomDefnListMap::Ptr p = map->lookup(atom); - JS_ASSERT(p); + MOZ_ASSERT(p); p.value().setFront(defn); } /* Remove the node at the head of the chain for |atom|. */ void remove(JSAtom *atom) { - JS_ASSERT(map); + MOZ_ASSERT(map); AtomDefnListMap::Ptr p = map->lookup(atom); if (!p) return; @@ -485,7 +485,7 @@ class AtomDecls } AtomDefnListMap::Range all() const { - JS_ASSERT(map); + MOZ_ASSERT(map); return map->all(); } diff --git a/js/src/frontend/ParseNode-inl.h b/js/src/frontend/ParseNode-inl.h index 64addc2358ff..91e09f12b933 100644 --- a/js/src/frontend/ParseNode-inl.h +++ b/js/src/frontend/ParseNode-inl.h @@ -17,7 +17,7 @@ namespace frontend { inline PropertyName * ParseNode::name() const { - JS_ASSERT(isKind(PNK_FUNCTION) || isKind(PNK_NAME)); + MOZ_ASSERT(isKind(PNK_FUNCTION) || isKind(PNK_NAME)); JSAtom *atom = isKind(PNK_FUNCTION) ? pn_funbox->function()->atom() : pn_atom; return atom->asPropertyName(); } @@ -25,7 +25,7 @@ ParseNode::name() const inline JSAtom * ParseNode::atom() const { - JS_ASSERT(isKind(PNK_STRING)); + MOZ_ASSERT(isKind(PNK_STRING)); return pn_atom; } diff --git a/js/src/frontend/ParseNode.cpp b/js/src/frontend/ParseNode.cpp index d75b3fad8416..32d737613d05 100644 --- a/js/src/frontend/ParseNode.cpp +++ b/js/src/frontend/ParseNode.cpp @@ -28,7 +28,7 @@ JS_STATIC_ASSERT(pn_offsetof(pn_link) == pn_offsetof(dn_uses)); void ParseNode::checkListConsistency() { - JS_ASSERT(isArity(PN_LIST)); + MOZ_ASSERT(isArity(PN_LIST)); ParseNode **tail; uint32_t count = 0; if (pn_head) { @@ -39,8 +39,8 @@ ParseNode::checkListConsistency() } else { tail = &pn_head; } - JS_ASSERT(pn_tail == tail); - JS_ASSERT(pn_count == count); + MOZ_ASSERT(pn_tail == tail); + MOZ_ASSERT(pn_count == count); } #endif @@ -49,7 +49,7 @@ void ParseNodeAllocator::freeNode(ParseNode *pn) { /* Catch back-to-back dup recycles. */ - JS_ASSERT(pn != freelist); + MOZ_ASSERT(pn != freelist); /* * It's too hard to clear these nodes from the AtomDefnMaps, etc. that @@ -57,8 +57,8 @@ ParseNodeAllocator::freeNode(ParseNode *pn) * recognize and process these, since their children do need to be dealt * with. */ - JS_ASSERT(!pn->isUsed()); - JS_ASSERT(!pn->isDefn()); + MOZ_ASSERT(!pn->isUsed()); + MOZ_ASSERT(!pn->isDefn()); #ifdef DEBUG /* Poison the node, to catch attempts to use it without initializing it. */ @@ -96,7 +96,7 @@ class NodeStack { top = pn->pn_head; } ParseNode *pop() { - JS_ASSERT(!empty()); + MOZ_ASSERT(!empty()); ParseNode *hold = top; /* my kingdom for a prog1 */ top = top->pn_next; return hold; @@ -269,7 +269,7 @@ ParseNode::append(ParseNodeKind kind, JSOp op, ParseNode *left, ParseNode *right if (!left || !right) return nullptr; - JS_ASSERT(left->isKind(kind) && left->isOp(op) && (js_CodeSpec[op].format & JOF_LEFTASSOC)); + MOZ_ASSERT(left->isKind(kind) && left->isOp(op) && (js_CodeSpec[op].format & JOF_LEFTASSOC)); ListNode *list; if (left->pn_arity == PN_LIST) { @@ -320,7 +320,7 @@ Definition::kindString(Kind kind) "", js_var_str, js_const_str, js_let_str, js_function_str, "argument", "unknown" }; - JS_ASSERT(unsigned(kind) <= unsigned(ARG)); + MOZ_ASSERT(unsigned(kind) <= unsigned(ARG)); return table[kind]; } @@ -455,7 +455,7 @@ Parser::cloneLeftHandSide(ParseNode *opn) pn->setUsed(opn->isUsed()); if (opn->isArity(PN_LIST)) { - JS_ASSERT(opn->isKind(PNK_ARRAY) || opn->isKind(PNK_OBJECT)); + MOZ_ASSERT(opn->isKind(PNK_ARRAY) || opn->isKind(PNK_OBJECT)); pn->makeEmpty(); for (ParseNode *opn2 = opn->pn_head; opn2; opn2 = opn2->pn_next) { ParseNode *pn2; @@ -466,8 +466,8 @@ Parser::cloneLeftHandSide(ParseNode *opn) return nullptr; pn2 = handler.new_(PNK_MUTATEPROTO, JSOP_NOP, opn2->pn_pos, target); } else { - JS_ASSERT(opn2->isArity(PN_BINARY)); - JS_ASSERT(opn2->isKind(PNK_COLON) || opn2->isKind(PNK_SHORTHAND)); + MOZ_ASSERT(opn2->isArity(PN_BINARY)); + MOZ_ASSERT(opn2->isKind(PNK_COLON) || opn2->isKind(PNK_SHORTHAND)); ParseNode *tag = cloneParseTree(opn2->pn_left); if (!tag) @@ -479,7 +479,7 @@ Parser::cloneLeftHandSide(ParseNode *opn) pn2 = handler.new_(opn2->getKind(), JSOP_INITPROP, opn2->pn_pos, tag, target); } } else if (opn2->isArity(PN_NULLARY)) { - JS_ASSERT(opn2->isKind(PNK_ELISION)); + MOZ_ASSERT(opn2->isKind(PNK_ELISION)); pn2 = cloneParseTree(opn2); } else if (opn2->isKind(PNK_SPREAD)) { ParseNode *target = cloneLeftHandSide(opn2->pn_kid); @@ -498,8 +498,8 @@ Parser::cloneLeftHandSide(ParseNode *opn) return pn; } - JS_ASSERT(opn->isArity(PN_NAME)); - JS_ASSERT(opn->isKind(PNK_NAME)); + MOZ_ASSERT(opn->isArity(PN_NAME)); + MOZ_ASSERT(opn->isKind(PNK_NAME)); /* If opn is a definition or use, make pn a use. */ pn->pn_u.name = opn->pn_u.name; @@ -741,7 +741,7 @@ NameNode::dump(int indent) return; } - JS_ASSERT(!isUsed()); + MOZ_ASSERT(!isUsed()); const char *name = parseNodeNames[getKind()]; if (isUsed()) fprintf(stderr, "(%s)", name); @@ -759,7 +759,7 @@ ObjectBox::ObjectBox(JSObject *object, ObjectBox* traceLink) traceLink(traceLink), emitLink(nullptr) { - JS_ASSERT(!object->is()); + MOZ_ASSERT(!object->is()); } ObjectBox::ObjectBox(JSFunction *function, ObjectBox* traceLink) @@ -767,14 +767,14 @@ ObjectBox::ObjectBox(JSFunction *function, ObjectBox* traceLink) traceLink(traceLink), emitLink(nullptr) { - JS_ASSERT(object->is()); - JS_ASSERT(asFunctionBox()->function() == function); + MOZ_ASSERT(object->is()); + MOZ_ASSERT(asFunctionBox()->function() == function); } FunctionBox * ObjectBox::asFunctionBox() { - JS_ASSERT(isFunctionBox()); + MOZ_ASSERT(isFunctionBox()); return static_cast(this); } diff --git a/js/src/frontend/ParseNode.h b/js/src/frontend/ParseNode.h index 7c0a255d47a3..ee8300756a25 100644 --- a/js/src/frontend/ParseNode.h +++ b/js/src/frontend/ParseNode.h @@ -44,8 +44,8 @@ class UpvarCookie static const uint32_t FREE_LEVEL = SCOPECOORD_HOPS_LIMIT - 1; bool isFree() const { return level_ == FREE_LEVEL; } - uint32_t level() const { JS_ASSERT(!isFree()); return level_; } - uint32_t slot() const { JS_ASSERT(!isFree()); return slot_; } + uint32_t level() const { MOZ_ASSERT(!isFree()); return level_; } + uint32_t slot() const { MOZ_ASSERT(!isFree()); return slot_; } // This fails and issues an error message if newLevel or newSlot are too large. bool set(TokenStream &ts, unsigned newLevel, uint32_t newSlot) { @@ -63,7 +63,7 @@ class UpvarCookie void makeFree() { level_ = FREE_LEVEL; slot_ = 0; // value doesn't matter, won't be used - JS_ASSERT(isFree()); + MOZ_ASSERT(isFree()); } }; @@ -468,7 +468,7 @@ class ParseNode : pn_type(kind), pn_op(op), pn_arity(arity), pn_parens(0), pn_used(0), pn_defn(0), pn_pos(0, 0), pn_offset(0), pn_next(nullptr), pn_link(nullptr) { - JS_ASSERT(kind < PNK_LIMIT); + MOZ_ASSERT(kind < PNK_LIMIT); memset(&pn_u, 0, sizeof pn_u); } @@ -476,7 +476,7 @@ class ParseNode : pn_type(kind), pn_op(op), pn_arity(arity), pn_parens(0), pn_used(0), pn_defn(0), pn_pos(pos), pn_offset(0), pn_next(nullptr), pn_link(nullptr) { - JS_ASSERT(kind < PNK_LIMIT); + MOZ_ASSERT(kind < PNK_LIMIT); memset(&pn_u, 0, sizeof pn_u); } @@ -485,11 +485,11 @@ class ParseNode bool isOp(JSOp op) const { return getOp() == op; } ParseNodeKind getKind() const { - JS_ASSERT(pn_type < PNK_LIMIT); + MOZ_ASSERT(pn_type < PNK_LIMIT); return ParseNodeKind(pn_type); } void setKind(ParseNodeKind kind) { - JS_ASSERT(kind < PNK_LIMIT); + MOZ_ASSERT(kind < PNK_LIMIT); pn_type = kind; } bool isKind(ParseNodeKind kind) const { return getKind() == kind; } @@ -612,8 +612,8 @@ class ParseNode pn_op = op; pn_arity = arity; pn_parens = false; - JS_ASSERT(!pn_used); - JS_ASSERT(!pn_defn); + MOZ_ASSERT(!pn_used); + MOZ_ASSERT(!pn_defn); pn_next = pn_link = nullptr; } @@ -647,14 +647,14 @@ class ParseNode * and pn->lexdef(). Otherwise, use pn->maybeExpr() and pn->maybeLexDef(). */ ParseNode *expr() const { - JS_ASSERT(!pn_used); - JS_ASSERT(pn_arity == PN_NAME || pn_arity == PN_CODE); + MOZ_ASSERT(!pn_used); + MOZ_ASSERT(pn_arity == PN_NAME || pn_arity == PN_CODE); return pn_expr; } Definition *lexdef() const { - JS_ASSERT(pn_used || isDeoptimized()); - JS_ASSERT(pn_arity == PN_NAME); + MOZ_ASSERT(pn_used || isDeoptimized()); + MOZ_ASSERT(pn_arity == PN_NAME); return pn_lexdef; } @@ -701,23 +701,23 @@ class ParseNode static_assert(PNX_NONCONST < (1 << NumListFlagBits), "Not enough bits"); unsigned frameLevel() const { - JS_ASSERT(pn_arity == PN_CODE || pn_arity == PN_NAME); + MOZ_ASSERT(pn_arity == PN_CODE || pn_arity == PN_NAME); return pn_cookie.level(); } uint32_t frameSlot() const { - JS_ASSERT(pn_arity == PN_CODE || pn_arity == PN_NAME); + MOZ_ASSERT(pn_arity == PN_CODE || pn_arity == PN_NAME); return pn_cookie.slot(); } bool functionIsHoisted() const { - JS_ASSERT(pn_arity == PN_CODE && getKind() == PNK_FUNCTION); - JS_ASSERT(isOp(JSOP_LAMBDA) || // lambda, genexpr - isOp(JSOP_LAMBDA_ARROW) || // arrow function - isOp(JSOP_DEFFUN) || // non-body-level function statement - isOp(JSOP_NOP) || // body-level function stmt in global code - isOp(JSOP_GETLOCAL) || // body-level function stmt in function code - isOp(JSOP_GETARG)); // body-level function redeclaring formal + MOZ_ASSERT(pn_arity == PN_CODE && getKind() == PNK_FUNCTION); + MOZ_ASSERT(isOp(JSOP_LAMBDA) || // lambda, genexpr + isOp(JSOP_LAMBDA_ARROW) || // arrow function + isOp(JSOP_DEFFUN) || // non-body-level function statement + isOp(JSOP_NOP) || // body-level function stmt in global code + isOp(JSOP_GETLOCAL) || // body-level function stmt in function code + isOp(JSOP_GETARG)); // body-level function redeclaring formal return !isOp(JSOP_LAMBDA) && !isOp(JSOP_LAMBDA_ARROW) && !isOp(JSOP_DEFFUN); } @@ -736,7 +736,7 @@ class ParseNode */ JSAtom *isStringExprStatement() const { if (getKind() == PNK_SEMI) { - JS_ASSERT(pn_arity == PN_UNARY); + MOZ_ASSERT(pn_arity == PN_UNARY); ParseNode *kid = pn_kid; if (kid && kid->getKind() == PNK_STRING && !kid->pn_parens) return kid->pn_atom; @@ -770,10 +770,10 @@ class ParseNode #ifdef JS_HAS_GENERATOR_EXPRS ParseNode *generatorExpr() const { - JS_ASSERT(isKind(PNK_GENEXP)); + MOZ_ASSERT(isKind(PNK_GENEXP)); ParseNode *callee = this->pn_head; ParseNode *body = callee->pn_body; - JS_ASSERT(body->isKind(PNK_LEXICALSCOPE)); + MOZ_ASSERT(body->isKind(PNK_LEXICALSCOPE)); return body->pn_expr; } #endif @@ -785,20 +785,20 @@ class ParseNode * must be non-empty for correct PN_LAST usage -- this is asserted! */ ParseNode *last() const { - JS_ASSERT(pn_arity == PN_LIST); - JS_ASSERT(pn_count != 0); + MOZ_ASSERT(pn_arity == PN_LIST); + MOZ_ASSERT(pn_count != 0); return (ParseNode *)(uintptr_t(pn_tail) - offsetof(ParseNode, pn_next)); } void initNumber(double value, DecimalPoint decimalPoint) { - JS_ASSERT(pn_arity == PN_NULLARY); - JS_ASSERT(getKind() == PNK_NUMBER); + MOZ_ASSERT(pn_arity == PN_NULLARY); + MOZ_ASSERT(getKind() == PNK_NUMBER); pn_u.number.value = value; pn_u.number.decimalPoint = decimalPoint; } void makeEmpty() { - JS_ASSERT(pn_arity == PN_LIST); + MOZ_ASSERT(pn_arity == PN_LIST); pn_head = nullptr; pn_tail = &pn_head; pn_count = 0; @@ -807,7 +807,7 @@ class ParseNode } void initList(ParseNode *pn) { - JS_ASSERT(pn_arity == PN_LIST); + MOZ_ASSERT(pn_arity == PN_LIST); if (pn->pn_pos.begin < pn_pos.begin) pn_pos.begin = pn->pn_pos.begin; pn_pos.end = pn->pn_pos.end; @@ -819,8 +819,8 @@ class ParseNode } void append(ParseNode *pn) { - JS_ASSERT(pn_arity == PN_LIST); - JS_ASSERT(pn->pn_pos.begin >= pn_pos.begin); + MOZ_ASSERT(pn_arity == PN_LIST); + MOZ_ASSERT(pn->pn_pos.begin >= pn_pos.begin); pn_pos.end = pn->pn_pos.end; *pn_tail = pn; pn_tail = &pn->pn_next; @@ -850,13 +850,13 @@ class ParseNode /* Casting operations. */ template inline NodeType &as() { - JS_ASSERT(NodeType::test(*this)); + MOZ_ASSERT(NodeType::test(*this)); return *static_cast(this); } template inline const NodeType &as() const { - JS_ASSERT(NodeType::test(*this)); + MOZ_ASSERT(NodeType::test(*this)); return *static_cast(this); } @@ -1052,7 +1052,7 @@ struct NameNode : public ParseNode pn_cookie.makeFree(); pn_dflags = 0; pn_blockid = blockid; - JS_ASSERT(pn_blockid == blockid); // check for bitfield overflow + MOZ_ASSERT(pn_blockid == blockid); // check for bitfield overflow } static bool test(const ParseNode &node) { @@ -1103,7 +1103,7 @@ class LoopControlStatement : public ParseNode LoopControlStatement(ParseNodeKind kind, PropertyName *label, const TokenPos &pos) : ParseNode(kind, JSOP_NOP, PN_NULLARY, pos) { - JS_ASSERT(kind == PNK_BREAK || kind == PNK_CONTINUE); + MOZ_ASSERT(kind == PNK_BREAK || kind == PNK_CONTINUE); pn_u.loopControl.label = label; } @@ -1166,9 +1166,9 @@ class ConditionalExpression : public ParseNode : ParseNode(PNK_CONDITIONAL, JSOP_NOP, PN_TERNARY, TokenPos(condition->pn_pos.begin, elseExpr->pn_pos.end)) { - JS_ASSERT(condition); - JS_ASSERT(thenExpr); - JS_ASSERT(elseExpr); + MOZ_ASSERT(condition); + MOZ_ASSERT(thenExpr); + MOZ_ASSERT(elseExpr); pn_u.ternary.kid1 = condition; pn_u.ternary.kid2 = thenExpr; pn_u.ternary.kid3 = elseExpr; @@ -1239,8 +1239,8 @@ class PropertyAccess : public ParseNode PropertyAccess(ParseNode *lhs, PropertyName *name, uint32_t begin, uint32_t end) : ParseNode(PNK_DOT, JSOP_NOP, PN_NAME, TokenPos(begin, end)) { - JS_ASSERT(lhs != nullptr); - JS_ASSERT(name != nullptr); + MOZ_ASSERT(lhs != nullptr); + MOZ_ASSERT(name != nullptr); pn_u.name.expr = lhs; pn_u.name.atom = name; } @@ -1393,7 +1393,7 @@ void DumpParseTree(ParseNode *pn, int indent = 0); struct Definition : public ParseNode { bool isFreeVar() const { - JS_ASSERT(isDefn()); + MOZ_ASSERT(isDefn()); return pn_cookie.isFree(); } @@ -1409,7 +1409,7 @@ struct Definition : public ParseNode return ARG; return VAR; } - JS_ASSERT(getKind() == PNK_NAME); + MOZ_ASSERT(getKind() == PNK_NAME); if (isOp(JSOP_CALLEE)) return NAMED_LAMBDA; if (isPlaceholder()) @@ -1445,12 +1445,12 @@ class ParseNodeAllocator inline bool ParseNode::test(unsigned flag) const { - JS_ASSERT(pn_defn || pn_arity == PN_CODE || pn_arity == PN_NAME); + MOZ_ASSERT(pn_defn || pn_arity == PN_CODE || pn_arity == PN_NAME); #ifdef DEBUG if ((flag & PND_ASSIGNED) && pn_defn && !(pn_dflags & flag)) { for (ParseNode *pn = ((Definition *) this)->dn_uses; pn; pn = pn->pn_link) { - JS_ASSERT(!pn->pn_defn); - JS_ASSERT(!(pn->pn_dflags & flag)); + MOZ_ASSERT(!pn->pn_defn); + MOZ_ASSERT(!(pn->pn_dflags & flag)); } } #endif @@ -1460,7 +1460,7 @@ ParseNode::test(unsigned flag) const inline void ParseNode::markAsAssigned() { - JS_ASSERT(js_CodeSpec[pn_op].format & JOF_NAME); + MOZ_ASSERT(js_CodeSpec[pn_op].format & JOF_NAME); if (isUsed()) pn_lexdef->pn_dflags |= PND_ASSIGNED; pn_dflags |= PND_ASSIGNED; @@ -1471,7 +1471,7 @@ ParseNode::resolve() { if (isDefn()) return (Definition *)this; - JS_ASSERT(lexdef()->isDefn()); + MOZ_ASSERT(lexdef()->isDefn()); return (Definition *)lexdef(); } @@ -1488,7 +1488,7 @@ ParseNode::isConstant() return true; case PNK_ARRAY: case PNK_OBJECT: - JS_ASSERT(isOp(JSOP_NEWINIT)); + MOZ_ASSERT(isOp(JSOP_NEWINIT)); return !(pn_xflags & PNX_NONCONST); default: return false; @@ -1527,13 +1527,13 @@ enum FunctionSyntaxKind { Expression, Statement, Arrow, Method }; static inline ParseNode * FunctionArgsList(ParseNode *fn, unsigned *numFormals) { - JS_ASSERT(fn->isKind(PNK_FUNCTION)); + MOZ_ASSERT(fn->isKind(PNK_FUNCTION)); ParseNode *argsBody = fn->pn_body; - JS_ASSERT(argsBody->isKind(PNK_ARGSBODY)); + MOZ_ASSERT(argsBody->isKind(PNK_ARGSBODY)); *numFormals = argsBody->pn_count; if (*numFormals > 0 && argsBody->last()->isKind(PNK_STATEMENTLIST)) (*numFormals)--; - JS_ASSERT(argsBody->isArity(PN_LIST)); + MOZ_ASSERT(argsBody->isArity(PN_LIST)); return argsBody->pn_head; } diff --git a/js/src/frontend/Parser-inl.h b/js/src/frontend/Parser-inl.h index 2cc6cff585c4..81868d30ab92 100644 --- a/js/src/frontend/Parser-inl.h +++ b/js/src/frontend/Parser-inl.h @@ -29,7 +29,7 @@ ParseContext::~ParseContext() { // |*parserPC| pointed to this object. Now that this object is about to // die, make |*parserPC| point to this object's parent. - JS_ASSERT(*parserPC == this); + MOZ_ASSERT(*parserPC == this); *parserPC = this->oldpc; } diff --git a/js/src/frontend/Parser.cpp b/js/src/frontend/Parser.cpp index 1453b8f8f640..e40c855f4956 100644 --- a/js/src/frontend/Parser.cpp +++ b/js/src/frontend/Parser.cpp @@ -77,7 +77,7 @@ GenerateBlockId(TokenStream &ts, ParseContext *pc, uint32_t &block ts.reportError(JSMSG_NEED_DIET, "program"); return false; } - JS_ASSERT(pc->blockidGen < BlockIdLimit); + MOZ_ASSERT(pc->blockidGen < BlockIdLimit); blockid = pc->blockidGen++; return true; } @@ -132,14 +132,14 @@ bool ParseContext::define(TokenStream &ts, HandlePropertyName name, ParseNode *pn, Definition::Kind kind) { - JS_ASSERT(!pn->isUsed()); + MOZ_ASSERT(!pn->isUsed()); JS_ASSERT_IF(pn->isDefn(), pn->isPlaceholder()); Definition *prevDef = nullptr; if (kind == Definition::LET) prevDef = decls_.lookupFirst(name); else - JS_ASSERT(!decls_.lookupFirst(name)); + MOZ_ASSERT(!decls_.lookupFirst(name)); if (!prevDef) prevDef = lexdeps.lookupDefn(name); @@ -150,8 +150,8 @@ ParseContext::define(TokenStream &ts, unsigned start = (kind == Definition::LET) ? pn->pn_blockid : bodyid; while ((pnu = *pnup) != nullptr && pnu->pn_blockid >= start) { - JS_ASSERT(pnu->pn_blockid >= bodyid); - JS_ASSERT(pnu->isUsed()); + MOZ_ASSERT(pnu->pn_blockid >= bodyid); + MOZ_ASSERT(pnu->isUsed()); pnu->pn_lexdef = (Definition *) pn; pn->pn_dflags |= pnu->pn_dflags & PND_USE2DEF_FLAGS; pnup = &pnu->pn_link; @@ -178,7 +178,7 @@ ParseContext::define(TokenStream &ts, Definition *dn = (Definition *)pn; switch (kind) { case Definition::ARG: - JS_ASSERT(sc->isFunctionBox()); + MOZ_ASSERT(sc->isFunctionBox()); dn->setOp((js_CodeSpec[dn->getOp()].format & JOF_SET) ? JSOP_SETARG : JSOP_GETARG); dn->pn_blockid = bodyid; dn->pn_dflags |= PND_BOUND; @@ -216,7 +216,7 @@ ParseContext::define(TokenStream &ts, case Definition::LET: dn->setOp(JSOP_INITLEXICAL); dn->pn_dflags |= (PND_LET | PND_BOUND); - JS_ASSERT(dn->pn_cookie.level() == staticLevel); /* see bindLet */ + MOZ_ASSERT(dn->pn_cookie.level() == staticLevel); /* see bindLet */ if (atBodyLevel()) { if (!bodyLevelLexicals_.append(dn)) return false; @@ -252,7 +252,7 @@ bool ParseContext::define(TokenStream &ts, HandlePropertyName name, Node pn, Definition::Kind kind) { - JS_ASSERT(!decls_.lookupFirst(name)); + MOZ_ASSERT(!decls_.lookupFirst(name)); if (lexdeps.lookupDefn(name)) lexdeps->remove(name); @@ -274,7 +274,7 @@ template void ParseContext::prepareToAddDuplicateArg(HandlePropertyName name, DefinitionNode prevDecl) { - JS_ASSERT(decls_.lookupFirst(name) == prevDecl); + MOZ_ASSERT(decls_.lookupFirst(name) == prevDecl); decls_.remove(name); } @@ -289,22 +289,22 @@ ParseContext::updateDecl(JSAtom *atom, Node pn) decls_.updateFirst(atom, newDecl); if (!sc->isFunctionBox()) { - JS_ASSERT(newDecl->isFreeVar()); + MOZ_ASSERT(newDecl->isFreeVar()); return; } - JS_ASSERT(oldDecl->isBound()); - JS_ASSERT(!oldDecl->pn_cookie.isFree()); + MOZ_ASSERT(oldDecl->isBound()); + MOZ_ASSERT(!oldDecl->pn_cookie.isFree()); newDecl->pn_cookie = oldDecl->pn_cookie; newDecl->pn_dflags |= PND_BOUND; if (IsArgOp(oldDecl->getOp())) { newDecl->setOp(JSOP_GETARG); - JS_ASSERT(args_[oldDecl->pn_cookie.slot()] == oldDecl); + MOZ_ASSERT(args_[oldDecl->pn_cookie.slot()] == oldDecl); args_[oldDecl->pn_cookie.slot()] = newDecl; } else { - JS_ASSERT(IsLocalOp(oldDecl->getOp())); + MOZ_ASSERT(IsLocalOp(oldDecl->getOp())); newDecl->setOp(JSOP_GETLOCAL); - JS_ASSERT(vars_[oldDecl->pn_cookie.slot()] == oldDecl); + MOZ_ASSERT(vars_[oldDecl->pn_cookie.slot()] == oldDecl); vars_[oldDecl->pn_cookie.slot()] = newDecl; } } @@ -313,7 +313,7 @@ template void ParseContext::popLetDecl(JSAtom *atom) { - JS_ASSERT(ParseHandler::getDefinitionKind(decls_.lookupFirst(atom)) == Definition::LET); + MOZ_ASSERT(ParseHandler::getDefinitionKind(decls_.lookupFirst(atom)) == Definition::LET); decls_.remove(atom); } @@ -365,9 +365,9 @@ ParseContext::generateFunctionBindings(ExclusiveContext *cx, Token LifoAlloc &alloc, InternalHandle bindings) const { - JS_ASSERT(sc->isFunctionBox()); - JS_ASSERT(args_.length() < ARGNO_LIMIT); - JS_ASSERT(vars_.length() + bodyLevelLexicals_.length() < LOCALNO_LIMIT); + MOZ_ASSERT(sc->isFunctionBox()); + MOZ_ASSERT(args_.length() < ARGNO_LIMIT); + MOZ_ASSERT(vars_.length() + bodyLevelLexicals_.length() < LOCALNO_LIMIT); /* * Avoid pathological edge cases by explicitly limiting the total number of @@ -539,7 +539,7 @@ template ObjectBox * Parser::newObjectBox(JSObject *obj) { - JS_ASSERT(obj && !IsPoisonedPtr(obj)); + MOZ_ASSERT(obj && !IsPoisonedPtr(obj)); /* * We use JSContext.tempLifoAlloc to allocate parsed objects and place them @@ -583,7 +583,7 @@ FunctionBox::FunctionBox(ExclusiveContext *cx, ObjectBox* traceListHead, JSFunct // Functions created at parse time may be set singleton after parsing and // baked into JIT code, so they must be allocated tenured. They are held by // the JSScript so cannot be collected during a minor GC anyway. - JS_ASSERT(fun->isTenured()); + MOZ_ASSERT(fun->isTenured()); if (!outerpc) { inWith = false; @@ -633,7 +633,7 @@ FunctionBox * Parser::newFunctionBox(Node fn, JSFunction *fun, ParseContext *outerpc, Directives inheritedDirectives, GeneratorKind generatorKind) { - JS_ASSERT(fun && !IsPoisonedPtr(fun)); + MOZ_ASSERT(fun && !IsPoisonedPtr(fun)); /* * We use JSContext.tempLifoAlloc to allocate parsed objects and place them @@ -830,7 +830,7 @@ Parser::standaloneFunctionBody(HandleFunction fun, const AutoN if (!funpc.generateFunctionBindings(context, tokenStream, alloc, funboxBindings)) return null(); - JS_ASSERT(fn->pn_body->isKind(PNK_ARGSBODY)); + MOZ_ASSERT(fn->pn_body->isKind(PNK_ARGSBODY)); fn->pn_body->append(pn); fn->pn_body->pn_pos = pn->pn_pos; return fn; @@ -983,8 +983,8 @@ template typename ParseHandler::Node Parser::functionBody(FunctionSyntaxKind kind, FunctionBodyType type) { - JS_ASSERT(pc->sc->isFunctionBox()); - JS_ASSERT(!pc->funHasReturnExpr && !pc->funHasReturnVoid); + MOZ_ASSERT(pc->sc->isFunctionBox()); + MOZ_ASSERT(!pc->funHasReturnExpr && !pc->funHasReturnVoid); #ifdef DEBUG uint32_t startYieldOffset = pc->lastYieldOffset; @@ -996,8 +996,8 @@ Parser::functionBody(FunctionSyntaxKind kind, FunctionBodyType typ if (!pn) return null(); } else { - JS_ASSERT(type == ExpressionBody); - JS_ASSERT(JS_HAS_EXPR_CLOSURES); + MOZ_ASSERT(type == ExpressionBody); + MOZ_ASSERT(JS_HAS_EXPR_CLOSURES); Node kid = assignExpr(); if (!kid) @@ -1010,12 +1010,12 @@ Parser::functionBody(FunctionSyntaxKind kind, FunctionBodyType typ switch (pc->generatorKind()) { case NotGenerator: - JS_ASSERT(pc->lastYieldOffset == startYieldOffset); + MOZ_ASSERT(pc->lastYieldOffset == startYieldOffset); break; case LegacyGenerator: // FIXME: Catch these errors eagerly, in yieldExpression(). - JS_ASSERT(pc->lastYieldOffset != startYieldOffset); + MOZ_ASSERT(pc->lastYieldOffset != startYieldOffset); if (kind == Arrow) { reportWithOffset(ParseError, false, pc->lastYieldOffset, JSMSG_YIELD_IN_ARROW, js_yield_str); @@ -1030,8 +1030,8 @@ Parser::functionBody(FunctionSyntaxKind kind, FunctionBodyType typ break; case StarGenerator: - JS_ASSERT(kind != Arrow); - JS_ASSERT(type == StatementListBody); + MOZ_ASSERT(kind != Arrow); + MOZ_ASSERT(type == StatementListBody); break; } @@ -1056,8 +1056,8 @@ Parser::makeDefIntoUse(Definition *dn, ParseNode *pn, JSAtom * /* Change all uses of dn to be uses of pn. */ for (ParseNode *pnu = dn->dn_uses; pnu; pnu = pnu->pn_link) { - JS_ASSERT(pnu->isUsed()); - JS_ASSERT(!pnu->isDefn()); + MOZ_ASSERT(pnu->isUsed()); + MOZ_ASSERT(!pnu->isDefn()); pnu->pn_lexdef = (Definition *) pn; pn->pn_dflags |= pnu->pn_dflags & PND_USE2DEF_FLAGS; } @@ -1080,7 +1080,7 @@ Parser::makeDefIntoUse(Definition *dn, ParseNode *pn, JSAtom * * both asserts are valid. */ if (dn->getKind() == PNK_FUNCTION) { - JS_ASSERT(dn->functionIsHoisted()); + MOZ_ASSERT(dn->functionIsHoisted()); pn->dn_uses = dn->pn_link; handler.prepareNodeForMutation(dn); dn->setKind(PNK_NOP); @@ -1105,9 +1105,9 @@ Parser::makeDefIntoUse(Definition *dn, ParseNode *pn, JSAtom * } /* Turn dn into a use of pn. */ - JS_ASSERT(dn->isKind(PNK_NAME)); - JS_ASSERT(dn->isArity(PN_NAME)); - JS_ASSERT(dn->pn_atom == atom); + MOZ_ASSERT(dn->isKind(PNK_NAME)); + MOZ_ASSERT(dn->isArity(PN_NAME)); + MOZ_ASSERT(dn->pn_atom == atom); dn->setOp((js_CodeSpec[dn->getOp()].format & JOF_SET) ? JSOP_SETNAME : JSOP_NAME); dn->setDefn(false); dn->setUsed(true); @@ -1236,7 +1236,7 @@ ConvertDefinitionToNamedLambdaUse(TokenStream &ts, ParseContextpn_cookie.set(ts, pc->staticLevel, 0)) return false; dn->pn_dflags |= PND_BOUND; - JS_ASSERT(dn->kind() == Definition::NAMED_LAMBDA); + MOZ_ASSERT(dn->kind() == Definition::NAMED_LAMBDA); /* * Since 'dn' is a placeholder, it has not been defined in the @@ -1268,14 +1268,14 @@ Parser::leaveFunction(ParseNode *fn, ParseContextblockidGen = pc->blockidGen; FunctionBox *funbox = fn->pn_funbox; - JS_ASSERT(funbox == pc->sc->asFunctionBox()); + MOZ_ASSERT(funbox == pc->sc->asFunctionBox()); /* Propagate unresolved lexical names up to outerpc->lexdeps. */ if (pc->lexdeps->count()) { for (AtomDefnRange r = pc->lexdeps->all(); !r.empty(); r.popFront()) { JSAtom *atom = r.front().key(); Definition *dn = r.front().value().get(); - JS_ASSERT(dn->isPlaceholder()); + MOZ_ASSERT(dn->isPlaceholder()); if (atom == funbox->function()->name() && kind == Expression) { if (!ConvertDefinitionToNamedLambdaUse(tokenStream, pc, funbox, dn)) @@ -1444,7 +1444,7 @@ Parser::defineArg(Node funcpn, HandlePropertyName name, *duplicatedArg = pn; /* ParseContext::define assumes and asserts prevDecl is not in decls. */ - JS_ASSERT(handler.getDefinitionKind(prevDecl) == Definition::ARG); + MOZ_ASSERT(handler.getDefinitionKind(prevDecl) == Definition::ARG); pc->prepareToAddDuplicateArg(name, prevDecl); } @@ -1465,7 +1465,7 @@ Parser::bindDestructuringArg(BindData *data, HandlePropertyName name, Parser *parser) { ParseContext *pc = parser->pc; - JS_ASSERT(pc->sc->isFunctionBox()); + MOZ_ASSERT(pc->sc->isFunctionBox()); if (pc->decls().lookupFirst(name)) { parser->report(ParseError, false, null(), JSMSG_BAD_DUP_ARGS); @@ -1611,7 +1611,7 @@ Parser::functionArguments(FunctionSyntaxKind kind, Node *listp, No // a = expr => body, but both operators are right-associative, so // that would have been parsed as a = (expr => body) instead. // Therefore it's impossible to get here with parenFreeArrow. - JS_ASSERT(!parenFreeArrow); + MOZ_ASSERT(!parenFreeArrow); if (*hasRest) { report(ParseError, false, null(), JSMSG_REST_WITH_DEFAULT); @@ -1677,8 +1677,8 @@ Parser::checkFunctionDefinition(HandlePropertyName funName, * function (thereby avoiding JSOP_DEFFUN and dynamic name lookup). */ if (Definition *dn = pc->decls().lookupFirst(funName)) { - JS_ASSERT(!dn->isUsed()); - JS_ASSERT(dn->isDefn()); + MOZ_ASSERT(!dn->isUsed()); + MOZ_ASSERT(dn->isDefn()); bool throwRedeclarationError = dn->kind() == Definition::CONST || dn->kind() == Definition::LET; @@ -1726,7 +1726,7 @@ Parser::checkFunctionDefinition(HandlePropertyName funName, * put in pc->lexdeps on first forward reference, and recycle pn. */ if (Definition *fn = pc->lexdeps.lookupDefn(funName)) { - JS_ASSERT(fn->isDefn()); + MOZ_ASSERT(fn->isDefn()); fn->setKind(PNK_FUNCTION); fn->setArity(PN_CODE); fn->pn_pos.begin = pn->pn_pos.begin; @@ -1747,7 +1747,7 @@ Parser::checkFunctionDefinition(HandlePropertyName funName, } if (bodyLevel) { - JS_ASSERT(pn->functionIsHoisted()); + MOZ_ASSERT(pn->functionIsHoisted()); JS_ASSERT_IF(pc->sc->isFunctionBox(), !pn->pn_cookie.isFree()); JS_ASSERT_IF(!pc->sc->isFunctionBox(), pn->pn_cookie.isFree()); } else { @@ -1756,8 +1756,8 @@ Parser::checkFunctionDefinition(HandlePropertyName funName, * statements (e.g., functions in an "if" or "while" block) are * dynamically bound when control flow reaches the statement. */ - JS_ASSERT(!pc->sc->strict); - JS_ASSERT(pn->pn_cookie.isFree()); + MOZ_ASSERT(!pc->sc->strict); + MOZ_ASSERT(pn->pn_cookie.isFree()); if (pc->sc->isFunctionBox()) { FunctionBox *funbox = pc->sc->asFunctionBox(); funbox->setMightAliasLocals(); @@ -1802,7 +1802,7 @@ Parser::checkFunctionDefinition(HandlePropertyName funName, // so we can skip over them after accounting for their free variables. if (LazyScript *lazyOuter = handler.lazyOuterFunction()) { JSFunction *fun = handler.nextLazyInnerFunction(); - JS_ASSERT(!fun->isLegacyGenerator()); + MOZ_ASSERT(!fun->isLegacyGenerator()); FunctionBox *funbox = newFunctionBox(pn, fun, pc, Directives(/* strict = */ false), fun->generatorKind()); if (!funbox) @@ -2106,8 +2106,8 @@ Parser::finishFunctionDefinition(ParseNode *pn, FunctionBox *f body->pn_xflags |= PNX_DESTRUCT; } - JS_ASSERT(pn->pn_funbox == funbox); - JS_ASSERT(pn->pn_body->isKind(PNK_ARGSBODY)); + MOZ_ASSERT(pn->pn_funbox == funbox); + MOZ_ASSERT(pn->pn_body->isKind(PNK_ARGSBODY)); pn->pn_body->append(body); pn->pn_body->pn_pos = body->pn_pos; @@ -2140,7 +2140,7 @@ Parser::finishFunctionDefinition(Node pn, FunctionBox *funbo size_t i = 0; for (AtomDefnRange r = pc->lexdeps->all(); !r.empty(); r.popFront()) freeVariables[i++] = LazyScript::FreeVariable(r.front().key()); - JS_ASSERT(i == numFreeVariables); + MOZ_ASSERT(i == numFreeVariables); HeapPtrFunction *innerFunctions = lazy->innerFunctions(); for (size_t i = 0; i < numInnerFunctions; i++) @@ -2281,7 +2281,7 @@ Parser::functionArgsAndBody(Node pn, HandleFunction fun, // This is a lazy function inner to another lazy function. Remember the // inner function so that if the outer function is eventually parsed we do // not need any further parsing or processing of the inner function. - JS_ASSERT(fun->lazyScript()); + MOZ_ASSERT(fun->lazyScript()); return outerpc->innerFunctions.append(fun); } @@ -2327,7 +2327,7 @@ Parser::standaloneLazyFunction(HandleFunction fun, unsigned st return null(); if (!functionArgsAndBodyGeneric(pn, fun, Normal, Statement)) { - JS_ASSERT(directives == newDirectives); + MOZ_ASSERT(directives == newDirectives); return null(); } @@ -2445,7 +2445,7 @@ template typename ParseHandler::Node Parser::functionStmt() { - JS_ASSERT(tokenStream.isCurrentTokenType(TOK_FUNCTION)); + MOZ_ASSERT(tokenStream.isCurrentTokenType(TOK_FUNCTION)); RootedPropertyName name(context); GeneratorKind generatorKind = NotGenerator; @@ -2482,7 +2482,7 @@ template typename ParseHandler::Node Parser::functionExpr() { - JS_ASSERT(tokenStream.isCurrentTokenType(TOK_FUNCTION)); + MOZ_ASSERT(tokenStream.isCurrentTokenType(TOK_FUNCTION)); GeneratorKind generatorKind = NotGenerator; TokenKind tt = tokenStream.getToken(); @@ -2916,7 +2916,7 @@ static void PopStatementPC(TokenStream &ts, ParseContext *pc) { RootedNestedScopeObject scopeObj(ts.context(), pc->topStmt->staticScope); - JS_ASSERT(!!scopeObj == pc->topStmt->isNestedScope); + MOZ_ASSERT(!!scopeObj == pc->topStmt->isNestedScope); AccumulateBlockScopeDepth(pc); FinishPopStatement(pc); @@ -2924,7 +2924,7 @@ PopStatementPC(TokenStream &ts, ParseContext *pc) if (scopeObj) { if (scopeObj->is()) { RootedStaticBlockObject blockObj(ts.context(), &scopeObj->as()); - JS_ASSERT(!blockObj->inDictionaryMode()); + MOZ_ASSERT(!blockObj->inDictionaryMode()); ForEachLetDef(ts, pc, blockObj, PopLetDecl()); } scopeObj->resetEnclosingNestedScopeFromParser(); @@ -3089,11 +3089,11 @@ template <> bool Parser::makeSetCall(ParseNode *pn, unsigned msg) { - JS_ASSERT(pn->isKind(PNK_CALL)); - JS_ASSERT(pn->isArity(PN_LIST)); - JS_ASSERT(pn->isOp(JSOP_CALL) || pn->isOp(JSOP_SPREADCALL) || - pn->isOp(JSOP_EVAL) || pn->isOp(JSOP_SPREADEVAL) || - pn->isOp(JSOP_FUNCALL) || pn->isOp(JSOP_FUNAPPLY)); + MOZ_ASSERT(pn->isKind(PNK_CALL)); + MOZ_ASSERT(pn->isArity(PN_LIST)); + MOZ_ASSERT(pn->isOp(JSOP_CALL) || pn->isOp(JSOP_SPREADCALL) || + pn->isOp(JSOP_EVAL) || pn->isOp(JSOP_SPREADEVAL) || + pn->isOp(JSOP_FUNCALL) || pn->isOp(JSOP_FUNAPPLY)); if (!report(ParseStrictError, pc->sc->strict, pn, msg)) return false; @@ -3156,7 +3156,7 @@ template <> bool Parser::bindDestructuringVar(BindData *data, ParseNode *pn) { - JS_ASSERT(pn->isKind(PNK_NAME)); + MOZ_ASSERT(pn->isKind(PNK_NAME)); RootedPropertyName name(context, pn->pn_atom->asPropertyName()); @@ -3331,7 +3331,7 @@ template typename ParseHandler::Node Parser::destructuringExpr(BindData *data, TokenKind tt) { - JS_ASSERT(tokenStream.isCurrentTokenType(tt)); + MOZ_ASSERT(tokenStream.isCurrentTokenType(tt)); pc->inDeclDestructuring = true; Node pn = primaryExpr(tt); @@ -3347,7 +3347,7 @@ template typename ParseHandler::Node Parser::pushLexicalScope(HandleStaticBlockObject blockObj, StmtInfoPC *stmt) { - JS_ASSERT(blockObj); + MOZ_ASSERT(blockObj); ObjectBox *blockbox = newObjectBox(blockObj); if (!blockbox) @@ -3399,7 +3399,7 @@ template <> ParseNode * Parser::pushLetScope(HandleStaticBlockObject blockObj, StmtInfoPC *stmt) { - JS_ASSERT(blockObj); + MOZ_ASSERT(blockObj); ParseNode *pn = pushLexicalScope(blockObj, stmt); if (!pn) return null(); @@ -3430,7 +3430,7 @@ template typename ParseHandler::Node Parser::letBlock(LetContext letContext) { - JS_ASSERT(tokenStream.isCurrentTokenType(TOK_LET)); + MOZ_ASSERT(tokenStream.isCurrentTokenType(TOK_LET)); RootedStaticBlockObject blockObj(context, StaticBlockObject::create(context)); if (!blockObj) @@ -3488,7 +3488,7 @@ Parser::letBlock(LetContext letContext) return null(); MUST_MATCH_TOKEN(TOK_RC, JSMSG_CURLY_AFTER_LET); } else { - JS_ASSERT(letContext == LetExpresion); + MOZ_ASSERT(letContext == LetExpresion); expr = assignExpr(); if (!expr) return null(); @@ -3519,7 +3519,7 @@ template typename ParseHandler::Node Parser::blockStatement() { - JS_ASSERT(tokenStream.isCurrentTokenType(TOK_LC)); + MOZ_ASSERT(tokenStream.isCurrentTokenType(TOK_LC)); StmtInfoPC stmtInfo(context); if (!PushBlocklikeStatement(tokenStream, &stmtInfo, STMT_BLOCK, pc)) @@ -3548,7 +3548,7 @@ Parser::newBindingNode(PropertyName *name, bool functionScope, Var if (varContext == HoistVars) { if (AtomDefnPtr p = pc->lexdeps->lookup(name)) { DefinitionNode lexdep = p.value().get(); - JS_ASSERT(handler.getDefinitionKind(lexdep) == Definition::PLACEHOLDER); + MOZ_ASSERT(handler.getDefinitionKind(lexdep) == Definition::PLACEHOLDER); Node pn = handler.getDefinitionNode(lexdep); if (handler.dependencyCovered(pn, pc->blockid(), functionScope)) { @@ -3581,7 +3581,7 @@ Parser::variables(ParseNodeKind kind, bool *psimple, * - PNK_LET: We are parsing a let declaration. * - PNK_CALL: We are parsing the head of a let block. */ - JS_ASSERT(kind == PNK_VAR || kind == PNK_CONST || kind == PNK_LET || kind == PNK_CALL); + MOZ_ASSERT(kind == PNK_VAR || kind == PNK_CONST || kind == PNK_LET || kind == PNK_CALL); /* * The simple flag is set if the declaration has the form 'var x', with @@ -3739,7 +3739,7 @@ Parser::letDeclaration() } if (stmt && stmt->isBlockScope) { - JS_ASSERT(pc->staticScope == stmt->staticScope); + MOZ_ASSERT(pc->staticScope == stmt->staticScope); } else { if (pc->atBodyLevel()) { /* @@ -3785,13 +3785,13 @@ Parser::letDeclaration() * situation. This stmt is not yet a scope, so it must not be a * catch block (catch is a lexical scope by definition). */ - JS_ASSERT(!stmt->isBlockScope); - JS_ASSERT(stmt != pc->topScopeStmt); - JS_ASSERT(stmt->type == STMT_BLOCK || - stmt->type == STMT_SWITCH || - stmt->type == STMT_TRY || - stmt->type == STMT_FINALLY); - JS_ASSERT(!stmt->downScope); + MOZ_ASSERT(!stmt->isBlockScope); + MOZ_ASSERT(stmt != pc->topScopeStmt); + MOZ_ASSERT(stmt->type == STMT_BLOCK || + stmt->type == STMT_SWITCH || + stmt->type == STMT_TRY || + stmt->type == STMT_FINALLY); + MOZ_ASSERT(!stmt->downScope); /* Convert the block statement into a scope statement. */ StaticBlockObject *blockObj = StaticBlockObject::create(context); @@ -3818,7 +3818,7 @@ Parser::letDeclaration() #ifdef DEBUG ParseNode *tmp = pc->blockNode; - JS_ASSERT(!tmp || !tmp->isKind(PNK_LEXICALSCOPE)); + MOZ_ASSERT(!tmp || !tmp->isKind(PNK_LEXICALSCOPE)); #endif /* Create a new lexical scope node for these statements. */ @@ -3879,7 +3879,7 @@ template typename ParseHandler::Node Parser::importDeclaration() { - JS_ASSERT(tokenStream.currentToken().type == TOK_IMPORT); + MOZ_ASSERT(tokenStream.currentToken().type == TOK_IMPORT); if (pc->sc->isFunctionBox() || !pc->atBodyLevel()) { report(ParseError, false, null(), JSMSG_IMPORT_DECL_AT_TOP_LEVEL); @@ -4007,7 +4007,7 @@ template typename ParseHandler::Node Parser::exportDeclaration() { - JS_ASSERT(tokenStream.currentToken().type == TOK_EXPORT); + MOZ_ASSERT(tokenStream.currentToken().type == TOK_EXPORT); if (pc->sc->isFunctionBox() || !pc->atBodyLevel()) { report(ParseError, false, null(), JSMSG_EXPORT_DECL_AT_TOP_LEVEL); @@ -4297,7 +4297,7 @@ template <> ParseNode * Parser::forStatement() { - JS_ASSERT(tokenStream.isCurrentTokenType(TOK_FOR)); + MOZ_ASSERT(tokenStream.isCurrentTokenType(TOK_FOR)); uint32_t begin = pos().begin; StmtInfoPC forStmt(context); @@ -4371,7 +4371,7 @@ Parser::forStatement() } JS_ASSERT_IF(isForDecl, pn1->isArity(PN_LIST)); - JS_ASSERT(!!blockObj == (isForDecl && pn1->isOp(JSOP_NOP))); + MOZ_ASSERT(!!blockObj == (isForDecl && pn1->isOp(JSOP_NOP))); // The form 'for (let ; ; ) ' generates an // implicit block even if stmt is not a BlockStatement. @@ -4467,13 +4467,13 @@ Parser::forStatement() if (pn2->isKind(PNK_ASSIGN)) { pn2 = pn2->pn_left; - JS_ASSERT(pn2->isKind(PNK_ARRAY) || pn2->isKind(PNK_OBJECT) || - pn2->isKind(PNK_NAME)); + MOZ_ASSERT(pn2->isKind(PNK_ARRAY) || pn2->isKind(PNK_OBJECT) || + pn2->isKind(PNK_NAME)); } } } else { /* Not a declaration. */ - JS_ASSERT(!blockObj); + MOZ_ASSERT(!blockObj); pn2 = pn1; pn1 = nullptr; @@ -4629,7 +4629,7 @@ Parser::forStatement() * parsing of 'for' statements is thus done separately, and only handles * the types of 'for' statements likely to be seen in web content. */ - JS_ASSERT(tokenStream.isCurrentTokenType(TOK_FOR)); + MOZ_ASSERT(tokenStream.isCurrentTokenType(TOK_FOR)); StmtInfoPC forStmt(context); PushStatementPC(pc, &forStmt, STMT_FOR_LOOP); @@ -4740,7 +4740,7 @@ template typename ParseHandler::Node Parser::switchStatement() { - JS_ASSERT(tokenStream.isCurrentTokenType(TOK_SWITCH)); + MOZ_ASSERT(tokenStream.isCurrentTokenType(TOK_SWITCH)); uint32_t begin = pos().begin; MUST_MATCH_TOKEN(TOK_LP, JSMSG_PAREN_BEFORE_SWITCH); @@ -4851,7 +4851,7 @@ template typename ParseHandler::Node Parser::continueStatement() { - JS_ASSERT(tokenStream.isCurrentTokenType(TOK_CONTINUE)); + MOZ_ASSERT(tokenStream.isCurrentTokenType(TOK_CONTINUE)); uint32_t begin = pos().begin; RootedPropertyName label(context); @@ -4898,7 +4898,7 @@ template typename ParseHandler::Node Parser::breakStatement() { - JS_ASSERT(tokenStream.isCurrentTokenType(TOK_BREAK)); + MOZ_ASSERT(tokenStream.isCurrentTokenType(TOK_BREAK)); uint32_t begin = pos().begin; RootedPropertyName label(context); @@ -4935,7 +4935,7 @@ template typename ParseHandler::Node Parser::returnStatement() { - JS_ASSERT(tokenStream.isCurrentTokenType(TOK_RETURN)); + MOZ_ASSERT(tokenStream.isCurrentTokenType(TOK_RETURN)); uint32_t begin = pos().begin; if (!pc->sc->isFunctionBox()) { @@ -4986,13 +4986,13 @@ template typename ParseHandler::Node Parser::yieldExpression() { - JS_ASSERT(tokenStream.isCurrentTokenType(TOK_YIELD)); + MOZ_ASSERT(tokenStream.isCurrentTokenType(TOK_YIELD)); uint32_t begin = pos().begin; switch (pc->generatorKind()) { case StarGenerator: { - JS_ASSERT(pc->sc->isFunctionBox()); + MOZ_ASSERT(pc->sc->isFunctionBox()); pc->lastYieldOffset = begin; @@ -5033,8 +5033,8 @@ Parser::yieldExpression() case NotGenerator: // We are in code that has not seen a yield, but we are in JS 1.7 or // later. Try to transition to being a legacy generator. - JS_ASSERT(tokenStream.versionNumber() >= JSVERSION_1_7); - JS_ASSERT(pc->lastYieldOffset == ParseContext::NoYieldOffset); + MOZ_ASSERT(tokenStream.versionNumber() >= JSVERSION_1_7); + MOZ_ASSERT(pc->lastYieldOffset == ParseContext::NoYieldOffset); if (!abortIfSyntaxParser()) return null(); @@ -5059,7 +5059,7 @@ Parser::yieldExpression() { // We are in a legacy generator: a function that has already seen a // yield, or in a legacy generator comprehension. - JS_ASSERT(pc->sc->isFunctionBox()); + MOZ_ASSERT(pc->sc->isFunctionBox()); pc->lastYieldOffset = begin; @@ -5104,7 +5104,7 @@ Parser::withStatement() return null(); } - JS_ASSERT(tokenStream.isCurrentTokenType(TOK_WITH)); + MOZ_ASSERT(tokenStream.isCurrentTokenType(TOK_WITH)); uint32_t begin = pos().begin; // In most cases, we want the constructs forbidden in strict mode code to be @@ -5199,7 +5199,7 @@ template typename ParseHandler::Node Parser::throwStatement() { - JS_ASSERT(tokenStream.isCurrentTokenType(TOK_THROW)); + MOZ_ASSERT(tokenStream.isCurrentTokenType(TOK_THROW)); uint32_t begin = pos().begin; /* ECMA-262 Edition 3 says 'throw [no LineTerminator here] Expr'. */ @@ -5229,7 +5229,7 @@ template typename ParseHandler::Node Parser::tryStatement() { - JS_ASSERT(tokenStream.isCurrentTokenType(TOK_TRY)); + MOZ_ASSERT(tokenStream.isCurrentTokenType(TOK_TRY)); uint32_t begin = pos().begin; /* @@ -5303,7 +5303,7 @@ Parser::tryStatement() */ data.initLet(HoistVars, &pc->staticScope->template as(), JSMSG_TOO_MANY_CATCH_VARS); - JS_ASSERT(data.let.blockObj); + MOZ_ASSERT(data.let.blockObj); tt = tokenStream.getToken(); Node catchName; @@ -5563,8 +5563,8 @@ static const JSOp ParseNodeKindToJSOp[] = { static inline JSOp BinaryOpParseNodeKindToJSOp(ParseNodeKind pnk) { - JS_ASSERT(pnk >= PNK_BINOP_FIRST); - JS_ASSERT(pnk <= PNK_BINOP_LAST); + MOZ_ASSERT(pnk >= PNK_BINOP_FIRST); + MOZ_ASSERT(pnk <= PNK_BINOP_LAST); return ParseNodeKindToJSOp[pnk - PNK_BINOP_FIRST]; } @@ -5577,7 +5577,7 @@ IsBinaryOpToken(TokenKind tok, bool parsingForInit) static ParseNodeKind BinaryOpTokenKindToParseNodeKind(TokenKind tok) { - JS_ASSERT(TokenKindIsBinaryOp(tok)); + MOZ_ASSERT(TokenKindIsBinaryOp(tok)); return ParseNodeKind(PNK_BINOP_FIRST + (tok - TOK_BINOP_FIRST)); } @@ -5617,8 +5617,8 @@ Precedence(ParseNodeKind pnk) { if (pnk == PNK_LIMIT) return 0; - JS_ASSERT(pnk >= PNK_BINOP_FIRST); - JS_ASSERT(pnk <= PNK_BINOP_LAST); + MOZ_ASSERT(pnk >= PNK_BINOP_FIRST); + MOZ_ASSERT(pnk <= PNK_BINOP_LAST); return PrecedenceTable[pnk - PNK_BINOP_FIRST]; } @@ -5680,10 +5680,10 @@ Parser::orExpr1() nodeStack[depth] = pn; kindStack[depth] = pnk; depth++; - JS_ASSERT(depth <= PRECEDENCE_CLASSES); + MOZ_ASSERT(depth <= PRECEDENCE_CLASSES); } - JS_ASSERT(depth == 0); + MOZ_ASSERT(depth == 0); pc->parsingForInit = oldParsingForInit; return pn; } @@ -5857,7 +5857,7 @@ Parser::assignExpr() } default: - JS_ASSERT(!tokenStream.isCurrentTokenAssignment()); + MOZ_ASSERT(!tokenStream.isCurrentTokenAssignment()); tokenStream.ungetToken(); return lhs; } @@ -6063,7 +6063,7 @@ BumpStaticLevel(TokenStream &ts, ParseNode *pn, ParseContext *pc) return true; unsigned level = unsigned(pn->pn_cookie.level()) + 1; - JS_ASSERT(level >= pc->staticLevel); + MOZ_ASSERT(level >= pc->staticLevel); return pn->pn_cookie.set(ts, level, pn->pn_cookie.slot()); } @@ -6071,7 +6071,7 @@ template static bool AdjustBlockId(TokenStream &ts, ParseNode *pn, unsigned adjust, ParseContext *pc) { - JS_ASSERT(pn->isArity(PN_LIST) || pn->isArity(PN_CODE) || pn->isArity(PN_NAME)); + MOZ_ASSERT(pn->isArity(PN_LIST) || pn->isArity(PN_CODE) || pn->isArity(PN_NAME)); if (BlockIdLimit - pn->pn_blockid <= adjust + 1) { ts.reportError(JSMSG_NEED_DIET, "program"); return false; @@ -6137,10 +6137,10 @@ LegacyCompExprTransplanter::transplant(ParseNode *pn) if (isGenexp && !BumpStaticLevel(parser->tokenStream, pn, pc)) return false; } else if (pn->isUsed()) { - JS_ASSERT(pn->pn_cookie.isFree()); + MOZ_ASSERT(pn->pn_cookie.isFree()); Definition *dn = pn->pn_lexdef; - JS_ASSERT(dn->isDefn()); + MOZ_ASSERT(dn->isDefn()); /* * Adjust the definition's block id only if it is a placeholder not @@ -6161,10 +6161,10 @@ LegacyCompExprTransplanter::transplant(ParseNode *pn) RootedAtom atom(parser->context, pn->pn_atom); #ifdef DEBUG StmtInfoPC *stmt = LexicalLookup(pc, atom, nullptr, (StmtInfoPC *)nullptr); - JS_ASSERT(!stmt || stmt != pc->topStmt); + MOZ_ASSERT(!stmt || stmt != pc->topStmt); #endif if (isGenexp && !dn->isOp(JSOP_CALLEE)) { - JS_ASSERT(!pc->decls().lookupFirst(atom)); + MOZ_ASSERT(!pc->decls().lookupFirst(atom)); if (dn->pn_pos < root->pn_pos) { /* @@ -6302,12 +6302,12 @@ Parser::legacyComprehensionTail(ParseNode *bodyStmt, unsigned BindData data(context); TokenKind tt; - JS_ASSERT(tokenStream.isCurrentTokenType(TOK_FOR)); + MOZ_ASSERT(tokenStream.isCurrentTokenType(TOK_FOR)); bool isGenexp = comprehensionKind != NotGenerator; if (isGenexp) { - JS_ASSERT(comprehensionKind == LegacyGenerator); + MOZ_ASSERT(comprehensionKind == LegacyGenerator); /* * Generator expression desugars to an immediately applied lambda that * yields the next value from a for-in loop (possibly nested, and with @@ -6335,11 +6335,11 @@ Parser::legacyComprehensionTail(ParseNode *bodyStmt, unsigned if (!pn) return null(); - JS_ASSERT(blockid <= pn->pn_blockid); - JS_ASSERT(blockid < pc->blockidGen); - JS_ASSERT(pc->bodyid < blockid); + MOZ_ASSERT(blockid <= pn->pn_blockid); + MOZ_ASSERT(blockid < pc->blockidGen); + MOZ_ASSERT(pc->bodyid < blockid); pn->pn_blockid = stmtInfo.blockid = blockid; - JS_ASSERT(adjust < blockid); + MOZ_ASSERT(adjust < blockid); adjust = blockid - adjust; } @@ -6354,7 +6354,7 @@ Parser::legacyComprehensionTail(ParseNode *bodyStmt, unsigned if (!transplanter.transplant(bodyStmt)) return null(); - JS_ASSERT(pc->staticScope && pc->staticScope == pn->pn_objbox->object); + MOZ_ASSERT(pc->staticScope && pc->staticScope == pn->pn_objbox->object); data.initLet(HoistVars, &pc->staticScope->as(), JSMSG_ARRAY_INIT_TOO_BIG); do { @@ -6417,7 +6417,7 @@ Parser::legacyComprehensionTail(ParseNode *bodyStmt, unsigned ParseNodeKind headKind = PNK_FORIN; if (isForOf) { if (pn2->pn_iflags != JSITER_ENUMERATE) { - JS_ASSERT(pn2->pn_iflags == (JSITER_FOREACH | JSITER_ENUMERATE)); + MOZ_ASSERT(pn2->pn_iflags == (JSITER_FOREACH | JSITER_ENUMERATE)); report(ParseError, false, null(), JSMSG_BAD_FOR_EACH_LOOP); return null(); } @@ -6452,9 +6452,9 @@ Parser::legacyComprehensionTail(ParseNode *bodyStmt, unsigned return null(); } - JS_ASSERT(pn2->isOp(JSOP_ITER)); - JS_ASSERT(pn2->pn_iflags & JSITER_ENUMERATE); - JS_ASSERT(headKind == PNK_FORIN); + MOZ_ASSERT(pn2->isOp(JSOP_ITER)); + MOZ_ASSERT(pn2->pn_iflags & JSITER_ENUMERATE); + MOZ_ASSERT(headKind == PNK_FORIN); pn2->pn_iflags |= JSITER_FOREACH | JSITER_KEYVALUE; } break; @@ -6537,7 +6537,7 @@ Parser::legacyArrayComprehension(ParseNode *array) // Remove the single element from array's linked list, leaving us with an // empty array literal and a comprehension expression. - JS_ASSERT(array->pn_count == 1); + MOZ_ASSERT(array->pn_count == 1); ParseNode *bodyExpr = array->last(); array->pn_count = 0; array->pn_tail = &array->pn_head; @@ -6573,8 +6573,8 @@ typename ParseHandler::Node Parser::generatorComprehensionLambda(GeneratorKind comprehensionKind, unsigned begin, Node innerStmt) { - JS_ASSERT(comprehensionKind == LegacyGenerator || comprehensionKind == StarGenerator); - JS_ASSERT(!!innerStmt == (comprehensionKind == LegacyGenerator)); + MOZ_ASSERT(comprehensionKind == LegacyGenerator || comprehensionKind == StarGenerator); + MOZ_ASSERT(!!innerStmt == (comprehensionKind == LegacyGenerator)); Node genfn = handler.newFunctionDefinition(); if (!genfn) @@ -6621,7 +6621,7 @@ Parser::generatorComprehensionLambda(GeneratorKind comprehensionKi if (outerpc->sc->isFunctionBox()) genFunbox->funCxFlags = outerpc->sc->asFunctionBox()->funCxFlags; - JS_ASSERT(genFunbox->generatorKind() == comprehensionKind); + MOZ_ASSERT(genFunbox->generatorKind() == comprehensionKind); genFunbox->inGenexpLambda = true; handler.setBlockId(genfn, genpc.bodyid); @@ -6632,7 +6632,7 @@ Parser::generatorComprehensionLambda(GeneratorKind comprehensionKi if (!body) return null(); } else { - JS_ASSERT(comprehensionKind == LegacyGenerator); + MOZ_ASSERT(comprehensionKind == LegacyGenerator); body = legacyComprehensionTail(innerStmt, outerpc->blockid(), LegacyGenerator, outerpc, LegacyComprehensionHeadBlockScopeDepth(outerpc)); if (!body) @@ -6682,7 +6682,7 @@ template <> ParseNode * Parser::legacyGeneratorExpr(ParseNode *expr) { - JS_ASSERT(tokenStream.isCurrentTokenType(TOK_FOR)); + MOZ_ASSERT(tokenStream.isCurrentTokenType(TOK_FOR)); /* Create a |yield| node for |kid|. */ ParseNode *yieldExpr = handler.newUnary(PNK_YIELD, JSOP_NOP, expr->pn_pos.begin, expr); @@ -6729,7 +6729,7 @@ template typename ParseHandler::Node Parser::comprehensionFor(GeneratorKind comprehensionKind) { - JS_ASSERT(tokenStream.isCurrentTokenType(TOK_FOR)); + MOZ_ASSERT(tokenStream.isCurrentTokenType(TOK_FOR)); uint32_t begin = pos().begin; @@ -6800,7 +6800,7 @@ template typename ParseHandler::Node Parser::comprehensionIf(GeneratorKind comprehensionKind) { - JS_ASSERT(tokenStream.isCurrentTokenType(TOK_IF)); + MOZ_ASSERT(tokenStream.isCurrentTokenType(TOK_IF)); uint32_t begin = pos().begin; @@ -6845,7 +6845,7 @@ Parser::comprehensionTail(GeneratorKind comprehensionKind) if (comprehensionKind == NotGenerator) return handler.newUnary(PNK_ARRAYPUSH, JSOP_ARRAYPUSH, begin, bodyExpr); - JS_ASSERT(comprehensionKind == StarGenerator); + MOZ_ASSERT(comprehensionKind == StarGenerator); Node yieldExpr = handler.newUnary(PNK_YIELD, JSOP_NOP, begin, bodyExpr); if (!yieldExpr) return null(); @@ -6860,7 +6860,7 @@ template typename ParseHandler::Node Parser::comprehension(GeneratorKind comprehensionKind) { - JS_ASSERT(tokenStream.isCurrentTokenType(TOK_FOR)); + MOZ_ASSERT(tokenStream.isCurrentTokenType(TOK_FOR)); uint32_t startYieldOffset = pc->lastYieldOffset; @@ -6901,7 +6901,7 @@ template typename ParseHandler::Node Parser::generatorComprehension(uint32_t begin) { - JS_ASSERT(tokenStream.isCurrentTokenType(TOK_FOR)); + MOZ_ASSERT(tokenStream.isCurrentTokenType(TOK_FOR)); // We have no problem parsing generator comprehensions inside lazy // functions, but the bytecode emitter currently can't handle them that way, @@ -7005,7 +7005,7 @@ template typename ParseHandler::Node Parser::memberExpr(TokenKind tt, bool allowCallSyntax) { - JS_ASSERT(tokenStream.isCurrentTokenType(tt)); + MOZ_ASSERT(tokenStream.isCurrentTokenType(tt)); Node lhs; @@ -7199,7 +7199,7 @@ template typename ParseHandler::Node Parser::arrayInitializer() { - JS_ASSERT(tokenStream.isCurrentTokenType(TOK_LB)); + MOZ_ASSERT(tokenStream.isCurrentTokenType(TOK_LB)); uint32_t begin = pos().begin; Node literal = handler.newArrayLiteral(begin, pc->blockidGen); @@ -7352,7 +7352,7 @@ template typename ParseHandler::Node Parser::objectLiteral() { - JS_ASSERT(tokenStream.isCurrentTokenType(TOK_LC)); + MOZ_ASSERT(tokenStream.isCurrentTokenType(TOK_LC)); Node literal = handler.newObjectLiteral(pos().begin); if (!literal) @@ -7458,7 +7458,7 @@ Parser::objectLiteral() break; } - JS_ASSERT(op == JSOP_INITPROP_GETTER || op == JSOP_INITPROP_SETTER); + MOZ_ASSERT(op == JSOP_INITPROP_GETTER || op == JSOP_INITPROP_SETTER); break; } @@ -7536,7 +7536,7 @@ Parser::objectLiteral() if (!tokenStream.checkForKeyword(atom, nullptr)) return null(); PropertyName *name = handler.isName(propname); - JS_ASSERT(atom); + MOZ_ASSERT(atom); propname = newName(name); if (!propname) return null(); @@ -7598,7 +7598,7 @@ template typename ParseHandler::Node Parser::primaryExpr(TokenKind tt) { - JS_ASSERT(tokenStream.isCurrentTokenType(tt)); + MOZ_ASSERT(tokenStream.isCurrentTokenType(tt)); JS_CHECK_RECURSION(context, return null()); switch (tt) { @@ -7722,7 +7722,7 @@ template typename ParseHandler::Node Parser::parenExprOrGeneratorComprehension() { - JS_ASSERT(tokenStream.isCurrentTokenType(TOK_LP)); + MOZ_ASSERT(tokenStream.isCurrentTokenType(TOK_LP)); uint32_t begin = pos().begin; uint32_t startYieldOffset = pc->lastYieldOffset; @@ -7798,7 +7798,7 @@ template typename ParseHandler::Node Parser::exprInParens() { - JS_ASSERT(tokenStream.isCurrentTokenType(TOK_LP)); + MOZ_ASSERT(tokenStream.isCurrentTokenType(TOK_LP)); uint32_t begin = pos().begin; uint32_t startYieldOffset = pc->lastYieldOffset; diff --git a/js/src/frontend/Parser.h b/js/src/frontend/Parser.h index de25b7b22ada..909fc5215deb 100644 --- a/js/src/frontend/Parser.h +++ b/js/src/frontend/Parser.h @@ -153,7 +153,7 @@ struct ParseContext : public GenericParseContext } uint32_t numArgs() const { - JS_ASSERT(sc->isFunctionBox()); + MOZ_ASSERT(sc->isFunctionBox()); return args_.length(); } diff --git a/js/src/frontend/SharedContext.h b/js/src/frontend/SharedContext.h index ff4b7ea480cc..f3657e96fb1c 100644 --- a/js/src/frontend/SharedContext.h +++ b/js/src/frontend/SharedContext.h @@ -227,7 +227,7 @@ class GlobalSharedContext : public SharedContext inline GlobalSharedContext * SharedContext::asGlobalSharedContext() { - JS_ASSERT(isGlobalSharedContext()); + MOZ_ASSERT(isGlobalSharedContext()); return static_cast(this); } @@ -271,7 +271,7 @@ class FunctionBox : public ObjectBox, public SharedContext // A generator kind can be set at initialization, or when "yield" is // first seen. In both cases the transition can only happen from // NotGenerator. - JS_ASSERT(!isGenerator()); + MOZ_ASSERT(!isGenerator()); generatorKindBits_ = GeneratorKindAsBits(kind); } @@ -285,7 +285,7 @@ class FunctionBox : public ObjectBox, public SharedContext void setHasExtensibleScope() { funCxFlags.hasExtensibleScope = true; } void setNeedsDeclEnvObject() { funCxFlags.needsDeclEnvObject = true; } void setArgumentsHasLocalBinding() { funCxFlags.argumentsHasLocalBinding = true; } - void setDefinitelyNeedsArgsObj() { JS_ASSERT(funCxFlags.argumentsHasLocalBinding); + void setDefinitelyNeedsArgsObj() { MOZ_ASSERT(funCxFlags.argumentsHasLocalBinding); funCxFlags.definitelyNeedsArgsObj = true; } bool hasDefaults() const { @@ -320,7 +320,7 @@ class FunctionBox : public ObjectBox, public SharedContext inline FunctionBox * SharedContext::asFunctionBox() { - JS_ASSERT(isFunctionBox()); + MOZ_ASSERT(isFunctionBox()); return static_cast(this); } @@ -431,8 +431,8 @@ struct StmtInfoBase { } StaticBlockObject& staticBlock() const { - JS_ASSERT(isNestedScope); - JS_ASSERT(isBlockScope); + MOZ_ASSERT(isNestedScope); + MOZ_ASSERT(isBlockScope); return staticScope->as(); } @@ -489,7 +489,7 @@ FinishPopStatement(ContextT *ct) if (stmt->linksScope()) { ct->topScopeStmt = stmt->downScope; if (stmt->isNestedScope) { - JS_ASSERT(stmt->staticScope); + MOZ_ASSERT(stmt->staticScope); ct->staticScope = stmt->staticScope->enclosingNestedScope(); } } diff --git a/js/src/frontend/TokenStream.cpp b/js/src/frontend/TokenStream.cpp index d8e8448f1c89..a35d3cf28134 100644 --- a/js/src/frontend/TokenStream.cpp +++ b/js/src/frontend/TokenStream.cpp @@ -57,7 +57,7 @@ template static const KeywordInfo * FindKeyword(const CharT *s, size_t length) { - JS_ASSERT(length != 0); + MOZ_ASSERT(length != 0); size_t i; const KeywordInfo *kw; @@ -149,7 +149,7 @@ TokenStream::SourceCoords::SourceCoords(ExclusiveContext *cx, uint32_t ln) // The first line begins at buffer offset 0. MAX_PTR is the sentinel. The // appends cannot fail because |lineStartOffsets_| has statically-allocated // elements. - JS_ASSERT(lineStartOffsets_.capacity() >= 2); + MOZ_ASSERT(lineStartOffsets_.capacity() >= 2); (void)lineStartOffsets_.reserve(2); lineStartOffsets_.infallibleAppend(0); lineStartOffsets_.infallibleAppend(maxPtr); @@ -161,7 +161,7 @@ TokenStream::SourceCoords::add(uint32_t lineNum, uint32_t lineStartOffset) uint32_t lineIndex = lineNumToIndex(lineNum); uint32_t sentinelIndex = lineStartOffsets_.length() - 1; - JS_ASSERT(lineStartOffsets_[0] == 0 && lineStartOffsets_[sentinelIndex] == MAX_PTR); + MOZ_ASSERT(lineStartOffsets_[0] == 0 && lineStartOffsets_[sentinelIndex] == MAX_PTR); if (lineIndex == sentinelIndex) { // We haven't seen this newline before. Update lineStartOffsets_. @@ -177,15 +177,15 @@ TokenStream::SourceCoords::add(uint32_t lineNum, uint32_t lineStartOffset) } else { // We have seen this newline before (and ungot it). Do nothing (other // than checking it hasn't mysteriously changed). - JS_ASSERT(lineStartOffsets_[lineIndex] == lineStartOffset); + MOZ_ASSERT(lineStartOffsets_[lineIndex] == lineStartOffset); } } MOZ_ALWAYS_INLINE bool TokenStream::SourceCoords::fill(const TokenStream::SourceCoords &other) { - JS_ASSERT(lineStartOffsets_.back() == MAX_PTR); - JS_ASSERT(other.lineStartOffsets_.back() == MAX_PTR); + MOZ_ASSERT(lineStartOffsets_.back() == MAX_PTR); + MOZ_ASSERT(other.lineStartOffsets_.back() == MAX_PTR); if (lineStartOffsets_.length() >= other.lineStartOffsets_.length()) return true; @@ -227,7 +227,7 @@ TokenStream::SourceCoords::lineIndexOf(uint32_t offset) const // No luck. Oh well, we have a better-than-default starting point for // the binary search. iMin = lastLineIndex_ + 1; - JS_ASSERT(iMin < lineStartOffsets_.length() - 1); // -1 due to the sentinel + MOZ_ASSERT(iMin < lineStartOffsets_.length() - 1); // -1 due to the sentinel } else { iMin = 0; @@ -245,8 +245,8 @@ TokenStream::SourceCoords::lineIndexOf(uint32_t offset) const else iMax = iMid; // offset is below or within lineStartOffsets_[iMid] } - JS_ASSERT(iMax == iMin); - JS_ASSERT(lineStartOffsets_[iMin] <= offset && offset < lineStartOffsets_[iMin + 1]); + MOZ_ASSERT(iMax == iMin); + MOZ_ASSERT(lineStartOffsets_[iMin] <= offset && offset < lineStartOffsets_[iMin + 1]); lastLineIndex_ = iMin; return iMin; } @@ -263,7 +263,7 @@ TokenStream::SourceCoords::columnIndex(uint32_t offset) const { uint32_t lineIndex = lineIndexOf(offset); uint32_t lineStartOffset = lineStartOffsets_[lineIndex]; - JS_ASSERT(offset >= lineStartOffset); + MOZ_ASSERT(offset >= lineStartOffset); return offset - lineStartOffset; } @@ -274,7 +274,7 @@ TokenStream::SourceCoords::lineNumAndColumnIndex(uint32_t offset, uint32_t *line uint32_t lineIndex = lineIndexOf(offset); *lineNum = lineIndexToNum(lineIndex); uint32_t lineStartOffset = lineStartOffsets_[lineIndex]; - JS_ASSERT(offset >= lineStartOffset); + MOZ_ASSERT(offset >= lineStartOffset); *columnIndex = offset - lineStartOffset; } @@ -440,24 +440,24 @@ TokenStream::ungetChar(int32_t c) { if (c == EOF) return; - JS_ASSERT(!userbuf.atStart()); + MOZ_ASSERT(!userbuf.atStart()); userbuf.ungetRawChar(); if (c == '\n') { #ifdef DEBUG int32_t c2 = userbuf.peekRawChar(); - JS_ASSERT(TokenBuf::isRawEOLChar(c2)); + MOZ_ASSERT(TokenBuf::isRawEOLChar(c2)); #endif // If it's a \r\n sequence, also unget the \r. if (!userbuf.atStart()) userbuf.matchRawCharBackwards('\r'); - JS_ASSERT(prevLinebase); // we should never get more than one EOL char + MOZ_ASSERT(prevLinebase); // we should never get more than one EOL char linebase = prevLinebase; prevLinebase = nullptr; lineno--; } else { - JS_ASSERT(userbuf.peekRawChar() == c); + MOZ_ASSERT(userbuf.peekRawChar() == c); } } @@ -466,7 +466,7 @@ TokenStream::ungetCharIgnoreEOL(int32_t c) { if (c == EOF) return; - JS_ASSERT(!userbuf.atStart()); + MOZ_ASSERT(!userbuf.atStart()); userbuf.ungetRawChar(); } @@ -498,7 +498,7 @@ TokenStream::peekChars(int n, char16_t *cp) const char16_t * TokenStream::TokenBuf::findEOLMax(const char16_t *p, size_t max) { - JS_ASSERT(base_ <= p && p <= limit_); + MOZ_ASSERT(base_ <= p && p <= limit_); size_t n = 0; while (true) { @@ -694,7 +694,7 @@ TokenStream::reportCompileErrorNumberVA(uint32_t offset, unsigned flags, unsigne // Find EOL, or truncate at the back if necessary. const char16_t *windowLimit = userbuf.findEOLMax(tokenStart, windowRadius); size_t windowLength = windowLimit - windowBase; - JS_ASSERT(windowLength <= windowRadius * 2); + MOZ_ASSERT(windowLength <= windowRadius * 2); // Create the windowed strings. StringBuffer windowBuf(cx); @@ -851,7 +851,7 @@ TokenStream::getDirective(bool isMultiline, bool shouldWarnDeprecated, const char *errorMsgPragma, UniquePtr *destination) { - JS_ASSERT(directiveLength <= 18); + MOZ_ASSERT(directiveLength <= 18); char16_t peeked[18]; int32_t c; @@ -1122,7 +1122,7 @@ TokenStream::getTokenInternal(Modifier modifier) } c = userbuf.getRawChar(); - JS_ASSERT(c != EOF); + MOZ_ASSERT(c != EOF); // Chars not in the range 0..127 are rare. Getting them out of the way // early allows subsequent checking to be faster. @@ -1395,7 +1395,7 @@ TokenStream::getTokenInternal(Modifier modifier) // This handles everything else. // - JS_ASSERT(c1kind == Other); + MOZ_ASSERT(c1kind == Other); tp = newToken(-1); switch (c) { case '.': @@ -1624,14 +1624,14 @@ TokenStream::getTokenInternal(Modifier modifier) out: flags.isDirtyLine = true; tp->pos.end = userbuf.addressOfNextRawChar() - userbuf.base(); - JS_ASSERT(IsTokenSane(tp)); + MOZ_ASSERT(IsTokenSane(tp)); return tp->type; error: flags.isDirtyLine = true; tp->pos.end = userbuf.addressOfNextRawChar() - userbuf.base(); tp->type = TOK_ERROR; - JS_ASSERT(IsTokenSane(tp)); + MOZ_ASSERT(IsTokenSane(tp)); onError(); return TOK_ERROR; } diff --git a/js/src/frontend/TokenStream.h b/js/src/frontend/TokenStream.h index 8ca1d78161a2..54921950c40b 100644 --- a/js/src/frontend/TokenStream.h +++ b/js/src/frontend/TokenStream.h @@ -38,9 +38,9 @@ struct TokenPos { // Return a TokenPos that covers left, right, and anything in between. static TokenPos box(const TokenPos &left, const TokenPos &right) { - JS_ASSERT(left.begin <= left.end); - JS_ASSERT(left.end <= right.begin); - JS_ASSERT(right.begin <= right.end); + MOZ_ASSERT(left.begin <= left.end); + MOZ_ASSERT(left.end <= right.begin); + MOZ_ASSERT(right.begin <= right.end); return TokenPos(left.begin, right.end); } @@ -113,27 +113,27 @@ struct Token // Mutators void setName(PropertyName *name) { - JS_ASSERT(type == TOK_NAME); - JS_ASSERT(!IsPoisonedPtr(name)); + MOZ_ASSERT(type == TOK_NAME); + MOZ_ASSERT(!IsPoisonedPtr(name)); u.name = name; } void setAtom(JSAtom *atom) { - JS_ASSERT (type == TOK_STRING || + MOZ_ASSERT(type == TOK_STRING || type == TOK_TEMPLATE_HEAD || type == TOK_NO_SUBS_TEMPLATE); - JS_ASSERT(!IsPoisonedPtr(atom)); + MOZ_ASSERT(!IsPoisonedPtr(atom)); u.atom = atom; } void setRegExpFlags(js::RegExpFlag flags) { - JS_ASSERT(type == TOK_REGEXP); - JS_ASSERT((flags & AllFlags) == flags); + MOZ_ASSERT(type == TOK_REGEXP); + MOZ_ASSERT((flags & AllFlags) == flags); u.reflags = flags; } void setNumber(double n, DecimalPoint decimalPoint) { - JS_ASSERT(type == TOK_NUMBER); + MOZ_ASSERT(type == TOK_NUMBER); u.number.value = n; u.number.decimalPoint = decimalPoint; } @@ -141,30 +141,30 @@ struct Token // Type-safe accessors PropertyName *name() const { - JS_ASSERT(type == TOK_NAME); + MOZ_ASSERT(type == TOK_NAME); return u.name->asPropertyName(); // poor-man's type verification } JSAtom *atom() const { - JS_ASSERT (type == TOK_STRING || + MOZ_ASSERT(type == TOK_STRING || type == TOK_TEMPLATE_HEAD || type == TOK_NO_SUBS_TEMPLATE); return u.atom; } js::RegExpFlag regExpFlags() const { - JS_ASSERT(type == TOK_REGEXP); - JS_ASSERT((u.reflags & AllFlags) == u.reflags); + MOZ_ASSERT(type == TOK_REGEXP); + MOZ_ASSERT((u.reflags & AllFlags) == u.reflags); return u.reflags; } double number() const { - JS_ASSERT(type == TOK_NUMBER); + MOZ_ASSERT(type == TOK_NUMBER); return u.number.value; } DecimalPoint decimalPoint() const { - JS_ASSERT(type == TOK_NUMBER); + MOZ_ASSERT(type == TOK_NUMBER); return u.number.decimalPoint; } }; @@ -277,7 +277,7 @@ class MOZ_STACK_CLASS TokenStream PropertyName *currentName() const { if (isCurrentTokenType(TOK_YIELD)) return cx->names().yield; - JS_ASSERT(isCurrentTokenType(TOK_NAME)); + MOZ_ASSERT(isCurrentTokenType(TOK_NAME)); return currentToken().name(); } @@ -310,8 +310,8 @@ class MOZ_STACK_CLASS TokenStream void reportAsmJSError(uint32_t offset, unsigned errorNumber, ...); JSAtom *getRawTemplateStringAtom() { - JS_ASSERT(currentToken().type == TOK_TEMPLATE_HEAD || - currentToken().type == TOK_NO_SUBS_TEMPLATE); + MOZ_ASSERT(currentToken().type == TOK_TEMPLATE_HEAD || + currentToken().type == TOK_NO_SUBS_TEMPLATE); const char16_t *cur = userbuf.base() + currentToken().pos.begin + 1; const char16_t *end; if (currentToken().type == TOK_TEMPLATE_HEAD) { @@ -380,7 +380,7 @@ class MOZ_STACK_CLASS TokenStream lookahead--; cursor = (cursor + 1) & ntokensMask; TokenKind tt = currentToken().type; - JS_ASSERT(tt != TOK_EOL); + MOZ_ASSERT(tt != TOK_EOL); return tt; } @@ -389,7 +389,7 @@ class MOZ_STACK_CLASS TokenStream // Push the last scanned token back into the stream. void ungetToken() { - JS_ASSERT(lookahead < maxLookahead); + MOZ_ASSERT(lookahead < maxLookahead); lookahead++; cursor = (cursor - 1) & ntokensMask; } @@ -407,7 +407,7 @@ class MOZ_STACK_CLASS TokenStream return tokens[(cursor + 1) & ntokensMask].pos; getTokenInternal(modifier); ungetToken(); - JS_ASSERT(lookahead != 0); + MOZ_ASSERT(lookahead != 0); return tokens[(cursor + 1) & ntokensMask].pos; } @@ -589,7 +589,7 @@ class MOZ_STACK_CLASS TokenStream bool isOnThisLine(uint32_t offset, uint32_t lineNum) const { uint32_t lineIndex = lineNumToIndex(lineNum); - JS_ASSERT(lineIndex + 1 < lineStartOffsets_.length()); // +1 due to sentinel + MOZ_ASSERT(lineIndex + 1 < lineStartOffsets_.length()); // +1 due to sentinel return lineStartOffsets_[lineIndex] <= offset && offset < lineStartOffsets_[lineIndex + 1]; } @@ -658,7 +658,7 @@ class MOZ_STACK_CLASS TokenStream } bool matchRawCharBackwards(char16_t c) { - JS_ASSERT(ptr); // make sure it hasn't been poisoned + MOZ_ASSERT(ptr); // make sure it hasn't been poisoned if (*(ptr - 1) == c) { ptr--; return true; @@ -667,7 +667,7 @@ class MOZ_STACK_CLASS TokenStream } void ungetRawChar() { - JS_ASSERT(ptr); // make sure it hasn't been poisoned + MOZ_ASSERT(ptr); // make sure it hasn't been poisoned ptr--; } @@ -734,7 +734,7 @@ class MOZ_STACK_CLASS TokenStream void consumeKnownChar(int32_t expect) { mozilla::DebugOnly c = getChar(); - JS_ASSERT(c == expect); + MOZ_ASSERT(c == expect); } int32_t peekChar() { diff --git a/js/src/gc/Barrier.cpp b/js/src/gc/Barrier.cpp index 515fd35783b3..812b2510ae63 100644 --- a/js/src/gc/Barrier.cpp +++ b/js/src/gc/Barrier.cpp @@ -18,7 +18,7 @@ namespace js { void ValueReadBarrier(const Value &value) { - JS_ASSERT(!CurrentThreadIsIonCompiling()); + MOZ_ASSERT(!CurrentThreadIsIonCompiling()); if (value.isObject()) JSObject::readBarrier(&value.toObject()); else if (value.isString()) @@ -26,7 +26,7 @@ ValueReadBarrier(const Value &value) else if (value.isSymbol()) JS::Symbol::readBarrier(value.toSymbol()); else - JS_ASSERT(!value.isMarkable()); + MOZ_ASSERT(!value.isMarkable()); } #ifdef DEBUG diff --git a/js/src/gc/Barrier.h b/js/src/gc/Barrier.h index 384f68b4d6f5..d341df07acb6 100644 --- a/js/src/gc/Barrier.h +++ b/js/src/gc/Barrier.h @@ -276,7 +276,7 @@ ShadowZoneOfSymbolFromAnyThread(JS::Symbol *sym) MOZ_ALWAYS_INLINE JS::Zone * ZoneOfValueFromAnyThread(const JS::Value &value) { - JS_ASSERT(value.isMarkable()); + MOZ_ASSERT(value.isMarkable()); if (value.isObject()) return ZoneOfObjectFromAnyThread(value.toObject()); return js::gc::TenuredCell::fromPointer(value.toGCThing())->zoneFromAnyThread(); @@ -307,14 +307,14 @@ template <> struct InternalGCMethods { static JSRuntime *runtimeFromAnyThread(const Value &v) { - JS_ASSERT(v.isMarkable()); + MOZ_ASSERT(v.isMarkable()); return static_cast(v.toGCThing())->runtimeFromAnyThread(); } static JS::shadow::Runtime *shadowRuntimeFromAnyThread(const Value &v) { return reinterpret_cast(runtimeFromAnyThread(v)); } static JSRuntime *runtimeFromMainThread(const Value &v) { - JS_ASSERT(v.isMarkable()); + MOZ_ASSERT(v.isMarkable()); return static_cast(v.toGCThing())->runtimeFromMainThread(); } static JS::shadow::Runtime *shadowRuntimeFromMainThread(const Value &v) { @@ -325,7 +325,7 @@ struct InternalGCMethods static void preBarrier(Value v) { #ifdef JSGC_INCREMENTAL - JS_ASSERT(!CurrentThreadIsIonCompiling()); + MOZ_ASSERT(!CurrentThreadIsIonCompiling()); if (v.isMarkable() && shadowRuntimeFromAnyThread(v)->needsIncrementalBarrier()) preBarrier(ZoneOfValueFromAnyThread(v), v); #endif @@ -333,7 +333,7 @@ struct InternalGCMethods static void preBarrier(Zone *zone, Value v) { #ifdef JSGC_INCREMENTAL - JS_ASSERT(!CurrentThreadIsIonCompiling()); + MOZ_ASSERT(!CurrentThreadIsIonCompiling()); if (v.isString() && StringIsPermanentAtom(v.toString())) return; JS::shadow::Zone *shadowZone = JS::shadow::Zone::asShadowZone(zone); @@ -341,14 +341,14 @@ struct InternalGCMethods JS_ASSERT_IF(v.isMarkable(), shadowRuntimeFromMainThread(v)->needsIncrementalBarrier()); Value tmp(v); js::gc::MarkValueUnbarriered(shadowZone->barrierTracer(), &tmp, "write barrier"); - JS_ASSERT(tmp == v); + MOZ_ASSERT(tmp == v); } #endif } static void postBarrier(Value *vp) { #ifdef JSGC_GENERATIONAL - JS_ASSERT(!CurrentThreadIsIonCompiling()); + MOZ_ASSERT(!CurrentThreadIsIonCompiling()); if (vp->isObject()) { gc::StoreBuffer *sb = reinterpret_cast(&vp->toObject())->storeBuffer(); if (sb) @@ -359,7 +359,7 @@ struct InternalGCMethods static void postBarrierRelocate(Value *vp) { #ifdef JSGC_GENERATIONAL - JS_ASSERT(!CurrentThreadIsIonCompiling()); + MOZ_ASSERT(!CurrentThreadIsIonCompiling()); if (vp->isObject()) { gc::StoreBuffer *sb = reinterpret_cast(&vp->toObject())->storeBuffer(); if (sb) @@ -370,9 +370,9 @@ struct InternalGCMethods static void postBarrierRemove(Value *vp) { #ifdef JSGC_GENERATIONAL - JS_ASSERT(vp); - JS_ASSERT(vp->isMarkable()); - JS_ASSERT(!CurrentThreadIsIonCompiling()); + MOZ_ASSERT(vp); + MOZ_ASSERT(vp->isMarkable()); + MOZ_ASSERT(!CurrentThreadIsIonCompiling()); JSRuntime *rt = static_cast(vp->toGCThing())->runtimeFromAnyThread(); JS::shadow::Runtime *shadowRuntime = JS::shadow::Runtime::asShadowRuntime(rt); shadowRuntime->gcStoreBufferPtr()->removeRelocatableValueFromAnyThread(vp); @@ -394,14 +394,14 @@ struct InternalGCMethods JS::shadow::Zone *shadowZone = ShadowZoneOfStringFromAnyThread(str); if (shadowZone->needsIncrementalBarrier()) { js::gc::MarkStringUnbarriered(shadowZone->barrierTracer(), &str, "write barrier"); - JS_ASSERT(str == JSID_TO_STRING(id)); + MOZ_ASSERT(str == JSID_TO_STRING(id)); } } else if (JSID_IS_SYMBOL(id)) { JS::Symbol *sym = JSID_TO_SYMBOL(id); JS::shadow::Zone *shadowZone = ShadowZoneOfSymbolFromAnyThread(sym); if (shadowZone->needsIncrementalBarrier()) { js::gc::MarkSymbolUnbarriered(shadowZone->barrierTracer(), &sym, "write barrier"); - JS_ASSERT(sym == JSID_TO_SYMBOL(id)); + MOZ_ASSERT(sym == JSID_TO_SYMBOL(id)); } } #endif @@ -430,7 +430,7 @@ class BarrieredBase : public BarrieredBaseMixins public: void init(T v) { - JS_ASSERT(!GCMethods::poisoned(v)); + MOZ_ASSERT(!GCMethods::poisoned(v)); this->value = v; } @@ -496,14 +496,14 @@ class PreBarriered : public BarrieredBase PreBarriered &operator=(T v) { this->pre(); - JS_ASSERT(!GCMethods::poisoned(v)); + MOZ_ASSERT(!GCMethods::poisoned(v)); this->value = v; return *this; } PreBarriered &operator=(const PreBarriered &v) { this->pre(); - JS_ASSERT(!GCMethods::poisoned(v.value)); + MOZ_ASSERT(!GCMethods::poisoned(v.value)); this->value = v.value; return *this; } @@ -530,14 +530,14 @@ class HeapPtr : public BarrieredBase explicit HeapPtr(const HeapPtr &v) : BarrieredBase(v) { post(); } void init(T v) { - JS_ASSERT(!GCMethods::poisoned(v)); + MOZ_ASSERT(!GCMethods::poisoned(v)); this->value = v; post(); } HeapPtr &operator=(T v) { this->pre(); - JS_ASSERT(!GCMethods::poisoned(v)); + MOZ_ASSERT(!GCMethods::poisoned(v)); this->value = v; post(); return *this; @@ -545,7 +545,7 @@ class HeapPtr : public BarrieredBase HeapPtr &operator=(const HeapPtr &v) { this->pre(); - JS_ASSERT(!GCMethods::poisoned(v.value)); + MOZ_ASSERT(!GCMethods::poisoned(v.value)); this->value = v.value; post(); return *this; @@ -599,7 +599,7 @@ class ImmutableTenuredPtr } void init(T ptr) { - JS_ASSERT(ptr->isTenured()); + MOZ_ASSERT(ptr->isTenured()); value = ptr; } @@ -641,7 +641,7 @@ class RelocatablePtr : public BarrieredBase RelocatablePtr &operator=(T v) { this->pre(); - JS_ASSERT(!GCMethods::poisoned(v)); + MOZ_ASSERT(!GCMethods::poisoned(v)); if (GCMethods::needsPostBarrier(v)) { this->value = v; post(); @@ -656,7 +656,7 @@ class RelocatablePtr : public BarrieredBase RelocatablePtr &operator=(const RelocatablePtr &v) { this->pre(); - JS_ASSERT(!GCMethods::poisoned(v.value)); + MOZ_ASSERT(!GCMethods::poisoned(v.value)); if (GCMethods::needsPostBarrier(v.value)) { this->value = v.value; post(); @@ -673,14 +673,14 @@ class RelocatablePtr : public BarrieredBase protected: void post() { #ifdef JSGC_GENERATIONAL - JS_ASSERT(GCMethods::needsPostBarrier(this->value)); + MOZ_ASSERT(GCMethods::needsPostBarrier(this->value)); InternalGCMethods::postBarrierRelocate(&this->value); #endif } void relocate() { #ifdef JSGC_GENERATIONAL - JS_ASSERT(GCMethods::needsPostBarrier(this->value)); + MOZ_ASSERT(GCMethods::needsPostBarrier(this->value)); InternalGCMethods::postBarrierRemove(&this->value); #endif } @@ -861,14 +861,14 @@ class HeapSlot : public BarrieredBase explicit HeapSlot(JSObject *obj, Kind kind, uint32_t slot, const Value &v) : BarrieredBase(v) { - JS_ASSERT(!IsPoisonedValue(v)); + MOZ_ASSERT(!IsPoisonedValue(v)); post(obj, kind, slot, v); } explicit HeapSlot(JSObject *obj, Kind kind, uint32_t slot, const HeapSlot &s) : BarrieredBase(s.value) { - JS_ASSERT(!IsPoisonedValue(s.value)); + MOZ_ASSERT(!IsPoisonedValue(s.value)); post(obj, kind, slot, s); } @@ -888,16 +888,16 @@ class HeapSlot : public BarrieredBase #endif void set(JSObject *owner, Kind kind, uint32_t slot, const Value &v) { - JS_ASSERT(preconditionForSet(owner, kind, slot)); - JS_ASSERT(!IsPoisonedValue(v)); + MOZ_ASSERT(preconditionForSet(owner, kind, slot)); + MOZ_ASSERT(!IsPoisonedValue(v)); pre(); value = v; post(owner, kind, slot, v); } void set(Zone *zone, JSObject *owner, Kind kind, uint32_t slot, const Value &v) { - JS_ASSERT(preconditionForSet(zone, owner, kind, slot)); - JS_ASSERT(!IsPoisonedValue(v)); + MOZ_ASSERT(preconditionForSet(zone, owner, kind, slot)); + MOZ_ASSERT(!IsPoisonedValue(v)); pre(zone); value = v; post(owner, kind, slot, v); @@ -910,7 +910,7 @@ class HeapSlot : public BarrieredBase private: void post(JSObject *owner, Kind kind, uint32_t slot, const Value &target) { - JS_ASSERT(preconditionForWriteBarrierPost(owner, kind, slot, target)); + MOZ_ASSERT(preconditionForWriteBarrierPost(owner, kind, slot, target)); #ifdef JSGC_GENERATIONAL if (this->value.isObject()) { gc::Cell *cell = reinterpret_cast(&this->value.toObject()); @@ -956,7 +956,7 @@ class HeapSlotArray {} operator const Value *() const { return Valueify(array); } - operator HeapSlot *() const { JS_ASSERT(allowWrite()); return array; } + operator HeapSlot *() const { MOZ_ASSERT(allowWrite()); return array; } HeapSlotArray operator +(int offset) const { return HeapSlotArray(array + offset, allowWrite()); } HeapSlotArray operator +(uint32_t offset) const { return HeapSlotArray(array + offset, allowWrite()); } diff --git a/js/src/gc/FindSCCs.h b/js/src/gc/FindSCCs.h index 587296e899e6..e92f7b5211e6 100644 --- a/js/src/gc/FindSCCs.h +++ b/js/src/gc/FindSCCs.h @@ -74,8 +74,8 @@ class ComponentFinder {} ~ComponentFinder() { - JS_ASSERT(!stack); - JS_ASSERT(!firstComponent); + MOZ_ASSERT(!stack); + MOZ_ASSERT(!firstComponent); } /* Forces all nodes to be added to a single component. */ @@ -83,7 +83,7 @@ class ComponentFinder void addNode(Node *v) { if (v->gcDiscoveryTime == Undefined) { - JS_ASSERT(v->gcLowLink == Undefined); + MOZ_ASSERT(v->gcLowLink == Undefined); processNode(v); } } @@ -104,7 +104,7 @@ class ComponentFinder stackFull = false; } - JS_ASSERT(!stack); + MOZ_ASSERT(!stack); Node *result = firstComponent; firstComponent = nullptr; @@ -166,7 +166,7 @@ class ComponentFinder Node *nextComponent = firstComponent; Node *w; do { - JS_ASSERT(stack); + MOZ_ASSERT(stack); w = stack; stack = w->gcNextGraphNode; diff --git a/js/src/gc/ForkJoinNursery-inl.h b/js/src/gc/ForkJoinNursery-inl.h index 87f810111c2c..f485e903f5a4 100644 --- a/js/src/gc/ForkJoinNursery-inl.h +++ b/js/src/gc/ForkJoinNursery-inl.h @@ -68,7 +68,7 @@ ForkJoinNursery::isInsideFromspace(const void *addr) MOZ_ALWAYS_INLINE bool ForkJoinNursery::isForwarded(Cell *cell) { - JS_ASSERT(isInsideFromspace(cell)); + MOZ_ASSERT(isInsideFromspace(cell)); const RelocationOverlay *overlay = RelocationOverlay::fromCell(cell); return overlay->isForwarded(); } @@ -77,8 +77,8 @@ template MOZ_ALWAYS_INLINE bool ForkJoinNursery::getForwardedPointer(T **ref) { - JS_ASSERT(ref); - JS_ASSERT(isInsideFromspace(*ref)); + MOZ_ASSERT(ref); + MOZ_ASSERT(isInsideFromspace(*ref)); const RelocationOverlay *overlay = RelocationOverlay::fromCell(*ref); if (!overlay->isForwarded()) return false; diff --git a/js/src/gc/ForkJoinNursery.cpp b/js/src/gc/ForkJoinNursery.cpp index 4689f19eadad..b370343aaa4a 100644 --- a/js/src/gc/ForkJoinNursery.cpp +++ b/js/src/gc/ForkJoinNursery.cpp @@ -210,21 +210,21 @@ ForkJoinNursery::evacuatingGC() void ForkJoinNursery::pjsCollection(int op) { - JS_ASSERT((op & Collect) != (op & Evacuate)); + MOZ_ASSERT((op & Collect) != (op & Evacuate)); bool evacuate = op & Evacuate; bool recreate = op & Recreate; - JS_ASSERT(!isEvacuating_); - JS_ASSERT(!evacuationZone_); - JS_ASSERT(!head_); - JS_ASSERT(tail_ == &head_); + MOZ_ASSERT(!isEvacuating_); + MOZ_ASSERT(!evacuationZone_); + MOZ_ASSERT(!head_); + MOZ_ASSERT(tail_ == &head_); JSRuntime *const rt = shared_->runtime(); const unsigned currentNumActiveChunks_ = numActiveChunks_; const char *msg = ""; - JS_ASSERT(!rt->needsIncrementalBarrier()); + MOZ_ASSERT(!rt->needsIncrementalBarrier()); TIME_START(pjsCollection); @@ -251,7 +251,7 @@ ForkJoinNursery::pjsCollection(int op) computeNurserySizeAfterGC(live, &msg); sweepHugeSlots(); - JS_ASSERT(hugeSlots[hugeSlotsFrom].empty()); + MOZ_ASSERT(hugeSlots[hugeSlotsFrom].empty()); JS_ASSERT_IF(isEvacuating_, hugeSlots[hugeSlotsNew].empty()); isEvacuating_ = false; @@ -325,7 +325,7 @@ ForkJoinNursery::flip() hugeSlotsNew = hugeSlotsFrom; hugeSlotsFrom = tmp; - JS_ASSERT(hugeSlots[hugeSlotsNew].empty()); + MOZ_ASSERT(hugeSlots[hugeSlotsNew].empty()); } void @@ -341,8 +341,8 @@ ForkJoinNursery::freeFromspace() bool ForkJoinNursery::initNewspace() { - JS_ASSERT(newspace[0] == nullptr); - JS_ASSERT(numActiveChunks_ == 0); + MOZ_ASSERT(newspace[0] == nullptr); + MOZ_ASSERT(numActiveChunks_ == 0); numActiveChunks_ = 1; return setCurrentChunk(0); @@ -373,7 +373,7 @@ ForkJoinNursery::MinorGCCallback(JSTracer *trcArg, void **thingp, JSGCTraceKind if (nursery->shouldMoveObject(thingp)) { // When other types of objects become nursery-allocable then the static_cast // to JSObject * will no longer be valid. - JS_ASSERT(traceKind == JSTRACE_OBJECT); + MOZ_ASSERT(traceKind == JSTRACE_OBJECT); *thingp = nursery->moveObjectToTospace(static_cast(*thingp)); } } @@ -415,14 +415,14 @@ ForkJoinNursery::forwardFromTenured(ForkJoinNurseryCollectionTracer *trc) // When non-JSObject types become nursery-allocable the assumptions in the // loops below will no longer hold; other types than JSObject must be // handled. - JS_ASSERT(kind <= FINALIZE_OBJECT_LAST); + MOZ_ASSERT(kind <= FINALIZE_OBJECT_LAST); // Clear the free list that we're currently allocating out of. lists.purge(kind); // Since we only purge once, there must not currently be any partially // full arenas left to allocate out of, or we would break out early. - JS_ASSERT(!lists.getArenaAfterCursor(kind)); + MOZ_ASSERT(!lists.getArenaAfterCursor(kind)); ArenaIter ai; ai.init(const_cast(tenured_), kind); @@ -463,7 +463,7 @@ ForkJoinNursery::forwardBufferPointer(JSTracer *trc, HeapSlot **pSlotsElems) // abuts the end of the allocable area. Thus, it is always safe to read the // first word of |old| here. *pSlotsElems = *reinterpret_cast(old); - JS_ASSERT(!nursery->isInsideFromspace(*pSlotsElems)); + MOZ_ASSERT(!nursery->isInsideFromspace(*pSlotsElems)); } void @@ -476,8 +476,8 @@ ForkJoinNursery::collectToFixedPoint(ForkJoinNurseryCollectionTracer *trc) inline bool ForkJoinNursery::setCurrentChunk(int index) { - JS_ASSERT((size_t)index < numActiveChunks_); - JS_ASSERT(!newspace[index]); + MOZ_ASSERT((size_t)index < numActiveChunks_); + MOZ_ASSERT(!newspace[index]); currentChunk_ = index; ForkJoinNurseryChunk *c = shared_->allocateNurseryChunk(); @@ -496,7 +496,7 @@ ForkJoinNursery::setCurrentChunk(int index) void * ForkJoinNursery::allocate(size_t size) { - JS_ASSERT(position_ >= currentStart_); + MOZ_ASSERT(position_ >= currentStart_); if (currentEnd_ - position_ < size) { if (currentChunk_ + 1 == numActiveChunks_) @@ -523,7 +523,7 @@ JSObject * ForkJoinNursery::allocateObject(size_t baseSize, size_t numDynamic, bool& tooLarge) { // Ensure there's enough space to replace the contents with a RelocationOverlay. - JS_ASSERT(baseSize >= sizeof(js::gc::RelocationOverlay)); + MOZ_ASSERT(baseSize >= sizeof(js::gc::RelocationOverlay)); // Too-large slot arrays cannot be accomodated. if (numDynamic > MaxNurserySlots) { @@ -547,8 +547,8 @@ ForkJoinNursery::allocateObject(size_t baseSize, size_t numDynamic, bool& tooLar HeapSlot * ForkJoinNursery::allocateSlots(JSObject *obj, uint32_t nslots) { - JS_ASSERT(obj); - JS_ASSERT(nslots > 0); + MOZ_ASSERT(obj); + MOZ_ASSERT(nslots > 0); if (nslots & mozilla::tl::MulOverflowMask::value) return nullptr; @@ -598,7 +598,7 @@ ForkJoinNursery::reallocateSlots(JSObject *obj, HeapSlot *oldSlots, ObjectElements * ForkJoinNursery::allocateElements(JSObject *obj, uint32_t nelems) { - JS_ASSERT(nelems >= ObjectElements::VALUES_PER_HEADER); + MOZ_ASSERT(nelems >= ObjectElements::VALUES_PER_HEADER); return reinterpret_cast(allocateSlots(obj, nelems)); } @@ -714,7 +714,7 @@ AllocKind ForkJoinNursery::getObjectAllocKind(JSObject *obj) { if (obj->is()) { - JS_ASSERT(obj->numFixedSlots() == 0); + MOZ_ASSERT(obj->numFixedSlots() == 0); // Use minimal size object if we are just going to copy the pointer. if (!isInsideFromspace((void *)obj->getElementsHeader())) @@ -728,8 +728,8 @@ ForkJoinNursery::getObjectAllocKind(JSObject *obj) return obj->as().getAllocKind(); AllocKind kind = GetGCObjectFixedSlotsKind(obj->numFixedSlots()); - JS_ASSERT(!IsBackgroundFinalized(kind)); - JS_ASSERT(CanBeFinalizedInBackground(kind, obj->getClass())); + MOZ_ASSERT(!IsBackgroundFinalized(kind)); + MOZ_ASSERT(CanBeFinalizedInBackground(kind, obj->getClass())); return GetBackgroundAllocKind(kind); } @@ -816,7 +816,7 @@ ForkJoinNursery::copyObjectToTospace(JSObject *dst, JSObject *src, AllocKind dst // The shape's list head may point into the old object. if (&src->shape_ == dst->shape_->listp) { - JS_ASSERT(cx_->isThreadLocal(dst->shape_.get())); + MOZ_ASSERT(cx_->isThreadLocal(dst->shape_.get())); dst->shape_->listp = &dst->shape_; } @@ -858,7 +858,7 @@ ForkJoinNursery::copyElementsToTospace(JSObject *dst, JSObject *src, AllocKind d // TODO Bug 874151: Prefer to put element data inline if we have space. // (Note, not a correctness issue.) if (!isInsideFromspace(srcHeader)) { - JS_ASSERT(src->elements == dst->elements); + MOZ_ASSERT(src->elements == dst->elements); hugeSlots[hugeSlotsFrom].remove(reinterpret_cast(srcHeader)); if (!isEvacuating_) hugeSlots[hugeSlotsNew].put(reinterpret_cast(srcHeader)); @@ -876,7 +876,7 @@ ForkJoinNursery::copyElementsToTospace(JSObject *dst, JSObject *src, AllocKind d return nslots * sizeof(HeapSlot); } - JS_ASSERT(nslots >= 2); + MOZ_ASSERT(nslots >= 2); dstHeader = reinterpret_cast(allocateInTospace(nslots)); if (!dstHeader) CrashAtUnhandlableOOM("Failed to allocate elements while moving object."); @@ -889,9 +889,9 @@ ForkJoinNursery::copyElementsToTospace(JSObject *dst, JSObject *src, AllocKind d void ForkJoinNursery::setSlotsForwardingPointer(HeapSlot *oldSlots, HeapSlot *newSlots, uint32_t nslots) { - JS_ASSERT(nslots > 0); - JS_ASSERT(isInsideFromspace(oldSlots)); - JS_ASSERT(!isInsideFromspace(newSlots)); + MOZ_ASSERT(nslots > 0); + MOZ_ASSERT(isInsideFromspace(oldSlots)); + MOZ_ASSERT(!isInsideFromspace(newSlots)); *reinterpret_cast(oldSlots) = newSlots; } @@ -903,8 +903,8 @@ ForkJoinNursery::setElementsForwardingPointer(ObjectElements *oldHeader, ObjectE // relocate it because reads and writes to/from this pointer are invalid. if (nelems - ObjectElements::VALUES_PER_HEADER < 1) return; - JS_ASSERT(isInsideFromspace(oldHeader)); - JS_ASSERT(!isInsideFromspace(newHeader)); + MOZ_ASSERT(isInsideFromspace(oldHeader)); + MOZ_ASSERT(!isInsideFromspace(newHeader)); *reinterpret_cast(oldHeader->elements()) = newHeader->elements(); } @@ -913,8 +913,8 @@ ForkJoinNurseryCollectionTracer::ForkJoinNurseryCollectionTracer(JSRuntime *rt, : JSTracer(rt, ForkJoinNursery::MinorGCCallback, TraceWeakMapKeysValues) , nursery_(nursery) { - JS_ASSERT(rt); - JS_ASSERT(nursery); + MOZ_ASSERT(rt); + MOZ_ASSERT(nursery); } } // namespace gc diff --git a/js/src/gc/GCInternals.h b/js/src/gc/GCInternals.h index 47bc708219d1..40d8fb0bea15 100644 --- a/js/src/gc/GCInternals.h +++ b/js/src/gc/GCInternals.h @@ -89,7 +89,7 @@ class IncrementalSafety } const char *reason() { - JS_ASSERT(reason_); + MOZ_ASSERT(reason_); return reason_; } }; diff --git a/js/src/gc/GCRuntime.h b/js/src/gc/GCRuntime.h index b378e8696dbd..639a48cd2e21 100644 --- a/js/src/gc/GCRuntime.h +++ b/js/src/gc/GCRuntime.h @@ -90,7 +90,7 @@ struct ConservativeGCData * The conservative GC scanner should be disabled when the thread leaves * the last request. */ - JS_ASSERT(!hasStackToScan()); + MOZ_ASSERT(!hasStackToScan()); } MOZ_NEVER_INLINE void recordStackTop(); @@ -344,19 +344,19 @@ class GCRuntime #endif // DEBUG void assertCanLock() { - JS_ASSERT(!currentThreadOwnsGCLock()); + MOZ_ASSERT(!currentThreadOwnsGCLock()); } void lockGC() { PR_Lock(lock); - JS_ASSERT(!lockOwner); + MOZ_ASSERT(!lockOwner); #ifdef DEBUG lockOwner = PR_GetCurrentThread(); #endif } void unlockGC() { - JS_ASSERT(lockOwner == PR_GetCurrentThread()); + MOZ_ASSERT(lockOwner == PR_GetCurrentThread()); lockOwner = nullptr; PR_Unlock(lock); } @@ -365,21 +365,21 @@ class GCRuntime bool isAllocAllowed() { return noGCOrAllocationCheck == 0; } void disallowAlloc() { ++noGCOrAllocationCheck; } void allowAlloc() { - JS_ASSERT(!isAllocAllowed()); + MOZ_ASSERT(!isAllocAllowed()); --noGCOrAllocationCheck; } bool isInsideUnsafeRegion() { return inUnsafeRegion != 0; } void enterUnsafeRegion() { ++inUnsafeRegion; } void leaveUnsafeRegion() { - JS_ASSERT(inUnsafeRegion > 0); + MOZ_ASSERT(inUnsafeRegion > 0); --inUnsafeRegion; } bool isStrictProxyCheckingEnabled() { return disableStrictProxyCheckingCount == 0; } void disableStrictProxyChecking() { ++disableStrictProxyCheckingCount; } void enableStrictProxyChecking() { - JS_ASSERT(disableStrictProxyCheckingCount > 0); + MOZ_ASSERT(disableStrictProxyCheckingCount > 0); --disableStrictProxyCheckingCount; } #endif @@ -425,7 +425,7 @@ class GCRuntime void setManipulatingDeadZones(bool value) { manipulatingDeadZones = value; } unsigned objectsMarkedInDeadZonesCount() { return objectsMarkedInDeadZones; } void incObjectsMarkedInDeadZone() { - JS_ASSERT(manipulatingDeadZones); + MOZ_ASSERT(manipulatingDeadZones); ++objectsMarkedInDeadZones; } diff --git a/js/src/gc/GCTrace.cpp b/js/src/gc/GCTrace.cpp index ecc1786e33da..282820007fa7 100644 --- a/js/src/gc/GCTrace.cpp +++ b/js/src/gc/GCTrace.cpp @@ -37,8 +37,8 @@ WriteWord(uint64_t data) static inline void TraceEvent(GCTraceEvent event, uint64_t payload = 0, uint8_t extra = 0) { - JS_ASSERT(event < GCTraceEventCount); - JS_ASSERT((payload >> TracePayloadBits) == 0); + MOZ_ASSERT(event < GCTraceEventCount); + MOZ_ASSERT((payload >> TracePayloadBits) == 0); WriteWord((uint64_t(event) << TraceEventShift) | (uint64_t(extra) << TraceExtraShift) | payload); } @@ -174,7 +174,7 @@ js::gc::TraceTypeNewScript(TypeObject *type) { const size_t bufLength = 128; static char buffer[bufLength]; - JS_ASSERT(type->hasNewScript()); + MOZ_ASSERT(type->hasNewScript()); JSAtom *funName = type->newScript()->fun->displayAtom(); if (!funName) return; diff --git a/js/src/gc/Heap.h b/js/src/gc/Heap.h index c2b93adb9cc3..0d3a16a25d2a 100644 --- a/js/src/gc/Heap.h +++ b/js/src/gc/Heap.h @@ -261,7 +261,7 @@ class FreeSpan void initAsEmpty() { first = 0; last = 0; - JS_ASSERT(isEmpty()); + MOZ_ASSERT(isEmpty()); } // This sets |first| and |last|, and also sets the next span stored at @@ -272,7 +272,7 @@ class FreeSpan last = lastArg; FreeSpan *lastSpan = reinterpret_cast(last); lastSpan->initAsEmpty(); - JS_ASSERT(!isEmpty()); + MOZ_ASSERT(!isEmpty()); checkSpan(thingSize); } @@ -295,26 +295,26 @@ class FreeSpan } const FreeSpan *nextSpan() const { - JS_ASSERT(!isEmpty()); + MOZ_ASSERT(!isEmpty()); return nextSpanUnchecked(); } uintptr_t arenaAddress() const { - JS_ASSERT(!isEmpty()); + MOZ_ASSERT(!isEmpty()); return first & ~ArenaMask; } #ifdef DEBUG bool isWithinArena(uintptr_t arenaAddr) const { - JS_ASSERT(!(arenaAddr & ArenaMask)); - JS_ASSERT(!isEmpty()); + MOZ_ASSERT(!(arenaAddr & ArenaMask)); + MOZ_ASSERT(!isEmpty()); return arenaAddress() == arenaAddr; } #endif size_t length(size_t thingSize) const { checkSpan(); - JS_ASSERT((last - first) % thingSize == 0); + MOZ_ASSERT((last - first) % thingSize == 0); return (last - first) / thingSize + 1; } @@ -337,26 +337,26 @@ class FreeSpan void checkSpan(size_t thingSize = 0) const { #ifdef DEBUG if (!first || !last) { - JS_ASSERT(!first && !last); + MOZ_ASSERT(!first && !last); // An empty span. return; } // |first| and |last| must be ordered appropriately, belong to the same // arena, and be suitably aligned. - JS_ASSERT(first <= last); - JS_ASSERT((first & ~ArenaMask) == (last & ~ArenaMask)); - JS_ASSERT((last - first) % (thingSize ? thingSize : CellSize) == 0); + MOZ_ASSERT(first <= last); + MOZ_ASSERT((first & ~ArenaMask) == (last & ~ArenaMask)); + MOZ_ASSERT((last - first) % (thingSize ? thingSize : CellSize) == 0); // If there's a following span, it must be from the same arena, it must // have a higher address, and the gap must be at least 2*thingSize. FreeSpan *next = reinterpret_cast(last); if (next->first) { - JS_ASSERT(next->last); - JS_ASSERT((first & ~ArenaMask) == (next->first & ~ArenaMask)); - JS_ASSERT(thingSize - ? last + 2 * thingSize <= next->first - : last < next->first); + MOZ_ASSERT(next->last); + MOZ_ASSERT((first & ~ArenaMask) == (next->first & ~ArenaMask)); + MOZ_ASSERT(thingSize + ? last + 2 * thingSize <= next->first + : last < next->first); } #endif } @@ -395,18 +395,18 @@ class CompactFreeSpan } bool isEmpty() const { - JS_ASSERT(!!firstOffset_ == !!lastOffset_); + MOZ_ASSERT(!!firstOffset_ == !!lastOffset_); return !firstOffset_; } FreeSpan decompact(uintptr_t arenaAddr) const { - JS_ASSERT(!(arenaAddr & ArenaMask)); + MOZ_ASSERT(!(arenaAddr & ArenaMask)); FreeSpan decodedSpan; if (isEmpty()) { decodedSpan.initAsEmpty(); } else { - JS_ASSERT(firstOffset_ <= lastOffset_); - JS_ASSERT(lastOffset_ < ArenaSize); + MOZ_ASSERT(firstOffset_ <= lastOffset_); + MOZ_ASSERT(lastOffset_ < ArenaSize); decodedSpan.initBounds(arenaAddr + firstOffset_, arenaAddr + lastOffset_); } return decodedSpan; @@ -453,26 +453,26 @@ class FreeList #ifdef DEBUG uintptr_t arenaAddress() const { - JS_ASSERT(!isEmpty()); + MOZ_ASSERT(!isEmpty()); return head.arenaAddress(); } #endif ArenaHeader *arenaHeader() const { - JS_ASSERT(!isEmpty()); + MOZ_ASSERT(!isEmpty()); return reinterpret_cast(head.arenaAddress()); } #ifdef DEBUG bool isSameNonEmptySpan(const FreeSpan &another) const { - JS_ASSERT(!isEmpty()); - JS_ASSERT(!another.isEmpty()); + MOZ_ASSERT(!isEmpty()); + MOZ_ASSERT(!another.isEmpty()); return head.first == another.first && head.last == another.last; } #endif MOZ_ALWAYS_INLINE void *allocate(size_t thingSize) { - JS_ASSERT(thingSize % CellSize == 0); + MOZ_ASSERT(thingSize % CellSize == 0); head.checkSpan(thingSize); uintptr_t thing = head.first; if (thing < head.last) { @@ -561,15 +561,15 @@ struct ArenaHeader : public JS::shadow::ArenaHeader inline Chunk *chunk() const; bool allocated() const { - JS_ASSERT(allocKind <= size_t(FINALIZE_LIMIT)); + MOZ_ASSERT(allocKind <= size_t(FINALIZE_LIMIT)); return allocKind < size_t(FINALIZE_LIMIT); } void init(JS::Zone *zoneArg, AllocKind kind) { - JS_ASSERT(!allocated()); - JS_ASSERT(!markOverflow); - JS_ASSERT(!allocatedDuringIncremental); - JS_ASSERT(!hasDelayedMarking); + MOZ_ASSERT(!allocated()); + MOZ_ASSERT(!markOverflow); + MOZ_ASSERT(!allocatedDuringIncremental); + MOZ_ASSERT(!hasDelayedMarking); zone = zoneArg; static_assert(FINALIZE_LIMIT <= 255, "We must be able to fit the allockind into uint8_t."); @@ -594,7 +594,7 @@ struct ArenaHeader : public JS::shadow::ArenaHeader inline Arena *getArena(); AllocKind getAllocKind() const { - JS_ASSERT(allocated()); + MOZ_ASSERT(allocated()); return AllocKind(allocKind); } @@ -663,10 +663,10 @@ struct Arena } static size_t thingsPerArena(size_t thingSize) { - JS_ASSERT(thingSize % CellSize == 0); + MOZ_ASSERT(thingSize % CellSize == 0); /* We should be able to fit FreeSpan in any GC thing. */ - JS_ASSERT(thingSize >= sizeof(FreeSpan)); + MOZ_ASSERT(thingSize >= sizeof(FreeSpan)); return (ArenaSize - sizeof(ArenaHeader)) / thingSize; } @@ -704,7 +704,7 @@ static_assert(sizeof(Arena) == ArenaSize, "The hardcoded arena size must match t inline size_t ArenaHeader::getThingSize() const { - JS_ASSERT(allocated()); + MOZ_ASSERT(allocated()); return Arena::thingSize(getAllocKind()); } @@ -913,13 +913,13 @@ struct Chunk } static size_t arenaIndex(uintptr_t addr) { - JS_ASSERT(withinArenasRange(addr)); + MOZ_ASSERT(withinArenasRange(addr)); return (addr & ChunkMask) >> ArenaShift; } uintptr_t address() const { uintptr_t addr = reinterpret_cast(this); - JS_ASSERT(!(addr & ChunkMask)); + MOZ_ASSERT(!(addr & ChunkMask)); return addr; } @@ -950,14 +950,14 @@ struct Chunk * chunk in a doubly-linked list, get that chunk. */ Chunk *getPrevious() { - JS_ASSERT(info.prevp); + MOZ_ASSERT(info.prevp); return fromPointerToNext(info.prevp); } /* Get the chunk from a pointer to its info.next field. */ static Chunk *fromPointerToNext(Chunk **nextFieldPtr) { uintptr_t addr = reinterpret_cast(nextFieldPtr); - JS_ASSERT((addr & ChunkMask) == offsetof(Chunk, info.next)); + MOZ_ASSERT((addr & ChunkMask) == offsetof(Chunk, info.next)); return reinterpret_cast(addr - offsetof(Chunk, info.next)); } @@ -1040,8 +1040,8 @@ inline uintptr_t ArenaHeader::address() const { uintptr_t addr = reinterpret_cast(this); - JS_ASSERT(!(addr & ArenaMask)); - JS_ASSERT(Chunk::withinArenasRange(addr)); + MOZ_ASSERT(!(addr & ArenaMask)); + MOZ_ASSERT(Chunk::withinArenasRange(addr)); return addr; } @@ -1067,7 +1067,7 @@ inline bool ArenaHeader::isEmpty() const { /* Arena is empty if its first span covers the whole arena. */ - JS_ASSERT(allocated()); + MOZ_ASSERT(allocated()); size_t firstThingOffset = Arena::firstThingOffset(getAllocKind()); size_t lastThingOffset = ArenaSize - getThingSize(); const CompactFreeSpan emptyCompactSpan(firstThingOffset, lastThingOffset); @@ -1093,15 +1093,15 @@ ArenaHeader::setFirstFreeSpan(const FreeSpan *span) inline ArenaHeader * ArenaHeader::getNextDelayedMarking() const { - JS_ASSERT(hasDelayedMarking); + MOZ_ASSERT(hasDelayedMarking); return &reinterpret_cast(auxNextLink << ArenaShift)->aheader; } inline void ArenaHeader::setNextDelayedMarking(ArenaHeader *aheader) { - JS_ASSERT(!(uintptr_t(aheader) & ArenaMask)); - JS_ASSERT(!auxNextLink && !hasDelayedMarking); + MOZ_ASSERT(!(uintptr_t(aheader) & ArenaMask)); + MOZ_ASSERT(!auxNextLink && !hasDelayedMarking); hasDelayedMarking = 1; auxNextLink = aheader->arenaAddress() >> ArenaShift; } @@ -1109,7 +1109,7 @@ ArenaHeader::setNextDelayedMarking(ArenaHeader *aheader) inline void ArenaHeader::unsetDelayedMarking() { - JS_ASSERT(hasDelayedMarking); + MOZ_ASSERT(hasDelayedMarking); hasDelayedMarking = 0; auxNextLink = 0; } @@ -1117,14 +1117,14 @@ ArenaHeader::unsetDelayedMarking() inline ArenaHeader * ArenaHeader::getNextAllocDuringSweep() const { - JS_ASSERT(allocatedDuringIncremental); + MOZ_ASSERT(allocatedDuringIncremental); return &reinterpret_cast(auxNextLink << ArenaShift)->aheader; } inline void ArenaHeader::setNextAllocDuringSweep(ArenaHeader *aheader) { - JS_ASSERT(!auxNextLink && !allocatedDuringIncremental); + MOZ_ASSERT(!auxNextLink && !allocatedDuringIncremental); allocatedDuringIncremental = 1; auxNextLink = aheader->arenaAddress() >> ArenaShift; } @@ -1132,7 +1132,7 @@ ArenaHeader::setNextAllocDuringSweep(ArenaHeader *aheader) inline void ArenaHeader::unsetAllocDuringSweep() { - JS_ASSERT(allocatedDuringIncremental); + MOZ_ASSERT(allocatedDuringIncremental); allocatedDuringIncremental = 0; auxNextLink = 0; } @@ -1142,21 +1142,21 @@ AssertValidColor(const TenuredCell *thing, uint32_t color) { #ifdef DEBUG ArenaHeader *aheader = thing->arenaHeader(); - JS_ASSERT(color < aheader->getThingSize() / CellSize); + MOZ_ASSERT(color < aheader->getThingSize() / CellSize); #endif } MOZ_ALWAYS_INLINE const TenuredCell * Cell::asTenured() const { - JS_ASSERT(isTenured()); + MOZ_ASSERT(isTenured()); return static_cast(this); } MOZ_ALWAYS_INLINE TenuredCell * Cell::asTenured() { - JS_ASSERT(isTenured()); + MOZ_ASSERT(isTenured()); return static_cast(this); } @@ -1164,7 +1164,7 @@ inline JSRuntime * Cell::runtimeFromMainThread() const { JSRuntime *rt = chunk()->info.trailer.runtime; - JS_ASSERT(CurrentThreadCanAccessRuntime(rt)); + MOZ_ASSERT(CurrentThreadCanAccessRuntime(rt)); return rt; } @@ -1190,8 +1190,8 @@ inline uintptr_t Cell::address() const { uintptr_t addr = uintptr_t(this); - JS_ASSERT(addr % CellSize == 0); - JS_ASSERT(Chunk::withinArenasRange(addr)); + MOZ_ASSERT(addr % CellSize == 0); + MOZ_ASSERT(Chunk::withinArenasRange(addr)); return addr; } @@ -1199,7 +1199,7 @@ Chunk * Cell::chunk() const { uintptr_t addr = uintptr_t(this); - JS_ASSERT(addr % CellSize == 0); + MOZ_ASSERT(addr % CellSize == 0); addr &= ~ChunkMask; return reinterpret_cast(addr); } @@ -1219,7 +1219,7 @@ InFreeList(ArenaHeader *aheader, void *thing) FreeSpan firstSpan(aheader->getFirstFreeSpan()); uintptr_t addr = reinterpret_cast(thing); - JS_ASSERT(Arena::isAligned(addr, aheader->getThingSize())); + MOZ_ASSERT(Arena::isAligned(addr, aheader->getThingSize())); return firstSpan.inFreeList(addr); } @@ -1236,21 +1236,21 @@ Cell::needWriteBarrierPre(JS::Zone *zone) { /* static */ MOZ_ALWAYS_INLINE TenuredCell * TenuredCell::fromPointer(void *ptr) { - JS_ASSERT(static_cast(ptr)->isTenured()); + MOZ_ASSERT(static_cast(ptr)->isTenured()); return static_cast(ptr); } /* static */ MOZ_ALWAYS_INLINE const TenuredCell * TenuredCell::fromPointer(const void *ptr) { - JS_ASSERT(static_cast(ptr)->isTenured()); + MOZ_ASSERT(static_cast(ptr)->isTenured()); return static_cast(ptr); } bool TenuredCell::isMarked(uint32_t color /* = BLACK */) const { - JS_ASSERT(arenaHeader()->allocated()); + MOZ_ASSERT(arenaHeader()->allocated()); AssertValidColor(this, color); return chunk()->bitmap.isMarked(this, color); } @@ -1265,7 +1265,7 @@ TenuredCell::markIfUnmarked(uint32_t color /* = BLACK */) const void TenuredCell::unmark(uint32_t color) const { - JS_ASSERT(color != BLACK); + MOZ_ASSERT(color != BLACK); AssertValidColor(this, color); chunk()->bitmap.unmark(this, color); } @@ -1281,7 +1281,7 @@ TenuredCell::copyMarkBitsFrom(const TenuredCell *src) inline ArenaHeader * TenuredCell::arenaHeader() const { - JS_ASSERT(isTenured()); + MOZ_ASSERT(isTenured()); uintptr_t addr = address(); addr &= ~ArenaMask; return reinterpret_cast(addr); @@ -1297,7 +1297,7 @@ JS::Zone * TenuredCell::zone() const { JS::Zone *zone = arenaHeader()->zone; - JS_ASSERT(CurrentThreadCanAccessZone(zone)); + MOZ_ASSERT(CurrentThreadCanAccessZone(zone)); return zone; } @@ -1317,8 +1317,8 @@ TenuredCell::isInsideZone(JS::Zone *zone) const TenuredCell::readBarrier(TenuredCell *thing) { #ifdef JSGC_INCREMENTAL - JS_ASSERT(!CurrentThreadIsIonCompiling()); - JS_ASSERT(!isNullLike(thing)); + MOZ_ASSERT(!CurrentThreadIsIonCompiling()); + MOZ_ASSERT(!isNullLike(thing)); JS::shadow::Zone *shadowZone = thing->shadowZoneFromAnyThread(); if (shadowZone->needsIncrementalBarrier()) { MOZ_ASSERT(!RuntimeFromMainThreadIsHeapMajorCollecting(shadowZone)); @@ -1326,7 +1326,7 @@ TenuredCell::readBarrier(TenuredCell *thing) shadowZone->barrierTracer()->setTracingName("read barrier"); MarkKind(shadowZone->barrierTracer(), &tmp, MapAllocToTraceKind(thing->getAllocKind())); - JS_ASSERT(tmp == thing); + MOZ_ASSERT(tmp == thing); } if (JS::GCThingIsMarkedGray(thing)) JS::UnmarkGrayGCThingRecursively(thing, MapAllocToTraceKind(thing->getAllocKind())); @@ -1336,7 +1336,7 @@ TenuredCell::readBarrier(TenuredCell *thing) /* static */ MOZ_ALWAYS_INLINE void TenuredCell::writeBarrierPre(TenuredCell *thing) { #ifdef JSGC_INCREMENTAL - JS_ASSERT(!CurrentThreadIsIonCompiling()); + MOZ_ASSERT(!CurrentThreadIsIonCompiling()); if (isNullLike(thing) || !thing->shadowRuntimeFromAnyThread()->needsIncrementalBarrier()) return; @@ -1347,7 +1347,7 @@ TenuredCell::writeBarrierPre(TenuredCell *thing) { shadowZone->barrierTracer()->setTracingName("pre barrier"); MarkKind(shadowZone->barrierTracer(), &tmp, MapAllocToTraceKind(thing->getAllocKind())); - JS_ASSERT(tmp == thing); + MOZ_ASSERT(tmp == thing); } #endif } @@ -1355,7 +1355,7 @@ TenuredCell::writeBarrierPre(TenuredCell *thing) { static MOZ_ALWAYS_INLINE void AssertValidToSkipBarrier(TenuredCell *thing) { - JS_ASSERT(!IsInsideNursery(thing)); + MOZ_ASSERT(!IsInsideNursery(thing)); JS_ASSERT_IF(thing, MapAllocToTraceKind(thing->getAllocKind()) != JSTRACE_OBJECT); } diff --git a/js/src/gc/Iteration.cpp b/js/src/gc/Iteration.cpp index 00aa7c91cf94..4ee24d8fbfb1 100644 --- a/js/src/gc/Iteration.cpp +++ b/js/src/gc/Iteration.cpp @@ -20,7 +20,7 @@ using namespace js::gc; void js::TraceRuntime(JSTracer *trc) { - JS_ASSERT(!IS_GC_MARKING_TRACER(trc)); + MOZ_ASSERT(!IS_GC_MARKING_TRACER(trc)); JSRuntime *rt = trc->runtime(); rt->gc.evictNursery(); @@ -129,7 +129,7 @@ JS_PUBLIC_API(void) JS_IterateCompartments(JSRuntime *rt, void *data, JSIterateCompartmentCallback compartmentCallback) { - JS_ASSERT(!rt->isHeapBusy()); + MOZ_ASSERT(!rt->isHeapBusy()); AutoTraceSession session(rt); diff --git a/js/src/gc/Marking.cpp b/js/src/gc/Marking.cpp index 7544df24a3d3..6a3425ccfd6a 100644 --- a/js/src/gc/Marking.cpp +++ b/js/src/gc/Marking.cpp @@ -141,7 +141,7 @@ IsThingPoisoned(T *thing) static GCMarker * AsGCMarker(JSTracer *trc) { - JS_ASSERT(IS_GC_MARKING_TRACER(trc)); + MOZ_ASSERT(IS_GC_MARKING_TRACER(trc)); return static_cast(trc); } @@ -158,11 +158,11 @@ static inline void CheckMarkedThing(JSTracer *trc, T **thingp) { #ifdef DEBUG - JS_ASSERT(trc); - JS_ASSERT(thingp); + MOZ_ASSERT(trc); + MOZ_ASSERT(thingp); T *thing = *thingp; - JS_ASSERT(*thingp); + MOZ_ASSERT(*thingp); #ifdef JSGC_COMPACTING thing = MaybeForwarded(thing); @@ -194,21 +194,21 @@ CheckMarkedThing(JSTracer *trc, T **thingp) if (ThingIsPermanentAtom(thing)) return; - JS_ASSERT(thing->zone()); - JS_ASSERT(thing->zone()->runtimeFromMainThread() == trc->runtime()); - JS_ASSERT(trc->hasTracingDetails()); + MOZ_ASSERT(thing->zone()); + MOZ_ASSERT(thing->zone()->runtimeFromMainThread() == trc->runtime()); + MOZ_ASSERT(trc->hasTracingDetails()); DebugOnly rt = trc->runtime(); bool isGcMarkingTracer = IS_GC_MARKING_TRACER(trc); - JS_ASSERT(CurrentThreadCanAccessRuntime(rt)); + MOZ_ASSERT(CurrentThreadCanAccessRuntime(rt)); JS_ASSERT_IF(thing->zone()->requireGCTracer(), isGcMarkingTracer); - JS_ASSERT(thing->isAligned()); + MOZ_ASSERT(thing->isAligned()); - JS_ASSERT(MapTypeToTraceKind::kind == GetGCThingTraceKind(thing)); + MOZ_ASSERT(MapTypeToTraceKind::kind == GetGCThingTraceKind(thing)); if (isGcMarkingTracer) { GCMarker *gcMarker = static_cast(trc); @@ -218,9 +218,9 @@ CheckMarkedThing(JSTracer *trc, T **thingp) JS_ASSERT_IF(gcMarker->getMarkColor() == GRAY, !thing->zone()->isGCMarkingBlack() || rt->isAtomsZone(thing->zone())); - JS_ASSERT(!(thing->zone()->isGCSweeping() || - thing->zone()->isGCFinished() || - thing->zone()->isGCCompacting())); + MOZ_ASSERT(!(thing->zone()->isGCSweeping() || + thing->zone()->isGCFinished() || + thing->zone()->isGCCompacting())); } /* @@ -275,8 +275,8 @@ MarkInternal(JSTracer *trc, T **thingp) * those should all be using a ForkJoinNurseryCollectionTracer * that carries a callback. */ - JS_ASSERT(!ForkJoinContext::current()); - JS_ASSERT(!trc->runtime()->isFJMinorCollecting()); + MOZ_ASSERT(!ForkJoinContext::current()); + MOZ_ASSERT(!trc->runtime()->isFJMinorCollecting()); #endif /* @@ -342,7 +342,7 @@ MarkPermanentAtom(JSTracer *trc, JSAtom *atom, const char *name) { trc->setTracingName(name); - JS_ASSERT(atom->isPermanent()); + MOZ_ASSERT(atom->isPermanent()); CheckMarkedThing(trc, &atom); @@ -353,7 +353,7 @@ MarkPermanentAtom(JSTracer *trc, JSAtom *atom, const char *name) } else { void *thing = atom; trc->callback(trc, &thing, JSTRACE_STRING); - JS_ASSERT(thing == atom); + MOZ_ASSERT(thing == atom); trc->unsetTracingLocation(); } @@ -428,8 +428,8 @@ template static bool IsMarked(T **thingp) { - JS_ASSERT(thingp); - JS_ASSERT(*thingp); + MOZ_ASSERT(thingp); + MOZ_ASSERT(*thingp); #ifdef JSGC_GENERATIONAL JSRuntime* rt = (*thingp)->runtimeFromAnyThread(); #ifdef JSGC_FJGENERATIONAL @@ -464,8 +464,8 @@ template static bool IsAboutToBeFinalized(T **thingp) { - JS_ASSERT(thingp); - JS_ASSERT(*thingp); + MOZ_ASSERT(thingp); + MOZ_ASSERT(*thingp); T *thing = *thingp; JSRuntime *rt = thing->runtimeFromAnyThread(); @@ -523,7 +523,7 @@ template T * UpdateIfRelocated(JSRuntime *rt, T **thingp) { - JS_ASSERT(thingp); + MOZ_ASSERT(thingp); if (!*thingp) return nullptr; @@ -662,8 +662,8 @@ DeclMarkerImpl(TypeObject, js::types::TypeObject) void gc::MarkKind(JSTracer *trc, void **thingp, JSGCTraceKind kind) { - JS_ASSERT(thingp); - JS_ASSERT(*thingp); + MOZ_ASSERT(thingp); + MOZ_ASSERT(*thingp); DebugOnly cell = static_cast(*thingp); JS_ASSERT_IF(cell->isTenured(), kind == MapAllocToTraceKind(cell->asTenured()->getAllocKind())); @@ -702,7 +702,7 @@ static void MarkGCThingInternal(JSTracer *trc, void **thingp, const char *name) { trc->setTracingName(name); - JS_ASSERT(thingp); + MOZ_ASSERT(thingp); if (!*thingp) return; MarkKind(trc, thingp, GetGCThingTraceKind(*thingp)); @@ -789,7 +789,7 @@ static inline void MarkValueInternal(JSTracer *trc, Value *v) { if (v->isMarkable()) { - JS_ASSERT(v->toGCThing()); + MOZ_ASSERT(v->toGCThing()); void *thing = v->toGCThing(); trc->setTracingLocation((void *)v); MarkKind(trc, &thing, v->gcKind()); @@ -798,7 +798,7 @@ MarkValueInternal(JSTracer *trc, Value *v) } else if (v->isObject()) { v->setObjectOrNull((JSObject *)thing); } else { - JS_ASSERT(v->isSymbol()); + MOZ_ASSERT(v->isSymbol()); v->setSymbol((JS::Symbol *)thing); } } else { @@ -860,7 +860,7 @@ gc::MarkValueRootRange(JSTracer *trc, size_t len, Value *vec, const char *name) bool gc::IsValueMarked(Value *v) { - JS_ASSERT(v->isMarkable()); + MOZ_ASSERT(v->isMarkable()); bool rv; if (v->isString()) { JSString *str = (JSString *)v->toGCThing(); @@ -871,7 +871,7 @@ gc::IsValueMarked(Value *v) rv = IsMarked(&obj); v->setObject(*obj); } else { - JS_ASSERT(v->isSymbol()); + MOZ_ASSERT(v->isSymbol()); JS::Symbol *sym = v->toSymbol(); rv = IsMarked(&sym); v->setSymbol(sym); @@ -882,7 +882,7 @@ gc::IsValueMarked(Value *v) bool gc::IsValueAboutToBeFinalized(Value *v) { - JS_ASSERT(v->isMarkable()); + MOZ_ASSERT(v->isMarkable()); bool rv; if (v->isString()) { JSString *str = (JSString *)v->toGCThing(); @@ -893,7 +893,7 @@ gc::IsValueAboutToBeFinalized(Value *v) rv = IsAboutToBeFinalized(&obj); v->setObject(*obj); } else { - JS_ASSERT(v->isSymbol()); + MOZ_ASSERT(v->isSymbol()); JS::Symbol *sym = v->toSymbol(); rv = IsAboutToBeFinalized(&sym); v->setSymbol(sym); @@ -928,7 +928,7 @@ gc::MarkArraySlots(JSTracer *trc, size_t len, HeapSlot *vec, const char *name) void gc::MarkObjectSlots(JSTracer *trc, JSObject *obj, uint32_t start, uint32_t nslots) { - JS_ASSERT(obj->isNative()); + MOZ_ASSERT(obj->isNative()); for (uint32_t i = start; i < (start + nslots); ++i) { trc->setTracingDetails(js_GetObjectSlotName, obj, i); MarkValueInternal(trc, obj->nativeGetSlotRef(i).unsafeGet()); @@ -942,10 +942,10 @@ ShouldMarkCrossCompartment(JSTracer *trc, JSObject *src, Cell *cell) return true; uint32_t color = AsGCMarker(trc)->getMarkColor(); - JS_ASSERT(color == BLACK || color == GRAY); + MOZ_ASSERT(color == BLACK || color == GRAY); if (IsInsideNursery(cell)) { - JS_ASSERT(color == BLACK); + MOZ_ASSERT(color == BLACK); return false; } TenuredCell *tenured = cell->asTenured(); @@ -960,7 +960,7 @@ ShouldMarkCrossCompartment(JSTracer *trc, JSObject *src, Cell *cell) * but the source was marked black by the conservative scanner. */ if (tenured->isMarked(GRAY)) { - JS_ASSERT(!zone->isCollecting()); + MOZ_ASSERT(!zone->isCollecting()); trc->runtime()->gc.setFoundBlackGrayEdges(); } return zone->isGCMarking(); @@ -1025,11 +1025,11 @@ gc::IsCellAboutToBeFinalized(Cell **thingp) /*** Push Mark Stack ***/ #define JS_COMPARTMENT_ASSERT(rt, thing) \ - JS_ASSERT((thing)->zone()->isGCMarking()) + MOZ_ASSERT((thing)->zone()->isGCMarking()) #define JS_COMPARTMENT_ASSERT_STR(rt, thing) \ - JS_ASSERT((thing)->zone()->isGCMarking() || \ - (rt)->isAtomsZone((thing)->zone())); + MOZ_ASSERT((thing)->zone()->isGCMarking() || \ + (rt)->isAtomsZone((thing)->zone())); // Symbols can also be in the atoms zone. #define JS_COMPARTMENT_ASSERT_SYM(rt, sym) \ @@ -1039,7 +1039,7 @@ static void PushMarkStack(GCMarker *gcmarker, ObjectImpl *thing) { JS_COMPARTMENT_ASSERT(gcmarker->runtime(), thing); - JS_ASSERT(!IsInsideNursery(thing)); + MOZ_ASSERT(!IsInsideNursery(thing)); if (thing->asTenured()->markIfUnmarked(gcmarker->getMarkColor())) gcmarker->pushObject(thing); @@ -1067,7 +1067,7 @@ static void PushMarkStack(GCMarker *gcmarker, JSFunction *thing) { JS_COMPARTMENT_ASSERT(gcmarker->runtime(), thing); - JS_ASSERT(!IsInsideNursery(thing)); + MOZ_ASSERT(!IsInsideNursery(thing)); if (thing->asTenured()->markIfUnmarked(gcmarker->getMarkColor())) gcmarker->pushObject(thing); @@ -1077,7 +1077,7 @@ static void PushMarkStack(GCMarker *gcmarker, types::TypeObject *thing) { JS_COMPARTMENT_ASSERT(gcmarker->runtime(), thing); - JS_ASSERT(!IsInsideNursery(thing)); + MOZ_ASSERT(!IsInsideNursery(thing)); if (thing->markIfUnmarked(gcmarker->getMarkColor())) gcmarker->pushType(thing); @@ -1087,7 +1087,7 @@ static void PushMarkStack(GCMarker *gcmarker, JSScript *thing) { JS_COMPARTMENT_ASSERT(gcmarker->runtime(), thing); - JS_ASSERT(!IsInsideNursery(thing)); + MOZ_ASSERT(!IsInsideNursery(thing)); /* * We mark scripts directly rather than pushing on the stack as they can @@ -1102,7 +1102,7 @@ static void PushMarkStack(GCMarker *gcmarker, LazyScript *thing) { JS_COMPARTMENT_ASSERT(gcmarker->runtime(), thing); - JS_ASSERT(!IsInsideNursery(thing)); + MOZ_ASSERT(!IsInsideNursery(thing)); /* * We mark lazy scripts directly rather than pushing on the stack as they @@ -1119,7 +1119,7 @@ static void PushMarkStack(GCMarker *gcmarker, Shape *thing) { JS_COMPARTMENT_ASSERT(gcmarker->runtime(), thing); - JS_ASSERT(!IsInsideNursery(thing)); + MOZ_ASSERT(!IsInsideNursery(thing)); /* We mark shapes directly rather than pushing on the stack. */ if (thing->markIfUnmarked(gcmarker->getMarkColor())) @@ -1130,7 +1130,7 @@ static void PushMarkStack(GCMarker *gcmarker, jit::JitCode *thing) { JS_COMPARTMENT_ASSERT(gcmarker->runtime(), thing); - JS_ASSERT(!IsInsideNursery(thing)); + MOZ_ASSERT(!IsInsideNursery(thing)); if (thing->markIfUnmarked(gcmarker->getMarkColor())) gcmarker->pushJitCode(thing); @@ -1143,7 +1143,7 @@ static void PushMarkStack(GCMarker *gcmarker, BaseShape *thing) { JS_COMPARTMENT_ASSERT(gcmarker->runtime(), thing); - JS_ASSERT(!IsInsideNursery(thing)); + MOZ_ASSERT(!IsInsideNursery(thing)); /* We mark base shapes directly rather than pushing on the stack. */ if (thing->markIfUnmarked(gcmarker->getMarkColor())) @@ -1196,7 +1196,7 @@ ScanBaseShape(GCMarker *gcmarker, BaseShape *base) */ if (base->isOwned()) { UnownedBaseShape *unowned = base->baseUnowned(); - JS_ASSERT(base->compartment() == unowned->compartment()); + MOZ_ASSERT(base->compartment() == unowned->compartment()); unowned->markIfUnmarked(gcmarker->getMarkColor()); } } @@ -1205,16 +1205,16 @@ static inline void ScanLinearString(GCMarker *gcmarker, JSLinearString *str) { JS_COMPARTMENT_ASSERT_STR(gcmarker->runtime(), str); - JS_ASSERT(str->isMarked()); + MOZ_ASSERT(str->isMarked()); /* * Add extra asserts to confirm the static type to detect incorrect string * mutations. */ - JS_ASSERT(str->JSString::isLinear()); + MOZ_ASSERT(str->JSString::isLinear()); while (str->hasBase()) { str = str->base(); - JS_ASSERT(str->JSString::isLinear()); + MOZ_ASSERT(str->JSString::isLinear()); if (str->isPermanentAtom()) break; JS_COMPARTMENT_ASSERT_STR(gcmarker->runtime(), str); @@ -1241,7 +1241,7 @@ ScanRope(GCMarker *gcmarker, JSRope *rope) JS_DIAGNOSTICS_ASSERT(GetGCThingTraceKind(rope) == JSTRACE_STRING); JS_DIAGNOSTICS_ASSERT(rope->JSString::isRope()); JS_COMPARTMENT_ASSERT_STR(gcmarker->runtime(), rope); - JS_ASSERT(rope->isMarked()); + MOZ_ASSERT(rope->isMarked()); JSRope *next = nullptr; JSString *right = rope->rightChild(); @@ -1269,13 +1269,13 @@ ScanRope(GCMarker *gcmarker, JSRope *rope) if (next) { rope = next; } else if (savedPos != gcmarker->stack.position()) { - JS_ASSERT(savedPos < gcmarker->stack.position()); + MOZ_ASSERT(savedPos < gcmarker->stack.position()); rope = reinterpret_cast(gcmarker->stack.pop()); } else { break; } } - JS_ASSERT(savedPos == gcmarker->stack.position()); + MOZ_ASSERT(savedPos == gcmarker->stack.position()); } static inline void @@ -1320,7 +1320,7 @@ PushMarkStack(GCMarker *gcmarker, JS::Symbol *sym) return; JS_COMPARTMENT_ASSERT_SYM(gcmarker->runtime(), sym); - JS_ASSERT(!IsInsideNursery(sym)); + MOZ_ASSERT(!IsInsideNursery(sym)); if (sym->markIfUnmarked()) ScanSymbol(gcmarker, sym); @@ -1382,7 +1382,7 @@ gc::MarkChildren(JSTracer *trc, BaseShape *base) static inline void MarkCycleCollectorChildren(JSTracer *trc, BaseShape *base, JSObject **prevParent) { - JS_ASSERT(base); + MOZ_ASSERT(base); /* * The cycle collector does not need to trace unowned base shapes, @@ -1394,19 +1394,19 @@ MarkCycleCollectorChildren(JSTracer *trc, BaseShape *base, JSObject **prevParent if (base->hasGetterObject()) { JSObject *tmp = base->getterObject(); MarkObjectUnbarriered(trc, &tmp, "getter"); - JS_ASSERT(tmp == base->getterObject()); + MOZ_ASSERT(tmp == base->getterObject()); } if (base->hasSetterObject()) { JSObject *tmp = base->setterObject(); MarkObjectUnbarriered(trc, &tmp, "setter"); - JS_ASSERT(tmp == base->setterObject()); + MOZ_ASSERT(tmp == base->setterObject()); } JSObject *parent = base->getObjectParent(); if (parent && parent != *prevParent) { MarkObjectUnbarriered(trc, &parent, "parent"); - JS_ASSERT(parent == base->getObjectParent()); + MOZ_ASSERT(parent == base->getObjectParent()); *prevParent = parent; } } @@ -1567,11 +1567,11 @@ GCMarker::saveValueRanges() p -= 2; SlotArrayLayout *arr = reinterpret_cast(p); JSObject *obj = arr->obj; - JS_ASSERT(obj->isNative()); + MOZ_ASSERT(obj->isNative()); HeapSlot *vp = obj->getDenseElements(); if (arr->end == vp + obj->getDenseInitializedLength()) { - JS_ASSERT(arr->start >= vp); + MOZ_ASSERT(arr->start >= vp); arr->index = arr->start - vp; arr->kind = HeapSlot::Element; } else { @@ -1580,11 +1580,11 @@ GCMarker::saveValueRanges() if (arr->start == arr->end) { arr->index = obj->slotSpan(); } else if (arr->start >= vp && arr->start < vp + nfixed) { - JS_ASSERT(arr->end == vp + Min(nfixed, obj->slotSpan())); + MOZ_ASSERT(arr->end == vp + Min(nfixed, obj->slotSpan())); arr->index = arr->start - vp; } else { - JS_ASSERT(arr->start >= obj->slots && - arr->end == obj->slots + obj->slotSpan() - nfixed); + MOZ_ASSERT(arr->start >= obj->slots && + arr->end == obj->slots + obj->slotSpan() - nfixed); arr->index = (arr->start - obj->slots) + nfixed; } arr->kind = HeapSlot::Slot; @@ -1616,7 +1616,7 @@ GCMarker::restoreValueArray(JSObject *obj, void **vpp, void **endp) *vpp = *endp = vp; } } else { - JS_ASSERT(kind == HeapSlot::Slot); + MOZ_ASSERT(kind == HeapSlot::Slot); HeapSlot *vp = obj->fixedSlots(); unsigned nfixed = obj->numFixedSlots(); unsigned nslots = obj->slotSpan(); @@ -1634,7 +1634,7 @@ GCMarker::restoreValueArray(JSObject *obj, void **vpp, void **endp) } } - JS_ASSERT(*vpp <= *endp); + MOZ_ASSERT(*vpp <= *endp); return true; } @@ -1644,7 +1644,7 @@ GCMarker::processMarkStackOther(uintptr_t tag, uintptr_t addr) if (tag == TypeTag) { ScanTypeObject(this, reinterpret_cast(addr)); } else if (tag == SavedValueArrayTag) { - JS_ASSERT(!(addr & CellMask)); + MOZ_ASSERT(!(addr & CellMask)); JSObject *obj = reinterpret_cast(addr); HeapValue *vp, *end; if (restoreValueArray(obj, (void **)&vp, (void **)&end)) @@ -1673,12 +1673,12 @@ GCMarker::processMarkStackTop(SliceBudget &budget) if (tag == ValueArrayTag) { JS_STATIC_ASSERT(ValueArrayTag == 0); - JS_ASSERT(!(addr & CellMask)); + MOZ_ASSERT(!(addr & CellMask)); obj = reinterpret_cast(addr); uintptr_t addr2 = stack.pop(); uintptr_t addr3 = stack.pop(); - JS_ASSERT(addr2 <= addr3); - JS_ASSERT((addr3 - addr2) % sizeof(Value) == 0); + MOZ_ASSERT(addr2 <= addr3); + MOZ_ASSERT((addr3 - addr2) % sizeof(Value) == 0); vp = reinterpret_cast(addr2); end = reinterpret_cast(addr3); goto scan_value_array; @@ -1694,21 +1694,21 @@ GCMarker::processMarkStackTop(SliceBudget &budget) return; scan_value_array: - JS_ASSERT(vp <= end); + MOZ_ASSERT(vp <= end); while (vp != end) { const Value &v = *vp++; if (v.isString()) { JSString *str = v.toString(); if (!str->isPermanentAtom()) { JS_COMPARTMENT_ASSERT_STR(runtime(), str); - JS_ASSERT(runtime()->isAtomsZone(str->zone()) || str->zone() == obj->zone()); + MOZ_ASSERT(runtime()->isAtomsZone(str->zone()) || str->zone() == obj->zone()); if (str->markIfUnmarked()) ScanString(this, str); } } else if (v.isObject()) { JSObject *obj2 = &v.toObject(); JS_COMPARTMENT_ASSERT(runtime(), obj2); - JS_ASSERT(obj->compartment() == obj2->compartment()); + MOZ_ASSERT(obj->compartment() == obj2->compartment()); if (obj2->asTenured()->markIfUnmarked(getMarkColor())) { pushValueArray(obj, vp, end); obj = obj2; @@ -1790,7 +1790,7 @@ GCMarker::processMarkStackTop(SliceBudget &budget) goto scan_value_array; } } - JS_ASSERT(nslots <= obj->numFixedSlots()); + MOZ_ASSERT(nslots <= obj->numFixedSlots()); end = vp + nslots; goto scan_value_array; } @@ -1803,7 +1803,7 @@ GCMarker::drainMarkStack(SliceBudget &budget) struct AutoCheckCompartment { bool &flag; explicit AutoCheckCompartment(bool &comparmentCheckFlag) : flag(comparmentCheckFlag) { - JS_ASSERT(!flag); + MOZ_ASSERT(!flag); flag = true; } ~AutoCheckCompartment() { flag = false; } @@ -1991,19 +1991,19 @@ UnmarkGrayChildren(JSTracer *trc, void **thingp, JSGCTraceKind kind) if (kind != JSTRACE_SHAPE) { JS_TraceChildren(&childTracer, thing, kind); - JS_ASSERT(!childTracer.previousShape); + MOZ_ASSERT(!childTracer.previousShape); tracer->unmarkedAny |= childTracer.unmarkedAny; return; } if (tracer->tracingShape) { - JS_ASSERT(!tracer->previousShape); + MOZ_ASSERT(!tracer->previousShape); tracer->previousShape = thing; return; } do { - JS_ASSERT(!JS::GCThingIsMarkedGray(thing)); + MOZ_ASSERT(!JS::GCThingIsMarkedGray(thing)); JS_TraceChildren(&childTracer, thing, JSTRACE_SHAPE); thing = childTracer.previousShape; childTracer.previousShape = nullptr; diff --git a/js/src/gc/Marking.h b/js/src/gc/Marking.h index 7e34adfe3836..ce2ecd1a95d2 100644 --- a/js/src/gc/Marking.h +++ b/js/src/gc/Marking.h @@ -391,12 +391,12 @@ ToMarkable(Cell *cell) inline JSGCTraceKind TraceKind(const Value &v) { - JS_ASSERT(v.isMarkable()); + MOZ_ASSERT(v.isMarkable()); if (v.isObject()) return JSTRACE_OBJECT; if (v.isString()) return JSTRACE_STRING; - JS_ASSERT(v.isSymbol()); + MOZ_ASSERT(v.isSymbol()); return JSTRACE_SYMBOL; } diff --git a/js/src/gc/Nursery-inl.h b/js/src/gc/Nursery-inl.h index 17804440d085..cf7b89bfe638 100644 --- a/js/src/gc/Nursery-inl.h +++ b/js/src/gc/Nursery-inl.h @@ -20,8 +20,8 @@ template MOZ_ALWAYS_INLINE bool js::Nursery::getForwardedPointer(T **ref) { - JS_ASSERT(ref); - JS_ASSERT(isInside((void *)*ref)); + MOZ_ASSERT(ref); + MOZ_ASSERT(isInside((void *)*ref)); const gc::RelocationOverlay *overlay = reinterpret_cast(*ref); if (!overlay->isForwarded()) return false; diff --git a/js/src/gc/Nursery.cpp b/js/src/gc/Nursery.cpp index a4aec9db61a6..5f5a4f83e664 100644 --- a/js/src/gc/Nursery.cpp +++ b/js/src/gc/Nursery.cpp @@ -78,7 +78,7 @@ js::Nursery::init(uint32_t maxNurseryBytes) GCReportThreshold = atoi(env); #endif - JS_ASSERT(isEnabled()); + MOZ_ASSERT(isEnabled()); return true; } @@ -98,8 +98,8 @@ js::Nursery::updateDecommittedRegion() # ifndef XP_MACOSX uintptr_t decommitStart = chunk(numActiveChunks_).start(); uintptr_t decommitSize = heapEnd() - decommitStart; - JS_ASSERT(decommitStart == AlignBytes(decommitStart, Alignment)); - JS_ASSERT(decommitSize == AlignBytes(decommitStart, Alignment)); + MOZ_ASSERT(decommitStart == AlignBytes(decommitStart, Alignment)); + MOZ_ASSERT(decommitSize == AlignBytes(decommitStart, Alignment)); MarkPagesUnused((void *)decommitStart, decommitSize); # endif } @@ -125,7 +125,7 @@ js::Nursery::enable() void js::Nursery::disable() { - JS_ASSERT(isEmpty()); + MOZ_ASSERT(isEmpty()); if (!isEnabled()) return; numActiveChunks_ = 0; @@ -136,7 +136,7 @@ js::Nursery::disable() bool js::Nursery::isEmpty() const { - JS_ASSERT(runtime_); + MOZ_ASSERT(runtime_); if (!isEnabled()) return true; JS_ASSERT_IF(runtime_->gcZeal() != ZealGenerationalGCValue, currentStart_ == start()); @@ -153,7 +153,7 @@ js::Nursery::enterZealMode() { void js::Nursery::leaveZealMode() { if (isEnabled()) { - JS_ASSERT(isEmpty()); + MOZ_ASSERT(isEmpty()); setCurrentChunk(0); currentStart_ = start(); } @@ -164,7 +164,7 @@ JSObject * js::Nursery::allocateObject(JSContext *cx, size_t size, size_t numDynamic) { /* Ensure there's enough space to replace the contents with a RelocationOverlay. */ - JS_ASSERT(size >= sizeof(RelocationOverlay)); + MOZ_ASSERT(size >= sizeof(RelocationOverlay)); /* Attempt to allocate slots contiguously after object, if possible. */ if (numDynamic && numDynamic <= MaxNurserySlots) { @@ -199,9 +199,9 @@ js::Nursery::allocateObject(JSContext *cx, size_t size, size_t numDynamic) void * js::Nursery::allocate(size_t size) { - JS_ASSERT(isEnabled()); - JS_ASSERT(!runtime()->isHeapBusy()); - JS_ASSERT(position() >= currentStart_); + MOZ_ASSERT(isEnabled()); + MOZ_ASSERT(!runtime()->isHeapBusy()); + MOZ_ASSERT(position() >= currentStart_); if (currentEnd() < position() + size) { if (currentChunk_ + 1 == numActiveChunks_) @@ -220,8 +220,8 @@ js::Nursery::allocate(size_t size) HeapSlot * js::Nursery::allocateSlots(JSObject *obj, uint32_t nslots) { - JS_ASSERT(obj); - JS_ASSERT(nslots > 0); + MOZ_ASSERT(obj); + MOZ_ASSERT(nslots > 0); if (!IsInsideNursery(obj)) return obj->zone()->pod_malloc(nslots); @@ -240,7 +240,7 @@ js::Nursery::allocateSlots(JSObject *obj, uint32_t nslots) ObjectElements * js::Nursery::allocateElements(JSObject *obj, uint32_t nelems) { - JS_ASSERT(nelems >= ObjectElements::VALUES_PER_HEADER); + MOZ_ASSERT(nelems >= ObjectElements::VALUES_PER_HEADER); return reinterpret_cast(allocateSlots(obj, nelems)); } @@ -367,7 +367,7 @@ static AllocKind GetObjectAllocKindForCopy(const Nursery &nursery, JSObject *obj) { if (obj->is()) { - JS_ASSERT(obj->numFixedSlots() == 0); + MOZ_ASSERT(obj->numFixedSlots() == 0); /* Use minimal size object if we are just going to copy the pointer. */ if (!nursery.isInside(obj->getElementsHeader())) @@ -400,8 +400,8 @@ GetObjectAllocKindForCopy(const Nursery &nursery, JSObject *obj) } AllocKind kind = GetGCObjectFixedSlotsKind(obj->numFixedSlots()); - JS_ASSERT(!IsBackgroundFinalized(kind)); - JS_ASSERT(CanBeFinalizedInBackground(kind, obj->getClass())); + MOZ_ASSERT(!IsBackgroundFinalized(kind)); + MOZ_ASSERT(CanBeFinalizedInBackground(kind, obj->getClass())); return GetBackgroundAllocKind(kind); } @@ -418,9 +418,9 @@ js::Nursery::allocateFromTenured(Zone *zone, AllocKind thingKind) void js::Nursery::setSlotsForwardingPointer(HeapSlot *oldSlots, HeapSlot *newSlots, uint32_t nslots) { - JS_ASSERT(nslots > 0); - JS_ASSERT(isInside(oldSlots)); - JS_ASSERT(!isInside(newSlots)); + MOZ_ASSERT(nslots > 0); + MOZ_ASSERT(isInside(oldSlots)); + MOZ_ASSERT(!isInside(newSlots)); *reinterpret_cast(oldSlots) = newSlots; } @@ -434,8 +434,8 @@ js::Nursery::setElementsForwardingPointer(ObjectElements *oldHeader, ObjectEleme */ if (nelems - ObjectElements::VALUES_PER_HEADER < 1) return; - JS_ASSERT(isInside(oldHeader)); - JS_ASSERT(!isInside(newHeader)); + MOZ_ASSERT(isInside(oldHeader)); + MOZ_ASSERT(!isInside(newHeader)); *reinterpret_cast(oldHeader->elements()) = newHeader->elements(); } @@ -465,8 +465,8 @@ js::Nursery::forwardBufferPointer(HeapSlot **pSlotsElems) * word of |old| here. */ *pSlotsElems = *reinterpret_cast(old); - JS_ASSERT(!isInside(*pSlotsElems)); - JS_ASSERT(IsWriteableAddress(*pSlotsElems)); + MOZ_ASSERT(!isInside(*pSlotsElems)); + MOZ_ASSERT(IsWriteableAddress(*pSlotsElems)); } // Structure for counting how many times objects of a particular type have been @@ -628,7 +628,7 @@ js::Nursery::forwardTypedArrayPointers(JSObject *dst, JSObject *src) void *srcData = src->fixedData(TypedArrayObject::FIXED_DATA_START); void *dstData = dst->fixedData(TypedArrayObject::FIXED_DATA_START); - JS_ASSERT(src->getPrivate() == srcData); + MOZ_ASSERT(src->getPrivate() == srcData); dst->setPrivate(dstData); /* @@ -676,7 +676,7 @@ js::Nursery::moveElementsToTenured(JSObject *dst, JSObject *src, AllocKind dstKi /* TODO Bug 874151: Prefer to put element data inline if we have space. */ if (!isInside(srcHeader)) { - JS_ASSERT(src->elements == dst->elements); + MOZ_ASSERT(src->elements == dst->elements); hugeSlots.remove(reinterpret_cast(srcHeader)); return 0; } @@ -692,7 +692,7 @@ js::Nursery::moveElementsToTenured(JSObject *dst, JSObject *src, AllocKind dstKi return nslots * sizeof(HeapSlot); } - JS_ASSERT(nslots >= 2); + MOZ_ASSERT(nslots >= 2); dstHeader = reinterpret_cast(zone->pod_malloc(nslots)); if (!dstHeader) CrashAtUnhandlableOOM("Failed to allocate elements while tenuring."); diff --git a/js/src/gc/Nursery.h b/js/src/gc/Nursery.h index ca92ae377580..6eb368885a3e 100644 --- a/js/src/gc/Nursery.h +++ b/js/src/gc/Nursery.h @@ -219,8 +219,8 @@ class Nursery static_assert(sizeof(NurseryChunkLayout) == gc::ChunkSize, "Nursery chunk size must match gc::Chunk size."); NurseryChunkLayout &chunk(int index) const { - JS_ASSERT(index < numNurseryChunks_); - JS_ASSERT(start()); + MOZ_ASSERT(index < numNurseryChunks_); + MOZ_ASSERT(start()); return reinterpret_cast(start())[index]; } @@ -232,8 +232,8 @@ class Nursery } MOZ_ALWAYS_INLINE void setCurrentChunk(int chunkno) { - JS_ASSERT(chunkno < numNurseryChunks_); - JS_ASSERT(chunkno < numActiveChunks_); + MOZ_ASSERT(chunkno < numNurseryChunks_); + MOZ_ASSERT(chunkno < numActiveChunks_); currentChunk_ = chunkno; position_ = chunk(chunkno).start(); currentEnd_ = chunk(chunkno).end(); @@ -243,17 +243,17 @@ class Nursery void updateDecommittedRegion(); MOZ_ALWAYS_INLINE uintptr_t allocationEnd() const { - JS_ASSERT(numActiveChunks_ > 0); + MOZ_ASSERT(numActiveChunks_ > 0); return chunk(numActiveChunks_ - 1).end(); } MOZ_ALWAYS_INLINE uintptr_t currentEnd() const { - JS_ASSERT(runtime_); - JS_ASSERT(currentEnd_ == chunk(currentChunk_).end()); + MOZ_ASSERT(runtime_); + MOZ_ASSERT(currentEnd_ == chunk(currentChunk_).end()); return currentEnd_; } void *addressOfCurrentEnd() const { - JS_ASSERT(runtime_); + MOZ_ASSERT(runtime_); return (void *)¤tEnd_; } diff --git a/js/src/gc/RootMarking.cpp b/js/src/gc/RootMarking.cpp index 04f842fad711..b23941ce97f3 100644 --- a/js/src/gc/RootMarking.cpp +++ b/js/src/gc/RootMarking.cpp @@ -158,7 +158,7 @@ ConservativeGCData::recordStackTop() void JS::AutoIdArray::trace(JSTracer *trc) { - JS_ASSERT(tag_ == IDARRAY); + MOZ_ASSERT(tag_ == IDARRAY); gc::MarkIdRange(trc, idArray->length, idArray->vector, "JSAutoIdArray.idArray"); } @@ -323,7 +323,7 @@ AutoGCRooter::trace(JSTracer *trc) return; } - JS_ASSERT(tag_ >= 0); + MOZ_ASSERT(tag_ >= 0); if (Value *vp = static_cast(this)->array) MarkValueRootRange(trc, tag_, vp, "JS::AutoArrayRooter.array"); } @@ -446,7 +446,7 @@ js::gc::MarkForkJoinStack(ForkJoinNurseryCollectionTracer *trc) // There should be only JIT activations on the stack for (ActivationIterator iter(ptd); !iter.done(); ++iter) { Activation *act = iter.activation(); - JS_ASSERT(act->isJit()); + MOZ_ASSERT(act->isJit()); } #endif } @@ -457,11 +457,11 @@ js::gc::GCRuntime::markRuntime(JSTracer *trc, TraceOrMarkRuntime traceOrMark, TraceRootsOrUsedSaved rootsSource) { - JS_ASSERT(trc->callback != GCMarker::GrayCallback); - JS_ASSERT(traceOrMark == TraceRuntime || traceOrMark == MarkRuntime); - JS_ASSERT(rootsSource == TraceRoots || rootsSource == UseSavedRoots); + MOZ_ASSERT(trc->callback != GCMarker::GrayCallback); + MOZ_ASSERT(traceOrMark == TraceRuntime || traceOrMark == MarkRuntime); + MOZ_ASSERT(rootsSource == TraceRoots || rootsSource == UseSavedRoots); - JS_ASSERT(!rt->mainThread.suppressGC); + MOZ_ASSERT(!rt->mainThread.suppressGC); if (traceOrMark == MarkRuntime) { for (CompartmentsIter c(rt, SkipAtoms); !c.done(); c.next()) { @@ -527,7 +527,7 @@ js::gc::GCRuntime::markRuntime(JSTracer *trc, JSScript *script = i.get(); if (script->hasScriptCounts()) { MarkScriptRoot(trc, &script, "profilingScripts"); - JS_ASSERT(script == i.get()); + MOZ_ASSERT(script == i.get()); } } } diff --git a/js/src/gc/Statistics.cpp b/js/src/gc/Statistics.cpp index d28f249c861b..0bacc5921abd 100644 --- a/js/src/gc/Statistics.cpp +++ b/js/src/gc/Statistics.cpp @@ -645,7 +645,7 @@ Statistics::Statistics(JSRuntime *rt) fullFormat = true; fp = fopen(env, "a"); - JS_ASSERT(fp); + MOZ_ASSERT(fp); } } @@ -812,12 +812,12 @@ void Statistics::beginPhase(Phase phase) { /* Guard against re-entry */ - JS_ASSERT(!phaseStartTimes[phase]); + MOZ_ASSERT(!phaseStartTimes[phase]); #ifdef DEBUG - JS_ASSERT(phases[phase].index == phase); + MOZ_ASSERT(phases[phase].index == phase); Phase parent = phaseNestingDepth ? phaseNesting[phaseNestingDepth - 1] : PHASE_NO_PARENT; - JS_ASSERT(phaseNestingDepth < MAX_NESTING); + MOZ_ASSERT(phaseNestingDepth < MAX_NESTING); JS_ASSERT_IF(gcDepth == 1, phases[phase].parent == parent); phaseNesting[phaseNestingDepth] = phase; phaseNestingDepth++; @@ -864,7 +864,7 @@ Statistics::endSCC(unsigned scc, int64_t start) double Statistics::computeMMU(int64_t window) { - JS_ASSERT(!slices.empty()); + MOZ_ASSERT(!slices.empty()); int64_t gc = slices[0].end - slices[0].start; int64_t gcMax = gc; diff --git a/js/src/gc/Statistics.h b/js/src/gc/Statistics.h index 373661abc355..e96d616d204a 100644 --- a/js/src/gc/Statistics.h +++ b/js/src/gc/Statistics.h @@ -117,7 +117,7 @@ struct Statistics void nonincremental(const char *reason) { nonincrementalReason = reason; } void count(Stat s) { - JS_ASSERT(s < STAT_LIMIT); + MOZ_ASSERT(s < STAT_LIMIT); counts[s]++; } diff --git a/js/src/gc/StoreBuffer.cpp b/js/src/gc/StoreBuffer.cpp index 4e99974a2a6c..ceef03a4aa29 100644 --- a/js/src/gc/StoreBuffer.cpp +++ b/js/src/gc/StoreBuffer.cpp @@ -53,7 +53,7 @@ StoreBuffer::SlotsEdge::mark(JSTracer *trc) void StoreBuffer::WholeCellEdges::mark(JSTracer *trc) { - JS_ASSERT(edge->isTenured()); + MOZ_ASSERT(edge->isTenured()); JSGCTraceKind kind = GetGCThingTraceKind(edge); if (kind <= JSTRACE_OBJECT) { JSObject *object = static_cast(edge); @@ -62,7 +62,7 @@ StoreBuffer::WholeCellEdges::mark(JSTracer *trc) MarkChildren(trc, object); return; } - JS_ASSERT(kind == JSTRACE_JITCODE); + MOZ_ASSERT(kind == JSTRACE_JITCODE); static_cast(edge)->trace(trc); } @@ -72,7 +72,7 @@ StoreBuffer::CellPtrEdge::mark(JSTracer *trc) if (!*edge) return; - JS_ASSERT(GetGCThingTraceKind(*edge) == JSTRACE_OBJECT); + MOZ_ASSERT(GetGCThingTraceKind(*edge) == JSTRACE_OBJECT); MarkObjectRoot(trc, reinterpret_cast(edge), "store buffer edge"); } @@ -139,7 +139,7 @@ template void StoreBuffer::MonoTypeBuffer::compact(StoreBuffer *owner) { - JS_ASSERT(storage_); + MOZ_ASSERT(storage_); compactRemoveDuplicates(owner); usedAtLastCompact_ = storage_->used(); } @@ -148,7 +148,7 @@ template void StoreBuffer::MonoTypeBuffer::maybeCompact(StoreBuffer *owner) { - JS_ASSERT(storage_); + MOZ_ASSERT(storage_); if (storage_->used() != usedAtLastCompact_) compact(owner); } @@ -157,7 +157,7 @@ template void StoreBuffer::MonoTypeBuffer::mark(StoreBuffer *owner, JSTracer *trc) { - JS_ASSERT(owner->isEnabled()); + MOZ_ASSERT(owner->isEnabled()); ReentrancyGuard g(*owner); if (!storage_) return; @@ -206,7 +206,7 @@ StoreBuffer::RelocatableMonoTypeBuffer::compactMoved(StoreBuffer *owner) #ifdef DEBUG for (LifoAlloc::Enum e(storage); !e.empty(); e.popFront()) - JS_ASSERT(!e.get()->isTagged()); + MOZ_ASSERT(!e.get()->isTagged()); #endif } @@ -223,7 +223,7 @@ StoreBuffer::RelocatableMonoTypeBuffer::compact(StoreBuffer *owner) void StoreBuffer::GenericBuffer::mark(StoreBuffer *owner, JSTracer *trc) { - JS_ASSERT(owner->isEnabled()); + MOZ_ASSERT(owner->isEnabled()); ReentrancyGuard g(*owner); if (!storage_) return; @@ -331,8 +331,8 @@ StoreBuffer::addSizeOfExcludingThis(mozilla::MallocSizeOf mallocSizeOf, JS::GCSi JS_PUBLIC_API(void) JS::HeapCellPostBarrier(js::gc::Cell **cellp) { - JS_ASSERT(cellp); - JS_ASSERT(*cellp); + MOZ_ASSERT(cellp); + MOZ_ASSERT(*cellp); StoreBuffer *storeBuffer = (*cellp)->storeBuffer(); if (storeBuffer) storeBuffer->putRelocatableCellFromAnyThread(cellp); @@ -342,8 +342,8 @@ JS_PUBLIC_API(void) JS::HeapCellRelocate(js::gc::Cell **cellp) { /* Called with old contents of *cellp before overwriting. */ - JS_ASSERT(cellp); - JS_ASSERT(*cellp); + MOZ_ASSERT(cellp); + MOZ_ASSERT(*cellp); JSRuntime *runtime = (*cellp)->runtimeFromMainThread(); runtime->gc.storeBuffer.removeRelocatableCellFromAnyThread(cellp); } @@ -351,8 +351,8 @@ JS::HeapCellRelocate(js::gc::Cell **cellp) JS_PUBLIC_API(void) JS::HeapValuePostBarrier(JS::Value *valuep) { - JS_ASSERT(valuep); - JS_ASSERT(valuep->isMarkable()); + MOZ_ASSERT(valuep); + MOZ_ASSERT(valuep->isMarkable()); if (valuep->isObject()) { StoreBuffer *storeBuffer = valuep->toObject().storeBuffer(); if (storeBuffer) @@ -364,8 +364,8 @@ JS_PUBLIC_API(void) JS::HeapValueRelocate(JS::Value *valuep) { /* Called with old contents of *valuep before overwriting. */ - JS_ASSERT(valuep); - JS_ASSERT(valuep->isMarkable()); + MOZ_ASSERT(valuep); + MOZ_ASSERT(valuep->isMarkable()); if (valuep->isString() && valuep->toString()->isPermanentAtom()) return; JSRuntime *runtime = static_cast(valuep->toGCThing())->runtimeFromMainThread(); diff --git a/js/src/gc/StoreBuffer.h b/js/src/gc/StoreBuffer.h index 6e4ee7ed83be..ff2ccad57fab 100644 --- a/js/src/gc/StoreBuffer.h +++ b/js/src/gc/StoreBuffer.h @@ -129,7 +129,7 @@ class StoreBuffer /* Add one item to the buffer. */ void put(StoreBuffer *owner, const T &t) { - JS_ASSERT(storage_); + MOZ_ASSERT(storage_); T *tp = storage_->new_(t); if (!tp) @@ -197,7 +197,7 @@ class StoreBuffer template void put(StoreBuffer *owner, const T &t) { - JS_ASSERT(storage_); + MOZ_ASSERT(storage_); /* Ensure T is derived from BufferableRef. */ (void)static_cast(&t); @@ -241,7 +241,7 @@ class StoreBuffer bool operator!=(const CellPtrEdge &other) const { return edge != other.edge; } bool maybeInRememberedSet(const Nursery &nursery) const { - JS_ASSERT(IsInsideNursery(*edge)); + MOZ_ASSERT(IsInsideNursery(*edge)); return !nursery.isInside(edge); } @@ -265,7 +265,7 @@ class StoreBuffer Cell *deref() const { return edge->isGCThing() ? static_cast(edge->toGCThing()) : nullptr; } bool maybeInRememberedSet(const Nursery &nursery) const { - JS_ASSERT(IsInsideNursery(deref())); + MOZ_ASSERT(IsInsideNursery(deref())); return !nursery.isInside(edge); } @@ -291,10 +291,10 @@ class StoreBuffer SlotsEdge(JSObject *object, int kind, int32_t start, int32_t count) : objectAndKind_(uintptr_t(object) | kind), start_(start), count_(count) { - JS_ASSERT((uintptr_t(object) & 1) == 0); - JS_ASSERT(kind <= 1); - JS_ASSERT(start >= 0); - JS_ASSERT(count > 0); + MOZ_ASSERT((uintptr_t(object) & 1) == 0); + MOZ_ASSERT(kind <= 1); + MOZ_ASSERT(start >= 0); + MOZ_ASSERT(count > 0); } JSObject *object() const { return reinterpret_cast(objectAndKind_ & ~1); } @@ -328,7 +328,7 @@ class StoreBuffer Cell *edge; explicit WholeCellEdges(Cell *cell) : edge(cell) { - JS_ASSERT(edge->isTenured()); + MOZ_ASSERT(edge->isTenured()); } bool operator==(const WholeCellEdges &other) const { return edge == other.edge; } @@ -400,7 +400,7 @@ class StoreBuffer void putFromMainThread(Buffer &buffer, const Edge &edge) { if (!isEnabled()) return; - JS_ASSERT(CurrentThreadCanAccessRuntime(runtime_)); + MOZ_ASSERT(CurrentThreadCanAccessRuntime(runtime_)); mozilla::ReentrancyGuard g(*this); if (edge.maybeInRememberedSet(nursery_)) buffer.put(this, edge); @@ -446,7 +446,7 @@ class StoreBuffer putFromAnyThread(bufferSlot, SlotsEdge(obj, kind, start, count)); } void putWholeCellFromMainThread(Cell *cell) { - JS_ASSERT(cell->isTenured()); + MOZ_ASSERT(cell->isTenured()); putFromMainThread(bufferWholeCell, WholeCellEdges(cell)); } diff --git a/js/src/gc/Tracer.cpp b/js/src/gc/Tracer.cpp index e0b920909135..a706daba7d43 100644 --- a/js/src/gc/Tracer.cpp +++ b/js/src/gc/Tracer.cpp @@ -292,7 +292,7 @@ JSTracer::hasTracingDetails() const const char * JSTracer::tracingName(const char *fallback) const { - JS_ASSERT(hasTracingDetails()); + MOZ_ASSERT(hasTracingDetails()); return debugPrinter_ ? fallback : (const char *)debugPrintArg_; } @@ -362,7 +362,7 @@ MarkStack::init(JSGCMode gcMode) { setBaseCapacity(gcMode); - JS_ASSERT(!stack_); + MOZ_ASSERT(!stack_); uintptr_t *newStack = js_pod_malloc(baseCapacity_); if (!newStack) return false; @@ -393,7 +393,7 @@ MarkStack::setBaseCapacity(JSGCMode mode) void MarkStack::setMaxCapacity(size_t maxCapacity) { - JS_ASSERT(isEmpty()); + MOZ_ASSERT(isEmpty()); maxCapacity_ = maxCapacity; if (baseCapacity_ > maxCapacity_) baseCapacity_ = maxCapacity_; @@ -476,25 +476,25 @@ GCMarker::init(JSGCMode gcMode) void GCMarker::start() { - JS_ASSERT(!started); + MOZ_ASSERT(!started); started = true; color = BLACK; - JS_ASSERT(!unmarkedArenaStackTop); - JS_ASSERT(markLaterArenas == 0); + MOZ_ASSERT(!unmarkedArenaStackTop); + MOZ_ASSERT(markLaterArenas == 0); } void GCMarker::stop() { - JS_ASSERT(isDrained()); + MOZ_ASSERT(isDrained()); - JS_ASSERT(started); + MOZ_ASSERT(started); started = false; - JS_ASSERT(!unmarkedArenaStackTop); - JS_ASSERT(markLaterArenas == 0); + MOZ_ASSERT(!unmarkedArenaStackTop); + MOZ_ASSERT(markLaterArenas == 0); /* Free non-ballast stack memory. */ stack.reset(); @@ -509,20 +509,20 @@ GCMarker::reset() color = BLACK; stack.reset(); - JS_ASSERT(isMarkStackEmpty()); + MOZ_ASSERT(isMarkStackEmpty()); while (unmarkedArenaStackTop) { ArenaHeader *aheader = unmarkedArenaStackTop; - JS_ASSERT(aheader->hasDelayedMarking); - JS_ASSERT(markLaterArenas); + MOZ_ASSERT(aheader->hasDelayedMarking); + MOZ_ASSERT(markLaterArenas); unmarkedArenaStackTop = aheader->getNextDelayedMarking(); aheader->unsetDelayedMarking(); aheader->markOverflow = 0; aheader->allocatedDuringIncremental = 0; markLaterArenas--; } - JS_ASSERT(isDrained()); - JS_ASSERT(!markLaterArenas); + MOZ_ASSERT(isDrained()); + MOZ_ASSERT(!markLaterArenas); } void @@ -540,7 +540,7 @@ GCMarker::markDelayedChildren(ArenaHeader *aheader) } } } else { - JS_ASSERT(aheader->allocatedDuringIncremental); + MOZ_ASSERT(aheader->allocatedDuringIncremental); PushArena(this, aheader); } aheader->allocatedDuringIncremental = 0; @@ -557,7 +557,7 @@ GCMarker::markDelayedChildren(SliceBudget &budget) GCRuntime &gc = runtime()->gc; gcstats::AutoPhase ap(gc.stats, gc.state() == MARK, gcstats::PHASE_MARK_DELAYED); - JS_ASSERT(unmarkedArenaStackTop); + MOZ_ASSERT(unmarkedArenaStackTop); do { /* * If marking gets delayed at the same arena again, we must repeat @@ -565,8 +565,8 @@ GCMarker::markDelayedChildren(SliceBudget &budget) * clear its hasDelayedMarking flag before we begin the marking. */ ArenaHeader *aheader = unmarkedArenaStackTop; - JS_ASSERT(aheader->hasDelayedMarking); - JS_ASSERT(markLaterArenas); + MOZ_ASSERT(aheader->hasDelayedMarking); + MOZ_ASSERT(markLaterArenas); unmarkedArenaStackTop = aheader->getNextDelayedMarking(); aheader->unsetDelayedMarking(); markLaterArenas--; @@ -576,7 +576,7 @@ GCMarker::markDelayedChildren(SliceBudget &budget) if (budget.isOverBudget()) return false; } while (unmarkedArenaStackTop); - JS_ASSERT(!markLaterArenas); + MOZ_ASSERT(!markLaterArenas); return true; } @@ -585,7 +585,7 @@ GCMarker::markDelayedChildren(SliceBudget &budget) void GCMarker::checkZone(void *p) { - JS_ASSERT(started); + MOZ_ASSERT(started); DebugOnly cell = static_cast(p); JS_ASSERT_IF(cell->isTenured(), cell->asTenured()->zone()->isCollecting()); } @@ -600,24 +600,24 @@ GCMarker::hasBufferedGrayRoots() const void GCMarker::startBufferingGrayRoots() { - JS_ASSERT(grayBufferState == GRAY_BUFFER_UNUSED); + MOZ_ASSERT(grayBufferState == GRAY_BUFFER_UNUSED); grayBufferState = GRAY_BUFFER_OK; for (GCZonesIter zone(runtime()); !zone.done(); zone.next()) - JS_ASSERT(zone->gcGrayRoots.empty()); + MOZ_ASSERT(zone->gcGrayRoots.empty()); - JS_ASSERT(!callback); + MOZ_ASSERT(!callback); callback = GrayCallback; - JS_ASSERT(IS_GC_MARKING_TRACER(this)); + MOZ_ASSERT(IS_GC_MARKING_TRACER(this)); } void GCMarker::endBufferingGrayRoots() { - JS_ASSERT(callback == GrayCallback); + MOZ_ASSERT(callback == GrayCallback); callback = nullptr; - JS_ASSERT(IS_GC_MARKING_TRACER(this)); - JS_ASSERT(grayBufferState == GRAY_BUFFER_OK || - grayBufferState == GRAY_BUFFER_FAILED); + MOZ_ASSERT(IS_GC_MARKING_TRACER(this)); + MOZ_ASSERT(grayBufferState == GRAY_BUFFER_OK || + grayBufferState == GRAY_BUFFER_FAILED); } void @@ -630,8 +630,8 @@ GCMarker::resetBufferedGrayRoots() void GCMarker::markBufferedGrayRoots(JS::Zone *zone) { - JS_ASSERT(grayBufferState == GRAY_BUFFER_OK); - JS_ASSERT(zone->isGCMarkingGray() || zone->isGCCompacting()); + MOZ_ASSERT(grayBufferState == GRAY_BUFFER_OK); + MOZ_ASSERT(zone->isGCMarkingGray() || zone->isGCCompacting()); for (GrayRoot *elem = zone->gcGrayRoots.begin(); elem != zone->gcGrayRoots.end(); elem++) { #ifdef DEBUG @@ -644,7 +644,7 @@ GCMarker::markBufferedGrayRoots(JS::Zone *zone) void GCMarker::appendGrayRoot(void *thing, JSGCTraceKind kind) { - JS_ASSERT(started); + MOZ_ASSERT(started); if (grayBufferState == GRAY_BUFFER_FAILED) return; @@ -682,8 +682,8 @@ GCMarker::appendGrayRoot(void *thing, JSGCTraceKind kind) void GCMarker::GrayCallback(JSTracer *trc, void **thingp, JSGCTraceKind kind) { - JS_ASSERT(thingp); - JS_ASSERT(*thingp); + MOZ_ASSERT(thingp); + MOZ_ASSERT(*thingp); GCMarker *gcmarker = static_cast(trc); gcmarker->appendGrayRoot(*thingp, kind); } diff --git a/js/src/gc/Tracer.h b/js/src/gc/Tracer.h index 19161c4232ca..0665d597cfc1 100644 --- a/js/src/gc/Tracer.h +++ b/js/src/gc/Tracer.h @@ -87,7 +87,7 @@ class MarkStack if (!enlarge(1)) return false; } - JS_ASSERT(tos_ < end_); + MOZ_ASSERT(tos_ < end_); *tos_++ = item; return true; } @@ -99,7 +99,7 @@ class MarkStack return false; nextTos = tos_ + 3; } - JS_ASSERT(nextTos <= end_); + MOZ_ASSERT(nextTos <= end_); tos_[0] = item1; tos_[1] = item2; tos_[2] = item3; @@ -112,7 +112,7 @@ class MarkStack } uintptr_t pop() { - JS_ASSERT(!isEmpty()); + MOZ_ASSERT(!isEmpty()); return *--tos_; } @@ -163,14 +163,14 @@ class GCMarker : public JSTracer * objects that are still reachable. */ void setMarkColorGray() { - JS_ASSERT(isDrained()); - JS_ASSERT(color == gc::BLACK); + MOZ_ASSERT(isDrained()); + MOZ_ASSERT(color == gc::BLACK); color = gc::GRAY; } void setMarkColorBlack() { - JS_ASSERT(isDrained()); - JS_ASSERT(color == gc::GRAY); + MOZ_ASSERT(isDrained()); + MOZ_ASSERT(color == gc::GRAY); color = gc::BLACK; } @@ -245,7 +245,7 @@ class GCMarker : public JSTracer void pushTaggedPtr(StackTag tag, void *ptr) { checkZone(ptr); uintptr_t addr = reinterpret_cast(ptr); - JS_ASSERT(!(addr & StackTagMask)); + MOZ_ASSERT(!(addr & StackTagMask)); if (!stack.push(addr | uintptr_t(tag))) delayMarkingChildren(ptr); } @@ -253,7 +253,7 @@ class GCMarker : public JSTracer void pushValueArray(JSObject *obj, void *start, void *end) { checkZone(obj); - JS_ASSERT(start <= end); + MOZ_ASSERT(start <= end); uintptr_t tagged = reinterpret_cast(obj) | GCMarker::ValueArrayTag; uintptr_t startAddr = reinterpret_cast(start); uintptr_t endAddr = reinterpret_cast(end); diff --git a/js/src/gc/Verifier.cpp b/js/src/gc/Verifier.cpp index 2ba2e230906b..b614a9fef1c7 100644 --- a/js/src/gc/Verifier.cpp +++ b/js/src/gc/Verifier.cpp @@ -119,7 +119,7 @@ AccumulateEdge(JSTracer *jstrc, void **thingp, JSGCTraceKind kind) { VerifyPreTracer *trc = (VerifyPreTracer *)jstrc; - JS_ASSERT(!IsInsideNursery(*reinterpret_cast(thingp))); + MOZ_ASSERT(!IsInsideNursery(*reinterpret_cast(thingp))); trc->edgeptr += sizeof(EdgeValue); if (trc->edgeptr >= trc->term) { @@ -290,7 +290,7 @@ CheckEdge(JSTracer *jstrc, void **thingp, JSGCTraceKind kind) for (uint32_t i = 0; i < node->count; i++) { if (node->edges[i].thing == *thingp) { - JS_ASSERT(node->edges[i].kind == kind); + MOZ_ASSERT(node->edges[i].kind == kind); node->edges[i].thing = nullptr; return; } @@ -325,7 +325,7 @@ gc::GCRuntime::endVerifyPreBarriers() if (!trc) return false; - JS_ASSERT(!JS::IsGenerationalGCEnabled(rt)); + MOZ_ASSERT(!JS::IsGenerationalGCEnabled(rt)); AutoPrepareForTracing prep(rt, SkipAtoms); @@ -345,7 +345,7 @@ gc::GCRuntime::endVerifyPreBarriers() * We need to bump gcNumber so that the methodjit knows that jitcode has * been discarded. */ - JS_ASSERT(trc->number == number); + MOZ_ASSERT(trc->number == number); number++; verifyPreData = nullptr; @@ -470,7 +470,7 @@ PostVerifierVisitEdge(JSTracer *jstrc, void **thingp, JSGCTraceKind kind) return; /* Filter out non cross-generational edges. */ - JS_ASSERT(!trc->runtime()->gc.nursery.isInside(thingp)); + MOZ_ASSERT(!trc->runtime()->gc.nursery.isInside(thingp)); JSObject *dst = *reinterpret_cast(thingp); if (!IsInsideNursery(dst)) return; diff --git a/js/src/gc/Zone.cpp b/js/src/gc/Zone.cpp index 50b6999e023d..5905690056e1 100644 --- a/js/src/gc/Zone.cpp +++ b/js/src/gc/Zone.cpp @@ -39,8 +39,8 @@ JS::Zone::Zone(JSRuntime *rt) jitUsingBarriers_(false) { /* Ensure that there are no vtables to mess us up here. */ - JS_ASSERT(reinterpret_cast(this) == - static_cast(this)); + MOZ_ASSERT(reinterpret_cast(this) == + static_cast(this)); threshold.updateAfterGC(8192, GC_NORMAL, rt->gc.tunables, rt->gc.schedulingState); setGCMaxMallocBytes(rt->gc.maxMallocBytesAllocated() * 0.9); @@ -70,7 +70,7 @@ Zone::setNeedsIncrementalBarrier(bool needs, ShouldUpdateJit updateJit) } if (needs && runtimeFromMainThread()->isAtomsZone(this)) - JS_ASSERT(!runtimeFromMainThread()->exclusiveThreadsPresent()); + MOZ_ASSERT(!runtimeFromMainThread()->exclusiveThreadsPresent()); JS_ASSERT_IF(needs, canCollect()); needsIncrementalBarrier_ = needs; @@ -138,7 +138,7 @@ Zone::sweepBreakpoints(FreeOp *fop) * to iterate over the scripts belonging to a single compartment in a zone. */ - JS_ASSERT(isGCSweepingOrCompacting()); + MOZ_ASSERT(isGCSweepingOrCompacting()); for (ZoneCellIterUnderGC i(this, FINALIZE_SCRIPT); !i.done(); i.next()) { JSScript *script = i.get(); JS_ASSERT_IF(isGCSweeping(), script->zone()->isGCSweeping()); @@ -146,7 +146,7 @@ Zone::sweepBreakpoints(FreeOp *fop) continue; bool scriptGone = IsScriptAboutToBeFinalized(&script); - JS_ASSERT(script == i.get()); + MOZ_ASSERT(script == i.get()); for (unsigned i = 0; i < script->length(); i++) { BreakpointSite *site = script->getBreakpointSite(script->offsetToPC(i)); if (!site) @@ -265,7 +265,7 @@ Zone::canCollect() JS::Zone * js::ZoneOfValue(const JS::Value &value) { - JS_ASSERT(value.isMarkable()); + MOZ_ASSERT(value.isMarkable()); if (value.isObject()) return value.toObject().zone(); return js::gc::TenuredCell::fromPointer(value.toGCThing())->zone(); diff --git a/js/src/gc/Zone.h b/js/src/gc/Zone.h index 92005c4fe4dc..5fc4ea6012ba 100644 --- a/js/src/gc/Zone.h +++ b/js/src/gc/Zone.h @@ -161,7 +161,7 @@ struct Zone : public JS::shadow::Zone, bool hasMarkedCompartments(); - void scheduleGC() { JS_ASSERT(!runtimeFromMainThread()->isHeapBusy()); gcScheduled_ = true; } + void scheduleGC() { MOZ_ASSERT(!runtimeFromMainThread()->isHeapBusy()); gcScheduled_ = true; } void unscheduleGC() { gcScheduled_ = false; } bool isGCScheduled() { return gcScheduled_ && canCollect(); } @@ -179,7 +179,7 @@ struct Zone : public JS::shadow::Zone, Compact }; void setGCState(GCState state) { - JS_ASSERT(runtimeFromMainThread()->isHeapBusy()); + MOZ_ASSERT(runtimeFromMainThread()->isHeapBusy()); JS_ASSERT_IF(state != NoGC, canCollect()); gcState_ = state; } @@ -340,14 +340,14 @@ class ZonesIter bool done() const { return it == end; } void next() { - JS_ASSERT(!done()); + MOZ_ASSERT(!done()); do { it++; } while (!done() && (*it)->usedByExclusiveThread); } JS::Zone *get() const { - JS_ASSERT(!done()); + MOZ_ASSERT(!done()); return *it; } @@ -363,16 +363,16 @@ struct CompartmentsInZoneIter } bool done() const { - JS_ASSERT(it); + MOZ_ASSERT(it); return it == end; } void next() { - JS_ASSERT(!done()); + MOZ_ASSERT(!done()); it++; } JSCompartment *get() const { - JS_ASSERT(it); + MOZ_ASSERT(it); return *it; } @@ -420,8 +420,8 @@ class CompartmentsIterT bool done() const { return zone.done(); } void next() { - JS_ASSERT(!done()); - JS_ASSERT(!comp.ref().done()); + MOZ_ASSERT(!done()); + MOZ_ASSERT(!comp.ref().done()); comp->next(); if (comp->done()) { comp.reset(); @@ -432,7 +432,7 @@ class CompartmentsIterT } JSCompartment *get() const { - JS_ASSERT(!done()); + MOZ_ASSERT(!done()); return *comp; } diff --git a/js/src/gdb/README b/js/src/gdb/README index 80b671aa401e..5c11284f1d6c 100644 --- a/js/src/gdb/README +++ b/js/src/gdb/README @@ -9,7 +9,7 @@ types like js::Rooted and JS::Handle. For example: receiver=(JSObject * const) 0x7ffff150b060 [object global] delegate, id=$jsid("x"), defineHow=4, vp=$jsval(1), strict=0) at /home/jimb/moz/archer/js/src/jsobj.cpp:4495 - 4495 JS_ASSERT((defineHow & ~(DNP_CACHE_RESULT | DNP_UNQUALIFIED)) == 0); + 4495 MOZ_ASSERT((defineHow & ~(DNP_CACHE_RESULT | DNP_UNQUALIFIED)) == 0); (gdb) Things to note here: diff --git a/js/src/irregexp/NativeRegExpMacroAssembler.cpp b/js/src/irregexp/NativeRegExpMacroAssembler.cpp index 61d43d94ce80..3b53e15997ae 100644 --- a/js/src/irregexp/NativeRegExpMacroAssembler.cpp +++ b/js/src/irregexp/NativeRegExpMacroAssembler.cpp @@ -242,7 +242,7 @@ NativeRegExpMacroAssembler::GenerateCode(JSContext *cx, bool match_only) masm.bind(&start_regexp); // Initialize on-stack registers. - JS_ASSERT(num_saved_registers_ > 0); + MOZ_ASSERT(num_saved_registers_ > 0); // Fill saved registers with initial value = start offset - 1 // Fill in stack push order, to avoid accessing across an unwritten @@ -269,7 +269,7 @@ NativeRegExpMacroAssembler::GenerateCode(JSContext *cx, bool match_only) // Exit code: if (success_label_.used()) { - JS_ASSERT(num_saved_registers_ > 0); + MOZ_ASSERT(num_saved_registers_ > 0); Address outputRegistersAddress(StackPointer, offsetof(FrameData, outputRegisters)); @@ -452,7 +452,7 @@ NativeRegExpMacroAssembler::GenerateCode(JSContext *cx, bool match_only) for (size_t i = 0; i < labelPatches.length(); i++) { LabelPatch &v = labelPatches[i]; - JS_ASSERT(!v.label); + MOZ_ASSERT(!v.label); v.patchOffset.fixup(&masm); uintptr_t offset = masm.actualOffset(v.labelOffset); Assembler::PatchDataWithValueCheck(CodeLocationLabel(code, v.patchOffset), @@ -488,8 +488,8 @@ NativeRegExpMacroAssembler::AdvanceRegister(int reg, int by) { JitSpew(SPEW_PREFIX "AdvanceRegister(%d, %d)", reg, by); - JS_ASSERT(reg >= 0); - JS_ASSERT(reg < num_registers_); + MOZ_ASSERT(reg >= 0); + MOZ_ASSERT(reg < num_registers_); if (by != 0) masm.addPtr(Imm32(by), register_location(reg)); } @@ -671,7 +671,7 @@ NativeRegExpMacroAssembler::CheckNotBackReference(int start_reg, Label* on_no_ma masm.load8ZeroExtend(Address(current_character, 0), temp0); masm.load8ZeroExtend(Address(temp1, 0), temp2); } else { - JS_ASSERT(mode_ == CHAR16); + MOZ_ASSERT(mode_ == CHAR16); masm.load16ZeroExtend(Address(current_character, 0), temp0); masm.load16ZeroExtend(Address(temp1, 0), temp2); } @@ -793,7 +793,7 @@ NativeRegExpMacroAssembler::CheckNotBackReferenceIgnoreCase(int start_reg, Label // Compute new value of character position after the matched part. masm.subPtr(input_end_pointer, current_position); } else { - JS_ASSERT(mode_ == CHAR16); + MOZ_ASSERT(mode_ == CHAR16); // Note: temp1 needs to be saved/restored if it is volatile, as it is used after the call. GeneralRegisterSet volatileRegs = GeneralRegisterSet::Volatile(); @@ -929,8 +929,8 @@ NativeRegExpMacroAssembler::LoadCurrentCharacter(int cp_offset, Label* on_end_of { JitSpew(SPEW_PREFIX "LoadCurrentCharacter(%d, %d)", cp_offset, characters); - JS_ASSERT(cp_offset >= -1); // ^ and \b can look behind one character. - JS_ASSERT(cp_offset < (1<<30)); // Be sane! (And ensure negation works) + MOZ_ASSERT(cp_offset >= -1); // ^ and \b can look behind one character. + MOZ_ASSERT(cp_offset < (1<<30)); // Be sane! (And ensure negation works) if (check_bounds) CheckPosition(cp_offset + characters - 1, on_end_of_input); LoadCurrentCharacterUnchecked(cp_offset, characters); @@ -948,12 +948,12 @@ NativeRegExpMacroAssembler::LoadCurrentCharacterUnchecked(int cp_offset, int cha } else if (characters == 2) { masm.load16ZeroExtend(address, current_character); } else { - JS_ASSERT(characters = 1); + MOZ_ASSERT(characters = 1); masm.load8ZeroExtend(address, current_character); } } else { - JS_ASSERT(mode_ == CHAR16); - JS_ASSERT(characters <= 2); + MOZ_ASSERT(mode_ == CHAR16); + MOZ_ASSERT(characters <= 2); BaseIndex address(input_end_pointer, current_position, TimesOne, cp_offset * sizeof(char16_t)); if (characters == 2) masm.load32(address, current_character); @@ -986,7 +986,7 @@ NativeRegExpMacroAssembler::PushBacktrack(Label *label) CodeOffsetLabel patchOffset = masm.movWithPatch(ImmPtr(nullptr), temp0); - JS_ASSERT(!label->bound()); + MOZ_ASSERT(!label->bound()); if (!labelPatches.append(LabelPatch(label, patchOffset))) CrashAtUnhandlableOOM("NativeRegExpMacroAssembler::PushBacktrack"); @@ -1016,7 +1016,7 @@ NativeRegExpMacroAssembler::PushBacktrack(Register source) { JitSpew(SPEW_PREFIX "PushBacktrack"); - JS_ASSERT(source != backtrack_stack_pointer); + MOZ_ASSERT(source != backtrack_stack_pointer); // Notice: This updates flags, unlike normal Push. masm.storePtr(source, Address(backtrack_stack_pointer, 0)); @@ -1038,7 +1038,7 @@ NativeRegExpMacroAssembler::PopBacktrack(Register target) { JitSpew(SPEW_PREFIX "PopBacktrack"); - JS_ASSERT(target != backtrack_stack_pointer); + MOZ_ASSERT(target != backtrack_stack_pointer); // Notice: This updates flags, unlike normal Pop. masm.subPtr(Imm32(sizeof(void *)), backtrack_stack_pointer); @@ -1147,7 +1147,7 @@ NativeRegExpMacroAssembler::SetRegister(int register_index, int to) { JitSpew(SPEW_PREFIX "SetRegister(%d, %d)", register_index, to); - JS_ASSERT(register_index >= num_saved_registers_); // Reserved for positions! + MOZ_ASSERT(register_index >= num_saved_registers_); // Reserved for positions! masm.storePtr(ImmWord(to), register_location(register_index)); } @@ -1165,7 +1165,7 @@ NativeRegExpMacroAssembler::ClearRegisters(int reg_from, int reg_to) { JitSpew(SPEW_PREFIX "ClearRegisters(%d, %d)", reg_from, reg_to); - JS_ASSERT(reg_from <= reg_to); + MOZ_ASSERT(reg_from <= reg_to); masm.loadPtr(Address(StackPointer, offsetof(FrameData, inputStartMinusOne)), temp0); for (int reg = reg_from; reg <= reg_to; reg++) masm.storePtr(temp0, register_location(reg)); @@ -1261,7 +1261,7 @@ NativeRegExpMacroAssembler::CheckSpecialCharacterClass(char16_t type, Label* on_ // Table is 128 entries, so all ASCII characters can be tested. masm.branch32(Assembler::Above, current_character, Imm32('z'), branch); } - JS_ASSERT(0 == word_character_map[0]); // Character '\0' is not a word char. + MOZ_ASSERT(0 == word_character_map[0]); // Character '\0' is not a word char. masm.movePtr(ImmPtr(word_character_map), temp0); masm.load8ZeroExtend(BaseIndex(temp0, current_character, TimesOne), temp0); masm.branchTest32(Assembler::Zero, temp0, temp0, branch); @@ -1273,7 +1273,7 @@ NativeRegExpMacroAssembler::CheckSpecialCharacterClass(char16_t type, Label* on_ // Table is 128 entries, so all ASCII characters can be tested. masm.branch32(Assembler::Above, current_character, Imm32('z'), &done); } - JS_ASSERT(0 == word_character_map[0]); // Character '\0' is not a word char. + MOZ_ASSERT(0 == word_character_map[0]); // Character '\0' is not a word char. masm.movePtr(ImmPtr(word_character_map), temp0); masm.load8ZeroExtend(BaseIndex(temp0, current_character, TimesOne), temp0); masm.branchTest32(Assembler::NonZero, temp0, temp0, branch); @@ -1299,7 +1299,7 @@ NativeRegExpMacroAssembler::CheckSpecialCharacterClass(char16_t type, Label* on_ } else { Label done; masm.branch32(Assembler::BelowOrEqual, temp0, Imm32(0x0c - 0x0b), &done); - JS_ASSERT(CHAR16 == mode_); + MOZ_ASSERT(CHAR16 == mode_); // Compare original value to 0x2028 and 0x2029, using the already // computed (current_char ^ 0x01 - 0x0b). I.e., check for diff --git a/js/src/irregexp/RegExpAST.cpp b/js/src/irregexp/RegExpAST.cpp index 88a2b0690a05..9a40714ffaed 100644 --- a/js/src/irregexp/RegExpAST.cpp +++ b/js/src/irregexp/RegExpAST.cpp @@ -71,7 +71,7 @@ ListCaptureRegisters(const RegExpTreeVector &children) RegExpDisjunction::RegExpDisjunction(RegExpTreeVector *alternatives) : alternatives_(alternatives) { - JS_ASSERT(alternatives->length() > 1); + MOZ_ASSERT(alternatives->length() > 1); RegExpTree* first_alternative = (*alternatives)[0]; min_match_ = first_alternative->min_match(); max_match_ = first_alternative->max_match(); @@ -125,7 +125,7 @@ RegExpAlternative::RegExpAlternative(RegExpTreeVector *nodes) min_match_(0), max_match_(0) { - JS_ASSERT(nodes->length() > 1); + MOZ_ASSERT(nodes->length() > 1); for (size_t i = 0; i < nodes->length(); i++) { RegExpTree* node = (*nodes)[i]; int node_min_match = node->min_match(); diff --git a/js/src/irregexp/RegExpEngine.cpp b/js/src/irregexp/RegExpEngine.cpp index 21fb5287bef3..11ed5c3f98d3 100644 --- a/js/src/irregexp/RegExpEngine.cpp +++ b/js/src/irregexp/RegExpEngine.cpp @@ -96,9 +96,9 @@ AddClass(const int* elmv, int elmc, CharacterRangeVector *ranges) { elmc--; - JS_ASSERT(elmv[elmc] == 0x10000); + MOZ_ASSERT(elmv[elmc] == 0x10000); for (int i = 0; i < elmc; i += 2) { - JS_ASSERT(elmv[i] < elmv[i + 1]); + MOZ_ASSERT(elmv[i] < elmv[i + 1]); ranges->append(CharacterRange(elmv[i], elmv[i + 1] - 1)); } } @@ -109,13 +109,13 @@ AddClassNegated(const int *elmv, CharacterRangeVector *ranges) { elmc--; - JS_ASSERT(elmv[elmc] == 0x10000); - JS_ASSERT(elmv[0] != 0x0000); - JS_ASSERT(elmv[elmc-1] != kMaxUtf16CodeUnit); + MOZ_ASSERT(elmv[elmc] == 0x10000); + MOZ_ASSERT(elmv[0] != 0x0000); + MOZ_ASSERT(elmv[elmc-1] != kMaxUtf16CodeUnit); char16_t last = 0x0000; for (int i = 0; i < elmc; i += 2) { - JS_ASSERT(last <= elmv[i] - 1); - JS_ASSERT(elmv[i] < elmv[i + 1]); + MOZ_ASSERT(last <= elmv[i] - 1); + MOZ_ASSERT(elmv[i] < elmv[i + 1]); ranges->append(CharacterRange(last, elmv[i] - 1)); last = elmv[i + 1]; } @@ -233,7 +233,7 @@ GetCaseIndependentLetters(char16_t character, static char16_t ConvertNonLatin1ToLatin1(char16_t c) { - JS_ASSERT(c > kMaxOneByteCharCode); + MOZ_ASSERT(c > kMaxOneByteCharCode); switch (c) { // This are equivalent characters in unicode. case 0x39c: @@ -300,10 +300,10 @@ static bool CompareInverseRanges(const CharacterRangeVector &ranges, const int *special_class, size_t length) { length--; // Remove final 0x10000. - JS_ASSERT(special_class[length] == 0x10000); - JS_ASSERT(ranges.length() != 0); - JS_ASSERT(length != 0); - JS_ASSERT(special_class[0] != 0); + MOZ_ASSERT(special_class[length] == 0x10000); + MOZ_ASSERT(ranges.length() != 0); + MOZ_ASSERT(length != 0); + MOZ_ASSERT(special_class[0] != 0); if (ranges.length() != (length >> 1) + 1) return false; CharacterRange range = ranges[0]; @@ -325,7 +325,7 @@ static bool CompareRanges(const CharacterRangeVector &ranges, const int *special_class, size_t length) { length--; // Remove final 0x10000. - JS_ASSERT(special_class[length] == 0x10000); + MOZ_ASSERT(special_class[length] == 0x10000); if (ranges.length() * 2 != length) return false; for (size_t i = 0; i < length; i += 2) { @@ -504,7 +504,7 @@ CharacterRange::Canonicalize(CharacterRangeVector &character_ranges) while (character_ranges.length() > num_canonical) character_ranges.popBack(); - JS_ASSERT(CharacterRange::IsCanonical(character_ranges)); + MOZ_ASSERT(CharacterRange::IsCanonical(character_ranges)); } // ------------------------------------------------------------------- @@ -516,7 +516,7 @@ class VisitMarker explicit VisitMarker(NodeInfo* info) : info_(info) { - JS_ASSERT(!info->visited); + MOZ_ASSERT(!info->visited); info->visited = true; } ~VisitMarker() { @@ -550,7 +550,7 @@ SeqRegExpNode::FilterASCII(int depth, bool ignore_case) if (depth < 0) return this; - JS_ASSERT(!info()->visited); + MOZ_ASSERT(!info()->visited); VisitMarker marker(info()); return FilterSuccessor(depth - 1, ignore_case); } @@ -709,7 +709,7 @@ TextNode::FilterASCII(int depth, bool ignore_case) if (depth < 0) return this; - JS_ASSERT(!info()->visited); + MOZ_ASSERT(!info()->visited); VisitMarker marker(info()); int element_count = elements().length(); for (int i = 0; i < element_count; i++) { @@ -735,7 +735,7 @@ TextNode::FilterASCII(int depth, bool ignore_case) quarks[j] = converted; } } else { - JS_ASSERT(elm.text_type() == TextElement::CHAR_CLASS); + MOZ_ASSERT(elm.text_type() == TextElement::CHAR_CLASS); RegExpCharacterClass* cc = elm.char_class(); CharacterRangeVector &ranges = cc->ranges(alloc()); @@ -907,7 +907,7 @@ ChoiceNode::GetQuickCheckDetails(QuickCheckDetails* details, { not_at_start = (not_at_start || not_at_start_); int choice_count = alternatives().length(); - JS_ASSERT(choice_count > 0); + MOZ_ASSERT(choice_count > 0); alternatives()[0].node()->GetQuickCheckDetails(details, compiler, characters_filled_in, @@ -974,7 +974,7 @@ ChoiceNode::FilterASCII(int depth, bool ignore_case) GuardedAlternative alternative = alternatives()[i]; RegExpNode* replacement = alternative.node()->FilterASCII(depth - 1, ignore_case); - JS_ASSERT(replacement != this); // No missing EMPTY_MATCH_CHECK. + MOZ_ASSERT(replacement != this); // No missing EMPTY_MATCH_CHECK. if (replacement != nullptr) { alternatives()[i].set_node(replacement); surviving++; @@ -1095,7 +1095,7 @@ GuardedAlternative::AddGuard(LifoAlloc *alloc, Guard *guard) void LoopChoiceNode::AddLoopAlternative(GuardedAlternative alt) { - JS_ASSERT(loop_node_ == nullptr); + MOZ_ASSERT(loop_node_ == nullptr); AddAlternative(alt); loop_node_ = alt.node(); } @@ -1104,7 +1104,7 @@ LoopChoiceNode::AddLoopAlternative(GuardedAlternative alt) void LoopChoiceNode::AddContinueAlternative(GuardedAlternative alt) { - JS_ASSERT(continue_node_ == nullptr); + MOZ_ASSERT(continue_node_ == nullptr); AddAlternative(alt); continue_node_ = alt.node(); } @@ -1460,7 +1460,7 @@ class FrequencyCollator // Does not measure in percent, but rather per-128 (the table size from the // regexp macro assembler). int Frequency(int in_character) { - JS_ASSERT((in_character & RegExpMacroAssembler::kTableMask) == in_character); + MOZ_ASSERT((in_character & RegExpMacroAssembler::kTableMask) == in_character); if (total_samples_ < 1) return 1; // Division by zero. int freq_in_per128 = (frequencies_[in_character].counter() * 128) / total_samples_; @@ -1585,7 +1585,7 @@ RegExpCompiler::RegExpCompiler(JSContext *cx, LifoAlloc *alloc, int capture_coun alloc_(alloc) { accept_ = alloc->newInfallible(alloc, EndNode::ACCEPT); - JS_ASSERT(next_register_ - 1 <= RegExpMacroAssembler::kMaxRegister); + MOZ_ASSERT(next_register_ - 1 <= RegExpMacroAssembler::kMaxRegister); } RegExpCode @@ -1844,7 +1844,7 @@ class RegExpExpansionLimiter saved_expansion_factor_(compiler->current_expansion_factor()), ok_to_expand_(saved_expansion_factor_ <= kMaxExpansionFactor) { - JS_ASSERT(factor > 0); + MOZ_ASSERT(factor > 0); if (ok_to_expand_) { if (factor > kMaxExpansionFactor) { // Avoid integer overflow of the current expansion factor. @@ -1932,7 +1932,7 @@ RegExpQuantifier::ToNode(int min, } } if (max <= kMaxUnrolledMaxMatches && min == 0) { - JS_ASSERT(max > 0); // Due to the 'if' above. + MOZ_ASSERT(max > 0); // Due to the 'if' above. RegExpExpansionLimiter limiter(compiler, max); if (limiter.ok_to_expand()) { // Unroll the optional matches up to max. @@ -2164,8 +2164,8 @@ irregexp::AddRange(ContainedInLattice containment, int ranges_length, Interval new_range) { - JS_ASSERT((ranges_length & 1) == 1); - JS_ASSERT(ranges[ranges_length - 1] == kMaxUtf16CodeUnit + 1); + MOZ_ASSERT((ranges_length & 1) == 1); + MOZ_ASSERT(ranges[ranges_length - 1] == kMaxUtf16CodeUnit + 1); if (containment == kLatticeUnknown) return containment; bool inside = false; int last = 0; @@ -2399,7 +2399,7 @@ BoyerMooreLookahead::EmitSkipInstructions(RegExpMacroAssembler* masm) CrashAtUnhandlableOOM("Table malloc"); int skip_distance = GetSkipTable(min_lookahead, max_lookahead, boolean_skip_table); - JS_ASSERT(skip_distance != 0); + MOZ_ASSERT(skip_distance != 0); jit::Label cont, again; masm->Bind(&again); @@ -2443,7 +2443,7 @@ bool Trace::mentions_reg(int reg) bool Trace::GetStoredPosition(int reg, int* cp_offset) { - JS_ASSERT(0 == *cp_offset); + MOZ_ASSERT(0 == *cp_offset); for (DeferredAction* action = actions_; action != nullptr; action = action->next()) { if (action->Mentions(reg)) { if (action->action_type() == ActionNode::STORE_POSITION) { @@ -2544,16 +2544,16 @@ Trace::PerformDeferredActions(LifoAlloc *alloc, // we can set undo_action to IGNORE if we know there is no value to // restore. undo_action = DEFER_RESTORE; - JS_ASSERT(store_position == -1); - JS_ASSERT(!clear); + MOZ_ASSERT(store_position == -1); + MOZ_ASSERT(!clear); break; } case ActionNode::INCREMENT_REGISTER: if (!absolute) { value++; } - JS_ASSERT(store_position == -1); - JS_ASSERT(!clear); + MOZ_ASSERT(store_position == -1); + MOZ_ASSERT(!clear); undo_action = DEFER_RESTORE; break; case ActionNode::STORE_POSITION: { @@ -2575,8 +2575,8 @@ Trace::PerformDeferredActions(LifoAlloc *alloc, } else { undo_action = pc->is_capture() ? DEFER_CLEAR : DEFER_RESTORE; } - JS_ASSERT(!absolute); - JS_ASSERT(value == 0); + MOZ_ASSERT(!absolute); + MOZ_ASSERT(value == 0); break; } case ActionNode::CLEAR_CAPTURES: { @@ -2587,8 +2587,8 @@ Trace::PerformDeferredActions(LifoAlloc *alloc, clear = true; } undo_action = DEFER_RESTORE; - JS_ASSERT(!absolute); - JS_ASSERT(value == 0); + MOZ_ASSERT(!absolute); + MOZ_ASSERT(value == 0); break; } default: @@ -2632,7 +2632,7 @@ void Trace::Flush(RegExpCompiler* compiler, RegExpNode* successor) { RegExpMacroAssembler* assembler = compiler->macro_assembler(); - JS_ASSERT(!is_trivial()); + MOZ_ASSERT(!is_trivial()); if (actions_ == nullptr && backtrack() == nullptr) { // Here we just have some deferred cp advances to fix and we are back to @@ -2696,7 +2696,7 @@ Trace::InvalidateCurrentCharacter() void Trace::AdvanceCurrentPositionInTrace(int by, RegExpCompiler* compiler) { - JS_ASSERT(by > 0); + MOZ_ASSERT(by > 0); // We don't have an instruction for shifting the current character register // down or for using a shifted value for anything so lets just forget that // we preloaded any characters into it. @@ -2909,7 +2909,7 @@ AssertionNode::EmitBoundaryCheck(RegExpCompiler* compiler, Trace* trace) } else if (next_is_word_character == Trace::TRUE_VALUE) { BacktrackIfPrevious(compiler, trace, at_boundary ? kIsWord : kIsNonWord); } else { - JS_ASSERT(next_is_word_character == Trace::FALSE_VALUE); + MOZ_ASSERT(next_is_word_character == Trace::FALSE_VALUE); BacktrackIfPrevious(compiler, trace, at_boundary ? kIsNonWord : kIsWord); } } @@ -3070,8 +3070,8 @@ EmitUseLookupTable(RegExpMacroAssembler* masm, // Assert that everything is on one kTableSize page. for (int i = start_index; i <= end_index; i++) - JS_ASSERT((ranges[i] & ~kMask) == base); - JS_ASSERT(start_index == 0 || (ranges[start_index - 1] & ~kMask) <= base); + MOZ_ASSERT((ranges[i] & ~kMask) == base); + MOZ_ASSERT(start_index == 0 || (ranges[start_index - 1] & ~kMask) <= base); char templ[kSize]; jit::Label* on_bit_set; @@ -3131,7 +3131,7 @@ CutOutRange(RegExpMacroAssembler* masm, &dummy, in_range_label, &dummy); - JS_ASSERT(!dummy.used()); + MOZ_ASSERT(!dummy.used()); // Cut out the single range by rewriting the array. This creates a new // range that is a merger of the two ranges on either side of the one we // are cutting out. The oddity of the labels is preserved. @@ -3199,7 +3199,7 @@ SplitSearchSpace(RangeBoundaryVector &ranges, } } - JS_ASSERT(*new_start_index > start_index); + MOZ_ASSERT(*new_start_index > start_index); *new_end_index = *new_start_index - 1; if (ranges[*new_end_index] == *border) (*new_end_index)--; @@ -3230,7 +3230,7 @@ GenerateBranches(RegExpMacroAssembler* masm, int first = ranges[start_index]; int last = ranges[end_index] - 1; - JS_ASSERT(min_char < first); + MOZ_ASSERT(min_char < first); // Just need to test if the character is before or on-or-after // a particular character. @@ -3261,7 +3261,7 @@ GenerateBranches(RegExpMacroAssembler* masm, } if (cut == kNoCutIndex) cut = start_index; CutOutRange(masm, ranges, start_index, end_index, cut, even_label, odd_label); - JS_ASSERT(end_index - start_index >= 2); + MOZ_ASSERT(end_index - start_index >= 2); GenerateBranches(masm, ranges, start_index + 1, @@ -3321,25 +3321,25 @@ GenerateBranches(RegExpMacroAssembler* masm, // We didn't find any section that started after the limit, so everything // above the border is one of the terminal labels. above = (end_index & 1) != (start_index & 1) ? odd_label : even_label; - JS_ASSERT(new_end_index == end_index - 1); + MOZ_ASSERT(new_end_index == end_index - 1); } - JS_ASSERT(start_index <= new_end_index); - JS_ASSERT(new_start_index <= end_index); - JS_ASSERT(start_index < new_start_index); - JS_ASSERT(new_end_index < end_index); - JS_ASSERT(new_end_index + 1 == new_start_index || - (new_end_index + 2 == new_start_index && - border == ranges[new_end_index + 1])); - JS_ASSERT(min_char < border - 1); - JS_ASSERT(border < max_char); - JS_ASSERT(ranges[new_end_index] < border); - JS_ASSERT(border < ranges[new_start_index] || - (border == ranges[new_start_index] && - new_start_index == end_index && - new_end_index == end_index - 1 && - border == last + 1)); - JS_ASSERT(new_start_index == 0 || border >= ranges[new_start_index - 1]); + MOZ_ASSERT(start_index <= new_end_index); + MOZ_ASSERT(new_start_index <= end_index); + MOZ_ASSERT(start_index < new_start_index); + MOZ_ASSERT(new_end_index < end_index); + MOZ_ASSERT(new_end_index + 1 == new_start_index || + (new_end_index + 2 == new_start_index && + border == ranges[new_end_index + 1])); + MOZ_ASSERT(min_char < border - 1); + MOZ_ASSERT(border < max_char); + MOZ_ASSERT(ranges[new_end_index] < border); + MOZ_ASSERT(border < ranges[new_start_index] || + (border == ranges[new_start_index] && + new_start_index == end_index && + new_end_index == end_index - 1 && + border == last + 1)); + MOZ_ASSERT(new_start_index == 0 || border >= ranges[new_start_index - 1]); masm->CheckCharacterGT(border - 1, above); jit::Label dummy; @@ -3451,7 +3451,7 @@ EmitCharClass(LifoAlloc *alloc, for (int i = 0; i <= last_valid_range; i++) { CharacterRange& range = ranges[i]; if (range.from() == 0) { - JS_ASSERT(i == 0); + MOZ_ASSERT(i == 0); zeroth_entry_is_failure = !zeroth_entry_is_failure; } else { range_boundaries->append(range.from()); @@ -3544,7 +3544,7 @@ ShortCutEmitCharacterPair(RegExpMacroAssembler* macro_assembler, { char16_t char_mask = MaximumCharacter(ascii); - JS_ASSERT(c1 != c2); + MOZ_ASSERT(c1 != c2); if (c1 > c2) { char16_t tmp = c1; c1 = c2; @@ -3596,7 +3596,7 @@ EmitAtomLetter(RegExpCompiler* compiler, if (!preloaded) macro_assembler->LoadCurrentCharacter(cp_offset, on_failure, check); jit::Label ok; - JS_ASSERT(kEcma262UnCanonicalizeMaxWidth == 4); + MOZ_ASSERT(kEcma262UnCanonicalizeMaxWidth == 4); switch (length) { case 2: { if (ShortCutEmitCharacterPair(macro_assembler, @@ -3679,7 +3679,7 @@ TextNode::TextEmitPass(RegExpCompiler* compiler, EmitCharacterFunction* emit_function = nullptr; switch (pass) { case NON_ASCII_MATCH: - JS_ASSERT(ascii); + MOZ_ASSERT(ascii); if (quarks[j] > kMaxOneByteCharCode) { assembler->JumpOrBacktrack(backtrack); return; @@ -3708,7 +3708,7 @@ TextNode::TextEmitPass(RegExpCompiler* compiler, } } } else { - JS_ASSERT(TextElement::CHAR_CLASS == elm.text_type()); + MOZ_ASSERT(TextElement::CHAR_CLASS == elm.text_type()); if (pass == CHARACTER_CLASS_MATCH) { if (first_element_checked && i == 0) continue; if (DeterminedAlready(quick_check, elm.cp_offset())) continue; @@ -3731,7 +3731,7 @@ int TextNode::Length() { TextElement elm = elements()[elements().length() - 1]; - JS_ASSERT(elm.cp_offset() >= 0); + MOZ_ASSERT(elm.cp_offset() >= 0); return elm.cp_offset() + elm.length(); } @@ -3755,7 +3755,7 @@ TextNode::Emit(RegExpCompiler* compiler, Trace* trace) { LimitResult limit_result = LimitVersions(compiler, trace); if (limit_result == DONE) return; - JS_ASSERT(limit_result == CONTINUE); + MOZ_ASSERT(limit_result == CONTINUE); if (trace->cp_offset() + Length() > RegExpMacroAssembler::kMaxCPOffset) { compiler->SetRegExpTooBig(); @@ -3812,15 +3812,15 @@ LoopChoiceNode::Emit(RegExpCompiler* compiler, Trace* trace) if (trace->stop_node() == this) { int text_length = GreedyLoopTextLengthForAlternative(&alternatives()[0]); - JS_ASSERT(text_length != kNodeIsTooComplexForGreedyLoops); + MOZ_ASSERT(text_length != kNodeIsTooComplexForGreedyLoops); // Update the counter-based backtracking info on the stack. This is an // optimization for greedy loops (see below). - JS_ASSERT(trace->cp_offset() == text_length); + MOZ_ASSERT(trace->cp_offset() == text_length); macro_assembler->AdvanceCurrentPosition(text_length); macro_assembler->JumpOrBacktrack(trace->loop_label()); return; } - JS_ASSERT(trace->stop_node() == nullptr); + MOZ_ASSERT(trace->stop_node() == nullptr); if (!trace->is_trivial()) { trace->Flush(compiler, this); return; @@ -3930,13 +3930,13 @@ ChoiceNode::GenerateGuard(RegExpMacroAssembler* macro_assembler, { switch (guard->op()) { case Guard::LT: - JS_ASSERT(!trace->mentions_reg(guard->reg())); + MOZ_ASSERT(!trace->mentions_reg(guard->reg())); macro_assembler->IfRegisterGE(guard->reg(), guard->value(), trace->backtrack()); break; case Guard::GEQ: - JS_ASSERT(!trace->mentions_reg(guard->reg())); + MOZ_ASSERT(!trace->mentions_reg(guard->reg())); macro_assembler->IfRegisterLT(guard->reg(), guard->value(), trace->backtrack()); @@ -4065,14 +4065,14 @@ ChoiceNode::Emit(RegExpCompiler* compiler, Trace* trace) const GuardVector *guards = alternative.guards(); if (guards) { for (size_t j = 0; j < guards->length(); j++) - JS_ASSERT(!trace->mentions_reg((*guards)[j]->reg())); + MOZ_ASSERT(!trace->mentions_reg((*guards)[j]->reg())); } } #endif LimitResult limit_result = LimitVersions(compiler, trace); if (limit_result == DONE) return; - JS_ASSERT(limit_result == CONTINUE); + MOZ_ASSERT(limit_result == CONTINUE); int new_flush_budget = trace->flush_budget() / choice_count; if (trace->flush_budget() == 0 && trace->actions() != nullptr) { @@ -4100,7 +4100,7 @@ ChoiceNode::Emit(RegExpCompiler* compiler, Trace* trace) // information for each iteration of the loop, which could take up a lot of // space. greedy_loop = true; - JS_ASSERT(trace->stop_node() == nullptr); + MOZ_ASSERT(trace->stop_node() == nullptr); macro_assembler->PushCurrentPosition(); current_trace = &counter_backtrack_trace; jit::Label greedy_match_failed; @@ -4138,7 +4138,7 @@ ChoiceNode::Emit(RegExpCompiler* compiler, Trace* trace) // and step forwards 3 if the character is not one of abc. Abc need // not be atoms, they can be any reasonably limited character class or // small alternation. - JS_ASSERT(trace->is_trivial()); // This is the case on LoopChoiceNodes. + MOZ_ASSERT(trace->is_trivial()); // This is the case on LoopChoiceNodes. BoyerMooreLookahead* lookahead = bm_info(not_at_start); if (lookahead == nullptr) { eats_at_least = Min(kMaxLookaheadForBoyerMoore, @@ -4323,7 +4323,7 @@ ActionNode::Emit(RegExpCompiler* compiler, Trace* trace) RegExpMacroAssembler* assembler = compiler->macro_assembler(); LimitResult limit_result = LimitVersions(compiler, trace); if (limit_result == DONE) return; - JS_ASSERT(limit_result == CONTINUE); + MOZ_ASSERT(limit_result == CONTINUE); RecursionCheck rc(compiler); @@ -4427,7 +4427,7 @@ ActionNode::Emit(RegExpCompiler* compiler, Trace* trace) int clear_registers_to = clear_registers_from + clear_register_count - 1; assembler->ClearRegisters(clear_registers_from, clear_registers_to); - JS_ASSERT(trace->backtrack() == nullptr); + MOZ_ASSERT(trace->backtrack() == nullptr); assembler->Backtrack(); return; } @@ -4447,11 +4447,11 @@ BackReferenceNode::Emit(RegExpCompiler* compiler, Trace* trace) LimitResult limit_result = LimitVersions(compiler, trace); if (limit_result == DONE) return; - JS_ASSERT(limit_result == CONTINUE); + MOZ_ASSERT(limit_result == CONTINUE); RecursionCheck rc(compiler); - JS_ASSERT(start_reg_ + 1 == end_reg_); + MOZ_ASSERT(start_reg_ + 1 == end_reg_); if (compiler->ignore_case()) { assembler->CheckNotBackReferenceIgnoreCase(start_reg_, trace->backtrack()); @@ -4516,8 +4516,8 @@ RegExpNode::EmitQuickCheck(RegExpCompiler* compiler, details, compiler, 0, trace->at_start() == Trace::FALSE_VALUE); if (details->cannot_match()) return false; if (!details->Rationalize(compiler->ascii())) return false; - JS_ASSERT(details->characters() == 1 || - compiler->macro_assembler()->CanReadUnaligned()); + MOZ_ASSERT(details->characters() == 1 || + compiler->macro_assembler()->CanReadUnaligned()); uint32_t mask = details->mask(); uint32_t value = details->value(); @@ -4608,7 +4608,7 @@ TextNode::FillInBMInfo(int initial_offset, } } } else { - JS_ASSERT(TextElement::CHAR_CLASS == text.text_type()); + MOZ_ASSERT(TextElement::CHAR_CLASS == text.text_type()); RegExpCharacterClass* char_class = text.char_class(); const CharacterRangeVector &ranges = char_class->ranges(alloc()); if (char_class->is_negated()) { @@ -4668,7 +4668,7 @@ TextNode::GetQuickCheckDetails(QuickCheckDetails* details, int characters_filled_in, bool not_at_start) { - JS_ASSERT(characters_filled_in < details->characters()); + MOZ_ASSERT(characters_filled_in < details->characters()); int characters = details->characters(); int char_mask = MaximumCharacter(compiler->ascii()); @@ -4692,7 +4692,7 @@ TextNode::GetQuickCheckDetails(QuickCheckDetails* details, if (compiler->ignore_case()) { char16_t chars[kEcma262UnCanonicalizeMaxWidth]; size_t length = GetCaseIndependentLetters(c, compiler->ascii(), chars); - JS_ASSERT(length != 0); // Can only happen if c > char_mask (see above). + MOZ_ASSERT(length != 0); // Can only happen if c > char_mask (see above). if (length == 1) { // This letter has no case equivalents, so it's nice and simple // and the mask-compare will determine definitely whether we have @@ -4728,7 +4728,7 @@ TextNode::GetQuickCheckDetails(QuickCheckDetails* details, pos->determines_perfectly = true; } characters_filled_in++; - JS_ASSERT(characters_filled_in <= details->characters()); + MOZ_ASSERT(characters_filled_in <= details->characters()); if (characters_filled_in == details->characters()) { return; } @@ -4794,13 +4794,13 @@ TextNode::GetQuickCheckDetails(QuickCheckDetails* details, pos->value = bits; } characters_filled_in++; - JS_ASSERT(characters_filled_in <= details->characters()); + MOZ_ASSERT(characters_filled_in <= details->characters()); if (characters_filled_in == details->characters()) { return; } } } - JS_ASSERT(characters_filled_in != details->characters()); + MOZ_ASSERT(characters_filled_in != details->characters()); if (!details->cannot_match()) { on_success()-> GetQuickCheckDetails(details, compiler, @@ -4823,7 +4823,7 @@ QuickCheckDetails::Clear() void QuickCheckDetails::Advance(int by, bool ascii) { - JS_ASSERT(by >= 0); + MOZ_ASSERT(by >= 0); if (by >= characters_) { Clear(); return; @@ -4864,7 +4864,7 @@ QuickCheckDetails::Rationalize(bool is_ascii) void QuickCheckDetails::Merge(QuickCheckDetails* other, int from_index) { - JS_ASSERT(characters_ == other->characters_); + MOZ_ASSERT(characters_ == other->characters_); if (other->cannot_match_) return; if (cannot_match_) { diff --git a/js/src/irregexp/RegExpEngine.h b/js/src/irregexp/RegExpEngine.h index dcf58aadf5c7..be7f25d0c16f 100644 --- a/js/src/irregexp/RegExpEngine.h +++ b/js/src/irregexp/RegExpEngine.h @@ -149,7 +149,7 @@ class CharacterRange return CharacterRange(value, value); } static inline CharacterRange Range(char16_t from, char16_t to) { - JS_ASSERT(from <= to); + MOZ_ASSERT(from <= to); return CharacterRange(from, to); } static inline CharacterRange Everything() { @@ -295,12 +295,12 @@ class TextElement RegExpTree* tree() const { return tree_; } RegExpAtom* atom() const { - JS_ASSERT(text_type() == ATOM); + MOZ_ASSERT(text_type() == ATOM); return reinterpret_cast(tree()); } RegExpCharacterClass* char_class() const { - JS_ASSERT(text_type() == CHAR_CLASS); + MOZ_ASSERT(text_type() == CHAR_CLASS); return reinterpret_cast(tree()); } @@ -428,8 +428,8 @@ class QuickCheckDetails }; Position* positions(int index) { - JS_ASSERT(index >= 0); - JS_ASSERT(index < characters_); + MOZ_ASSERT(index >= 0); + MOZ_ASSERT(index < characters_); return positions_ + index; } @@ -520,7 +520,7 @@ class RegExpNode // Helper for FilterASCII. RegExpNode* replacement() { - JS_ASSERT(info()->replacement_calculated); + MOZ_ASSERT(info()->replacement_calculated); return replacement_; } RegExpNode* set_replacement(RegExpNode* replacement) { @@ -1392,7 +1392,7 @@ class Trace // These set methods and AdvanceCurrentPositionInTrace should be used only on // new traces - the intention is that traces are immutable after creation. void add_action(DeferredAction* new_action) { - JS_ASSERT(new_action->next_ == nullptr); + MOZ_ASSERT(new_action->next_ == nullptr); new_action->next_ = actions_; actions_ = new_action; } @@ -1476,7 +1476,7 @@ class Analysis : public NodeVisitor bool has_failed() { return error_message_ != nullptr; } const char* errorMessage() { - JS_ASSERT(error_message_ != nullptr); + MOZ_ASSERT(error_message_ != nullptr); return error_message_; } void fail(const char* error_message) { diff --git a/js/src/irregexp/RegExpInterpreter.cpp b/js/src/irregexp/RegExpInterpreter.cpp index 70b26cd35d39..9a66cc82268b 100644 --- a/js/src/irregexp/RegExpInterpreter.cpp +++ b/js/src/irregexp/RegExpInterpreter.cpp @@ -61,12 +61,12 @@ class MOZ_STACK_CLASS RegExpStackCursor } int32_t pop() { - JS_ASSERT(cursor > base()); + MOZ_ASSERT(cursor > base()); return *--cursor; } int32_t peek() { - JS_ASSERT(cursor > base()); + MOZ_ASSERT(cursor > base()); return *(cursor - 1); } @@ -76,7 +76,7 @@ class MOZ_STACK_CLASS RegExpStackCursor void setPosition(int32_t position) { cursor = base() + position; - JS_ASSERT(cursor < stack().limit()); + MOZ_ASSERT(cursor < stack().limit()); } private: @@ -91,14 +91,14 @@ class MOZ_STACK_CLASS RegExpStackCursor static int32_t Load32Aligned(const uint8_t* pc) { - JS_ASSERT((reinterpret_cast(pc) & 3) == 0); + MOZ_ASSERT((reinterpret_cast(pc) & 3) == 0); return *reinterpret_cast(pc); } static int32_t Load16Aligned(const uint8_t* pc) { - JS_ASSERT((reinterpret_cast(pc) & 1) == 0); + MOZ_ASSERT((reinterpret_cast(pc) & 1) == 0); return *reinterpret_cast(pc); } diff --git a/js/src/irregexp/RegExpMacroAssembler.cpp b/js/src/irregexp/RegExpMacroAssembler.cpp index c0a6f4d9eb33..b0b8b3adcbdb 100644 --- a/js/src/irregexp/RegExpMacroAssembler.cpp +++ b/js/src/irregexp/RegExpMacroAssembler.cpp @@ -40,7 +40,7 @@ int irregexp::CaseInsensitiveCompareStrings(const CharT *substring1, const CharT *substring2, size_t byteLength) { - JS_ASSERT(byteLength % sizeof(CharT) == 0); + MOZ_ASSERT(byteLength % sizeof(CharT) == 0); size_t length = byteLength / sizeof(CharT); for (size_t i = 0; i < length; i++) { @@ -102,8 +102,8 @@ InterpretedRegExpMacroAssembler::GenerateCode(JSContext *cx, bool match_only) void InterpretedRegExpMacroAssembler::AdvanceCurrentPosition(int by) { - JS_ASSERT(by >= kMinCPOffset); - JS_ASSERT(by <= kMaxCPOffset); + MOZ_ASSERT(by >= kMinCPOffset); + MOZ_ASSERT(by <= kMaxCPOffset); advance_current_start_ = pc_; advance_current_offset_ = by; Emit(BC_ADVANCE_CP, by); @@ -128,7 +128,7 @@ void InterpretedRegExpMacroAssembler::Bind(jit::Label* label) { advance_current_end_ = kInvalidPC; - JS_ASSERT(!label->bound()); + MOZ_ASSERT(!label->bound()); if (label->used()) { int pos = label->offset(); while (pos != jit::Label::INVALID_OFFSET) { @@ -203,8 +203,8 @@ InterpretedRegExpMacroAssembler::CheckNotAtStart(jit::Label* on_not_at_start) void InterpretedRegExpMacroAssembler::CheckNotBackReference(int start_reg, jit::Label* on_no_match) { - JS_ASSERT(start_reg >= 0); - JS_ASSERT(start_reg <= kMaxRegister); + MOZ_ASSERT(start_reg >= 0); + MOZ_ASSERT(start_reg <= kMaxRegister); Emit(BC_CHECK_NOT_BACK_REF, start_reg); EmitOrLink(on_no_match); } @@ -212,8 +212,8 @@ InterpretedRegExpMacroAssembler::CheckNotBackReference(int start_reg, jit::Label void InterpretedRegExpMacroAssembler::CheckNotBackReferenceIgnoreCase(int start_reg, jit::Label* on_no_match) { - JS_ASSERT(start_reg >= 0); - JS_ASSERT(start_reg <= kMaxRegister); + MOZ_ASSERT(start_reg >= 0); + MOZ_ASSERT(start_reg <= kMaxRegister); Emit(BC_CHECK_NOT_BACK_REF_NO_CASE, start_reg); EmitOrLink(on_no_match); } @@ -343,8 +343,8 @@ void InterpretedRegExpMacroAssembler::LoadCurrentCharacter(int cp_offset, jit::Label* on_end_of_input, bool check_bounds, int characters) { - JS_ASSERT(cp_offset >= kMinCPOffset); - JS_ASSERT(cp_offset <= kMaxCPOffset); + MOZ_ASSERT(cp_offset >= kMinCPOffset); + MOZ_ASSERT(cp_offset <= kMaxCPOffset); int bytecode; if (check_bounds) { if (characters == 4) { @@ -352,7 +352,7 @@ InterpretedRegExpMacroAssembler::LoadCurrentCharacter(int cp_offset, jit::Label* } else if (characters == 2) { bytecode = BC_LOAD_2_CURRENT_CHARS; } else { - JS_ASSERT(characters == 1); + MOZ_ASSERT(characters == 1); bytecode = BC_LOAD_CURRENT_CHAR; } } else { @@ -361,7 +361,7 @@ InterpretedRegExpMacroAssembler::LoadCurrentCharacter(int cp_offset, jit::Label* } else if (characters == 2) { bytecode = BC_LOAD_2_CURRENT_CHARS_UNCHECKED; } else { - JS_ASSERT(characters == 1); + MOZ_ASSERT(characters == 1); bytecode = BC_LOAD_CURRENT_CHAR_UNCHECKED; } } @@ -413,7 +413,7 @@ InterpretedRegExpMacroAssembler::ReadBacktrackStackPointerFromRegister(int reg) void InterpretedRegExpMacroAssembler::SetCurrentPositionFromEnd(int by) { - JS_ASSERT(by >= 0 && by < (1 << 24)); + MOZ_ASSERT(by >= 0 && by < (1 << 24)); Emit(BC_SET_CURRENT_POSITION_FROM_END, by); } @@ -445,7 +445,7 @@ InterpretedRegExpMacroAssembler::WriteCurrentPositionToRegister(int reg, int cp_ void InterpretedRegExpMacroAssembler::ClearRegisters(int reg_from, int reg_to) { - JS_ASSERT(reg_from <= reg_to); + MOZ_ASSERT(reg_from <= reg_to); for (int reg = reg_from; reg <= reg_to; reg++) SetRegister(reg, -1); } @@ -493,7 +493,7 @@ InterpretedRegExpMacroAssembler::Emit(uint32_t byte, uint32_t twenty_four_bits) void InterpretedRegExpMacroAssembler::Emit32(uint32_t word) { - JS_ASSERT(pc_ <= length_); + MOZ_ASSERT(pc_ <= length_); if (pc_ + 3 >= length_) Expand(); *reinterpret_cast(buffer_ + pc_) = word; @@ -503,7 +503,7 @@ InterpretedRegExpMacroAssembler::Emit32(uint32_t word) void InterpretedRegExpMacroAssembler::Emit16(uint32_t word) { - JS_ASSERT(pc_ <= length_); + MOZ_ASSERT(pc_ <= length_); if (pc_ + 1 >= length_) Expand(); *reinterpret_cast(buffer_ + pc_) = word; @@ -513,7 +513,7 @@ InterpretedRegExpMacroAssembler::Emit16(uint32_t word) void InterpretedRegExpMacroAssembler::Emit8(uint32_t word) { - JS_ASSERT(pc_ <= length_); + MOZ_ASSERT(pc_ <= length_); if (pc_ == length_) Expand(); *reinterpret_cast(buffer_ + pc_) = word; diff --git a/js/src/irregexp/RegExpMacroAssembler.h b/js/src/irregexp/RegExpMacroAssembler.h index 7b1cd457db47..1c4112d10cba 100644 --- a/js/src/irregexp/RegExpMacroAssembler.h +++ b/js/src/irregexp/RegExpMacroAssembler.h @@ -207,8 +207,8 @@ class MOZ_STACK_CLASS RegExpMacroAssembler int num_saved_registers_; void checkRegister(int reg) { - JS_ASSERT(reg >= 0); - JS_ASSERT(reg <= kMaxRegister); + MOZ_ASSERT(reg >= 0); + MOZ_ASSERT(reg <= kMaxRegister); if (num_registers_ <= reg) num_registers_ = reg + 1; } diff --git a/js/src/irregexp/RegExpParser.cpp b/js/src/irregexp/RegExpParser.cpp index 6b8dc16f9e9d..9689b5819066 100644 --- a/js/src/irregexp/RegExpParser.cpp +++ b/js/src/irregexp/RegExpParser.cpp @@ -163,7 +163,7 @@ RegExpBuilder::AddQuantifierToAtom(int min, int max, } RegExpTree* atom; if (characters_ != nullptr) { - JS_ASSERT(last_added_ == ADD_CHAR); + MOZ_ASSERT(last_added_ == ADD_CHAR); // Last atom was character. CharacterVector *char_vector = characters_; int num_chars = char_vector->length(); @@ -178,11 +178,11 @@ RegExpBuilder::AddQuantifierToAtom(int min, int max, atom = alloc->newInfallible(char_vector); FlushText(); } else if (text_.length() > 0) { - JS_ASSERT(last_added_ == ADD_ATOM); + MOZ_ASSERT(last_added_ == ADD_ATOM); atom = text_.RemoveLast(); FlushText(); } else if (terms_.length() > 0) { - JS_ASSERT(last_added_ == ADD_ATOM); + MOZ_ASSERT(last_added_ == ADD_ATOM); atom = terms_.RemoveLast(); if (atom->max_match() == 0) { // Guaranteed to only match an empty string. @@ -260,7 +260,7 @@ template size_t RegExpParser::ParseOctalLiteral() { - JS_ASSERT('0' <= current() && current() <= '7'); + MOZ_ASSERT('0' <= current() && current() <= '7'); // For compatibility with some other browsers (not all), we parse // up to three octal digits with a value below 256. widechar value = current() - '0'; @@ -320,8 +320,8 @@ template widechar RegExpParser::ParseClassCharacterEscape() { - JS_ASSERT(current() == '\\'); - JS_ASSERT(has_next() && !IsSpecialClassEscape(Next())); + MOZ_ASSERT(current() == '\\'); + MOZ_ASSERT(has_next() && !IsSpecialClassEscape(Next())); Advance(); switch (current()) { case 'b': @@ -418,7 +418,7 @@ template RegExpTree* RegExpParser::ParseCharacterClass() { - JS_ASSERT(current() == '['); + MOZ_ASSERT(current() == '['); Advance(); bool is_negated = false; if (current() == '^') { @@ -474,7 +474,7 @@ template bool RegExpParser::ParseClassAtom(char16_t* char_class, CharacterRange *char_range) { - JS_ASSERT(*char_class == kNoCharClass); + MOZ_ASSERT(*char_class == kNoCharClass); widechar first = current(); if (first == '\\') { switch (Next()) { @@ -541,7 +541,7 @@ RegExpParser::ScanForCaptures() inline bool IsInRange(int value, int lower_limit, int higher_limit) { - JS_ASSERT(lower_limit <= higher_limit); + MOZ_ASSERT(lower_limit <= higher_limit); return static_cast(value - lower_limit) <= static_cast(higher_limit - lower_limit); } @@ -557,8 +557,8 @@ template bool RegExpParser::ParseBackReferenceIndex(int* index_out) { - JS_ASSERT('\\' == current()); - JS_ASSERT('1' <= Next() && Next() <= '9'); + MOZ_ASSERT('\\' == current()); + MOZ_ASSERT('1' <= Next() && Next() <= '9'); // Try to parse a decimal literal that is no greater than the total number // of left capturing parentheses in the input. @@ -604,7 +604,7 @@ template bool RegExpParser::ParseIntervalQuantifier(int* min_out, int* max_out) { - JS_ASSERT(current() == '{'); + MOZ_ASSERT(current() == '{'); const CharT *start = position(); Advance(); int min = 0; @@ -699,13 +699,13 @@ RegExpParser::ParseDisjunction() // Inside a parenthesized group when hitting end of input. return ReportError(JSMSG_MISSING_PAREN); } - JS_ASSERT(INITIAL == stored_state->group_type()); + MOZ_ASSERT(INITIAL == stored_state->group_type()); // Parsing completed successfully. return builder->ToRegExp(); case ')': { if (!stored_state->IsSubexpression()) return ReportError(JSMSG_UNMATCHED_RIGHT_PAREN); - JS_ASSERT(INITIAL != stored_state->group_type()); + MOZ_ASSERT(INITIAL != stored_state->group_type()); Advance(); // End disjunction parsing and convert builder content to new single @@ -727,8 +727,8 @@ RegExpParser::ParseDisjunction() (*captures_)[capture_index - 1] = capture; body = capture; } else if (group_type != GROUPING) { - JS_ASSERT(group_type == POSITIVE_LOOKAHEAD || - group_type == NEGATIVE_LOOKAHEAD); + MOZ_ASSERT(group_type == POSITIVE_LOOKAHEAD || + group_type == NEGATIVE_LOOKAHEAD); bool is_positive = (group_type == POSITIVE_LOOKAHEAD); body = alloc->newInfallible(body, is_positive, diff --git a/js/src/irregexp/RegExpParser.h b/js/src/irregexp/RegExpParser.h index a153a8f372a2..dab06119c13c 100644 --- a/js/src/irregexp/RegExpParser.h +++ b/js/src/irregexp/RegExpParser.h @@ -78,12 +78,12 @@ class BufferedVector } T* last() { - JS_ASSERT(last_ != nullptr); + MOZ_ASSERT(last_ != nullptr); return last_; } T* RemoveLast() { - JS_ASSERT(last_ != nullptr); + MOZ_ASSERT(last_ != nullptr); T* result = last_; if ((list_ != nullptr) && (list_->length() > 0)) last_ = list_->popCopy(); @@ -93,13 +93,13 @@ class BufferedVector } T* Get(int i) { - JS_ASSERT((0 <= i) && (i < length())); + MOZ_ASSERT((0 <= i) && (i < length())); if (list_ == nullptr) { - JS_ASSERT(0 == i); + MOZ_ASSERT(0 == i); return last_; } else { if (size_t(i) == list_->length()) { - JS_ASSERT(last_ != nullptr); + MOZ_ASSERT(last_ != nullptr); return last_; } else { return (*list_)[i]; diff --git a/js/src/irregexp/RegExpStack.cpp b/js/src/irregexp/RegExpStack.cpp index 3771906e1c5c..26ff0eebf9fc 100644 --- a/js/src/irregexp/RegExpStack.cpp +++ b/js/src/irregexp/RegExpStack.cpp @@ -74,7 +74,7 @@ RegExpStack::init() void RegExpStack::reset() { - JS_ASSERT(size >= kMinimumStackSize); + MOZ_ASSERT(size >= kMinimumStackSize); if (size != kMinimumStackSize) { base_ = js_realloc(base_, kMinimumStackSize); diff --git a/js/src/irregexp/RegExpStack.h b/js/src/irregexp/RegExpStack.h index fa9bbe3e1285..84133110c920 100644 --- a/js/src/irregexp/RegExpStack.h +++ b/js/src/irregexp/RegExpStack.h @@ -109,7 +109,7 @@ class RegExpStack void *limit_; void updateLimit() { - JS_ASSERT(size >= kStackLimitSlack * sizeof(void *)); + MOZ_ASSERT(size >= kStackLimitSlack * sizeof(void *)); limit_ = static_cast(base()) + size - (kStackLimitSlack * sizeof(void *)); } }; diff --git a/js/src/jit/AliasAnalysis.cpp b/js/src/jit/AliasAnalysis.cpp index 776374d26b02..f64ba4801af4 100644 --- a/js/src/jit/AliasAnalysis.cpp +++ b/js/src/jit/AliasAnalysis.cpp @@ -83,7 +83,7 @@ class AliasSetIterator return !!flags; } unsigned operator *() const { - JS_ASSERT(pos < AliasSet::NumCategories); + MOZ_ASSERT(pos < AliasSet::NumCategories); return pos; } }; @@ -239,7 +239,7 @@ AliasAnalysis::analyze() block->lastIns()->setId(newId++); if (block->isLoopBackedge()) { - JS_ASSERT(loop_->loopHeader() == block->loopHeaderOfBackedge()); + MOZ_ASSERT(loop_->loopHeader() == block->loopHeaderOfBackedge()); JitSpew(JitSpew_Alias, "Processing loop backedge %d (header %d)", block->id(), loop_->loopHeader()->id()); LoopAliasInfo *outerLoop = loop_->outer(); @@ -250,7 +250,7 @@ AliasAnalysis::analyze() for (unsigned i = 0; i < invariant.length(); i++) { MDefinition *ins = invariant[i]; AliasSet set = ins->getAliasSet(); - JS_ASSERT(set.isLoad()); + MOZ_ASSERT(set.isLoad()); bool hasAlias = false; for (AliasSetIterator iter(set); iter; iter++) { @@ -290,6 +290,6 @@ AliasAnalysis::analyze() } } - JS_ASSERT(loop_ == nullptr); + MOZ_ASSERT(loop_ == nullptr); return true; } diff --git a/js/src/jit/BacktrackingAllocator.cpp b/js/src/jit/BacktrackingAllocator.cpp index 5f1f004f5ffc..c3153a5ef5fa 100644 --- a/js/src/jit/BacktrackingAllocator.cpp +++ b/js/src/jit/BacktrackingAllocator.cpp @@ -123,7 +123,7 @@ LifetimesOverlap(BacktrackingVirtualRegister *reg0, BacktrackingVirtualRegister { // Registers may have been eagerly split in two, see tryGroupReusedRegister. // In such cases, only consider the first interval. - JS_ASSERT(reg0->numIntervals() <= 2 && reg1->numIntervals() <= 2); + MOZ_ASSERT(reg0->numIntervals() <= 2 && reg1->numIntervals() <= 2); LiveInterval *interval0 = reg0->getInterval(0), *interval1 = reg1->getInterval(0); @@ -222,7 +222,7 @@ BacktrackingAllocator::tryGroupReusedRegister(uint32_t def, uint32_t use) // on x86/x64). if (reg.intervalFor(inputOf(reg.ins()))) { - JS_ASSERT(reg.isTemp()); + MOZ_ASSERT(reg.isTemp()); reg.setMustCopyInput(); return true; } @@ -276,7 +276,7 @@ BacktrackingAllocator::tryGroupReusedRegister(uint32_t def, uint32_t use) LiveInterval *preInterval = LiveInterval::New(alloc(), interval->vreg(), 0); for (size_t i = 0; i < interval->numRanges(); i++) { const LiveInterval::Range *range = interval->getRange(i); - JS_ASSERT(range->from <= inputOf(reg.ins())); + MOZ_ASSERT(range->from <= inputOf(reg.ins())); CodePosition to = Min(range->to, outputOf(reg.ins())); if (!preInterval->addRange(range->from, to)) @@ -302,7 +302,7 @@ BacktrackingAllocator::tryGroupReusedRegister(uint32_t def, uint32_t use) if (!split(interval, newIntervals)) return false; - JS_ASSERT(usedReg.numIntervals() == 2); + MOZ_ASSERT(usedReg.numIntervals() == 2); usedReg.setCanonicalSpillExclude(inputOf(reg.ins())); @@ -314,7 +314,7 @@ BacktrackingAllocator::groupAndQueueRegisters() { // Try to group registers with their reused inputs. // Virtual register number 0 is unused. - JS_ASSERT(vregs[0u].numIntervals() == 0); + MOZ_ASSERT(vregs[0u].numIntervals() == 0); for (size_t i = 1; i < graph.numVirtualRegisters(); i++) { BacktrackingVirtualRegister ® = vregs[i]; if (!reg.numIntervals()) @@ -342,14 +342,14 @@ BacktrackingAllocator::groupAndQueueRegisters() } // Virtual register number 0 is unused. - JS_ASSERT(vregs[0u].numIntervals() == 0); + MOZ_ASSERT(vregs[0u].numIntervals() == 0); for (size_t i = 1; i < graph.numVirtualRegisters(); i++) { if (mir->shouldCancel("Backtracking Enqueue Registers")) return false; BacktrackingVirtualRegister ® = vregs[i]; - JS_ASSERT(reg.numIntervals() <= 2); - JS_ASSERT(!reg.canonicalSpill()); + MOZ_ASSERT(reg.numIntervals() <= 2); + MOZ_ASSERT(!reg.canonicalSpill()); if (!reg.numIntervals()) continue; @@ -459,7 +459,7 @@ BacktrackingAllocator::tryAllocateNonFixed(LiveInterval *interval, bool *success } // We failed to allocate this interval. - JS_ASSERT(!*success); + MOZ_ASSERT(!*success); return true; } @@ -533,7 +533,7 @@ BacktrackingAllocator::processInterval(LiveInterval *interval) // it at this point we will just end up with the same interval and will // enter an infinite loop. Weights and the initial live intervals must // be constructed so that any minimal interval is allocatable. - JS_ASSERT(!minimalInterval(interval)); + MOZ_ASSERT(!minimalInterval(interval)); if (canAllocate && fixed) return splitAcrossCalls(interval); @@ -578,7 +578,7 @@ BacktrackingAllocator::processGroup(VirtualRegisterGroup *group) for (size_t i = 0; i < group->registers.length(); i++) { VirtualRegister ® = vregs[group->registers[i]]; - JS_ASSERT(reg.numIntervals() <= 2); + MOZ_ASSERT(reg.numIntervals() <= 2); if (!processInterval(reg.getInterval(0))) return false; } @@ -678,7 +678,7 @@ BacktrackingAllocator::tryAllocateGroupRegister(PhysicalRegister &r, VirtualRegi for (size_t i = 0; i < group->registers.length(); i++) { VirtualRegister ® = vregs[group->registers[i]]; - JS_ASSERT(reg.numIntervals() <= 2); + MOZ_ASSERT(reg.numIntervals() <= 2); LiveInterval *interval = reg.getInterval(0); for (size_t j = 0; j < interval->numRanges(); j++) { @@ -696,7 +696,7 @@ BacktrackingAllocator::tryAllocateGroupRegister(PhysicalRegister &r, VirtualRegi } if (!allocatable) { - JS_ASSERT(conflicting); + MOZ_ASSERT(conflicting); if (!*pconflicting || computeSpillWeight(conflicting) < computeSpillWeight(*pconflicting)) *pconflicting = conflicting; if (!conflicting->hasVreg()) @@ -780,11 +780,11 @@ BacktrackingAllocator::evictInterval(LiveInterval *interval) interval->toString(), computePriority(interval), computeSpillWeight(interval)); } - JS_ASSERT(interval->getAllocation()->isRegister()); + MOZ_ASSERT(interval->getAllocation()->isRegister()); AnyRegister reg(interval->getAllocation()->toRegister()); PhysicalRegister &physical = registers[reg.code()]; - JS_ASSERT(physical.reg == reg && physical.allocatable); + MOZ_ASSERT(physical.reg == reg && physical.allocatable); for (size_t i = 0; i < interval->numRanges(); i++) { AllocatedRange range(interval, interval->getRange(i)); @@ -801,7 +801,7 @@ void BacktrackingAllocator::distributeUses(LiveInterval *interval, const LiveIntervalVector &newIntervals) { - JS_ASSERT(newIntervals.length() >= 2); + MOZ_ASSERT(newIntervals.length() >= 2); // Simple redistribution of uses from an old interval to a set of new // intervals. Intervals are permitted to overlap, in which case this will @@ -832,12 +832,12 @@ BacktrackingAllocator::split(LiveInterval *interval, JitSpew(JitSpew_RegAlloc, " splitting interval %s into:", interval->toString()); for (size_t i = 0; i < newIntervals.length(); i++) { JitSpew(JitSpew_RegAlloc, " %s", newIntervals[i]->toString()); - JS_ASSERT(newIntervals[i]->start() >= interval->start()); - JS_ASSERT(newIntervals[i]->end() <= interval->end()); + MOZ_ASSERT(newIntervals[i]->start() >= interval->start()); + MOZ_ASSERT(newIntervals[i]->end() <= interval->end()); } } - JS_ASSERT(newIntervals.length() >= 2); + MOZ_ASSERT(newIntervals.length() >= 2); // Find the earliest interval in the new list. LiveInterval *first = newIntervals[0]; @@ -874,11 +874,11 @@ BacktrackingAllocator::spill(LiveInterval *interval) { JitSpew(JitSpew_RegAlloc, " Spilling interval"); - JS_ASSERT(interval->requirement()->kind() == Requirement::NONE); - JS_ASSERT(!interval->getAllocation()->isStackSlot()); + MOZ_ASSERT(interval->requirement()->kind() == Requirement::NONE); + MOZ_ASSERT(!interval->getAllocation()->isStackSlot()); // We can't spill bogus intervals. - JS_ASSERT(interval->hasVreg()); + MOZ_ASSERT(interval->hasVreg()); BacktrackingVirtualRegister *reg = &vregs[interval->vreg()]; @@ -911,7 +911,7 @@ BacktrackingAllocator::spill(LiveInterval *interval) } uint32_t stackSlot = stackSlotAllocator.allocateSlot(reg->type()); - JS_ASSERT(stackSlot <= stackSlotAllocator.stackHeight()); + MOZ_ASSERT(stackSlot <= stackSlotAllocator.stackHeight()); LStackSlot alloc(stackSlot); interval->setAllocation(alloc); @@ -933,7 +933,7 @@ BacktrackingAllocator::resolveControlFlow() JitSpew(JitSpew_RegAlloc, "Resolving control flow (vreg loop)"); // Virtual register number 0 is unused. - JS_ASSERT(vregs[0u].numIntervals() == 0); + MOZ_ASSERT(vregs[0u].numIntervals() == 0); for (size_t i = 1; i < graph.numVirtualRegisters(); i++) { BacktrackingVirtualRegister *reg = &vregs[i]; @@ -942,7 +942,7 @@ BacktrackingAllocator::resolveControlFlow() for (size_t j = 1; j < reg->numIntervals(); j++) { LiveInterval *interval = reg->getInterval(j); - JS_ASSERT(interval->index() == j); + MOZ_ASSERT(interval->index() == j); bool skip = false; for (int k = j - 1; k >= 0; k--) { @@ -960,7 +960,7 @@ BacktrackingAllocator::resolveControlFlow() CodePosition start = interval->start(); InstructionData *data = &insData[start]; if (interval->start() > entryOf(data->block())) { - JS_ASSERT(start == inputOf(data->ins()) || start == outputOf(data->ins())); + MOZ_ASSERT(start == inputOf(data->ins()) || start == outputOf(data->ins())); LiveInterval *prevInterval = reg->intervalFor(start.previous()); if (start.subpos() == CodePosition::INPUT) { @@ -988,19 +988,19 @@ BacktrackingAllocator::resolveControlFlow() // Resolve phis to moves for (size_t j = 0; j < successor->numPhis(); j++) { LPhi *phi = successor->getPhi(j); - JS_ASSERT(phi->numDefs() == 1); + MOZ_ASSERT(phi->numDefs() == 1); LDefinition *def = phi->getDef(0); VirtualRegister *vreg = &vregs[def]; LiveInterval *to = vreg->intervalFor(entryOf(successor)); - JS_ASSERT(to); + MOZ_ASSERT(to); for (size_t k = 0; k < mSuccessor->numPredecessors(); k++) { LBlock *predecessor = mSuccessor->getPredecessor(k)->lir(); - JS_ASSERT(predecessor->mir()->numSuccessors() == 1); + MOZ_ASSERT(predecessor->mir()->numSuccessors() == 1); LAllocation *input = phi->getOperand(k); LiveInterval *from = vregs[input].intervalFor(exitOf(predecessor)); - JS_ASSERT(from); + MOZ_ASSERT(from); if (!moveAtExit(predecessor, from, to, def->type())) return false; @@ -1026,7 +1026,7 @@ BacktrackingAllocator::resolveControlFlow() LiveInterval *from = reg.intervalFor(exitOf(predecessor)); if (mSuccessor->numPredecessors() > 1) { - JS_ASSERT(predecessor->mir()->numSuccessors() == 1); + MOZ_ASSERT(predecessor->mir()->numSuccessors() == 1); if (!moveAtExit(predecessor, from, to, reg.type())) return false; } else { @@ -1087,7 +1087,7 @@ BacktrackingAllocator::reifyAllocations() JitSpew(JitSpew_RegAlloc, "Reifying Allocations"); // Virtual register number 0 is unused. - JS_ASSERT(vregs[0u].numIntervals() == 0); + MOZ_ASSERT(vregs[0u].numIntervals() == 0); for (size_t i = 1; i < graph.numVirtualRegisters(); i++) { VirtualRegister *reg = &vregs[i]; @@ -1096,7 +1096,7 @@ BacktrackingAllocator::reifyAllocations() for (size_t j = 0; j < reg->numIntervals(); j++) { LiveInterval *interval = reg->getInterval(j); - JS_ASSERT(interval->index() == j); + MOZ_ASSERT(interval->index() == j); if (interval->index() == 0) { reg->def()->setOutput(*interval->getAllocation()); @@ -1151,7 +1151,7 @@ BacktrackingAllocator::populateSafepoints() size_t firstSafepoint = 0; // Virtual register number 0 is unused. - JS_ASSERT(!vregs[0u].def()); + MOZ_ASSERT(!vregs[0u].def()); for (uint32_t i = 1; i < vregs.numVirtualRegisters(); i++) { BacktrackingVirtualRegister *reg = &vregs[i]; @@ -1236,7 +1236,7 @@ BacktrackingAllocator::dumpRegisterGroups() bool any = false; // Virtual register number 0 is unused. - JS_ASSERT(!vregs[0u].group()); + MOZ_ASSERT(!vregs[0u].group()); for (size_t i = 1; i < graph.numVirtualRegisters(); i++) { VirtualRegisterGroup *group = vregs[i].group(); if (group && i == group->canonicalReg()) { @@ -1555,7 +1555,7 @@ BacktrackingAllocator::trySplitAfterLastRegisterUse(LiveInterval *interval, Live LInstruction *ins = insData[iter->pos].ins(); // Uses in the interval should be sorted. - JS_ASSERT(iter->pos >= lastUse); + MOZ_ASSERT(iter->pos >= lastUse); lastUse = inputOf(ins); if (!conflict || outputOf(ins) < conflict->start()) { @@ -1699,7 +1699,7 @@ BacktrackingAllocator::splitAtAllRegisterUses(LiveInterval *interval) newIntervals.back()->addUseAtEnd(new(alloc()) UsePosition(iter->use, iter->pos)); } else { - JS_ASSERT(spillIntervalIsNew); + MOZ_ASSERT(spillIntervalIsNew); spillInterval->addUseAtEnd(new(alloc()) UsePosition(iter->use, iter->pos)); } } @@ -1741,9 +1741,9 @@ BacktrackingAllocator::splitAt(LiveInterval *interval, // same resulting interval. // splitPositions should be non-empty and sorted. - JS_ASSERT(!splitPositions.empty()); + MOZ_ASSERT(!splitPositions.empty()); for (size_t i = 1; i < splitPositions.length(); ++i) - JS_ASSERT(splitPositions[i-1] < splitPositions[i]); + MOZ_ASSERT(splitPositions[i-1] < splitPositions[i]); // Don't spill the interval until after the end of its definition. CodePosition spillStart = interval->start(); @@ -1803,7 +1803,7 @@ BacktrackingAllocator::splitAt(LiveInterval *interval, newIntervals.back()->addUseAtEnd(new(alloc()) UsePosition(iter->use, iter->pos)); lastRegisterUse = iter->pos; } else { - JS_ASSERT(spillIntervalIsNew); + MOZ_ASSERT(spillIntervalIsNew); spillInterval->addUseAtEnd(new(alloc()) UsePosition(iter->use, iter->pos)); } } @@ -1861,7 +1861,7 @@ BacktrackingAllocator::splitAcrossCalls(LiveInterval *interval) return false; } } - JS_ASSERT(callPositions.length()); + MOZ_ASSERT(callPositions.length()); #ifdef DEBUG JitSpewStart(JitSpew_RegAlloc, " split across calls at "); diff --git a/js/src/jit/BacktrackingAllocator.h b/js/src/jit/BacktrackingAllocator.h index a95c47c8f595..05453c65237c 100644 --- a/js/src/jit/BacktrackingAllocator.h +++ b/js/src/jit/BacktrackingAllocator.h @@ -78,7 +78,7 @@ class BacktrackingVirtualRegister : public VirtualRegister } void setCanonicalSpill(LAllocation alloc) { - JS_ASSERT(!alloc.isUse()); + MOZ_ASSERT(!alloc.isUse()); canonicalSpill_ = alloc; } const LAllocation *canonicalSpill() const { @@ -92,7 +92,7 @@ class BacktrackingVirtualRegister : public VirtualRegister return canonicalSpillExclude_.bits() != 0; } CodePosition canonicalSpillExclude() const { - JS_ASSERT(hasCanonicalSpillExclude()); + MOZ_ASSERT(hasCanonicalSpillExclude()); return canonicalSpillExclude_; } diff --git a/js/src/jit/Bailouts.cpp b/js/src/jit/Bailouts.cpp index a269a04c4b61..c7a0668acf13 100644 --- a/js/src/jit/Bailouts.cpp +++ b/js/src/jit/Bailouts.cpp @@ -75,7 +75,7 @@ uint32_t jit::Bailout(BailoutStack *sp, BaselineBailoutInfo **bailoutInfo) { JSContext *cx = GetJSContextFromJitCode(); - JS_ASSERT(bailoutInfo); + MOZ_ASSERT(bailoutInfo); // We don't have an exit frame. MOZ_ASSERT(IsInRange(FAKE_JIT_TOP_FOR_BAILOUT, 0, 0x1000) && @@ -93,13 +93,13 @@ jit::Bailout(BailoutStack *sp, BaselineBailoutInfo **bailoutInfo) JitSpew(JitSpew_IonBailouts, "Took bailout! Snapshot offset: %d", iter.snapshotOffset()); - JS_ASSERT(IsBaselineEnabled(cx)); + MOZ_ASSERT(IsBaselineEnabled(cx)); *bailoutInfo = nullptr; uint32_t retval = BailoutIonToBaseline(cx, activation, iter, false, bailoutInfo); - JS_ASSERT(retval == BAILOUT_RETURN_OK || - retval == BAILOUT_RETURN_FATAL_ERROR || - retval == BAILOUT_RETURN_OVERRECURSED); + MOZ_ASSERT(retval == BAILOUT_RETURN_OK || + retval == BAILOUT_RETURN_FATAL_ERROR || + retval == BAILOUT_RETURN_OVERRECURSED); JS_ASSERT_IF(retval == BAILOUT_RETURN_OK, *bailoutInfo != nullptr); if (retval != BAILOUT_RETURN_OK) { @@ -149,13 +149,13 @@ jit::InvalidationBailout(InvalidationBailoutStack *sp, size_t *frameSizeOut, // Note: the frame size must be computed before we return from this function. *frameSizeOut = iter.topFrameSize(); - JS_ASSERT(IsBaselineEnabled(cx)); + MOZ_ASSERT(IsBaselineEnabled(cx)); *bailoutInfo = nullptr; uint32_t retval = BailoutIonToBaseline(cx, activation, iter, true, bailoutInfo); - JS_ASSERT(retval == BAILOUT_RETURN_OK || - retval == BAILOUT_RETURN_FATAL_ERROR || - retval == BAILOUT_RETURN_OVERRECURSED); + MOZ_ASSERT(retval == BAILOUT_RETURN_OK || + retval == BAILOUT_RETURN_FATAL_ERROR || + retval == BAILOUT_RETURN_OVERRECURSED); JS_ASSERT_IF(retval == BAILOUT_RETURN_OK, *bailoutInfo != nullptr); if (retval != BAILOUT_RETURN_OK) { diff --git a/js/src/jit/Bailouts.h b/js/src/jit/Bailouts.h index 0c9578856cb8..9c11b4174a12 100644 --- a/js/src/jit/Bailouts.h +++ b/js/src/jit/Bailouts.h @@ -139,7 +139,7 @@ class IonBailoutIterator : public JitFrameIterator return JitFrameIterator::machineState(); } size_t topFrameSize() const { - JS_ASSERT(topIonScript_); + MOZ_ASSERT(topIonScript_); return topFrameSize_; } IonScript *ionScript() const { diff --git a/js/src/jit/BaselineBailouts.cpp b/js/src/jit/BaselineBailouts.cpp index e85a8b457762..ce20e130a295 100644 --- a/js/src/jit/BaselineBailouts.cpp +++ b/js/src/jit/BaselineBailouts.cpp @@ -46,7 +46,7 @@ class BufferPointer return (T*)(header->incomingStack + offset_); uint8_t *p = header->copyStackTop - offset_; - JS_ASSERT(p >= header->copyStackBottom && p < header->copyStackTop); + MOZ_ASSERT(p >= header->copyStackBottom && p < header->copyStackTop); return (T*)p; } @@ -98,7 +98,7 @@ struct BaselineStackBuilder header_(nullptr), framePushed_(0) { - JS_ASSERT(bufferTotal_ >= HeaderSize()); + MOZ_ASSERT(bufferTotal_ >= HeaderSize()); } ~BaselineStackBuilder() { @@ -106,8 +106,8 @@ struct BaselineStackBuilder } bool init() { - JS_ASSERT(!buffer_); - JS_ASSERT(bufferUsed_ == 0); + MOZ_ASSERT(!buffer_); + MOZ_ASSERT(bufferUsed_ == 0); buffer_ = reinterpret_cast(js_calloc(bufferTotal_)); if (!buffer_) return false; @@ -130,7 +130,7 @@ struct BaselineStackBuilder } bool enlarge() { - JS_ASSERT(buffer_ != nullptr); + MOZ_ASSERT(buffer_ != nullptr); if (bufferTotal_ & mozilla::tl::MulOverflowMask<2>::value) return false; size_t newSize = bufferTotal_ * 2; @@ -151,12 +151,12 @@ struct BaselineStackBuilder } BaselineBailoutInfo *info() { - JS_ASSERT(header_ == reinterpret_cast(buffer_)); + MOZ_ASSERT(header_ == reinterpret_cast(buffer_)); return header_; } BaselineBailoutInfo *takeBuffer() { - JS_ASSERT(header_ == reinterpret_cast(buffer_)); + MOZ_ASSERT(header_ == reinterpret_cast(buffer_)); buffer_ = nullptr; return header_; } @@ -238,8 +238,8 @@ struct BaselineStackBuilder } Value popValue() { - JS_ASSERT(bufferUsed_ >= sizeof(Value)); - JS_ASSERT(framePushed_ >= sizeof(Value)); + MOZ_ASSERT(bufferUsed_ >= sizeof(Value)); + MOZ_ASSERT(framePushed_ >= sizeof(Value)); bufferAvail_ += sizeof(Value); bufferUsed_ -= sizeof(Value); framePushed_ -= sizeof(Value); @@ -249,7 +249,7 @@ struct BaselineStackBuilder } void popValueInto(PCMappingSlotInfo::SlotLocation loc) { - JS_ASSERT(PCMappingSlotInfo::ValidSlotLocation(loc)); + MOZ_ASSERT(PCMappingSlotInfo::ValidSlotLocation(loc)); switch(loc) { case PCMappingSlotInfo::SlotInR0: header_->setR0 = 1; @@ -260,7 +260,7 @@ struct BaselineStackBuilder header_->valueR1 = popValue(); break; default: - JS_ASSERT(loc == PCMappingSlotInfo::SlotIgnore); + MOZ_ASSERT(loc == PCMappingSlotInfo::SlotIgnore); popValue(); break; } @@ -339,7 +339,7 @@ struct BaselineStackBuilder return virtualPointerAtStackOffset(offset); } - JS_ASSERT(type == JitFrame_Rectifier); + MOZ_ASSERT(type == JitFrame_Rectifier); // Rectifier - behaviour depends on the frame preceding the rectifier frame, and // whether the arch is x86 or not. The x86 rectifier frame saves the frame pointer, // so we can calculate it directly. For other archs, the previous frame pointer @@ -347,7 +347,7 @@ struct BaselineStackBuilder size_t priorOffset = IonJSFrameLayout::Size() + topFrame->prevFrameLocalSize(); #if defined(JS_CODEGEN_X86) // On X86, the FramePointer is pushed as the first value in the Rectifier frame. - JS_ASSERT(BaselineFrameReg == FramePointer); + MOZ_ASSERT(BaselineFrameReg == FramePointer); priorOffset -= sizeof(void *); return virtualPointerAtStackOffset(priorOffset); #elif defined(JS_CODEGEN_X64) || defined(JS_CODEGEN_ARM) || defined(JS_CODEGEN_MIPS) @@ -356,7 +356,7 @@ struct BaselineStackBuilder BufferPointer priorFrame = pointerAtStackOffset(priorOffset); FrameType priorType = priorFrame->prevType(); - JS_ASSERT(priorType == JitFrame_IonJS || priorType == JitFrame_BaselineStub); + MOZ_ASSERT(priorType == JitFrame_IonJS || priorType == JitFrame_BaselineStub); // If the frame preceding the rectifier is an IonJS frame, then once again // the frame pointer does not matter. @@ -421,7 +421,7 @@ GetStubReturnAddress(JSContext *cx, jsbytecode *pc) if (IsSetPropPC(pc)) return cx->compartment()->jitCompartment()->baselineSetPropReturnAddr(); // This should be a call op of some kind, now. - JS_ASSERT(IsCallPC(pc)); + MOZ_ASSERT(IsCallPC(pc)); return cx->compartment()->jitCompartment()->baselineCallReturnAddr(); } @@ -622,7 +622,7 @@ InitFromBailout(JSContext *cx, HandleScript caller, jsbytecode *callerPC, if (fun && fun->isHeavyweight()) flags |= BaselineFrame::HAS_CALL_OBJ; } else { - JS_ASSERT(v.isUndefined() || v.isMagic(JS_OPTIMIZED_OUT)); + MOZ_ASSERT(v.isUndefined() || v.isMagic(JS_OPTIMIZED_OUT)); // Get scope chain from function or script. if (fun) { @@ -637,8 +637,8 @@ InitFromBailout(JSContext *cx, HandleScript caller, jsbytecode *callerPC, // scripts). Also note that it's invalid to resume into the // prologue in this case because the prologue expects the scope // chain in R1 for eval and global scripts. - JS_ASSERT(!script->isForEval()); - JS_ASSERT(script->compileAndGo()); + MOZ_ASSERT(!script->isForEval()); + MOZ_ASSERT(script->compileAndGo()); scopeChain = &(script->global()); } } @@ -651,7 +651,7 @@ InitFromBailout(JSContext *cx, HandleScript caller, jsbytecode *callerPC, // If script maybe has an arguments object, the third slot will hold it. if (script->argumentsHasVarBinding()) { v = iter.read(); - JS_ASSERT(v.isObject() || v.isUndefined() || v.isMagic(JS_OPTIMIZED_OUT)); + MOZ_ASSERT(v.isObject() || v.isUndefined() || v.isMagic(JS_OPTIMIZED_OUT)); if (v.isObject()) argsObj = &v.toObject().as(); } @@ -678,7 +678,7 @@ InitFromBailout(JSContext *cx, HandleScript caller, jsbytecode *callerPC, size_t thisvOffset = builder.framePushed() + IonJSFrameLayout::offsetOfThis(); *builder.valuePointerAtStackOffset(thisvOffset) = thisv; - JS_ASSERT(iter.numAllocations() >= CountArgSlots(script, fun)); + MOZ_ASSERT(iter.numAllocations() >= CountArgSlots(script, fun)); JitSpew(JitSpew_BaselineBailouts, " frame slots %u, nargs %u, nfixed %u", iter.numAllocations(), fun->nargs(), script->nfixed()); @@ -688,7 +688,7 @@ InitFromBailout(JSContext *cx, HandleScript caller, jsbytecode *callerPC, // UndefinedValue() here for formals we think are unused, but // locals may still reference the original argument slot // (MParameter/LArgument) and expect the original Value. - JS_ASSERT(startFrameFormals.empty()); + MOZ_ASSERT(startFrameFormals.empty()); if (!startFrameFormals.resize(fun->nargs())) return false; } @@ -734,7 +734,7 @@ InitFromBailout(JSContext *cx, HandleScript caller, jsbytecode *callerPC, else inlined_args = 2 + IsSetPropPC(pc); - JS_ASSERT(exprStackSlots >= inlined_args); + MOZ_ASSERT(exprStackSlots >= inlined_args); pushedSlots = exprStackSlots - inlined_args; JitSpew(JitSpew_BaselineBailouts, @@ -814,7 +814,7 @@ InitFromBailout(JSContext *cx, HandleScript caller, jsbytecode *callerPC, // If coming from an invalidation bailout, and this is the topmost // value, and a value override has been specified, don't read from the // iterator. Otherwise, we risk using a garbage value. - JS_ASSERT(invalidate); + MOZ_ASSERT(invalidate); iter.skip(); JitSpew(JitSpew_BaselineBailouts, " [Return Override]"); v = cx->runtime()->jitRuntime()->takeIonReturnOverride(); @@ -874,7 +874,7 @@ InitFromBailout(JSContext *cx, HandleScript caller, jsbytecode *callerPC, // For fun.call(this, ...); the reconstructStackDepth will // include the this. When inlining that is not included. // So the exprStackSlots will be one less. - JS_ASSERT(expectedDepth - exprStackSlots <= 1); + MOZ_ASSERT(expectedDepth - exprStackSlots <= 1); } else if (iter.moreFrames() && (IsGetPropPC(pc) || IsSetPropPC(pc))) { // Accessors coming out of ion are inlined via a complete // lie perpetrated by the compiler internally. Ion just rearranges @@ -884,13 +884,13 @@ InitFromBailout(JSContext *cx, HandleScript caller, jsbytecode *callerPC, // rather than the expected |this| and [arg] // Note that none of that was pushed, but it's still reflected // in exprStackSlots. - JS_ASSERT(exprStackSlots - expectedDepth == 1); + MOZ_ASSERT(exprStackSlots - expectedDepth == 1); } else { // 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. - JS_ASSERT(exprStackSlots == expectedDepth); + MOZ_ASSERT(exprStackSlots == expectedDepth); } } } @@ -932,7 +932,7 @@ InitFromBailout(JSContext *cx, HandleScript caller, jsbytecode *callerPC, if (enterMonitorChain) { ICEntry &icEntry = baselineScript->icEntryFromPCOffset(pcOff); ICFallbackStub *fallbackStub = icEntry.firstStub()->getChainFallback(); - JS_ASSERT(fallbackStub->isMonitoredFallback()); + MOZ_ASSERT(fallbackStub->isMonitoredFallback()); JitSpew(JitSpew_BaselineBailouts, " [TYPE-MONITOR CHAIN]"); ICMonitoredFallbackStub *monFallbackStub = fallbackStub->toMonitoredFallbackStub(); ICStub *firstMonStub = monFallbackStub->fallbackMonitorStub()->firstMonitorStub(); @@ -977,7 +977,7 @@ InitFromBailout(JSContext *cx, HandleScript caller, jsbytecode *callerPC, PCMappingSlotInfo slotInfo; uint8_t *nativeCodeForPC = baselineScript->nativeCodeForPC(script, pc, &slotInfo); unsigned numUnsynced = slotInfo.numUnsynced(); - JS_ASSERT(numUnsynced <= 2); + MOZ_ASSERT(numUnsynced <= 2); PCMappingSlotInfo::SlotLocation loc1, loc2; if (numUnsynced > 0) { loc1 = slotInfo.topSlotLocation(); @@ -1006,8 +1006,8 @@ InitFromBailout(JSContext *cx, HandleScript caller, jsbytecode *callerPC, if (scopeChain == nullptr) { // Global and eval scripts expect the scope chain in R1, so only // resume into the prologue for function scripts. - JS_ASSERT(fun); - JS_ASSERT(numUnsynced == 0); + MOZ_ASSERT(fun); + MOZ_ASSERT(numUnsynced == 0); opReturnAddr = baselineScript->prologueEntryAddr(); JitSpew(JitSpew_BaselineBailouts, " Resuming into prologue."); @@ -1086,7 +1086,7 @@ InitFromBailout(JSContext *cx, HandleScript caller, jsbytecode *callerPC, // Calculate and write out return address. // The icEntry in question MUST have an inlinable fallback stub. ICEntry &icEntry = baselineScript->icEntryFromPCOffset(pcOff); - JS_ASSERT(IsInlinableFallback(icEntry.firstStub()->getChainFallback())); + MOZ_ASSERT(IsInlinableFallback(icEntry.firstStub()->getChainFallback())); if (!builder.writePtr(baselineScript->returnAddressForIC(icEntry), "ReturnAddr")) return false; @@ -1118,7 +1118,7 @@ InitFromBailout(JSContext *cx, HandleScript caller, jsbytecode *callerPC, size_t startOfBaselineStubFrame = builder.framePushed(); // Write stub pointer. - JS_ASSERT(IsInlinableFallback(icEntry.fallbackStub())); + MOZ_ASSERT(IsInlinableFallback(icEntry.fallbackStub())); if (!builder.writePtr(icEntry.fallbackStub(), "StubPtr")) return false; @@ -1129,7 +1129,7 @@ InitFromBailout(JSContext *cx, HandleScript caller, jsbytecode *callerPC, // Write out actual arguments (and thisv), copied from unpacked stack of BaselineJS frame. // Arguments are reversed on the BaselineJS frame's stack values. - JS_ASSERT(IsIonInlinablePC(pc)); + MOZ_ASSERT(IsIonInlinablePC(pc)); unsigned actualArgc; if (needToSaveArgs) { // For FUNAPPLY or an accessor, the arguments are not on the stack anymore, @@ -1139,8 +1139,8 @@ InitFromBailout(JSContext *cx, HandleScript caller, jsbytecode *callerPC, else actualArgc = IsSetPropPC(pc); - JS_ASSERT(actualArgc + 2 <= exprStackSlots); - JS_ASSERT(savedCallerArgs.length() == actualArgc + 2); + MOZ_ASSERT(actualArgc + 2 <= exprStackSlots); + MOZ_ASSERT(savedCallerArgs.length() == actualArgc + 2); for (unsigned i = 0; i < actualArgc + 1; i++) { size_t arg = savedCallerArgs.length() - (i + 1); if (!builder.writeValue(savedCallerArgs[arg], "ArgVal")) @@ -1149,11 +1149,11 @@ InitFromBailout(JSContext *cx, HandleScript caller, jsbytecode *callerPC, } else { actualArgc = GET_ARGC(pc); if (op == JSOP_FUNCALL) { - JS_ASSERT(actualArgc > 0); + MOZ_ASSERT(actualArgc > 0); actualArgc--; } - JS_ASSERT(actualArgc + 2 <= exprStackSlots); + MOZ_ASSERT(actualArgc + 2 <= exprStackSlots); for (unsigned i = 0; i < actualArgc + 1; i++) { size_t argSlot = (script->nfixed() + exprStackSlots) - (i + 1); if (!builder.writeValue(*blFrame->valueSlot(argSlot), "ArgVal")) @@ -1188,7 +1188,7 @@ InitFromBailout(JSContext *cx, HandleScript caller, jsbytecode *callerPC, JitSpew(JitSpew_BaselineBailouts, " CalleeStackSlot=%d", (int) calleeStackSlot); } JitSpew(JitSpew_BaselineBailouts, " Callee = %016llx", *((uint64_t *) &callee)); - JS_ASSERT(callee.isObject() && callee.toObject().is()); + MOZ_ASSERT(callee.isObject() && callee.toObject().is()); JSFunction *calleeFun = &callee.toObject().as(); if (!builder.writePtr(CalleeToToken(calleeFun, JSOp(*pc) == JSOP_NEW), "CalleeToken")) return false; @@ -1200,7 +1200,7 @@ InitFromBailout(JSContext *cx, HandleScript caller, jsbytecode *callerPC, // Push return address into ICCall_Scripted stub, immediately after the call. void *baselineCallReturnAddr = GetStubReturnAddress(cx, pc); - JS_ASSERT(baselineCallReturnAddr); + MOZ_ASSERT(baselineCallReturnAddr); if (!builder.writePtr(baselineCallReturnAddr, "ReturnAddr")) return false; @@ -1279,7 +1279,7 @@ InitFromBailout(JSContext *cx, HandleScript caller, jsbytecode *callerPC, // Push return address into the ArgumentsRectifier code, immediately after the ioncode // call. void *rectReturnAddr = cx->runtime()->jitRuntime()->getArgumentsRectifierReturnAddr(); - JS_ASSERT(rectReturnAddr); + MOZ_ASSERT(rectReturnAddr); if (!builder.writePtr(rectReturnAddr, "ReturnAddr")) return false; @@ -1293,10 +1293,10 @@ jit::BailoutIonToBaseline(JSContext *cx, JitActivation *activation, IonBailoutIt { // The Baseline frames we will reconstruct on the heap are not rooted, so GC // must be suppressed here. - JS_ASSERT(cx->mainThread().suppressGC); + MOZ_ASSERT(cx->mainThread().suppressGC); - JS_ASSERT(bailoutInfo != nullptr); - JS_ASSERT(*bailoutInfo == nullptr); + MOZ_ASSERT(bailoutInfo != nullptr); + MOZ_ASSERT(*bailoutInfo == nullptr); TraceLogger *logger = TraceLoggerForMainThread(cx->runtime()); TraceLogStopEvent(logger, TraceLogger::IonMonkey); @@ -1307,12 +1307,12 @@ jit::BailoutIonToBaseline(JSContext *cx, JitActivation *activation, IonBailoutIt // BaselineStub - Baseline calling into Ion. // Entry - Interpreter or other calling into Ion. // Rectifier - Arguments rectifier calling into Ion. - JS_ASSERT(iter.isIonJS()); + MOZ_ASSERT(iter.isIonJS()); FrameType prevFrameType = iter.prevType(); - JS_ASSERT(prevFrameType == JitFrame_IonJS || - prevFrameType == JitFrame_BaselineStub || - prevFrameType == JitFrame_Entry || - prevFrameType == JitFrame_Rectifier); + MOZ_ASSERT(prevFrameType == JitFrame_IonJS || + prevFrameType == JitFrame_BaselineStub || + prevFrameType == JitFrame_Entry || + prevFrameType == JitFrame_Rectifier); // All incoming frames are going to look like this: // @@ -1433,15 +1433,15 @@ jit::BailoutIonToBaseline(JSContext *cx, JitActivation *activation, IonBailoutIt } if (!snapIter.moreFrames()) { - JS_ASSERT(!callPC); + MOZ_ASSERT(!callPC); break; } if (handleException) break; - JS_ASSERT(nextCallee); - JS_ASSERT(callPC); + MOZ_ASSERT(nextCallee); + MOZ_ASSERT(callPC); caller = scr; callerPC = callPC; fun = nextCallee; @@ -1449,7 +1449,7 @@ jit::BailoutIonToBaseline(JSContext *cx, JitActivation *activation, IonBailoutIt // Save top caller info for adjusting SPS frames later. if (!topCaller) { - JS_ASSERT(frameNo == 0); + MOZ_ASSERT(frameNo == 0); topCaller = caller; topCallerPC = callerPC; } @@ -1503,7 +1503,7 @@ HandleBoundsCheckFailure(JSContext *cx, HandleScript outerScript, HandleScript i innerScript->filename(), innerScript->lineno(), outerScript->filename(), outerScript->lineno()); - JS_ASSERT(!outerScript->ionScript()->invalidated()); + MOZ_ASSERT(!outerScript->ionScript()->invalidated()); // TODO: Currently this mimic's Ion's handling of this case. Investigate setting // the flag on innerScript as opposed to outerScript, and maybe invalidating both @@ -1521,7 +1521,7 @@ HandleShapeGuardFailure(JSContext *cx, HandleScript outerScript, HandleScript in innerScript->filename(), innerScript->lineno(), outerScript->filename(), outerScript->lineno()); - JS_ASSERT(!outerScript->ionScript()->invalidated()); + MOZ_ASSERT(!outerScript->ionScript()->invalidated()); // TODO: Currently this mimic's Ion's handling of this case. Investigate setting // the flag on innerScript as opposed to outerScript, and maybe invalidating both @@ -1538,7 +1538,7 @@ HandleBaselineInfoBailout(JSContext *cx, JSScript *outerScript, JSScript *innerS innerScript->filename(), innerScript->lineno(), outerScript->filename(), outerScript->lineno()); - JS_ASSERT(!outerScript->ionScript()->invalidated()); + MOZ_ASSERT(!outerScript->ionScript()->invalidated()); JitSpew(JitSpew_BaselineBailouts, "Invalidating due to invalid baseline info"); return Invalidate(cx, outerScript); @@ -1595,7 +1595,7 @@ jit::FinishBailoutToBaseline(BaselineBailoutInfo *bailoutInfo) #endif uint32_t numFrames = bailoutInfo->numFrames; - JS_ASSERT(numFrames > 0); + MOZ_ASSERT(numFrames > 0); BailoutKind bailoutKind = bailoutInfo->bailoutKind; // Free the bailout buffer. @@ -1614,13 +1614,13 @@ jit::FinishBailoutToBaseline(BaselineBailoutInfo *bailoutInfo) RootedScript innerScript(cx, nullptr); RootedScript outerScript(cx, nullptr); - JS_ASSERT(cx->currentlyRunningInJit()); + MOZ_ASSERT(cx->currentlyRunningInJit()); JitFrameIterator iter(cx); uint8_t *outerFp = nullptr; uint32_t frameno = 0; while (frameno < numFrames) { - JS_ASSERT(!iter.isIonJS()); + MOZ_ASSERT(!iter.isIonJS()); if (iter.isBaselineJS()) { BaselineFrame *frame = iter.baselineFrame(); diff --git a/js/src/jit/BaselineCompiler.cpp b/js/src/jit/BaselineCompiler.cpp index 966d2d812732..a02b8d7ab900 100644 --- a/js/src/jit/BaselineCompiler.cpp +++ b/js/src/jit/BaselineCompiler.cpp @@ -87,7 +87,7 @@ BaselineCompiler::compile() // Pin analysis info during compilation. types::AutoEnterAnalysis autoEnterAnalysis(cx); - JS_ASSERT(!script->hasBaselineScript()); + MOZ_ASSERT(!script->hasBaselineScript()); if (!emitPrologue()) return Method_Error; @@ -154,12 +154,12 @@ BaselineCompiler::compile() // Use the high bit of the SlotInfo byte to indicate the // native code offset (relative to the previous op) > 0 and // comes next in the buffer. - JS_ASSERT((entry.slotInfo.toByte() & 0x80) == 0); + MOZ_ASSERT((entry.slotInfo.toByte() & 0x80) == 0); if (entry.nativeOffset == previousOffset) { pcEntries.writeByte(entry.slotInfo.toByte()); } else { - JS_ASSERT(entry.nativeOffset > previousOffset); + MOZ_ASSERT(entry.nativeOffset > previousOffset); pcEntries.writeByte(0x80 | entry.slotInfo.toByte()); pcEntries.writeUnsigned(entry.nativeOffset - previousOffset); } @@ -200,10 +200,10 @@ BaselineCompiler::compile() writePerfSpewerBaselineProfile(script, code); #endif - JS_ASSERT(pcMappingIndexEntries.length() > 0); + MOZ_ASSERT(pcMappingIndexEntries.length() > 0); baselineScript->copyPCMappingIndexEntries(&pcMappingIndexEntries[0]); - JS_ASSERT(pcEntries.length() > 0); + MOZ_ASSERT(pcEntries.length() > 0); baselineScript->copyPCMappingEntries(pcEntries); // Copy IC entries @@ -285,8 +285,8 @@ BaselineCompiler::emitInitializeLocals(size_t n, const Value &v) // Partially unrolled loop of pushes. if (n >= LOOP_UNROLL_FACTOR) { size_t toPush = n - toPushExtra; - JS_ASSERT(toPush % LOOP_UNROLL_FACTOR == 0); - JS_ASSERT(toPush >= LOOP_UNROLL_FACTOR); + MOZ_ASSERT(toPush % LOOP_UNROLL_FACTOR == 0); + MOZ_ASSERT(toPush >= LOOP_UNROLL_FACTOR); masm.move32(Imm32(toPush), R1.scratchReg()); // Emit unrolled loop with 4 pushes per iteration. Label pushLoop; @@ -677,13 +677,13 @@ BaselineCompiler::emitWarmUpCounterIncrement(bool allowOsr) // If this is a loop inside a catch or finally block, increment the warmup // counter but don't attempt OSR (Ion only compiles the try block). if (analysis_.info(pc).loopEntryInCatchOrFinally) { - JS_ASSERT(JSOp(*pc) == JSOP_LOOPENTRY); + MOZ_ASSERT(JSOp(*pc) == JSOP_LOOPENTRY); return true; } // OSR not possible at this loop entry. if (!allowOsr) { - JS_ASSERT(JSOp(*pc) == JSOP_LOOPENTRY); + MOZ_ASSERT(JSOp(*pc) == JSOP_LOOPENTRY); return true; } @@ -735,8 +735,8 @@ BaselineCompiler::emitArgumentTypeChecks() bool BaselineCompiler::emitDebugTrap() { - JS_ASSERT(debugMode_); - JS_ASSERT(frame.numUnsyncedSlots() == 0); + MOZ_ASSERT(debugMode_); + MOZ_ASSERT(frame.numUnsyncedSlots() == 0); bool enabled = script->stepModeEnabled() || script->hasBreakpointsAt(pc); @@ -747,7 +747,7 @@ BaselineCompiler::emitDebugTrap() #ifdef DEBUG // Patchable call offset has to match the pc mapping offset. PCMappingEntry &entry = pcMappingEntries_.back(); - JS_ASSERT((&offset)->offset() == entry.nativeOffset); + MOZ_ASSERT((&offset)->offset() == entry.nativeOffset); #endif // Add an IC entry for the return offset -> pc mapping. @@ -765,14 +765,14 @@ BaselineCompiler::emitSPSPush() // Enter the IC, guarded by a toggled jump (initially disabled). Label noPush; CodeOffsetLabel toggleOffset = masm.toggledJump(&noPush); - JS_ASSERT(frame.numUnsyncedSlots() == 0); + MOZ_ASSERT(frame.numUnsyncedSlots() == 0); ICProfiler_Fallback::Compiler compiler(cx); if (!emitNonOpIC(compiler.getStub(&stubSpace_))) return false; masm.bind(&noPush); // Store the start offset in the appropriate location. - JS_ASSERT(spsPushToggleOffset_.offset() == 0); + MOZ_ASSERT(spsPushToggleOffset_.offset() == 0); spsPushToggleOffset_ = toggleOffset; return true; } @@ -791,7 +791,7 @@ BaselineCompiler::emitSPSPop() MethodStatus BaselineCompiler::emitBody() { - JS_ASSERT(pc == script->code()); + MOZ_ASSERT(pc == script->code()); bool lastOpUnreachable = false; uint32_t emittedOps = 0; @@ -874,7 +874,7 @@ OPCODE_LIST(EMIT_OP) #endif } - JS_ASSERT(JSOp(*prevpc) == JSOP_RETRVAL); + MOZ_ASSERT(JSOp(*prevpc) == JSOP_RETRVAL); return Method_Compiled; } @@ -1764,7 +1764,7 @@ BaselineCompiler::emit_JSOP_NEWINIT() if (!emitOpIC(stubCompiler.getStub(&stubSpace_))) return false; } else { - JS_ASSERT(key == JSProto_Object); + MOZ_ASSERT(key == JSProto_Object); RootedObject templateObject(cx); templateObject = NewBuiltinClassInstance(cx, &JSObject::class_, TenuredObject); @@ -2268,7 +2268,7 @@ BaselineCompiler::emit_JSOP_DEFVAR() attrs |= JSPROP_READONLY; else if (!script->isForEval()) attrs |= JSPROP_PERMANENT; - JS_ASSERT(attrs <= UINT32_MAX); + MOZ_ASSERT(attrs <= UINT32_MAX); masm.loadPtr(frame.addressOfScopeChain(), R0.scratchReg()); @@ -2336,8 +2336,8 @@ static const VMFunction InitPropGetterSetterInfo = bool BaselineCompiler::emitInitPropGetterSetter() { - JS_ASSERT(JSOp(*pc) == JSOP_INITPROP_GETTER || - JSOp(*pc) == JSOP_INITPROP_SETTER); + MOZ_ASSERT(JSOp(*pc) == JSOP_INITPROP_GETTER || + JSOp(*pc) == JSOP_INITPROP_SETTER); // Keep values on the stack for the decompiler. frame.syncStack(0); @@ -2379,8 +2379,8 @@ static const VMFunction InitElemGetterSetterInfo = bool BaselineCompiler::emitInitElemGetterSetter() { - JS_ASSERT(JSOp(*pc) == JSOP_INITELEM_GETTER || - JSOp(*pc) == JSOP_INITELEM_SETTER); + MOZ_ASSERT(JSOp(*pc) == JSOP_INITELEM_GETTER || + JSOp(*pc) == JSOP_INITELEM_SETTER); // Load index and value in R0 and R1, but keep values on the stack for the // decompiler. @@ -2610,7 +2610,7 @@ BaselineCompiler::emit_JSOP_UNINITIALIZED() bool BaselineCompiler::emitCall() { - JS_ASSERT(IsCallPC(pc)); + MOZ_ASSERT(IsCallPC(pc)); uint32_t argc = GET_ARGC(pc); @@ -2632,7 +2632,7 @@ BaselineCompiler::emitCall() bool BaselineCompiler::emitSpreadCall() { - JS_ASSERT(IsCallPC(pc)); + MOZ_ASSERT(IsCallPC(pc)); frame.syncStack(0); masm.move32(Imm32(1), R0.scratchReg()); @@ -3011,7 +3011,7 @@ BaselineCompiler::emitReturn() bool BaselineCompiler::emit_JSOP_RETURN() { - JS_ASSERT(frame.stackDepth() == 1); + MOZ_ASSERT(frame.stackDepth() == 1); frame.popValue(JSReturnOperand); return emitReturn(); @@ -3020,7 +3020,7 @@ BaselineCompiler::emit_JSOP_RETURN() bool BaselineCompiler::emit_JSOP_RETRVAL() { - JS_ASSERT(frame.stackDepth() == 0); + MOZ_ASSERT(frame.stackDepth() == 0); masm.moveValue(UndefinedValue(), JSReturnOperand); @@ -3147,7 +3147,7 @@ BaselineCompiler::emit_JSOP_SETRVAL() bool BaselineCompiler::emit_JSOP_CALLEE() { - JS_ASSERT(function()); + MOZ_ASSERT(function()); frame.syncStack(0); masm.loadFunctionFromCalleeToken(frame.addressOfCalleeToken(), R0.scratchReg()); masm.tagValue(JSVAL_TYPE_OBJECT, R0.scratchReg(), R0); diff --git a/js/src/jit/BaselineFrame-inl.h b/js/src/jit/BaselineFrame-inl.h index 853bc6f8060a..e18947e5c1cb 100644 --- a/js/src/jit/BaselineFrame-inl.h +++ b/js/src/jit/BaselineFrame-inl.h @@ -20,8 +20,8 @@ namespace jit { inline void BaselineFrame::pushOnScopeChain(ScopeObject &scope) { - JS_ASSERT(*scopeChain() == scope.enclosingScope() || - *scopeChain() == scope.as().enclosingScope().as().enclosingScope()); + MOZ_ASSERT(*scopeChain() == scope.enclosingScope() || + *scopeChain() == scope.as().enclosingScope().as().enclosingScope()); scopeChain_ = &scope; } @@ -37,14 +37,14 @@ BaselineFrame::popWith(JSContext *cx) if (MOZ_UNLIKELY(cx->compartment()->debugMode())) DebugScopes::onPopWith(this); - JS_ASSERT(scopeChain()->is()); + MOZ_ASSERT(scopeChain()->is()); popOffScopeChain(); } inline bool BaselineFrame::pushBlock(JSContext *cx, Handle block) { - JS_ASSERT(block->needsClone()); + MOZ_ASSERT(block->needsClone()); ClonedBlockObject *clone = ClonedBlockObject::create(cx, block, this); if (!clone) @@ -57,7 +57,7 @@ BaselineFrame::pushBlock(JSContext *cx, Handle block) inline void BaselineFrame::popBlock(JSContext *cx) { - JS_ASSERT(scopeChain_->is()); + MOZ_ASSERT(scopeChain_->is()); popOffScopeChain(); } @@ -65,8 +65,8 @@ BaselineFrame::popBlock(JSContext *cx) inline CallObject & BaselineFrame::callObj() const { - JS_ASSERT(hasCallObj()); - JS_ASSERT(fun()->isHeavyweight()); + MOZ_ASSERT(hasCallObj()); + MOZ_ASSERT(fun()->isHeavyweight()); JSObject *obj = scopeChain(); while (!obj->is()) diff --git a/js/src/jit/BaselineFrame.cpp b/js/src/jit/BaselineFrame.cpp index 0ad823ca244d..a7cc16224910 100644 --- a/js/src/jit/BaselineFrame.cpp +++ b/js/src/jit/BaselineFrame.cpp @@ -74,15 +74,15 @@ BaselineFrame::trace(JSTracer *trc, JitFrameIterator &frameIterator) } } - JS_ASSERT(nlivefixed <= nfixed); - JS_ASSERT(nlivefixed >= script->nbodyfixed()); + MOZ_ASSERT(nlivefixed <= nfixed); + MOZ_ASSERT(nlivefixed >= script->nbodyfixed()); // NB: It is possible that numValueSlots() could be zero, even if nfixed is // nonzero. This is the case if the function has an early stack check. if (numValueSlots() == 0) return; - JS_ASSERT(nfixed <= numValueSlots()); + MOZ_ASSERT(nfixed <= numValueSlots()); if (nfixed == nlivefixed) { // All locals are live. @@ -118,7 +118,7 @@ BaselineFrame::copyRawFrameSlots(AutoValueVector *vec) const bool BaselineFrame::strictEvalPrologue(JSContext *cx) { - JS_ASSERT(isStrictEvalFrame()); + MOZ_ASSERT(isStrictEvalFrame()); CallObject *callobj = CallObject::createForStrictEval(cx, this); if (!callobj) @@ -138,8 +138,8 @@ BaselineFrame::heavyweightFunPrologue(JSContext *cx) bool BaselineFrame::initFunctionScopeObjects(JSContext *cx) { - JS_ASSERT(isNonEvalFunctionFrame()); - JS_ASSERT(fun()->isHeavyweight()); + MOZ_ASSERT(isNonEvalFunctionFrame()); + MOZ_ASSERT(fun()->isHeavyweight()); CallObject *callobj = CallObject::createForFunction(cx, this); if (!callobj) @@ -190,7 +190,7 @@ BaselineFrame::initForOsr(InterpreterFrame *fp, uint32_t numStackValues) BaselineFrame::Size() + numStackValues * sizeof(Value); - JS_ASSERT(numValueSlots() == numStackValues); + MOZ_ASSERT(numValueSlots() == numStackValues); for (uint32_t i = 0; i < numStackValues; i++) *valueSlot(i) = fp->slots()[i]; @@ -204,7 +204,7 @@ BaselineFrame::initForOsr(InterpreterFrame *fp, uint32_t numStackValues) // In debug mode there's always at least 1 ICEntry (since there are always // debug prologue/epilogue calls). JitFrameIterator iter(cx); - JS_ASSERT(iter.returnAddress() == nullptr); + MOZ_ASSERT(iter.returnAddress() == nullptr); BaselineScript *baseline = fp->script()->baselineScript(); iter.current()->setReturnAddress(baseline->returnAddressForIC(baseline->icEntry(0))); diff --git a/js/src/jit/BaselineFrame.h b/js/src/jit/BaselineFrame.h index ee76e0dcbfcf..e73051454f8c 100644 --- a/js/src/jit/BaselineFrame.h +++ b/js/src/jit/BaselineFrame.h @@ -157,39 +157,39 @@ class BaselineFrame size_t numValueSlots() const { size_t size = frameSize(); - JS_ASSERT(size >= BaselineFrame::FramePointerOffset + BaselineFrame::Size()); + MOZ_ASSERT(size >= BaselineFrame::FramePointerOffset + BaselineFrame::Size()); size -= BaselineFrame::FramePointerOffset + BaselineFrame::Size(); - JS_ASSERT((size % sizeof(Value)) == 0); + MOZ_ASSERT((size % sizeof(Value)) == 0); return size / sizeof(Value); } Value *valueSlot(size_t slot) const { - JS_ASSERT(slot < numValueSlots()); + MOZ_ASSERT(slot < numValueSlots()); return (Value *)this - (slot + 1); } Value &unaliasedVar(uint32_t i, MaybeCheckAliasing checkAliasing = CHECK_ALIASING) const { - JS_ASSERT(i < script()->nfixedvars()); + MOZ_ASSERT(i < script()->nfixedvars()); JS_ASSERT_IF(checkAliasing, !script()->varIsAliased(i)); return *valueSlot(i); } Value &unaliasedFormal(unsigned i, MaybeCheckAliasing checkAliasing = CHECK_ALIASING) const { - JS_ASSERT(i < numFormalArgs()); + MOZ_ASSERT(i < numFormalArgs()); JS_ASSERT_IF(checkAliasing, !script()->argsObjAliasesFormals() && !script()->formalIsAliased(i)); return argv()[i]; } Value &unaliasedActual(unsigned i, MaybeCheckAliasing checkAliasing = CHECK_ALIASING) const { - JS_ASSERT(i < numActualArgs()); + MOZ_ASSERT(i < numActualArgs()); JS_ASSERT_IF(checkAliasing, !script()->argsObjAliasesFormals()); JS_ASSERT_IF(checkAliasing && i < numFormalArgs(), !script()->formalIsAliased(i)); return argv()[i]; } Value &unaliasedLocal(uint32_t i, MaybeCheckAliasing checkAliasing = CHECK_ALIASING) const { - JS_ASSERT(i < script()->nfixed()); + MOZ_ASSERT(i < script()->nfixed()); #ifdef DEBUG CheckLocalUnaliased(checkAliasing, script(), i); #endif @@ -258,15 +258,15 @@ class BaselineFrame argsObj_ = &argsobj; } void initArgsObj(ArgumentsObject &argsobj) { - JS_ASSERT(script()->needsArgsObj()); + MOZ_ASSERT(script()->needsArgsObj()); initArgsObjUnchecked(argsobj); } bool hasArgsObj() const { return flags_ & HAS_ARGS_OBJ; } ArgumentsObject &argsObj() const { - JS_ASSERT(hasArgsObj()); - JS_ASSERT(script()->needsArgsObj()); + MOZ_ASSERT(hasArgsObj()); + MOZ_ASSERT(script()->needsArgsObj()); return *argsObj_; } @@ -278,7 +278,7 @@ class BaselineFrame } JSScript *evalScript() const { - JS_ASSERT(isEvalFrame()); + MOZ_ASSERT(isEvalFrame()); return evalScript_; } diff --git a/js/src/jit/BaselineFrameInfo.cpp b/js/src/jit/BaselineFrameInfo.cpp index c00ff7d56811..d937912d1f1d 100644 --- a/js/src/jit/BaselineFrameInfo.cpp +++ b/js/src/jit/BaselineFrameInfo.cpp @@ -55,7 +55,7 @@ FrameInfo::sync(StackValue *val) void FrameInfo::syncStack(uint32_t uses) { - JS_ASSERT(uses <= stackDepth()); + MOZ_ASSERT(uses <= stackDepth()); uint32_t depth = stackDepth() - uses; @@ -115,9 +115,9 @@ FrameInfo::popRegsAndSync(uint32_t uses) // x86 has only 3 Value registers. Only support 2 regs here for now, // so that there's always a scratch Value register for reg -> reg // moves. - JS_ASSERT(uses > 0); - JS_ASSERT(uses <= 2); - JS_ASSERT(uses <= stackDepth()); + MOZ_ASSERT(uses > 0); + MOZ_ASSERT(uses <= 2); + MOZ_ASSERT(uses <= stackDepth()); syncStack(uses); @@ -147,7 +147,7 @@ void FrameInfo::assertValidState(const BytecodeInfo &info) { // Check stack depth. - JS_ASSERT(stackDepth() == info.stackDepth); + MOZ_ASSERT(stackDepth() == info.stackDepth); // Start at the bottom, find the first value that's not synced. uint32_t i = 0; @@ -158,7 +158,7 @@ FrameInfo::assertValidState(const BytecodeInfo &info) // Assert all values on top of it are also not synced. for (; i < stackDepth(); i++) - JS_ASSERT(stack[i].kind() != StackValue::Stack); + MOZ_ASSERT(stack[i].kind() != StackValue::Stack); // Assert every Value register is used by at most one StackValue. // R2 is used as scratch register by the compiler and FrameInfo, @@ -169,10 +169,10 @@ FrameInfo::assertValidState(const BytecodeInfo &info) if (stack[i].kind() == StackValue::Register) { ValueOperand reg = stack[i].reg(); if (reg == R0) { - JS_ASSERT(!usedR0); + MOZ_ASSERT(!usedR0); usedR0 = true; } else if (reg == R1) { - JS_ASSERT(!usedR1); + MOZ_ASSERT(!usedR1); usedR1 = true; } else { MOZ_CRASH("Invalid register"); diff --git a/js/src/jit/BaselineFrameInfo.h b/js/src/jit/BaselineFrameInfo.h index d5c57ba2fc96..653130df161a 100644 --- a/js/src/jit/BaselineFrameInfo.h +++ b/js/src/jit/BaselineFrameInfo.h @@ -93,14 +93,14 @@ class StackValue return knownType_ != JSVAL_TYPE_UNKNOWN; } bool hasKnownType(JSValueType type) const { - JS_ASSERT(type != JSVAL_TYPE_UNKNOWN); + MOZ_ASSERT(type != JSVAL_TYPE_UNKNOWN); return knownType_ == type; } bool isKnownBoolean() const { return hasKnownType(JSVAL_TYPE_BOOLEAN); } JSValueType knownType() const { - JS_ASSERT(hasKnownType()); + MOZ_ASSERT(hasKnownType()); return knownType_; } void reset() { @@ -110,19 +110,19 @@ class StackValue #endif } Value constant() const { - JS_ASSERT(kind_ == Constant); + MOZ_ASSERT(kind_ == Constant); return data.constant.v; } ValueOperand reg() const { - JS_ASSERT(kind_ == Register); + MOZ_ASSERT(kind_ == Register); return *data.reg.reg.addr(); } uint32_t localSlot() const { - JS_ASSERT(kind_ == LocalSlot); + MOZ_ASSERT(kind_ == LocalSlot); return data.local.slot; } uint32_t argSlot() const { - JS_ASSERT(kind_ == ArgSlot); + MOZ_ASSERT(kind_ == ArgSlot); return data.arg.slot; } @@ -210,11 +210,11 @@ class FrameInfo val->setStack(); } - JS_ASSERT(spIndex == newDepth); + MOZ_ASSERT(spIndex == newDepth); } } inline StackValue *peek(int32_t index) const { - JS_ASSERT(index < 0); + MOZ_ASSERT(index < 0); return const_cast(&stack[spIndex + index]); } @@ -247,7 +247,7 @@ class FrameInfo sv->setRegister(val, knownType); } inline void pushLocal(uint32_t local) { - JS_ASSERT(local < nlocals()); + MOZ_ASSERT(local < nlocals()); StackValue *sv = rawPush(); sv->setLocalSlot(local); } @@ -265,11 +265,11 @@ class FrameInfo sv->setStack(); } inline Address addressOfLocal(size_t local) const { - JS_ASSERT(local < nlocals()); + MOZ_ASSERT(local < nlocals()); return Address(BaselineFrameReg, BaselineFrame::reverseOffsetOfLocal(local)); } Address addressOfArg(size_t arg) const { - JS_ASSERT(arg < nargs()); + MOZ_ASSERT(arg < nargs()); return Address(BaselineFrameReg, BaselineFrame::offsetOfArg(arg)); } Address addressOfThis() const { @@ -291,9 +291,9 @@ class FrameInfo return Address(BaselineFrameReg, BaselineFrame::reverseOffsetOfReturnValue()); } Address addressOfStackValue(const StackValue *value) const { - JS_ASSERT(value->kind() == StackValue::Stack); + MOZ_ASSERT(value->kind() == StackValue::Stack); size_t slot = value - &stack[0]; - JS_ASSERT(slot < stackDepth()); + MOZ_ASSERT(slot < stackDepth()); return Address(BaselineFrameReg, BaselineFrame::reverseOffsetOfLocal(nlocals() + slot)); } Address addressOfScratchValue() const { diff --git a/js/src/jit/BaselineIC.cpp b/js/src/jit/BaselineIC.cpp index b362cb23eb24..1d0566f8e70c 100644 --- a/js/src/jit/BaselineIC.cpp +++ b/js/src/jit/BaselineIC.cpp @@ -106,7 +106,7 @@ ICEntry::fallbackStub() const ICStubConstIterator & ICStubConstIterator::operator++() { - JS_ASSERT(currentStub_ != nullptr); + MOZ_ASSERT(currentStub_ != nullptr); currentStub_ = currentStub_->next(); return *this; } @@ -123,7 +123,7 @@ ICStubIterator::ICStubIterator(ICFallbackStub *fallbackStub, bool end) ICStubIterator & ICStubIterator::operator++() { - JS_ASSERT(currentStub_->next() != nullptr); + MOZ_ASSERT(currentStub_->next() != nullptr); if (!unlinked_) previousStub_ = currentStub_; currentStub_ = currentStub_->next(); @@ -134,9 +134,9 @@ ICStubIterator::operator++() void ICStubIterator::unlink(JSContext *cx) { - JS_ASSERT(currentStub_->next() != nullptr); - JS_ASSERT(currentStub_ != fallbackStub_); - JS_ASSERT(!unlinked_); + MOZ_ASSERT(currentStub_->next() != nullptr); + MOZ_ASSERT(currentStub_ != fallbackStub_); + MOZ_ASSERT(!unlinked_); fallbackStub_->unlinkStub(cx->zone(), previousStub_, currentStub_); @@ -468,11 +468,11 @@ ICStub::trace(JSTracer *trc) void ICFallbackStub::unlinkStub(Zone *zone, ICStub *prev, ICStub *stub) { - JS_ASSERT(stub->next()); + MOZ_ASSERT(stub->next()); // If stub is the last optimized stub, update lastStubPtrAddr. if (stub->next() == this) { - JS_ASSERT(lastStubPtrAddr_ == stub->addressOfNext()); + MOZ_ASSERT(lastStubPtrAddr_ == stub->addressOfNext()); if (prev) lastStubPtrAddr_ = prev->addressOfNext(); else @@ -480,15 +480,15 @@ ICFallbackStub::unlinkStub(Zone *zone, ICStub *prev, ICStub *stub) *lastStubPtrAddr_ = this; } else { if (prev) { - JS_ASSERT(prev->next() == stub); + MOZ_ASSERT(prev->next() == stub); prev->setNext(stub->next()); } else { - JS_ASSERT(icEntry()->firstStub() == stub); + MOZ_ASSERT(icEntry()->firstStub() == stub); icEntry()->setFirstStub(stub->next()); } } - JS_ASSERT(numOptimizedStubs_ > 0); + MOZ_ASSERT(numOptimizedStubs_ > 0); numOptimizedStubs_--; if (zone->needsIncrementalBarrier()) { @@ -570,7 +570,7 @@ ICMonitoredStub::ICMonitoredStub(Kind kind, JitCode *stubCode, ICStub *firstMoni bool ICMonitoredFallbackStub::initMonitoringChain(JSContext *cx, ICStubSpace *space) { - JS_ASSERT(fallbackMonitorStub_ == nullptr); + MOZ_ASSERT(fallbackMonitorStub_ == nullptr); ICTypeMonitor_Fallback::Compiler compiler(cx, this); ICTypeMonitor_Fallback *stub = compiler.getStub(space); @@ -589,7 +589,7 @@ ICMonitoredFallbackStub::addMonitorStubForValue(JSContext *cx, JSScript *script, bool ICUpdatedStub::initUpdatingChain(JSContext *cx, ICStubSpace *space) { - JS_ASSERT(firstUpdateStub_ == nullptr); + MOZ_ASSERT(firstUpdateStub_ == nullptr); ICTypeUpdate_Fallback::Compiler compiler(cx); ICTypeUpdate_Fallback *stub = compiler.getStub(space); @@ -638,7 +638,7 @@ ICStubCompiler::getStubCode() if (!comp->putStubCode(stubKey, newStubCode)) return nullptr; - JS_ASSERT(entersStubFrame_ == ICStub::CanMakeCalls(kind)); + MOZ_ASSERT(entersStubFrame_ == ICStub::CanMakeCalls(kind)); #ifdef JS_ION_PERF writePerfSpewerJitCodeProfile(newStubCode, "BaselineIC"); @@ -693,7 +693,7 @@ ICStubCompiler::enterStubFrame(MacroAssembler &masm, Register scratch) void ICStubCompiler::leaveStubFrame(MacroAssembler &masm, bool calledIntoIon) { - JS_ASSERT(entersStubFrame_); + MOZ_ASSERT(entersStubFrame_); EmitLeaveStubFrame(masm, calledIntoIon); } @@ -701,27 +701,27 @@ void ICStubCompiler::guardProfilingEnabled(MacroAssembler &masm, Register scratch, Label *skip) { // This should only be called from the following stubs. - JS_ASSERT(kind == ICStub::Call_Scripted || - kind == ICStub::Call_AnyScripted || - kind == ICStub::Call_Native || - kind == ICStub::Call_ScriptedApplyArray || - kind == ICStub::Call_ScriptedApplyArguments || - kind == ICStub::Call_ScriptedFunCall || - kind == ICStub::GetProp_CallScripted || - kind == ICStub::GetProp_CallNative || - kind == ICStub::GetProp_CallNativePrototype || - kind == ICStub::GetProp_CallDOMProxyNative || - kind == ICStub::GetElem_NativePrototypeCallNative || - kind == ICStub::GetElem_NativePrototypeCallScripted || - kind == ICStub::GetProp_CallDOMProxyWithGenerationNative || - kind == ICStub::GetProp_DOMProxyShadowed || - kind == ICStub::SetProp_CallScripted || - kind == ICStub::SetProp_CallNative); + MOZ_ASSERT(kind == ICStub::Call_Scripted || + kind == ICStub::Call_AnyScripted || + kind == ICStub::Call_Native || + kind == ICStub::Call_ScriptedApplyArray || + kind == ICStub::Call_ScriptedApplyArguments || + kind == ICStub::Call_ScriptedFunCall || + kind == ICStub::GetProp_CallScripted || + kind == ICStub::GetProp_CallNative || + kind == ICStub::GetProp_CallNativePrototype || + kind == ICStub::GetProp_CallDOMProxyNative || + kind == ICStub::GetElem_NativePrototypeCallNative || + kind == ICStub::GetElem_NativePrototypeCallScripted || + kind == ICStub::GetProp_CallDOMProxyWithGenerationNative || + kind == ICStub::GetProp_DOMProxyShadowed || + kind == ICStub::SetProp_CallScripted || + kind == ICStub::SetProp_CallNative); // Guard on bit in frame that indicates if the SPS frame was pushed in the first // place. This code is expected to be called from within a stub that has already // entered a stub frame. - JS_ASSERT(entersStubFrame_); + MOZ_ASSERT(entersStubFrame_); masm.loadPtr(Address(BaselineFrameReg, 0), scratch); masm.branchTest32(Assembler::Zero, Address(scratch, BaselineFrame::reverseOffsetOfFlags()), @@ -791,14 +791,14 @@ static bool EnsureCanEnterIon(JSContext *cx, ICWarmUpCounter_Fallback *stub, BaselineFrame *frame, HandleScript script, jsbytecode *pc, void **jitcodePtr) { - JS_ASSERT(jitcodePtr); - JS_ASSERT(!*jitcodePtr); + MOZ_ASSERT(jitcodePtr); + MOZ_ASSERT(!*jitcodePtr); bool isLoopEntry = (JSOp(*pc) == JSOP_LOOPENTRY); MethodStatus stat; if (isLoopEntry) { - JS_ASSERT(LoopEntryCanIonOsr(pc)); + MOZ_ASSERT(LoopEntryCanIonOsr(pc)); JitSpew(JitSpew_BaselineOSR, " Compile at loop entry!"); stat = CanEnterAtBranch(cx, script, frame, pc); } else if (frame->isFunctionFrame()) { @@ -838,8 +838,8 @@ EnsureCanEnterIon(JSContext *cx, ICWarmUpCounter_Fallback *stub, BaselineFrame * if (isLoopEntry) { IonScript *ion = script->ionScript(); - JS_ASSERT(cx->runtime()->spsProfiler.enabled() == ion->hasSPSInstrumentation()); - JS_ASSERT(ion->osrPc() == pc); + MOZ_ASSERT(cx->runtime()->spsProfiler.enabled() == ion->hasSPSInstrumentation()); + MOZ_ASSERT(ion->osrPc() == pc); // If the baseline frame's SPS handling doesn't match up with the Ion code's SPS // handling, don't OSR. @@ -931,7 +931,7 @@ static bool DoWarmUpCounterFallback(JSContext *cx, ICWarmUpCounter_Fallback *stub, BaselineFrame *frame, IonOsrTempData **infoPtr) { - JS_ASSERT(infoPtr); + MOZ_ASSERT(infoPtr); *infoPtr = nullptr; // A TI OOM will disable TI and Ion. @@ -942,7 +942,7 @@ DoWarmUpCounterFallback(JSContext *cx, ICWarmUpCounter_Fallback *stub, BaselineF jsbytecode *pc = stub->icEntry()->pc(script); bool isLoopEntry = JSOp(*pc) == JSOP_LOOPENTRY; - JS_ASSERT(!isLoopEntry || LoopEntryCanIonOsr(pc)); + MOZ_ASSERT(!isLoopEntry || LoopEntryCanIonOsr(pc)); FallbackICSpew(cx, stub, "WarmUpCounter(%d)", isLoopEntry ? int(script->pcToOffset(pc)) : int(-1)); @@ -954,7 +954,7 @@ DoWarmUpCounterFallback(JSContext *cx, ICWarmUpCounter_Fallback *stub, BaselineF return true; } - JS_ASSERT(!script->isIonCompilingOffThread()); + MOZ_ASSERT(!script->isIonCompilingOffThread()); // If Ion script exists, but PC is not at a loop entry, then Ion will be entered for // this script at an appropriate LOOPENTRY or the next time this function is called. @@ -1080,7 +1080,7 @@ DoProfilerFallback(JSContext *cx, BaselineFrame *frame, ICProfiler_Fallback *stu SPSProfiler *profiler = &cx->runtime()->spsProfiler; // Manually enter SPS this time. - JS_ASSERT(profiler->enabled()); + MOZ_ASSERT(profiler->enabled()); if (!cx->runtime()->spsProfiler.enter(script, func)) return false; frame->setPushedSPSFrame(); @@ -1091,7 +1091,7 @@ DoProfilerFallback(JSContext *cx, BaselineFrame *frame, ICProfiler_Fallback *stu icEntry->firstStub()->isProfiler_PushFunction() && icEntry->firstStub()->next() == stub); stub->unlinkStubsWithKind(cx, ICStub::Profiler_PushFunction); - JS_ASSERT(icEntry->firstStub() == stub); + MOZ_ASSERT(icEntry->firstStub() == stub); // Generate the string to use to identify this stack frame. const char *string = profiler->profileString(script, func); @@ -1175,7 +1175,7 @@ ICTypeMonitor_Fallback::addMonitorStubForValue(JSContext *cx, JSScript *script, } if (val.isPrimitive()) { - JS_ASSERT(!val.isMagic()); + MOZ_ASSERT(!val.isMagic()); JSValueType type = val.isDouble() ? JSVAL_TYPE_DOUBLE : val.extractNonDoubleType(); // Check for existing TypeMonitor stub. @@ -1200,7 +1200,7 @@ ICTypeMonitor_Fallback::addMonitorStubForValue(JSContext *cx, JSScript *script, existingStub ? "Modified existing" : "Created new", stub, type); if (!existingStub) { - JS_ASSERT(!hasStub(TypeMonitor_PrimitiveSet)); + MOZ_ASSERT(!hasStub(TypeMonitor_PrimitiveSet)); addOptimizedMonitorStub(stub); } @@ -1269,7 +1269,7 @@ ICTypeMonitor_Fallback::addMonitorStubForValue(JSContext *cx, JSScript *script, // Since we just added the first optimized monitoring stub, any // existing main stub's |firstMonitorStub| MUST be pointing to the fallback // monitor stub (i.e. this stub). - JS_ASSERT(iter->toMonitoredStub()->firstMonitorStub() == this); + MOZ_ASSERT(iter->toMonitoredStub()->firstMonitorStub() == this); iter->toMonitoredStub()->updateFirstMonitorStub(firstMonitorStub_); } } @@ -1295,10 +1295,10 @@ DoTypeMonitorFallback(JSContext *cx, BaselineFrame *frame, ICTypeMonitor_Fallbac uint32_t argument; if (stub->monitorsThis()) { - JS_ASSERT(pc == script->code()); + MOZ_ASSERT(pc == script->code()); types::TypeScript::SetThis(cx, script, value); } else if (stub->monitorsArgument(&argument)) { - JS_ASSERT(pc == script->code()); + MOZ_ASSERT(pc == script->code()); types::TypeScript::SetArgument(cx, script, argument, value); } else { types::TypeScript::Monitor(cx, script, pc, value); @@ -1320,7 +1320,7 @@ static const VMFunction DoTypeMonitorFallbackInfo = bool ICTypeMonitor_Fallback::Compiler::generateStubCode(MacroAssembler &masm) { - JS_ASSERT(R0 == JSReturnOperand); + MOZ_ASSERT(R0 == JSReturnOperand); // Restore the tail call register. EmitRestoreTailCallReg(masm); @@ -1363,7 +1363,7 @@ ICTypeMonitor_PrimitiveSet::Compiler::generateStubCode(MacroAssembler &masm) if (flags_ & TypeToFlag(JSVAL_TYPE_OBJECT)) masm.branchTestObject(Assembler::Equal, R0, &success); */ - JS_ASSERT(!(flags_ & TypeToFlag(JSVAL_TYPE_OBJECT))); + MOZ_ASSERT(!(flags_ & TypeToFlag(JSVAL_TYPE_OBJECT))); if (flags_ & TypeToFlag(JSVAL_TYPE_NULL)) masm.branchTestNull(Assembler::Equal, R0, &success); @@ -1449,7 +1449,7 @@ ICUpdatedStub::addUpdateStubForValue(JSContext *cx, HandleScript script, HandleO if (!stub) return false; if (!existingStub) { - JS_ASSERT(!hasTypeUpdateStub(TypeUpdate_PrimitiveSet)); + MOZ_ASSERT(!hasTypeUpdateStub(TypeUpdate_PrimitiveSet)); addOptimizedUpdateStub(stub); } @@ -1520,14 +1520,14 @@ DoTypeUpdateFallback(JSContext *cx, BaselineFrame *frame, ICUpdatedStub *stub, H switch(stub->kind()) { case ICStub::SetElem_Dense: case ICStub::SetElem_DenseAdd: { - JS_ASSERT(obj->isNative()); + MOZ_ASSERT(obj->isNative()); id = JSID_VOID; types::AddTypePropertyId(cx, obj, id, value); break; } case ICStub::SetProp_Native: case ICStub::SetProp_NativeAdd: { - JS_ASSERT(obj->isNative()); + MOZ_ASSERT(obj->isNative()); jsbytecode *pc = stub->getChainFallback()->icEntry()->pc(script); if (*pc == JSOP_SETALIASEDVAR || *pc == JSOP_INITALIASEDLEXICAL) id = NameToId(ScopeCoordinateName(cx->runtime()->scopeCoordinateNameCache, script, pc)); @@ -1588,7 +1588,7 @@ ICTypeUpdate_PrimitiveSet::Compiler::generateStubCode(MacroAssembler &masm) if (flags_ & TypeToFlag(JSVAL_TYPE_OBJECT)) masm.branchTestObject(Assembler::Equal, R0, &success); */ - JS_ASSERT(!(flags_ & TypeToFlag(JSVAL_TYPE_OBJECT))); + MOZ_ASSERT(!(flags_ & TypeToFlag(JSVAL_TYPE_OBJECT))); if (flags_ & TypeToFlag(JSVAL_TYPE_NULL)) masm.branchTestNull(Assembler::Equal, R0, &success); @@ -1653,7 +1653,7 @@ static bool DoCallNativeGetter(JSContext *cx, HandleFunction callee, HandleObject obj, MutableHandleValue result) { - JS_ASSERT(callee->isNative()); + MOZ_ASSERT(callee->isNative()); JSNative natfun = callee->native(); JS::AutoValueArray<2> vp(cx); @@ -1694,7 +1694,7 @@ static const VMFunction DoThisFallbackInfo = FunctionInfo(DoTh bool ICThis_Fallback::Compiler::generateStubCode(MacroAssembler &masm) { - JS_ASSERT(R0 == JSReturnOperand); + MOZ_ASSERT(R0 == JSReturnOperand); // Restore the tail call register. EmitRestoreTailCallReg(masm); @@ -1831,7 +1831,7 @@ DoCompareFallback(JSContext *cx, BaselineFrame *frame, ICCompare_Fallback *stub_ return false; break; default: - JS_ASSERT(!"Unhandled baseline compare op"); + MOZ_ASSERT(!"Unhandled baseline compare op"); return false; } @@ -1932,7 +1932,7 @@ DoCompareFallback(JSContext *cx, BaselineFrame *frame, ICCompare_Fallback *stub_ } if (lhs.isObject() && rhs.isObject()) { - JS_ASSERT(!stub->hasStub(ICStub::Compare_Object)); + MOZ_ASSERT(!stub->hasStub(ICStub::Compare_Object)); JitSpew(JitSpew_BaselineIC, " Generating %s(Object, Object) stub", js_CodeName[op]); ICCompare_Object::Compiler compiler(cx, op); ICStub *objectStub = compiler.getStub(compiler.getStubSpace(script)); @@ -1975,7 +1975,7 @@ static const VMFunction DoCompareFallbackInfo = bool ICCompare_Fallback::Compiler::generateStubCode(MacroAssembler &masm) { - JS_ASSERT(R0 == JSReturnOperand); + MOZ_ASSERT(R0 == JSReturnOperand); // Restore the tail call register. EmitRestoreTailCallReg(masm); @@ -2003,7 +2003,7 @@ ICCompare_String::Compiler::generateStubCode(MacroAssembler &masm) masm.branchTestString(Assembler::NotEqual, R0, &failure); masm.branchTestString(Assembler::NotEqual, R1, &failure); - JS_ASSERT(IsEqualityOp(op)); + MOZ_ASSERT(IsEqualityOp(op)); Register left = masm.extractString(R0, ExtractTemp0); Register right = masm.extractString(R1, ExtractTemp1); @@ -2091,7 +2091,7 @@ ICCompare_Object::Compiler::generateStubCode(MacroAssembler &masm) masm.branchTestObject(Assembler::NotEqual, R0, &failure); masm.branchTestObject(Assembler::NotEqual, R1, &failure); - JS_ASSERT(IsEqualityOp(op)); + MOZ_ASSERT(IsEqualityOp(op)); Register left = masm.extractObject(R0, ExtractTemp0); Register right = masm.extractObject(R1, ExtractTemp1); @@ -2119,7 +2119,7 @@ ICCompare_Object::Compiler::generateStubCode(MacroAssembler &masm) bool ICCompare_ObjectWithUndefined::Compiler::generateStubCode(MacroAssembler &masm) { - JS_ASSERT(IsEqualityOp(op)); + MOZ_ASSERT(IsEqualityOp(op)); ValueOperand objectOperand, undefinedOperand; if (lhsIsUndefined) { @@ -2241,7 +2241,7 @@ DoToBoolFallback(JSContext *cx, BaselineFrame *frame, ICToBool_Fallback *stub, H return true; } - JS_ASSERT(!arg.isBoolean()); + MOZ_ASSERT(!arg.isBoolean()); JSScript *script = frame->script(); @@ -2310,7 +2310,7 @@ static const VMFunction fun = FunctionInfo(DoToBoolFallback); bool ICToBool_Fallback::Compiler::generateStubCode(MacroAssembler &masm) { - JS_ASSERT(R0 == JSReturnOperand); + MOZ_ASSERT(R0 == JSReturnOperand); // Restore the tail call register. EmitRestoreTailCallReg(masm); @@ -2477,7 +2477,7 @@ static const VMFunction DoToNumberFallbackInfo = bool ICToNumber_Fallback::Compiler::generateStubCode(MacroAssembler &masm) { - JS_ASSERT(R0 == JSReturnOperand); + MOZ_ASSERT(R0 == JSReturnOperand); // Restore the tail call register. EmitRestoreTailCallReg(masm); @@ -2599,7 +2599,7 @@ DoBinaryArithFallback(JSContext *cx, BaselineFrame *frame, ICBinaryArith_Fallbac if (op == JSOP_ADD) { if (lhs.isString() && rhs.isString()) { JitSpew(JitSpew_BaselineIC, " Generating %s(String, String) stub", js_CodeName[op]); - JS_ASSERT(ret.isString()); + MOZ_ASSERT(ret.isString()); ICBinaryArith_StringConcat::Compiler compiler(cx); ICStub *strcatStub = compiler.getStub(compiler.getStubSpace(script)); if (!strcatStub) @@ -2612,7 +2612,7 @@ DoBinaryArithFallback(JSContext *cx, BaselineFrame *frame, ICBinaryArith_Fallbac JitSpew(JitSpew_BaselineIC, " Generating %s(%s, %s) stub", js_CodeName[op], lhs.isString() ? "String" : "Object", lhs.isString() ? "Object" : "String"); - JS_ASSERT(ret.isString()); + MOZ_ASSERT(ret.isString()); ICBinaryArith_StringObjectConcat::Compiler compiler(cx, lhs.isString()); ICStub *strcatStub = compiler.getStub(compiler.getStubSpace(script)); if (!strcatStub) @@ -2643,7 +2643,7 @@ DoBinaryArithFallback(JSContext *cx, BaselineFrame *frame, ICBinaryArith_Fallbac return true; } - JS_ASSERT(ret.isNumber()); + MOZ_ASSERT(ret.isNumber()); if (lhs.isDouble() || rhs.isDouble() || ret.isDouble()) { if (!cx->runtime()->jitSupportsFloatingPoint) @@ -2720,7 +2720,7 @@ static const VMFunction DoBinaryArithFallbackInfo = bool ICBinaryArith_Fallback::Compiler::generateStubCode(MacroAssembler &masm) { - JS_ASSERT(R0 == JSReturnOperand); + MOZ_ASSERT(R0 == JSReturnOperand); // Restore the tail call register. EmitRestoreTailCallReg(masm); @@ -2741,8 +2741,8 @@ ICBinaryArith_Fallback::Compiler::generateStubCode(MacroAssembler &masm) static bool DoConcatStrings(JSContext *cx, HandleValue lhs, HandleValue rhs, MutableHandleValue res) { - JS_ASSERT(lhs.isString()); - JS_ASSERT(rhs.isString()); + MOZ_ASSERT(lhs.isString()); + MOZ_ASSERT(rhs.isString()); JSString *lstr = lhs.toString(); JSString *rstr = rhs.toString(); JSString *result = ConcatStrings(cx, lstr, rstr); @@ -2787,7 +2787,7 @@ ICBinaryArith_StringConcat::Compiler::generateStubCode(MacroAssembler &masm) static JSString * ConvertObjectToStringForConcat(JSContext *cx, HandleValue obj) { - JS_ASSERT(obj.isObject()); + MOZ_ASSERT(obj.isObject()); RootedValue rootedObj(cx, obj); if (!ToPrimitive(cx, &rootedObj)) return nullptr; @@ -2802,7 +2802,7 @@ DoConcatStringObject(JSContext *cx, bool lhsIsString, HandleValue lhs, HandleVal JSString *rstr = nullptr; if (lhsIsString) { // Convert rhs first. - JS_ASSERT(lhs.isString() && rhs.isObject()); + MOZ_ASSERT(lhs.isString() && rhs.isObject()); rstr = ConvertObjectToStringForConcat(cx, rhs); if (!rstr) return false; @@ -2810,7 +2810,7 @@ DoConcatStringObject(JSContext *cx, bool lhsIsString, HandleValue lhs, HandleVal // lhs is already string. lstr = lhs.toString(); } else { - JS_ASSERT(rhs.isString() && lhs.isObject()); + MOZ_ASSERT(rhs.isString() && lhs.isObject()); // Convert lhs first. lstr = ConvertObjectToStringForConcat(cx, lhs); if (!lstr) @@ -2897,7 +2897,7 @@ ICBinaryArith_Double::Compiler::generateStubCode(MacroAssembler &masm) masm.passABIArg(FloatReg0, MoveOp::DOUBLE); masm.passABIArg(FloatReg1, MoveOp::DOUBLE); masm.callWithABI(JS_FUNC_TO_DATA_PTR(void *, NumberMod), MoveOp::DOUBLE); - JS_ASSERT(ReturnDoubleReg == FloatReg0); + MOZ_ASSERT(ReturnDoubleReg == FloatReg0); break; default: MOZ_CRASH("Unexpected op"); @@ -2931,8 +2931,8 @@ ICBinaryArith_BooleanWithInt32::Compiler::generateStubCode(MacroAssembler &masm) Register rhsReg = rhsIsBool_ ? masm.extractBoolean(R1, ExtractTemp1) : masm.extractInt32(R1, ExtractTemp1); - JS_ASSERT(op_ == JSOP_ADD || op_ == JSOP_SUB || - op_ == JSOP_BITOR || op_ == JSOP_BITXOR || op_ == JSOP_BITAND); + MOZ_ASSERT(op_ == JSOP_ADD || op_ == JSOP_SUB || + op_ == JSOP_BITOR || op_ == JSOP_BITXOR || op_ == JSOP_BITAND); switch(op_) { case JSOP_ADD: { @@ -2990,7 +2990,7 @@ ICBinaryArith_BooleanWithInt32::Compiler::generateStubCode(MacroAssembler &masm) bool ICBinaryArith_DoubleWithInt32::Compiler::generateStubCode(MacroAssembler &masm) { - JS_ASSERT(op == JSOP_BITOR || op == JSOP_BITAND || op == JSOP_BITXOR); + MOZ_ASSERT(op == JSOP_BITOR || op == JSOP_BITAND || op == JSOP_BITXOR); Label failure; Register intReg; @@ -3130,7 +3130,7 @@ static const VMFunction DoUnaryArithFallbackInfo = bool ICUnaryArith_Fallback::Compiler::generateStubCode(MacroAssembler &masm) { - JS_ASSERT(R0 == JSReturnOperand); + MOZ_ASSERT(R0 == JSReturnOperand); // Restore the tail call register. EmitRestoreTailCallReg(masm); @@ -3152,7 +3152,7 @@ ICUnaryArith_Double::Compiler::generateStubCode(MacroAssembler &masm) Label failure; masm.ensureDouble(R0, FloatReg0, &failure); - JS_ASSERT(op == JSOP_NEG || op == JSOP_BITNOT); + MOZ_ASSERT(op == JSOP_NEG || op == JSOP_BITNOT); if (op == JSOP_NEG) { masm.negateDouble(FloatReg0); @@ -3192,8 +3192,8 @@ ICUnaryArith_Double::Compiler::generateStubCode(MacroAssembler &masm) static void GetFixedOrDynamicSlotOffset(HandleObject obj, uint32_t slot, bool *isFixed, uint32_t *offset) { - JS_ASSERT(isFixed); - JS_ASSERT(offset); + MOZ_ASSERT(isFixed); + MOZ_ASSERT(offset); *isFixed = obj->isFixedSlot(slot); *offset = *isFixed ? JSObject::getFixedSlotOffset(slot) : obj->dynamicSlotIndex(slot) * sizeof(Value); @@ -3202,7 +3202,7 @@ static void GetFixedOrDynamicSlotOffset(HandleObject obj, uint32_t slot, static JSObject * GetDOMProxyProto(JSObject *obj) { - JS_ASSERT(IsCacheableDOMProxy(obj)); + MOZ_ASSERT(IsCacheableDOMProxy(obj)); return obj->getTaggedProto().toObjectOrNull(); } @@ -3240,7 +3240,7 @@ GenerateDOMProxyChecks(JSContext *cx, MacroAssembler &masm, Register object, Label domProxyOk; if (expandoAndGenerationAddr) { - JS_ASSERT(generationAddr); + MOZ_ASSERT(generationAddr); masm.loadPtr(*expandoAndGenerationAddr, tempVal.scratchReg()); masm.branchPrivatePtr(Assembler::NotEqual, expandoAddr, tempVal.scratchReg(), @@ -3303,8 +3303,8 @@ EffectlesslyLookupProperty(JSContext *cx, HandleObject obj, HandlePropertyName n // Check for list base if asked to. RootedObject checkObj(cx, obj); if (checkDOMProxy && IsCacheableDOMProxy(obj)) { - JS_ASSERT(domProxyHasGeneration); - JS_ASSERT(shadowsResult); + MOZ_ASSERT(domProxyHasGeneration); + MOZ_ASSERT(shadowsResult); *checkDOMProxy = true; if (obj->hasUncacheableProto()) @@ -3418,7 +3418,7 @@ static bool IsCacheableGetPropCall(JSContext *cx, JSObject *obj, JSObject *holder, Shape *shape, bool *isScripted, bool isDOMProxy=false) { - JS_ASSERT(isScripted); + MOZ_ASSERT(isScripted); if (!shape || !IsCacheableProtoChain(obj, holder, isDOMProxy)) return false; @@ -3533,7 +3533,7 @@ IsCacheableSetPropAddSlot(JSContext *cx, HandleObject obj, HandleShape oldShape, static bool IsCacheableSetPropCall(JSContext *cx, JSObject *obj, JSObject *holder, Shape *shape, bool *isScripted) { - JS_ASSERT(isScripted); + MOZ_ASSERT(isScripted); // Currently we only optimize setter calls for setters bound on prototypes. if (obj == holder) @@ -3629,8 +3629,8 @@ GetElemNativeStubExists(ICGetElem_Fallback *stub, HandleObject obj, HandleObject if (holder->lastProperty() != protoStub->holderShape()) continue; } else { - JS_ASSERT(iter->isGetElem_NativePrototypeCallNative() || - iter->isGetElem_NativePrototypeCallScripted()); + MOZ_ASSERT(iter->isGetElem_NativePrototypeCallNative() || + iter->isGetElem_NativePrototypeCallScripted()); ICGetElemNativePrototypeCallStub *protoStub = reinterpret_cast(*iter); @@ -3690,8 +3690,8 @@ RemoveExistingGetElemNativeStubs(JSContext *cx, ICGetElem_Fallback *stub, Handle continue; } } else { - JS_ASSERT(iter->isGetElem_NativePrototypeCallNative() || - iter->isGetElem_NativePrototypeCallScripted()); + MOZ_ASSERT(iter->isGetElem_NativePrototypeCallNative() || + iter->isGetElem_NativePrototypeCallScripted()); ICGetElemNativePrototypeCallStub *protoStub = reinterpret_cast(*iter); @@ -3901,7 +3901,7 @@ TryAttachGetElemStub(JSContext *cx, JSScript *script, jsbytecode *pc, ICGetElem_ { // Any script with a CALLPROP on arguments (arguments.foo()) // should not have optimized arguments. - JS_ASSERT(!isCallElem); + MOZ_ASSERT(!isCallElem); JitSpew(JitSpew_BaselineIC, " Generating GetElem(MagicArgs[Int32]) stub"); ICGetElem_Arguments::Compiler compiler(cx, stub->fallbackMonitorStub()->firstMonitorStub(), @@ -4015,7 +4015,7 @@ DoGetElemFallback(JSContext *cx, BaselineFrame *frame, ICGetElem_Fallback *stub_ JSOp op = JSOp(*pc); FallbackICSpew(cx, stub, "GetElem(%s)", js_CodeName[op]); - JS_ASSERT(op == JSOP_GETELEM || op == JSOP_CALLELEM); + MOZ_ASSERT(op == JSOP_GETELEM || op == JSOP_CALLELEM); // Don't pass lhs directly, we need it when generating stubs. RootedValue lhsCopy(cx, lhs); @@ -4064,7 +4064,7 @@ static const VMFunction DoGetElemFallbackInfo = bool ICGetElem_Fallback::Compiler::generateStubCode(MacroAssembler &masm) { - JS_ASSERT(R0 == JSReturnOperand); + MOZ_ASSERT(R0 == JSReturnOperand); // Restore the tail call register. EmitRestoreTailCallReg(masm); @@ -4185,7 +4185,7 @@ ICGetElemNativeCompiler::emitCallScripted(MacroAssembler &masm, Register objReg) masm.branch32(Assembler::Equal, scratch, Imm32(0), &noUnderflow); { // Call the arguments rectifier. - JS_ASSERT(ArgumentsRectifierReg != code); + MOZ_ASSERT(ArgumentsRectifierReg != code); JitCode *argumentsRectifier = cx->runtime()->jitRuntime()->getArgumentsRectifier(SequentialExecution); @@ -4262,7 +4262,7 @@ ICGetElemNativeCompiler::generateStubCode(MacroAssembler &masm) // Atomized string is now in JSReturnOperand (R0). // Leave stub frame, move atomized string into R1. - JS_ASSERT(R0 == JSReturnOperand); + MOZ_ASSERT(R0 == JSReturnOperand); leaveStubFrame(masm); masm.moveValue(JSReturnOperand, R1); @@ -4271,7 +4271,7 @@ ICGetElemNativeCompiler::generateStubCode(MacroAssembler &masm) // Extract string from R1 again. DebugOnly strExtract2 = masm.extractString(R1, ExtractTemp1); - JS_ASSERT(Register(strExtract2) == strExtract); + MOZ_ASSERT(Register(strExtract2) == strExtract); masm.bind(&skipAtomize); } @@ -4386,10 +4386,10 @@ ICGetElemNativeCompiler::generateStubCode(MacroAssembler &masm) #endif } else { - JS_ASSERT(acctype_ == ICGetElemNativeStub::NativeGetter || - acctype_ == ICGetElemNativeStub::ScriptedGetter); - JS_ASSERT(kind == ICStub::GetElem_NativePrototypeCallNative || - kind == ICStub::GetElem_NativePrototypeCallScripted); + MOZ_ASSERT(acctype_ == ICGetElemNativeStub::NativeGetter || + acctype_ == ICGetElemNativeStub::ScriptedGetter); + MOZ_ASSERT(kind == ICStub::GetElem_NativePrototypeCallNative || + kind == ICStub::GetElem_NativePrototypeCallScripted); if (acctype_ == ICGetElemNativeStub::NativeGetter) { // If calling a native getter, there is no chance of failure now. @@ -4401,7 +4401,7 @@ ICGetElemNativeCompiler::generateStubCode(MacroAssembler &masm) emitCallNative(masm, objReg); } else { - JS_ASSERT(acctype_ == ICGetElemNativeStub::ScriptedGetter); + MOZ_ASSERT(acctype_ == ICGetElemNativeStub::ScriptedGetter); // Load function in scratchReg and ensure that it has a jit script. masm.loadPtr(Address(BaselineStubReg, ICGetElemNativeGetterStub::offsetOfGetter()), @@ -4656,7 +4656,7 @@ ICGetElem_Arguments::Compiler::generateStubCode(MacroAssembler &masm) Label failure; if (which_ == ICGetElem_Arguments::Magic) { - JS_ASSERT(!isCallElem_); + MOZ_ASSERT(!isCallElem_); // Ensure that this is a magic arguments value. masm.branchTestMagicValue(Assembler::NotEqual, R0, JS_OPTIMIZED_ARGUMENTS, &failure); @@ -4696,8 +4696,8 @@ ICGetElem_Arguments::Compiler::generateStubCode(MacroAssembler &masm) return true; } - JS_ASSERT(which_ == ICGetElem_Arguments::Strict || - which_ == ICGetElem_Arguments::Normal); + MOZ_ASSERT(which_ == ICGetElem_Arguments::Strict || + which_ == ICGetElem_Arguments::Normal); bool isStrict = which_ == ICGetElem_Arguments::Strict; const Class *clasp = isStrict ? &StrictArgumentsObject::class_ : &NormalArgumentsObject::class_; @@ -4747,7 +4747,7 @@ ICGetElem_Arguments::Compiler::generateStubCode(MacroAssembler &masm) // In tempReg, calculate index of word containing bit: (idx >> logBitsPerWord) masm.movePtr(idxReg, tempReg); const uint32_t shift = mozilla::tl::FloorLog2<(sizeof(size_t) * JS_BITS_PER_BYTE)>::value; - JS_ASSERT(shift == 5 || shift == 6); + MOZ_ASSERT(shift == 5 || shift == 6); masm.rshiftPtr(Imm32(shift), tempReg); masm.loadPtr(BaseIndex(scratchReg, tempReg, ScaleFromElemWidth(sizeof(size_t))), scratchReg); @@ -4851,7 +4851,7 @@ SetElemDenseAddHasSameShapes(ICSetElem_DenseAdd *stub, JSObject *obj) static bool DenseSetElemStubExists(JSContext *cx, ICStub::Kind kind, ICSetElem_Fallback *stub, HandleObject obj) { - JS_ASSERT(kind == ICStub::SetElem_Dense || kind == ICStub::SetElem_DenseAdd); + MOZ_ASSERT(kind == ICStub::SetElem_Dense || kind == ICStub::SetElem_DenseAdd); for (ICStubConstIterator iter = stub->beginChainConst(); !iter.atEnd(); iter++) { if (kind == ICStub::SetElem_Dense && iter->isSetElem_Dense()) { @@ -4894,7 +4894,7 @@ RemoveExistingTypedArraySetElemStub(JSContext *cx, ICSetElem_Fallback *stub, Han // TypedArraySetElem stubs are only removed using this procedure if // being replaced with one that expects out of bounds index. - JS_ASSERT(!iter->toSetElem_TypedArray()->expectOutOfBounds()); + MOZ_ASSERT(!iter->toSetElem_TypedArray()->expectOutOfBounds()); iter.unlink(cx); return true; } @@ -4985,10 +4985,10 @@ DoSetElemFallback(JSContext *cx, BaselineFrame *frame, ICSetElem_Fallback *stub_ JSOp op = JSOp(*pc); FallbackICSpew(cx, stub, "SetElem(%s)", js_CodeName[JSOp(*pc)]); - JS_ASSERT(op == JSOP_SETELEM || - op == JSOP_INITELEM || - op == JSOP_INITELEM_ARRAY || - op == JSOP_INITELEM_INC); + MOZ_ASSERT(op == JSOP_SETELEM || + op == JSOP_INITELEM || + op == JSOP_INITELEM_ARRAY || + op == JSOP_INITELEM_INC); RootedObject obj(cx, ToObjectFromStack(cx, objv)); if (!obj) @@ -5008,7 +5008,7 @@ DoSetElemFallback(JSContext *cx, BaselineFrame *frame, ICSetElem_Fallback *stub_ if (!InitElemOperation(cx, obj, index, rhs)) return false; } else if (op == JSOP_INITELEM_ARRAY) { - JS_ASSERT(uint32_t(index.toInt32()) == GET_UINT24(pc)); + MOZ_ASSERT(uint32_t(index.toInt32()) == GET_UINT24(pc)); if (!InitArrayElemOperation(cx, pc, obj, index.toInt32(), rhs)) return false; } else if (op == JSOP_INITELEM_INC) { @@ -5020,7 +5020,7 @@ DoSetElemFallback(JSContext *cx, BaselineFrame *frame, ICSetElem_Fallback *stub_ } // Overwrite the object on the stack (pushed for the decompiler) with the rhs. - JS_ASSERT(stack[2] == objv); + MOZ_ASSERT(stack[2] == objv); stack[2] = rhs; // Check if debug mode toggling made the stub invalid. @@ -5128,7 +5128,7 @@ static const VMFunction DoSetElemFallbackInfo = bool ICSetElem_Fallback::Compiler::generateStubCode(MacroAssembler &masm) { - JS_ASSERT(R0 == JSReturnOperand); + MOZ_ASSERT(R0 == JSReturnOperand); EmitRestoreTailCallReg(masm); @@ -5303,14 +5303,14 @@ ICSetElem_Dense::Compiler::generateStubCode(MacroAssembler &masm) static bool GetProtoShapes(JSObject *obj, size_t protoChainDepth, AutoShapeVector *shapes) { - JS_ASSERT(shapes->length() == 1); + MOZ_ASSERT(shapes->length() == 1); JSObject *curProto = obj->getProto(); for (size_t i = 0; i < protoChainDepth; i++) { if (!shapes->append(curProto->lastProperty())) return false; curProto = curProto->getProto(); } - JS_ASSERT(!curProto); + MOZ_ASSERT(!curProto); return true; } @@ -5672,7 +5672,7 @@ TryAttachGlobalNameStub(JSContext *cx, HandleScript script, jsbytecode *pc, ICGetName_Fallback *stub, HandleObject global, HandlePropertyName name) { - JS_ASSERT(global->is()); + MOZ_ASSERT(global->is()); RootedId id(cx, NameToId(name)); @@ -5687,7 +5687,7 @@ TryAttachGlobalNameStub(JSContext *cx, HandleScript script, jsbytecode *pc, if (shape->hasDefaultGetter() && shape->hasSlot()) { - JS_ASSERT(shape->slot() >= global->numFixedSlots()); + MOZ_ASSERT(shape->slot() >= global->numFixedSlots()); uint32_t slot = shape->slot() - global->numFixedSlots(); // TODO: if there's a previous stub discard it, or just update its Shape + slot? @@ -5832,7 +5832,7 @@ DoGetNameFallback(JSContext *cx, BaselineFrame *frame, ICGetName_Fallback *stub_ mozilla::DebugOnly op = JSOp(*pc); FallbackICSpew(cx, stub, "GetName(%s)", js_CodeName[JSOp(*pc)]); - JS_ASSERT(op == JSOP_NAME || op == JSOP_GETGNAME); + MOZ_ASSERT(op == JSOP_NAME || op == JSOP_GETGNAME); RootedPropertyName name(cx, script->getName(pc)); @@ -5878,7 +5878,7 @@ static const VMFunction DoGetNameFallbackInfo = FunctionInfo op = JSOp(*pc); FallbackICSpew(cx, stub, "BindName(%s)", js_CodeName[JSOp(*pc)]); - JS_ASSERT(op == JSOP_BINDNAME); + MOZ_ASSERT(op == JSOP_BINDNAME); RootedPropertyName name(cx, frame->script()->getName(pc)); @@ -5989,7 +5989,7 @@ static const VMFunction DoBindNameFallbackInfo = bool ICBindName_Fallback::Compiler::generateStubCode(MacroAssembler &masm) { - JS_ASSERT(R0 == JSReturnOperand); + MOZ_ASSERT(R0 == JSReturnOperand); EmitRestoreTailCallReg(masm); @@ -6016,7 +6016,7 @@ DoGetIntrinsicFallback(JSContext *cx, BaselineFrame *frame, ICGetIntrinsic_Fallb mozilla::DebugOnly op = JSOp(*pc); FallbackICSpew(cx, stub, "GetIntrinsic(%s)", js_CodeName[JSOp(*pc)]); - JS_ASSERT(op == JSOP_GETINTRINSIC); + MOZ_ASSERT(op == JSOP_GETINTRINSIC); if (!GetIntrinsicOperation(cx, pc, res)) return false; @@ -6118,10 +6118,10 @@ static bool TryAttachLengthStub(JSContext *cx, JSScript *script, ICGetProp_Fallback *stub, HandleValue val, HandleValue res, bool *attached) { - JS_ASSERT(!*attached); + MOZ_ASSERT(!*attached); if (val.isString()) { - JS_ASSERT(res.isInt32()); + MOZ_ASSERT(res.isInt32()); JitSpew(JitSpew_BaselineIC, " Generating GetProp(String.length) stub"); ICGetProp_StringLength::Compiler compiler(cx); ICStub *newStub = compiler.getStub(compiler.getStubSpace(script)); @@ -6186,7 +6186,7 @@ UpdateExistingGenerationalDOMProxyStub(ICGetProp_Fallback *stub, HandleObject obj) { Value expandoSlot = obj->getFixedSlot(GetDOMProxyExpandoSlot()); - JS_ASSERT(!expandoSlot.isObject() && !expandoSlot.isUndefined()); + MOZ_ASSERT(!expandoSlot.isObject() && !expandoSlot.isUndefined()); ExpandoAndGeneration *expandoAndGeneration = (ExpandoAndGeneration*)expandoSlot.toPrivate(); for (ICStubConstIterator iter = stub->beginChainConst(); !iter.atEnd(); iter++) { if (iter->isGetProp_CallDOMProxyWithGenerationNative()) { @@ -6245,7 +6245,7 @@ TryAttachNativeGetPropStub(JSContext *cx, HandleScript script, jsbytecode *pc, ICGetProp_Fallback *stub, HandlePropertyName name, HandleValue val, HandleValue res, bool *attached) { - JS_ASSERT(!*attached); + MOZ_ASSERT(!*attached); if (!val.isObject()) return true; @@ -6318,8 +6318,8 @@ TryAttachNativeGetPropStub(JSContext *cx, HandleScript script, jsbytecode *pc, return true; RootedFunction callee(cx, &shape->getterObject()->as()); - JS_ASSERT(obj != holder); - JS_ASSERT(callee->hasScript()); + MOZ_ASSERT(obj != holder); + MOZ_ASSERT(callee->hasScript()); JitSpew(JitSpew_BaselineIC, " Generating GetProp(NativeObj/ScriptedGetter %s:%d) stub", callee->nonLazyScript()->filename(), callee->nonLazyScript()->lineno()); @@ -6346,7 +6346,7 @@ TryAttachNativeGetPropStub(JSContext *cx, HandleScript script, jsbytecode *pc, #endif RootedFunction callee(cx, &shape->getterObject()->as()); - JS_ASSERT(callee->isNative()); + MOZ_ASSERT(callee->isNative()); JitSpew(JitSpew_BaselineIC, " Generating GetProp(%s%s/NativeGetter %p) stub", isDOMProxy ? "DOMProxyObj" : "NativeObj", @@ -6355,7 +6355,7 @@ TryAttachNativeGetPropStub(JSContext *cx, HandleScript script, jsbytecode *pc, ICStub *newStub = nullptr; if (isDOMProxy) { - JS_ASSERT(obj != holder); + MOZ_ASSERT(obj != holder); ICStub::Kind kind; if (domProxyHasGeneration) { if (UpdateExistingGenerationalDOMProxyStub(stub, obj)) { @@ -6388,7 +6388,7 @@ TryAttachNativeGetPropStub(JSContext *cx, HandleScript script, jsbytecode *pc, // If it's a shadowed listbase proxy property, attach stub to call Proxy::get instead. if (isDOMProxy && domProxyShadowsResult == Shadows) { - JS_ASSERT(obj == holder); + MOZ_ASSERT(obj == holder); #if JS_HAS_NO_SUCH_METHOD if (isCallProp) return true; @@ -6414,7 +6414,7 @@ TryAttachPrimitiveGetPropStub(JSContext *cx, HandleScript script, jsbytecode *pc ICGetProp_Fallback *stub, HandlePropertyName name, HandleValue val, HandleValue res, bool *attached) { - JS_ASSERT(!*attached); + MOZ_ASSERT(!*attached); JSValueType primitiveType; RootedObject proto(cx); @@ -6429,7 +6429,7 @@ TryAttachPrimitiveGetPropStub(JSContext *cx, HandleScript script, jsbytecode *pc primitiveType = JSVAL_TYPE_DOUBLE; proto = GlobalObject::getOrCreateNumberPrototype(cx, global); } else { - JS_ASSERT(val.isBoolean()); + MOZ_ASSERT(val.isBoolean()); primitiveType = JSVAL_TYPE_BOOLEAN; proto = GlobalObject::getOrCreateBooleanPrototype(cx, global); } @@ -6553,10 +6553,10 @@ DoGetPropFallback(JSContext *cx, BaselineFrame *frame, ICGetProp_Fallback *stub_ JSOp op = JSOp(*pc); FallbackICSpew(cx, stub, "GetProp(%s)", js_CodeName[op]); - JS_ASSERT(op == JSOP_GETPROP || op == JSOP_CALLPROP || op == JSOP_LENGTH || op == JSOP_GETXPROP); + MOZ_ASSERT(op == JSOP_GETPROP || op == JSOP_CALLPROP || op == JSOP_LENGTH || op == JSOP_GETXPROP); // After the Genericstub was added, we should never reach the Fallbackstub again. - JS_ASSERT(!stub->hasStub(ICStub::GetProp_Generic)); + MOZ_ASSERT(!stub->hasStub(ICStub::GetProp_Generic)); RootedPropertyName name(cx, frame->script()->getName(pc)); if (!ComputeGetPropResult(cx, frame, op, name, val, res)) @@ -6620,7 +6620,7 @@ DoGetPropFallback(JSContext *cx, BaselineFrame *frame, ICGetProp_Fallback *stub_ return true; } - JS_ASSERT(!attached); + MOZ_ASSERT(!attached); stub->noteUnoptimizableAccess(); return true; @@ -6634,7 +6634,7 @@ static const VMFunction DoGetPropFallbackInfo = bool ICGetProp_Fallback::Compiler::generateStubCode(MacroAssembler &masm) { - JS_ASSERT(R0 == JSReturnOperand); + MOZ_ASSERT(R0 == JSReturnOperand); EmitRestoreTailCallReg(masm); @@ -7013,7 +7013,7 @@ ICGetProp_CallScripted::Compiler::generateStubCode(MacroAssembler &masm) masm.branch32(Assembler::Equal, scratch, Imm32(0), &noUnderflow); { // Call the arguments rectifier. - JS_ASSERT(ArgumentsRectifierReg != code); + MOZ_ASSERT(ArgumentsRectifierReg != code); JitCode *argumentsRectifier = cx->runtime()->jitRuntime()->getArgumentsRectifier(SequentialExecution); @@ -7249,8 +7249,8 @@ ICGetPropCallDOMProxyNativeCompiler::getStub(ICStubSpace *space) if (kind == ICStub::GetProp_CallDOMProxyNative) { expandoVal = expandoSlot; } else { - JS_ASSERT(kind == ICStub::GetProp_CallDOMProxyWithGenerationNative); - JS_ASSERT(!expandoSlot.isObject() && !expandoSlot.isUndefined()); + MOZ_ASSERT(kind == ICStub::GetProp_CallDOMProxyWithGenerationNative); + MOZ_ASSERT(!expandoSlot.isObject() && !expandoSlot.isUndefined()); expandoAndGeneration = (ExpandoAndGeneration*)expandoSlot.toPrivate(); expandoVal = expandoAndGeneration->expando; generation = expandoAndGeneration->generation; @@ -7380,8 +7380,8 @@ ICGetProp_ArgumentsLength::Compiler::generateStubCode(MacroAssembler &masm) EmitStubGuardFailure(masm); return true; } - JS_ASSERT(which_ == ICGetProp_ArgumentsLength::Strict || - which_ == ICGetProp_ArgumentsLength::Normal); + MOZ_ASSERT(which_ == ICGetProp_ArgumentsLength::Strict || + which_ == ICGetProp_ArgumentsLength::Normal); bool isStrict = which_ == ICGetProp_ArgumentsLength::Strict; const Class *clasp = isStrict ? &StrictArgumentsObject::class_ : &NormalArgumentsObject::class_; @@ -7501,7 +7501,7 @@ TryAttachSetPropStub(JSContext *cx, HandleScript script, jsbytecode *pc, ICSetPr HandleObject obj, HandleShape oldShape, HandleTypeObject oldType, uint32_t oldSlots, HandlePropertyName name, HandleId id, HandleValue rhs, bool *attached) { - JS_ASSERT(!*attached); + MOZ_ASSERT(!*attached); if (!obj->isNative() || obj->watched()) return true; @@ -7583,8 +7583,8 @@ TryAttachSetPropStub(JSContext *cx, HandleScript script, jsbytecode *pc, ICSetPr // Try handling scripted setters. if (cacheableCall && isScripted) { RootedFunction callee(cx, &shape->setterObject()->as()); - JS_ASSERT(obj != holder); - JS_ASSERT(callee->hasScript()); + MOZ_ASSERT(obj != holder); + MOZ_ASSERT(callee->hasScript()); JitSpew(JitSpew_BaselineIC, " Generating SetProp(NativeObj/ScriptedSetter %s:%d) stub", callee->nonLazyScript()->filename(), callee->nonLazyScript()->lineno()); @@ -7602,8 +7602,8 @@ TryAttachSetPropStub(JSContext *cx, HandleScript script, jsbytecode *pc, ICSetPr // Try handling JSNative setters. if (cacheableCall && !isScripted) { RootedFunction callee(cx, &shape->setterObject()->as()); - JS_ASSERT(obj != holder); - JS_ASSERT(callee->isNative()); + MOZ_ASSERT(obj != holder); + MOZ_ASSERT(callee->isNative()); JitSpew(JitSpew_BaselineIC, " Generating SetProp(NativeObj/NativeSetter %p) stub", callee->native()); @@ -7633,12 +7633,12 @@ DoSetPropFallback(JSContext *cx, BaselineFrame *frame, ICSetProp_Fallback *stub_ JSOp op = JSOp(*pc); FallbackICSpew(cx, stub, "SetProp(%s)", js_CodeName[op]); - JS_ASSERT(op == JSOP_SETPROP || - op == JSOP_SETNAME || - op == JSOP_SETGNAME || - op == JSOP_INITPROP || - op == JSOP_SETALIASEDVAR || - op == JSOP_INITALIASEDLEXICAL); + MOZ_ASSERT(op == JSOP_SETPROP || + op == JSOP_SETNAME || + op == JSOP_SETGNAME || + op == JSOP_INITPROP || + op == JSOP_SETALIASEDVAR || + op == JSOP_INITALIASEDLEXICAL); RootedPropertyName name(cx); if (op == JSOP_SETALIASEDVAR || op == JSOP_INITALIASEDLEXICAL) @@ -7697,7 +7697,7 @@ DoSetPropFallback(JSContext *cx, BaselineFrame *frame, ICSetProp_Fallback *stub_ if (attached) return true; - JS_ASSERT(!attached); + MOZ_ASSERT(!attached); stub->noteUnoptimizableAccess(); return true; @@ -7711,7 +7711,7 @@ static const VMFunction DoSetPropFallbackInfo = bool ICSetProp_Fallback::Compiler::generateStubCode(MacroAssembler &masm) { - JS_ASSERT(R0 == JSReturnOperand); + MOZ_ASSERT(R0 == JSReturnOperand); EmitRestoreTailCallReg(masm); @@ -8040,7 +8040,7 @@ ICSetProp_CallScripted::Compiler::generateStubCode(MacroAssembler &masm) masm.branch32(Assembler::BelowOrEqual, scratch, Imm32(1), &noUnderflow); { // Call the arguments rectifier. - JS_ASSERT(ArgumentsRectifierReg != code); + MOZ_ASSERT(ArgumentsRectifierReg != code); JitCode *argumentsRectifier = cx->runtime()->jitRuntime()->getArgumentsRectifier(SequentialExecution); @@ -8087,7 +8087,7 @@ ICSetProp_CallScripted::Compiler::generateStubCode(MacroAssembler &masm) static bool DoCallNativeSetter(JSContext *cx, HandleFunction callee, HandleObject obj, HandleValue val) { - JS_ASSERT(callee->isNative()); + MOZ_ASSERT(callee->isNative()); JSNative natfun = callee->native(); JS::AutoValueArray<3> vp(cx); @@ -8470,7 +8470,7 @@ TryAttachCallStub(JSContext *cx, ICCall_Fallback *stub, HandleScript script, jsb if (fun->isNative() && (!constructing || (constructing && fun->isNativeConstructor()))) { // Generalized native call stubs are not here yet! - JS_ASSERT(!stub->nativeStubsAreGeneralized()); + MOZ_ASSERT(!stub->nativeStubsAreGeneralized()); // Check for JSOP_FUNAPPLY if (op == JSOP_FUNAPPLY) { @@ -8522,9 +8522,9 @@ TryAttachCallStub(JSContext *cx, ICCall_Fallback *stub, HandleScript script, jsb static bool CopyArray(JSContext *cx, HandleObject obj, MutableHandleValue result) { - JS_ASSERT(obj->is()); + MOZ_ASSERT(obj->is()); uint32_t length = obj->as().length(); - JS_ASSERT(obj->getDenseInitializedLength() == length); + MOZ_ASSERT(obj->getDenseInitializedLength() == length); RootedTypeObject type(cx, obj->getType(cx)); if (!type) @@ -8554,9 +8554,9 @@ TryAttachStringSplit(JSContext *cx, ICCall_Fallback *stub, HandleScript script, if (!IsOptimizableCallStringSplit(callee, thisv, argc, args)) return true; - JS_ASSERT(res.toObject().is()); - JS_ASSERT(callee.isObject()); - JS_ASSERT(callee.toObject().is()); + MOZ_ASSERT(res.toObject().is()); + MOZ_ASSERT(callee.isObject()); + MOZ_ASSERT(callee.toObject().is()); RootedString thisString(cx, thisv.toString()); RootedString argString(cx, args[0].toString()); @@ -8612,7 +8612,7 @@ DoCallFallback(JSContext *cx, BaselineFrame *frame, ICCall_Fallback *stub_, uint JSOp op = JSOp(*pc); FallbackICSpew(cx, stub, "Call(%s)", js_CodeName[op]); - JS_ASSERT(argc == GET_ARGC(pc)); + MOZ_ASSERT(argc == GET_ARGC(pc)); RootedValue callee(cx, vp[0]); RootedValue thisv(cx, vp[1]); @@ -8649,7 +8649,7 @@ DoCallFallback(JSContext *cx, BaselineFrame *frame, ICCall_Fallback *stub_, uint return false; res.set(vp[0]); } else { - JS_ASSERT(op == JSOP_CALL || op == JSOP_FUNCALL || op == JSOP_FUNAPPLY || op == JSOP_EVAL); + MOZ_ASSERT(op == JSOP_CALL || op == JSOP_FUNCALL || op == JSOP_FUNAPPLY || op == JSOP_EVAL); if (!Invoke(cx, thisv, callee, argc, args, res)) return false; } @@ -8732,7 +8732,7 @@ DoSpreadCallFallback(JSContext *cx, BaselineFrame *frame, ICCall_Fallback *stub_ void ICCallStubCompiler::pushCallArguments(MacroAssembler &masm, GeneralRegisterSet regs, Register argcReg) { - JS_ASSERT(!regs.has(argcReg)); + MOZ_ASSERT(!regs.has(argcReg)); // Push the callee and |this| too. Register count = regs.takeAny(); @@ -8829,7 +8829,7 @@ ICCallStubCompiler::guardFunApply(MacroAssembler &masm, GeneralRegisterSet regs, Imm32(BaselineFrame::HAS_ARGS_OBJ), failure); } else { - JS_ASSERT(applyThing == FunApply_Array); + MOZ_ASSERT(applyThing == FunApply_Array); GeneralRegisterSet regsx = regs; @@ -8986,7 +8986,7 @@ static const VMFunction DoSpreadCallFallbackInfo = bool ICCall_Fallback::Compiler::generateStubCode(MacroAssembler &masm) { - JS_ASSERT(R0 == JSReturnOperand); + MOZ_ASSERT(R0 == JSReturnOperand); // Push a stub frame so that we can perform a non-tail call. enterStubFrame(masm, R1.scratchReg()); @@ -9058,7 +9058,7 @@ ICCall_Fallback::Compiler::generateStubCode(MacroAssembler &masm) // If this is a |constructing| call, if the callee returns a non-object, we replace it with // the |this| object passed in. - JS_ASSERT(JSReturnOperand == R0); + MOZ_ASSERT(JSReturnOperand == R0); Label skipThisReplace; masm.load16ZeroExtend(Address(BaselineStubReg, ICStub::offsetOfExtra()), scratch); masm.branchTest32(Assembler::Zero, scratch, Imm32(ICCall_Fallback::CONSTRUCTING_FLAG), @@ -9105,7 +9105,7 @@ ICCallScriptedCompiler::generateStubCode(MacroAssembler &masm) bool canUseTailCallReg = regs.has(BaselineTailCallReg); Register argcReg = R0.scratchReg(); - JS_ASSERT(argcReg != ArgumentsRectifierReg); + MOZ_ASSERT(argcReg != ArgumentsRectifierReg); regs.take(argcReg); regs.take(ArgumentsRectifierReg); @@ -9136,7 +9136,7 @@ ICCallScriptedCompiler::generateStubCode(MacroAssembler &masm) // If calling a specific script, check if the script matches. Otherwise, ensure that // callee function is scripted. Leave calleeScript in |callee| reg. if (calleeScript_) { - JS_ASSERT(kind == ICStub::Call_Scripted); + MOZ_ASSERT(kind == ICStub::Call_Scripted); // Callee is a function. Check if script matches. masm.loadPtr(Address(callee, JSFunction::offsetOfNativeOrScript()), callee); @@ -9197,7 +9197,7 @@ ICCallScriptedCompiler::generateStubCode(MacroAssembler &masm) #endif // Reset the register set from here on in. - JS_ASSERT(JSReturnOperand == R0); + MOZ_ASSERT(JSReturnOperand == R0); regs = availableGeneralRegs(0); regs.take(R0); regs.take(ArgumentsRectifierReg); @@ -9279,8 +9279,8 @@ ICCallScriptedCompiler::generateStubCode(MacroAssembler &masm) masm.branch32(Assembler::AboveOrEqual, argcReg, callee, &noUnderflow); { // Call the arguments rectifier. - JS_ASSERT(ArgumentsRectifierReg != code); - JS_ASSERT(ArgumentsRectifierReg != argcReg); + MOZ_ASSERT(ArgumentsRectifierReg != code); + MOZ_ASSERT(ArgumentsRectifierReg != argcReg); JitCode *argumentsRectifier = cx->runtime()->jitRuntime()->getArgumentsRectifier(SequentialExecution); @@ -9294,7 +9294,7 @@ ICCallScriptedCompiler::generateStubCode(MacroAssembler &masm) // If needed, update SPS Profiler frame entry before and after call. { - JS_ASSERT(kind == ICStub::Call_Scripted || kind == ICStub::Call_AnyScripted); + MOZ_ASSERT(kind == ICStub::Call_Scripted || kind == ICStub::Call_AnyScripted); GeneralRegisterSet availRegs = availableGeneralRegs(0); availRegs.take(ArgumentsRectifierReg); availRegs.take(code); @@ -9634,8 +9634,8 @@ ICCall_ScriptedApplyArray::Compiler::generateStubCode(MacroAssembler &masm) masm.branch32(Assembler::AboveOrEqual, argcReg, scratch, &noUnderflow); { // Call the arguments rectifier. - JS_ASSERT(ArgumentsRectifierReg != target); - JS_ASSERT(ArgumentsRectifierReg != argcReg); + MOZ_ASSERT(ArgumentsRectifierReg != target); + MOZ_ASSERT(ArgumentsRectifierReg != argcReg); JitCode *argumentsRectifier = cx->runtime()->jitRuntime()->getArgumentsRectifier(SequentialExecution); @@ -9735,8 +9735,8 @@ ICCall_ScriptedApplyArguments::Compiler::generateStubCode(MacroAssembler &masm) masm.branch32(Assembler::AboveOrEqual, argcReg, scratch, &noUnderflow); { // Call the arguments rectifier. - JS_ASSERT(ArgumentsRectifierReg != target); - JS_ASSERT(ArgumentsRectifierReg != argcReg); + MOZ_ASSERT(ArgumentsRectifierReg != target); + MOZ_ASSERT(ArgumentsRectifierReg != argcReg); JitCode *argumentsRectifier = cx->runtime()->jitRuntime()->getArgumentsRectifier(SequentialExecution); @@ -9773,7 +9773,7 @@ ICCall_ScriptedFunCall::Compiler::generateStubCode(MacroAssembler &masm) bool canUseTailCallReg = regs.has(BaselineTailCallReg); Register argcReg = R0.scratchReg(); - JS_ASSERT(argcReg != ArgumentsRectifierReg); + MOZ_ASSERT(argcReg != ArgumentsRectifierReg); regs.take(argcReg); regs.take(ArgumentsRectifierReg); @@ -9857,8 +9857,8 @@ ICCall_ScriptedFunCall::Compiler::generateStubCode(MacroAssembler &masm) masm.branch32(Assembler::AboveOrEqual, argcReg, callee, &noUnderflow); { // Call the arguments rectifier. - JS_ASSERT(ArgumentsRectifierReg != code); - JS_ASSERT(ArgumentsRectifierReg != argcReg); + MOZ_ASSERT(ArgumentsRectifierReg != code); + MOZ_ASSERT(ArgumentsRectifierReg != argcReg); JitCode *argumentsRectifier = cx->runtime()->jitRuntime()->getArgumentsRectifier(SequentialExecution); @@ -10236,7 +10236,7 @@ DoTypeOfFallback(JSContext *cx, BaselineFrame *frame, ICTypeOf_Fallback *stub, H res.setString(string); - JS_ASSERT(type != JSTYPE_NULL); + MOZ_ASSERT(type != JSTYPE_NULL); if (type != JSTYPE_OBJECT && type != JSTYPE_FUNCTION) { // Create a new TypeOf stub. JitSpew(JitSpew_BaselineIC, " Generating TypeOf stub for JSType (%d)", (int) type); @@ -10270,9 +10270,9 @@ ICTypeOf_Fallback::Compiler::generateStubCode(MacroAssembler &masm) bool ICTypeOf_Typed::Compiler::generateStubCode(MacroAssembler &masm) { - JS_ASSERT(type_ != JSTYPE_NULL); - JS_ASSERT(type_ != JSTYPE_FUNCTION); - JS_ASSERT(type_ != JSTYPE_OBJECT); + MOZ_ASSERT(type_ != JSTYPE_NULL); + MOZ_ASSERT(type_ != JSTYPE_FUNCTION); + MOZ_ASSERT(type_ != JSTYPE_OBJECT); Label failure; switch(type_) { @@ -10317,8 +10317,8 @@ DoRetSubFallback(JSContext *cx, BaselineFrame *frame, ICRetSub_Fallback *stub, // |val| is the bytecode offset where we should resume. - JS_ASSERT(val.isInt32()); - JS_ASSERT(val.toInt32() >= 0); + MOZ_ASSERT(val.isInt32()); + MOZ_ASSERT(val.toInt32() >= 0); JSScript *script = frame->script(); uint32_t offset = uint32_t(val.toInt32()); @@ -10463,9 +10463,9 @@ ICGetElemNativeGetterStub::ICGetElemNativeGetterStub( getter_(getter), pcOffset_(pcOffset) { - JS_ASSERT(kind == GetElem_NativePrototypeCallNative || - kind == GetElem_NativePrototypeCallScripted); - JS_ASSERT(acctype == NativeGetter || acctype == ScriptedGetter); + MOZ_ASSERT(kind == GetElem_NativePrototypeCallNative || + kind == GetElem_NativePrototypeCallScripted); + MOZ_ASSERT(acctype == NativeGetter || acctype == ScriptedGetter); } ICGetElem_NativePrototypeSlot::ICGetElem_NativePrototypeSlot( @@ -10536,7 +10536,7 @@ ICGetElem_TypedArray::ICGetElem_TypedArray(JitCode *stubCode, HandleShape shape, shape_(shape) { extra_ = uint16_t(type); - JS_ASSERT(extra_ == type); + MOZ_ASSERT(extra_ == type); } /* static */ ICGetElem_Arguments * @@ -10557,7 +10557,7 @@ ICSetElem_DenseAdd::ICSetElem_DenseAdd(JitCode *stubCode, types::TypeObject *typ : ICUpdatedStub(SetElem_DenseAdd, stubCode), type_(type) { - JS_ASSERT(protoChainDepth <= MAX_PROTO_CHAIN_DEPTH); + MOZ_ASSERT(protoChainDepth <= MAX_PROTO_CHAIN_DEPTH); extra_ = protoChainDepth; } @@ -10578,7 +10578,7 @@ ICSetElem_TypedArray::ICSetElem_TypedArray(JitCode *stubCode, HandleShape shape, shape_(shape) { extra_ = uint8_t(type); - JS_ASSERT(extra_ == type); + MOZ_ASSERT(extra_ == type); extra_ |= (static_cast(expectOutOfBounds) << 8); } @@ -10596,7 +10596,7 @@ ICGetName_Scope::ICGetName_Scope(JitCode *stubCode, ICStub *firstMonito offset_(offset) { JS_STATIC_ASSERT(NumHops <= MAX_HOPS); - JS_ASSERT(shapes->length() == NumHops + 1); + MOZ_ASSERT(shapes->length() == NumHops + 1); for (size_t i = 0; i < NumHops + 1; i++) shapes_[i].init((*shapes)[i]); } @@ -10697,9 +10697,9 @@ ICGetPropCallGetter::ICGetPropCallGetter(Kind kind, JitCode *stubCode, ICStub *f getter_(getter), pcOffset_(pcOffset) { - JS_ASSERT(kind == ICStub::GetProp_CallScripted || - kind == ICStub::GetProp_CallNative || - kind == ICStub::GetProp_CallNativePrototype); + MOZ_ASSERT(kind == ICStub::GetProp_CallScripted || + kind == ICStub::GetProp_CallNative || + kind == ICStub::GetProp_CallNativePrototype); } ICGetPropCallPrototypeGetter::ICGetPropCallPrototypeGetter(Kind kind, JitCode *stubCode, @@ -10710,7 +10710,7 @@ ICGetPropCallPrototypeGetter::ICGetPropCallPrototypeGetter(Kind kind, JitCode *s : ICGetPropCallGetter(kind, stubCode, firstMonitorStub, holder, holderShape, getter, pcOffset), receiverShape_(receiverShape) { - JS_ASSERT(kind == ICStub::GetProp_CallScripted || kind == ICStub::GetProp_CallNativePrototype); + MOZ_ASSERT(kind == ICStub::GetProp_CallScripted || kind == ICStub::GetProp_CallNativePrototype); } /* static */ ICGetProp_CallScripted * @@ -10781,7 +10781,7 @@ ICSetProp_NativeAdd::ICSetProp_NativeAdd(JitCode *stubCode, HandleTypeObject typ newType_(newType), offset_(offset) { - JS_ASSERT(protoChainDepth <= MAX_PROTO_CHAIN_DEPTH); + MOZ_ASSERT(protoChainDepth <= MAX_PROTO_CHAIN_DEPTH); extra_ = protoChainDepth; } @@ -10794,7 +10794,7 @@ ICSetProp_NativeAddImpl::ICSetProp_NativeAddImpl(JitCode *stubC uint32_t offset) : ICSetProp_NativeAdd(stubCode, type, ProtoChainDepth, newShape, newType, offset) { - JS_ASSERT(shapes->length() == NumShapes); + MOZ_ASSERT(shapes->length() == NumShapes); for (size_t i = 0; i < NumShapes; i++) shapes_[i].init((*shapes)[i]); } @@ -10813,7 +10813,7 @@ ICSetPropNativeAddCompiler::ICSetPropNativeAddCompiler(JSContext *cx, HandleObje isFixedSlot_(isFixedSlot), offset_(offset) { - JS_ASSERT(protoChainDepth_ <= ICSetProp_NativeAdd::MAX_PROTO_CHAIN_DEPTH); + MOZ_ASSERT(protoChainDepth_ <= ICSetProp_NativeAdd::MAX_PROTO_CHAIN_DEPTH); } ICSetPropCallSetter::ICSetPropCallSetter(Kind kind, JitCode *stubCode, HandleShape shape, @@ -10826,7 +10826,7 @@ ICSetPropCallSetter::ICSetPropCallSetter(Kind kind, JitCode *stubCode, HandleSha setter_(setter), pcOffset_(pcOffset) { - JS_ASSERT(kind == ICStub::SetProp_CallScripted || kind == ICStub::SetProp_CallNative); + MOZ_ASSERT(kind == ICStub::SetProp_CallScripted || kind == ICStub::SetProp_CallNative); } /* static */ ICSetProp_CallScripted * @@ -10959,9 +10959,9 @@ ICGetPropCallDOMProxyNativeCompiler::ICGetPropCallDOMProxyNativeCompiler(JSConte getter_(cx, getter), pcOffset_(pcOffset) { - JS_ASSERT(kind == ICStub::GetProp_CallDOMProxyNative || - kind == ICStub::GetProp_CallDOMProxyWithGenerationNative); - JS_ASSERT(proxy_->handler()->family() == GetDOMProxyHandlerFamily()); + MOZ_ASSERT(kind == ICStub::GetProp_CallDOMProxyNative || + kind == ICStub::GetProp_CallDOMProxyWithGenerationNative); + MOZ_ASSERT(proxy_->handler()->family() == GetDOMProxyHandlerFamily()); } /* static */ ICGetProp_CallDOMProxyNative * diff --git a/js/src/jit/BaselineIC.h b/js/src/jit/BaselineIC.h index 0c168187a44d..184753db6d20 100644 --- a/js/src/jit/BaselineIC.h +++ b/js/src/jit/BaselineIC.h @@ -258,14 +258,14 @@ class ICEntry } void setReturnOffset(CodeOffsetLabel offset) { - JS_ASSERT(offset.offset() <= (size_t) UINT32_MAX); + MOZ_ASSERT(offset.offset() <= (size_t) UINT32_MAX); returnOffset_ = (uint32_t) offset.offset(); } void fixupReturnOffset(MacroAssembler &masm) { CodeOffsetLabel offset = returnOffset(); offset.fixup(&masm); - JS_ASSERT(offset.offset() <= UINT32_MAX); + MOZ_ASSERT(offset.offset() <= UINT32_MAX); returnOffset_ = (uint32_t) offset.offset(); } @@ -298,7 +298,7 @@ class ICEntry return firstStub_ != nullptr; } ICStub *firstStub() const { - JS_ASSERT(hasStub()); + MOZ_ASSERT(hasStub()); return firstStub_; } @@ -500,12 +500,12 @@ class ICStubConstIterator } ICStub *operator *() const { - JS_ASSERT(currentStub_); + MOZ_ASSERT(currentStub_); return currentStub_; } ICStub *operator ->() const { - JS_ASSERT(currentStub_); + MOZ_ASSERT(currentStub_); return currentStub_; } @@ -541,8 +541,8 @@ class ICStubIterator bool operator ==(const ICStubIterator &other) const { // == should only ever be called on stubs from the same chain. - JS_ASSERT(icEntry_ == other.icEntry_); - JS_ASSERT(fallbackStub_ == other.fallbackStub_); + MOZ_ASSERT(icEntry_ == other.icEntry_); + MOZ_ASSERT(fallbackStub_ == other.fallbackStub_); return currentStub_ == other.currentStub_; } bool operator !=(const ICStubIterator &other) const { @@ -638,7 +638,7 @@ class ICStub trait_(Regular), kind_(kind) { - JS_ASSERT(stubCode != nullptr); + MOZ_ASSERT(stubCode != nullptr); } inline ICStub(Kind kind, Trait trait, JitCode *stubCode) @@ -648,7 +648,7 @@ class ICStub trait_(trait), kind_(kind) { - JS_ASSERT(stubCode != nullptr); + MOZ_ASSERT(stubCode != nullptr); } inline Trait trait() const { @@ -679,53 +679,53 @@ class ICStub } inline const ICFallbackStub *toFallbackStub() const { - JS_ASSERT(isFallback()); + MOZ_ASSERT(isFallback()); return reinterpret_cast(this); } inline ICFallbackStub *toFallbackStub() { - JS_ASSERT(isFallback()); + MOZ_ASSERT(isFallback()); return reinterpret_cast(this); } inline const ICMonitoredStub *toMonitoredStub() const { - JS_ASSERT(isMonitored()); + MOZ_ASSERT(isMonitored()); return reinterpret_cast(this); } inline ICMonitoredStub *toMonitoredStub() { - JS_ASSERT(isMonitored()); + MOZ_ASSERT(isMonitored()); return reinterpret_cast(this); } inline const ICMonitoredFallbackStub *toMonitoredFallbackStub() const { - JS_ASSERT(isMonitoredFallback()); + MOZ_ASSERT(isMonitoredFallback()); return reinterpret_cast(this); } inline ICMonitoredFallbackStub *toMonitoredFallbackStub() { - JS_ASSERT(isMonitoredFallback()); + MOZ_ASSERT(isMonitoredFallback()); return reinterpret_cast(this); } inline const ICUpdatedStub *toUpdatedStub() const { - JS_ASSERT(isUpdated()); + MOZ_ASSERT(isUpdated()); return reinterpret_cast(this); } inline ICUpdatedStub *toUpdatedStub() { - JS_ASSERT(isUpdated()); + MOZ_ASSERT(isUpdated()); return reinterpret_cast(this); } #define KIND_METHODS(kindName) \ inline bool is##kindName() const { return kind() == kindName; } \ inline const IC##kindName *to##kindName() const { \ - JS_ASSERT(is##kindName()); \ + MOZ_ASSERT(is##kindName()); \ return reinterpret_cast(this); \ } \ inline IC##kindName *to##kindName() { \ - JS_ASSERT(is##kindName()); \ + MOZ_ASSERT(is##kindName()); \ return reinterpret_cast(this); \ } IC_STUB_KIND_LIST(KIND_METHODS) @@ -762,7 +762,7 @@ class ICStub ICStub *lastStub = this; while (lastStub->next_) lastStub = lastStub->next_; - JS_ASSERT(lastStub->isFallback()); + MOZ_ASSERT(lastStub->isFallback()); return lastStub->toFallbackStub(); } @@ -783,7 +783,7 @@ class ICStub } static bool CanMakeCalls(ICStub::Kind kind) { - JS_ASSERT(IsValidKind(kind)); + MOZ_ASSERT(IsValidKind(kind)); switch (kind) { case Call_Fallback: case Call_Scripted: @@ -830,7 +830,7 @@ class ICStub // that these do not get purged, all stubs that can make calls are allocated // in the fallback stub space. bool allocatedInFallbackSpace() const { - JS_ASSERT(next()); + MOZ_ASSERT(next()); return CanMakeCalls(kind()); } }; @@ -867,8 +867,8 @@ class ICFallbackStub : public ICStub numOptimizedStubs_(0), lastStubPtrAddr_(nullptr) { - JS_ASSERT(trait == ICStub::Fallback || - trait == ICStub::MonitoredFallback); + MOZ_ASSERT(trait == ICStub::Fallback || + trait == ICStub::MonitoredFallback); } public: @@ -885,16 +885,16 @@ class ICFallbackStub : public ICStub // address until after compile when the BaselineScript is created. This method // allows these fields to be fixed up at that point. void fixupICEntry(ICEntry *icEntry) { - JS_ASSERT(icEntry_ == nullptr); - JS_ASSERT(lastStubPtrAddr_ == nullptr); + MOZ_ASSERT(icEntry_ == nullptr); + MOZ_ASSERT(lastStubPtrAddr_ == nullptr); icEntry_ = icEntry; lastStubPtrAddr_ = icEntry_->addressOfFirstStub(); } // Add a new stub to the IC chain terminated by this fallback stub. void addNewStub(ICStub *stub) { - JS_ASSERT(*lastStubPtrAddr_ == this); - JS_ASSERT(stub->next() == nullptr); + MOZ_ASSERT(*lastStubPtrAddr_ == this); + MOZ_ASSERT(stub->next() == nullptr); stub->setNext(this); *lastStubPtrAddr_ = stub; lastStubPtrAddr_ = stub->addressOfNext(); @@ -944,11 +944,11 @@ class ICMonitoredStub : public ICStub inline void updateFirstMonitorStub(ICStub *monitorStub) { // This should only be called once: when the first optimized monitor stub // is added to the type monitor IC chain. - JS_ASSERT(firstMonitorStub_ && firstMonitorStub_->isTypeMonitor_Fallback()); + MOZ_ASSERT(firstMonitorStub_ && firstMonitorStub_->isTypeMonitor_Fallback()); firstMonitorStub_ = monitorStub; } inline void resetFirstMonitorStub(ICStub *monitorFallback) { - JS_ASSERT(monitorFallback->isTypeMonitor_Fallback()); + MOZ_ASSERT(monitorFallback->isTypeMonitor_Fallback()); firstMonitorStub_ = monitorFallback; } inline ICStub *firstMonitorStub() const { @@ -1013,10 +1013,10 @@ class ICUpdatedStub : public ICStub firstUpdateStub_ = stub; } else { ICStub *iter = firstUpdateStub_; - JS_ASSERT(iter->next() != nullptr); + MOZ_ASSERT(iter->next() != nullptr); while (!iter->next()->isTypeUpdate_Fallback()) iter = iter->next(); - JS_ASSERT(iter->next()->next() == nullptr); + MOZ_ASSERT(iter->next()->next() == nullptr); stub->setNext(iter->next()); iter->setNext(stub); } @@ -1109,13 +1109,13 @@ class ICStubCompiler inline GeneralRegisterSet availableGeneralRegs(size_t numInputs) const { GeneralRegisterSet regs(GeneralRegisterSet::All()); - JS_ASSERT(!regs.has(BaselineStackReg)); + MOZ_ASSERT(!regs.has(BaselineStackReg)); #if defined(JS_CODEGEN_ARM) - JS_ASSERT(!regs.has(BaselineTailCallReg)); + MOZ_ASSERT(!regs.has(BaselineTailCallReg)); regs.take(BaselineSecondScratchReg); #elif defined(JS_CODEGEN_MIPS) - JS_ASSERT(!regs.has(BaselineTailCallReg)); - JS_ASSERT(!regs.has(BaselineSecondScratchReg)); + MOZ_ASSERT(!regs.has(BaselineTailCallReg)); + MOZ_ASSERT(!regs.has(BaselineSecondScratchReg)); #endif regs.take(BaselineFrameReg); regs.take(BaselineStubReg); @@ -1316,13 +1316,13 @@ class TypeCheckPrimitiveSetStub : public ICStub TypeCheckPrimitiveSetStub(Kind kind, JitCode *stubCode, uint16_t flags) : ICStub(kind, stubCode) { - JS_ASSERT(kind == TypeMonitor_PrimitiveSet || kind == TypeUpdate_PrimitiveSet); - JS_ASSERT(flags && !(flags & ~ValidFlags())); + MOZ_ASSERT(kind == TypeMonitor_PrimitiveSet || kind == TypeUpdate_PrimitiveSet); + MOZ_ASSERT(flags && !(flags & ~ValidFlags())); extra_ = flags; } TypeCheckPrimitiveSetStub *updateTypesAndCode(uint16_t flags, JitCode *code) { - JS_ASSERT(flags && !(flags & ~ValidFlags())); + MOZ_ASSERT(flags && !(flags & ~ValidFlags())); if (!code) return nullptr; extra_ = flags; @@ -1336,8 +1336,8 @@ class TypeCheckPrimitiveSetStub : public ICStub } bool containsType(JSValueType type) const { - JS_ASSERT(type <= JSVAL_TYPE_OBJECT); - JS_ASSERT(type != JSVAL_TYPE_MAGIC); + MOZ_ASSERT(type <= JSVAL_TYPE_OBJECT); + MOZ_ASSERT(type != JSVAL_TYPE_MAGIC); return extra_ & TypeToFlag(type); } @@ -1369,7 +1369,7 @@ class TypeCheckPrimitiveSetStub : public ICStub } TypeCheckPrimitiveSetStub *updateStub() { - JS_ASSERT(existingStub_); + MOZ_ASSERT(existingStub_); return existingStub_->updateTypesAndCode(flags_, getStubCode()); } }; @@ -1434,17 +1434,17 @@ class ICTypeMonitor_Fallback : public ICStub void addOptimizedMonitorStub(ICStub *stub) { stub->setNext(this); - JS_ASSERT((lastMonitorStubPtrAddr_ != nullptr) == - (numOptimizedMonitorStubs_ || !hasFallbackStub_)); + MOZ_ASSERT((lastMonitorStubPtrAddr_ != nullptr) == + (numOptimizedMonitorStubs_ || !hasFallbackStub_)); if (lastMonitorStubPtrAddr_) *lastMonitorStubPtrAddr_ = stub; if (numOptimizedMonitorStubs_ == 0) { - JS_ASSERT(firstMonitorStub_ == this); + MOZ_ASSERT(firstMonitorStub_ == this); firstMonitorStub_ = stub; } else { - JS_ASSERT(firstMonitorStub_ != nullptr); + MOZ_ASSERT(firstMonitorStub_ != nullptr); } lastMonitorStubPtrAddr_ = stub->addressOfNext(); @@ -1474,7 +1474,7 @@ class ICTypeMonitor_Fallback : public ICStub } inline ICFallbackStub *mainFallbackStub() const { - JS_ASSERT(hasFallbackStub_); + MOZ_ASSERT(hasFallbackStub_); return mainFallbackStub_; } @@ -1512,9 +1512,9 @@ class ICTypeMonitor_Fallback : public ICStub // Fixup the IC entry as for a normal fallback stub, for this/arguments. void fixupICEntry(ICEntry *icEntry) { - JS_ASSERT(!hasFallbackStub_); - JS_ASSERT(icEntry_ == nullptr); - JS_ASSERT(lastMonitorStubPtrAddr_ == nullptr); + MOZ_ASSERT(!hasFallbackStub_); + MOZ_ASSERT(icEntry_ == nullptr); + MOZ_ASSERT(lastMonitorStubPtrAddr_ == nullptr); icEntry_ = icEntry; lastMonitorStubPtrAddr_ = icEntry_->addressOfFirstStub(); } @@ -1588,7 +1588,7 @@ class ICTypeMonitor_PrimitiveSet : public TypeCheckPrimitiveSetStub } ICTypeMonitor_PrimitiveSet *getStub(ICStubSpace *space) { - JS_ASSERT(!existingStub_); + MOZ_ASSERT(!existingStub_); return ICTypeMonitor_PrimitiveSet::New(space, getStubCode(), flags_); } }; @@ -1750,7 +1750,7 @@ class ICTypeUpdate_PrimitiveSet : public TypeCheckPrimitiveSetStub } ICTypeUpdate_PrimitiveSet *getStub(ICStubSpace *space) { - JS_ASSERT(!existingStub_); + MOZ_ASSERT(!existingStub_); return ICTypeUpdate_PrimitiveSet::New(space, getStubCode(), flags_); } }; @@ -2698,7 +2698,7 @@ class ICBinaryArith_BooleanWithInt32 : public ICStub ICBinaryArith_BooleanWithInt32(JitCode *stubCode, bool lhsIsBool, bool rhsIsBool) : ICStub(BinaryArith_BooleanWithInt32, stubCode) { - JS_ASSERT(lhsIsBool || rhsIsBool); + MOZ_ASSERT(lhsIsBool || rhsIsBool); extra_ = 0; if (lhsIsBool) extra_ |= 1; @@ -2740,9 +2740,9 @@ class ICBinaryArith_BooleanWithInt32 : public ICStub : ICStubCompiler(cx, ICStub::BinaryArith_BooleanWithInt32), op_(op), lhsIsBool_(lhsIsBool), rhsIsBool_(rhsIsBool) { - JS_ASSERT(op_ == JSOP_ADD || op_ == JSOP_SUB || op_ == JSOP_BITOR || - op_ == JSOP_BITAND || op_ == JSOP_BITXOR); - JS_ASSERT(lhsIsBool_ || rhsIsBool_); + MOZ_ASSERT(op_ == JSOP_ADD || op_ == JSOP_SUB || op_ == JSOP_BITOR || + op_ == JSOP_BITAND || op_ == JSOP_BITXOR); + MOZ_ASSERT(lhsIsBool_ || rhsIsBool_); } ICStub *getStub(ICStubSpace *space) { @@ -3016,8 +3016,8 @@ class ICGetElemNativeSlotStub : public ICGetElemNativeStub : ICGetElemNativeStub(kind, stubCode, firstMonitorStub, shape, name, acctype, needsAtomize), offset_(offset) { - JS_ASSERT(kind == GetElem_NativeSlot || kind == GetElem_NativePrototypeSlot); - JS_ASSERT(acctype == FixedSlot || acctype == DynamicSlot); + MOZ_ASSERT(kind == GetElem_NativeSlot || kind == GetElem_NativePrototypeSlot); + MOZ_ASSERT(acctype == FixedSlot || acctype == DynamicSlot); } public: @@ -3284,13 +3284,13 @@ class ICGetElemNativeCompiler : public ICStubCompiler ICStub *getStub(ICStubSpace *space) { RootedShape shape(cx, obj_->lastProperty()); if (kind == ICStub::GetElem_NativeSlot) { - JS_ASSERT(obj_ == holder_); + MOZ_ASSERT(obj_ == holder_); return ICGetElem_NativeSlot::New( space, getStubCode(), firstMonitorStub_, shape, name_, acctype_, needsAtomize_, offset_); } - JS_ASSERT(obj_ != holder_); + MOZ_ASSERT(obj_ != holder_); RootedShape holderShape(cx, holder_->lastProperty()); if (kind == ICStub::GetElem_NativePrototypeSlot) { return ICGetElem_NativePrototypeSlot::New( @@ -3304,7 +3304,7 @@ class ICGetElemNativeCompiler : public ICStubCompiler getter_, pcOffset_, holder_, holderShape); } - JS_ASSERT(kind == ICStub::GetElem_NativePrototypeCallScripted); + MOZ_ASSERT(kind == ICStub::GetElem_NativePrototypeCallScripted); if (kind == ICStub::GetElem_NativePrototypeCallScripted) { return ICGetElem_NativePrototypeCallScripted::New( space, getStubCode(), firstMonitorStub_, shape, name_, acctype_, needsAtomize_, @@ -3648,7 +3648,7 @@ class ICSetElem_DenseAdd : public ICUpdatedStub template ICSetElem_DenseAddImpl *toImpl() { - JS_ASSERT(ProtoChainDepth == protoChainDepth()); + MOZ_ASSERT(ProtoChainDepth == protoChainDepth()); return toImplUnchecked(); } }; @@ -3665,7 +3665,7 @@ class ICSetElem_DenseAddImpl : public ICSetElem_DenseAdd const AutoShapeVector *shapes) : ICSetElem_DenseAdd(stubCode, type, ProtoChainDepth) { - JS_ASSERT(shapes->length() == NumShapes); + MOZ_ASSERT(shapes->length() == NumShapes); for (size_t i = 0; i < NumShapes; i++) shapes_[i].init((*shapes)[i]); } @@ -3685,7 +3685,7 @@ class ICSetElem_DenseAddImpl : public ICSetElem_DenseAdd MarkShape(trc, &shapes_[i], "baseline-setelem-denseadd-stub-shape"); } Shape *shape(size_t i) const { - JS_ASSERT(i < NumShapes); + MOZ_ASSERT(i < NumShapes); return shapes_[i]; } static size_t offsetOfShape(size_t idx) { @@ -3939,7 +3939,7 @@ class ICGetName_Scope : public ICMonitoredStub } static size_t offsetOfShape(size_t index) { - JS_ASSERT(index <= NumHops); + MOZ_ASSERT(index <= NumHops); return offsetof(ICGetName_Scope, shapes_) + (index * sizeof(HeapPtrShape)); } static size_t offsetOfOffset() { @@ -4451,12 +4451,12 @@ class ICGetPropNativeCompiler : public ICStubCompiler ICGetPropNativeStub *getStub(ICStubSpace *space) { RootedShape shape(cx, obj_->lastProperty()); if (kind == ICStub::GetProp_Native) { - JS_ASSERT(obj_ == holder_); + MOZ_ASSERT(obj_ == holder_); return ICGetProp_Native::New(space, getStubCode(), firstMonitorStub_, shape, offset_); } - JS_ASSERT(obj_ != holder_); - JS_ASSERT(kind == ICStub::GetProp_NativePrototype); + MOZ_ASSERT(obj_ != holder_); + MOZ_ASSERT(kind == ICStub::GetProp_NativePrototype); RootedShape holderShape(cx, holder_->lastProperty()); return ICGetProp_NativePrototype::New(space, getStubCode(), firstMonitorStub_, shape, offset_, holder_, holderShape); @@ -4621,9 +4621,9 @@ class ICGetPropCallGetter : public ICMonitoredStub getter_(cx, getter), pcOffset_(pcOffset) { - JS_ASSERT(kind == ICStub::GetProp_CallScripted || - kind == ICStub::GetProp_CallNative || - kind == ICStub::GetProp_CallNativePrototype); + MOZ_ASSERT(kind == ICStub::GetProp_CallScripted || + kind == ICStub::GetProp_CallNative || + kind == ICStub::GetProp_CallNativePrototype); } }; }; @@ -4662,8 +4662,8 @@ class ICGetPropCallPrototypeGetter : public ICGetPropCallGetter : ICGetPropCallGetter::Compiler(cx, kind, firstMonitorStub, holder, getter, pcOffset), receiver_(cx, obj) { - JS_ASSERT(kind == ICStub::GetProp_CallScripted || - kind == ICStub::GetProp_CallNativePrototype); + MOZ_ASSERT(kind == ICStub::GetProp_CallScripted || + kind == ICStub::GetProp_CallNativePrototype); } }; }; @@ -5299,7 +5299,7 @@ class ICSetProp_NativeAdd : public ICUpdatedStub template ICSetProp_NativeAddImpl *toImpl() { - JS_ASSERT(ProtoChainDepth == protoChainDepth()); + MOZ_ASSERT(ProtoChainDepth == protoChainDepth()); return static_cast *>(this); } @@ -5463,7 +5463,7 @@ class ICSetPropCallSetter : public ICStub setter_(cx, setter), pcOffset_(pcOffset) { - JS_ASSERT(kind == ICStub::SetProp_CallScripted || kind == ICStub::SetProp_CallNative); + MOZ_ASSERT(kind == ICStub::SetProp_CallScripted || kind == ICStub::SetProp_CallNative); } }; }; @@ -6381,7 +6381,7 @@ class ICTypeOf_Typed : public ICFallbackStub : ICFallbackStub(ICStub::TypeOf_Typed, stubCode) { extra_ = uint16_t(type); - JS_ASSERT(JSType(extra_) == type); + MOZ_ASSERT(JSType(extra_) == type); } public: diff --git a/js/src/jit/BaselineInspector.cpp b/js/src/jit/BaselineInspector.cpp index 996b455b7dab..b678b136d103 100644 --- a/js/src/jit/BaselineInspector.cpp +++ b/js/src/jit/BaselineInspector.cpp @@ -85,12 +85,12 @@ BaselineInspector::maybeShapesForPropertyOp(jsbytecode *pc, ShapeVector &shapes) // Return a list of shapes seen by the baseline IC for the current op. // An empty list indicates no shapes are known, or there was an uncacheable // access. - JS_ASSERT(shapes.empty()); + MOZ_ASSERT(shapes.empty()); if (!hasBaselineScript()) return true; - JS_ASSERT(isValidPC(pc)); + MOZ_ASSERT(isValidPC(pc)); const ICEntry &entry = icEntryFromPC(pc); ICStub *stub = entry.firstStub(); @@ -227,7 +227,7 @@ BaselineInspector::expectedCompareType(jsbytecode *pc) return MCompare::Compare_Unknown; if (ICStub *fallback = second ? second->next() : first->next()) { - JS_ASSERT(fallback->isFallback()); + MOZ_ASSERT(fallback->isFallback()); if (fallback->toCompare_Fallback()->hadUnoptimizableAccess()) return MCompare::Compare_Unknown; } @@ -302,7 +302,7 @@ TryToSpecializeBinaryArithOp(ICStub **stubs, return true; } - JS_ASSERT(sawInt32); + MOZ_ASSERT(sawInt32); *result = MIRType_Int32; return true; } @@ -383,7 +383,7 @@ BaselineInspector::hasSeenAccessedGetter(jsbytecode *pc) bool BaselineInspector::hasSeenNonStringIterMore(jsbytecode *pc) { - JS_ASSERT(JSOp(*pc) == JSOP_MOREITER); + MOZ_ASSERT(JSOp(*pc) == JSOP_MOREITER); if (!hasBaselineScript()) return false; @@ -403,7 +403,7 @@ BaselineInspector::hasSeenDoubleResult(jsbytecode *pc) const ICEntry &entry = icEntryFromPC(pc); ICStub *stub = entry.fallbackStub(); - JS_ASSERT(stub->isUnaryArith_Fallback() || stub->isBinaryArith_Fallback()); + MOZ_ASSERT(stub->isUnaryArith_Fallback() || stub->isBinaryArith_Fallback()); if (stub->isUnaryArith_Fallback()) return stub->toUnaryArith_Fallback()->sawDoubleResult(); @@ -462,7 +462,7 @@ BaselineInspector::templateDeclEnvObject() return nullptr; JSObject *res = &templateCallObject()->as().enclosingScope(); - JS_ASSERT(res); + MOZ_ASSERT(res); return &res->as(); } @@ -474,7 +474,7 @@ BaselineInspector::templateCallObject() return nullptr; JSObject *res = baselineScript()->templateScope(); - JS_ASSERT(res); + MOZ_ASSERT(res); return &res->as(); } diff --git a/js/src/jit/BaselineInspector.h b/js/src/jit/BaselineInspector.h index 6d81655c01f5..640a2f7a8dc5 100644 --- a/js/src/jit/BaselineInspector.h +++ b/js/src/jit/BaselineInspector.h @@ -51,7 +51,7 @@ class BaselineInspector explicit BaselineInspector(JSScript *script) : script(script), prevLookedUpEntry(nullptr) { - JS_ASSERT(script); + MOZ_ASSERT(script); } bool hasBaselineScript() const { @@ -70,10 +70,10 @@ class BaselineInspector #endif ICEntry &icEntryFromPC(jsbytecode *pc) { - JS_ASSERT(hasBaselineScript()); - JS_ASSERT(isValidPC(pc)); + MOZ_ASSERT(hasBaselineScript()); + MOZ_ASSERT(isValidPC(pc)); ICEntry &ent = baselineScript()->icEntryFromPCOffset(script->pcToOffset(pc), prevLookedUpEntry); - JS_ASSERT(ent.isForOp()); + MOZ_ASSERT(ent.isForOp()); prevLookedUpEntry = &ent; return ent; } @@ -83,7 +83,7 @@ class BaselineInspector ICEntry *ent = nullptr; if (hasBaselineScript()) { ent = &icEntryFromPC(pc); - JS_ASSERT(ent->fallbackStub()->kind() == expectedFallbackKind); + MOZ_ASSERT(ent->fallbackStub()->kind() == expectedFallbackKind); } return ICInspectorType(this, pc, ent); } diff --git a/js/src/jit/BaselineJIT.cpp b/js/src/jit/BaselineJIT.cpp index ca8dc1175d9d..a278ed5a01d3 100644 --- a/js/src/jit/BaselineJIT.cpp +++ b/js/src/jit/BaselineJIT.cpp @@ -33,10 +33,10 @@ PCMappingSlotInfo::ToSlotLocation(const StackValue *stackVal) if (stackVal->kind() == StackValue::Register) { if (stackVal->reg() == R0) return SlotInR0; - JS_ASSERT(stackVal->reg() == R1); + MOZ_ASSERT(stackVal->reg() == R1); return SlotInR1; } - JS_ASSERT(stackVal->kind() != StackValue::Stack); + MOZ_ASSERT(stackVal->kind() != StackValue::Stack); return SlotIgnore; } @@ -95,7 +95,7 @@ EnterBaseline(JSContext *cx, EnterJitData &data) JS_CHECK_RECURSION(cx, return IonExec_Aborted); } - JS_ASSERT(jit::IsBaselineEnabled(cx)); + MOZ_ASSERT(jit::IsBaselineEnabled(cx)); JS_ASSERT_IF(data.osrFrame, CheckFrame(data.osrFrame)); EnterJitCode enter = cx->runtime()->jitRuntime()->enterBaseline(); @@ -119,7 +119,7 @@ EnterBaseline(JSContext *cx, EnterJitData &data) data.osrFrame->clearRunningInJit(); } - JS_ASSERT(!cx->runtime()->jitRuntime()->hasIonReturnOverride()); + MOZ_ASSERT(!cx->runtime()->jitRuntime()->hasIonReturnOverride()); // Jit callers wrap primitive constructor return. if (!data.result.isMagic() && data.constructing && data.result.isPrimitive()) @@ -155,7 +155,7 @@ jit::EnterBaselineMethod(JSContext *cx, RunState &state) IonExecStatus jit::EnterBaselineAtBranch(JSContext *cx, InterpreterFrame *fp, jsbytecode *pc) { - JS_ASSERT(JSOp(*pc) == JSOP_LOOPENTRY); + MOZ_ASSERT(JSOp(*pc) == JSOP_LOOPENTRY); BaselineScript *baseline = fp->script()->baselineScript(); @@ -209,9 +209,9 @@ jit::EnterBaselineAtBranch(JSContext *cx, InterpreterFrame *fp, jsbytecode *pc) MethodStatus jit::BaselineCompile(JSContext *cx, JSScript *script) { - JS_ASSERT(!script->hasBaselineScript()); - JS_ASSERT(script->canBaselineCompile()); - JS_ASSERT(IsBaselineEnabled(cx)); + MOZ_ASSERT(!script->hasBaselineScript()); + MOZ_ASSERT(script->canBaselineCompile()); + MOZ_ASSERT(IsBaselineEnabled(cx)); LifoAlloc alloc(BASELINE_LIFO_ALLOC_PRIMARY_CHUNK_SIZE); script->ensureNonLazyCanonicalFunction(cx); @@ -240,7 +240,7 @@ jit::BaselineCompile(JSContext *cx, JSScript *script) static MethodStatus CanEnterBaselineJIT(JSContext *cx, HandleScript script, bool osr) { - JS_ASSERT(jit::IsBaselineEnabled(cx)); + MOZ_ASSERT(jit::IsBaselineEnabled(cx)); // Skip if the script has been disabled. if (!script->canBaselineCompile()) @@ -276,7 +276,7 @@ CanEnterBaselineJIT(JSContext *cx, HandleScript script, bool osr) // Ensure the original function is compiled too, so that bailouts from // Ion code have a BaselineScript to resume into. RootedScript original(cx, script->donorFunction()->nonLazyScript()); - JS_ASSERT(original != script); + MOZ_ASSERT(original != script); if (!original->canBaselineCompile()) return Method_CantCompile; @@ -330,7 +330,7 @@ jit::CanEnterBaselineMethod(JSContext *cx, RunState &state) return Method_CantCompile; } } else { - JS_ASSERT(state.isGenerator()); + MOZ_ASSERT(state.isGenerator()); JitSpew(JitSpew_BaselineAbort, "generator frame"); return Method_CantCompile; } @@ -431,7 +431,7 @@ BaselineScript::Destroy(FreeOp *fop, BaselineScript *script) * in invalid store buffer entries. Assert that if we do destroy scripts * outside of a GC that we at least emptied the nursery first. */ - JS_ASSERT(fop->runtime()->gc.nursery.isEmpty()); + MOZ_ASSERT(fop->runtime()->gc.nursery.isEmpty()); #endif fop->delete_(script); @@ -440,14 +440,14 @@ BaselineScript::Destroy(FreeOp *fop, BaselineScript *script) ICEntry & BaselineScript::icEntry(size_t index) { - JS_ASSERT(index < numICEntries()); + MOZ_ASSERT(index < numICEntries()); return icEntryList()[index]; } PCMappingIndexEntry & BaselineScript::pcMappingIndexEntry(size_t index) { - JS_ASSERT(index < numPCMappingIndexEntries()); + MOZ_ASSERT(index < numPCMappingIndexEntries()); return pcMappingIndexEntryList()[index]; } @@ -491,7 +491,7 @@ ICEntry & BaselineScript::icEntryFromReturnOffset(CodeOffsetLabel returnOffset) { ICEntry *result = maybeICEntryFromReturnOffset(returnOffset); - JS_ASSERT(result); + MOZ_ASSERT(result); return *result; } @@ -549,7 +549,7 @@ BaselineScript::icEntryFromPCOffset(uint32_t pcOffset, ICEntry *prevLookedUpEntr break; curEntry++; } - JS_ASSERT(curEntry->pcOffset() == pcOffset && curEntry->isForOp()); + MOZ_ASSERT(curEntry->pcOffset() == pcOffset && curEntry->isForOp()); return *curEntry; } @@ -559,8 +559,8 @@ BaselineScript::icEntryFromPCOffset(uint32_t pcOffset, ICEntry *prevLookedUpEntr ICEntry * BaselineScript::maybeICEntryFromReturnAddress(uint8_t *returnAddr) { - JS_ASSERT(returnAddr > method_->raw()); - JS_ASSERT(returnAddr < method_->raw() + method_->instructionsSize()); + MOZ_ASSERT(returnAddr > method_->raw()); + MOZ_ASSERT(returnAddr < method_->raw() + method_->instructionsSize()); CodeOffsetLabel offset(returnAddr - method_->raw()); return maybeICEntryFromReturnOffset(offset); } @@ -568,8 +568,8 @@ BaselineScript::maybeICEntryFromReturnAddress(uint8_t *returnAddr) ICEntry & BaselineScript::icEntryFromReturnAddress(uint8_t *returnAddr) { - JS_ASSERT(returnAddr > method_->raw()); - JS_ASSERT(returnAddr < method_->raw() + method_->instructionsSize()); + MOZ_ASSERT(returnAddr > method_->raw()); + MOZ_ASSERT(returnAddr < method_->raw() + method_->instructionsSize()); CodeOffsetLabel offset(returnAddr - method_->raw()); return icEntryFromReturnOffset(offset); } @@ -615,8 +615,8 @@ BaselineScript::adoptFallbackStubs(FallbackICStubSpace *stubSpace) void BaselineScript::copyPCMappingEntries(const CompactBufferWriter &entries) { - JS_ASSERT(entries.length() > 0); - JS_ASSERT(entries.length() == pcMappingSize_); + MOZ_ASSERT(entries.length() > 0); + MOZ_ASSERT(entries.length() == pcMappingSize_); memcpy(pcMappingData(), entries.buffer(), entries.length()); } @@ -644,18 +644,18 @@ BaselineScript::nativeCodeForPC(JSScript *script, jsbytecode *pc, PCMappingSlotI } // The previous entry contains the current pc. - JS_ASSERT(i > 0); + MOZ_ASSERT(i > 0); i--; PCMappingIndexEntry &entry = pcMappingIndexEntry(i); - JS_ASSERT(pcOffset >= entry.pcOffset); + MOZ_ASSERT(pcOffset >= entry.pcOffset); CompactBufferReader reader(pcMappingReader(i)); jsbytecode *curPC = script->offsetToPC(entry.pcOffset); uint32_t nativeOffset = entry.nativeOffset; - JS_ASSERT(script->containsPC(curPC)); - JS_ASSERT(curPC <= pc); + MOZ_ASSERT(script->containsPC(curPC)); + MOZ_ASSERT(curPC <= pc); while (true) { // If the high bit is set, the native offset relative to the @@ -683,9 +683,9 @@ BaselineScript::pcForReturnOffset(JSScript *script, uint32_t nativeOffset) jsbytecode * BaselineScript::pcForReturnAddress(JSScript *script, uint8_t *nativeAddress) { - JS_ASSERT(script->baselineScript() == this); - JS_ASSERT(nativeAddress >= method_->raw()); - JS_ASSERT(nativeAddress < method_->raw() + method_->instructionsSize()); + MOZ_ASSERT(script->baselineScript() == this); + MOZ_ASSERT(nativeAddress >= method_->raw()); + MOZ_ASSERT(nativeAddress < method_->raw() + method_->instructionsSize()); return pcForReturnOffset(script, uint32_t(nativeAddress - method_->raw())); } @@ -698,8 +698,8 @@ BaselineScript::pcForNativeOffset(JSScript *script, uint32_t nativeOffset) jsbytecode * BaselineScript::pcForNativeOffset(JSScript *script, uint32_t nativeOffset, bool isReturn) { - JS_ASSERT(script->baselineScript() == this); - JS_ASSERT(nativeOffset < method_->instructionsSize()); + MOZ_ASSERT(script->baselineScript() == this); + MOZ_ASSERT(nativeOffset < method_->instructionsSize()); // Look for the first PCMappingIndexEntry with native offset > the native offset we are // interested in. @@ -710,7 +710,7 @@ BaselineScript::pcForNativeOffset(JSScript *script, uint32_t nativeOffset, bool } // Go back an entry to search forward from. - JS_ASSERT(i > 0); + MOZ_ASSERT(i > 0); i--; PCMappingIndexEntry &entry = pcMappingIndexEntry(i); @@ -720,7 +720,7 @@ BaselineScript::pcForNativeOffset(JSScript *script, uint32_t nativeOffset, bool jsbytecode *curPC = script->offsetToPC(entry.pcOffset); uint32_t curNativeOffset = entry.nativeOffset; - JS_ASSERT(script->containsPC(curPC)); + MOZ_ASSERT(script->containsPC(curPC)); JS_ASSERT_IF(isReturn, nativeOffset >= curNativeOffset); // In the raw native-lookup case, the native code address can occur @@ -751,16 +751,16 @@ BaselineScript::pcForNativeOffset(JSScript *script, uint32_t nativeOffset, bool jsbytecode * BaselineScript::pcForNativeAddress(JSScript *script, uint8_t *nativeAddress) { - JS_ASSERT(script->baselineScript() == this); - JS_ASSERT(nativeAddress >= method_->raw()); - JS_ASSERT(nativeAddress < method_->raw() + method_->instructionsSize()); + MOZ_ASSERT(script->baselineScript() == this); + MOZ_ASSERT(nativeAddress >= method_->raw()); + MOZ_ASSERT(nativeAddress < method_->raw() + method_->instructionsSize()); return pcForNativeOffset(script, uint32_t(nativeAddress - method_->raw())); } void BaselineScript::toggleDebugTraps(JSScript *script, jsbytecode *pc) { - JS_ASSERT(script->baselineScript() == this); + MOZ_ASSERT(script->baselineScript() == this); // Only scripts compiled for debug mode have toggled calls. if (!debugMode()) @@ -775,7 +775,7 @@ BaselineScript::toggleDebugTraps(JSScript *script, jsbytecode *pc) jsbytecode *curPC = script->offsetToPC(entry.pcOffset); uint32_t nativeOffset = entry.nativeOffset; - JS_ASSERT(script->containsPC(curPC)); + MOZ_ASSERT(script->containsPC(curPC)); while (reader.more()) { uint8_t b = reader.readByte(); @@ -801,7 +801,7 @@ BaselineScript::toggleDebugTraps(JSScript *script, jsbytecode *pc) void BaselineScript::toggleSPS(bool enable) { - JS_ASSERT(enable == !(bool)spsOn_); + MOZ_ASSERT(enable == !(bool)spsOn_); JitSpew(JitSpew_BaselineIC, " toggling SPS %s for BaselineScript %p", enable ? "on" : "off", this); @@ -857,7 +857,7 @@ BaselineScript::purgeOptimizedStubs(Zone *zone) } else if (lastStub->isTypeMonitor_Fallback()) { lastStub->toTypeMonitor_Fallback()->resetMonitorStubChain(zone); } else { - JS_ASSERT(lastStub->isTableSwitch()); + MOZ_ASSERT(lastStub->isTableSwitch()); } } @@ -870,7 +870,7 @@ BaselineScript::purgeOptimizedStubs(Zone *zone) ICStub *stub = entry.firstStub(); while (stub->next()) { - JS_ASSERT(stub->allocatedInFallbackSpace()); + MOZ_ASSERT(stub->allocatedInFallbackSpace()); stub = stub->next(); } } diff --git a/js/src/jit/BaselineJIT.h b/js/src/jit/BaselineJIT.h index 11baa3dcdf65..2dfad1064582 100644 --- a/js/src/jit/BaselineJIT.h +++ b/js/src/jit/BaselineJIT.h @@ -52,13 +52,13 @@ class PCMappingSlotInfo inline static PCMappingSlotInfo MakeSlotInfo() { return PCMappingSlotInfo(0); } inline static PCMappingSlotInfo MakeSlotInfo(SlotLocation topSlotLoc) { - JS_ASSERT(ValidSlotLocation(topSlotLoc)); + MOZ_ASSERT(ValidSlotLocation(topSlotLoc)); return PCMappingSlotInfo(1 | (topSlotLoc << 2)); } inline static PCMappingSlotInfo MakeSlotInfo(SlotLocation topSlotLoc, SlotLocation nextSlotLoc) { - JS_ASSERT(ValidSlotLocation(topSlotLoc)); - JS_ASSERT(ValidSlotLocation(nextSlotLoc)); + MOZ_ASSERT(ValidSlotLocation(topSlotLoc)); + MOZ_ASSERT(ValidSlotLocation(nextSlotLoc)); return PCMappingSlotInfo(2 | (topSlotLoc << 2) | (nextSlotLoc) << 4); } @@ -282,7 +282,7 @@ struct BaselineScript return method_; } void setMethod(JitCode *code) { - JS_ASSERT(!method_); + MOZ_ASSERT(!method_); method_ = code; } @@ -290,7 +290,7 @@ struct BaselineScript return templateScope_; } void setTemplateScope(JSObject *templateScope) { - JS_ASSERT(!templateScope_); + MOZ_ASSERT(!templateScope_); templateScope_ = templateScope; } @@ -358,7 +358,7 @@ struct BaselineScript static void writeBarrierPre(Zone *zone, BaselineScript *script); uint32_t *bytecodeTypeMap() { - JS_ASSERT(bytecodeTypeMapOffset_); + MOZ_ASSERT(bytecodeTypeMapOffset_); return reinterpret_cast(reinterpret_cast(this) + bytecodeTypeMapOffset_); } }; diff --git a/js/src/jit/BitSet.cpp b/js/src/jit/BitSet.cpp index 6e393725823c..52a5fbd067cf 100644 --- a/js/src/jit/BitSet.cpp +++ b/js/src/jit/BitSet.cpp @@ -35,7 +35,7 @@ BitSet::init(TempAllocator &alloc) bool BitSet::empty() const { - JS_ASSERT(bits_); + MOZ_ASSERT(bits_); const uint32_t *bits = bits_; for (unsigned int i = 0, e = numWords(); i < e; i++) { if (bits[i]) @@ -47,9 +47,9 @@ BitSet::empty() const void BitSet::insertAll(const BitSet *other) { - JS_ASSERT(bits_); - JS_ASSERT(other->numBits_ == numBits_); - JS_ASSERT(other->bits_); + MOZ_ASSERT(bits_); + MOZ_ASSERT(other->numBits_ == numBits_); + MOZ_ASSERT(other->bits_); uint32_t *bits = bits_; const uint32_t *otherBits = other->bits_; @@ -60,9 +60,9 @@ BitSet::insertAll(const BitSet *other) void BitSet::removeAll(const BitSet *other) { - JS_ASSERT(bits_); - JS_ASSERT(other->numBits_ == numBits_); - JS_ASSERT(other->bits_); + MOZ_ASSERT(bits_); + MOZ_ASSERT(other->numBits_ == numBits_); + MOZ_ASSERT(other->bits_); uint32_t *bits = bits_; const uint32_t *otherBits = other->bits_; @@ -73,9 +73,9 @@ BitSet::removeAll(const BitSet *other) void BitSet::intersect(const BitSet *other) { - JS_ASSERT(bits_); - JS_ASSERT(other->numBits_ == numBits_); - JS_ASSERT(other->bits_); + MOZ_ASSERT(bits_); + MOZ_ASSERT(other->numBits_ == numBits_); + MOZ_ASSERT(other->bits_); uint32_t *bits = bits_; const uint32_t *otherBits = other->bits_; @@ -87,9 +87,9 @@ BitSet::intersect(const BitSet *other) bool BitSet::fixedPointIntersect(const BitSet *other) { - JS_ASSERT(bits_); - JS_ASSERT(other->numBits_ == numBits_); - JS_ASSERT(other->bits_); + MOZ_ASSERT(bits_); + MOZ_ASSERT(other->numBits_ == numBits_); + MOZ_ASSERT(other->bits_); bool changed = false; @@ -108,7 +108,7 @@ BitSet::fixedPointIntersect(const BitSet *other) void BitSet::complement() { - JS_ASSERT(bits_); + MOZ_ASSERT(bits_); uint32_t *bits = bits_; for (unsigned int i = 0, e = numWords(); i < e; i++) bits[i] = ~bits[i]; @@ -117,7 +117,7 @@ BitSet::complement() void BitSet::clear() { - JS_ASSERT(bits_); + MOZ_ASSERT(bits_); uint32_t *bits = bits_; for (unsigned int i = 0, e = numWords(); i < e; i++) bits[i] = 0; diff --git a/js/src/jit/BitSet.h b/js/src/jit/BitSet.h index e018de4f188c..805a13fd0da6 100644 --- a/js/src/jit/BitSet.h +++ b/js/src/jit/BitSet.h @@ -60,8 +60,8 @@ class BitSet : private TempObject // O(1): Check if this set contains the given value. bool contains(unsigned int value) const { - JS_ASSERT(bits_); - JS_ASSERT(value < numBits_); + MOZ_ASSERT(bits_); + MOZ_ASSERT(value < numBits_); return !!(bits_[wordForValue(value)] & bitForValue(value)); } @@ -71,8 +71,8 @@ class BitSet : private TempObject // O(1): Insert the given value into this set. void insert(unsigned int value) { - JS_ASSERT(bits_); - JS_ASSERT(value < numBits_); + MOZ_ASSERT(bits_); + MOZ_ASSERT(value < numBits_); bits_[wordForValue(value)] |= bitForValue(value); } @@ -82,8 +82,8 @@ class BitSet : private TempObject // O(1): Remove the given value from this set. void remove(unsigned int value) { - JS_ASSERT(bits_); - JS_ASSERT(value < numBits_); + MOZ_ASSERT(bits_); + MOZ_ASSERT(value < numBits_); bits_[wordForValue(value)] &= ~bitForValue(value); } @@ -161,8 +161,8 @@ class BitSet::Iterator } inline Iterator& operator++(int dummy) { - JS_ASSERT(more()); - JS_ASSERT(index_ < set_.numBits_); + MOZ_ASSERT(more()); + MOZ_ASSERT(index_ < set_.numBits_); index_++; value_ >>= 1; @@ -172,7 +172,7 @@ class BitSet::Iterator } unsigned int operator *() { - JS_ASSERT(index_ < set_.numBits_); + MOZ_ASSERT(index_ < set_.numBits_); return index_; } }; diff --git a/js/src/jit/BytecodeAnalysis.cpp b/js/src/jit/BytecodeAnalysis.cpp index cfc96957c237..51f7e44a4922 100644 --- a/js/src/jit/BytecodeAnalysis.cpp +++ b/js/src/jit/BytecodeAnalysis.cpp @@ -31,7 +31,7 @@ struct CatchFinallyRange CatchFinallyRange(uint32_t start, uint32_t end) : start(start), end(end) { - JS_ASSERT(end > start); + MOZ_ASSERT(end > start); } bool contains(uint32_t offset) const { @@ -69,18 +69,18 @@ BytecodeAnalysis::init(TempAllocator &alloc, GSNCache &gsn) unsigned stackDepth = infos_[offset].stackDepth; #ifdef DEBUG for (jsbytecode *chkpc = pc + 1; chkpc < (pc + GetBytecodeLength(pc)); chkpc++) - JS_ASSERT(!infos_[script_->pcToOffset(chkpc)].initialized); + MOZ_ASSERT(!infos_[script_->pcToOffset(chkpc)].initialized); #endif unsigned nuses = GetUseCount(script_, offset); unsigned ndefs = GetDefCount(script_, offset); - JS_ASSERT(stackDepth >= nuses); + MOZ_ASSERT(stackDepth >= nuses); stackDepth -= nuses; stackDepth += ndefs; // If stack depth exceeds max allowed by analysis, fail fast. - JS_ASSERT(stackDepth <= BytecodeInfo::MAX_STACK_DEPTH); + MOZ_ASSERT(stackDepth <= BytecodeInfo::MAX_STACK_DEPTH); switch (op) { case JSOP_TABLESWITCH: { @@ -123,13 +123,13 @@ BytecodeAnalysis::init(TempAllocator &alloc, GSNCache &gsn) // Get the pc of the last instruction in the try block. It's a JSOP_GOTO to // jump over the catch/finally blocks. jssrcnote *sn = GetSrcNote(gsn, script_, pc); - JS_ASSERT(SN_TYPE(sn) == SRC_TRY); + MOZ_ASSERT(SN_TYPE(sn) == SRC_TRY); jsbytecode *endOfTry = pc + js_GetSrcNoteOffset(sn, 0); - JS_ASSERT(JSOp(*endOfTry) == JSOP_GOTO); + MOZ_ASSERT(JSOp(*endOfTry) == JSOP_GOTO); jsbytecode *afterTry = endOfTry + GET_JUMP_OFFSET(endOfTry); - JS_ASSERT(afterTry > endOfTry); + MOZ_ASSERT(afterTry > endOfTry); // Pop CatchFinallyRanges that are no longer needed. while (!catchFinallyRanges.empty() && catchFinallyRanges.back().end <= offset) @@ -197,7 +197,7 @@ BytecodeAnalysis::init(TempAllocator &alloc, GSNCache &gsn) // Handle any fallthrough from this opcode. if (BytecodeFallsThrough(op)) { jsbytecode *fallthrough = pc + GetBytecodeLength(pc); - JS_ASSERT(fallthrough < end); + MOZ_ASSERT(fallthrough < end); unsigned fallthroughOffset = script_->pcToOffset(fallthrough); infos_[fallthroughOffset].init(stackDepth); diff --git a/js/src/jit/BytecodeAnalysis.h b/js/src/jit/BytecodeAnalysis.h index bc8ea5c38716..b81ccf467664 100644 --- a/js/src/jit/BytecodeAnalysis.h +++ b/js/src/jit/BytecodeAnalysis.h @@ -26,7 +26,7 @@ struct BytecodeInfo bool loopEntryInCatchOrFinally : 1; void init(unsigned depth) { - JS_ASSERT(depth <= MAX_STACK_DEPTH); + MOZ_ASSERT(depth <= MAX_STACK_DEPTH); JS_ASSERT_IF(initialized, stackDepth == depth); initialized = true; stackDepth = depth; @@ -48,7 +48,7 @@ class BytecodeAnalysis bool init(TempAllocator &alloc, GSNCache &gsn); BytecodeInfo &info(jsbytecode *pc) { - JS_ASSERT(infos_[script_->pcToOffset(pc)].initialized); + MOZ_ASSERT(infos_[script_->pcToOffset(pc)].initialized); return infos_[script_->pcToOffset(pc)]; } diff --git a/js/src/jit/CodeGenerator.cpp b/js/src/jit/CodeGenerator.cpp index 47a66695c521..b354f83b5919 100644 --- a/js/src/jit/CodeGenerator.cpp +++ b/js/src/jit/CodeGenerator.cpp @@ -742,7 +742,7 @@ CodeGenerator::visitFunctionDispatch(LFunctionDispatch *lir) // Determine if the last case is fallback or an ordinary case. if (!mir->hasFallback()) { - JS_ASSERT(mir->numCases() > 0); + MOZ_ASSERT(mir->numCases() > 0); casesWithFallback = mir->numCases(); lastLabel = skipTrivialBlocks(mir->getCaseBlock(mir->numCases() - 1))->lir()->label(); } else { @@ -752,7 +752,7 @@ CodeGenerator::visitFunctionDispatch(LFunctionDispatch *lir) // Compare function pointers, except for the last case. for (size_t i = 0; i < casesWithFallback - 1; i++) { - JS_ASSERT(i < mir->numCases()); + MOZ_ASSERT(i < mir->numCases()); JSFunction *func = mir->getCase(i); LBlock *target = skipTrivialBlocks(mir->getCaseBlock(i))->lir(); masm.branchPtr(Assembler::Equal, input, ImmGCPtr(func), target->label()); @@ -798,7 +798,7 @@ CodeGenerator::visitTypeObjectDispatch(LTypeObjectDispatch *lir) lastBlock = target; found = true; } - JS_ASSERT(found); + MOZ_ASSERT(found); } // Unknown function: jump to fallback block. @@ -981,7 +981,7 @@ CodeGenerator::visitValueToString(LValueToString *lir) // Object if (lir->mir()->input()->mightBeType(MIRType_Object)) { // Bail. - JS_ASSERT(lir->mir()->fallible()); + MOZ_ASSERT(lir->mir()->fallible()); Label bail; masm.branchTestObject(Assembler::Equal, tag, &bail); if (!bailoutFrom(&bail, lir->snapshot())) @@ -1105,7 +1105,7 @@ CodeGenerator::visitLambda(LLambda *lir) if (!ool) return false; - JS_ASSERT(!info.singletonType); + MOZ_ASSERT(!info.singletonType); masm.createGCObject(output, tempReg, info.fun, gc::DefaultHeap, ool->entry()); @@ -1176,7 +1176,7 @@ CodeGenerator::emitLambdaInit(Register output, Register scopeChain, u.s.nargs = info.fun->nargs(); u.s.flags = info.flags; - JS_ASSERT(JSFunction::offsetOfFlags() == JSFunction::offsetOfNargs() + 2); + MOZ_ASSERT(JSFunction::offsetOfFlags() == JSFunction::offsetOfNargs() + 2); masm.store32(Imm32(u.word), Address(output, JSFunction::offsetOfNargs())); masm.storePtr(ImmGCPtr(info.scriptOrLazyScript), Address(output, JSFunction::offsetOfNativeOrScript())); @@ -1194,7 +1194,7 @@ CodeGenerator::visitLambdaPar(LLambdaPar *lir) Register tempReg2 = ToRegister(lir->getTemp1()); const LambdaFunctionInfo &info = lir->mir()->info(); - JS_ASSERT(scopeChainReg != resultReg); + MOZ_ASSERT(scopeChainReg != resultReg); if (!emitAllocateGCThingPar(lir, resultReg, cxReg, tempReg1, tempReg2, info.fun)) return false; @@ -1220,14 +1220,14 @@ CodeGenerator::visitOsiPoint(LOsiPoint *lir) // Note: markOsiPoint ensures enough space exists between the last // LOsiPoint and this one to patch adjacent call instructions. - JS_ASSERT(masm.framePushed() == frameSize()); + MOZ_ASSERT(masm.framePushed() == frameSize()); uint32_t osiCallPointOffset; if (!markOsiPoint(lir, &osiCallPointOffset)) return false; LSafepoint *safepoint = lir->associatedSafepoint(); - JS_ASSERT(!safepoint->osiCallPointOffset()); + MOZ_ASSERT(!safepoint->osiCallPointOffset()); safepoint->setOsiCallPointOffset(osiCallPointOffset); #ifdef DEBUG @@ -1237,8 +1237,8 @@ CodeGenerator::visitOsiPoint(LOsiPoint *lir) for (LInstructionReverseIterator iter(current->rbegin(lir)); iter != current->rend(); iter++) { if (*iter == lir || iter->isNop()) continue; - JS_ASSERT(!iter->isMoveGroup()); - JS_ASSERT(iter->safepoint() == safepoint); + MOZ_ASSERT(!iter->isMoveGroup()); + MOZ_ASSERT(iter->safepoint() == safepoint); break; } #endif @@ -1305,7 +1305,7 @@ CodeGenerator::visitOutOfLineInterruptCheckImplicit(OutOfLineInterruptCheckImpli break; } } - JS_ASSERT(*iter == ool->lir); + MOZ_ASSERT(*iter == ool->lir); saveLive(ool->lir); if (!callVM(InterruptCheckInfo, ool->lir)) @@ -1434,11 +1434,11 @@ CodeGenerator::visitReturn(LReturn *lir) #if defined(JS_NUNBOX32) DebugOnly type = lir->getOperand(TYPE_INDEX); DebugOnly payload = lir->getOperand(PAYLOAD_INDEX); - JS_ASSERT(ToRegister(type) == JSReturnReg_Type); - JS_ASSERT(ToRegister(payload) == JSReturnReg_Data); + MOZ_ASSERT(ToRegister(type) == JSReturnReg_Type); + MOZ_ASSERT(ToRegister(payload) == JSReturnReg_Data); #elif defined(JS_PUNBOX64) DebugOnly result = lir->getOperand(0); - JS_ASSERT(ToRegister(result) == JSReturnReg); + MOZ_ASSERT(ToRegister(result) == JSReturnReg); #endif // Don't emit a jump to the return label if this is the last block. if (current->mir() != *gen->graph().poBegin()) @@ -1530,7 +1530,7 @@ CodeGenerator::visitStackArgT(LStackArgT *lir) const LAllocation *arg = lir->getArgument(); MIRType argType = lir->type(); uint32_t argslot = lir->argslot(); - JS_ASSERT(argslot - 1u < graph.argumentSlotCount()); + MOZ_ASSERT(argslot - 1u < graph.argumentSlotCount()); int32_t stack_offset = StackOffsetOfPassedArg(argslot); Address dest(StackPointer, stack_offset); @@ -1543,7 +1543,7 @@ CodeGenerator::visitStackArgT(LStackArgT *lir) masm.storeValue(*(arg->toConstant()), dest); uint32_t slot = StackOffsetToSlot(stack_offset); - JS_ASSERT(slot - 1u < graph.totalSlotCount()); + MOZ_ASSERT(slot - 1u < graph.totalSlotCount()); return pushedArgumentSlots_.append(slot); } @@ -1552,14 +1552,14 @@ CodeGenerator::visitStackArgV(LStackArgV *lir) { ValueOperand val = ToValue(lir, 0); uint32_t argslot = lir->argslot(); - JS_ASSERT(argslot - 1u < graph.argumentSlotCount()); + MOZ_ASSERT(argslot - 1u < graph.argumentSlotCount()); int32_t stack_offset = StackOffsetOfPassedArg(argslot); masm.storeValue(val, Address(StackPointer, stack_offset)); uint32_t slot = StackOffsetToSlot(stack_offset); - JS_ASSERT(slot - 1u < graph.totalSlotCount()); + MOZ_ASSERT(slot - 1u < graph.totalSlotCount()); return pushedArgumentSlots_.append(slot); } @@ -1579,8 +1579,8 @@ CodeGenerator::visitMoveGroup(LMoveGroup *group) LDefinition::Type type = move.type(); // No bogus moves. - JS_ASSERT(*from != *to); - JS_ASSERT(!from->isConstant()); + MOZ_ASSERT(*from != *to); + MOZ_ASSERT(!from->isConstant()); MoveOp::Type moveType; switch (type) { case LDefinition::OBJECT: @@ -1702,7 +1702,7 @@ CodeGenerator::emitGetPropertyPolymorphic(LInstruction *ins, Register obj, Regis const TypedOrValueRegister &output) { MGetPropertyPolymorphic *mir = ins->mirRaw()->toGetPropertyPolymorphic(); - JS_ASSERT(mir->numShapes() > 1); + MOZ_ASSERT(mir->numShapes() > 1); masm.loadObjShape(obj, scratch); @@ -1764,7 +1764,7 @@ CodeGenerator::emitSetPropertyPolymorphic(LInstruction *ins, Register obj, Regis const ConstantOrRegister &value) { MSetPropertyPolymorphic *mir = ins->mirRaw()->toSetPropertyPolymorphic(); - JS_ASSERT(mir->numShapes() > 1); + MOZ_ASSERT(mir->numShapes() > 1); masm.loadObjShape(obj, scratch); @@ -1926,14 +1926,14 @@ CodeGenerator::visitForkJoinContext(LForkJoinContext *lir) masm.setupUnalignedABICall(0, tempReg); masm.callWithABI(JS_FUNC_TO_DATA_PTR(void *, ForkJoinContextPar)); - JS_ASSERT(ToRegister(lir->output()) == ReturnReg); + MOZ_ASSERT(ToRegister(lir->output()) == ReturnReg); return true; } bool CodeGenerator::visitGuardThreadExclusive(LGuardThreadExclusive *lir) { - JS_ASSERT(gen->info().executionMode() == ParallelExecution); + MOZ_ASSERT(gen->info().executionMode() == ParallelExecution); const Register tempReg = ToRegister(lir->getTempReg()); masm.setupUnalignedABICall(2, tempReg); @@ -2094,7 +2094,7 @@ CodeGenerator::visitPostWriteBarrierO(LPostWriteBarrierO *lir) if (lir->object()->isConstant()) { #ifdef DEBUG - JS_ASSERT(!IsInsideNursery(&lir->object()->toConstant()->toObject())); + MOZ_ASSERT(!IsInsideNursery(&lir->object()->toConstant()->toObject())); #endif } else { masm.branchPtrInNurseryRange(Assembler::Equal, ToRegister(lir->object()), temp, @@ -2120,7 +2120,7 @@ CodeGenerator::visitPostWriteBarrierV(LPostWriteBarrierV *lir) if (lir->object()->isConstant()) { #ifdef DEBUG - JS_ASSERT(!IsInsideNursery(&lir->object()->toConstant()->toObject())); + MOZ_ASSERT(!IsInsideNursery(&lir->object()->toConstant()->toObject())); #endif } else { masm.branchPtrInNurseryRange(Assembler::Equal, ToRegister(lir->object()), temp, @@ -2139,8 +2139,8 @@ bool CodeGenerator::visitCallNative(LCallNative *call) { JSFunction *target = call->getSingleTarget(); - JS_ASSERT(target); - JS_ASSERT(target->isNative()); + MOZ_ASSERT(target); + MOZ_ASSERT(target->isNative()); int callargslot = call->argslot(); int unusedStack = StackOffsetOfPassedArg(callargslot); @@ -2223,7 +2223,7 @@ CodeGenerator::visitCallNative(LCallNative *call) // Move the StackPointer back to its original location, unwinding the native exit frame. masm.adjustStack(IonNativeExitFrameLayout::Size() - unusedStack); - JS_ASSERT(masm.framePushed() == initialStack); + MOZ_ASSERT(masm.framePushed() == initialStack); dropArguments(call->numStackArgs() + 1); return true; @@ -2233,10 +2233,10 @@ bool CodeGenerator::visitCallDOMNative(LCallDOMNative *call) { JSFunction *target = call->getSingleTarget(); - JS_ASSERT(target); - JS_ASSERT(target->isNative()); - JS_ASSERT(target->jitInfo()); - JS_ASSERT(call->mir()->isCallDOMNative()); + MOZ_ASSERT(target); + MOZ_ASSERT(target->isNative()); + MOZ_ASSERT(target->jitInfo()); + MOZ_ASSERT(call->mir()->isCallDOMNative()); int callargslot = call->argslot(); int unusedStack = StackOffsetOfPassedArg(callargslot); @@ -2263,7 +2263,7 @@ CodeGenerator::visitCallDOMNative(LCallDOMNative *call) masm.adjustStack(unusedStack); // argObj is filled with the extracted object, then returned. Register obj = masm.extractObject(Address(StackPointer, 0), argObj); - JS_ASSERT(obj == argObj); + MOZ_ASSERT(obj == argObj); // Push a Value containing the callee object: natives are allowed to access their callee before // setitng the return value. After this the StackPointer points to &vp[0]. @@ -2331,7 +2331,7 @@ CodeGenerator::visitCallDOMNative(LCallDOMNative *call) // Move the StackPointer back to its original location, unwinding the native exit frame. masm.adjustStack(IonDOMMethodExitFrameLayout::Size() - unusedStack); - JS_ASSERT(masm.framePushed() == initialStack); + MOZ_ASSERT(masm.framePushed() == initialStack); dropArguments(call->numStackArgs() + 1); return true; @@ -2382,7 +2382,7 @@ CodeGenerator::visitCallGeneric(LCallGeneric *call) Label invoke, thunk, makeCall, end; // Known-target case is handled by LCallKnown. - JS_ASSERT(!call->hasSingleTarget()); + MOZ_ASSERT(!call->hasSingleTarget()); // Generate an ArgumentsRectifier. JitCode *argumentsRectifier = gen->jitRuntime()->getArgumentsRectifier(executionMode); @@ -2423,7 +2423,7 @@ CodeGenerator::visitCallGeneric(LCallGeneric *call) // Argument fixed needed. Load the ArgumentsRectifier. masm.bind(&thunk); { - JS_ASSERT(ArgumentsRectifierReg != objreg); + MOZ_ASSERT(ArgumentsRectifierReg != objreg); masm.movePtr(ImmGCPtr(argumentsRectifier), objreg); // Necessary for GC marking. masm.loadPtr(Address(objreg, JitCode::offsetOfCode()), objreg); masm.move32(Imm32(call->numStackArgs()), ArgumentsRectifierReg); @@ -2500,9 +2500,9 @@ CodeGenerator::visitCallKnown(LCallKnown *call) Label end, uncompiled; // Native single targets are handled by LCallNative. - JS_ASSERT(!target->isNative()); + MOZ_ASSERT(!target->isNative()); // Missing arguments must have been explicitly appended by the IonBuilder. - JS_ASSERT(target->nargs() <= call->numStackArgs()); + MOZ_ASSERT(target->nargs() <= call->numStackArgs()); JS_ASSERT_IF(call->mir()->isConstructing(), target->isInterpretedConstructor()); @@ -2577,7 +2577,7 @@ bool CodeGenerator::emitCallInvokeFunction(LApplyArgsGeneric *apply, Register extraStackSize) { Register objreg = ToRegister(apply->getTempObject()); - JS_ASSERT(objreg != extraStackSize); + MOZ_ASSERT(objreg != extraStackSize); // Push the space used by the arguments. masm.movePtr(StackPointer, objreg); @@ -2700,7 +2700,7 @@ CodeGenerator::visitApplyArgsGeneric(LApplyArgsGeneric *apply) masm.branchIfFunctionHasNoScript(calleereg, &invoke); } else { // Native single targets are handled by LCallNative. - JS_ASSERT(!apply->getSingleTarget()->isNative()); + MOZ_ASSERT(!apply->getSingleTarget()->isNative()); } // Knowing that calleereg is a non-native function, load the JSScript. @@ -2742,7 +2742,7 @@ CodeGenerator::visitApplyArgsGeneric(LApplyArgsGeneric *apply) // Hardcode the address of the argumentsRectifier code. JitCode *argumentsRectifier = gen->jitRuntime()->getArgumentsRectifier(executionMode); - JS_ASSERT(ArgumentsRectifierReg != objreg); + MOZ_ASSERT(ArgumentsRectifierReg != objreg); masm.movePtr(ImmGCPtr(argumentsRectifier), objreg); // Necessary for GC marking. masm.loadPtr(Address(objreg, JitCode::offsetOfCode()), objreg); masm.movePtr(argcreg, ArgumentsRectifierReg); @@ -3268,7 +3268,7 @@ CodeGenerator::emitObjectOrStringResultChecks(LInstruction *lir, MDefinition *mi if (lir->numDefs() == 0) return true; - JS_ASSERT(lir->numDefs() == 1); + MOZ_ASSERT(lir->numDefs() == 1); Register output = ToRegister(lir->getDef(0)); GeneralRegisterSet regs(GeneralRegisterSet::All()); @@ -3327,7 +3327,7 @@ CodeGenerator::emitValueResultChecks(LInstruction *lir, MDefinition *mir) if (lir->numDefs() == 0) return true; - JS_ASSERT(lir->numDefs() == BOX_PIECES); + MOZ_ASSERT(lir->numDefs() == BOX_PIECES); if (!lir->getDef(0)->output()->isRegister()) return true; @@ -3484,7 +3484,7 @@ CodeGenerator::generateBody() #endif } - JS_ASSERT(pushedArgumentSlots_.empty()); + MOZ_ASSERT(pushedArgumentSlots_.empty()); return true; } @@ -3514,11 +3514,11 @@ static const VMFunction NewDenseArrayInfo = FunctionInfo(NewDen bool CodeGenerator::visitNewArrayCallVM(LNewArray *lir) { - JS_ASSERT(gen->info().executionMode() == SequentialExecution); + MOZ_ASSERT(gen->info().executionMode() == SequentialExecution); Register objReg = ToRegister(lir->output()); - JS_ASSERT(!lir->isCall()); + MOZ_ASSERT(!lir->isCall()); saveLive(lir); JSObject *templateObject = lir->mir()->templateObject(); @@ -3551,7 +3551,7 @@ bool CodeGenerator::visitNewDerivedTypedObject(LNewDerivedTypedObject *lir) { // Not yet made safe for par exec: - JS_ASSERT(gen->info().executionMode() == SequentialExecution); + MOZ_ASSERT(gen->info().executionMode() == SequentialExecution); pushArg(ToRegister(lir->offset())); pushArg(ToRegister(lir->owner())); @@ -3570,7 +3570,7 @@ bool CodeGenerator::visitAtan2D(LAtan2D *lir) masm.passABIArg(x, MoveOp::DOUBLE); masm.callWithABI(JS_FUNC_TO_DATA_PTR(void *, ecmaAtan2), MoveOp::DOUBLE); - JS_ASSERT(ToFloatRegister(lir->output()) == ReturnDoubleReg); + MOZ_ASSERT(ToFloatRegister(lir->output()) == ReturnDoubleReg); return true; } @@ -3585,20 +3585,20 @@ bool CodeGenerator::visitHypot(LHypot *lir) masm.passABIArg(y, MoveOp::DOUBLE); masm.callWithABI(JS_FUNC_TO_DATA_PTR(void *, ecmaHypot), MoveOp::DOUBLE); - JS_ASSERT(ToFloatRegister(lir->output()) == ReturnDoubleReg); + MOZ_ASSERT(ToFloatRegister(lir->output()) == ReturnDoubleReg); return true; } bool CodeGenerator::visitNewArray(LNewArray *lir) { - JS_ASSERT(gen->info().executionMode() == SequentialExecution); + MOZ_ASSERT(gen->info().executionMode() == SequentialExecution); Register objReg = ToRegister(lir->output()); Register tempReg = ToRegister(lir->temp()); JSObject *templateObject = lir->mir()->templateObject(); DebugOnly count = lir->mir()->count(); - JS_ASSERT(count < JSObject::NELEMENTS_LIMIT); + MOZ_ASSERT(count < JSObject::NELEMENTS_LIMIT); if (lir->mir()->shouldUseVM()) return visitNewArrayCallVM(lir); @@ -3672,11 +3672,11 @@ static const VMFunction NewInitObjectWithClassPrototypeInfo = bool CodeGenerator::visitNewObjectVMCall(LNewObject *lir) { - JS_ASSERT(gen->info().executionMode() == SequentialExecution); + MOZ_ASSERT(gen->info().executionMode() == SequentialExecution); Register objReg = ToRegister(lir->output()); - JS_ASSERT(!lir->isCall()); + MOZ_ASSERT(!lir->isCall()); saveLive(lir); pushArg(ImmGCPtr(lir->mir()->templateObject())); @@ -3786,7 +3786,7 @@ ShouldInitFixedSlots(LInstruction *lir, JSObject *templateObj) bool CodeGenerator::visitNewObject(LNewObject *lir) { - JS_ASSERT(gen->info().executionMode() == SequentialExecution); + MOZ_ASSERT(gen->info().executionMode() == SequentialExecution); Register objReg = ToRegister(lir->output()); Register tempReg = ToRegister(lir->temp()); JSObject *templateObject = lir->mir()->templateObject(); @@ -4008,8 +4008,8 @@ bool CodeGenerator::emitAllocateGCThingPar(LInstruction *lir, Register objReg, Register cxReg, Register tempReg1, Register tempReg2, JSObject *templateObj) { - JS_ASSERT(lir->mirRaw()); - JS_ASSERT(lir->mirRaw()->isInstruction()); + MOZ_ASSERT(lir->mirRaw()); + MOZ_ASSERT(lir->mirRaw()->isInstruction()); gc::AllocKind allocKind = templateObj->asTenured()->getAllocKind(); #ifdef JSGC_FJGENERATIONAL @@ -4224,7 +4224,7 @@ bool CodeGenerator::visitCreateArgumentsObject(LCreateArgumentsObject *lir) { // This should be getting constructed in the first block only, and not any OSR entry blocks. - JS_ASSERT(lir->mir()->block()->id() == 0); + MOZ_ASSERT(lir->mir()->block()->id() == 0); const LAllocation *callObj = lir->getCallObject(); Register temp = ToRegister(lir->getTemp(0)); @@ -4396,7 +4396,7 @@ bool CodeGenerator::visitTypedObjectProto(LTypedObjectProto *lir) { Register obj = ToRegister(lir->object()); - JS_ASSERT(ToRegister(lir->output()) == ReturnReg); + MOZ_ASSERT(ToRegister(lir->output()) == ReturnReg); // Eventually we ought to inline this helper function for // efficiency, but it's mildly non-trivial since we must reach @@ -4494,7 +4494,7 @@ CodeGenerator::visitMinMaxI(LMinMaxI *ins) Register first = ToRegister(ins->first()); Register output = ToRegister(ins->output()); - JS_ASSERT(first == output); + MOZ_ASSERT(first == output); Label done; Assembler::Condition cond = ins->mir()->isMax() @@ -4519,7 +4519,7 @@ CodeGenerator::visitAbsI(LAbsI *ins) Register input = ToRegister(ins->input()); Label positive; - JS_ASSERT(input == ToRegister(ins->output())); + MOZ_ASSERT(input == ToRegister(ins->output())); masm.branchTest32(Assembler::NotSigned, input, input, &positive); masm.neg32(input); #ifdef JS_CODEGEN_MIPS @@ -4542,7 +4542,7 @@ CodeGenerator::visitPowI(LPowI *ins) Register power = ToRegister(ins->power()); Register temp = ToRegister(ins->temp()); - JS_ASSERT(power != temp); + MOZ_ASSERT(power != temp); // In all implementations, setupUnalignedABICall() relinquishes use of // its scratch register. We can therefore save an input register by @@ -4552,7 +4552,7 @@ CodeGenerator::visitPowI(LPowI *ins) masm.passABIArg(power); masm.callWithABI(JS_FUNC_TO_DATA_PTR(void *, js::powi), MoveOp::DOUBLE); - JS_ASSERT(ToFloatRegister(ins->output()) == ReturnDoubleReg); + MOZ_ASSERT(ToFloatRegister(ins->output()) == ReturnDoubleReg); return true; } @@ -4569,7 +4569,7 @@ CodeGenerator::visitPowD(LPowD *ins) masm.passABIArg(power, MoveOp::DOUBLE); masm.callWithABI(JS_FUNC_TO_DATA_PTR(void *, ecmaPow), MoveOp::DOUBLE); - JS_ASSERT(ToFloatRegister(ins->output()) == ReturnDoubleReg); + MOZ_ASSERT(ToFloatRegister(ins->output()) == ReturnDoubleReg); return true; } @@ -4585,7 +4585,7 @@ CodeGenerator::visitRandom(LRandom *ins) masm.passABIArg(temp); masm.callWithABI(JS_FUNC_TO_DATA_PTR(void *, math_random_no_outparam), MoveOp::DOUBLE); - JS_ASSERT(ToFloatRegister(ins->output()) == ReturnDoubleReg); + MOZ_ASSERT(ToFloatRegister(ins->output()) == ReturnDoubleReg); return true; } @@ -4594,7 +4594,7 @@ CodeGenerator::visitMathFunctionD(LMathFunctionD *ins) { Register temp = ToRegister(ins->temp()); FloatRegister input = ToFloatRegister(ins->input()); - JS_ASSERT(ToFloatRegister(ins->output()) == ReturnDoubleReg); + MOZ_ASSERT(ToFloatRegister(ins->output()) == ReturnDoubleReg); const MathCache *mathCache = ins->mir()->cache(); @@ -4696,7 +4696,7 @@ CodeGenerator::visitMathFunctionF(LMathFunctionF *ins) { Register temp = ToRegister(ins->temp()); FloatRegister input = ToFloatRegister(ins->input()); - JS_ASSERT(ToFloatRegister(ins->output()) == ReturnFloat32Reg); + MOZ_ASSERT(ToFloatRegister(ins->output()) == ReturnFloat32Reg); masm.setupUnalignedABICall(1, temp); masm.passABIArg(input, MoveOp::FLOAT32); @@ -4721,7 +4721,7 @@ CodeGenerator::visitModD(LModD *ins) FloatRegister rhs = ToFloatRegister(ins->rhs()); Register temp = ToRegister(ins->temp()); - JS_ASSERT(ToFloatRegister(ins->output()) == ReturnDoubleReg); + MOZ_ASSERT(ToFloatRegister(ins->output()) == ReturnDoubleReg); masm.setupUnalignedABICall(2, temp); masm.passABIArg(lhs, MoveOp::DOUBLE); @@ -4789,14 +4789,14 @@ bool CodeGenerator::emitCompareS(LInstruction *lir, JSOp op, Register left, Register right, Register output) { - JS_ASSERT(lir->isCompareS() || lir->isCompareStrictS()); + MOZ_ASSERT(lir->isCompareS() || lir->isCompareStrictS()); OutOfLineCode *ool = nullptr; if (op == JSOP_EQ || op == JSOP_STRICTEQ) { ool = oolCallVM(StringsEqualInfo, lir, (ArgList(), left, right), StoreRegisterTo(output)); } else { - JS_ASSERT(op == JSOP_NE || op == JSOP_STRICTNE); + MOZ_ASSERT(op == JSOP_NE || op == JSOP_STRICTNE); ool = oolCallVM(StringsNotEqualInfo, lir, (ArgList(), left, right), StoreRegisterTo(output)); } if (!ool) @@ -4812,7 +4812,7 @@ bool CodeGenerator::visitCompareStrictS(LCompareStrictS *lir) { JSOp op = lir->mir()->jsop(); - JS_ASSERT(op == JSOP_STRICTEQ || op == JSOP_STRICTNE); + MOZ_ASSERT(op == JSOP_STRICTEQ || op == JSOP_STRICTNE); const ValueOperand leftV = ToValue(lir, LCompareStrictS::Lhs); Register right = ToRegister(lir->right()); @@ -4914,8 +4914,8 @@ CodeGenerator::visitIsNullOrLikeUndefined(LIsNullOrLikeUndefined *lir) { JSOp op = lir->mir()->jsop(); MCompare::CompareType compareType = lir->mir()->compareType(); - JS_ASSERT(compareType == MCompare::Compare_Undefined || - compareType == MCompare::Compare_Null); + MOZ_ASSERT(compareType == MCompare::Compare_Undefined || + compareType == MCompare::Compare_Null); const ValueOperand value = ToValue(lir, LIsNullOrLikeUndefined::Value); Register output = ToRegister(lir->output()); @@ -4973,7 +4973,7 @@ CodeGenerator::visitIsNullOrLikeUndefined(LIsNullOrLikeUndefined *lir) return true; } - JS_ASSERT(op == JSOP_STRICTEQ || op == JSOP_STRICTNE); + MOZ_ASSERT(op == JSOP_STRICTEQ || op == JSOP_STRICTNE); Assembler::Condition cond = JSOpToCondition(compareType, op); if (compareType == MCompare::Compare_Null) @@ -4989,8 +4989,8 @@ CodeGenerator::visitIsNullOrLikeUndefinedAndBranch(LIsNullOrLikeUndefinedAndBran { JSOp op = lir->cmpMir()->jsop(); MCompare::CompareType compareType = lir->cmpMir()->compareType(); - JS_ASSERT(compareType == MCompare::Compare_Undefined || - compareType == MCompare::Compare_Null); + MOZ_ASSERT(compareType == MCompare::Compare_Undefined || + compareType == MCompare::Compare_Null); const ValueOperand value = ToValue(lir, LIsNullOrLikeUndefinedAndBranch::Value); @@ -5040,7 +5040,7 @@ CodeGenerator::visitIsNullOrLikeUndefinedAndBranch(LIsNullOrLikeUndefinedAndBran return true; } - JS_ASSERT(op == JSOP_STRICTEQ || op == JSOP_STRICTNE); + MOZ_ASSERT(op == JSOP_STRICTEQ || op == JSOP_STRICTNE); Assembler::Condition cond = JSOpToCondition(compareType, op); if (compareType == MCompare::Compare_Null) @@ -5159,14 +5159,14 @@ CodeGenerator::visitConcat(LConcat *lir) Register output = ToRegister(lir->output()); - JS_ASSERT(lhs == CallTempReg0); - JS_ASSERT(rhs == CallTempReg1); - JS_ASSERT(ToRegister(lir->temp1()) == CallTempReg0); - JS_ASSERT(ToRegister(lir->temp2()) == CallTempReg1); - JS_ASSERT(ToRegister(lir->temp3()) == CallTempReg2); - JS_ASSERT(ToRegister(lir->temp4()) == CallTempReg3); - JS_ASSERT(ToRegister(lir->temp5()) == CallTempReg4); - JS_ASSERT(output == CallTempReg5); + MOZ_ASSERT(lhs == CallTempReg0); + MOZ_ASSERT(rhs == CallTempReg1); + MOZ_ASSERT(ToRegister(lir->temp1()) == CallTempReg0); + MOZ_ASSERT(ToRegister(lir->temp2()) == CallTempReg1); + MOZ_ASSERT(ToRegister(lir->temp3()) == CallTempReg2); + MOZ_ASSERT(ToRegister(lir->temp4()) == CallTempReg3); + MOZ_ASSERT(ToRegister(lir->temp5()) == CallTempReg4); + MOZ_ASSERT(output == CallTempReg5); return emitConcat(lir, lhs, rhs, output); } @@ -5179,14 +5179,14 @@ CodeGenerator::visitConcatPar(LConcatPar *lir) Register rhs = ToRegister(lir->rhs()); Register output = ToRegister(lir->output()); - JS_ASSERT(lhs == CallTempReg0); - JS_ASSERT(rhs == CallTempReg1); - JS_ASSERT((Register)cx == CallTempReg4); - JS_ASSERT(ToRegister(lir->temp1()) == CallTempReg0); - JS_ASSERT(ToRegister(lir->temp2()) == CallTempReg1); - JS_ASSERT(ToRegister(lir->temp3()) == CallTempReg2); - JS_ASSERT(ToRegister(lir->temp4()) == CallTempReg3); - JS_ASSERT(output == CallTempReg5); + MOZ_ASSERT(lhs == CallTempReg0); + MOZ_ASSERT(rhs == CallTempReg1); + MOZ_ASSERT((Register)cx == CallTempReg4); + MOZ_ASSERT(ToRegister(lir->temp1()) == CallTempReg0); + MOZ_ASSERT(ToRegister(lir->temp2()) == CallTempReg1); + MOZ_ASSERT(ToRegister(lir->temp3()) == CallTempReg2); + MOZ_ASSERT(ToRegister(lir->temp4()) == CallTempReg3); + MOZ_ASSERT(output == CallTempReg5); return emitConcat(lir, lhs, rhs, output); } @@ -5460,7 +5460,7 @@ JitRuntime::generateMallocStub(JSContext *cx) const Register regTemp = regs.takeGeneral(); const Register regRuntime = regTemp; regs.add(regTemp); - JS_ASSERT(regTemp != regNBytes); + MOZ_ASSERT(regTemp != regNBytes); masm.setupUnalignedABICall(2, regTemp); masm.movePtr(ImmPtr(cx->runtime()), regRuntime); @@ -5496,7 +5496,7 @@ JitRuntime::generateFreeStub(JSContext *cx) const Register regTemp = regs.takeGeneral(); regs.add(regTemp); - JS_ASSERT(regTemp != regSlots); + MOZ_ASSERT(regTemp != regSlots); masm.setupUnalignedABICall(1, regTemp); masm.passABIArg(regSlots); @@ -5736,7 +5736,7 @@ CodeGenerator::visitBoundsCheckRange(LBoundsCheckRange *lir) { int32_t min = lir->mir()->minimum(); int32_t max = lir->mir()->maximum(); - JS_ASSERT(max >= min); + MOZ_ASSERT(max >= min); Register temp = ToRegister(lir->getTemp(0)); if (lir->index()->isConstant()) { @@ -5810,7 +5810,7 @@ class OutOfLineStoreElementHole : public OutOfLineCodeBase explicit OutOfLineStoreElementHole(LInstruction *ins) : ins_(ins) { - JS_ASSERT(ins->isStoreElementHoleV() || ins->isStoreElementHoleT()); + MOZ_ASSERT(ins->isStoreElementHoleV() || ins->isStoreElementHoleT()); } bool accept(CodeGenerator *codegen) { @@ -6059,7 +6059,7 @@ CodeGenerator::emitArrayPopShift(LInstruction *lir, const MArrayPopShift *mir, R if (!ool) return false; } else { - JS_ASSERT(mir->mode() == MArrayPopShift::Shift); + MOZ_ASSERT(mir->mode() == MArrayPopShift::Shift); ool = oolCallVM(ArrayShiftDenseInfo, lir, (ArgList(), obj), StoreValueTo(out)); if (!ool) return false; @@ -6097,7 +6097,7 @@ CodeGenerator::emitArrayPopShift(LInstruction *lir, const MArrayPopShift *mir, R masm.loadElementTypedOrValue(BaseIndex(elementsTemp, lengthTemp, TimesEight), out, mir->needsHoleCheck(), ool->entry()); } else { - JS_ASSERT(mir->mode() == MArrayPopShift::Shift); + MOZ_ASSERT(mir->mode() == MArrayPopShift::Shift); masm.loadElementTypedOrValue(Address(elementsTemp, 0), out, mir->needsHoleCheck(), ool->entry()); } @@ -6291,7 +6291,7 @@ CodeGenerator::visitIteratorStart(LIteratorStart *lir) const Register niTemp = ToRegister(lir->temp3()); // Holds the NativeIterator object. // Iterators other than for-in should use LCallIteratorStart. - JS_ASSERT(flags == JSITER_ENUMERATE); + MOZ_ASSERT(flags == JSITER_ENUMERATE); // Fetch the most recent iterator and ensure it's not nullptr. masm.loadPtr(AbsoluteAddress(GetIonContext()->runtime->addressOfLastCachedNativeIterator()), output); @@ -6377,7 +6377,7 @@ CodeGenerator::visitIteratorStart(LIteratorStart *lir) static void LoadNativeIterator(MacroAssembler &masm, Register obj, Register dest, Label *failures) { - JS_ASSERT(obj != dest); + MOZ_ASSERT(obj != dest); // Test class. masm.branchTestObjClass(Assembler::NotEqual, obj, dest, &PropertyIteratorObject::class_, failures); @@ -6695,15 +6695,15 @@ CodeGenerator::generateAsmJS(AsmJSFunctionLabels *labels) // is nothing else to do after this point since the LifoAlloc memory // holding the MIR graph is about to be popped and reused. In particular, // every step in CodeGenerator::link must be a nop, as asserted here: - JS_ASSERT(snapshots_.listSize() == 0); - JS_ASSERT(snapshots_.RVATableSize() == 0); - JS_ASSERT(recovers_.size() == 0); - JS_ASSERT(bailouts_.empty()); - JS_ASSERT(graph.numConstants() == 0); - JS_ASSERT(safepointIndices_.empty()); - JS_ASSERT(osiIndices_.empty()); - JS_ASSERT(cacheList_.empty()); - JS_ASSERT(safepoints_.size() == 0); + MOZ_ASSERT(snapshots_.listSize() == 0); + MOZ_ASSERT(snapshots_.RVATableSize() == 0); + MOZ_ASSERT(recovers_.size() == 0); + MOZ_ASSERT(bailouts_.empty()); + MOZ_ASSERT(graph.numConstants() == 0); + MOZ_ASSERT(safepointIndices_.empty()); + MOZ_ASSERT(osiIndices_.empty()); + MOZ_ASSERT(cacheList_.empty()); + MOZ_ASSERT(safepoints_.size() == 0); return true; } @@ -6855,7 +6855,7 @@ CodeGenerator::link(JSContext *cx, types::CompilerConstraintList *constraints) // We finished the new IonScript. Invalidate the current active IonScript, // so we can replace it with this new (probably higher optimized) version. if (HasIonScript(script, executionMode)) { - JS_ASSERT(GetIonScript(script, executionMode)->isRecompiling()); + MOZ_ASSERT(GetIonScript(script, executionMode)->isRecompiling()); // Do a normal invalidate, except don't cancel offThread compilations, // since that will cancel this compilation too. if (!Invalidate(cx, script, SequentialExecution, @@ -7171,7 +7171,7 @@ CodeGenerator::visitCallGetElement(LCallGetElement *lir) if (op == JSOP_GETELEM) { return callVM(GetElementInfo, lir); } else { - JS_ASSERT(op == JSOP_CALLELEM); + MOZ_ASSERT(op == JSOP_CALLELEM); return callVM(CallElementInfo, lir); } } @@ -8308,7 +8308,7 @@ CodeGenerator::visitStoreTypedArrayElementHole(LStoreTypedArrayElementHole *lir) StoreToTypedArray(masm, arrayType, value, dest); } else { Register idxReg = ToRegister(lir->index()); - JS_ASSERT(guardLength); + MOZ_ASSERT(guardLength); if (lir->length()->isConstant()) masm.branch32(Assembler::AboveOrEqual, idxReg, Imm32(ToInt32(lir->length())), &skip); else @@ -8326,7 +8326,7 @@ bool CodeGenerator::visitClampIToUint8(LClampIToUint8 *lir) { Register output = ToRegister(lir->output()); - JS_ASSERT(output == ToRegister(lir->input())); + MOZ_ASSERT(output == ToRegister(lir->input())); masm.clampIntToUint8(output); return true; } @@ -8520,7 +8520,7 @@ CodeGenerator::emitInstanceOf(LInstruction *ins, JSObject *prototypeObject) masm.jump(&done); masm.bind(¬PrototypeObject); - JS_ASSERT(uintptr_t(TaggedProto::LazyProto) == 1); + MOZ_ASSERT(uintptr_t(TaggedProto::LazyProto) == 1); // Test for nullptr or Proxy::LazyProto masm.branchPtr(Assembler::BelowOrEqual, output, ImmWord(1), &testLazy); @@ -8554,7 +8554,7 @@ CodeGenerator::emitInstanceOf(LInstruction *ins, JSObject *prototypeObject) } else { objReg = ToRegister(ins->toInstanceOfO()->lhs()); } - JS_ASSERT(objReg == output); + MOZ_ASSERT(objReg == output); masm.jump(ool->entry()); } @@ -8574,7 +8574,7 @@ CodeGenerator::visitCallInstanceOf(LCallInstanceOf *ins) { ValueOperand lhs = ToValue(ins, LCallInstanceOf::LHS); Register rhs = ToRegister(ins->rhs()); - JS_ASSERT(ToRegister(ins->output()) == ReturnReg); + MOZ_ASSERT(ToRegister(ins->output()) == ReturnReg); pushArg(lhs); pushArg(rhs); @@ -8661,7 +8661,7 @@ CodeGenerator::visitGetDOMProperty(LGetDOMProperty *ins) masm.bind(&haveValue); - JS_ASSERT(masm.framePushed() == initialStack); + MOZ_ASSERT(masm.framePushed() == initialStack); return true; } @@ -8731,7 +8731,7 @@ CodeGenerator::visitSetDOMProperty(LSetDOMProperty *ins) masm.adjustStack(IonDOMExitFrameLayout::Size()); - JS_ASSERT(masm.framePushed() == initialStack); + MOZ_ASSERT(masm.framePushed() == initialStack); return true; } diff --git a/js/src/jit/CompactBuffer.h b/js/src/jit/CompactBuffer.h index a7f21e1819c8..a91e2848ee90 100644 --- a/js/src/jit/CompactBuffer.h +++ b/js/src/jit/CompactBuffer.h @@ -36,7 +36,7 @@ class CompactBufferReader uint32_t shift = 0; uint8_t byte; while (true) { - JS_ASSERT(shift < 32); + MOZ_ASSERT(shift < 32); byte = readByte(); val |= (uint32_t(byte) >> 1) << shift; shift += 7; @@ -52,7 +52,7 @@ class CompactBufferReader { } inline explicit CompactBufferReader(const CompactBufferWriter &writer); uint8_t readByte() { - JS_ASSERT(buffer_ < end_); + MOZ_ASSERT(buffer_ < end_); return *buffer_++; } uint32_t readFixedUint32_t() { @@ -69,7 +69,7 @@ class CompactBufferReader } uint32_t readNativeEndianUint32_t() { // Must be at 4-byte boundary - JS_ASSERT(uintptr_t(buffer_) % sizeof(uint32_t) == 0); + MOZ_ASSERT(uintptr_t(buffer_) % sizeof(uint32_t) == 0); return *reinterpret_cast(buffer_); } uint32_t readUnsigned() { @@ -88,7 +88,7 @@ class CompactBufferReader } bool more() const { - JS_ASSERT(buffer_ <= end_); + MOZ_ASSERT(buffer_ <= end_); return buffer_ < end_; } @@ -116,7 +116,7 @@ class CompactBufferWriter // Note: writeByte() takes uint32 to catch implicit casts with a runtime // assert. void writeByte(uint32_t byte) { - JS_ASSERT(byte <= 0xFF); + MOZ_ASSERT(byte <= 0xFF); enoughMemory_ &= buffer_.append(byte); } void writeUnsigned(uint32_t value) { @@ -150,7 +150,7 @@ class CompactBufferWriter } void writeNativeEndianUint32_t(uint32_t value) { // Must be at 4-byte boundary - JS_ASSERT(length() % sizeof(uint32_t) == 0); + MOZ_ASSERT(length() % sizeof(uint32_t) == 0); writeFixedUint32_t(0); if (oom()) return; diff --git a/js/src/jit/CompileInfo-inl.h b/js/src/jit/CompileInfo-inl.h index 2960eb023ab5..838faf2893dc 100644 --- a/js/src/jit/CompileInfo-inl.h +++ b/js/src/jit/CompileInfo-inl.h @@ -47,7 +47,7 @@ InlineScriptTree * InlineScriptTree::addCallee(TempAllocator *allocator, jsbytecode *callerPc, JSScript *calleeScript) { - JS_ASSERT(script_ && script_->containsPC(callerPc)); + MOZ_ASSERT(script_ && script_->containsPC(callerPc)); InlineScriptTree *calleeTree = New(allocator, this, callerPc, calleeScript); if (!calleeTree) return nullptr; diff --git a/js/src/jit/CompileInfo.h b/js/src/jit/CompileInfo.h index fd29239b8e1a..ce4e64131e12 100644 --- a/js/src/jit/CompileInfo.h +++ b/js/src/jit/CompileInfo.h @@ -104,7 +104,7 @@ class InlineScriptTree { return children_ != nullptr; } InlineScriptTree *firstChild() const { - JS_ASSERT(hasChildren()); + MOZ_ASSERT(hasChildren()); return children_; } @@ -112,7 +112,7 @@ class InlineScriptTree { return nextCallee_ != nullptr; } InlineScriptTree *nextCallee() const { - JS_ASSERT(hasNextCallee()); + MOZ_ASSERT(hasNextCallee()); return nextCallee_; } @@ -138,8 +138,8 @@ class BytecodeSite { BytecodeSite(InlineScriptTree *tree, jsbytecode *pc) : tree_(tree), pc_(pc) { - JS_ASSERT(tree_ != nullptr); - JS_ASSERT(pc_ != nullptr); + MOZ_ASSERT(tree_ != nullptr); + MOZ_ASSERT(pc_ != nullptr); } bool hasTree() const { @@ -179,7 +179,7 @@ class CompileInfo // guaranteed to be non-lazy. Hence, don't access its script! if (fun_) { fun_ = fun_->nonLazyScript()->functionNonDelazifying(); - JS_ASSERT(fun_->isTenured()); + MOZ_ASSERT(fun_->isTenured()); } osrStaticScope_ = osrPc ? script->getStaticScope(osrPc) : nullptr; @@ -231,7 +231,7 @@ class CompileInfo } bool hasOsrAt(jsbytecode *pc) { - JS_ASSERT(JSOp(*pc) == JSOP_LOOPENTRY); + MOZ_ASSERT(JSOp(*pc) == JSOP_LOOPENTRY); return pc == osrPc(); } @@ -312,20 +312,20 @@ class CompileInfo } uint32_t scopeChainSlot() const { - JS_ASSERT(script()); + MOZ_ASSERT(script()); return 0; } uint32_t returnValueSlot() const { - JS_ASSERT(script()); + MOZ_ASSERT(script()); return 1; } uint32_t argsObjSlot() const { - JS_ASSERT(hasArguments()); + MOZ_ASSERT(hasArguments()); return 2; } uint32_t thisSlot() const { - JS_ASSERT(funMaybeLazy()); - JS_ASSERT(nimplicit_ > 0); + MOZ_ASSERT(funMaybeLazy()); + MOZ_ASSERT(nimplicit_ > 0); return nimplicit_ - 1; } uint32_t firstArgSlot() const { @@ -334,14 +334,14 @@ class CompileInfo uint32_t argSlotUnchecked(uint32_t i) const { // During initialization, some routines need to get at arg // slots regardless of how regular argument access is done. - JS_ASSERT(i < nargs_); + MOZ_ASSERT(i < nargs_); return nimplicit_ + i; } uint32_t argSlot(uint32_t i) const { // This should only be accessed when compiling functions for // which argument accesses don't need to go through the // argument object. - JS_ASSERT(!argsObjAliasesFormals()); + MOZ_ASSERT(!argsObjAliasesFormals()); return argSlotUnchecked(i); } uint32_t firstLocalSlot() const { @@ -358,21 +358,21 @@ class CompileInfo } uint32_t startArgSlot() const { - JS_ASSERT(script()); + MOZ_ASSERT(script()); return StartArgSlot(script()); } uint32_t endArgSlot() const { - JS_ASSERT(script()); + MOZ_ASSERT(script()); return CountArgSlots(script(), funMaybeLazy()); } uint32_t totalSlots() const { - JS_ASSERT(script() && funMaybeLazy()); + MOZ_ASSERT(script() && funMaybeLazy()); return nimplicit() + nargs() + nlocals(); } bool isSlotAliased(uint32_t index, NestedScopeObject *staticScope) const { - JS_ASSERT(index >= startArgSlot()); + MOZ_ASSERT(index >= startArgSlot()); if (funMaybeLazy() && index == thisSlot()) return false; @@ -403,7 +403,7 @@ class CompileInfo return false; } - JS_ASSERT(index >= firstStackSlot()); + MOZ_ASSERT(index >= firstStackSlot()); return false; } diff --git a/js/src/jit/CompileWrappers.cpp b/js/src/jit/CompileWrappers.cpp index 1d0272018fd5..0030b92b26d8 100644 --- a/js/src/jit/CompileWrappers.cpp +++ b/js/src/jit/CompileWrappers.cpp @@ -30,7 +30,7 @@ CompileRuntime::onMainThread() js::PerThreadData * CompileRuntime::mainThread() { - JS_ASSERT(onMainThread()); + MOZ_ASSERT(onMainThread()); return &runtime()->mainThread; } diff --git a/js/src/jit/EffectiveAddressAnalysis.cpp b/js/src/jit/EffectiveAddressAnalysis.cpp index 3d16b227d9ca..34559a3620bf 100644 --- a/js/src/jit/EffectiveAddressAnalysis.cpp +++ b/js/src/jit/EffectiveAddressAnalysis.cpp @@ -18,7 +18,7 @@ AnalyzeLsh(TempAllocator &alloc, MLsh *lsh) return; MDefinition *index = lsh->lhs(); - JS_ASSERT(index->type() == MIRType_Int32); + MOZ_ASSERT(index->type() == MIRType_Int32); MDefinition *shift = lsh->rhs(); if (!shift->isConstant()) diff --git a/js/src/jit/ExecutableAllocator.h b/js/src/jit/ExecutableAllocator.h index 4451249b663e..0a078a6c44db 100644 --- a/js/src/jit/ExecutableAllocator.h +++ b/js/src/jit/ExecutableAllocator.h @@ -101,7 +101,7 @@ private: public: void release(bool willDestroy = false) { - JS_ASSERT(m_refCount != 0); + MOZ_ASSERT(m_refCount != 0); JS_ASSERT_IF(willDestroy, m_refCount == 1); if (--m_refCount == 0) js_delete(this); @@ -146,13 +146,13 @@ private: // of generated code, and they only hold 16KB or so of code. void addRef() { - JS_ASSERT(m_refCount); + MOZ_ASSERT(m_refCount); ++m_refCount; } void* alloc(size_t n, CodeKind kind) { - JS_ASSERT(n <= available()); + MOZ_ASSERT(n <= available()); void *result = m_freePtr; m_freePtr += n; @@ -167,7 +167,7 @@ private: } size_t available() const { - JS_ASSERT(m_end >= m_freePtr); + MOZ_ASSERT(m_end >= m_freePtr); return m_end - m_freePtr; } @@ -200,7 +200,7 @@ public: largeAllocSize = pageSize * 16; } - JS_ASSERT(m_smallPools.empty()); + MOZ_ASSERT(m_smallPools.empty()); } ~ExecutableAllocator() @@ -227,7 +227,7 @@ public: // Caller must ensure 'n' is word-size aligned. If all allocations are // of word sized quantities, then all subsequent allocations will be // aligned. - JS_ASSERT(roundUpAllocationSize(n, sizeof(void*)) == n); + MOZ_ASSERT(roundUpAllocationSize(n, sizeof(void*)) == n); if (n == OVERSIZE_ALLOCATION) { *poolp = NULL; @@ -241,16 +241,16 @@ public: // This alloc is infallible because poolForSize() just obtained // (found, or created if necessary) a pool that had enough space. void *result = (*poolp)->alloc(n, type); - JS_ASSERT(result); + MOZ_ASSERT(result); return result; } void releasePoolPages(ExecutablePool *pool) { - JS_ASSERT(pool->m_allocation.pages); + MOZ_ASSERT(pool->m_allocation.pages); if (destroyCallback) destroyCallback(pool->m_allocation.pages, pool->m_allocation.size); systemRelease(pool->m_allocation); - JS_ASSERT(m_pools.initialized()); + MOZ_ASSERT(m_pools.initialized()); m_pools.remove(m_pools.lookup(pool)); // this asserts if |pool| is not in m_pools } @@ -285,7 +285,7 @@ private: // Round up to next page boundary size_t size = request + (granularity - 1); size = size & ~(granularity - 1); - JS_ASSERT(size >= request); + MOZ_ASSERT(size >= request); return size; } diff --git a/js/src/jit/FixedList.h b/js/src/jit/FixedList.h index ca3d81739a59..c416bc5c2437 100644 --- a/js/src/jit/FixedList.h +++ b/js/src/jit/FixedList.h @@ -48,7 +48,7 @@ class FixedList } void shrink(size_t num) { - JS_ASSERT(num < length_); + MOZ_ASSERT(num < length_); length_ -= num; } @@ -71,11 +71,11 @@ class FixedList } T &operator[](size_t index) { - JS_ASSERT(index < length_); + MOZ_ASSERT(index < length_); return list_[index]; } const T &operator [](size_t index) const { - JS_ASSERT(index < length_); + MOZ_ASSERT(index < length_); return list_[index]; } }; diff --git a/js/src/jit/InlineList.h b/js/src/jit/InlineList.h index b0f65b27732c..72fad0d0edce 100644 --- a/js/src/jit/InlineList.h +++ b/js/src/jit/InlineList.h @@ -88,7 +88,7 @@ class InlineForwardList : protected InlineForwardListNode insertAfter(this, t); } void pushBack(Node *t) { - JS_ASSERT(t->next == nullptr); + MOZ_ASSERT(t->next == nullptr); #ifdef DEBUG modifyCount_++; #endif @@ -96,17 +96,17 @@ class InlineForwardList : protected InlineForwardListNode tail_ = t; } T *popFront() { - JS_ASSERT(!empty()); + MOZ_ASSERT(!empty()); T* result = static_cast(this->next); removeAfter(this, result); return result; } T *back() { - JS_ASSERT(!empty()); + MOZ_ASSERT(!empty()); return static_cast(tail_); } void insertAfter(Node *at, Node *item) { - JS_ASSERT(item->next == nullptr); + MOZ_ASSERT(item->next == nullptr); #ifdef DEBUG modifyCount_++; #endif @@ -121,12 +121,12 @@ class InlineForwardList : protected InlineForwardListNode #endif if (item == tail_) tail_ = at; - JS_ASSERT(at->next == item); + MOZ_ASSERT(at->next == item); at->next = item->next; item->next = nullptr; } void splitAfter(Node *at, InlineForwardList *to) { - JS_ASSERT(to->empty()); + MOZ_ASSERT(to->empty()); if (!at) at = this; if (at == tail_) @@ -170,7 +170,7 @@ private: public: InlineForwardListIterator & operator ++() { - JS_ASSERT(modifyCount_ == owner_->modifyCount_); + MOZ_ASSERT(modifyCount_ == owner_->modifyCount_); prev = iter; iter = iter->next; return *this; @@ -181,11 +181,11 @@ public: return old; } T * operator *() const { - JS_ASSERT(modifyCount_ == owner_->modifyCount_); + MOZ_ASSERT(modifyCount_ == owner_->modifyCount_); return static_cast(iter); } T * operator ->() const { - JS_ASSERT(modifyCount_ == owner_->modifyCount_); + MOZ_ASSERT(modifyCount_ == owner_->modifyCount_); return static_cast(iter); } bool operator !=(const InlineForwardListIterator &where) const { @@ -289,13 +289,13 @@ class InlineList : protected InlineListNode insertBeforeUnchecked(this, t); } T *popFront() { - JS_ASSERT(!empty()); + MOZ_ASSERT(!empty()); T *t = static_cast(this->next); remove(t); return t; } T *popBack() { - JS_ASSERT(!empty()); + MOZ_ASSERT(!empty()); T *t = static_cast(this->prev); remove(t); return t; @@ -306,8 +306,8 @@ class InlineList : protected InlineListNode return *iter; } void insertBefore(Node *at, Node *item) { - JS_ASSERT(item->prev == nullptr); - JS_ASSERT(item->next == nullptr); + MOZ_ASSERT(item->prev == nullptr); + MOZ_ASSERT(item->next == nullptr); insertBeforeUnchecked(at, item); } void insertBeforeUnchecked(Node *at, Node *item) { @@ -318,8 +318,8 @@ class InlineList : protected InlineListNode at->prev = item; } void insertAfter(Node *at, Node *item) { - JS_ASSERT(item->prev == nullptr); - JS_ASSERT(item->next == nullptr); + MOZ_ASSERT(item->prev == nullptr); + MOZ_ASSERT(item->next == nullptr); insertAfterUnchecked(at, item); } void insertAfterUnchecked(Node *at, Node *item) { @@ -481,10 +481,10 @@ class InlineConcatList void append(InlineConcatList *adding) { - JS_ASSERT(tail); - JS_ASSERT(!tail->next); - JS_ASSERT(adding->tail); - JS_ASSERT(!adding->tail->next); + MOZ_ASSERT(tail); + MOZ_ASSERT(!tail->next); + MOZ_ASSERT(adding->tail); + MOZ_ASSERT(!adding->tail->next); tail->next = adding; tail = adding->tail; diff --git a/js/src/jit/Ion.cpp b/js/src/jit/Ion.cpp index f5f30242d15a..0e951b43bb95 100644 --- a/js/src/jit/Ion.cpp +++ b/js/src/jit/Ion.cpp @@ -190,8 +190,8 @@ JitRuntime::~JitRuntime() bool JitRuntime::initialize(JSContext *cx) { - JS_ASSERT(cx->runtime()->currentThreadHasExclusiveAccess()); - JS_ASSERT(cx->runtime()->currentThreadOwnsInterruptLock()); + MOZ_ASSERT(cx->runtime()->currentThreadHasExclusiveAccess()); + MOZ_ASSERT(cx->runtime()->currentThreadOwnsInterruptLock()); AutoCompartment ac(cx, cx->atomsCompartment()); @@ -356,7 +356,7 @@ JitRuntime::freeOsrTempData() ExecutableAllocator * JitRuntime::createIonAlloc(JSContext *cx) { - JS_ASSERT(cx->runtime()->currentThreadOwnsInterruptLock()); + MOZ_ASSERT(cx->runtime()->currentThreadOwnsInterruptLock()); ionAlloc_ = js_new(); if (!ionAlloc_) @@ -367,7 +367,7 @@ JitRuntime::createIonAlloc(JSContext *cx) void JitRuntime::ensureIonCodeProtected(JSRuntime *rt) { - JS_ASSERT(rt->currentThreadOwnsInterruptLock()); + MOZ_ASSERT(rt->currentThreadOwnsInterruptLock()); if (!rt->signalHandlersInstalled() || ionCodeProtected_ || !ionAlloc_) return; @@ -388,7 +388,7 @@ JitRuntime::handleAccessViolation(JSRuntime *rt, void *faultingAddress) // code memory won't be accessed within, or call ensureIonCodeAccessible to // render the memory safe for accessing. Otherwise taking the lock below // will deadlock the process. - JS_ASSERT(!rt->currentThreadOwnsInterruptLock()); + MOZ_ASSERT(!rt->currentThreadOwnsInterruptLock()); // Taking this lock is necessary to prevent the interrupting thread from marking // the memory as inaccessible while we are patching backedges. This will cause us @@ -405,12 +405,12 @@ JitRuntime::handleAccessViolation(JSRuntime *rt, void *faultingAddress) void JitRuntime::ensureIonCodeAccessible(JSRuntime *rt) { - JS_ASSERT(rt->currentThreadOwnsInterruptLock()); + MOZ_ASSERT(rt->currentThreadOwnsInterruptLock()); // This can only be called on the main thread and while handling signals, // which happens on a separate thread in OS X. #ifndef XP_MACOSX - JS_ASSERT(CurrentThreadCanAccessRuntime(rt)); + MOZ_ASSERT(CurrentThreadCanAccessRuntime(rt)); #endif if (ionCodeProtected_) { @@ -433,7 +433,7 @@ void JitRuntime::patchIonBackedges(JSRuntime *rt, BackedgeTarget target) { #ifndef XP_MACOSX - JS_ASSERT(CurrentThreadCanAccessRuntime(rt)); + MOZ_ASSERT(CurrentThreadCanAccessRuntime(rt)); #endif // Patch all loop backedges in Ion code so that they either jump to the @@ -457,7 +457,7 @@ jit::RequestInterruptForIonCode(JSRuntime *rt, JSRuntime::InterruptMode mode) if (!jitRuntime) return; - JS_ASSERT(rt->currentThreadOwnsInterruptLock()); + MOZ_ASSERT(rt->currentThreadOwnsInterruptLock()); // The mechanism for interrupting normal ion code varies depending on how // the interrupt is being requested. @@ -467,7 +467,7 @@ jit::RequestInterruptForIonCode(JSRuntime *rt, JSRuntime::InterruptMode mode) // backedges can be patched directly. Make sure we don't segv while // patching the backedges, to avoid deadlocking inside the signal // handler. - JS_ASSERT(CurrentThreadCanAccessRuntime(rt)); + MOZ_ASSERT(CurrentThreadCanAccessRuntime(rt)); jitRuntime->ensureIonCodeAccessible(rt); break; @@ -664,7 +664,7 @@ jit::LazyLinkTopActivation(JSContext *cx) /* static */ void JitRuntime::Mark(JSTracer *trc) { - JS_ASSERT(!trc->runtime()->isHeapMinorCollecting()); + MOZ_ASSERT(!trc->runtime()->isHeapMinorCollecting()); Zone *zone = trc->runtime()->atomsCompartment()->zone(); for (gc::ZoneCellIterUnderGC i(zone, gc::FINALIZE_JITCODE); !i.done(); i.next()) { JitCode *code = i.get(); @@ -717,7 +717,7 @@ JitCompartment::sweep(FreeOp *fop, JSCompartment *compartment) // Cancel any active or pending off thread compilations. Note that the // MIR graph does not hold any nursery pointers, so there's no need to // do this for minor GCs. - JS_ASSERT(!fop->runtime()->isHeapMinorCollecting()); + MOZ_ASSERT(!fop->runtime()->isHeapMinorCollecting()); CancelOffThreadIonCompile(compartment, nullptr); FinishAllOffThreadCompilations(compartment); @@ -752,17 +752,17 @@ JitCompartment::sweep(FreeOp *fop, JSCompartment *compartment) JitCode * JitRuntime::getBailoutTable(const FrameSizeClass &frameClass) const { - JS_ASSERT(frameClass != FrameSizeClass::None()); + MOZ_ASSERT(frameClass != FrameSizeClass::None()); return bailoutTables_[frameClass.classId()]; } JitCode * JitRuntime::getVMWrapper(const VMFunction &f) const { - JS_ASSERT(functionWrappers_); - JS_ASSERT(functionWrappers_->initialized()); + MOZ_ASSERT(functionWrappers_); + MOZ_ASSERT(functionWrappers_->initialized()); JitRuntime::VMWrapperMap::Ptr p = functionWrappers_->readonlyThreadsafeLookup(&f); - JS_ASSERT(p); + MOZ_ASSERT(p); return p->value(); } @@ -838,11 +838,11 @@ JitCode::finalize(FreeOp *fop) { // Make sure this can't race with an interrupting thread, which may try // to read the contents of the pool we are releasing references in. - JS_ASSERT(fop->runtime()->currentThreadOwnsInterruptLock()); + MOZ_ASSERT(fop->runtime()->currentThreadOwnsInterruptLock()); // If this jitcode has a bytecode map, de-register it. if (hasBytecodeMap_) { - JS_ASSERT(fop->runtime()->jitRuntime()->hasJitcodeGlobalTable()); + MOZ_ASSERT(fop->runtime()->jitRuntime()->hasJitcodeGlobalTable()); fop->runtime()->jitRuntime()->getJitcodeGlobalTable()->removeEntry(raw()); } @@ -1081,7 +1081,7 @@ IonScript::copyRecovers(const RecoverWriter *writer) void IonScript::copySafepoints(const SafepointWriter *writer) { - JS_ASSERT(writer->size() == safepointsSize_); + MOZ_ASSERT(writer->size() == safepointsSize_); memcpy((uint8_t *)this + safepointsStart_, writer->buffer(), safepointsSize_); } @@ -1178,11 +1178,11 @@ IonScript::copyCacheEntries(const uint32_t *caches, MacroAssembler &masm) const SafepointIndex * IonScript::getSafepointIndex(uint32_t disp) const { - JS_ASSERT(safepointIndexEntries_ > 0); + MOZ_ASSERT(safepointIndexEntries_ > 0); const SafepointIndex *table = safepointIndices(); if (safepointIndexEntries_ == 1) { - JS_ASSERT(disp == table[0].displacement()); + MOZ_ASSERT(disp == table[0].displacement()); return &table[0]; } @@ -1192,7 +1192,7 @@ IonScript::getSafepointIndex(uint32_t disp) const uint32_t max = table[maxEntry].displacement(); // Raise if the element is not in the list. - JS_ASSERT(min <= disp && disp <= max); + MOZ_ASSERT(min <= disp && disp <= max); // Approximate the location of the FrameInfo. size_t guess = (disp - min) * (maxEntry - minEntry) / (max - min) + minEntry; @@ -1208,14 +1208,14 @@ IonScript::getSafepointIndex(uint32_t disp) const if (guessDisp > disp) { while (--guess >= minEntry) { guessDisp = table[guess].displacement(); - JS_ASSERT(guessDisp >= disp); + MOZ_ASSERT(guessDisp >= disp); if (guessDisp == disp) return &table[guess]; } } else { while (++guess <= maxEntry) { guessDisp = table[guess].displacement(); - JS_ASSERT(guessDisp <= disp); + MOZ_ASSERT(guessDisp <= disp); if (guessDisp == disp) return &table[guess]; } @@ -1244,7 +1244,7 @@ IonScript::getOsiIndex(uint8_t *retAddr) const JitSpew(JitSpew_IonInvalidate, "IonScript %p has method %p raw %p", (void *) this, (void *) method(), method()->raw()); - JS_ASSERT(containsCodeAddress(retAddr)); + MOZ_ASSERT(containsCodeAddress(retAddr)); uint32_t disp = retAddr - method()->raw(); return getOsiIndex(disp); } @@ -1927,7 +1927,7 @@ OffThreadCompilationAvailable(JSContext *cx) static void TrackAllProperties(JSContext *cx, JSObject *obj) { - JS_ASSERT(obj->hasSingletonType()); + MOZ_ASSERT(obj->hasSingletonType()); for (Shape::Range range(obj->lastProperty()); !range.empty(); range.popFront()) types::EnsureTrackPropertyTypes(cx, obj, range.front().propid()); @@ -1967,7 +1967,7 @@ IonCompile(JSContext *cx, JSScript *script, AutoTraceLog logScript(logger, TraceLogCreateTextId(logger, script)); AutoTraceLog logCompile(logger, TraceLogger::IonCompilation); - JS_ASSERT(optimizationLevel > Optimization_DontCompile); + MOZ_ASSERT(optimizationLevel > Optimization_DontCompile); // Make sure the script's canonical function isn't lazy. We can't de-lazify // it in a helper thread. @@ -2042,13 +2042,13 @@ IonCompile(JSContext *cx, JSScript *script, if (!builder) return AbortReason_Alloc; - JS_ASSERT(recompile == HasIonScript(builder->script(), executionMode)); - JS_ASSERT(CanIonCompile(builder->script(), executionMode)); + MOZ_ASSERT(recompile == HasIonScript(builder->script(), executionMode)); + MOZ_ASSERT(CanIonCompile(builder->script(), executionMode)); RootedScript builderScript(cx, builder->script()); if (recompile) { - JS_ASSERT(executionMode == SequentialExecution); + MOZ_ASSERT(executionMode == SequentialExecution); builderScript->ionScript()->setRecompiling(); } @@ -2108,8 +2108,8 @@ IonCompile(JSContext *cx, JSScript *script, static bool CheckFrame(BaselineFrame *frame) { - JS_ASSERT(!frame->isGeneratorFrame()); - JS_ASSERT(!frame->isDebuggerFrame()); + MOZ_ASSERT(!frame->isGeneratorFrame()); + MOZ_ASSERT(!frame->isDebuggerFrame()); // This check is to not overrun the stack. if (frame->isFunctionFrame()) { @@ -2185,7 +2185,7 @@ GetOptimizationLevel(HandleScript script, jsbytecode *pc, ExecutionMode executio if (executionMode == ParallelExecution) return Optimization_Normal; - JS_ASSERT(executionMode == SequentialExecution); + MOZ_ASSERT(executionMode == SequentialExecution); return js_IonOptimizations.levelForScript(script, pc); } @@ -2194,8 +2194,8 @@ static MethodStatus Compile(JSContext *cx, HandleScript script, BaselineFrame *osrFrame, jsbytecode *osrPc, bool constructing, ExecutionMode executionMode) { - JS_ASSERT(jit::IsIonEnabled(cx)); - JS_ASSERT(jit::IsBaselineEnabled(cx)); + MOZ_ASSERT(jit::IsIonEnabled(cx)); + MOZ_ASSERT(jit::IsBaselineEnabled(cx)); JS_ASSERT_IF(osrPc != nullptr, LoopEntryCanIonOsr(osrPc)); JS_ASSERT_IF(executionMode == ParallelExecution, !osrFrame && !osrPc); JS_ASSERT_IF(executionMode == ParallelExecution, !HasIonScript(script, executionMode)); @@ -2292,9 +2292,9 @@ Compile(JSContext *cx, HandleScript script, BaselineFrame *osrFrame, jsbytecode MethodStatus jit::CanEnterAtBranch(JSContext *cx, JSScript *script, BaselineFrame *osrFrame, jsbytecode *pc) { - JS_ASSERT(jit::IsIonEnabled(cx)); - JS_ASSERT((JSOp)*pc == JSOP_LOOPENTRY); - JS_ASSERT(LoopEntryCanIonOsr(pc)); + MOZ_ASSERT(jit::IsIonEnabled(cx)); + MOZ_ASSERT((JSOp)*pc == JSOP_LOOPENTRY); + MOZ_ASSERT(LoopEntryCanIonOsr(pc)); // Skip if the script has been disabled. if (!script->canIonCompile()) @@ -2338,7 +2338,7 @@ jit::CanEnterAtBranch(JSContext *cx, JSScript *script, BaselineFrame *osrFrame, MethodStatus jit::CanEnter(JSContext *cx, RunState &state) { - JS_ASSERT(jit::IsIonEnabled(cx)); + MOZ_ASSERT(jit::IsIonEnabled(cx)); JSScript *script = state.script(); @@ -2406,11 +2406,11 @@ jit::CanEnter(JSContext *cx, RunState &state) MethodStatus jit::CompileFunctionForBaseline(JSContext *cx, HandleScript script, BaselineFrame *frame) { - JS_ASSERT(jit::IsIonEnabled(cx)); - JS_ASSERT(frame->fun()->nonLazyScript()->canIonCompile()); - JS_ASSERT(!frame->fun()->nonLazyScript()->isIonCompilingOffThread()); - JS_ASSERT(!frame->fun()->nonLazyScript()->hasIonScript()); - JS_ASSERT(frame->isFunctionFrame()); + MOZ_ASSERT(jit::IsIonEnabled(cx)); + MOZ_ASSERT(frame->fun()->nonLazyScript()->canIonCompile()); + MOZ_ASSERT(!frame->fun()->nonLazyScript()->isIonCompilingOffThread()); + MOZ_ASSERT(!frame->fun()->nonLazyScript()->hasIonScript()); + MOZ_ASSERT(frame->isFunctionFrame()); // Mark as forbidden if frame can't be handled. if (!CheckFrame(frame)) { @@ -2434,7 +2434,7 @@ MethodStatus jit::Recompile(JSContext *cx, HandleScript script, BaselineFrame *osrFrame, jsbytecode *osrPc, bool constructing) { - JS_ASSERT(script->hasIonScript()); + MOZ_ASSERT(script->hasIonScript()); if (script->ionScript()->isRecompiling()) return Method_Compiled; @@ -2495,7 +2495,7 @@ jit::CanEnterInParallel(JSContext *cx, HandleScript script) MethodStatus jit::CanEnterUsingFastInvoke(JSContext *cx, HandleScript script, uint32_t numActualArgs) { - JS_ASSERT(jit::IsIonEnabled(cx)); + MOZ_ASSERT(jit::IsIonEnabled(cx)); // Skip if the code is expected to result in a bailout. if (!script->hasIonScript() || script->ionScript()->bailoutExpected()) @@ -2523,8 +2523,8 @@ static IonExecStatus EnterIon(JSContext *cx, EnterJitData &data) { JS_CHECK_RECURSION(cx, return IonExec_Aborted); - JS_ASSERT(jit::IsIonEnabled(cx)); - JS_ASSERT(!data.osrFrame); + MOZ_ASSERT(jit::IsIonEnabled(cx)); + MOZ_ASSERT(!data.osrFrame); EnterJitCode enter = cx->runtime()->jitRuntime()->enterIon(); @@ -2540,7 +2540,7 @@ EnterIon(JSContext *cx, EnterJitData &data) /* scopeChain = */ nullptr, 0, data.result.address()); } - JS_ASSERT(!cx->runtime()->jitRuntime()->hasIonReturnOverride()); + MOZ_ASSERT(!cx->runtime()->jitRuntime()->hasIonReturnOverride()); // Jit callers wrap primitive constructor return. if (!data.result.isMagic() && data.constructing && data.result.isPrimitive()) @@ -2581,7 +2581,7 @@ jit::SetEnterJitData(JSContext *cx, EnterJitData &data, RunState &state, AutoVal return false; } - JS_ASSERT(vals.length() >= numFormals + 1); + MOZ_ASSERT(vals.length() >= numFormals + 1); data.maxArgv = vals.begin(); } } else { @@ -2634,8 +2634,8 @@ jit::FastInvoke(JSContext *cx, HandleFunction fun, CallArgs &args) JitCode *code = ion->method(); void *jitcode = code->raw(); - JS_ASSERT(jit::IsIonEnabled(cx)); - JS_ASSERT(!ion->bailoutExpected()); + MOZ_ASSERT(jit::IsIonEnabled(cx)); + MOZ_ASSERT(!ion->bailoutExpected()); JitActivation activation(cx); @@ -2643,12 +2643,12 @@ jit::FastInvoke(JSContext *cx, HandleFunction fun, CallArgs &args) void *calleeToken = CalleeToToken(fun, /* constructing = */ false); RootedValue result(cx, Int32Value(args.length())); - JS_ASSERT(args.length() >= fun->nargs()); + MOZ_ASSERT(args.length() >= fun->nargs()); CALL_GENERATED_CODE(enter, jitcode, args.length() + 1, args.array() - 1, /* osrFrame = */nullptr, calleeToken, /* scopeChain = */ nullptr, 0, result.address()); - JS_ASSERT(!cx->runtime()->jitRuntime()->hasIonReturnOverride()); + MOZ_ASSERT(!cx->runtime()->jitRuntime()->hasIonReturnOverride()); args.rval().set(result); @@ -2674,7 +2674,7 @@ InvalidateActivation(FreeOp *fop, uint8_t *jitTop, bool invalidateAll) case JitFrame_BaselineJS: case JitFrame_IonJS: { - JS_ASSERT(it.isScripted()); + MOZ_ASSERT(it.isScripted()); const char *type = it.isIonJS() ? "Optimized" : "Baseline"; JitSpew(JitSpew_IonInvalidate, "#%d %s JS frame @ %p, %s:%d (fun: %p, script: %p, pc %p)", frameno, type, it.fp(), it.script()->filename(), it.script()->lineno(), @@ -2893,7 +2893,7 @@ jit::Invalidate(types::TypeZone &types, FreeOp *fop, // Make sure we didn't leak references by invalidating the same IonScript // multiple times in the above loop. - JS_ASSERT(!numInvalidations); + MOZ_ASSERT(!numInvalidations); } void @@ -2919,7 +2919,7 @@ bool jit::Invalidate(JSContext *cx, JSScript *script, ExecutionMode mode, bool resetUses, bool cancelOffThread) { - JS_ASSERT(script->hasIonScript()); + MOZ_ASSERT(script->hasIonScript()); if (cx->runtime()->spsProfiler.enabled()) { // Register invalidation with profiler. @@ -2946,12 +2946,12 @@ jit::Invalidate(JSContext *cx, JSScript *script, ExecutionMode mode, bool resetU switch (mode) { case SequentialExecution: - JS_ASSERT(script->hasIonScript()); + MOZ_ASSERT(script->hasIonScript()); if (!scripts.append(script->ionScript()->recompileInfo())) return false; break; case ParallelExecution: - JS_ASSERT(script->hasParallelIonScript()); + MOZ_ASSERT(script->hasParallelIonScript()); if (!scripts.append(script->parallelIonScript()->recompileInfo())) return false; break; @@ -3086,8 +3086,8 @@ AutoFlushICache::setRange(uintptr_t start, size_t len) { #if defined(JS_CODEGEN_ARM) || defined(JS_CODEGEN_MIPS) AutoFlushICache *afc = TlsPerThreadData.get()->PerThreadData::autoFlushICache(); - JS_ASSERT(afc); - JS_ASSERT(!afc->start_); + MOZ_ASSERT(afc); + MOZ_ASSERT(!afc->start_); JitSpewCont(JitSpew_CacheFlush, "(%x %x):", start, len); uintptr_t stop = start + len; @@ -3123,7 +3123,7 @@ AutoFlushICache::flush(uintptr_t start, size_t len) if (!afc) { JitSpewCont(JitSpew_CacheFlush, "#"); ExecutableAllocator::cacheFlush((void*)start, len); - JS_ASSERT(len <= 16); + MOZ_ASSERT(len <= 16); return; } @@ -3146,8 +3146,8 @@ AutoFlushICache::setInhibit() { #if defined(JS_CODEGEN_ARM) || defined(JS_CODEGEN_MIPS) AutoFlushICache *afc = TlsPerThreadData.get()->PerThreadData::autoFlushICache(); - JS_ASSERT(afc); - JS_ASSERT(afc->start_); + MOZ_ASSERT(afc); + MOZ_ASSERT(afc->start_); JitSpewCont(JitSpew_CacheFlush, "I"); afc->inhibit_ = true; #endif @@ -3195,7 +3195,7 @@ AutoFlushICache::~AutoFlushICache() { #if defined(JS_CODEGEN_ARM) || defined(JS_CODEGEN_MIPS) PerThreadData *pt = TlsPerThreadData.get(); - JS_ASSERT(pt->PerThreadData::autoFlushICache() == this); + MOZ_ASSERT(pt->PerThreadData::autoFlushICache() == this); if (!inhibit_ && start_) ExecutableAllocator::cacheFlush((void *)start_, size_t(stop_ - start_)); diff --git a/js/src/jit/IonAllocPolicy.h b/js/src/jit/IonAllocPolicy.h index 558daffef4bf..99b204757cfc 100644 --- a/js/src/jit/IonAllocPolicy.h +++ b/js/src/jit/IonAllocPolicy.h @@ -133,7 +133,7 @@ class AutoIonContextAlloc } ~AutoIonContextAlloc() { - JS_ASSERT(icx_->temp == &tempAlloc_); + MOZ_ASSERT(icx_->temp == &tempAlloc_); icx_->temp = prevAlloc_; } }; @@ -162,11 +162,11 @@ class TempObjectPool : alloc_(nullptr) {} void setAllocator(TempAllocator &alloc) { - JS_ASSERT(freed_.empty()); + MOZ_ASSERT(freed_.empty()); alloc_ = &alloc; } T *allocate() { - JS_ASSERT(alloc_); + MOZ_ASSERT(alloc_); if (freed_.empty()) return new(*alloc_) T(); return freed_.popFront(); diff --git a/js/src/jit/IonAnalysis.cpp b/js/src/jit/IonAnalysis.cpp index 1401b2bc2ca3..b67db7e8833b 100644 --- a/js/src/jit/IonAnalysis.cpp +++ b/js/src/jit/IonAnalysis.cpp @@ -145,26 +145,26 @@ UpdateTestSuccessors(TempAllocator &alloc, MBasicBlock *block, MInstruction *ins = block->lastIns(); if (ins->isTest()) { MTest *test = ins->toTest(); - JS_ASSERT(test->input() == value); + MOZ_ASSERT(test->input() == value); if (ifTrue != test->ifTrue()) { test->ifTrue()->removePredecessor(block); ifTrue->addPredecessorSameInputsAs(block, existingPred); - JS_ASSERT(test->ifTrue() == test->getSuccessor(0)); + MOZ_ASSERT(test->ifTrue() == test->getSuccessor(0)); test->replaceSuccessor(0, ifTrue); } if (ifFalse != test->ifFalse()) { test->ifFalse()->removePredecessor(block); ifFalse->addPredecessorSameInputsAs(block, existingPred); - JS_ASSERT(test->ifFalse() == test->getSuccessor(1)); + MOZ_ASSERT(test->ifFalse() == test->getSuccessor(1)); test->replaceSuccessor(1, ifFalse); } return; } - JS_ASSERT(ins->isGoto()); + MOZ_ASSERT(ins->isGoto()); ins->toGoto()->target()->removePredecessor(block); block->discardLastIns(); @@ -403,7 +403,7 @@ EliminateTriviallyDeadResumePointOperands(MIRGraph &graph, MResumePoint *rp) return; size_t top = rp->stackDepth() - 1; - JS_ASSERT(!rp->isObservableOperand(top)); + MOZ_ASSERT(!rp->isObservableOperand(top)); MDefinition *def = rp->getOperand(top); if (def->isConstant()) @@ -686,7 +686,7 @@ jit::EliminatePhis(MIRGenerator *mir, MIRGraph &graph, return false; MPhi *phi = worklist.popCopy(); - JS_ASSERT(phi->isUnused()); + MOZ_ASSERT(phi->isUnused()); phi->setNotInWorklist(); // The removal of Phis can produce newly redundant phis. @@ -866,7 +866,7 @@ GuessPhiType(MPhi *phi, bool *hasInputsWithEmptyTypes) if (type == MIRType_None && !hasPhiInputs) { // All inputs are non-phis with empty typesets. Use MIRType_Value // in this case, as it's impossible to get better type information. - JS_ASSERT(*hasInputsWithEmptyTypes); + MOZ_ASSERT(*hasInputsWithEmptyTypes); type = MIRType_Value; } @@ -885,7 +885,7 @@ TypeAnalyzer::respecialize(MPhi *phi, MIRType type) bool TypeAnalyzer::propagateSpecialization(MPhi *phi) { - JS_ASSERT(phi->type() != MIRType_None); + MOZ_ASSERT(phi->type() != MIRType_None); // Verify that this specialization matches any phis depending on it. for (MUseDefIterator iter(phi); iter; iter++) { @@ -993,7 +993,7 @@ void TypeAnalyzer::adjustPhiInputs(MPhi *phi) { MIRType phiType = phi->type(); - JS_ASSERT(phiType != MIRType_None); + MOZ_ASSERT(phiType != MIRType_None); // If we specialized a type that's not Value, there are 3 cases: // 1. Every input is of that type. @@ -1182,7 +1182,7 @@ TypeAnalyzer::insertConversions() bool TypeAnalyzer::markPhiConsumers() { - JS_ASSERT(phiWorklist_.empty()); + MOZ_ASSERT(phiWorklist_.empty()); // Iterate in postorder so worklist is initialized to RPO. for (PostorderIterator block(graph.poBegin()); block != graph.poEnd(); ++block) { @@ -1190,7 +1190,7 @@ TypeAnalyzer::markPhiConsumers() return false; for (MPhiIterator phi(block->phisBegin()); phi != block->phisEnd(); ++phi) { - JS_ASSERT(!phi->isInWorklist()); + MOZ_ASSERT(!phi->isInWorklist()); bool canConsumeFloat32 = true; for (MUseDefIterator use(*phi); canConsumeFloat32 && use; use++) { MDefinition *usedef = use.def(); @@ -1207,7 +1207,7 @@ TypeAnalyzer::markPhiConsumers() return false; MPhi *phi = popPhi(); - JS_ASSERT(phi->canConsumeFloat32(nullptr /* unused */)); + MOZ_ASSERT(phi->canConsumeFloat32(nullptr /* unused */)); bool validConsumer = true; for (MUseDefIterator use(phi); use; use++) { @@ -1238,7 +1238,7 @@ TypeAnalyzer::markPhiConsumers() bool TypeAnalyzer::markPhiProducers() { - JS_ASSERT(phiWorklist_.empty()); + MOZ_ASSERT(phiWorklist_.empty()); // Iterate in reverse postorder so worklist is initialized to PO. for (ReversePostorderIterator block(graph.rpoBegin()); block != graph.rpoEnd(); ++block) { @@ -1246,7 +1246,7 @@ TypeAnalyzer::markPhiProducers() return false; for (MPhiIterator phi(block->phisBegin()); phi != block->phisEnd(); ++phi) { - JS_ASSERT(!phi->isInWorklist()); + MOZ_ASSERT(!phi->isInWorklist()); bool canProduceFloat32 = true; for (size_t i = 0, e = phi->numOperands(); canProduceFloat32 && i < e; ++i) { MDefinition *input = phi->getOperand(i); @@ -1263,7 +1263,7 @@ TypeAnalyzer::markPhiProducers() return false; MPhi *phi = popPhi(); - JS_ASSERT(phi->canProduceFloat32()); + MOZ_ASSERT(phi->canProduceFloat32()); bool validProducer = true; for (size_t i = 0, e = phi->numOperands(); i < e; ++i) { @@ -1366,7 +1366,7 @@ TypeAnalyzer::checkFloatCoherency() for (MUseDefIterator use(*def); use; use++) { MDefinition *consumer = use.def(); - JS_ASSERT(consumer->isConsistentFloat32Use(use.use())); + MOZ_ASSERT(consumer->isConsistentFloat32Use(use.use())); } } } @@ -1417,7 +1417,7 @@ jit::MakeMRegExpHoistable(MIRGraph &graph) if (i->consumer()->isResumePoint()) continue; - JS_ASSERT(i->consumer()->isDefinition()); + MOZ_ASSERT(i->consumer()->isDefinition()); // All MRegExp* MIR's don't adjust the regexp. MDefinition *use = i->consumer()->toDefinition(); @@ -1442,7 +1442,7 @@ jit::MakeMRegExpHoistable(MIRGraph &graph) // Therefore setting the lastIndex to 0. That is faster than a not movable regexp. RegExpObject *source = regexp->source(); if (source->sticky() || source->global()) { - JS_ASSERT(regexp->mustClone()); + MOZ_ASSERT(regexp->mustClone()); MConstant *zero = MConstant::New(graph.alloc(), Int32Value(0)); regexp->block()->insertAfter(regexp, zero); @@ -1530,8 +1530,8 @@ IntersectDominators(MBasicBlock *block1, MBasicBlock *block2) MBasicBlock *finger1 = block1; MBasicBlock *finger2 = block2; - JS_ASSERT(finger1); - JS_ASSERT(finger2); + MOZ_ASSERT(finger1); + MOZ_ASSERT(finger2); // In the original paper, the block ID comparisons are on the postorder index. // This implementation iterates in RPO, so the comparisons are reversed. @@ -1627,7 +1627,7 @@ ComputeImmediateDominators(MIRGraph &graph) #ifdef DEBUG // Assert that all blocks have dominator information. for (MBasicBlockIterator block(graph.begin()); block != graph.end(); block++) { - JS_ASSERT(block->immediateDominator() != nullptr); + MOZ_ASSERT(block->immediateDominator() != nullptr); } #endif } @@ -1670,7 +1670,7 @@ jit::BuildDominatorTree(MIRGraph &graph) // If compiling with OSR, many blocks will self-dominate. // Without OSR, there is only one root block which dominates all. if (!graph.osrBlock()) - JS_ASSERT(graph.entryBlock()->numDominated() == graph.numBlocks()); + MOZ_ASSERT(graph.entryBlock()->numDominated() == graph.numBlocks()); #endif // Now, iterate through the dominator tree in pre-order and annotate every // block with its index in the traversal. @@ -1726,7 +1726,7 @@ jit::BuildPhiReverseMapping(MIRGraph &graph) if (!successor->phisEmpty()) numSuccessorsWithPhis++; } - JS_ASSERT(numSuccessorsWithPhis <= 1); + MOZ_ASSERT(numSuccessorsWithPhis <= 1); #endif pred->setSuccessorWithPhis(*block, j); @@ -1790,35 +1790,35 @@ void jit::AssertBasicGraphCoherency(MIRGraph &graph) { #ifdef DEBUG - JS_ASSERT(graph.entryBlock()->numPredecessors() == 0); - JS_ASSERT(graph.entryBlock()->phisEmpty()); - JS_ASSERT(!graph.entryBlock()->unreachable()); + MOZ_ASSERT(graph.entryBlock()->numPredecessors() == 0); + MOZ_ASSERT(graph.entryBlock()->phisEmpty()); + MOZ_ASSERT(!graph.entryBlock()->unreachable()); if (MBasicBlock *osrBlock = graph.osrBlock()) { - JS_ASSERT(osrBlock->numPredecessors() == 0); - JS_ASSERT(osrBlock->phisEmpty()); - JS_ASSERT(osrBlock != graph.entryBlock()); - JS_ASSERT(!osrBlock->unreachable()); + MOZ_ASSERT(osrBlock->numPredecessors() == 0); + MOZ_ASSERT(osrBlock->phisEmpty()); + MOZ_ASSERT(osrBlock != graph.entryBlock()); + MOZ_ASSERT(!osrBlock->unreachable()); } if (MResumePoint *resumePoint = graph.entryResumePoint()) - JS_ASSERT(resumePoint->block() == graph.entryBlock()); + MOZ_ASSERT(resumePoint->block() == graph.entryBlock()); // Assert successor and predecessor list coherency. uint32_t count = 0; for (MBasicBlockIterator block(graph.begin()); block != graph.end(); block++) { count++; - JS_ASSERT(&block->graph() == &graph); + MOZ_ASSERT(&block->graph() == &graph); MOZ_ASSERT(!block->isDead()); MOZ_ASSERT_IF(block->outerResumePoint() != nullptr, block->entryResumePoint() != nullptr); for (size_t i = 0; i < block->numSuccessors(); i++) - JS_ASSERT(CheckSuccessorImpliesPredecessor(*block, block->getSuccessor(i))); + MOZ_ASSERT(CheckSuccessorImpliesPredecessor(*block, block->getSuccessor(i))); for (size_t i = 0; i < block->numPredecessors(); i++) - JS_ASSERT(CheckPredecessorImpliesSuccessor(*block, block->getPredecessor(i))); + MOZ_ASSERT(CheckPredecessorImpliesSuccessor(*block, block->getPredecessor(i))); if (block->entryResumePoint()) { MOZ_ASSERT(!block->entryResumePoint()->instruction()); @@ -1839,12 +1839,12 @@ jit::AssertBasicGraphCoherency(MIRGraph &graph) } } for (MPhiIterator phi(block->phisBegin()); phi != block->phisEnd(); phi++) { - JS_ASSERT(phi->numOperands() == block->numPredecessors()); + MOZ_ASSERT(phi->numOperands() == block->numPredecessors()); MOZ_ASSERT(!phi->isRecoveredOnBailout()); MOZ_ASSERT(phi->type() != MIRType_None); } for (MDefinitionIterator iter(*block); iter; iter++) { - JS_ASSERT(iter->block() == *block); + MOZ_ASSERT(iter->block() == *block); MOZ_ASSERT_IF(iter->hasUses(), iter->type() != MIRType_None); MOZ_ASSERT(!iter->isDiscarded()); MOZ_ASSERT_IF(iter->isStart(), @@ -1856,9 +1856,9 @@ jit::AssertBasicGraphCoherency(MIRGraph &graph) // Assert that use chains are valid for this instruction. for (uint32_t i = 0, end = iter->numOperands(); i < end; i++) - JS_ASSERT(CheckOperandImpliesUse(*iter, iter->getOperand(i))); + MOZ_ASSERT(CheckOperandImpliesUse(*iter, iter->getOperand(i))); for (MUseIterator use(iter->usesBegin()); use != iter->usesEnd(); use++) - JS_ASSERT(CheckUseImpliesOperand(*iter, *use)); + MOZ_ASSERT(CheckUseImpliesOperand(*iter, *use)); if (iter->isInstruction()) { if (MResumePoint *resume = iter->toInstruction()->resumePoint()) { @@ -1883,7 +1883,7 @@ jit::AssertBasicGraphCoherency(MIRGraph &graph) MOZ_ASSERT(CheckOperandImpliesUse(control, control->getOperand(i))); } - JS_ASSERT(graph.numBlocks() == count); + MOZ_ASSERT(graph.numBlocks() == count); #endif } @@ -1894,13 +1894,13 @@ AssertReversePostorder(MIRGraph &graph) // Check that every block is visited after all its predecessors (except backedges). for (ReversePostorderIterator iter(graph.rpoBegin()); iter != graph.rpoEnd(); ++iter) { MBasicBlock *block = *iter; - JS_ASSERT(!block->isMarked()); + MOZ_ASSERT(!block->isMarked()); for (size_t i = 0; i < block->numPredecessors(); i++) { MBasicBlock *pred = block->getPredecessor(i); if (!pred->isMarked()) { - JS_ASSERT(pred->isLoopBackedge()); - JS_ASSERT(block->backedge() == pred); + MOZ_ASSERT(pred->isLoopBackedge()); + MOZ_ASSERT(block->backedge() == pred); } } @@ -1917,20 +1917,20 @@ AssertDominatorTree(MIRGraph &graph) { // Check dominators. - JS_ASSERT(graph.entryBlock()->immediateDominator() == graph.entryBlock()); + MOZ_ASSERT(graph.entryBlock()->immediateDominator() == graph.entryBlock()); if (MBasicBlock *osrBlock = graph.osrBlock()) - JS_ASSERT(osrBlock->immediateDominator() == osrBlock); + MOZ_ASSERT(osrBlock->immediateDominator() == osrBlock); else - JS_ASSERT(graph.entryBlock()->numDominated() == graph.numBlocks()); + MOZ_ASSERT(graph.entryBlock()->numDominated() == graph.numBlocks()); size_t i = graph.numBlocks(); size_t totalNumDominated = 0; for (MBasicBlockIterator block(graph.begin()); block != graph.end(); block++) { - JS_ASSERT(block->dominates(*block)); + MOZ_ASSERT(block->dominates(*block)); MBasicBlock *idom = block->immediateDominator(); - JS_ASSERT(idom->dominates(*block)); - JS_ASSERT(idom == *block || idom->id() < block->id()); + MOZ_ASSERT(idom->dominates(*block)); + MOZ_ASSERT(idom == *block || idom->id() < block->id()); if (idom == *block) { totalNumDominated += block->numDominated(); @@ -1942,25 +1942,25 @@ AssertDominatorTree(MIRGraph &graph) break; } } - JS_ASSERT(foundInParent); + MOZ_ASSERT(foundInParent); } size_t numDominated = 1; for (size_t j = 0; j < block->numImmediatelyDominatedBlocks(); j++) { MBasicBlock *dom = block->getImmediatelyDominatedBlock(j); - JS_ASSERT(block->dominates(dom)); - JS_ASSERT(dom->id() > block->id()); - JS_ASSERT(dom->immediateDominator() == *block); + MOZ_ASSERT(block->dominates(dom)); + MOZ_ASSERT(dom->id() > block->id()); + MOZ_ASSERT(dom->immediateDominator() == *block); numDominated += dom->numDominated(); } - JS_ASSERT(block->numDominated() == numDominated); - JS_ASSERT(block->numDominated() <= i); - JS_ASSERT(block->numSuccessors() != 0 || block->numDominated() == 1); + MOZ_ASSERT(block->numDominated() == numDominated); + MOZ_ASSERT(block->numDominated() <= i); + MOZ_ASSERT(block->numSuccessors() != 0 || block->numDominated() == 1); i--; } - JS_ASSERT(i == 0); - JS_ASSERT(totalNumDominated == graph.numBlocks()); + MOZ_ASSERT(i == 0); + MOZ_ASSERT(totalNumDominated == graph.numBlocks()); } #endif @@ -1992,26 +1992,26 @@ jit::AssertExtendedGraphCoherency(MIRGraph &graph) uint32_t idx = 0; for (MBasicBlockIterator block(graph.begin()); block != graph.end(); block++) { - JS_ASSERT(block->id() == idx++); + MOZ_ASSERT(block->id() == idx++); // No critical edges: if (block->numSuccessors() > 1) for (size_t i = 0; i < block->numSuccessors(); i++) - JS_ASSERT(block->getSuccessor(i)->numPredecessors() == 1); + MOZ_ASSERT(block->getSuccessor(i)->numPredecessors() == 1); if (block->isLoopHeader()) { - JS_ASSERT(block->numPredecessors() == 2); + MOZ_ASSERT(block->numPredecessors() == 2); MBasicBlock *backedge = block->getPredecessor(1); - JS_ASSERT(backedge->id() >= block->id()); - JS_ASSERT(backedge->numSuccessors() == 1); - JS_ASSERT(backedge->getSuccessor(0) == *block); + MOZ_ASSERT(backedge->id() >= block->id()); + MOZ_ASSERT(backedge->numSuccessors() == 1); + MOZ_ASSERT(backedge->getSuccessor(0) == *block); } if (!block->phisEmpty()) { for (size_t i = 0; i < block->numPredecessors(); i++) { MBasicBlock *pred = block->getPredecessor(i); - JS_ASSERT(pred->successorWithPhis() == *block); - JS_ASSERT(pred->positionInPhiSuccessor() == i); + MOZ_ASSERT(pred->successorWithPhis() == *block); + MOZ_ASSERT(pred->positionInPhiSuccessor() == i); } } @@ -2020,8 +2020,8 @@ jit::AssertExtendedGraphCoherency(MIRGraph &graph) if (!block->getSuccessor(i)->phisEmpty()) successorWithPhis++; - JS_ASSERT(successorWithPhis <= 1); - JS_ASSERT((successorWithPhis != 0) == (block->successorWithPhis() != nullptr)); + MOZ_ASSERT(successorWithPhis <= 1); + MOZ_ASSERT((successorWithPhis != 0) == (block->successorWithPhis() != nullptr)); // Verify that phi operands dominate the corresponding CFG predecessor // edges. @@ -2125,7 +2125,7 @@ jit::ExtractLinearSum(MDefinition *ins) if (ins->isConstant()) { const Value &v = ins->toConstant()->value(); - JS_ASSERT(v.isInt32()); + MOZ_ASSERT(v.isInt32()); return SimpleLinearSum(nullptr, v.toInt32()); } else if (ins->isAdd() || ins->isSub()) { MDefinition *lhs = ins->getOperand(0); @@ -2173,8 +2173,8 @@ jit::ExtractLinearInequality(MTest *test, BranchDirection direction, if (!compare->isInt32Comparison()) return false; - JS_ASSERT(lhs->type() == MIRType_Int32); - JS_ASSERT(rhs->type() == MIRType_Int32); + MOZ_ASSERT(lhs->type() == MIRType_Int32); + MOZ_ASSERT(rhs->type() == MIRType_Int32); JSOp jsop = compare->jsop(); if (direction == FALSE_BRANCH) @@ -2219,7 +2219,7 @@ jit::ExtractLinearInequality(MTest *test, BranchDirection direction, static bool TryEliminateBoundsCheck(BoundsCheckMap &checks, size_t blockIndex, MBoundsCheck *dominated, bool *eliminated) { - JS_ASSERT(!*eliminated); + MOZ_ASSERT(!*eliminated); // Replace all uses of the bounds check with the actual index. // This is (a) necessary, because we can coalesce two different @@ -2283,7 +2283,7 @@ static void TryEliminateTypeBarrierFromTest(MTypeBarrier *barrier, bool filtersNull, bool filtersUndefined, MTest *test, BranchDirection direction, bool *eliminated) { - JS_ASSERT(filtersNull || filtersUndefined); + MOZ_ASSERT(filtersNull || filtersUndefined); // Watch for code patterns similar to 'if (x.f) { ... = x.f }'. If x.f // is either an object or null/undefined, there will be a type barrier on @@ -2336,7 +2336,7 @@ TryEliminateTypeBarrierFromTest(MTypeBarrier *barrier, bool filtersNull, bool fi static bool TryEliminateTypeBarrier(MTypeBarrier *barrier, bool *eliminated) { - JS_ASSERT(!*eliminated); + MOZ_ASSERT(!*eliminated); const types::TemporaryTypeSet *barrierTypes = barrier->resultTypeSet(); const types::TemporaryTypeSet *inputTypes = barrier->input()->resultTypeSet(); @@ -2455,7 +2455,7 @@ jit::EliminateRedundantChecks(MIRGraph &graph) index++; } - JS_ASSERT(index == graph.numBlocks()); + MOZ_ASSERT(index == graph.numBlocks()); return true; } @@ -2488,7 +2488,7 @@ LinearSum::add(const LinearSum &other, int32_t scale /* = 1 */) bool LinearSum::add(MDefinition *term, int32_t scale) { - JS_ASSERT(term); + MOZ_ASSERT(term); if (scale == 0) return true; @@ -2528,7 +2528,7 @@ LinearSum::print(Sprinter &sp) const for (size_t i = 0; i < terms_.length(); i++) { int32_t scale = terms_[i].scale; int32_t id = terms_[i].term->id(); - JS_ASSERT(scale); + MOZ_ASSERT(scale); if (scale > 0) { if (i) sp.printf("+"); @@ -2570,7 +2570,7 @@ jit::ConvertLinearSum(TempAllocator &alloc, MBasicBlock *block, const LinearSum for (size_t i = 0; i < sum.numTerms(); i++) { LinearTerm term = sum.term(i); - JS_ASSERT(!term.term->isConstant()); + MOZ_ASSERT(!term.term->isConstant()); if (term.scale == 1) { if (def) { def = MAdd::New(alloc, def, term.term); @@ -2591,7 +2591,7 @@ jit::ConvertLinearSum(TempAllocator &alloc, MBasicBlock *block, const LinearSum block->insertAtEnd(def->toInstruction()); def->computeRange(alloc); } else { - JS_ASSERT(term.scale != 0); + MOZ_ASSERT(term.scale != 0); MConstant *factor = MConstant::New(alloc, Int32Value(term.scale)); block->insertAtEnd(factor); MMul *mul = MMul::New(alloc, term.term, factor); @@ -2744,11 +2744,11 @@ AnalyzePoppedThis(JSContext *cx, types::TypeObject *type, // Add the property to the object, being careful not to update type information. DebugOnly slotSpan = baseobj->slotSpan(); - JS_ASSERT(!baseobj->nativeContainsPure(id)); + MOZ_ASSERT(!baseobj->nativeContainsPure(id)); if (!baseobj->addDataProperty(cx, id, baseobj->slotSpan(), JSPROP_ENUMERATE)) return false; - JS_ASSERT(baseobj->slotSpan() != slotSpan); - JS_ASSERT(!baseobj->inDictionaryMode()); + MOZ_ASSERT(baseobj->slotSpan() != slotSpan); + MOZ_ASSERT(!baseobj->inDictionaryMode()); Vector callerResumePoints(cx); for (MResumePoint *rp = ins->block()->callerResumePoint(); @@ -2826,7 +2826,7 @@ jit::AnalyzeNewScriptDefiniteProperties(JSContext *cx, JSFunction *fun, types::TypeObject *type, HandleObject baseobj, Vector *initializerList) { - JS_ASSERT(cx->compartment()->activeAnalysis); + MOZ_ASSERT(cx->compartment()->activeAnalysis); // When invoking 'new' on the specified script, try to find some properties // which will definitely be added to the created object before it has a @@ -2975,7 +2975,7 @@ jit::AnalyzeNewScriptDefiniteProperties(JSContext *cx, JSFunction *fun, break; if (slotSpan != baseobj->slotSpan()) { - JS_ASSERT(ins->block()->id() >= lastAddedBlock); + MOZ_ASSERT(ins->block()->id() >= lastAddedBlock); lastAddedBlock = ins->block()->id(); } } @@ -3047,7 +3047,7 @@ jit::AnalyzeArgumentsUsage(JSContext *cx, JSScript *scriptArg) RootedScript script(cx, scriptArg); types::AutoEnterAnalysis enter(cx); - JS_ASSERT(!script->analyzedArgsUsage()); + MOZ_ASSERT(!script->analyzedArgsUsage()); // Treat the script as needing an arguments object until we determine it // does not need one. This both allows us to easily see where the arguments diff --git a/js/src/jit/IonBuilder.cpp b/js/src/jit/IonBuilder.cpp index 48880345043f..ab923a7cb0d2 100644 --- a/js/src/jit/IonBuilder.cpp +++ b/js/src/jit/IonBuilder.cpp @@ -57,7 +57,7 @@ class jit::BaselineFrameInspector BaselineFrameInspector * jit::NewBaselineFrameInspector(TempAllocator *temp, BaselineFrame *frame, CompileInfo *info) { - JS_ASSERT(frame); + MOZ_ASSERT(frame); BaselineFrameInspector *inspector = temp->lifoAlloc()->new_(temp); if (!inspector) @@ -148,8 +148,8 @@ IonBuilder::IonBuilder(JSContext *analysisContext, CompileCompartment *comp, pc = info->startPC(); abortReason_ = AbortReason_Disable; - JS_ASSERT(script()->hasBaselineScript() == (info->executionMode() != ArgumentsUsageAnalysis)); - JS_ASSERT(!!analysisContext == (info->executionMode() == DefinitePropertiesAnalysis)); + MOZ_ASSERT(script()->hasBaselineScript() == (info->executionMode() != ArgumentsUsageAnalysis)); + MOZ_ASSERT(!!analysisContext == (info->executionMode() == DefinitePropertiesAnalysis)); if (!info->executionModeIsAnalysis()) script()->baselineScript()->setIonCompiledOrInlined(); @@ -158,7 +158,7 @@ IonBuilder::IonBuilder(JSContext *analysisContext, CompileCompartment *comp, void IonBuilder::clearForBackEnd() { - JS_ASSERT(!analysisContext); + MOZ_ASSERT(!analysisContext); baselineFrame_ = nullptr; // The caches below allocate data from the malloc heap. Release this before @@ -195,7 +195,7 @@ IonBuilder::spew(const char *message) static inline int32_t GetJumpOffset(jsbytecode *pc) { - JS_ASSERT(js_CodeSpec[JSOp(*pc)].type() == JOF_JUMP); + MOZ_ASSERT(js_CodeSpec[JSOp(*pc)].type() == JOF_JUMP); return GET_JUMP_OFFSET(pc); } @@ -272,8 +272,8 @@ bool IonBuilder::getPolyCallTargets(types::TemporaryTypeSet *calleeTypes, bool constructing, ObjectVector &targets, uint32_t maxTargets, bool *gotLambda) { - JS_ASSERT(targets.empty()); - JS_ASSERT(gotLambda); + MOZ_ASSERT(targets.empty()); + MOZ_ASSERT(gotLambda); *gotLambda = false; if (!calleeTypes) @@ -300,7 +300,7 @@ IonBuilder::getPolyCallTargets(types::TemporaryTypeSet *calleeTypes, bool constr fun = &obj->as(); } else { types::TypeObject *typeObj = calleeTypes->getTypeObject(i); - JS_ASSERT(typeObj); + MOZ_ASSERT(typeObj); if (!typeObj->interpretedFunction) { targets.clear(); return true; @@ -319,7 +319,7 @@ IonBuilder::getPolyCallTargets(types::TemporaryTypeSet *calleeTypes, bool constr } DebugOnly appendOk = targets.append(fun); - JS_ASSERT(appendOk); + MOZ_ASSERT(appendOk); } // For now, only inline "singleton" lambda calls @@ -758,12 +758,12 @@ IonBuilder::build() return false; if (!abortedNewScriptPropertiesTypes().empty()) { - JS_ASSERT(!info().executionModeIsAnalysis()); + MOZ_ASSERT(!info().executionModeIsAnalysis()); abortReason_ = AbortReason_NewScriptProperties; return false; } - JS_ASSERT(loopDepth_ == 0); + MOZ_ASSERT(loopDepth_ == 0); abortReason_ = AbortReason_NoAbort; return true; } @@ -833,7 +833,7 @@ IonBuilder::buildInline(IonBuilder *callerBuilder, MResumePoint *callerResumePoi // Connect the entrance block to the last block in the caller's graph. MBasicBlock *predecessor = callerBuilder->current; - JS_ASSERT(predecessor == callerResumePoint->block()); + MOZ_ASSERT(predecessor == callerResumePoint->block()); predecessor->end(MGoto::New(alloc(), current)); if (!current->addPredecessorWithoutPhis(predecessor)) @@ -863,7 +863,7 @@ IonBuilder::buildInline(IonBuilder *callerBuilder, MResumePoint *callerResumePoi // NB: Ion does not inline functions which |needsArgsObj|. So using argSlot() // instead of argSlotUnchecked() below is OK - JS_ASSERT(!info().needsArgsObj()); + MOZ_ASSERT(!info().needsArgsObj()); // Initialize actually set arguments. uint32_t existing_args = Min(callInfo.argc(), info().nargs()); @@ -892,7 +892,7 @@ IonBuilder::buildInline(IonBuilder *callerBuilder, MResumePoint *callerResumePoi (void *) current->entryResumePoint(), current->entryResumePoint()->numOperands()); // +2 for the scope chain and |this|, maybe another +1 for arguments object slot. - JS_ASSERT(current->entryResumePoint()->numOperands() == info().totalSlots()); + MOZ_ASSERT(current->entryResumePoint()->numOperands() == info().totalSlots()); if (script_->argumentsHasVarBinding()) { lazyArguments_ = MConstant::New(alloc(), MagicValue(JS_OPTIMIZED_ARGUMENTS)); @@ -913,7 +913,7 @@ IonBuilder::buildInline(IonBuilder *callerBuilder, MResumePoint *callerResumePoi void IonBuilder::rewriteParameter(uint32_t slotIdx, MDefinition *param, int32_t argIndex) { - JS_ASSERT(param->isParameter() || param->isGetArgumentsObjectArg()); + MOZ_ASSERT(param->isParameter() || param->isGetArgumentsObjectArg()); types::TemporaryTypeSet *types = param->resultTypeSet(); MDefinition *actual = ensureDefiniteType(param, types->getKnownMIRType()); @@ -938,7 +938,7 @@ IonBuilder::rewriteParameter(uint32_t slotIdx, MDefinition *param, int32_t argIn void IonBuilder::rewriteParameters() { - JS_ASSERT(info().scopeChainSlot() == 0); + MOZ_ASSERT(info().scopeChainSlot() == 0); if (!info().funMaybeLazy()) return; @@ -1060,7 +1060,7 @@ IonBuilder::initArgumentsObject() { JitSpew(JitSpew_IonMIR, "%s:%d - Emitting code to initialize arguments object! block=%p", script()->filename(), script()->lineno(), current); - JS_ASSERT(info().needsArgsObj()); + MOZ_ASSERT(info().needsArgsObj()); MCreateArgumentsObject *argsObj = MCreateArgumentsObject::New(alloc(), current->scopeChain()); current->add(argsObj); current->setArgumentsObject(argsObj); @@ -1134,7 +1134,7 @@ IonBuilder::addOsrValueTypeBarrier(uint32_t slot, MInstruction **def_, } case MIRType_MagicOptimizedArguments: - JS_ASSERT(lazyArguments_); + MOZ_ASSERT(lazyArguments_); osrBlock->rewriteSlot(slot, lazyArguments_); def = lazyArguments_; break; @@ -1143,7 +1143,7 @@ IonBuilder::addOsrValueTypeBarrier(uint32_t slot, MInstruction **def_, break; } - JS_ASSERT(def == osrBlock->getSlot(slot)); + MOZ_ASSERT(def == osrBlock->getSlot(slot)); return true; } @@ -1174,14 +1174,14 @@ IonBuilder::maybeAddOsrTypeBarriers() // while (..) { } // <= OSR here, only reachable via catch block. // // For now we just abort in this case. - JS_ASSERT(graph().hasTryBlock()); + MOZ_ASSERT(graph().hasTryBlock()); return abort("OSR block only reachable through catch block"); } MBasicBlock *preheader = osrBlock->getSuccessor(0); MBasicBlock *header = preheader->getSuccessor(0); static const size_t OSR_PHI_POSITION = 1; - JS_ASSERT(preheader->getPredecessor(OSR_PHI_POSITION) == osrBlock); + MOZ_ASSERT(preheader->getPredecessor(OSR_PHI_POSITION) == osrBlock); MResumePoint *headerRp = header->entryResumePoint(); size_t stackDepth = headerRp->numOperands(); @@ -1242,7 +1242,7 @@ bool IonBuilder::traverseBytecode() { for (;;) { - JS_ASSERT(pc < info().limitPC()); + MOZ_ASSERT(pc < info().limitPC()); for (;;) { if (!alloc().ensureBallast()) @@ -1339,21 +1339,21 @@ IonBuilder::traverseBytecode() // the ImplicitlyUsed flag. If this value will be popped immediately, // we may replace it with |undefined|, but the difference is // not observable. - JS_ASSERT(i == 0); + MOZ_ASSERT(i == 0); if (current->peek(-1) == popped[0]) break; // FALL THROUGH default: - JS_ASSERT(popped[i]->isImplicitlyUsed() || + MOZ_ASSERT(popped[i]->isImplicitlyUsed() || - // MNewDerivedTypedObject instances are - // often dead unless they escape from the - // fn. See IonBuilder::loadTypedObjectData() - // for more details. - popped[i]->isNewDerivedTypedObject() || + // MNewDerivedTypedObject instances are + // often dead unless they escape from the + // fn. See IonBuilder::loadTypedObjectData() + // for more details. + popped[i]->isNewDerivedTypedObject() || - popped[i]->defUseCount() > poppedUses[i]); + popped[i]->defUseCount() > poppedUses[i]); break; } } @@ -1797,7 +1797,7 @@ IonBuilder::inspectOpcode(JSOp op) return jsop_in(); case JSOP_SETRVAL: - JS_ASSERT(!script()->noScriptRval()); + MOZ_ASSERT(!script()->noScriptRval()); current->setSlot(info().returnValueSlot(), current->pop()); return true; @@ -1832,7 +1832,7 @@ IonBuilder::inspectOpcode(JSOp op) IonBuilder::ControlStatus IonBuilder::processControlEnd() { - JS_ASSERT(!current); + MOZ_ASSERT(!current); if (cfgStack_.empty()) { // If there is no more control flow to process, then this is the @@ -2010,9 +2010,9 @@ IonBuilder::processIfElseFalseEnd(CFGState &state) IonBuilder::ControlStatus IonBuilder::processBrokenLoop(CFGState &state) { - JS_ASSERT(!current); + MOZ_ASSERT(!current); - JS_ASSERT(loopDepth_); + MOZ_ASSERT(loopDepth_); loopDepth_--; // A broken loop is not a real loop (it has no header or backedge), so @@ -2028,7 +2028,7 @@ IonBuilder::processBrokenLoop(CFGState &state) if (!setCurrentAndSpecializePhis(state.loop.successor)) return ControlStatus_Error; if (current) { - JS_ASSERT(current->loopDepth() == loopDepth_); + MOZ_ASSERT(current->loopDepth() == loopDepth_); graph().moveBlockToEnd(current); } @@ -2063,9 +2063,9 @@ IonBuilder::processBrokenLoop(CFGState &state) IonBuilder::ControlStatus IonBuilder::finishLoop(CFGState &state, MBasicBlock *successor) { - JS_ASSERT(current); + MOZ_ASSERT(current); - JS_ASSERT(loopDepth_); + MOZ_ASSERT(loopDepth_); loopDepth_--; JS_ASSERT_IF(successor, successor->loopDepth() == loopDepth_); @@ -2203,11 +2203,11 @@ IonBuilder::processDoWhileBodyEnd(CFGState &state) IonBuilder::ControlStatus IonBuilder::processDoWhileCondEnd(CFGState &state) { - JS_ASSERT(JSOp(*pc) == JSOP_IFNE); + MOZ_ASSERT(JSOp(*pc) == JSOP_IFNE); // We're guaranteed a |current|, it's impossible to break or return from // inside the conditional expression. - JS_ASSERT(current); + MOZ_ASSERT(current); // Pop the last value, and create the successor block. MDefinition *vins = current->pop(); @@ -2236,7 +2236,7 @@ IonBuilder::processDoWhileCondEnd(CFGState &state) IonBuilder::ControlStatus IonBuilder::processWhileCondEnd(CFGState &state) { - JS_ASSERT(JSOp(*pc) == JSOP_IFNE || JSOp(*pc) == JSOP_IFEQ); + MOZ_ASSERT(JSOp(*pc) == JSOP_IFNE || JSOp(*pc) == JSOP_IFEQ); // Balance the stack past the IFNE. MDefinition *ins = current->pop(); @@ -2295,7 +2295,7 @@ IonBuilder::processWhileBodyEnd(CFGState &state) IonBuilder::ControlStatus IonBuilder::processForCondEnd(CFGState &state) { - JS_ASSERT(JSOp(*pc) == JSOP_IFNE); + MOZ_ASSERT(JSOp(*pc) == JSOP_IFNE); // Balance the stack past the IFNE. MDefinition *ins = current->pop(); @@ -2368,7 +2368,7 @@ IonBuilder::filterDeadDeferredEdges(DeferredEdge *edge) // There must be at least one deferred edge from a block that was not // deleted; blocks are deleted when restarting processing of a loop, and // the final version of the loop body will have edges from live blocks. - JS_ASSERT(head); + MOZ_ASSERT(head); return head; } @@ -2441,7 +2441,7 @@ IonBuilder::createBreakCatchBlock(DeferredEdge *edge, jsbytecode *pc) IonBuilder::ControlStatus IonBuilder::processNextTableSwitchCase(CFGState &state) { - JS_ASSERT(state.state == CFGState::TABLE_SWITCH); + MOZ_ASSERT(state.state == CFGState::TABLE_SWITCH); state.tableswitch.currentBlock++; @@ -2497,7 +2497,7 @@ IonBuilder::processAndOrEnd(CFGState &state) IonBuilder::ControlStatus IonBuilder::processLabelEnd(CFGState &state) { - JS_ASSERT(state.state == CFGState::LABEL); + MOZ_ASSERT(state.state == CFGState::LABEL); // If there are no breaks and no current, controlflow is terminated. if (!state.label.breaks && !current) @@ -2526,10 +2526,10 @@ IonBuilder::processLabelEnd(CFGState &state) IonBuilder::ControlStatus IonBuilder::processTryEnd(CFGState &state) { - JS_ASSERT(state.state == CFGState::TRY); + MOZ_ASSERT(state.state == CFGState::TRY); if (!state.try_.successor) { - JS_ASSERT(!current); + MOZ_ASSERT(!current); return ControlStatus_Ended; } @@ -2551,10 +2551,10 @@ IonBuilder::processTryEnd(CFGState &state) IonBuilder::ControlStatus IonBuilder::processBreak(JSOp op, jssrcnote *sn) { - JS_ASSERT(op == JSOP_GOTO); + MOZ_ASSERT(op == JSOP_GOTO); - JS_ASSERT(SN_TYPE(sn) == SRC_BREAK || - SN_TYPE(sn) == SRC_BREAK2LABEL); + MOZ_ASSERT(SN_TYPE(sn) == SRC_BREAK || + SN_TYPE(sn) == SRC_BREAK2LABEL); // Find the break target. jsbytecode *target = pc + GetJumpOffset(pc); @@ -2563,7 +2563,7 @@ IonBuilder::processBreak(JSOp op, jssrcnote *sn) if (SN_TYPE(sn) == SRC_BREAK2LABEL) { for (size_t i = labels_.length() - 1; i < labels_.length(); i--) { CFGState &cfg = cfgStack_[labels_[i].cfgEntry]; - JS_ASSERT(cfg.state == CFGState::LABEL); + MOZ_ASSERT(cfg.state == CFGState::LABEL); if (cfg.stopAt == target) { cfg.label.breaks = new(alloc()) DeferredEdge(current, cfg.label.breaks); found = true; @@ -2573,7 +2573,7 @@ IonBuilder::processBreak(JSOp op, jssrcnote *sn) } else { for (size_t i = loops_.length() - 1; i < loops_.length(); i--) { CFGState &cfg = cfgStack_[loops_[i].cfgEntry]; - JS_ASSERT(cfg.isLoop()); + MOZ_ASSERT(cfg.isLoop()); if (cfg.loop.exitpc == target) { cfg.loop.breaks = new(alloc()) DeferredEdge(current, cfg.loop.breaks); found = true; @@ -2582,7 +2582,7 @@ IonBuilder::processBreak(JSOp op, jssrcnote *sn) } } - JS_ASSERT(found); + MOZ_ASSERT(found); setCurrent(nullptr); pc += js_CodeSpec[op].length; @@ -2600,7 +2600,7 @@ EffectiveContinue(jsbytecode *pc) IonBuilder::ControlStatus IonBuilder::processContinue(JSOp op) { - JS_ASSERT(op == JSOP_GOTO); + MOZ_ASSERT(op == JSOP_GOTO); // Find the target loop. CFGState *found = nullptr; @@ -2616,7 +2616,7 @@ IonBuilder::processContinue(JSOp op) // There must always be a valid target loop structure. If not, there's // probably an off-by-something error in which pc we track. - JS_ASSERT(found); + MOZ_ASSERT(found); CFGState &state = *found; state.loop.continues = new(alloc()) DeferredEdge(current, state.loop.continues); @@ -2629,7 +2629,7 @@ IonBuilder::processContinue(JSOp op) IonBuilder::ControlStatus IonBuilder::processSwitchBreak(JSOp op) { - JS_ASSERT(op == JSOP_GOTO); + MOZ_ASSERT(op == JSOP_GOTO); // Find the target switch. CFGState *found = nullptr; @@ -2643,7 +2643,7 @@ IonBuilder::processSwitchBreak(JSOp op) // There must always be a valid target loop structure. If not, there's // probably an off-by-something error in which pc we track. - JS_ASSERT(found); + MOZ_ASSERT(found); CFGState &state = *found; DeferredEdge **breaks = nullptr; @@ -2744,7 +2744,7 @@ void IonBuilder::assertValidLoopHeadOp(jsbytecode *pc) { #ifdef DEBUG - JS_ASSERT(JSOp(*pc) == JSOP_LOOPHEAD); + MOZ_ASSERT(JSOp(*pc) == JSOP_LOOPHEAD); // Make sure this is the next opcode after the loop header, // unless the for loop is unconditional. @@ -2769,9 +2769,9 @@ IonBuilder::assertValidLoopHeadOp(jsbytecode *pc) // Make sure this loop goes to the same ifne as the loop header's // source notes or GOTO. - JS_ASSERT(ifne == expected_ifne); + MOZ_ASSERT(ifne == expected_ifne); } else { - JS_ASSERT(state.state != CFGState::DO_WHILE_LOOP_BODY); + MOZ_ASSERT(state.state != CFGState::DO_WHILE_LOOP_BODY); } #endif } @@ -2794,12 +2794,12 @@ IonBuilder::doWhileLoop(JSOp op, jssrcnote *sn) jssrcnote *sn2 = info().getNote(gsn, pc+1); int offset = js_GetSrcNoteOffset(sn2, 0); jsbytecode *ifne = pc + offset + 1; - JS_ASSERT(ifne > pc); + MOZ_ASSERT(ifne > pc); // Verify that the IFNE goes back to a loophead op. jsbytecode *loopHead = GetNextPc(pc); - JS_ASSERT(JSOp(*loopHead) == JSOP_LOOPHEAD); - JS_ASSERT(loopHead == ifne + GetJumpOffset(ifne)); + MOZ_ASSERT(JSOp(*loopHead) == JSOP_LOOPHEAD); + MOZ_ASSERT(loopHead == ifne + GetJumpOffset(ifne)); jsbytecode *loopEntry = GetNextPc(loopHead); bool canOsr = LoopEntryCanIonOsr(loopEntry); @@ -2857,14 +2857,14 @@ IonBuilder::whileOrForInLoop(jssrcnote *sn) // ... // IFNE ; goes to LOOPHEAD // for (x in y) { } loops are similar; the cond will be a MOREITER. - JS_ASSERT(SN_TYPE(sn) == SRC_FOR_OF || SN_TYPE(sn) == SRC_FOR_IN || SN_TYPE(sn) == SRC_WHILE); + MOZ_ASSERT(SN_TYPE(sn) == SRC_FOR_OF || SN_TYPE(sn) == SRC_FOR_IN || SN_TYPE(sn) == SRC_WHILE); int ifneOffset = js_GetSrcNoteOffset(sn, 0); jsbytecode *ifne = pc + ifneOffset; - JS_ASSERT(ifne > pc); + MOZ_ASSERT(ifne > pc); // Verify that the IFNE goes back to a loophead op. - JS_ASSERT(JSOp(*GetNextPc(pc)) == JSOP_LOOPHEAD); - JS_ASSERT(GetNextPc(pc) == ifne + GetJumpOffset(ifne)); + MOZ_ASSERT(JSOp(*GetNextPc(pc)) == JSOP_LOOPHEAD); + MOZ_ASSERT(GetNextPc(pc) == ifne + GetJumpOffset(ifne)); jsbytecode *loopEntry = pc + GetJumpOffset(pc); bool canOsr = LoopEntryCanIonOsr(loopEntry); @@ -2919,7 +2919,7 @@ IonBuilder::ControlStatus IonBuilder::forLoop(JSOp op, jssrcnote *sn) { // Skip the NOP or POP. - JS_ASSERT(op == JSOP_POP || op == JSOP_NOP); + MOZ_ASSERT(op == JSOP_POP || op == JSOP_NOP); pc = GetNextPc(pc); jsbytecode *condpc = pc + js_GetSrcNoteOffset(sn, 0); @@ -2946,21 +2946,21 @@ IonBuilder::forLoop(JSOp op, jssrcnote *sn) jsbytecode *bodyEnd = updatepc; jsbytecode *loopEntry = condpc; if (condpc != ifne) { - JS_ASSERT(JSOp(*bodyStart) == JSOP_GOTO); - JS_ASSERT(bodyStart + GetJumpOffset(bodyStart) == condpc); + MOZ_ASSERT(JSOp(*bodyStart) == JSOP_GOTO); + MOZ_ASSERT(bodyStart + GetJumpOffset(bodyStart) == condpc); bodyStart = GetNextPc(bodyStart); } else { // No loop condition, such as for(j = 0; ; j++) if (op != JSOP_NOP) { // If the loop starts with POP, we have to skip a NOP. - JS_ASSERT(JSOp(*bodyStart) == JSOP_NOP); + MOZ_ASSERT(JSOp(*bodyStart) == JSOP_NOP); bodyStart = GetNextPc(bodyStart); } loopEntry = GetNextPc(bodyStart); } jsbytecode *loopHead = bodyStart; - JS_ASSERT(JSOp(*bodyStart) == JSOP_LOOPHEAD); - JS_ASSERT(ifne + GetJumpOffset(ifne) == bodyStart); + MOZ_ASSERT(JSOp(*bodyStart) == JSOP_LOOPHEAD); + MOZ_ASSERT(ifne + GetJumpOffset(ifne) == bodyStart); bodyStart = GetNextPc(bodyStart); bool osr = info().hasOsrAt(loopEntry); @@ -3042,8 +3042,8 @@ IonBuilder::tableSwitch(JSOp op, jssrcnote *sn) // .: ... // .: Offset of case high - JS_ASSERT(op == JSOP_TABLESWITCH); - JS_ASSERT(SN_TYPE(sn) == SRC_TABLESWITCH); + MOZ_ASSERT(op == JSOP_TABLESWITCH); + MOZ_ASSERT(SN_TYPE(sn) == SRC_TABLESWITCH); // Pop input. MDefinition *ins = current->pop(); @@ -3052,7 +3052,7 @@ IonBuilder::tableSwitch(JSOp op, jssrcnote *sn) jsbytecode *exitpc = pc + js_GetSrcNoteOffset(sn, 0); jsbytecode *defaultpc = pc + GET_JUMP_OFFSET(pc); - JS_ASSERT(defaultpc > pc && defaultpc <= exitpc); + MOZ_ASSERT(defaultpc > pc && defaultpc <= exitpc); // Get the low and high from the tableswitch jsbytecode *pc2 = pc; @@ -3077,7 +3077,7 @@ IonBuilder::tableSwitch(JSOp op, jssrcnote *sn) for (int i = 0; i < high-low+1; i++) { casepc = pc + GET_JUMP_OFFSET(pc2); - JS_ASSERT(casepc >= pc && casepc <= exitpc); + MOZ_ASSERT(casepc >= pc && casepc <= exitpc); MBasicBlock *caseblock = newBlock(current, casepc); if (!caseblock) @@ -3106,8 +3106,8 @@ IonBuilder::tableSwitch(JSOp op, jssrcnote *sn) // Move defaultcase to the end, to maintain RPO. graph().moveBlockToEnd(defaultcase); - JS_ASSERT(tableswitch->numCases() == (uint32_t)(high - low + 1)); - JS_ASSERT(tableswitch->numSuccessors() > 0); + MOZ_ASSERT(tableswitch->numCases() == (uint32_t)(high - low + 1)); + MOZ_ASSERT(tableswitch->numSuccessors() > 0); // Sort the list of blocks that still needs to get processed by pc qsort(tableswitch->blocks(), tableswitch->numBlocks(), @@ -3385,10 +3385,10 @@ IonBuilder::improveTypesAtTest(MDefinition *ins, bool trueBranch, MTest *test) bool IonBuilder::jsop_label() { - JS_ASSERT(JSOp(*pc) == JSOP_LABEL); + MOZ_ASSERT(JSOp(*pc) == JSOP_LABEL); jsbytecode *endpc = pc + GET_JUMP_OFFSET(pc); - JS_ASSERT(endpc > pc); + MOZ_ASSERT(endpc > pc); ControlFlowInfo label(cfgStack_.length(), endpc); if (!labels_.append(label)) @@ -3428,9 +3428,9 @@ IonBuilder::jsop_condswitch() // 2/ Generate code for all cases (see processCondSwitchCase). // 3/ Generate code for all bodies (see processCondSwitchBody). - JS_ASSERT(JSOp(*pc) == JSOP_CONDSWITCH); + MOZ_ASSERT(JSOp(*pc) == JSOP_CONDSWITCH); jssrcnote *sn = info().getNote(gsn, pc); - JS_ASSERT(SN_TYPE(sn) == SRC_CONDSWITCH); + MOZ_ASSERT(SN_TYPE(sn) == SRC_CONDSWITCH); // Get the exit pc jsbytecode *exitpc = pc + js_GetSrcNoteOffset(sn, 0); @@ -3444,14 +3444,14 @@ IonBuilder::jsop_condswitch() jsbytecode *lastTarget = GetJumpOffset(curCase) + curCase; size_t nbBodies = 2; // default target and the first body. - JS_ASSERT(pc < curCase && curCase <= exitpc); + MOZ_ASSERT(pc < curCase && curCase <= exitpc); while (JSOp(*curCase) == JSOP_CASE) { // Fetch the next case. jssrcnote *caseSn = info().getNote(gsn, curCase); - JS_ASSERT(caseSn && SN_TYPE(caseSn) == SRC_NEXTCASE); + MOZ_ASSERT(caseSn && SN_TYPE(caseSn) == SRC_NEXTCASE); ptrdiff_t off = js_GetSrcNoteOffset(caseSn, 0); curCase = off ? curCase + off : GetNextPc(curCase); - JS_ASSERT(pc < curCase && curCase <= exitpc); + MOZ_ASSERT(pc < curCase && curCase <= exitpc); // Count non-aliased cases. jsbytecode *curTarget = GetJumpOffset(curCase) + curCase; @@ -3462,9 +3462,9 @@ IonBuilder::jsop_condswitch() // The current case now be the default case which jump to the body of the // default case, which might be behind the last target. - JS_ASSERT(JSOp(*curCase) == JSOP_DEFAULT); + MOZ_ASSERT(JSOp(*curCase) == JSOP_DEFAULT); jsbytecode *defaultTarget = GetJumpOffset(curCase) + curCase; - JS_ASSERT(curCase < defaultTarget && defaultTarget <= exitpc); + MOZ_ASSERT(curCase < defaultTarget && defaultTarget <= exitpc); // Allocate the current graph state. CFGState state = CFGState::CondSwitch(this, exitpc, defaultTarget); @@ -3472,7 +3472,7 @@ IonBuilder::jsop_condswitch() return ControlStatus_Error; // We loop on case conditions with processCondSwitchCase. - JS_ASSERT(JSOp(*firstCase) == JSOP_CASE); + MOZ_ASSERT(JSOp(*firstCase) == JSOP_CASE); state.stopAt = firstCase; state.state = CFGState::COND_SWITCH_CASE; @@ -3518,10 +3518,10 @@ IonBuilder::CFGState::Try(jsbytecode *exitpc, MBasicBlock *successor) IonBuilder::ControlStatus IonBuilder::processCondSwitchCase(CFGState &state) { - JS_ASSERT(state.state == CFGState::COND_SWITCH_CASE); - JS_ASSERT(!state.condswitch.breaks); - JS_ASSERT(current); - JS_ASSERT(JSOp(*pc) == JSOP_CASE); + MOZ_ASSERT(state.state == CFGState::COND_SWITCH_CASE); + MOZ_ASSERT(!state.condswitch.breaks); + MOZ_ASSERT(current); + MOZ_ASSERT(JSOp(*pc) == JSOP_CASE); FixedList &bodies = *state.condswitch.bodies; jsbytecode *defaultTarget = state.condswitch.defaultTarget; uint32_t ¤tIdx = state.condswitch.currentIdx; @@ -3532,7 +3532,7 @@ IonBuilder::processCondSwitchCase(CFGState &state) ptrdiff_t off = js_GetSrcNoteOffset(sn, 0); jsbytecode *casePc = off ? pc + off : GetNextPc(pc); bool caseIsDefault = JSOp(*casePc) == JSOP_DEFAULT; - JS_ASSERT(JSOp(*casePc) == JSOP_CASE || caseIsDefault); + MOZ_ASSERT(JSOp(*casePc) == JSOP_CASE || caseIsDefault); // Allocate the block of the matching case. bool bodyIsNew = false; @@ -3541,7 +3541,7 @@ IonBuilder::processCondSwitchCase(CFGState &state) if (lastTarget < bodyTarget) { // If the default body is in the middle or aliasing the current target. if (lastTarget < defaultTarget && defaultTarget <= bodyTarget) { - JS_ASSERT(state.condswitch.defaultIdx == uint32_t(-1)); + MOZ_ASSERT(state.condswitch.defaultIdx == uint32_t(-1)); state.condswitch.defaultIdx = currentIdx; bodies[currentIdx] = nullptr; // If the default body does not alias any and it would be allocated @@ -3556,8 +3556,8 @@ IonBuilder::processCondSwitchCase(CFGState &state) bodies[currentIdx++] = bodyBlock; } else { // This body alias the previous one. - JS_ASSERT(lastTarget == bodyTarget); - JS_ASSERT(currentIdx > 0); + MOZ_ASSERT(lastTarget == bodyTarget); + MOZ_ASSERT(currentIdx > 0); bodyBlock = bodies[currentIdx - 1]; } @@ -3581,17 +3581,17 @@ IonBuilder::processCondSwitchCase(CFGState &state) if (state.condswitch.defaultIdx == uint32_t(-1)) { // The default target is the last target. - JS_ASSERT(lastTarget < defaultTarget); + MOZ_ASSERT(lastTarget < defaultTarget); state.condswitch.defaultIdx = currentIdx++; caseIsNew = true; } else if (bodies[state.condswitch.defaultIdx] == nullptr) { // The default target is in the middle and it does not alias any // case target. - JS_ASSERT(defaultTarget < lastTarget); + MOZ_ASSERT(defaultTarget < lastTarget); caseIsNew = true; } else { // The default target is in the middle and it alias a case target. - JS_ASSERT(defaultTarget <= lastTarget); + MOZ_ASSERT(defaultTarget <= lastTarget); caseBlock = bodies[state.condswitch.defaultIdx]; } @@ -3613,7 +3613,7 @@ IonBuilder::processCondSwitchCase(CFGState &state) MDefinition *switchOperand = current->peek(-1); MCompare *cmpResult = MCompare::New(alloc(), switchOperand, caseOperand, JSOP_STRICTEQ); cmpResult->infer(inspector, pc); - JS_ASSERT(!cmpResult->isEffectful()); + MOZ_ASSERT(!cmpResult->isEffectful()); current->add(cmpResult); current->end(newTest(cmpResult, bodyBlock, caseBlock)); @@ -3631,7 +3631,7 @@ IonBuilder::processCondSwitchCase(CFGState &state) return ControlStatus_Error; } else { // The default case alias the last case body. - JS_ASSERT(caseIsDefault); + MOZ_ASSERT(caseIsDefault); current->pop(); // Case operand current->pop(); // Switch operand current->end(MGoto::New(alloc(), bodyBlock)); @@ -3644,7 +3644,7 @@ IonBuilder::processCondSwitchCase(CFGState &state) // with potential stops in processSwitchBreak. Check that the bodies // fixed list is over-estimate by at most 1, and shrink the size such as // length can be used as an upper bound while iterating bodies. - JS_ASSERT(currentIdx == bodies.length() || currentIdx + 1 == bodies.length()); + MOZ_ASSERT(currentIdx == bodies.length() || currentIdx + 1 == bodies.length()); bodies.shrink(bodies.length() - currentIdx); // Handle break statements in processSwitchBreak while processing @@ -3671,12 +3671,12 @@ IonBuilder::processCondSwitchCase(CFGState &state) IonBuilder::ControlStatus IonBuilder::processCondSwitchBody(CFGState &state) { - JS_ASSERT(state.state == CFGState::COND_SWITCH_BODY); - JS_ASSERT(pc <= state.condswitch.exitpc); + MOZ_ASSERT(state.state == CFGState::COND_SWITCH_BODY); + MOZ_ASSERT(pc <= state.condswitch.exitpc); FixedList &bodies = *state.condswitch.bodies; uint32_t ¤tIdx = state.condswitch.currentIdx; - JS_ASSERT(currentIdx <= bodies.length()); + MOZ_ASSERT(currentIdx <= bodies.length()); if (currentIdx == bodies.length()) { JS_ASSERT_IF(current, pc == state.condswitch.exitpc); return processSwitchEnd(state.condswitch.breaks, state.condswitch.exitpc); @@ -3711,11 +3711,11 @@ IonBuilder::processCondSwitchBody(CFGState &state) bool IonBuilder::jsop_andor(JSOp op) { - JS_ASSERT(op == JSOP_AND || op == JSOP_OR); + MOZ_ASSERT(op == JSOP_AND || op == JSOP_OR); jsbytecode *rhsStart = pc + js_CodeSpec[op].length; jsbytecode *joinStart = pc + GetJumpOffset(pc); - JS_ASSERT(joinStart > pc); + MOZ_ASSERT(joinStart > pc); // We have to leave the LHS on the stack. MDefinition *lhs = current->peek(-1); @@ -3763,7 +3763,7 @@ IonBuilder::jsop_ifeq(JSOp op) // IFEQ always has a forward offset. jsbytecode *trueStart = pc + js_CodeSpec[op].length; jsbytecode *falseStart = pc + GetJumpOffset(pc); - JS_ASSERT(falseStart > pc); + MOZ_ASSERT(falseStart > pc); // We only handle cases that emit source notes. jssrcnote *sn = info().getNote(gsn, pc); @@ -3811,14 +3811,14 @@ IonBuilder::jsop_ifeq(JSOp op) // Infer the join point from the JSOP_GOTO[X] sitting here, then // assert as we much we can that this is the right GOTO. jsbytecode *trueEnd = pc + js_GetSrcNoteOffset(sn, 0); - JS_ASSERT(trueEnd > pc); - JS_ASSERT(trueEnd < falseStart); - JS_ASSERT(JSOp(*trueEnd) == JSOP_GOTO); - JS_ASSERT(!info().getNote(gsn, trueEnd)); + MOZ_ASSERT(trueEnd > pc); + MOZ_ASSERT(trueEnd < falseStart); + MOZ_ASSERT(JSOp(*trueEnd) == JSOP_GOTO); + MOZ_ASSERT(!info().getNote(gsn, trueEnd)); jsbytecode *falseEnd = trueEnd + GetJumpOffset(trueEnd); - JS_ASSERT(falseEnd > trueEnd); - JS_ASSERT(falseEnd >= falseStart); + MOZ_ASSERT(falseEnd > trueEnd); + MOZ_ASSERT(falseEnd >= falseStart); if (!cfgStack_.append(CFGState::IfElse(trueEnd, falseEnd, test))) return false; @@ -3844,14 +3844,14 @@ IonBuilder::jsop_ifeq(JSOp op) bool IonBuilder::jsop_try() { - JS_ASSERT(JSOp(*pc) == JSOP_TRY); + MOZ_ASSERT(JSOp(*pc) == JSOP_TRY); // Try-finally is not yet supported. if (analysis().hasTryFinally()) return abort("Has try-finally"); // Try-catch within inline frames is not yet supported. - JS_ASSERT(!isInlineBuilder()); + MOZ_ASSERT(!isInlineBuilder()); // Try-catch during the arguments usage analysis is not yet supported. Code // accessing the arguments within the 'catch' block is not accounted for. @@ -3861,13 +3861,13 @@ IonBuilder::jsop_try() graph().setHasTryBlock(); jssrcnote *sn = info().getNote(gsn, pc); - JS_ASSERT(SN_TYPE(sn) == SRC_TRY); + MOZ_ASSERT(SN_TYPE(sn) == SRC_TRY); // Get the pc of the last instruction in the try block. It's a JSOP_GOTO to // jump over the catch block. jsbytecode *endpc = pc + js_GetSrcNoteOffset(sn, 0); - JS_ASSERT(JSOp(*endpc) == JSOP_GOTO); - JS_ASSERT(GetJumpOffset(endpc) > 0); + MOZ_ASSERT(JSOp(*endpc) == JSOP_GOTO); + MOZ_ASSERT(GetJumpOffset(endpc) > 0); jsbytecode *afterTry = endpc + GetJumpOffset(endpc); @@ -3916,7 +3916,7 @@ IonBuilder::jsop_try() // The baseline compiler should not attempt to enter the catch block // via OSR. - JS_ASSERT(info().osrPc() < endpc || info().osrPc() >= afterTry); + MOZ_ASSERT(info().osrPc() < endpc || info().osrPc() >= afterTry); // Start parsing the try block. return setCurrentAndSpecializePhis(tryBlock); @@ -4197,8 +4197,8 @@ class AutoAccumulateReturns bool IonBuilder::inlineScriptedCall(CallInfo &callInfo, JSFunction *target) { - JS_ASSERT(target->hasScript()); - JS_ASSERT(IsIonInlinablePC(pc)); + MOZ_ASSERT(target->hasScript()); + MOZ_ASSERT(IsIonInlinablePC(pc)); callInfo.setImplicitlyUsedUnchecked(); @@ -4286,7 +4286,7 @@ IonBuilder::inlineScriptedCall(CallInfo &callInfo, JSFunction *target) abortReason_ = AbortReason_Inlining; } else if (inlineBuilder.abortReason_ == AbortReason_NewScriptProperties) { const TypeObjectVector &types = inlineBuilder.abortedNewScriptPropertiesTypes(); - JS_ASSERT(!types.empty()); + MOZ_ASSERT(!types.empty()); for (size_t i = 0; i < types.length(); i++) addAbortedNewScriptPropertiesType(types[i]); abortReason_ = AbortReason_NewScriptProperties; @@ -4361,7 +4361,7 @@ IonBuilder::patchInlinedReturns(CallInfo &callInfo, MIRGraphReturns &returns, MB { // Replaces MReturns with MGotos, returning the MDefinition // representing the return value, or nullptr. - JS_ASSERT(returns.length() > 0); + MOZ_ASSERT(returns.length() > 0); if (returns.length() == 1) return patchInlinedReturn(callInfo, returns[0], bottom); @@ -4491,14 +4491,14 @@ IonBuilder::selectInliningTargets(ObjectVector &targets, CallInfo &callInfo, Boo *numInlineable += 1; } - JS_ASSERT(choiceSet.length() == targets.length()); + MOZ_ASSERT(choiceSet.length() == targets.length()); return true; } static bool CanInlineGetPropertyCache(MGetPropertyCache *cache, MDefinition *thisDef) { - JS_ASSERT(cache->object()->type() == MIRType_Object); + MOZ_ASSERT(cache->object()->type() == MIRType_Object); if (cache->object() != thisDef) return false; @@ -4714,10 +4714,10 @@ IonBuilder::inlineTypeObjectFallback(CallInfo &callInfo, MBasicBlock *dispatchBl // Getting here implies the following: // 1. The call function is an MGetPropertyCache, or an MGetPropertyCache // followed by an MTypeBarrier. - JS_ASSERT(callInfo.fun()->isGetPropertyCache() || callInfo.fun()->isTypeBarrier()); + MOZ_ASSERT(callInfo.fun()->isGetPropertyCache() || callInfo.fun()->isTypeBarrier()); // 2. The MGetPropertyCache has inlineable cases by guarding on the TypeObject. - JS_ASSERT(dispatch->numCases() > 0); + MOZ_ASSERT(dispatch->numCases() > 0); // 3. The MGetPropertyCache (and, if applicable, MTypeBarrier) only // have at most a single use. @@ -4741,7 +4741,7 @@ IonBuilder::inlineTypeObjectFallback(CallInfo &callInfo, MBasicBlock *dispatchBl return false; DebugOnly preCallFuncIndex = preCallResumePoint->numOperands() - callInfo.numFormals(); - JS_ASSERT(preCallResumePoint->getOperand(preCallFuncIndex) == fallbackInfo.fun()); + MOZ_ASSERT(preCallResumePoint->getOperand(preCallFuncIndex) == fallbackInfo.fun()); // In the dispatch block, replace the function's slot entry with Undefined. MConstant *undefined = MConstant::New(alloc(), UndefinedValue()); @@ -4759,8 +4759,8 @@ IonBuilder::inlineTypeObjectFallback(CallInfo &callInfo, MBasicBlock *dispatchBl // This is subtle: the pc and resume point are those of the MGetPropertyCache! InlinePropertyTable *propTable = cache->propTable(); MResumePoint *priorResumePoint = propTable->takePriorResumePoint(); - JS_ASSERT(propTable->pc() != nullptr); - JS_ASSERT(priorResumePoint != nullptr); + MOZ_ASSERT(propTable->pc() != nullptr); + MOZ_ASSERT(priorResumePoint != nullptr); MBasicBlock *getPropBlock = newBlock(prepBlock, propTable->pc(), priorResumePoint); if (!getPropBlock) return false; @@ -4770,18 +4770,18 @@ IonBuilder::inlineTypeObjectFallback(CallInfo &callInfo, MBasicBlock *dispatchBl // Since the getPropBlock inherited the stack from right before the MGetPropertyCache, // the target of the MGetPropertyCache is still on the stack. DebugOnly checkObject = getPropBlock->pop(); - JS_ASSERT(checkObject == cache->object()); + MOZ_ASSERT(checkObject == cache->object()); // Move the MGetPropertyCache and friends into the getPropBlock. if (fallbackInfo.fun()->isGetPropertyCache()) { - JS_ASSERT(fallbackInfo.fun()->toGetPropertyCache() == cache); + MOZ_ASSERT(fallbackInfo.fun()->toGetPropertyCache() == cache); getPropBlock->addFromElsewhere(cache); getPropBlock->push(cache); } else { MTypeBarrier *barrier = callInfo.fun()->toTypeBarrier(); - JS_ASSERT(barrier->type() == MIRType_Object); - JS_ASSERT(barrier->input()->isGetPropertyCache()); - JS_ASSERT(barrier->input()->toGetPropertyCache() == cache); + MOZ_ASSERT(barrier->type() == MIRType_Object); + MOZ_ASSERT(barrier->input()->isGetPropertyCache()); + MOZ_ASSERT(barrier->input()->toGetPropertyCache() == cache); getPropBlock->addFromElsewhere(cache); getPropBlock->addFromElsewhere(barrier); @@ -4810,8 +4810,8 @@ IonBuilder::inlineCalls(CallInfo &callInfo, ObjectVector &targets, MGetPropertyCache *maybeCache) { // Only handle polymorphic inlining. - JS_ASSERT(IsIonInlinablePC(pc)); - JS_ASSERT(choiceSet.length() == targets.length()); + MOZ_ASSERT(IsIonInlinablePC(pc)); + MOZ_ASSERT(choiceSet.length() == targets.length()); JS_ASSERT_IF(!maybeCache, targets.length() >= 2); JS_ASSERT_IF(maybeCache, targets.length() >= 1); @@ -4877,7 +4877,7 @@ IonBuilder::inlineCalls(CallInfo &callInfo, ObjectVector &targets, maybeCache ? maybeCache->object()->resultTypeSet() : nullptr; // Inline each of the inlineable targets. - JS_ASSERT(targets.length() == originals.length()); + MOZ_ASSERT(targets.length() == originals.length()); for (uint32_t i = 0; i < targets.length(); i++) { // When original != target, the target is a callsite clone. The // original should be used for guards, and the target should be the @@ -4917,7 +4917,7 @@ IonBuilder::inlineCalls(CallInfo &callInfo, ObjectVector &targets, inlineInfo.setFun(funcDef); if (maybeCache) { - JS_ASSERT(callInfo.thisArg() == maybeCache->object()); + MOZ_ASSERT(callInfo.thisArg() == maybeCache->object()); types::TemporaryTypeSet *targetThisTypes = maybeCache->propTable()->buildTypeSetForFunction(original); if (!targetThisTypes) @@ -4934,8 +4934,8 @@ IonBuilder::inlineCalls(CallInfo &callInfo, ObjectVector &targets, // Natives may veto inlining. if (status == InliningStatus_NotInlined) { - JS_ASSERT(target->isNative()); - JS_ASSERT(current == inlineBlock); + MOZ_ASSERT(target->isNative()); + MOZ_ASSERT(current == inlineBlock); graph().removeBlock(inlineBlock); choiceSet[i] = false; continue; @@ -4969,7 +4969,7 @@ IonBuilder::inlineCalls(CallInfo &callInfo, ObjectVector &targets, // If all paths were vetoed, output only a generic fallback path. if (propTable->numEntries() == 0) { - JS_ASSERT(dispatch->numCases() == 0); + MOZ_ASSERT(dispatch->numCases() == 0); maybeCache = nullptr; } } @@ -5023,7 +5023,7 @@ IonBuilder::inlineCalls(CallInfo &callInfo, ObjectVector &targets, dispatchBlock->end(dispatch); // Check the depth change: +1 for retval - JS_ASSERT(returnBlock->stackDepth() == dispatchBlock->stackDepth() - callInfo.numFormals() + 1); + MOZ_ASSERT(returnBlock->stackDepth() == dispatchBlock->stackDepth() - callInfo.numFormals() + 1); graph().moveBlockToEnd(returnBlock); return setCurrentAndSpecializePhis(returnBlock); @@ -5038,7 +5038,7 @@ IonBuilder::createDeclEnvObject(MDefinition *callee, MDefinition *scope) // One field is added to the function to handle its name. This cannot be a // dynamic slot because there is still plenty of room on the DeclEnv object. - JS_ASSERT(!templateObj->hasDynamicSlots()); + MOZ_ASSERT(!templateObj->hasDynamicSlots()); // Allocate the actual object. It is important that no intervening // instructions could potentially bailout, thus leaking the dynamic slots @@ -5525,7 +5525,7 @@ static bool ArgumentTypesMatch(MDefinition *def, types::StackTypeSet *calleeTypes) { if (def->resultTypeSet()) { - JS_ASSERT(def->type() == MIRType_Value || def->mightBeType(def->type())); + MOZ_ASSERT(def->type() == MIRType_Value || def->mightBeType(def->type())); return def->resultTypeSet()->isSubset(calleeTypes); } @@ -5810,7 +5810,7 @@ IonBuilder::jsop_newarray(uint32_t count) return abort("No template object for NEWARRAY"); } - JS_ASSERT(templateObject->is()); + MOZ_ASSERT(templateObject->is()); if (templateObject->type()->unknownProperties()) { if (info().executionMode() == ArgumentsUsageAnalysis) { MUnknownValue *unknown = MUnknownValue::New(alloc()); @@ -5878,7 +5878,7 @@ IonBuilder::jsop_newobject() return abort("No template object for NEWOBJECT"); } - JS_ASSERT(templateObject->is()); + MOZ_ASSERT(templateObject->is()); MConstant *templateConst = MConstant::NewConstraintlessObject(alloc(), templateObject); current->add(templateConst); MNewObject *ins = MNewObject::New(alloc(), constraints(), templateConst, @@ -6132,8 +6132,8 @@ IonBuilder::newBlock(MBasicBlock *predecessor, jsbytecode *pc, uint32_t loopDept MBasicBlock * IonBuilder::newOsrPreheader(MBasicBlock *predecessor, jsbytecode *loopEntry) { - JS_ASSERT(LoopEntryCanIonOsr(loopEntry)); - JS_ASSERT(loopEntry == info().osrPc()); + MOZ_ASSERT(LoopEntryCanIonOsr(loopEntry)); + MOZ_ASSERT(loopEntry == info().osrPc()); // Create two blocks: one for the OSR entry with no predecessors, one for // the preheader, which has the OSR entry block as a predecessor. The @@ -6201,7 +6201,7 @@ IonBuilder::newOsrPreheader(MBasicBlock *predecessor, jsbytecode *loopEntry) // formals may have been assigned to during interpretation, and that change // will not be reflected in the argsobj. if (needsArgsObj && info().argsObjAliasesFormals()) { - JS_ASSERT(argsObj && argsObj->isOsrArgumentsObject()); + MOZ_ASSERT(argsObj && argsObj->isOsrArgumentsObject()); // If this is an aliased formal, then the arguments object // contains a hole at this index. Any references to this // variable in the jitcode will come from JSOP_*ALIASEDVAR @@ -6262,8 +6262,8 @@ IonBuilder::newOsrPreheader(MBasicBlock *predecessor, jsbytecode *loopEntry) // Clone types of the other predecessor of the pre-header to the osr block, // such as pre-header phi's won't discard specialized type of the // predecessor. - JS_ASSERT(predecessor->stackDepth() == osrBlock->stackDepth()); - JS_ASSERT(info().scopeChainSlot() == 0); + MOZ_ASSERT(predecessor->stackDepth() == osrBlock->stackDepth()); + MOZ_ASSERT(info().scopeChainSlot() == 0); // Treat the OSR values as having the same type as the existing values // coming in to the loop. These will be fixed up with appropriate @@ -6387,7 +6387,7 @@ IonBuilder::newTest(MDefinition *ins, MBasicBlock *ifTrue, MBasicBlock *ifFalse) bool IonBuilder::resume(MInstruction *ins, jsbytecode *pc, MResumePoint::Mode mode) { - JS_ASSERT(ins->isEffectful() || !ins->isMovable()); + MOZ_ASSERT(ins->isEffectful() || !ins->isMovable()); MResumePoint *resumePoint = MResumePoint::New(alloc(), ins->block(), pc, callerResumePoint_, mode); @@ -6685,7 +6685,7 @@ IonBuilder::pushTypeBarrier(MDefinition *def, types::TemporaryTypeSet *observed, bool IonBuilder::pushDOMTypeBarrier(MInstruction *ins, types::TemporaryTypeSet *observed, JSFunction* func) { - JS_ASSERT(func && func->isNative() && func->jitInfo()); + MOZ_ASSERT(func && func->isNative() && func->jitInfo()); const JSJitInfo *jitinfo = func->jitInfo(); bool barrier = DOMCallNeedsBarrier(jitinfo, observed); @@ -6705,7 +6705,7 @@ IonBuilder::pushDOMTypeBarrier(MInstruction *ins, types::TemporaryTypeSet *obser current->push(replace); } } else { - JS_ASSERT(barrier); + MOZ_ASSERT(barrier); } return pushTypeBarrier(replace, observed, @@ -6732,7 +6732,7 @@ IonBuilder::ensureDefiniteType(MDefinition *def, MIRType definiteType) default: { if (def->type() != MIRType_Value) { - JS_ASSERT(def->type() == definiteType); + MOZ_ASSERT(def->type() == definiteType); return def; } replace = MUnbox::New(alloc(), def, definiteType, MUnbox::Infallible); @@ -6787,8 +6787,8 @@ IonBuilder::getStaticName(JSObject *staticObject, PropertyName *name, bool *psuc { jsid id = NameToId(name); - JS_ASSERT(staticObject->is() || staticObject->is()); - JS_ASSERT(staticObject->hasSingletonType()); + MOZ_ASSERT(staticObject->is() || staticObject->is()); + MOZ_ASSERT(staticObject->hasSingletonType()); *psucceeded = true; @@ -6916,7 +6916,7 @@ IonBuilder::setStaticName(JSObject *staticObject, PropertyName *name) { jsid id = NameToId(name); - JS_ASSERT(staticObject->is() || staticObject->is()); + MOZ_ASSERT(staticObject->is() || staticObject->is()); MDefinition *value = current->peek(-1); @@ -6942,7 +6942,7 @@ IonBuilder::setStaticName(JSObject *staticObject, PropertyName *name) // Pop the bound object on the stack. MDefinition *obj = current->pop(); - JS_ASSERT(&obj->toConstant()->value().toObject() == staticObject); + MOZ_ASSERT(&obj->toConstant()->value().toObject() == staticObject); if (NeedsPostBarrier(info(), value)) current->add(MPostWriteBarrier::New(alloc(), obj, value)); @@ -7029,7 +7029,7 @@ IonBuilder::jsop_intrinsic(PropertyName *name) // Bake in the intrinsic. Make sure that TI agrees with us on the type. Value vp; JS_ALWAYS_TRUE(script()->global().maybeGetIntrinsicValue(name, &vp)); - JS_ASSERT(types->hasType(types::GetValueType(vp))); + MOZ_ASSERT(types->hasType(types::GetValueType(vp))); pushConstant(vp); return true; @@ -7038,7 +7038,7 @@ IonBuilder::jsop_intrinsic(PropertyName *name) bool IonBuilder::jsop_bindname(PropertyName *name) { - JS_ASSERT(analysis().usesScopeChain()); + MOZ_ASSERT(analysis().usesScopeChain()); MDefinition *scopeChain = current->scopeChain(); MBindNameCache *ins = MBindNameCache::New(alloc(), scopeChain, name, script(), pc); @@ -7136,7 +7136,7 @@ IonBuilder::jsop_getelem() bool IonBuilder::getElemTryTypedObject(bool *emitted, MDefinition *obj, MDefinition *index) { - JS_ASSERT(*emitted == false); + MOZ_ASSERT(*emitted == false); TypedObjectPrediction objPrediction = typedObjectPrediction(obj); if (objPrediction.isUseless()) @@ -7149,7 +7149,7 @@ IonBuilder::getElemTryTypedObject(bool *emitted, MDefinition *obj, MDefinition * if (elemPrediction.isUseless()) return true; - JS_ASSERT(TypeDescr::isSized(elemPrediction.kind())); + MOZ_ASSERT(TypeDescr::isSized(elemPrediction.kind())); int32_t elemSize; if (!elemPrediction.hasKnownSize(&elemSize)) @@ -7248,11 +7248,11 @@ IonBuilder::getElemTryScalarElemOfTypedObject(bool *emitted, TypedObjectPrediction elemPrediction, int32_t elemSize) { - JS_ASSERT(objPrediction.ofArrayKind()); + MOZ_ASSERT(objPrediction.ofArrayKind()); // Must always be loading the same scalar type ScalarTypeDescr::Type elemType = elemPrediction.scalarType(); - JS_ASSERT(elemSize == ScalarTypeDescr::alignment(elemType)); + MOZ_ASSERT(elemSize == ScalarTypeDescr::alignment(elemType)); bool canBeNeutered; MDefinition *indexAsByteOffset; @@ -7273,7 +7273,7 @@ IonBuilder::pushScalarLoadFromTypedObject(bool *emitted, bool canBeNeutered) { int32_t size = ScalarTypeDescr::size(elemType); - JS_ASSERT(size == ScalarTypeDescr::alignment(elemType)); + MOZ_ASSERT(size == ScalarTypeDescr::alignment(elemType)); // Find location within the owner object. MDefinition *elements, *scaledOffset; @@ -7314,7 +7314,7 @@ IonBuilder::getElemTryComplexElemOfTypedObject(bool *emitted, TypedObjectPrediction elemPrediction, int32_t elemSize) { - JS_ASSERT(objPrediction.ofArrayKind()); + MOZ_ASSERT(objPrediction.ofArrayKind()); MDefinition *type = loadTypedObjectType(obj); MDefinition *elemTypeObj = typeObjectForElementFromArrayStructType(type); @@ -7402,7 +7402,7 @@ IonBuilder::pushDerivedTypedObject(bool *emitted, bool IonBuilder::getElemTryDense(bool *emitted, MDefinition *obj, MDefinition *index) { - JS_ASSERT(*emitted == false); + MOZ_ASSERT(*emitted == false); if (!ElementAccessIsDenseNative(obj, index)) return true; @@ -7428,7 +7428,7 @@ IonBuilder::getElemTryDense(bool *emitted, MDefinition *obj, MDefinition *index) bool IonBuilder::getElemTryTypedStatic(bool *emitted, MDefinition *obj, MDefinition *index) { - JS_ASSERT(*emitted == false); + MOZ_ASSERT(*emitted == false); Scalar::Type arrayType; if (!ElementAccessIsAnyTypedArray(obj, index, &arrayType)) @@ -7494,7 +7494,7 @@ IonBuilder::getElemTryTypedStatic(bool *emitted, MDefinition *obj, MDefinition * bool IonBuilder::getElemTryTypedArray(bool *emitted, MDefinition *obj, MDefinition *index) { - JS_ASSERT(*emitted == false); + MOZ_ASSERT(*emitted == false); Scalar::Type arrayType; if (!ElementAccessIsAnyTypedArray(obj, index, &arrayType)) @@ -7511,7 +7511,7 @@ IonBuilder::getElemTryTypedArray(bool *emitted, MDefinition *obj, MDefinition *i bool IonBuilder::getElemTryString(bool *emitted, MDefinition *obj, MDefinition *index) { - JS_ASSERT(*emitted == false); + MOZ_ASSERT(*emitted == false); if (obj->type() != MIRType_String || !IsNumberType(index->type())) return true; @@ -7545,7 +7545,7 @@ IonBuilder::getElemTryString(bool *emitted, MDefinition *obj, MDefinition *index bool IonBuilder::getElemTryArguments(bool *emitted, MDefinition *obj, MDefinition *index) { - JS_ASSERT(*emitted == false); + MOZ_ASSERT(*emitted == false); if (inliningDepth_ > 0) return true; @@ -7555,7 +7555,7 @@ IonBuilder::getElemTryArguments(bool *emitted, MDefinition *obj, MDefinition *in // Emit GetFrameArgument. - JS_ASSERT(!info().argsObjAliasesFormals()); + MOZ_ASSERT(!info().argsObjAliasesFormals()); // Type Inference has guaranteed this is an optimized arguments object. obj->setImplicitlyUsedUnchecked(); @@ -7588,7 +7588,7 @@ IonBuilder::getElemTryArguments(bool *emitted, MDefinition *obj, MDefinition *in bool IonBuilder::getElemTryArgumentsInlined(bool *emitted, MDefinition *obj, MDefinition *index) { - JS_ASSERT(*emitted == false); + MOZ_ASSERT(*emitted == false); if (inliningDepth_ == 0) return true; @@ -7599,11 +7599,11 @@ IonBuilder::getElemTryArgumentsInlined(bool *emitted, MDefinition *obj, MDefinit // Emit inlined arguments. obj->setImplicitlyUsedUnchecked(); - JS_ASSERT(!info().argsObjAliasesFormals()); + MOZ_ASSERT(!info().argsObjAliasesFormals()); // When the id is constant, we can just return the corresponding inlined argument if (index->isConstant() && index->toConstant()->value().isInt32()) { - JS_ASSERT(inliningDepth_ > 0); + MOZ_ASSERT(inliningDepth_ > 0); int32_t id = index->toConstant()->value().toInt32(); index->setImplicitlyUsedUnchecked(); @@ -7624,7 +7624,7 @@ IonBuilder::getElemTryArgumentsInlined(bool *emitted, MDefinition *obj, MDefinit bool IonBuilder::getElemTryCache(bool *emitted, MDefinition *obj, MDefinition *index) { - JS_ASSERT(*emitted == false); + MOZ_ASSERT(*emitted == false); // Make sure we have at least an object. if (!obj->mightBeType(MIRType_Object)) @@ -7771,7 +7771,7 @@ IonBuilder::jsop_getelem_dense(MDefinition *obj, MDefinition *index) // If maybeUndefined was true, the typeset must have undefined, and // then either additional types or a barrier. This means we should // never have a typed version of LoadElementHole. - JS_ASSERT(knownType == MIRType_Value); + MOZ_ASSERT(knownType == MIRType_Value); } // If the array is being converted to doubles, but we've observed @@ -7899,7 +7899,7 @@ IonBuilder::convertShiftToMaskForStaticTypedArray(MDefinition *id, MBitAnd *ptr = MBitAnd::New(alloc(), id->getOperand(0), mask); ptr->infer(nullptr, nullptr); - JS_ASSERT(!ptr->isEffectful()); + MOZ_ASSERT(!ptr->isEffectful()); current->add(mask); current->add(ptr); @@ -8052,7 +8052,7 @@ bool IonBuilder::setElemTryTypedObject(bool *emitted, MDefinition *obj, MDefinition *index, MDefinition *value) { - JS_ASSERT(*emitted == false); + MOZ_ASSERT(*emitted == false); TypedObjectPrediction objPrediction = typedObjectPrediction(obj); if (objPrediction.isUseless()) @@ -8065,7 +8065,7 @@ IonBuilder::setElemTryTypedObject(bool *emitted, MDefinition *obj, if (elemPrediction.isUseless()) return true; - JS_ASSERT(TypeDescr::isSized(elemPrediction.kind())); + MOZ_ASSERT(TypeDescr::isSized(elemPrediction.kind())); int32_t elemSize; if (!elemPrediction.hasKnownSize(&elemSize)) @@ -8107,7 +8107,7 @@ IonBuilder::setElemTryScalarElemOfTypedObject(bool *emitted, { // Must always be loading the same scalar type ScalarTypeDescr::Type elemType = elemPrediction.scalarType(); - JS_ASSERT(elemSize == ScalarTypeDescr::alignment(elemType)); + MOZ_ASSERT(elemSize == ScalarTypeDescr::alignment(elemType)); bool canBeNeutered; MDefinition *indexAsByteOffset; @@ -8131,7 +8131,7 @@ bool IonBuilder::setElemTryTypedStatic(bool *emitted, MDefinition *object, MDefinition *index, MDefinition *value) { - JS_ASSERT(*emitted == false); + MOZ_ASSERT(*emitted == false); Scalar::Type arrayType; if (!ElementAccessIsAnyTypedArray(object, index, &arrayType)) @@ -8193,7 +8193,7 @@ bool IonBuilder::setElemTryTypedArray(bool *emitted, MDefinition *object, MDefinition *index, MDefinition *value) { - JS_ASSERT(*emitted == false); + MOZ_ASSERT(*emitted == false); Scalar::Type arrayType; if (!ElementAccessIsAnyTypedArray(object, index, &arrayType)) @@ -8211,7 +8211,7 @@ bool IonBuilder::setElemTryDense(bool *emitted, MDefinition *object, MDefinition *index, MDefinition *value) { - JS_ASSERT(*emitted == false); + MOZ_ASSERT(*emitted == false); if (!ElementAccessIsDenseNative(object, index)) return true; @@ -8250,7 +8250,7 @@ bool IonBuilder::setElemTryArguments(bool *emitted, MDefinition *object, MDefinition *index, MDefinition *value) { - JS_ASSERT(*emitted == false); + MOZ_ASSERT(*emitted == false); if (object->type() != MIRType_MagicOptimizedArguments) return true; @@ -8263,7 +8263,7 @@ bool IonBuilder::setElemTryCache(bool *emitted, MDefinition *object, MDefinition *index, MDefinition *value) { - JS_ASSERT(*emitted == false); + MOZ_ASSERT(*emitted == false); if (!object->mightBeType(MIRType_Object)) return true; @@ -8351,7 +8351,7 @@ IonBuilder::jsop_setelem_dense(types::TemporaryTypeSet::DoubleConversion convers } case types::TemporaryTypeSet::AmbiguousDoubleConversion: { - JS_ASSERT(value->type() == MIRType_Int32); + MOZ_ASSERT(value->type() == MIRType_Int32); MInstruction *maybeDouble = MMaybeToDoubleElement::New(alloc(), elements, value); current->add(maybeDouble); newValue = maybeDouble; @@ -8376,7 +8376,7 @@ IonBuilder::jsop_setelem_dense(types::TemporaryTypeSet::DoubleConversion convers // the initialized length and bounds check. MStoreElementCommon *store; if (writeHole && writeOutOfBounds) { - JS_ASSERT(safety == SetElem_Normal); + MOZ_ASSERT(safety == SetElem_Normal); MStoreElementHole *ins = MStoreElementHole::New(alloc(), obj, elements, id, newValue); store = ins; @@ -8483,7 +8483,7 @@ bool IonBuilder::jsop_setelem_typed_object(Scalar::Type arrayType, SetElemSafety safety, bool racy, MDefinition *object, MDefinition *index, MDefinition *value) { - JS_ASSERT(safety == SetElem_Unsafe); // Can be fixed, but there's been no reason to as of yet + MOZ_ASSERT(safety == SetElem_Unsafe); // Can be fixed, but there's been no reason to as of yet MInstruction *int_index = MToInt32::New(alloc(), index); current->add(int_index); @@ -8558,7 +8558,7 @@ IonBuilder::jsop_arguments() current->push(current->argumentsObject()); return true; } - JS_ASSERT(lazyArguments_); + MOZ_ASSERT(lazyArguments_); current->push(lazyArguments_); return true; } @@ -8567,7 +8567,7 @@ bool IonBuilder::jsop_rest() { JSObject *templateObject = inspector->getTemplateObject(pc); - JS_ASSERT(templateObject->is()); + MOZ_ASSERT(templateObject->is()); if (inliningDepth_ == 0) { // We don't know anything about the callee. @@ -9003,7 +9003,7 @@ bool IonBuilder::storeSlot(MDefinition *obj, Shape *shape, MDefinition *value, bool needsBarrier, MIRType slotType /* = MIRType_None */) { - JS_ASSERT(shape->writable()); + MOZ_ASSERT(shape->writable()); return storeSlot(obj, shape->slot(), shape->numFixedSlots(), value, needsBarrier, slotType); } @@ -9111,7 +9111,7 @@ bool IonBuilder::getPropTryInferredConstant(bool *emitted, MDefinition *obj, PropertyName *name, types::TemporaryTypeSet *types) { - JS_ASSERT(*emitted == false); + MOZ_ASSERT(*emitted == false); // Need a result typeset to optimize. types::TemporaryTypeSet *objTypes = obj->resultTypeSet(); @@ -9144,7 +9144,7 @@ IonBuilder::getPropTryInferredConstant(bool *emitted, MDefinition *obj, Property bool IonBuilder::getPropTryArgumentsLength(bool *emitted, MDefinition *obj) { - JS_ASSERT(*emitted == false); + MOZ_ASSERT(*emitted == false); bool isOptimizedArgs = false; if (!checkIsDefinitelyOptimizedArguments(obj, &isOptimizedArgs)) @@ -9174,7 +9174,7 @@ IonBuilder::getPropTryArgumentsLength(bool *emitted, MDefinition *obj) bool IonBuilder::getPropTryArgumentsCallee(bool *emitted, MDefinition *obj, PropertyName *name) { - JS_ASSERT(*emitted == false); + MOZ_ASSERT(*emitted == false); bool isOptimizedArgs = false; if (!checkIsDefinitelyOptimizedArguments(obj, &isOptimizedArgs)) @@ -9198,7 +9198,7 @@ bool IonBuilder::getPropTryConstant(bool *emitted, MDefinition *obj, PropertyName *name, types::TemporaryTypeSet *types) { - JS_ASSERT(*emitted == false); + MOZ_ASSERT(*emitted == false); JSObject *singleton = types ? types->getSingleton() : nullptr; if (!singleton) return true; @@ -9208,7 +9208,7 @@ IonBuilder::getPropTryConstant(bool *emitted, MDefinition *obj, PropertyName *na return true; // Property access is a known constant -- safe to emit. - JS_ASSERT(!testString || !testObject); + MOZ_ASSERT(!testString || !testObject); if (testObject) current->add(MGuardObject::New(alloc(), obj)); else if (testString) @@ -9301,7 +9301,7 @@ bool IonBuilder::getPropTryDefiniteSlot(bool *emitted, MDefinition *obj, PropertyName *name, BarrierKind barrier, types::TemporaryTypeSet *types) { - JS_ASSERT(*emitted == false); + MOZ_ASSERT(*emitted == false); uint32_t slot = getDefiniteSlot(obj->resultTypeSet(), name); if (slot == UINT32_MAX) return true; @@ -9339,7 +9339,7 @@ bool IonBuilder::getPropTryCommonGetter(bool *emitted, MDefinition *obj, PropertyName *name, types::TemporaryTypeSet *types) { - JS_ASSERT(*emitted == false); + MOZ_ASSERT(*emitted == false); Shape *lastProperty = nullptr; JSFunction *commonGetter = nullptr; @@ -9486,7 +9486,7 @@ bool IonBuilder::getPropTryInlineAccess(bool *emitted, MDefinition *obj, PropertyName *name, BarrierKind barrier, types::TemporaryTypeSet *types) { - JS_ASSERT(*emitted == false); + MOZ_ASSERT(*emitted == false); if (obj->type() != MIRType_Object) return true; @@ -9510,7 +9510,7 @@ IonBuilder::getPropTryInlineAccess(bool *emitted, MDefinition *obj, PropertyName obj = addShapeGuard(obj, objShape, Bailout_ShapeGuard); Shape *shape = objShape->searchLinear(NameToId(name)); - JS_ASSERT(shape); + MOZ_ASSERT(shape); if (!loadSlot(obj, shape, rvalType, barrier, types)) return false; @@ -9571,7 +9571,7 @@ bool IonBuilder::getPropTryCache(bool *emitted, MDefinition *obj, PropertyName *name, BarrierKind barrier, types::TemporaryTypeSet *types) { - JS_ASSERT(*emitted == false); + MOZ_ASSERT(*emitted == false); // The input value must either be an object, or we should have strong suspicions // that it can be safely unboxed to an object. @@ -9781,7 +9781,7 @@ bool IonBuilder::setPropTryCommonSetter(bool *emitted, MDefinition *obj, PropertyName *name, MDefinition *value) { - JS_ASSERT(*emitted == false); + MOZ_ASSERT(*emitted == false); Shape *lastProperty = nullptr; JSFunction *commonSetter = nullptr; @@ -9869,7 +9869,7 @@ IonBuilder::setPropTryCommonDOMSetter(bool *emitted, MDefinition *obj, MDefinition *value, JSFunction *setter, bool isDOM) { - JS_ASSERT(*emitted == false); + MOZ_ASSERT(*emitted == false); if (!isDOM) return true; @@ -9879,7 +9879,7 @@ IonBuilder::setPropTryCommonDOMSetter(bool *emitted, MDefinition *obj, return true; // Emit SetDOMProperty. - JS_ASSERT(setter->jitInfo()->type() == JSJitInfo::Setter); + MOZ_ASSERT(setter->jitInfo()->type() == JSJitInfo::Setter); MSetDOMProperty *set = MSetDOMProperty::New(alloc(), setter->jitInfo()->setter, obj, value); current->add(set); @@ -9948,7 +9948,7 @@ IonBuilder::setPropTryDefiniteSlot(bool *emitted, MDefinition *obj, PropertyName *name, MDefinition *value, types::TemporaryTypeSet *objTypes) { - JS_ASSERT(*emitted == false); + MOZ_ASSERT(*emitted == false); uint32_t slot = getDefiniteSlot(obj->resultTypeSet(), name); if (slot == UINT32_MAX) @@ -9995,7 +9995,7 @@ IonBuilder::setPropTryInlineAccess(bool *emitted, MDefinition *obj, PropertyName *name, MDefinition *value, types::TemporaryTypeSet *objTypes) { - JS_ASSERT(*emitted == false); + MOZ_ASSERT(*emitted == false); BaselineInspector::ShapeVector shapes(alloc()); if (!inspector->maybeShapesForPropertyOp(pc, shapes)) @@ -10018,7 +10018,7 @@ IonBuilder::setPropTryInlineAccess(bool *emitted, MDefinition *obj, obj = addShapeGuard(obj, objShape, Bailout_ShapeGuard); Shape *shape = objShape->searchLinear(NameToId(name)); - JS_ASSERT(shape); + MOZ_ASSERT(shape); bool needsBarrier = objTypes->propertyNeedsBarrier(constraints(), NameToId(name)); if (!storeSlot(obj, shape, value, needsBarrier)) @@ -10064,7 +10064,7 @@ IonBuilder::setPropTryInlineAccess(bool *emitted, MDefinition *obj, for (size_t i = 0; i < shapes.length(); i++) { Shape *objShape = shapes[i]; Shape *shape = objShape->searchLinear(NameToId(name)); - JS_ASSERT(shape); + MOZ_ASSERT(shape); if (!ins->addShape(objShape, shape)) return false; } @@ -10084,7 +10084,7 @@ IonBuilder::setPropTryCache(bool *emitted, MDefinition *obj, PropertyName *name, MDefinition *value, bool barrier, types::TemporaryTypeSet *objTypes) { - JS_ASSERT(*emitted == false); + MOZ_ASSERT(*emitted == false); // Emit SetPropertyCache. MSetPropertyCache *ins = MSetPropertyCache::New(alloc(), obj, value, name, script()->strict(), barrier); @@ -10151,7 +10151,7 @@ IonBuilder::jsop_regexp(RegExpObject *reobj) MOZ_ASSERT(res); uint32_t origFlags = reobj->getFlags(); uint32_t staticsFlags = res->getFlags(); - JS_ASSERT((origFlags & staticsFlags) == staticsFlags); + MOZ_ASSERT((origFlags & staticsFlags) == staticsFlags); } #endif @@ -10222,7 +10222,7 @@ IonBuilder::jsop_setarg(uint32_t arg) // to wrap the spilling action, we don't want the spilling to be // captured by the GETARG and by the resume point, only by // MGetFrameArgument. - JS_ASSERT(analysis_.hasSetArg()); + MOZ_ASSERT(analysis_.hasSetArg()); MDefinition *val = current->peek(-1); // If an arguments object is in use, and it aliases formals, then all SETARGs @@ -10247,7 +10247,7 @@ IonBuilder::jsop_setarg(uint32_t arg) // the frame does not actually need to be updated with the new arg value. if (info().argumentsAliasesFormals()) { // JSOP_SETARG with magic arguments within inline frames is not yet supported. - JS_ASSERT(script()->uninlineable() && !isInlineBuilder()); + MOZ_ASSERT(script()->uninlineable() && !isInlineBuilder()); MSetFrameArgument *store = MSetFrameArgument::New(alloc(), arg, val); modifiesFrameArguments_ = true; @@ -10278,13 +10278,13 @@ IonBuilder::jsop_setarg(uint32_t arg) otherUses = true; } if (!otherUses) { - JS_ASSERT(op->resultTypeSet() == &argTypes[arg]); + MOZ_ASSERT(op->resultTypeSet() == &argTypes[arg]); argTypes[arg].addType(types::Type::UnknownType(), alloc_->lifoAlloc()); if (val->isMul()) { val->setResultType(MIRType_Double); val->toMul()->setSpecialization(MIRType_Double); } else { - JS_ASSERT(val->type() == MIRType_Int32); + MOZ_ASSERT(val->type() == MIRType_Int32); } val->setResultTypeSet(nullptr); } @@ -10299,7 +10299,7 @@ IonBuilder::jsop_setarg(uint32_t arg) bool IonBuilder::jsop_defvar(uint32_t index) { - JS_ASSERT(JSOp(*pc) == JSOP_DEFVAR || JSOp(*pc) == JSOP_DEFCONST); + MOZ_ASSERT(JSOp(*pc) == JSOP_DEFVAR || JSOp(*pc) == JSOP_DEFCONST); PropertyName *name = script()->getName(index); @@ -10309,10 +10309,10 @@ IonBuilder::jsop_defvar(uint32_t index) attrs |= JSPROP_READONLY; else attrs |= JSPROP_PERMANENT; - JS_ASSERT(!script()->isForEval()); + MOZ_ASSERT(!script()->isForEval()); // Pass the ScopeChain. - JS_ASSERT(analysis().usesScopeChain()); + MOZ_ASSERT(analysis().usesScopeChain()); // Bake the name pointer into the MDefVar. MDefVar *defvar = MDefVar::New(alloc(), name, attrs, current->scopeChain()); @@ -10328,7 +10328,7 @@ IonBuilder::jsop_deffun(uint32_t index) if (fun->isNative() && IsAsmJSModuleNative(fun->native())) return abort("asm.js module function"); - JS_ASSERT(analysis().usesScopeChain()); + MOZ_ASSERT(analysis().usesScopeChain()); MDefFun *deffun = MDefFun::New(alloc(), fun, current->scopeChain()); current->add(deffun); @@ -10550,7 +10550,7 @@ IonBuilder::hasStaticScopeObject(ScopeCoordinate sc, JSObject **pcall) !environment->as().isForEval() && environment->as().callee().nonLazyScript() == outerScript) { - JS_ASSERT(environment->hasSingletonType()); + MOZ_ASSERT(environment->hasSingletonType()); *pcall = environment; return true; } @@ -10568,7 +10568,7 @@ IonBuilder::hasStaticScopeObject(ScopeCoordinate sc, JSObject **pcall) singletonScope->is() && singletonScope->as().callee().nonLazyScript() == outerScript) { - JS_ASSERT(singletonScope->hasSingletonType()); + MOZ_ASSERT(singletonScope->hasSingletonType()); *pcall = singletonScope; return true; } @@ -10857,7 +10857,7 @@ IonBuilder::typedObjectPrediction(types::TemporaryTypeSet *types) // typed objects have immutable prototypes, and they are // always instances of TypedProto - JS_ASSERT(proto.isObject() && proto.toObject()->is()); + MOZ_ASSERT(proto.isObject() && proto.toObject()->is()); TypedProto &typedProto = proto.toObject()->as(); out.addProto(typedProto); @@ -10902,8 +10902,8 @@ IonBuilder::loadTypedObjectData(MDefinition *typedObj, MDefinition **owner, MDefinition **ownerOffset) { - JS_ASSERT(typedObj->type() == MIRType_Object); - JS_ASSERT(offset->type() == MIRType_Int32); + MOZ_ASSERT(typedObj->type() == MIRType_Object); + MOZ_ASSERT(offset->type() == MIRType_Int32); // Shortcircuit derived type objects, meaning the intermediate // objects created to represent `a.b` in an expression like diff --git a/js/src/jit/IonBuilder.h b/js/src/jit/IonBuilder.h index 055b9e73240f..594217e459c4 100644 --- a/js/src/jit/IonBuilder.h +++ b/js/src/jit/IonBuilder.h @@ -894,7 +894,7 @@ class IonBuilder uint32_t loopDepth_; BytecodeSite bytecodeSite(jsbytecode *pc) { - JS_ASSERT(info().inlineScriptTree()->script()->containsPC(pc)); + MOZ_ASSERT(info().inlineScriptTree()->script()->containsPC(pc)); return BytecodeSite(info().inlineScriptTree(), pc); } @@ -1017,7 +1017,7 @@ class CallInfo { } bool init(CallInfo &callInfo) { - JS_ASSERT(constructing_ == callInfo.constructing()); + MOZ_ASSERT(constructing_ == callInfo.constructing()); fun_ = callInfo.fun(); thisArg_ = callInfo.thisArg(); @@ -1029,7 +1029,7 @@ class CallInfo } bool init(MBasicBlock *current, uint32_t argc) { - JS_ASSERT(args_.empty()); + MOZ_ASSERT(args_.empty()); // Get the arguments in the right order if (!args_.reserve(argc)) @@ -1065,7 +1065,7 @@ class CallInfo } void setArgs(MDefinitionVector *args) { - JS_ASSERT(args_.empty()); + MOZ_ASSERT(args_.empty()); args_.appendAll(*args); } @@ -1078,17 +1078,17 @@ class CallInfo } MDefinition *getArg(uint32_t i) const { - JS_ASSERT(i < argc()); + MOZ_ASSERT(i < argc()); return args_[i]; } void setArg(uint32_t i, MDefinition *def) { - JS_ASSERT(i < argc()); + MOZ_ASSERT(i < argc()); args_[i] = def; } MDefinition *thisArg() const { - JS_ASSERT(thisArg_); + MOZ_ASSERT(thisArg_); return thisArg_; } @@ -1108,7 +1108,7 @@ class CallInfo } MDefinition *fun() const { - JS_ASSERT(fun_); + MOZ_ASSERT(fun_); return fun_; } diff --git a/js/src/jit/IonCaches.cpp b/js/src/jit/IonCaches.cpp index cf3657f68dbd..26e00ad9d646 100644 --- a/js/src/jit/IonCaches.cpp +++ b/js/src/jit/IonCaches.cpp @@ -40,14 +40,14 @@ typedef Rooted RootedSharedTypedArrayObject; void CodeLocationJump::repoint(JitCode *code, MacroAssembler *masm) { - JS_ASSERT(state_ == Relative); + MOZ_ASSERT(state_ == Relative); size_t new_off = (size_t)raw_; #ifdef JS_SMALL_BRANCH size_t jumpTableEntryOffset = reinterpret_cast(jumpTableEntry_); #endif if (masm != nullptr) { #ifdef JS_CODEGEN_X64 - JS_ASSERT((uint64_t)raw_ <= UINT32_MAX); + MOZ_ASSERT((uint64_t)raw_ <= UINT32_MAX); #endif new_off = masm->actualOffset((uintptr_t)raw_); #ifdef JS_SMALL_BRANCH @@ -64,15 +64,15 @@ CodeLocationJump::repoint(JitCode *code, MacroAssembler *masm) void CodeLocationLabel::repoint(JitCode *code, MacroAssembler *masm) { - JS_ASSERT(state_ == Relative); + MOZ_ASSERT(state_ == Relative); size_t new_off = (size_t)raw_; if (masm != nullptr) { #ifdef JS_CODEGEN_X64 - JS_ASSERT((uint64_t)raw_ <= UINT32_MAX); + MOZ_ASSERT((uint64_t)raw_ <= UINT32_MAX); #endif new_off = masm->actualOffset((uintptr_t)raw_); } - JS_ASSERT(new_off < code->instructionsSize()); + MOZ_ASSERT(new_off < code->instructionsSize()); raw_ = code->raw() + new_off; setAbsolute(); @@ -192,7 +192,7 @@ class IonCache::StubAttacher template void branchNextStub(MacroAssembler &masm, Assembler::Condition cond, T1 op1, T2 op2) { - JS_ASSERT(!hasNextStubOffset_); + MOZ_ASSERT(!hasNextStubOffset_); RepatchLabel nextStub; nextStubOffset_ = masm.branchPtrWithPatch(cond, op1, op2, &nextStub); hasNextStubOffset_ = true; @@ -216,7 +216,7 @@ class IonCache::StubAttacher } void jumpNextStub(MacroAssembler &masm) { - JS_ASSERT(!hasNextStubOffset_); + MOZ_ASSERT(!hasNextStubOffset_); RepatchLabel nextStub; nextStubOffset_ = masm.jumpWithPatch(&nextStub); hasNextStubOffset_ = true; @@ -234,7 +234,7 @@ class IonCache::StubAttacher // WARNING: it is on the stack at the time of the GC. No ImmGCPtr is needed as the // WARNING: stubs are flushed on GC. // WARNING: - JS_ASSERT(!hasStubCodePatchOffset_); + MOZ_ASSERT(!hasStubCodePatchOffset_); stubCodePatchOffset_ = masm.PushWithPatch(STUB_ADDR); hasStubCodePatchOffset_ = true; } @@ -330,7 +330,7 @@ class DispatchIonCache::DispatchStubPrepender : public IonCache::StubAttacher } void patchNextStubJump(MacroAssembler &masm, JitCode *code) { - JS_ASSERT(hasNextStubOffset_); + MOZ_ASSERT(hasNextStubOffset_); // Jump to the previous entry in the stub dispatch table. We // have not yet executed the code we're patching the jump in. @@ -371,7 +371,7 @@ void DispatchIonCache::updateBaseAddress(JitCode *code, MacroAssembler &masm) { // The address of firstStub_ should be pointer aligned. - JS_ASSERT(uintptr_t(&firstStub_) % sizeof(uintptr_t) == 0); + MOZ_ASSERT(uintptr_t(&firstStub_) % sizeof(uintptr_t) == 0); IonCache::updateBaseAddress(code, masm); dispatchLabel_.fixup(&masm); @@ -385,7 +385,7 @@ DispatchIonCache::updateBaseAddress(JitCode *code, MacroAssembler &masm) void IonCache::attachStub(MacroAssembler &masm, StubAttacher &attacher, Handle code) { - JS_ASSERT(canAttachStub()); + MOZ_ASSERT(canAttachStub()); incrementStubCount(); // Update the success path to continue after the IC initial jump. @@ -471,7 +471,7 @@ GeneratePrototypeGuards(JSContext *cx, IonScript *ion, MacroAssembler &masm, JSO * it, and any other change to the holder, or adding a shadowing property will result * in reshaping the holder, and thus the failure of the shape guard. */ - JS_ASSERT(obj != holder); + MOZ_ASSERT(obj != holder); if (obj->hasUncacheableProto()) { // Note: objectReg and scratchReg may be the same register, so we cannot @@ -489,7 +489,7 @@ GeneratePrototypeGuards(JSContext *cx, IonScript *ion, MacroAssembler &masm, JSO return; while (pobj != holder) { if (pobj->hasUncacheableProto()) { - JS_ASSERT(!pobj->hasSingletonType()); + MOZ_ASSERT(!pobj->hasSingletonType()); masm.moveNurseryPtr(ImmMaybeNurseryPtr(pobj), scratchReg); Address objType(scratchReg, JSObject::offsetOfType()); masm.branchPtr(Assembler::NotEqual, objType, ImmGCPtr(pobj->type()), failures); @@ -537,7 +537,7 @@ IsCacheableNoProperty(JSObject *obj, JSObject *holder, Shape *shape, jsbytecode if (shape) return false; - JS_ASSERT(!holder); + MOZ_ASSERT(!holder); // Just because we didn't find the property on the object doesn't mean it // won't magically appear through various engine hacks: @@ -657,7 +657,7 @@ static inline void EmitLoadSlot(MacroAssembler &masm, JSObject *holder, Shape *shape, Register holderReg, TypedOrValueRegister output, Register scratchReg) { - JS_ASSERT(holder); + MOZ_ASSERT(holder); if (holder->isFixedSlot(shape->slot())) { Address addr(holderReg, JSObject::getFixedSlotOffset(shape->slot())); masm.loadTypedOrValue(addr, output); @@ -674,7 +674,7 @@ GenerateDOMProxyChecks(JSContext *cx, MacroAssembler &masm, JSObject *obj, PropertyName *name, Register object, Label *stubFailure, bool skipExpandoCheck = false) { - JS_ASSERT(IsCacheableDOMProxy(obj)); + MOZ_ASSERT(IsCacheableDOMProxy(obj)); // Guard the following: // 1. The object is a DOMProxy. @@ -726,7 +726,7 @@ GenerateDOMProxyChecks(JSContext *cx, MacroAssembler &masm, JSObject *obj, masm.branchTestUndefined(Assembler::Equal, tempVal, &domProxyOk); if (expandoVal.isObject()) { - JS_ASSERT(!expandoVal.toObject().nativeContains(cx, name)); + MOZ_ASSERT(!expandoVal.toObject().nativeContains(cx, name)); // Reference object has an expando object that doesn't define the name. Check that // the incoming object has an expando object with the same shape. @@ -754,7 +754,7 @@ GenerateReadSlot(JSContext *cx, IonScript *ion, MacroAssembler &masm, Shape *shape, Register object, TypedOrValueRegister output, Label *failures = nullptr) { - JS_ASSERT(obj->isNative()); + MOZ_ASSERT(obj->isNative()); // If there's a single jump to |failures|, we can patch the shape guard // jump directly. Otherwise, jump to the end of the stub, so there's a // common point to patch. @@ -820,7 +820,7 @@ GenerateReadSlot(JSContext *cx, IonScript *ion, MacroAssembler &masm, // prototype chain. JSObject *proto = obj->getTaggedProto().toObjectOrNull(); Register lastReg = object; - JS_ASSERT(scratchReg != object); + MOZ_ASSERT(scratchReg != object); while (proto) { masm.loadObjProto(lastReg, scratchReg); @@ -869,7 +869,7 @@ EmitGetterCall(JSContext *cx, MacroAssembler &masm, TypedOrValueRegister output, void *returnAddr) { - JS_ASSERT(output.hasValue()); + MOZ_ASSERT(output.hasValue()); MacroAssembler::AfterICSaveLive aic = masm.icSaveLive(liveRegs); // Remaining registers should basically be free, but we need to use |object| still @@ -891,12 +891,12 @@ EmitGetterCall(JSContext *cx, MacroAssembler &masm, JS_ASSERT_IF(!callNative, IsCacheableGetPropCallPropertyOp(obj, holder, shape)); if (callNative) { - JS_ASSERT(shape->hasGetterValue() && shape->getterValue().isObject() && - shape->getterValue().toObject().is()); + MOZ_ASSERT(shape->hasGetterValue() && shape->getterValue().isObject() && + shape->getterValue().toObject().is()); JSFunction *target = &shape->getterValue().toObject().as(); - JS_ASSERT(target); - JS_ASSERT(target->isNative()); + MOZ_ASSERT(target); + MOZ_ASSERT(target->isNative()); // Native functions have the signature: // bool (*)(JSContext *, unsigned, Value *vp) @@ -943,7 +943,7 @@ EmitGetterCall(JSContext *cx, MacroAssembler &masm, Register argIdReg = regSet.takeGeneral(); PropertyOp target = shape->getterOp(); - JS_ASSERT(target); + MOZ_ASSERT(target); // Push stubCode for marking. attacher.pushStubCodePointer(masm); @@ -996,8 +996,8 @@ GenerateCallGetter(JSContext *cx, IonScript *ion, MacroAssembler &masm, JSObject *holder, HandleShape shape, RegisterSet &liveRegs, Register object, TypedOrValueRegister output, void *returnAddr, Label *failures = nullptr) { - JS_ASSERT(obj->isNative()); - JS_ASSERT(output.hasValue()); + MOZ_ASSERT(obj->isNative()); + MOZ_ASSERT(output.hasValue()); // Use the passed in label if there was one. Otherwise, we'll have to make our own. Label stubFailure; @@ -1056,7 +1056,7 @@ static bool GenerateArrayLength(JSContext *cx, MacroAssembler &masm, IonCache::StubAttacher &attacher, JSObject *obj, Register object, TypedOrValueRegister output) { - JS_ASSERT(obj->is()); + MOZ_ASSERT(obj->is()); Label failures; @@ -1071,7 +1071,7 @@ GenerateArrayLength(JSContext *cx, MacroAssembler &masm, IonCache::StubAttacher if (output.hasValue()) { outReg = output.valueReg().scratchReg(); } else { - JS_ASSERT(output.type() == MIRType_Int32); + MOZ_ASSERT(output.type() == MIRType_Int32); outReg = output.typedReg().gpr(); } @@ -1079,7 +1079,7 @@ GenerateArrayLength(JSContext *cx, MacroAssembler &masm, IonCache::StubAttacher masm.load32(Address(outReg, ObjectElements::offsetOfLength()), outReg); // The length is an unsigned int, but the value encodes a signed int. - JS_ASSERT(object != outReg); + MOZ_ASSERT(object != outReg); masm.branchTest32(Assembler::Signed, outReg, outReg, &failures); if (output.hasValue()) @@ -1108,10 +1108,10 @@ GenerateTypedArrayLength(JSContext *cx, MacroAssembler &masm, IonCache::StubAtta if (output.hasValue()) { tmpReg = output.valueReg().scratchReg(); } else { - JS_ASSERT(output.type() == MIRType_Int32); + MOZ_ASSERT(output.type() == MIRType_Int32); tmpReg = output.typedReg().gpr(); } - JS_ASSERT(object != tmpReg); + MOZ_ASSERT(object != tmpReg); // Implement the negated version of JSObject::isTypedArray predicate. masm.loadObjClass(object, tmpReg); @@ -1236,9 +1236,9 @@ GetPropertyIC::tryAttachNative(JSContext *cx, HandleScript outerScript, IonScrip HandleObject obj, HandlePropertyName name, void *returnAddr, bool *emitted) { - JS_ASSERT(canAttachStub()); - JS_ASSERT(!*emitted); - JS_ASSERT(outerScript->ionScript() == ion); + MOZ_ASSERT(canAttachStub()); + MOZ_ASSERT(!*emitted); + MOZ_ASSERT(outerScript->ionScript() == ion); RootedShape shape(cx); RootedObject holder(cx); @@ -1286,8 +1286,8 @@ bool GetPropertyIC::tryAttachTypedArrayLength(JSContext *cx, HandleScript outerScript, IonScript *ion, HandleObject obj, HandlePropertyName name, bool *emitted) { - JS_ASSERT(canAttachStub()); - JS_ASSERT(!*emitted); + MOZ_ASSERT(canAttachStub()); + MOZ_ASSERT(!*emitted); if (!IsAnyTypedArray(obj)) return true; @@ -1323,7 +1323,7 @@ EmitCallProxyGet(JSContext *cx, MacroAssembler &masm, IonCache::StubAttacher &at PropertyName *name, RegisterSet liveRegs, Register object, TypedOrValueRegister output, jsbytecode *pc, void *returnAddr) { - JS_ASSERT(output.hasValue()); + MOZ_ASSERT(output.hasValue()); MacroAssembler::AfterICSaveLive aic = masm.icSaveLive(liveRegs); // Remaining registers should be free, but we need to use |object| still @@ -1395,11 +1395,11 @@ GetPropertyIC::tryAttachDOMProxyShadowed(JSContext *cx, HandleScript outerScript HandleObject obj, void *returnAddr, bool *emitted) { - JS_ASSERT(canAttachStub()); - JS_ASSERT(!*emitted); - JS_ASSERT(IsCacheableDOMProxy(obj)); - JS_ASSERT(monitoredResult()); - JS_ASSERT(output().hasValue()); + MOZ_ASSERT(canAttachStub()); + MOZ_ASSERT(!*emitted); + MOZ_ASSERT(IsCacheableDOMProxy(obj)); + MOZ_ASSERT(monitoredResult()); + MOZ_ASSERT(output().hasValue()); if (idempotent()) return true; @@ -1441,11 +1441,11 @@ GetPropertyIC::tryAttachDOMProxyUnshadowed(JSContext *cx, HandleScript outerScri HandleObject obj, HandlePropertyName name, bool resetNeeded, void *returnAddr, bool *emitted) { - JS_ASSERT(canAttachStub()); - JS_ASSERT(!*emitted); - JS_ASSERT(IsCacheableDOMProxy(obj)); - JS_ASSERT(monitoredResult()); - JS_ASSERT(output().hasValue()); + MOZ_ASSERT(canAttachStub()); + MOZ_ASSERT(!*emitted); + MOZ_ASSERT(IsCacheableDOMProxy(obj)); + MOZ_ASSERT(monitoredResult()); + MOZ_ASSERT(output().hasValue()); RootedObject checkObj(cx, obj->getTaggedProto().toObjectOrNull()); RootedObject holder(cx); @@ -1454,7 +1454,7 @@ GetPropertyIC::tryAttachDOMProxyUnshadowed(JSContext *cx, HandleScript outerScri NativeGetPropCacheability canCache = CanAttachNativeGetProp(cx, *this, checkObj, name, &holder, &shape, /* skipArrayLen = */true); - JS_ASSERT(canCache != CanAttachArrayLength); + MOZ_ASSERT(canCache != CanAttachArrayLength); if (canCache == CanAttachNone) return true; @@ -1510,8 +1510,8 @@ GetPropertyIC::tryAttachDOMProxyUnshadowed(JSContext *cx, HandleScript outerScri // EmitGetterCall() expects |obj| to be the object the property is // on to do some checks. Since we actually looked at checkObj, and // no extra guards will be generated, we can just pass that instead. - JS_ASSERT(canCache == CanAttachCallGetter); - JS_ASSERT(!idempotent()); + MOZ_ASSERT(canCache == CanAttachCallGetter); + MOZ_ASSERT(!idempotent()); if (!EmitGetterCall(cx, masm, attacher, checkObj, holder, shape, liveRegs_, object(), output(), returnAddr)) { @@ -1521,7 +1521,7 @@ GetPropertyIC::tryAttachDOMProxyUnshadowed(JSContext *cx, HandleScript outerScri } else { // Property was not found on the prototype chain. Deoptimize down to // proxy get call - JS_ASSERT(!idempotent()); + MOZ_ASSERT(!idempotent()); if (!EmitCallProxyGet(cx, masm, attacher, name, liveRegs_, object(), output(), pc(), returnAddr)) { @@ -1541,8 +1541,8 @@ GetPropertyIC::tryAttachProxy(JSContext *cx, HandleScript outerScript, IonScript HandleObject obj, HandlePropertyName name, void *returnAddr, bool *emitted) { - JS_ASSERT(canAttachStub()); - JS_ASSERT(!*emitted); + MOZ_ASSERT(canAttachStub()); + MOZ_ASSERT(!*emitted); if (!obj->is()) return true; @@ -1573,11 +1573,11 @@ GetPropertyIC::tryAttachGenericProxy(JSContext *cx, HandleScript outerScript, Io HandleObject obj, HandlePropertyName name, void *returnAddr, bool *emitted) { - JS_ASSERT(canAttachStub()); - JS_ASSERT(!*emitted); - JS_ASSERT(obj->is()); - JS_ASSERT(monitoredResult()); - JS_ASSERT(output().hasValue()); + MOZ_ASSERT(canAttachStub()); + MOZ_ASSERT(!*emitted); + MOZ_ASSERT(obj->is()); + MOZ_ASSERT(monitoredResult()); + MOZ_ASSERT(output().hasValue()); if (hasGenericProxyStub()) return true; @@ -1611,7 +1611,7 @@ GetPropertyIC::tryAttachGenericProxy(JSContext *cx, HandleScript outerScript, Io masm.bind(&failures); attacher.jumpNextStub(masm); - JS_ASSERT(!hasGenericProxyStub_); + MOZ_ASSERT(!hasGenericProxyStub_); hasGenericProxyStub_ = true; return linkAndAttachStub(cx, masm, attacher, ion, "Generic Proxy get"); @@ -1621,8 +1621,8 @@ bool GetPropertyIC::tryAttachArgumentsLength(JSContext *cx, HandleScript outerScript, IonScript *ion, HandleObject obj, HandlePropertyName name, bool *emitted) { - JS_ASSERT(canAttachStub()); - JS_ASSERT(!*emitted); + MOZ_ASSERT(canAttachStub()); + MOZ_ASSERT(!*emitted); if (name != cx->names().length) return true; @@ -1638,7 +1638,7 @@ GetPropertyIC::tryAttachArgumentsLength(JSContext *cx, HandleScript outerScript, *emitted = true; - JS_ASSERT(!idempotent()); + MOZ_ASSERT(!idempotent()); Label failures; MacroAssembler masm(cx, ion, outerScript, profilerLeavePc_); @@ -1648,10 +1648,10 @@ GetPropertyIC::tryAttachArgumentsLength(JSContext *cx, HandleScript outerScript, if (output().hasValue()) { tmpReg = output().valueReg().scratchReg(); } else { - JS_ASSERT(output().type() == MIRType_Int32); + MOZ_ASSERT(output().type() == MIRType_Int32); tmpReg = output().typedReg().gpr(); } - JS_ASSERT(object() != tmpReg); + MOZ_ASSERT(object() != tmpReg); const Class *clasp = obj->is() ? &StrictArgumentsObject::class_ : &NormalArgumentsObject::class_; @@ -1677,12 +1677,12 @@ GetPropertyIC::tryAttachArgumentsLength(JSContext *cx, HandleScript outerScript, attacher.jumpNextStub(masm); if (obj->is()) { - JS_ASSERT(!hasStrictArgumentsLengthStub_); + MOZ_ASSERT(!hasStrictArgumentsLengthStub_); hasStrictArgumentsLengthStub_ = true; return linkAndAttachStub(cx, masm, attacher, ion, "ArgsObj length (strict)"); } - JS_ASSERT(!hasNormalArgumentsLengthStub_); + MOZ_ASSERT(!hasNormalArgumentsLengthStub_); hasNormalArgumentsLengthStub_ = true; return linkAndAttachStub(cx, masm, attacher, ion, "ArgsObj length (normal)"); } @@ -1692,7 +1692,7 @@ GetPropertyIC::tryAttachStub(JSContext *cx, HandleScript outerScript, IonScript HandleObject obj, HandlePropertyName name, void *returnAddr, bool *emitted) { - JS_ASSERT(!*emitted); + MOZ_ASSERT(!*emitted); if (!canAttachStub()) return true; @@ -1798,7 +1798,7 @@ GetPropertyIC::reset() bool ParallelIonCache::initStubbedShapes(JSContext *cx) { - JS_ASSERT(isAllocated()); + MOZ_ASSERT(isAllocated()); if (!stubbedShapes_) { stubbedShapes_ = cx->new_(cx); return stubbedShapes_ && stubbedShapes_->init(); @@ -1966,7 +1966,7 @@ GenerateSetSlot(JSContext *cx, MacroAssembler &masm, IonCache::StubAttacher &att JSObject *obj, Shape *shape, Register object, ConstantOrRegister value, bool needsTypeBarrier, bool checkTypeset) { - JS_ASSERT(obj->isNative()); + MOZ_ASSERT(obj->isNative()); Label failures, barrierFailure; masm.branchPtr(Assembler::NotEqual, @@ -1988,8 +1988,8 @@ GenerateSetSlot(JSContext *cx, MacroAssembler &masm, IonCache::StubAttacher &att if (checkTypeset) { TypedOrValueRegister valReg = value.reg(); types::HeapTypeSet *propTypes = type->maybeGetProperty(shape->propid()); - JS_ASSERT(propTypes); - JS_ASSERT(!propTypes->unknown()); + MOZ_ASSERT(propTypes); + MOZ_ASSERT(!propTypes->unknown()); // guardTypeSet can read from type sets without triggering read barriers. types::TypeSet::readBarrier(propTypes); @@ -2046,7 +2046,7 @@ SetPropertyIC::attachSetSlot(JSContext *cx, HandleScript outerScript, IonScript static bool IsCacheableSetPropCallNative(HandleObject obj, HandleObject holder, HandleShape shape) { - JS_ASSERT(obj->isNative()); + MOZ_ASSERT(obj->isNative()); if (!shape || !IsCacheableProtoChainForIon(obj, holder)) return false; @@ -2059,7 +2059,7 @@ IsCacheableSetPropCallNative(HandleObject obj, HandleObject holder, HandleShape static bool IsCacheableSetPropCallPropertyOp(HandleObject obj, HandleObject holder, HandleShape shape) { - JS_ASSERT(obj->isNative()); + MOZ_ASSERT(obj->isNative()); if (!shape) return false; @@ -2155,7 +2155,7 @@ bool SetPropertyIC::attachGenericProxy(JSContext *cx, HandleScript outerScript, IonScript *ion, void *returnAddr) { - JS_ASSERT(!hasGenericProxyStub()); + MOZ_ASSERT(!hasGenericProxyStub()); MacroAssembler masm(cx, ion, outerScript, profilerLeavePc_); RepatchStubAppender attacher(*this); @@ -2201,7 +2201,7 @@ SetPropertyIC::attachGenericProxy(JSContext *cx, HandleScript outerScript, IonSc masm.bind(&failures); attacher.jumpNextStub(masm); - JS_ASSERT(!hasGenericProxyStub_); + MOZ_ASSERT(!hasGenericProxyStub_); hasGenericProxyStub_ = true; return linkAndAttachStub(cx, masm, attacher, ion, "generic proxy set"); @@ -2211,7 +2211,7 @@ bool SetPropertyIC::attachDOMProxyShadowed(JSContext *cx, HandleScript outerScript, IonScript *ion, HandleObject obj, void *returnAddr) { - JS_ASSERT(IsCacheableDOMProxy(obj)); + MOZ_ASSERT(IsCacheableDOMProxy(obj)); Label failures; MacroAssembler masm(cx, ion, outerScript, profilerLeavePc_); @@ -2307,11 +2307,11 @@ GenerateCallSetter(JSContext *cx, IonScript *ion, MacroAssembler &masm, JS_ASSERT_IF(!callNative, IsCacheableSetPropCallPropertyOp(obj, holder, shape)); if (callNative) { - JS_ASSERT(shape->hasSetterValue() && shape->setterObject() && - shape->setterObject()->is()); + MOZ_ASSERT(shape->hasSetterValue() && shape->setterObject() && + shape->setterObject()->is()); JSFunction *target = &shape->setterObject()->as(); - JS_ASSERT(target->isNative()); + MOZ_ASSERT(target->isNative()); Register argUintNReg = regSet.takeGeneral(); @@ -2359,7 +2359,7 @@ GenerateCallSetter(JSContext *cx, IonScript *ion, MacroAssembler &masm, attacher.pushStubCodePointer(masm); StrictPropertyOp target = shape->setterOp(); - JS_ASSERT(target); + MOZ_ASSERT(target); // JSStrictPropertyOp: bool fn(JSContext *cx, HandleObject obj, // HandleId id, bool strict, MutableHandleValue vp); @@ -2410,7 +2410,7 @@ IsCacheableDOMProxyUnshadowedSetterCall(JSContext *cx, HandleObject obj, HandleP MutableHandleObject holder, MutableHandleShape shape, bool *isSetter) { - JS_ASSERT(IsCacheableDOMProxy(obj)); + MOZ_ASSERT(IsCacheableDOMProxy(obj)); *isSetter = false; @@ -2438,7 +2438,7 @@ bool SetPropertyIC::attachDOMProxyUnshadowed(JSContext *cx, HandleScript outerScript, IonScript *ion, HandleObject obj, void *returnAddr) { - JS_ASSERT(IsCacheableDOMProxy(obj)); + MOZ_ASSERT(IsCacheableDOMProxy(obj)); Label failures; MacroAssembler masm(cx, ion, outerScript, profilerLeavePc_); @@ -2494,7 +2494,7 @@ SetPropertyIC::attachCallSetter(JSContext *cx, HandleScript outerScript, IonScri HandleObject obj, HandleObject holder, HandleShape shape, void *returnAddr) { - JS_ASSERT(obj->isNative()); + MOZ_ASSERT(obj->isNative()); MacroAssembler masm(cx, ion, outerScript, profilerLeavePc_); RepatchStubAppender attacher(*this); @@ -2527,7 +2527,7 @@ GenerateAddSlot(JSContext *cx, MacroAssembler &masm, IonCache::StubAttacher &att Register object, ConstantOrRegister value, bool checkTypeset) { - JS_ASSERT(obj->isNative()); + MOZ_ASSERT(obj->isNative()); Label failures; @@ -2547,8 +2547,8 @@ GenerateAddSlot(JSContext *cx, MacroAssembler &masm, IonCache::StubAttacher &att TypedOrValueRegister valReg = value.reg(); types::TypeObject *type = obj->type(); types::HeapTypeSet *propTypes = type->maybeGetProperty(obj->lastProperty()->propid()); - JS_ASSERT(propTypes); - JS_ASSERT(!propTypes->unknown()); + MOZ_ASSERT(propTypes); + MOZ_ASSERT(!propTypes->unknown()); // guardTypeSet can read from type sets without triggering read barriers. types::TypeSet::readBarrier(propTypes); @@ -2686,7 +2686,7 @@ static bool IsPropertySetInlineable(HandleObject obj, HandleId id, MutableHandleShape pshape, ConstantOrRegister val, bool needsTypeBarrier, bool *checkTypeset) { - JS_ASSERT(obj->isNative()); + MOZ_ASSERT(obj->isNative()); // Do a pure non-proto chain climbing lookup. See note in // CanAttachNativeGetProp. @@ -2714,7 +2714,7 @@ static bool IsPropertyAddInlineable(HandleObject obj, HandleId id, ConstantOrRegister val, uint32_t oldSlots, HandleShape oldShape, bool needsTypeBarrier, bool *checkTypeset) { - JS_ASSERT(obj->isNative()); + MOZ_ASSERT(obj->isNative()); // If the shape of the object did not change, then this was not an add. if (obj->lastProperty() == oldShape) @@ -2726,7 +2726,7 @@ IsPropertyAddInlineable(HandleObject obj, HandleId id, ConstantOrRegister val, u // If we have a shape at this point and the object's shape changed, then // the shape must be the one we just added. - JS_ASSERT(shape == obj->lastProperty()); + MOZ_ASSERT(shape == obj->lastProperty()); // If object has a non-default resolve hook, don't inline if (obj->getClass()->resolve != JS_ResolveStub) @@ -2842,7 +2842,7 @@ SetPropertyIC::update(JSContext *cx, size_t cacheIndex, HandleObject obj, return false; addedSetterStub = true; } else { - JS_ASSERT(shadows == DoesntShadow || shadows == DoesntShadowUnique); + MOZ_ASSERT(shadows == DoesntShadow || shadows == DoesntShadowUnique); if (shadows == DoesntShadowUnique) cache.reset(); if (!cache.attachDOMProxyUnshadowed(cx, script, ion, obj, returnAddr)) @@ -2908,7 +2908,7 @@ bool SetPropertyParIC::update(ForkJoinContext *cx, size_t cacheIndex, HandleObject obj, HandleValue value) { - JS_ASSERT(cx->isThreadLocal(obj)); + MOZ_ASSERT(cx->isThreadLocal(obj)); IonScript *ion = GetTopIonJSScript(cx)->parallelIonScript(); SetPropertyParIC &cache = ion->getCache(cacheIndex).toSetPropertyPar(); @@ -3020,9 +3020,9 @@ GetElementIC::canAttachGetProp(JSObject *obj, const Value &idval, jsid id) static bool EqualStringsHelper(JSString *str1, JSString *str2) { - JS_ASSERT(str1->isAtom()); - JS_ASSERT(!str2->isAtom()); - JS_ASSERT(str1->length() == str2->length()); + MOZ_ASSERT(str1->isAtom()); + MOZ_ASSERT(!str2->isAtom()); + MOZ_ASSERT(str1->length() == str2->length()); JSLinearString *str2Linear = str2->ensureLinear(nullptr); if (!str2Linear) @@ -3036,7 +3036,7 @@ GetElementIC::attachGetProp(JSContext *cx, HandleScript outerScript, IonScript * HandleObject obj, const Value &idval, HandlePropertyName name, void *returnAddr) { - JS_ASSERT(index().reg().hasValue()); + MOZ_ASSERT(index().reg().hasValue()); RootedObject holder(cx); RootedShape shape(cx); @@ -3054,8 +3054,8 @@ GetElementIC::attachGetProp(JSContext *cx, HandleScript outerScript, IonScript * return true; } - JS_ASSERT(idval.isString()); - JS_ASSERT(idval.toString()->length() == name->length()); + MOZ_ASSERT(idval.isString()); + MOZ_ASSERT(idval.toString()->length() == name->length()); Label failures; MacroAssembler masm(cx, ion, outerScript, profilerLeavePc_); @@ -3085,7 +3085,7 @@ GetElementIC::attachGetProp(JSContext *cx, HandleScript outerScript, IonScript * masm.PushRegsInMask(volatileRegs); Register objReg = object(); - JS_ASSERT(objReg != scratch); + MOZ_ASSERT(objReg != scratch); if (!volatileRegs.has(objReg)) masm.push(objReg); @@ -3113,7 +3113,7 @@ GetElementIC::attachGetProp(JSContext *cx, HandleScript outerScript, IonScript * GenerateReadSlot(cx, ion, masm, attacher, obj, holder, shape, object(), output(), &failures); } else { - JS_ASSERT(canCache == GetPropertyIC::CanAttachCallGetter); + MOZ_ASSERT(canCache == GetPropertyIC::CanAttachCallGetter); // Set the frame for bailout safety of the OOL call. if (!GenerateCallGetter(cx, ion, masm, attacher, obj, name, holder, shape, liveRegs_, object(), output(), returnAddr, &failures)) @@ -3136,7 +3136,7 @@ GenerateDenseElement(JSContext *cx, MacroAssembler &masm, IonCache::StubAttacher JSObject *obj, const Value &idval, Register object, ConstantOrRegister index, TypedOrValueRegister output) { - JS_ASSERT(GetElementIC::canAttachDenseElement(obj, idval)); + MOZ_ASSERT(GetElementIC::canAttachDenseElement(obj, idval)); Label failures; @@ -3151,7 +3151,7 @@ GenerateDenseElement(JSContext *cx, MacroAssembler &masm, IonCache::StubAttacher if (index.reg().hasValue()) { indexReg = output.scratchReg().gpr(); - JS_ASSERT(indexReg != InvalidReg); + MOZ_ASSERT(indexReg != InvalidReg); ValueOperand val = index.reg().valueReg(); masm.branchTestInt32(Assembler::NotEqual, val, &failures); @@ -3159,7 +3159,7 @@ GenerateDenseElement(JSContext *cx, MacroAssembler &masm, IonCache::StubAttacher // Unbox the index. masm.unboxInt32(val, indexReg); } else { - JS_ASSERT(!index.reg().typedReg().isFloat()); + MOZ_ASSERT(!index.reg().typedReg().isFloat()); indexReg = index.reg().typedReg().gpr(); } @@ -3244,7 +3244,7 @@ GenerateGetTypedArrayElement(JSContext *cx, MacroAssembler &masm, IonCache::Stub ConstantOrRegister index, TypedOrValueRegister output, bool allowDoubleResult) { - JS_ASSERT(GetElementIC::canAttachTypedArrayElement(tarr, idval, output)); + MOZ_ASSERT(GetElementIC::canAttachTypedArrayElement(tarr, idval, output)); Label failures; @@ -3257,11 +3257,11 @@ GenerateGetTypedArrayElement(JSContext *cx, MacroAssembler &masm, IonCache::Stub // Decide to what type index the stub should be optimized Register tmpReg = output.scratchReg().gpr(); - JS_ASSERT(tmpReg != InvalidReg); + MOZ_ASSERT(tmpReg != InvalidReg); Register indexReg = tmpReg; - JS_ASSERT(!index.constant()); + MOZ_ASSERT(!index.constant()); if (idval.isString()) { - JS_ASSERT(GetIndexFromString(idval.toString()) != UINT32_MAX); + MOZ_ASSERT(GetIndexFromString(idval.toString()) != UINT32_MAX); // Part 1: Get the string into a register Register str; @@ -3271,7 +3271,7 @@ GenerateGetTypedArrayElement(JSContext *cx, MacroAssembler &masm, IonCache::Stub str = masm.extractString(val, indexReg); } else { - JS_ASSERT(!index.reg().typedReg().isFloat()); + MOZ_ASSERT(!index.reg().typedReg().isFloat()); str = index.reg().typedReg().gpr(); } @@ -3294,7 +3294,7 @@ GenerateGetTypedArrayElement(JSContext *cx, MacroAssembler &masm, IonCache::Stub masm.branch32(Assembler::Equal, indexReg, Imm32(UINT32_MAX), &failures); } else { - JS_ASSERT(idval.isInt32()); + MOZ_ASSERT(idval.isInt32()); if (index.reg().hasValue()) { ValueOperand val = index.reg().valueReg(); @@ -3303,7 +3303,7 @@ GenerateGetTypedArrayElement(JSContext *cx, MacroAssembler &masm, IonCache::Stub // Unbox the index. masm.unboxInt32(val, indexReg); } else { - JS_ASSERT(!index.reg().typedReg().isFloat()); + MOZ_ASSERT(!index.reg().typedReg().isFloat()); indexReg = index.reg().typedReg().gpr(); } } @@ -3357,14 +3357,14 @@ bool GetElementIC::attachArgumentsElement(JSContext *cx, HandleScript outerScript, IonScript *ion, HandleObject obj) { - JS_ASSERT(obj->is()); + MOZ_ASSERT(obj->is()); Label failures; MacroAssembler masm(cx, ion, outerScript, profilerLeavePc_); RepatchStubAppender attacher(*this); Register tmpReg = output().scratchReg().gpr(); - JS_ASSERT(tmpReg != InvalidReg); + MOZ_ASSERT(tmpReg != InvalidReg); const Class *clasp = obj->is() ? &StrictArgumentsObject::class_ : &NormalArgumentsObject::class_; @@ -3379,7 +3379,7 @@ GetElementIC::attachArgumentsElement(JSContext *cx, HandleScript outerScript, Io // Decide to what type index the stub should be optimized Register indexReg; - JS_ASSERT(!index().constant()); + MOZ_ASSERT(!index().constant()); // Check index against length. Label failureRestoreIndex; @@ -3391,7 +3391,7 @@ GetElementIC::attachArgumentsElement(JSContext *cx, HandleScript outerScript, Io masm.unboxInt32(val, indexReg); masm.branch32(Assembler::AboveOrEqual, indexReg, tmpReg, &failureRestoreIndex); } else { - JS_ASSERT(index().reg().type() == MIRType_Int32); + MOZ_ASSERT(index().reg().type() == MIRType_Int32); indexReg = index().reg().typedReg().gpr(); masm.branch32(Assembler::AboveOrEqual, indexReg, tmpReg, &failures); } @@ -3405,7 +3405,7 @@ GetElementIC::attachArgumentsElement(JSContext *cx, HandleScript outerScript, Io // In tempReg, calculate index of word containing bit: (idx >> logBitsPerWord) const uint32_t shift = FloorLog2<(sizeof(size_t) * JS_BITS_PER_BYTE)>::value; - JS_ASSERT(shift == 5 || shift == 6); + MOZ_ASSERT(shift == 5 || shift == 6); masm.rshiftPtr(Imm32(shift), indexReg); masm.loadPtr(BaseIndex(tmpReg, indexReg, ScaleFromElemWidth(sizeof(size_t))), tmpReg); @@ -3424,12 +3424,12 @@ GetElementIC::attachArgumentsElement(JSContext *cx, HandleScript outerScript, Io masm.branchTestMagic(Assembler::Equal, elemIdx, &failureRestoreIndex); if (output().hasTyped()) { - JS_ASSERT(!output().typedReg().isFloat()); - JS_ASSERT(index().reg().type() == MIRType_Boolean || - index().reg().type() == MIRType_Int32 || - index().reg().type() == MIRType_String || - index().reg().type() == MIRType_Symbol || - index().reg().type() == MIRType_Object); + MOZ_ASSERT(!output().typedReg().isFloat()); + MOZ_ASSERT(index().reg().type() == MIRType_Boolean || + index().reg().type() == MIRType_Int32 || + index().reg().type() == MIRType_String || + index().reg().type() == MIRType_Symbol || + index().reg().type() == MIRType_Object); masm.branchTestMIRType(Assembler::NotEqual, elemIdx, index().reg().type(), &failureRestoreIndex); } @@ -3454,12 +3454,12 @@ GetElementIC::attachArgumentsElement(JSContext *cx, HandleScript outerScript, Io if (obj->is()) { - JS_ASSERT(!hasStrictArgumentsStub_); + MOZ_ASSERT(!hasStrictArgumentsStub_); hasStrictArgumentsStub_ = true; return linkAndAttachStub(cx, masm, attacher, ion, "ArgsObj element (strict)"); } - JS_ASSERT(!hasNormalArgumentsStub_); + MOZ_ASSERT(!hasNormalArgumentsStub_); hasNormalArgumentsStub_ = true; return linkAndAttachStub(cx, masm, attacher, ion, "ArgsObj element (normal)"); } @@ -3636,7 +3636,7 @@ StoreDenseElement(MacroAssembler &masm, ConstantOrRegister value, Register eleme masm.int32ValueToDouble(reg.valueReg(), ScratchDoubleReg); masm.storeDouble(ScratchDoubleReg, target); } else { - JS_ASSERT(reg.type() == MIRType_Int32); + MOZ_ASSERT(reg.type() == MIRType_Int32); masm.convertInt32ToDouble(reg.typedReg().gpr(), ScratchDoubleReg); masm.storeDouble(ScratchDoubleReg, target); } @@ -3650,8 +3650,8 @@ GenerateSetDenseElement(JSContext *cx, MacroAssembler &masm, IonCache::StubAttac ValueOperand indexVal, ConstantOrRegister value, Register tempToUnboxIndex, Register temp) { - JS_ASSERT(obj->isNative()); - JS_ASSERT(idval.isInt32()); + MOZ_ASSERT(obj->isNative()); + MOZ_ASSERT(idval.isInt32()); Label failures; Label outOfBounds; // index represents a known hole, or an illegal append @@ -4077,7 +4077,7 @@ bool BindNameIC::attachGlobal(JSContext *cx, HandleScript outerScript, IonScript *ion, HandleObject scopeChain) { - JS_ASSERT(scopeChain->is()); + MOZ_ASSERT(scopeChain->is()); MacroAssembler masm(cx, ion, outerScript, profilerLeavePc_); RepatchStubAppender attacher(*this); @@ -4133,7 +4133,7 @@ GenerateScopeChainGuards(MacroAssembler &masm, JSObject *scopeChain, JSObject *h // Walk up the scope chain. Note that IsCacheableScopeChain guarantees the // |tobj == holder| condition terminates the loop. while (true) { - JS_ASSERT(IsCacheableNonGlobalScope(tobj) || tobj->is()); + MOZ_ASSERT(IsCacheableNonGlobalScope(tobj) || tobj->is()); if (skipLastGuard && tobj == holder) break; @@ -4153,7 +4153,7 @@ bool BindNameIC::attachNonGlobal(JSContext *cx, HandleScript outerScript, IonScript *ion, HandleObject scopeChain, HandleObject holder) { - JS_ASSERT(IsCacheableNonGlobalScope(scopeChain)); + MOZ_ASSERT(IsCacheableNonGlobalScope(scopeChain)); MacroAssembler masm(cx, ion, outerScript, profilerLeavePc_); RepatchStubAppender attacher(*this); @@ -4301,7 +4301,7 @@ IsCacheableNameReadSlot(HandleObject scopeChain, HandleObject obj, !IsCacheableNoProperty(obj, holder, shape, pc, output)) return false; } else if (obj->is()) { - JS_ASSERT(obj == holder); + MOZ_ASSERT(obj == holder); if (!shape->hasDefaultGetter()) return false; } else { diff --git a/js/src/jit/IonCaches.h b/js/src/jit/IonCaches.h index a8b70fec0fa8..e5485c7ffc68 100644 --- a/js/src/jit/IonCaches.h +++ b/js/src/jit/IonCaches.h @@ -177,7 +177,7 @@ class IonCache void incrementStubCount() { // The IC should stop generating stubs before wrapping stubCount. stubCount_++; - JS_ASSERT(stubCount_); + MOZ_ASSERT(stubCount_); } public: @@ -207,7 +207,7 @@ class IonCache } void setProfilerLeavePC(jsbytecode *pc) { - JS_ASSERT(pc != nullptr); + MOZ_ASSERT(pc != nullptr); profilerLeavePc_ = pc; } @@ -268,14 +268,14 @@ class IonCache return idempotent_; } void setIdempotent() { - JS_ASSERT(!idempotent_); - JS_ASSERT(!script_); - JS_ASSERT(!pc_); + MOZ_ASSERT(!idempotent_); + MOZ_ASSERT(!script_); + MOZ_ASSERT(!pc_); idempotent_ = true; } void setScriptedLocation(JSScript *script, jsbytecode *pc) { - JS_ASSERT(!idempotent_); + MOZ_ASSERT(!idempotent_); script_ = script; pc_ = pc; } @@ -286,7 +286,7 @@ class IonCache } jsbytecode *pc() const { - JS_ASSERT(pc_); + MOZ_ASSERT(pc_); return pc_; } }; @@ -611,23 +611,23 @@ class GetPropertyIC : public RepatchIonCache void setHasTypedArrayLengthStub(HandleObject obj) { if (obj->is()) { - JS_ASSERT(!hasTypedArrayLengthStub_); + MOZ_ASSERT(!hasTypedArrayLengthStub_); hasTypedArrayLengthStub_ = true; } else { - JS_ASSERT(!hasSharedTypedArrayLengthStub_); + MOZ_ASSERT(!hasSharedTypedArrayLengthStub_); hasSharedTypedArrayLengthStub_ = true; } } void setLocationInfo(size_t locationsIndex, size_t numLocations) { - JS_ASSERT(idempotent()); - JS_ASSERT(!numLocations_); - JS_ASSERT(numLocations); + MOZ_ASSERT(idempotent()); + MOZ_ASSERT(!numLocations_); + MOZ_ASSERT(numLocations); locationsIndex_ = locationsIndex; numLocations_ = numLocations; } void getLocationInfo(uint32_t *index, uint32_t *num) const { - JS_ASSERT(idempotent()); + MOZ_ASSERT(idempotent()); *index = locationsIndex_; *num = numLocations_; } @@ -821,13 +821,13 @@ class GetElementIC : public RepatchIonCache return strict ? hasStrictArgumentsStub_ : hasNormalArgumentsStub_; } void setHasDenseStub() { - JS_ASSERT(!hasDenseStub()); + MOZ_ASSERT(!hasDenseStub()); hasDenseStub_ = true; } // Helpers for CanAttachNativeGetProp typedef JSContext * Context; - bool allowGetters() const { JS_ASSERT(!idempotent()); return true; } + bool allowGetters() const { MOZ_ASSERT(!idempotent()); return true; } bool allowArrayLength(Context, HandleObject) const { return false; } bool canMonitorSingletonUndefinedSlot(HandleObject holder, HandleShape shape) const { return monitoredResult(); @@ -936,7 +936,7 @@ class SetElementIC : public RepatchIonCache return hasDenseStub_; } void setHasDenseStub() { - JS_ASSERT(!hasDenseStub()); + MOZ_ASSERT(!hasDenseStub()); hasDenseStub_ = true; } @@ -1142,10 +1142,10 @@ class GetPropertyParIC : public ParallelIonCache void setHasTypedArrayLengthStub(HandleObject obj) { if (obj->is()) { - JS_ASSERT(!hasTypedArrayLengthStub_); + MOZ_ASSERT(!hasTypedArrayLengthStub_); hasTypedArrayLengthStub_ = true; } else { - JS_ASSERT(!hasSharedTypedArrayLengthStub_); + MOZ_ASSERT(!hasSharedTypedArrayLengthStub_); hasSharedTypedArrayLengthStub_ = true; } } @@ -1360,12 +1360,12 @@ class SetElementParIC : public ParallelIonCache #define CACHE_CASTS(ickind) \ ickind##IC &IonCache::to##ickind() \ { \ - JS_ASSERT(is##ickind()); \ + MOZ_ASSERT(is##ickind()); \ return *static_cast(this); \ } \ const ickind##IC &IonCache::to##ickind() const \ { \ - JS_ASSERT(is##ickind()); \ + MOZ_ASSERT(is##ickind()); \ return *static_cast(this); \ } IONCACHE_KIND_LIST(CACHE_CASTS) diff --git a/js/src/jit/IonCode.h b/js/src/jit/IonCode.h index 444c91ca7628..dcc18fc28b13 100644 --- a/js/src/jit/IonCode.h +++ b/js/src/jit/IonCode.h @@ -127,7 +127,7 @@ class JitCode : public gc::TenuredCell static JitCode *FromExecutable(uint8_t *buffer) { JitCode *code = *(JitCode **)(buffer - sizeof(JitCode *)); - JS_ASSERT(code->raw() == buffer); + MOZ_ASSERT(code->raw() == buffer); return code; } @@ -405,7 +405,7 @@ struct IonScript return method_; } void setMethod(JitCode *code) { - JS_ASSERT(!invalidated()); + MOZ_ASSERT(!invalidated()); method_ = code; } void setDeoptTable(JitCode *code) { @@ -418,14 +418,14 @@ struct IonScript return osrPc_; } void setOsrEntryOffset(uint32_t offset) { - JS_ASSERT(!osrEntryOffset_); + MOZ_ASSERT(!osrEntryOffset_); osrEntryOffset_ = offset; } uint32_t osrEntryOffset() const { return osrEntryOffset_; } void setSkipArgCheckEntryOffset(uint32_t offset) { - JS_ASSERT(!skipArgCheckEntryOffset_); + MOZ_ASSERT(!skipArgCheckEntryOffset_); skipArgCheckEntryOffset_ = offset; } uint32_t getSkipArgCheckEntryOffset() const { @@ -440,19 +440,19 @@ struct IonScript return method()->raw() <= addr && addr <= method()->raw() + method()->instructionsSize(); } void setInvalidationEpilogueOffset(uint32_t offset) { - JS_ASSERT(!invalidateEpilogueOffset_); + MOZ_ASSERT(!invalidateEpilogueOffset_); invalidateEpilogueOffset_ = offset; } uint32_t invalidateEpilogueOffset() const { - JS_ASSERT(invalidateEpilogueOffset_); + MOZ_ASSERT(invalidateEpilogueOffset_); return invalidateEpilogueOffset_; } void setInvalidationEpilogueDataOffset(uint32_t offset) { - JS_ASSERT(!invalidateEpilogueDataOffset_); + MOZ_ASSERT(!invalidateEpilogueDataOffset_); invalidateEpilogueDataOffset_ = offset; } uint32_t invalidateEpilogueDataOffset() const { - JS_ASSERT(invalidateEpilogueDataOffset_); + MOZ_ASSERT(invalidateEpilogueDataOffset_); return invalidateEpilogueDataOffset_; } void incNumBailouts() { @@ -519,7 +519,7 @@ struct IonScript return mallocSizeOf(this); } PreBarrieredValue &getConstant(size_t index) { - JS_ASSERT(index < numConstants()); + MOZ_ASSERT(index < numConstants()); return constants()[index]; } size_t numConstants() const { @@ -532,23 +532,23 @@ struct IonScript return frameSize_; } SnapshotOffset bailoutToSnapshot(uint32_t bailoutId) { - JS_ASSERT(bailoutId < bailoutEntries_); + MOZ_ASSERT(bailoutId < bailoutEntries_); return bailoutTable()[bailoutId]; } const SafepointIndex *getSafepointIndex(uint32_t disp) const; const SafepointIndex *getSafepointIndex(uint8_t *retAddr) const { - JS_ASSERT(containsCodeAddress(retAddr)); + MOZ_ASSERT(containsCodeAddress(retAddr)); return getSafepointIndex(retAddr - method()->raw()); } const OsiIndex *getOsiIndex(uint32_t disp) const; const OsiIndex *getOsiIndex(uint8_t *retAddr) const; inline IonCache &getCacheFromIndex(uint32_t index) { - JS_ASSERT(index < cacheEntries_); + MOZ_ASSERT(index < cacheEntries_); uint32_t offset = cacheIndex()[index]; return getCache(offset); } inline IonCache &getCache(uint32_t offset) { - JS_ASSERT(offset < runtimeSize_); + MOZ_ASSERT(offset < runtimeSize_); return *(IonCache *) &runtimeData()[offset]; } size_t numCaches() const { @@ -558,7 +558,7 @@ struct IonScript return runtimeSize_; } CacheLocation *getCacheLocs(uint32_t locIndex) { - JS_ASSERT(locIndex < runtimeSize_); + MOZ_ASSERT(locIndex < runtimeSize_); return (CacheLocation *) &runtimeData()[locIndex]; } void toggleBarriers(bool enabled); @@ -593,7 +593,7 @@ struct IonScript refcount_++; } void decref(FreeOp *fop) { - JS_ASSERT(refcount_); + MOZ_ASSERT(refcount_); refcount_--; if (!refcount_) Destroy(fop, this); @@ -710,12 +710,12 @@ struct IonBlockCounts } void setSuccessor(size_t i, uint32_t id) { - JS_ASSERT(i < numSuccessors_); + MOZ_ASSERT(i < numSuccessors_); successors_[i] = id; } uint32_t successor(size_t i) const { - JS_ASSERT(i < numSuccessors_); + MOZ_ASSERT(i < numSuccessors_); return successors_[i]; } @@ -776,7 +776,7 @@ struct IonScriptCounts } IonBlockCounts &block(size_t i) { - JS_ASSERT(i < numBlocks_); + MOZ_ASSERT(i < numBlocks_); return blocks_[i]; } diff --git a/js/src/jit/IonFrames-inl.h b/js/src/jit/IonFrames-inl.h index 9990dd69fa9b..283f6dc1b8fd 100644 --- a/js/src/jit/IonFrames-inl.h +++ b/js/src/jit/IonFrames-inl.h @@ -21,7 +21,7 @@ namespace jit { inline void SafepointIndex::resolve() { - JS_ASSERT(!resolved); + MOZ_ASSERT(!resolved); safepointOffset_ = safepoint_->offset(); #ifdef DEBUG resolved = true; @@ -63,8 +63,8 @@ JitFrameIterator::isFakeExitFrame() const inline IonExitFrameLayout * JitFrameIterator::exitFrame() const { - JS_ASSERT(type() == JitFrame_Exit); - JS_ASSERT(!isFakeExitFrame()); + MOZ_ASSERT(type() == JitFrame_Exit); + MOZ_ASSERT(!isFakeExitFrame()); return (IonExitFrameLayout *) fp(); } @@ -72,11 +72,11 @@ inline BaselineFrame * GetTopBaselineFrame(JSContext *cx) { JitFrameIterator iter(cx); - JS_ASSERT(iter.type() == JitFrame_Exit); + MOZ_ASSERT(iter.type() == JitFrame_Exit); ++iter; if (iter.isBaselineStub()) ++iter; - JS_ASSERT(iter.isBaselineJS()); + MOZ_ASSERT(iter.isBaselineJS()); return iter.baselineFrame(); } diff --git a/js/src/jit/IonFrames.cpp b/js/src/jit/IonFrames.cpp index 5a919bb52ab0..15eedbea6e01 100644 --- a/js/src/jit/IonFrames.cpp +++ b/js/src/jit/IonFrames.cpp @@ -157,7 +157,7 @@ JitFrameIterator::checkInvalidation(IonScript **ionScriptOut) const int32_t invalidationDataOffset = ((int32_t *) returnAddr)[-1]; uint8_t *ionScriptDataOffset = returnAddr + invalidationDataOffset; IonScript *ionScript = (IonScript *) Assembler::GetPointer(ionScriptDataOffset); - JS_ASSERT(ionScript->containsReturnAddress(returnAddr)); + MOZ_ASSERT(ionScript->containsReturnAddress(returnAddr)); *ionScriptOut = ionScript; return true; } @@ -171,8 +171,8 @@ JitFrameIterator::calleeToken() const JSFunction * JitFrameIterator::callee() const { - JS_ASSERT(isScripted()); - JS_ASSERT(isFunctionFrame()); + MOZ_ASSERT(isScripted()); + MOZ_ASSERT(isFunctionFrame()); return CalleeTokenToFunction(calleeToken()); } @@ -201,11 +201,11 @@ JitFrameIterator::isFunctionFrame() const JSScript * JitFrameIterator::script() const { - JS_ASSERT(isScripted()); + MOZ_ASSERT(isScripted()); if (isBaselineJS()) return baselineFrame()->script(); JSScript *script = ScriptFromCalleeToken(calleeToken()); - JS_ASSERT(script); + MOZ_ASSERT(script); return script; } @@ -222,7 +222,7 @@ JitFrameIterator::resumeAddressToFp() const void JitFrameIterator::baselineScriptAndPc(JSScript **scriptRes, jsbytecode **pcRes) const { - JS_ASSERT(isBaselineJS()); + MOZ_ASSERT(isBaselineJS()); JSScript *script = this->script(); if (scriptRes) *scriptRes = script; @@ -296,8 +296,8 @@ JitFrameIterator::prevFp() const // needed because the descriptor size of JS-to-JS frame which is just after // a Rectifier frame should not change. (cf EnsureExitFrame function) if (isFakeExitFrame()) { - JS_ASSERT(SizeOfFramePrefix(JitFrame_BaselineJS) == - SizeOfFramePrefix(JitFrame_IonJS)); + MOZ_ASSERT(SizeOfFramePrefix(JitFrame_BaselineJS) == + SizeOfFramePrefix(JitFrame_IonJS)); currentSize = SizeOfFramePrefix(JitFrame_IonJS); } currentSize += current()->prevFrameLocalSize(); @@ -307,7 +307,7 @@ JitFrameIterator::prevFp() const JitFrameIterator & JitFrameIterator::operator++() { - JS_ASSERT(type_ != JitFrame_Entry); + MOZ_ASSERT(type_ != JitFrame_Entry); frameSize_ = prevFrameLocalSize(); cachedSafepointIndex_ = nullptr; @@ -436,8 +436,8 @@ HandleExceptionIon(JSContext *cx, const InlineFrameIterator &frame, ResumeFromEx switch (tn->kind) { case JSTRY_ITER: { - JS_ASSERT(JSOp(*(script->main() + tn->start + tn->length)) == JSOP_ENDITER); - JS_ASSERT(tn->stackDepth > 0); + MOZ_ASSERT(JSOp(*(script->main() + tn->start + tn->length)) == JSOP_ENDITER); + MOZ_ASSERT(tn->stackDepth > 0); uint32_t localSlot = tn->stackDepth; CloseLiveIterator(cx, frame, localSlot); @@ -494,8 +494,8 @@ static void HandleExceptionBaseline(JSContext *cx, const JitFrameIterator &frame, ResumeFromException *rfe, jsbytecode **unwoundScopeToPc, bool *calledDebugEpilogue) { - JS_ASSERT(frame.isBaselineJS()); - JS_ASSERT(!*calledDebugEpilogue); + MOZ_ASSERT(frame.isBaselineJS()); + MOZ_ASSERT(!*calledDebugEpilogue); RootedScript script(cx); jsbytecode *pc; @@ -515,12 +515,12 @@ HandleExceptionBaseline(JSContext *cx, const JitFrameIterator &frame, ResumeFrom switch (status) { case JSTRAP_ERROR: // Uncatchable exception. - JS_ASSERT(!cx->isExceptionPending()); + MOZ_ASSERT(!cx->isExceptionPending()); break; case JSTRAP_CONTINUE: case JSTRAP_THROW: - JS_ASSERT(cx->isExceptionPending()); + MOZ_ASSERT(cx->isExceptionPending()); break; case JSTRAP_RETURN: @@ -548,7 +548,7 @@ HandleExceptionBaseline(JSContext *cx, const JitFrameIterator &frame, ResumeFrom // Skip if the try note's stack depth exceeds the frame's stack depth. // See the big comment in TryNoteIter::settle for more info. - JS_ASSERT(frame.baselineFrame()->numValueSlots() >= script->nfixed()); + MOZ_ASSERT(frame.baselineFrame()->numValueSlots() >= script->nfixed()); size_t stackDepth = frame.baselineFrame()->numValueSlots() - script->nfixed(); if (tn->stackDepth > stackDepth) continue; @@ -658,7 +658,7 @@ HandleException(ResumeFromException *rfe) return; } - JS_ASSERT(rfe->kind == ResumeFromException::RESUME_ENTRY_FRAME); + MOZ_ASSERT(rfe->kind == ResumeFromException::RESUME_ENTRY_FRAME); // Figure out whether SPS frame was pushed for this frame or not. // Even if profiler is enabled, the frame being popped might have @@ -736,7 +736,7 @@ HandleException(ResumeFromException *rfe) jsbytecode *pc; iter.baselineScriptAndPc(script.address(), &pc); if (jit::DebugEpilogue(cx, frame, pc, false)) { - JS_ASSERT(frame->hasReturnValue()); + MOZ_ASSERT(frame->hasReturnValue()); rfe->kind = ResumeFromException::RESUME_FORCED_RETURN; rfe->framePointer = iter.fp() - BaselineFrame::FramePointerOffset; rfe->stackPointer = reinterpret_cast(frame); @@ -821,7 +821,7 @@ EnsureExitFrame(IonCommonFrameLayout *frame) return; } - JS_ASSERT(frame->prevType() == JitFrame_IonJS); + MOZ_ASSERT(frame->prevType() == JitFrame_IonJS); frame->changePrevType(JitFrame_Unwound_IonJS); } @@ -869,7 +869,7 @@ static void MarkActualArguments(JSTracer *trc, const JitFrameIterator &frame) { IonJSFrameLayout *layout = frame.jsFrame(); - JS_ASSERT(CalleeTokenIsFunction(layout->calleeToken())); + MOZ_ASSERT(CalleeTokenIsFunction(layout->calleeToken())); size_t nargs = frame.numActualArgs(); @@ -1024,11 +1024,11 @@ MarkBaselineStubFrame(JSTracer *trc, const JitFrameIterator &frame) // Mark the ICStub pointer stored in the stub frame. This is necessary // so that we don't destroy the stub code after unlinking the stub. - JS_ASSERT(frame.type() == JitFrame_BaselineStub); + MOZ_ASSERT(frame.type() == JitFrame_BaselineStub); IonBaselineStubFrameLayout *layout = (IonBaselineStubFrameLayout *)frame.fp(); if (ICStub *stub = layout->maybeStubPtr()) { - JS_ASSERT(ICStub::CanMakeCalls(stub->kind())); + MOZ_ASSERT(ICStub::CanMakeCalls(stub->kind())); stub->trace(trc); } } @@ -1095,7 +1095,7 @@ MarkJitExitFrameCopiedArguments(JSTracer *trc, const VMFunction *f, IonExitFoote if (f->argRootType(explicitArg) == VMFunction::RootValue) gc::MarkValueRoot(trc, reinterpret_cast(doubleArgs), "ion-vm-args"); else - JS_ASSERT(f->argRootType(explicitArg) == VMFunction::RootNone); + MOZ_ASSERT(f->argRootType(explicitArg) == VMFunction::RootNone); doubleArgs += sizeof(double); } } @@ -1122,7 +1122,7 @@ MarkJitExitFrame(JSTracer *trc, const JitFrameIterator &frame) // invalidation and relocation data are no longer reliable. So the VM // wrapper or the invalidation code may be GC if no JitCode keep reference // on them. - JS_ASSERT(uintptr_t(footer->jitCode()) != uintptr_t(-1)); + MOZ_ASSERT(uintptr_t(footer->jitCode()) != uintptr_t(-1)); // This correspond to the case where we have build a fake exit frame in // CodeGenerator.cpp which handle the case of a native function call. We @@ -1337,9 +1337,9 @@ template void UpdateJitActivationsForMinorGC(PerThreadData *ptd, JSTracer *trc) { #ifdef JSGC_FJGENERATIONAL - JS_ASSERT(trc->runtime()->isHeapMinorCollecting() || trc->runtime()->isFJMinorCollecting()); + MOZ_ASSERT(trc->runtime()->isHeapMinorCollecting() || trc->runtime()->isFJMinorCollecting()); #else - JS_ASSERT(trc->runtime()->isHeapMinorCollecting()); + MOZ_ASSERT(trc->runtime()->isHeapMinorCollecting()); #endif for (JitActivationIterator activations(ptd); !activations.done(); ++activations) { for (JitFrameIterator frames(activations); !frames.done(); ++frames) { @@ -1373,9 +1373,9 @@ GetPcScript(JSContext *cx, JSScript **scriptRes, jsbytecode **pcRes) // skip past it. if (it.prevType() == JitFrame_Rectifier || it.prevType() == JitFrame_Unwound_Rectifier) { ++it; - JS_ASSERT(it.prevType() == JitFrame_BaselineStub || - it.prevType() == JitFrame_BaselineJS || - it.prevType() == JitFrame_IonJS); + MOZ_ASSERT(it.prevType() == JitFrame_BaselineStub || + it.prevType() == JitFrame_BaselineJS || + it.prevType() == JitFrame_IonJS); } // If the previous frame is a stub frame, skip the exit frame so that @@ -1383,12 +1383,12 @@ GetPcScript(JSContext *cx, JSScript **scriptRes, jsbytecode **pcRes) // frame. if (it.prevType() == JitFrame_BaselineStub || it.prevType() == JitFrame_Unwound_BaselineStub) { ++it; - JS_ASSERT(it.prevType() == JitFrame_BaselineJS); + MOZ_ASSERT(it.prevType() == JitFrame_BaselineJS); } uint8_t *retAddr = it.returnAddress(); uint32_t hash = PcScriptCache::Hash(retAddr); - JS_ASSERT(retAddr != nullptr); + MOZ_ASSERT(retAddr != nullptr); // Lazily initialize the cache. The allocation may safely fail and will not GC. if (MOZ_UNLIKELY(rt->ionPcScriptCache == nullptr)) { @@ -1410,7 +1410,7 @@ GetPcScript(JSContext *cx, JSScript **scriptRes, jsbytecode **pcRes) *scriptRes = ifi.script(); pc = ifi.pc(); } else { - JS_ASSERT(it.isBaselineJS()); + MOZ_ASSERT(it.isBaselineJS()); it.baselineScriptAndPc(scriptRes, &pc); } @@ -1524,7 +1524,7 @@ SnapshotIterator::SnapshotIterator(IonScript *ionScript, SnapshotOffset snapshot ionScript_(ionScript), instructionResults_(nullptr) { - JS_ASSERT(snapshotOffset < ionScript->snapshotsListSize()); + MOZ_ASSERT(snapshotOffset < ionScript->snapshotsListSize()); } SnapshotIterator::SnapshotIterator(const JitFrameIterator &iter) @@ -1896,7 +1896,7 @@ Value SnapshotIterator::maybeReadAllocByIndex(size_t index) { while (index--) { - JS_ASSERT(moreAllocations()); + MOZ_ASSERT(moreAllocations()); skip(); } @@ -1917,7 +1917,7 @@ SnapshotIterator::maybeReadAllocByIndex(size_t index) IonScript * JitFrameIterator::ionScript() const { - JS_ASSERT(type() == JitFrame_IonJS); + MOZ_ASSERT(type() == JitFrame_IonJS); IonScript *ionScript = nullptr; if (checkInvalidation(&ionScript)) @@ -1928,8 +1928,8 @@ JitFrameIterator::ionScript() const IonScript * JitFrameIterator::ionScriptFromCalleeToken() const { - JS_ASSERT(type() == JitFrame_IonJS); - JS_ASSERT(!checkInvalidation()); + MOZ_ASSERT(type() == JitFrame_IonJS); + MOZ_ASSERT(!checkInvalidation()); switch (mode_) { case SequentialExecution: @@ -2019,7 +2019,7 @@ InlineFrameIterator::resetOn(const JitFrameIterator *iter) void InlineFrameIterator::findNextFrame() { - JS_ASSERT(more()); + MOZ_ASSERT(more()); si_ = start_; @@ -2046,13 +2046,13 @@ InlineFrameIterator::findNextFrame() size_t i = 1; for (; i <= remaining && si_.moreFrames(); i++) { - JS_ASSERT(IsIonInlinablePC(pc_)); + MOZ_ASSERT(IsIonInlinablePC(pc_)); // Recover the number of actual arguments from the script. if (JSOp(*pc_) != JSOP_FUNAPPLY) numActualArgs_ = GET_ARGC(pc_); if (JSOp(*pc_) == JSOP_FUNCALL) { - JS_ASSERT(GET_ARGC(pc_) > 0); + MOZ_ASSERT(GET_ARGC(pc_) > 0); numActualArgs_ = GET_ARGC(pc_) - 1; } else if (IsGetPropPC(pc_)) { numActualArgs_ = 0; @@ -2167,7 +2167,7 @@ InlineFrameIterator::isConstructing() const return false; // In the case of a JS frame, look up the pc from the snapshot. - JS_ASSERT(IsCallPC(parent.pc())); + MOZ_ASSERT(IsCallPC(parent.pc())); return (JSOp)*parent.pc() == JSOP_NEW; } @@ -2187,7 +2187,7 @@ JitFrameIterator::numActualArgs() const if (isScripted()) return jsFrame()->numActualArgs(); - JS_ASSERT(isExitFrameLayout()); + MOZ_ASSERT(isExitFrameLayout()); return exitFrame()->as()->argc(); } @@ -2215,7 +2215,7 @@ struct DumpOp { void JitFrameIterator::dumpBaseline() const { - JS_ASSERT(isBaselineJS()); + MOZ_ASSERT(isBaselineJS()); fprintf(stderr, " JS Baseline frame\n"); if (isFunctionFrame()) { @@ -2362,7 +2362,7 @@ JitFrameIterator::dump() const bool JitFrameIterator::verifyReturnAddressUsingNativeToBytecodeMap() { - JS_ASSERT(returnAddressToFp_ != nullptr); + MOZ_ASSERT(returnAddressToFp_ != nullptr); // Only handle Ion frames for now. if (type_ != JitFrame_IonJS && type_ != JitFrame_BaselineJS) @@ -2395,8 +2395,8 @@ JitFrameIterator::verifyReturnAddressUsingNativeToBytecodeMap() uint32_t depth = UINT32_MAX; if (!entry.callStackAtAddr(rt, returnAddressToFp_, location, &depth)) return false; - JS_ASSERT(depth > 0 && depth != UINT32_MAX); - JS_ASSERT(location.length() == depth); + MOZ_ASSERT(depth > 0 && depth != UINT32_MAX); + MOZ_ASSERT(location.length() == depth); JitSpew(JitSpew_Profiling, "Found bytecode location of depth %d:", depth); for (size_t i = 0; i < location.length(); i++) { @@ -2409,7 +2409,7 @@ JitFrameIterator::verifyReturnAddressUsingNativeToBytecodeMap() // Create an InlineFrameIterator here and verify the mapped info against the iterator info. InlineFrameIterator inlineFrames(GetJSContextFromJitCode(), this); for (size_t idx = 0; idx < location.length(); idx++) { - JS_ASSERT(idx < location.length()); + MOZ_ASSERT(idx < location.length()); JS_ASSERT_IF(idx < location.length() - 1, inlineFrames.more()); JitSpew(JitSpew_Profiling, "Match %d: ION %s:%d(%d) vs N2B %s:%d(%d)", @@ -2421,7 +2421,7 @@ JitFrameIterator::verifyReturnAddressUsingNativeToBytecodeMap() location[idx].script->lineno(), location[idx].pc - location[idx].script->code()); - JS_ASSERT(inlineFrames.script() == location[idx].script); + MOZ_ASSERT(inlineFrames.script() == location[idx].script); if (inlineFrames.more()) ++inlineFrames; @@ -2444,12 +2444,12 @@ InvalidationBailoutStack::checkInvariants() const #ifdef DEBUG IonJSFrameLayout *frame = fp(); CalleeToken token = frame->calleeToken(); - JS_ASSERT(token); + MOZ_ASSERT(token); uint8_t *rawBase = ionScript()->method()->raw(); uint8_t *rawLimit = rawBase + ionScript()->method()->instructionsSize(); uint8_t *osiPoint = osiPointReturnAddress(); - JS_ASSERT(rawBase <= osiPoint && osiPoint <= rawLimit); + MOZ_ASSERT(rawBase <= osiPoint && osiPoint <= rawLimit); #endif } diff --git a/js/src/jit/IonFrames.h b/js/src/jit/IonFrames.h index 7b3307581587..97838da7eabf 100644 --- a/js/src/jit/IonFrames.h +++ b/js/src/jit/IonFrames.h @@ -32,7 +32,7 @@ static inline CalleeTokenTag GetCalleeTokenTag(CalleeToken token) { CalleeTokenTag tag = CalleeTokenTag(uintptr_t(token) & 0x3); - JS_ASSERT(tag <= CalleeToken_Script); + MOZ_ASSERT(tag <= CalleeToken_Script); return tag; } static inline CalleeToken @@ -66,7 +66,7 @@ CalleeTokenToFunction(CalleeToken token) static inline JSScript * CalleeTokenToScript(CalleeToken token) { - JS_ASSERT(GetCalleeTokenTag(token) == CalleeToken_Script); + MOZ_ASSERT(GetCalleeTokenTag(token) == CalleeToken_Script); return (JSScript *)(uintptr_t(token) & CalleeTokenMask); } @@ -128,7 +128,7 @@ class SafepointIndex void resolve(); LSafepoint *safepoint() { - JS_ASSERT(!resolved); + MOZ_ASSERT(!resolved); return safepoint_; } uint32_t displacement() const { @@ -138,7 +138,7 @@ class SafepointIndex return safepointOffset_; } void adjustDisplacement(uint32_t offset) { - JS_ASSERT(offset >= displacement_); + MOZ_ASSERT(offset >= displacement_); displacement_ = offset; } inline SnapshotOffset snapshotOffset() const; @@ -234,7 +234,7 @@ class FrameSizeClass uint32_t frameSize() const; uint32_t classId() const { - JS_ASSERT(class_ != NO_FRAME_SIZE_CLASS_ID); + MOZ_ASSERT(class_ != NO_FRAME_SIZE_CLASS_ID); return class_; } @@ -295,19 +295,19 @@ inline JSScript * GetTopIonJSScript(uint8_t *jitTop, void **returnAddrOut, ExecutionMode mode) { JitFrameIterator iter(jitTop, mode); - JS_ASSERT(iter.type() == JitFrame_Exit); + MOZ_ASSERT(iter.type() == JitFrame_Exit); ++iter; - JS_ASSERT(iter.returnAddressToFp() != nullptr); + MOZ_ASSERT(iter.returnAddressToFp() != nullptr); if (returnAddrOut) *returnAddrOut = (void *) iter.returnAddressToFp(); if (iter.isBaselineStub()) { ++iter; - JS_ASSERT(iter.isBaselineJS()); + MOZ_ASSERT(iter.isBaselineJS()); } - JS_ASSERT(iter.isScripted()); + MOZ_ASSERT(iter.isScripted()); return iter.script(); } @@ -504,7 +504,7 @@ class IonExitFrameLayout : public IonCommonFrameLayout // each wrapper are pushed before the exit frame. This correspond exactly // to the value of the argBase register of the generateVMWrapper function. inline uint8_t *argBase() { - JS_ASSERT(footer()->jitCode() != nullptr); + MOZ_ASSERT(footer()->jitCode() != nullptr); return top(); } diff --git a/js/src/jit/IonInstrumentation.h b/js/src/jit/IonInstrumentation.h index 9c3da9dd2577..05c106178e60 100644 --- a/js/src/jit/IonInstrumentation.h +++ b/js/src/jit/IonInstrumentation.h @@ -26,7 +26,7 @@ class IonInstrumentation : public BaseInstrumentation : BaseInstrumentation(profiler), trackedPc_(pc) { - JS_ASSERT(pc != nullptr); + MOZ_ASSERT(pc != nullptr); } void leave(MacroAssembler &masm, Register reg, bool inlinedFunction = false) { diff --git a/js/src/jit/IonLinker.h b/js/src/jit/IonLinker.h index 183da15932e6..de97815f8f48 100644 --- a/js/src/jit/IonLinker.h +++ b/js/src/jit/IonLinker.h @@ -30,7 +30,7 @@ class Linker template JitCode *newCode(JSContext *cx, ExecutableAllocator *execAlloc, CodeKind kind) { - JS_ASSERT(masm.numAsmJSAbsoluteLinks() == 0); + MOZ_ASSERT(masm.numAsmJSAbsoluteLinks() == 0); gc::AutoSuppressGC suppressGC(cx); if (masm.oom()) @@ -84,7 +84,7 @@ class Linker JitCode *newCodeForIonScript(JSContext *cx) { // The caller must lock the runtime against interrupt requests, as the // thread requesting an interrupt may use the executable allocator below. - JS_ASSERT(cx->runtime()->currentThreadOwnsInterruptLock()); + MOZ_ASSERT(cx->runtime()->currentThreadOwnsInterruptLock()); ExecutableAllocator *alloc = cx->runtime()->jitRuntime()->getIonAlloc(cx); if (!alloc) diff --git a/js/src/jit/IonMacroAssembler.cpp b/js/src/jit/IonMacroAssembler.cpp index 02937bdf7303..f10b8e70e803 100644 --- a/js/src/jit/IonMacroAssembler.cpp +++ b/js/src/jit/IonMacroAssembler.cpp @@ -73,8 +73,8 @@ template void MacroAssembler::guardTypeSet(const Source &address, const TypeSet *types, BarrierKind kind, Register scratch, Label *miss) { - JS_ASSERT(kind == BarrierKind::TypeTagOnly || kind == BarrierKind::TypeSet); - JS_ASSERT(!types->unknown()); + MOZ_ASSERT(kind == BarrierKind::TypeTagOnly || kind == BarrierKind::TypeSet); + MOZ_ASSERT(!types->unknown()); Label matched; types::Type tests[8] = { @@ -91,7 +91,7 @@ MacroAssembler::guardTypeSet(const Source &address, const TypeSet *types, Barrie // The double type also implies Int32. // So replace the int32 test with the double one. if (types->hasType(types::Type::DoubleType())) { - JS_ASSERT(types->hasType(types::Type::Int32Type())); + MOZ_ASSERT(types->hasType(types::Type::Int32Type())); tests[0] = types::Type::DoubleType(); } @@ -127,7 +127,7 @@ MacroAssembler::guardTypeSet(const Source &address, const TypeSet *types, Barrie lastBranch.emit(*this); // Test specific objects. - JS_ASSERT(scratch != InvalidReg); + MOZ_ASSERT(scratch != InvalidReg); branchTestObject(NotEqual, tag, miss); if (kind != BarrierKind::TypeTagOnly) { Register obj = extractObject(address, scratch); @@ -141,10 +141,10 @@ template void MacroAssembler::guardObjectType(Register obj, const TypeSet *types, Register scratch, Label *miss) { - JS_ASSERT(!types->unknown()); - JS_ASSERT(!types->hasType(types::Type::AnyObjectType())); - JS_ASSERT(types->getObjectCount()); - JS_ASSERT(scratch != InvalidReg); + MOZ_ASSERT(!types->unknown()); + MOZ_ASSERT(!types->hasType(types::Type::AnyObjectType())); + MOZ_ASSERT(types->getObjectCount()); + MOZ_ASSERT(scratch != InvalidReg); // Note: this method elides read barriers on values read from type sets, as // this may be called off the main thread during Ion compilation. This is @@ -155,7 +155,7 @@ MacroAssembler::guardObjectType(Register obj, const TypeSet *types, Label matched; BranchGCPtr lastBranch; - JS_ASSERT(!lastBranch.isInitialized()); + MOZ_ASSERT(!lastBranch.isInitialized()); bool hasTypeObjects = false; unsigned count = types->getObjectCount(); for (unsigned i = 0; i < count; i++) { @@ -462,8 +462,8 @@ MacroAssembler::nurseryAllocate(Register result, Register slots, gc::AllocKind a size_t nDynamicSlots, gc::InitialHeap initialHeap, Label *fail) { #ifdef JSGC_GENERATIONAL - JS_ASSERT(IsNurseryAllocable(allocKind)); - JS_ASSERT(initialHeap != gc::TenuredHeap); + MOZ_ASSERT(IsNurseryAllocable(allocKind)); + MOZ_ASSERT(initialHeap != gc::TenuredHeap); // We still need to allocate in the nursery, per the comment in // shouldNurseryAllocate; however, we need to insert into hugeSlots, so @@ -527,8 +527,8 @@ MacroAssembler::callMallocStub(size_t nbytes, Register result, Label *fail) // This register must match the one in JitRuntime::generateMallocStub. const Register regNBytes = CallTempReg0; - JS_ASSERT(nbytes > 0); - JS_ASSERT(nbytes <= INT32_MAX); + MOZ_ASSERT(nbytes > 0); + MOZ_ASSERT(nbytes <= INT32_MAX); if (regNBytes != result) push(regNBytes); @@ -558,7 +558,7 @@ void MacroAssembler::allocateObject(Register result, Register slots, gc::AllocKind allocKind, uint32_t nDynamicSlots, gc::InitialHeap initialHeap, Label *fail) { - JS_ASSERT(allocKind >= gc::FINALIZE_OBJECT0 && allocKind <= gc::FINALIZE_OBJECT_LAST); + MOZ_ASSERT(allocKind >= gc::FINALIZE_OBJECT0 && allocKind <= gc::FINALIZE_OBJECT_LAST); checkAllocatorState(fail); @@ -593,10 +593,10 @@ MacroAssembler::newGCThing(Register result, Register temp, JSObject *templateObj // This method does not initialize the object: if external slots get // allocated into |temp|, there is no easy way for us to ensure the caller // frees them. Instead just assert this case does not happen. - JS_ASSERT(!templateObj->numDynamicSlots()); + MOZ_ASSERT(!templateObj->numDynamicSlots()); gc::AllocKind allocKind = templateObj->asTenured()->getAllocKind(); - JS_ASSERT(allocKind >= gc::FINALIZE_OBJECT0 && allocKind <= gc::FINALIZE_OBJECT_LAST); + MOZ_ASSERT(allocKind >= gc::FINALIZE_OBJECT0 && allocKind <= gc::FINALIZE_OBJECT_LAST); allocateObject(result, temp, allocKind, templateObj->numDynamicSlots(), initialHeap, fail); } @@ -607,7 +607,7 @@ MacroAssembler::createGCObject(Register obj, Register temp, JSObject *templateOb { uint32_t nDynamicSlots = templateObj->numDynamicSlots(); gc::AllocKind allocKind = templateObj->asTenured()->getAllocKind(); - JS_ASSERT(allocKind >= gc::FINALIZE_OBJECT0 && allocKind <= gc::FINALIZE_OBJECT_LAST); + MOZ_ASSERT(allocKind >= gc::FINALIZE_OBJECT0 && allocKind <= gc::FINALIZE_OBJECT_LAST); // Arrays with copy on write elements do not need fixed space for an // elements header. The template object, which owns the original elements, @@ -659,7 +659,7 @@ MacroAssembler::newGCNurseryThingPar(Register result, Register cx, Register tempReg1, Register tempReg2, gc::AllocKind allocKind, Label *fail) { - JS_ASSERT(IsNurseryAllocable(allocKind)); + MOZ_ASSERT(IsNurseryAllocable(allocKind)); uint32_t thingSize = uint32_t(gc::Arena::thingSize(allocKind)); @@ -737,8 +737,8 @@ MacroAssembler::newGCThingPar(Register result, Register cx, Register tempReg1, R JSObject *templateObject, Label *fail) { gc::AllocKind allocKind = templateObject->asTenured()->getAllocKind(); - JS_ASSERT(allocKind >= gc::FINALIZE_OBJECT0 && allocKind <= gc::FINALIZE_OBJECT_LAST); - JS_ASSERT(!templateObject->numDynamicSlots()); + MOZ_ASSERT(allocKind >= gc::FINALIZE_OBJECT0 && allocKind <= gc::FINALIZE_OBJECT_LAST); + MOZ_ASSERT(!templateObject->numDynamicSlots()); newGCThingPar(result, cx, tempReg1, tempReg2, allocKind, fail); } @@ -793,8 +793,8 @@ MacroAssembler::fillSlotsWithUndefined(Address base, Register temp, uint32_t sta static uint32_t FindStartOfUndefinedSlots(JSObject *templateObj, uint32_t nslots) { - JS_ASSERT(nslots == templateObj->lastProperty()->slotSpan(templateObj->getClass())); - JS_ASSERT(nslots > 0); + MOZ_ASSERT(nslots == templateObj->lastProperty()->slotSpan(templateObj->getClass())); + MOZ_ASSERT(nslots > 0); for (uint32_t first = nslots; first != 0; --first) { if (templateObj->getSlot(first - 1) != UndefinedValue()) return first; @@ -823,7 +823,7 @@ MacroAssembler::initGCSlots(Register obj, Register slots, JSObject *templateObj, // duplicated writes of UndefinedValue to the tail. For the majority of // objects, the "tail" will be the entire slot range. uint32_t startOfUndefined = FindStartOfUndefinedSlots(templateObj, nslots); - JS_ASSERT(startOfUndefined <= nfixed); // Reserved slots must be fixed. + MOZ_ASSERT(startOfUndefined <= nfixed); // Reserved slots must be fixed. // Copy over any preserved reserved slots. copySlotsFromTemplate(obj, templateObj, 0, startOfUndefined); @@ -864,7 +864,7 @@ MacroAssembler::initGCThing(Register obj, Register slots, JSObject *templateObj, Address(obj, JSObject::offsetOfElements())); } else if (templateObj->is()) { Register temp = slots; - JS_ASSERT(!templateObj->getDenseInitializedLength()); + MOZ_ASSERT(!templateObj->getDenseInitializedLength()); int elementsOffset = JSObject::offsetOfFixedElements(); @@ -882,7 +882,7 @@ MacroAssembler::initGCThing(Register obj, Register slots, JSObject *templateObj, ? ObjectElements::CONVERT_DOUBLE_ELEMENTS : 0), Address(obj, elementsOffset + ObjectElements::offsetOfFlags())); - JS_ASSERT(!templateObj->hasPrivate()); + MOZ_ASSERT(!templateObj->hasPrivate()); } else { storePtr(ImmPtr(emptyObjectElements), Address(obj, JSObject::offsetOfElements())); @@ -915,7 +915,7 @@ void MacroAssembler::compareStrings(JSOp op, Register left, Register right, Register result, Label *fail) { - JS_ASSERT(IsEqualityOp(op)); + MOZ_ASSERT(IsEqualityOp(op)); Label done; Label notPointerEqual; @@ -1042,7 +1042,7 @@ MacroAssembler::generateBailoutTail(Register scratch, Register bailoutInfo) { // Prepare a register set for use in this case. GeneralRegisterSet regs(GeneralRegisterSet::All()); - JS_ASSERT(!regs.has(BaselineStackReg)); + MOZ_ASSERT(!regs.has(BaselineStackReg)); regs.take(bailoutInfo); // Reset SP to the point where clobbering starts. @@ -1612,7 +1612,7 @@ MacroAssembler::convertValueToFloatingPoint(JSContext *cx, const Value &v, Float return true; } - JS_ASSERT(v.isObject()); + MOZ_ASSERT(v.isObject()); jump(fail); return true; } @@ -1672,7 +1672,7 @@ void MacroAssembler::convertTypedOrValueToFloatingPoint(TypedOrValueRegister src, FloatRegister output, Label *fail, MIRType outputType) { - JS_ASSERT(IsFloatingPointType(outputType)); + MOZ_ASSERT(IsFloatingPointType(outputType)); if (src.hasValue()) { convertValueToFloatingPoint(src.valueReg(), output, fail, outputType); @@ -1874,7 +1874,7 @@ MacroAssembler::convertValueToInt(JSContext *cx, const Value &v, Register output return true; } - JS_ASSERT(v.isObject()); + MOZ_ASSERT(v.isObject()); jump(fail); return true; @@ -1952,8 +1952,8 @@ MacroAssembler::branchIfNotInterpretedConstructor(Register fun, Register scratch { // 16-bit loads are slow and unaligned 32-bit loads may be too so // perform an aligned 32-bit load and adjust the bitmask accordingly. - JS_ASSERT(JSFunction::offsetOfNargs() % sizeof(uint32_t) == 0); - JS_ASSERT(JSFunction::offsetOfFlags() == JSFunction::offsetOfNargs() + 2); + MOZ_ASSERT(JSFunction::offsetOfNargs() % sizeof(uint32_t) == 0); + MOZ_ASSERT(JSFunction::offsetOfFlags() == JSFunction::offsetOfNargs() + 2); // Emit code for the following test: // diff --git a/js/src/jit/IonMacroAssembler.h b/js/src/jit/IonMacroAssembler.h index 2aa33e80e892..67deac321f46 100644 --- a/js/src/jit/IonMacroAssembler.h +++ b/js/src/jit/IonMacroAssembler.h @@ -134,7 +134,7 @@ class MacroAssembler : public MacroAssemblerSpecific { } void emit(MacroAssembler &masm) { - JS_ASSERT(isInitialized()); + MOZ_ASSERT(isInitialized()); MIRType mirType = MIRType_None; if (type_.isPrimitive()) { @@ -175,7 +175,7 @@ class MacroAssembler : public MacroAssemblerSpecific { } void emit(MacroAssembler &masm) { - JS_ASSERT(isInitialized()); + MOZ_ASSERT(isInitialized()); masm.branchPtr(cond(), reg(), ptr_, jump()); } }; @@ -215,7 +215,7 @@ class MacroAssembler : public MacroAssemblerSpecific constructRoot(cx); if (!icx->temp) { - JS_ASSERT(cx); + MOZ_ASSERT(cx); alloc_.emplace(cx); } @@ -542,8 +542,8 @@ class MacroAssembler : public MacroAssemblerSpecific void branchIfFunctionHasNoScript(Register fun, Label *label) { // 16-bit loads are slow and unaligned 32-bit loads may be too so // perform an aligned 32-bit load and adjust the bitmask accordingly. - JS_ASSERT(JSFunction::offsetOfNargs() % sizeof(uint32_t) == 0); - JS_ASSERT(JSFunction::offsetOfFlags() == JSFunction::offsetOfNargs() + 2); + MOZ_ASSERT(JSFunction::offsetOfNargs() % sizeof(uint32_t) == 0); + MOZ_ASSERT(JSFunction::offsetOfFlags() == JSFunction::offsetOfNargs() + 2); Address address(fun, JSFunction::offsetOfNargs()); int32_t bit = IMM32_16ADJ(JSFunction::INTERPRETED); branchTest32(Assembler::Zero, address, Imm32(bit), label); @@ -551,8 +551,8 @@ class MacroAssembler : public MacroAssemblerSpecific void branchIfInterpreted(Register fun, Label *label) { // 16-bit loads are slow and unaligned 32-bit loads may be too so // perform an aligned 32-bit load and adjust the bitmask accordingly. - JS_ASSERT(JSFunction::offsetOfNargs() % sizeof(uint32_t) == 0); - JS_ASSERT(JSFunction::offsetOfFlags() == JSFunction::offsetOfNargs() + 2); + MOZ_ASSERT(JSFunction::offsetOfNargs() % sizeof(uint32_t) == 0); + MOZ_ASSERT(JSFunction::offsetOfFlags() == JSFunction::offsetOfNargs() + 2); Address address(fun, JSFunction::offsetOfNargs()); int32_t bit = IMM32_16ADJ(JSFunction::INTERPRETED); branchTest32(Assembler::NonZero, address, Imm32(bit), label); @@ -572,8 +572,8 @@ class MacroAssembler : public MacroAssemblerSpecific if (JSID_IS_STRING(id)) { JSString *str = JSID_TO_STRING(id); - JS_ASSERT(((size_t)str & JSID_TYPE_MASK) == 0); - JS_ASSERT(JSID_TYPE_STRING == 0x0); + MOZ_ASSERT(((size_t)str & JSID_TYPE_MASK) == 0); + MOZ_ASSERT(JSID_TYPE_STRING == 0x0); Push(ImmGCPtr(str)); } else { MOZ_ASSERT(JSID_IS_SYMBOL(id)); @@ -625,7 +625,7 @@ class MacroAssembler : public MacroAssemblerSpecific } void PushValue(const Address &addr) { - JS_ASSERT(addr.base != StackPointer); + MOZ_ASSERT(addr.base != StackPointer); pushValue(addr); framePushed_ += sizeof(Value); } @@ -663,7 +663,7 @@ class MacroAssembler : public MacroAssemblerSpecific } void branchTestNeedsIncrementalBarrier(Condition cond, Label *label) { - JS_ASSERT(cond == Zero || cond == NonZero); + MOZ_ASSERT(cond == Zero || cond == NonZero); CompileZone *zone = GetIonContext()->compartment->zone(); AbsoluteAddress needsBarrierAddr(zone->addressOfNeedsIncrementalBarrier()); branchTest32(cond, needsBarrierAddr, Imm32(0x1), label); @@ -772,7 +772,7 @@ class MacroAssembler : public MacroAssemblerSpecific Register extractObject(const TypedOrValueRegister ®, Register scratch) { if (reg.hasValue()) return extractObject(reg.valueReg(), scratch); - JS_ASSERT(reg.type() == MIRType_Object); + MOZ_ASSERT(reg.type() == MIRType_Object); return reg.typedReg().gpr(); } @@ -911,7 +911,7 @@ class MacroAssembler : public MacroAssemblerSpecific } void link(JitCode *code) { - JS_ASSERT(!oom()); + MOZ_ASSERT(!oom()); // If this code can transition to C++ code and witness a GC, then we need to store // the JitCode onto the stack in order to GC it correctly. exitCodePatch should // be unset if the code never needed to push its JitCode*. @@ -1206,7 +1206,7 @@ class MacroAssembler : public MacroAssemblerSpecific #endif #define DISPATCH_FLOATING_POINT_OP(method, type, arg1d, arg1f, arg2) \ - JS_ASSERT(IsFloatingPointType(type)); \ + MOZ_ASSERT(IsFloatingPointType(type)); \ if (type == MIRType_Double) \ method##Double(arg1d, arg2); \ else \ @@ -1450,14 +1450,14 @@ class MacroAssembler : public MacroAssemblerSpecific void icRestoreLive(RegisterSet &liveRegs, AfterICSaveLive &aic) { restoreFrameAlignmentForICArguments(aic); - JS_ASSERT(framePushed() == aic.initialStack); + MOZ_ASSERT(framePushed() == aic.initialStack); PopRegsInMask(liveRegs); } void assertStackAlignment(uint32_t alignment) { #ifdef DEBUG Label ok; - JS_ASSERT(IsPowerOfTwo(alignment)); + MOZ_ASSERT(IsPowerOfTwo(alignment)); branchTestPtr(Assembler::Zero, StackPointer, Imm32(alignment - 1), &ok); breakpoint(); bind(&ok); diff --git a/js/src/jit/IonOptimizationLevels.cpp b/js/src/jit/IonOptimizationLevels.cpp index 80b07864b1da..9aeaee5871d4 100644 --- a/js/src/jit/IonOptimizationLevels.cpp +++ b/js/src/jit/IonOptimizationLevels.cpp @@ -64,7 +64,7 @@ OptimizationInfo::initAsmjsOptimizationInfo() uint32_t OptimizationInfo::compilerWarmUpThreshold(JSScript *script, jsbytecode *pc) const { - JS_ASSERT(pc == nullptr || pc == script->code() || JSOp(*pc) == JSOP_LOOPENTRY); + MOZ_ASSERT(pc == nullptr || pc == script->code() || JSOp(*pc) == JSOP_LOOPENTRY); if (pc == script->code()) pc = nullptr; @@ -92,7 +92,7 @@ OptimizationInfo::compilerWarmUpThreshold(JSScript *script, jsbytecode *pc) cons // To accomplish this, we use a slightly higher threshold for inner loops. // Note that the loop depth is always > 0 so we will prefer non-OSR over OSR. uint32_t loopDepth = LoopEntryDepthHint(pc); - JS_ASSERT(loopDepth > 0); + MOZ_ASSERT(loopDepth > 0); return warmUpThreshold + loopDepth * 100; } @@ -105,7 +105,7 @@ OptimizationInfos::OptimizationInfos() OptimizationLevel level = firstLevel(); while (!isLastLevel(level)) { OptimizationLevel next = nextLevel(level); - JS_ASSERT(level < next); + MOZ_ASSERT(level < next); level = next; } #endif @@ -114,7 +114,7 @@ OptimizationInfos::OptimizationInfos() OptimizationLevel OptimizationInfos::nextLevel(OptimizationLevel level) const { - JS_ASSERT(!isLastLevel(level)); + MOZ_ASSERT(!isLastLevel(level)); switch (level) { case Optimization_DontCompile: return Optimization_Normal; diff --git a/js/src/jit/IonOptimizationLevels.h b/js/src/jit/IonOptimizationLevels.h index 2c1565fc14df..2b5b6c6c1492 100644 --- a/js/src/jit/IonOptimizationLevels.h +++ b/js/src/jit/IonOptimizationLevels.h @@ -205,8 +205,8 @@ class OptimizationInfos OptimizationInfos(); const OptimizationInfo *get(OptimizationLevel level) const { - JS_ASSERT(level < Optimization_Count); - JS_ASSERT(level != Optimization_DontCompile); + MOZ_ASSERT(level < Optimization_Count); + MOZ_ASSERT(level != Optimization_DontCompile); return &infos_[level - 1]; } diff --git a/js/src/jit/IonTypes.h b/js/src/jit/IonTypes.h index a27a8dc7fa2d..131449800500 100644 --- a/js/src/jit/IonTypes.h +++ b/js/src/jit/IonTypes.h @@ -296,7 +296,7 @@ class SimdConstant { } uint32_t length() const { - JS_ASSERT(defined()); + MOZ_ASSERT(defined()); switch(type_) { case Int32x4: case Float32x4: @@ -308,21 +308,21 @@ class SimdConstant { } Type type() const { - JS_ASSERT(defined()); + MOZ_ASSERT(defined()); return type_; } const int32_t *asInt32x4() const { - JS_ASSERT(defined() && type_ == Int32x4); + MOZ_ASSERT(defined() && type_ == Int32x4); return u.i32x4; } const float *asFloat32x4() const { - JS_ASSERT(defined() && type_ == Float32x4); + MOZ_ASSERT(defined() && type_ == Float32x4); return u.f32x4; } bool operator==(const SimdConstant &rhs) const { - JS_ASSERT(defined() && rhs.defined()); + MOZ_ASSERT(defined() && rhs.defined()); if (type() != rhs.type()) return false; return memcmp(&u, &rhs.u, sizeof(u)) == 0; @@ -439,7 +439,7 @@ ValueTypeFromMIRType(MIRType type) case MIRType_MagicUninitializedLexical: return JSVAL_TYPE_MAGIC; default: - JS_ASSERT(type == MIRType_Object); + MOZ_ASSERT(type == MIRType_Object); return JSVAL_TYPE_OBJECT; } } @@ -538,7 +538,7 @@ IsSimdType(MIRType type) static inline unsigned SimdTypeToLength(MIRType type) { - JS_ASSERT(IsSimdType(type)); + MOZ_ASSERT(IsSimdType(type)); switch (type) { case MIRType_Int32x4: case MIRType_Float32x4: @@ -551,7 +551,7 @@ SimdTypeToLength(MIRType type) static inline MIRType SimdTypeToScalarType(MIRType type) { - JS_ASSERT(IsSimdType(type)); + MOZ_ASSERT(IsSimdType(type)); switch (type) { case MIRType_Int32x4: return MIRType_Int32; diff --git a/js/src/jit/JSONSpewer.cpp b/js/src/jit/JSONSpewer.cpp index 91e97007cbba..36f6c052c110 100644 --- a/js/src/jit/JSONSpewer.cpp +++ b/js/src/jit/JSONSpewer.cpp @@ -28,7 +28,7 @@ JSONSpewer::indent() { if (!fp_) return; - JS_ASSERT(indentLevel_ >= 0); + MOZ_ASSERT(indentLevel_ >= 0); fprintf(fp_, "\n"); for (int i = 0; i < indentLevel_; i++) fprintf(fp_, " "); @@ -456,7 +456,7 @@ JSONSpewer::endPass() void JSONSpewer::endFunction() { - JS_ASSERT(inFunction_); + MOZ_ASSERT(inFunction_); endList(); endObject(); fflush(fp_); diff --git a/js/src/jit/JitCompartment.h b/js/src/jit/JitCompartment.h index 035e2dba8531..d13f34aa6113 100644 --- a/js/src/jit/JitCompartment.h +++ b/js/src/jit/JitCompartment.h @@ -274,12 +274,12 @@ class JitRuntime } ExecutableAllocator *getIonAlloc(JSContext *cx) { - JS_ASSERT(cx->runtime()->currentThreadOwnsInterruptLock()); + MOZ_ASSERT(cx->runtime()->currentThreadOwnsInterruptLock()); return ionAlloc_ ? ionAlloc_ : createIonAlloc(cx); } ExecutableAllocator *ionAlloc(JSRuntime *rt) { - JS_ASSERT(rt->currentThreadOwnsInterruptLock()); + MOZ_ASSERT(rt->currentThreadOwnsInterruptLock()); return ionAlloc_; } @@ -391,8 +391,8 @@ class JitRuntime return v; } void setIonReturnOverride(const js::Value &v) { - JS_ASSERT(!hasIonReturnOverride()); - JS_ASSERT(!v.isMagic()); + MOZ_ASSERT(!hasIonReturnOverride()); + MOZ_ASSERT(!v.isMagic()); ionReturnOverride_ = v; } @@ -401,7 +401,7 @@ class JitRuntime } JitcodeGlobalTable *getJitcodeGlobalTable() { - JS_ASSERT(hasJitcodeGlobalTable()); + MOZ_ASSERT(hasJitcodeGlobalTable()); return jitcodeGlobalTable_; } @@ -466,32 +466,32 @@ class JitCompartment // Make sure to do a lookupForAdd(key) and then insert into that slot, because // that way if stubCode gets moved due to a GC caused by lookupForAdd, then // we still write the correct pointer. - JS_ASSERT(!stubCodes_->has(key)); + MOZ_ASSERT(!stubCodes_->has(key)); ICStubCodeMap::AddPtr p = stubCodes_->lookupForAdd(key); return stubCodes_->add(p, key, stubCode.get()); } void initBaselineCallReturnAddr(void *addr) { - JS_ASSERT(baselineCallReturnAddr_ == nullptr); + MOZ_ASSERT(baselineCallReturnAddr_ == nullptr); baselineCallReturnAddr_ = addr; } void *baselineCallReturnAddr() { - JS_ASSERT(baselineCallReturnAddr_ != nullptr); + MOZ_ASSERT(baselineCallReturnAddr_ != nullptr); return baselineCallReturnAddr_; } void initBaselineGetPropReturnAddr(void *addr) { - JS_ASSERT(baselineGetPropReturnAddr_ == nullptr); + MOZ_ASSERT(baselineGetPropReturnAddr_ == nullptr); baselineGetPropReturnAddr_ = addr; } void *baselineGetPropReturnAddr() { - JS_ASSERT(baselineGetPropReturnAddr_ != nullptr); + MOZ_ASSERT(baselineGetPropReturnAddr_ != nullptr); return baselineGetPropReturnAddr_; } void initBaselineSetPropReturnAddr(void *addr) { - JS_ASSERT(baselineSetPropReturnAddr_ == nullptr); + MOZ_ASSERT(baselineSetPropReturnAddr_ == nullptr); baselineSetPropReturnAddr_ = addr; } void *baselineSetPropReturnAddr() { - JS_ASSERT(baselineSetPropReturnAddr_ != nullptr); + MOZ_ASSERT(baselineSetPropReturnAddr_ != nullptr); return baselineSetPropReturnAddr_; } diff --git a/js/src/jit/JitFrameIterator-inl.h b/js/src/jit/JitFrameIterator-inl.h index 3a5cbdd555af..2850ef657654 100644 --- a/js/src/jit/JitFrameIterator-inl.h +++ b/js/src/jit/JitFrameIterator-inl.h @@ -19,7 +19,7 @@ namespace jit { inline BaselineFrame * JitFrameIterator::baselineFrame() const { - JS_ASSERT(isBaselineJS()); + MOZ_ASSERT(isBaselineJS()); return (BaselineFrame *)(fp() - BaselineFrame::FramePointerOffset - BaselineFrame::Size()); } diff --git a/js/src/jit/JitFrameIterator.h b/js/src/jit/JitFrameIterator.h index 63ed9dc929a7..05b2f691689f 100644 --- a/js/src/jit/JitFrameIterator.h +++ b/js/src/jit/JitFrameIterator.h @@ -139,7 +139,7 @@ class JitFrameIterator inline uint8_t *returnAddress() const; IonJSFrameLayout *jsFrame() const { - JS_ASSERT(isScripted()); + MOZ_ASSERT(isScripted()); return (IonJSFrameLayout *) fp(); } @@ -201,7 +201,7 @@ class JitFrameIterator // Returns the stack space used by the current frame, in bytes. This does // not include the size of its fixed header. size_t frameSize() const { - JS_ASSERT(type_ != JitFrame_Exit); + MOZ_ASSERT(type_ != JitFrame_Exit); return frameSize_; } @@ -232,7 +232,7 @@ class JitFrameIterator template void unaliasedForEachActual(Op op, ReadFrameArgsBehavior behavior) const { - JS_ASSERT(isBaselineJS()); + MOZ_ASSERT(isBaselineJS()); unsigned nactual = numActualArgs(); unsigned start, end; @@ -593,7 +593,7 @@ class InlineFrameIterator return frame_ && framesRead_ < frameCount_; } JSFunction *callee() const { - JS_ASSERT(callee_); + MOZ_ASSERT(callee_); return callee_; } JSFunction *maybeCallee() const { @@ -657,7 +657,7 @@ class InlineFrameIterator // Skip over all slots until we get to the last slots // (= arguments slots of callee) the +3 is for [this], [returnvalue], // [scopechain], and maybe +1 for [argsObj] - JS_ASSERT(parent_s.numAllocations() >= nactual + 3 + argsObjAdj); + MOZ_ASSERT(parent_s.numAllocations() >= nactual + 3 + argsObjAdj); unsigned skip = parent_s.numAllocations() - nactual - 3 - argsObjAdj; for (unsigned j = 0; j < skip; j++) parent_s.skip(); @@ -719,7 +719,7 @@ class InlineFrameIterator } Value thisValue(MaybeReadFallback &fallback) const { - // JS_ASSERT(isConstructing(...)); + // MOZ_ASSERT(isConstructing(...)); SnapshotIterator s(si_); // scopeChain diff --git a/js/src/jit/JitSpewer.cpp b/js/src/jit/JitSpewer.cpp index b562293b9c97..92195a33be51 100644 --- a/js/src/jit/JitSpewer.cpp +++ b/js/src/jit/JitSpewer.cpp @@ -145,7 +145,7 @@ IonSpewer::beginFunction(MIRGraph *graph, HandleScript function) return; if (!FilterContainsLocation(function)) { - JS_ASSERT(!this->graph); + MOZ_ASSERT(!this->graph); // filter out logs during the compilation. filteredOutCompilations++; return; @@ -190,7 +190,7 @@ IonSpewer::endFunction() { if (!isSpewingFunction()) { if (inited_) { - JS_ASSERT(filteredOutCompilations != 0); + MOZ_ASSERT(filteredOutCompilations != 0); filteredOutCompilations--; } return; @@ -430,21 +430,21 @@ jit::JitSpewHeader(JitSpewChannel channel) bool jit::JitSpewEnabled(JitSpewChannel channel) { - JS_ASSERT(LoggingChecked); + MOZ_ASSERT(LoggingChecked); return (LoggingBits & (1 << uint32_t(channel))) && !filteredOutCompilations; } void jit::EnableChannel(JitSpewChannel channel) { - JS_ASSERT(LoggingChecked); + MOZ_ASSERT(LoggingChecked); LoggingBits |= (1 << uint32_t(channel)); } void jit::DisableChannel(JitSpewChannel channel) { - JS_ASSERT(LoggingChecked); + MOZ_ASSERT(LoggingChecked); LoggingBits &= ~(1 << uint32_t(channel)); } diff --git a/js/src/jit/JitcodeMap.cpp b/js/src/jit/JitcodeMap.cpp index 1f0e5a7fb6e2..a5c1e81cf15c 100644 --- a/js/src/jit/JitcodeMap.cpp +++ b/js/src/jit/JitcodeMap.cpp @@ -20,18 +20,18 @@ JitcodeGlobalEntry::IonEntry::callStackAtAddr(JSRuntime *rt, void *ptr, BytecodeLocationVector &results, uint32_t *depth) const { - JS_ASSERT(containsPointer(ptr)); + MOZ_ASSERT(containsPointer(ptr)); uint32_t ptrOffset = reinterpret_cast(ptr) - reinterpret_cast(nativeStartAddr()); uint32_t regionIdx = regionTable()->findRegionEntry(ptrOffset); - JS_ASSERT(regionIdx < regionTable()->numRegions()); + MOZ_ASSERT(regionIdx < regionTable()->numRegions()); JitcodeRegionEntry region = regionTable()->regionEntry(regionIdx); *depth = region.scriptDepth(); JitcodeRegionEntry::ScriptPcIterator locationIter = region.scriptPcIterator(); - JS_ASSERT(locationIter.hasMore()); + MOZ_ASSERT(locationIter.hasMore()); bool first = true; while (locationIter.hasMore()) { uint32_t scriptIdx, pcOffset; @@ -75,8 +75,8 @@ JitcodeGlobalEntry::BaselineEntry::callStackAtAddr(JSRuntime *rt, void *ptr, BytecodeLocationVector &results, uint32_t *depth) const { - JS_ASSERT(containsPointer(ptr)); - JS_ASSERT(script_->hasBaselineScript()); + MOZ_ASSERT(containsPointer(ptr)); + MOZ_ASSERT(script_->hasBaselineScript()); jsbytecode *pc = script_->baselineScript()->pcForNativeAddress(script_, (uint8_t*) ptr); if (!results.append(BytecodeLocation(script_, pc))) @@ -92,13 +92,13 @@ JitcodeGlobalEntry::IonCacheEntry::callStackAtAddr(JSRuntime *rt, void *ptr, BytecodeLocationVector &results, uint32_t *depth) const { - JS_ASSERT(containsPointer(ptr)); + MOZ_ASSERT(containsPointer(ptr)); // There must exist an entry for the rejoin addr if this entry exists. JitRuntime *jitrt = rt->jitRuntime(); JitcodeGlobalEntry entry; jitrt->getJitcodeGlobalTable()->lookupInfallible(rejoinAddr(), &entry); - JS_ASSERT(entry.isIon()); + MOZ_ASSERT(entry.isIon()); return entry.callStackAtAddr(rt, rejoinAddr(), results, depth); } @@ -118,7 +118,7 @@ static int ComparePointers(const void *a, const void *b) { JitcodeGlobalEntry::compare(const JitcodeGlobalEntry &ent1, const JitcodeGlobalEntry &ent2) { // Both parts of compare cannot be a query. - JS_ASSERT(!(ent1.isQuery() && ent2.isQuery())); + MOZ_ASSERT(!(ent1.isQuery() && ent2.isQuery())); // Ensure no overlaps for non-query lookups. JS_ASSERT_IF(!ent1.isQuery() && !ent2.isQuery(), !ent1.overlapsWith(ent2)); @@ -146,7 +146,7 @@ JitcodeGlobalEntry::compare(const JitcodeGlobalEntry &ent1, const JitcodeGlobalE bool JitcodeGlobalTable::lookup(void *ptr, JitcodeGlobalEntry *result) { - JS_ASSERT(result); + MOZ_ASSERT(result); // Construct a JitcodeGlobalEntry::Query to do the lookup JitcodeGlobalEntry query = JitcodeGlobalEntry::MakeQuery(ptr); @@ -157,14 +157,14 @@ void JitcodeGlobalTable::lookupInfallible(void *ptr, JitcodeGlobalEntry *result) { mozilla::DebugOnly success = lookup(ptr, result); - JS_ASSERT(success); + MOZ_ASSERT(success); } bool JitcodeGlobalTable::addEntry(const JitcodeGlobalEntry &entry) { // Should only add Main entries for now. - JS_ASSERT(entry.isIon() || entry.isBaseline() || entry.isIonCache()); + MOZ_ASSERT(entry.isIon() || entry.isBaseline() || entry.isIonCache()); return tree_.insert(entry); } @@ -294,7 +294,7 @@ JitcodeRegionEntry::ReadDelta(CompactBufferReader &reader, uint32_t encVal = firstByte | secondByte << 8; *nativeDelta = encVal >> ENC2_NATIVE_DELTA_SHIFT; *pcDelta = (encVal & ENC2_PC_DELTA_MASK) >> ENC2_PC_DELTA_SHIFT; - JS_ASSERT(*pcDelta != 0); + MOZ_ASSERT(*pcDelta != 0); JS_ASSERT_IF(*nativeDelta == 0, *pcDelta <= 0); return; } @@ -310,13 +310,13 @@ JitcodeRegionEntry::ReadDelta(CompactBufferReader &reader, if (pcDeltaU > ENC3_PC_DELTA_MAX) pcDeltaU |= ~ENC3_PC_DELTA_MAX; *pcDelta = pcDeltaU; - JS_ASSERT(*pcDelta != 0); + MOZ_ASSERT(*pcDelta != 0); JS_ASSERT_IF(*nativeDelta == 0, *pcDelta <= 0); return; } // NNNN-NNNN NNNN-NNNN BBBB-BBBB BBBB-B111 - JS_ASSERT((firstByte & ENC4_MASK) == ENC4_MASK_VAL); + MOZ_ASSERT((firstByte & ENC4_MASK) == ENC4_MASK_VAL); const uint32_t fourthByte = reader.readByte(); uint32_t encVal = firstByte | secondByte << 8 | thirdByte << 16 | fourthByte << 24; *nativeDelta = encVal >> ENC4_NATIVE_DELTA_SHIFT; @@ -327,7 +327,7 @@ JitcodeRegionEntry::ReadDelta(CompactBufferReader &reader, pcDeltaU |= ~ENC4_PC_DELTA_MAX; *pcDelta = pcDeltaU; - JS_ASSERT(*pcDelta != 0); + MOZ_ASSERT(*pcDelta != 0); JS_ASSERT_IF(*nativeDelta == 0, *pcDelta <= 0); } @@ -335,7 +335,7 @@ JitcodeRegionEntry::ReadDelta(CompactBufferReader &reader, JitcodeRegionEntry::ExpectedRunLength(const CodeGeneratorShared::NativeToBytecode *entry, const CodeGeneratorShared::NativeToBytecode *end) { - JS_ASSERT(entry < end); + MOZ_ASSERT(entry < end); // We always use the first entry, so runLength starts at 1 uint32_t runLength = 1; @@ -350,7 +350,7 @@ JitcodeRegionEntry::ExpectedRunLength(const CodeGeneratorShared::NativeToBytecod uint32_t nextNativeOffset = nextEntry->nativeOffset.offset(); uint32_t nextBytecodeOffset = nextEntry->tree->script()->pcToOffset(nextEntry->pc); - JS_ASSERT(nextNativeOffset >= curNativeOffset); + MOZ_ASSERT(nextNativeOffset >= curNativeOffset); uint32_t nativeDelta = nextNativeOffset - curNativeOffset; int32_t bytecodeDelta = int32_t(nextBytecodeOffset) - int32_t(curBytecodeOffset); @@ -419,11 +419,11 @@ JitcodeRegionEntry::WriteRun(CompactBufferWriter &writer, JSScript **scriptList, uint32_t scriptListSize, uint32_t runLength, const CodeGeneratorShared::NativeToBytecode *entry) { - JS_ASSERT(runLength > 0); - JS_ASSERT(runLength <= MAX_RUN_LENGTH); + MOZ_ASSERT(runLength > 0); + MOZ_ASSERT(runLength <= MAX_RUN_LENGTH); // Calculate script depth. - JS_ASSERT(entry->tree->depth() <= 0xff); + MOZ_ASSERT(entry->tree->depth() <= 0xff); uint8_t scriptDepth = entry->tree->depth(); uint32_t regionNativeOffset = entry->nativeOffset.offset(); @@ -447,7 +447,7 @@ JitcodeRegionEntry::WriteRun(CompactBufferWriter &writer, if (scriptList[scriptIdx] == curTree->script()) break; } - JS_ASSERT(scriptIdx < scriptListSize); + MOZ_ASSERT(scriptIdx < scriptListSize); uint32_t pcOffset = curTree->script()->pcToOffset(curPc); @@ -471,15 +471,15 @@ JitcodeRegionEntry::WriteRun(CompactBufferWriter &writer, // Skip first entry because it is implicit in the header. Start at subsequent entry. for (uint32_t i = 1; i < runLength; i++) { - JS_ASSERT(entry[i].tree == entry->tree); + MOZ_ASSERT(entry[i].tree == entry->tree); uint32_t nextNativeOffset = entry[i].nativeOffset.offset(); uint32_t nextBytecodeOffset = entry[i].tree->script()->pcToOffset(entry[i].pc); - JS_ASSERT(nextNativeOffset >= curNativeOffset); + MOZ_ASSERT(nextNativeOffset >= curNativeOffset); uint32_t nativeDelta = nextNativeOffset - curNativeOffset; int32_t bytecodeDelta = int32_t(nextBytecodeOffset) - int32_t(curBytecodeOffset); - JS_ASSERT(IsDeltaEncodeable(nativeDelta, bytecodeDelta)); + MOZ_ASSERT(IsDeltaEncodeable(nativeDelta, bytecodeDelta)); JitSpew(JitSpew_Profiling, " RunEntry native: %d-%d [%d] bytecode: %d-%d [%d]", int(curNativeOffset), int(nextNativeOffset), int(nativeDelta), @@ -515,7 +515,7 @@ JitcodeRegionEntry::unpack() { CompactBufferReader reader(data_, end_); ReadHead(reader, &nativeOffset_, &scriptDepth_); - JS_ASSERT(scriptDepth_ > 0); + MOZ_ASSERT(scriptDepth_ > 0); scriptPcStack_ = reader.currentPosition(); // Skip past script/pc stack @@ -556,7 +556,7 @@ JitcodeIonTable::makeIonEntry(JSContext *cx, JitCode *code, { typedef JitcodeGlobalEntry::IonEntry::SizedScriptList SizedScriptList; - JS_ASSERT(numScripts > 0); + MOZ_ASSERT(numScripts > 0); if (numScripts == 1) { out.init(code->raw(), code->raw() + code->instructionsSize(), scripts[0], this); @@ -582,14 +582,14 @@ JitcodeIonTable::findRegionEntry(uint32_t nativeOffset) const { static const uint32_t LINEAR_SEARCH_THRESHOLD = 8; uint32_t regions = numRegions(); - JS_ASSERT(regions > 0); + MOZ_ASSERT(regions > 0); // For small region lists, just search linearly. if (regions <= LINEAR_SEARCH_THRESHOLD) { JitcodeRegionEntry previousEntry = regionEntry(0); for (uint32_t i = 1; i < regions; i++) { JitcodeRegionEntry nextEntry = regionEntry(i); - JS_ASSERT(nextEntry.nativeOffset() >= previousEntry.nativeOffset()); + MOZ_ASSERT(nextEntry.nativeOffset() >= previousEntry.nativeOffset()); // See note in binary-search code below about why we use '<=' here instead of // '<'. Short explanation: regions are closed at their ending addresses, @@ -638,10 +638,10 @@ JitcodeIonTable::WriteIonTable(CompactBufferWriter &writer, const CodeGeneratorShared::NativeToBytecode *end, uint32_t *tableOffsetOut, uint32_t *numRegionsOut) { - JS_ASSERT(tableOffsetOut != nullptr); - JS_ASSERT(numRegionsOut != nullptr); - JS_ASSERT(writer.length() == 0); - JS_ASSERT(scriptListSize > 0); + MOZ_ASSERT(tableOffsetOut != nullptr); + MOZ_ASSERT(numRegionsOut != nullptr); + MOZ_ASSERT(writer.length() == 0); + MOZ_ASSERT(scriptListSize > 0); JitSpew(JitSpew_Profiling, "Writing native to bytecode map for %s:%d (%d entries)", scriptList[0]->filename(), scriptList[0]->lineno(), @@ -661,8 +661,8 @@ JitcodeIonTable::WriteIonTable(CompactBufferWriter &writer, while (curEntry != end) { // Calculate the length of the next run. uint32_t runLength = JitcodeRegionEntry::ExpectedRunLength(curEntry, end); - JS_ASSERT(runLength > 0); - JS_ASSERT(runLength <= (end - curEntry)); + MOZ_ASSERT(runLength > 0); + MOZ_ASSERT(runLength <= (end - curEntry)); JitSpew(JitSpew_Profiling, " Run at entry %d, length %d, buffer offset %d", int(curEntry - start), int(runLength), int(writer.length())); diff --git a/js/src/jit/JitcodeMap.h b/js/src/jit/JitcodeMap.h index c56125b05943..1a837410ed2e 100644 --- a/js/src/jit/JitcodeMap.h +++ b/js/src/jit/JitcodeMap.h @@ -66,9 +66,9 @@ class JitcodeGlobalEntry } void init(Kind kind, void *nativeStartAddr, void *nativeEndAddr) { - JS_ASSERT(nativeStartAddr); - JS_ASSERT(nativeEndAddr); - JS_ASSERT(kind > INVALID && kind < LIMIT); + MOZ_ASSERT(nativeStartAddr); + MOZ_ASSERT(nativeEndAddr); + MOZ_ASSERT(kind > INVALID && kind < LIMIT); nativeStartAddr_ = nativeStartAddr; nativeEndAddr_ = nativeEndAddr; kind_ = kind; @@ -130,9 +130,9 @@ class JitcodeGlobalEntry void init(void *nativeStartAddr, void *nativeEndAddr, JSScript *script, JitcodeIonTable *regionTable) { - JS_ASSERT((uintptr_t(script) & LowMask) == 0); - JS_ASSERT(script); - JS_ASSERT(regionTable); + MOZ_ASSERT((uintptr_t(script) & LowMask) == 0); + MOZ_ASSERT(script); + MOZ_ASSERT(regionTable); BaseEntry::init(Ion, nativeStartAddr, nativeEndAddr); scriptList_ = uintptr_t(script); regionTable_ = regionTable; @@ -141,11 +141,11 @@ class JitcodeGlobalEntry void init(void *nativeStartAddr, void *nativeEndAddr, unsigned numScripts, JSScript **scripts, JitcodeIonTable *regionTable) { - JS_ASSERT((uintptr_t(scripts) & LowMask) == 0); - JS_ASSERT(numScripts >= 1); - JS_ASSERT(numScripts <= 6); - JS_ASSERT(scripts); - JS_ASSERT(regionTable); + MOZ_ASSERT((uintptr_t(scripts) & LowMask) == 0); + MOZ_ASSERT(numScripts >= 1); + MOZ_ASSERT(numScripts <= 6); + MOZ_ASSERT(scripts); + MOZ_ASSERT(regionTable); BaseEntry::init(Ion, nativeStartAddr, nativeEndAddr); scriptList_ = uintptr_t(scripts) | numScripts; regionTable_ = regionTable; @@ -154,10 +154,10 @@ class JitcodeGlobalEntry void init(void *nativeStartAddr, void *nativeEndAddr, SizedScriptList *scripts, JitcodeIonTable *regionTable) { - JS_ASSERT((uintptr_t(scripts) & LowMask) == 0); - JS_ASSERT(scripts->size > 6); - JS_ASSERT(scripts); - JS_ASSERT(regionTable); + MOZ_ASSERT((uintptr_t(scripts) & LowMask) == 0); + MOZ_ASSERT(scripts->size > 6); + MOZ_ASSERT(scripts); + MOZ_ASSERT(regionTable); BaseEntry::init(Ion, nativeStartAddr, nativeEndAddr); scriptList_ = uintptr_t(scripts) | uintptr_t(Multi); @@ -172,15 +172,15 @@ class JitcodeGlobalEntry } JSScript *singleScript() const { - JS_ASSERT(scriptListTag() == Single); + MOZ_ASSERT(scriptListTag() == Single); return reinterpret_cast(scriptListPointer()); } JSScript **rawScriptArray() const { - JS_ASSERT(scriptListTag() < Multi); + MOZ_ASSERT(scriptListTag() < Multi); return reinterpret_cast(scriptListPointer()); } SizedScriptList *sizedScriptList() const { - JS_ASSERT(scriptListTag() == Multi); + MOZ_ASSERT(scriptListTag() == Multi); return reinterpret_cast(scriptListPointer()); } @@ -190,7 +190,7 @@ class JitcodeGlobalEntry return 1; if (tag < Multi) { - JS_ASSERT(int(tag) >= 2); + MOZ_ASSERT(int(tag) >= 2); return static_cast(tag); } @@ -198,7 +198,7 @@ class JitcodeGlobalEntry } JSScript *getScript(unsigned idx) const { - JS_ASSERT(idx < numScripts()); + MOZ_ASSERT(idx < numScripts()); ScriptListTag tag = scriptListTag(); @@ -206,7 +206,7 @@ class JitcodeGlobalEntry return singleScript(); if (tag < Multi) { - JS_ASSERT(int(tag) >= 2); + MOZ_ASSERT(int(tag) >= 2); return rawScriptArray()[idx]; } @@ -238,7 +238,7 @@ class JitcodeGlobalEntry void init(void *nativeStartAddr, void *nativeEndAddr, JSScript *script) { - JS_ASSERT(script != nullptr); + MOZ_ASSERT(script != nullptr); BaseEntry::init(Baseline, nativeStartAddr, nativeEndAddr); script_ = script; } @@ -259,7 +259,7 @@ class JitcodeGlobalEntry void init(void *nativeStartAddr, void *nativeEndAddr, void *rejoinAddr) { - JS_ASSERT(rejoinAddr != nullptr); + MOZ_ASSERT(rejoinAddr != nullptr); BaseEntry::init(IonCache, nativeStartAddr, nativeEndAddr); rejoinAddr_ = rejoinAddr; } @@ -402,36 +402,36 @@ class JitcodeGlobalEntry } IonEntry &ionEntry() { - JS_ASSERT(isIon()); + MOZ_ASSERT(isIon()); return ion_; } BaselineEntry &baselineEntry() { - JS_ASSERT(isBaseline()); + MOZ_ASSERT(isBaseline()); return baseline_; } IonCacheEntry &ionCacheEntry() { - JS_ASSERT(isIonCache()); + MOZ_ASSERT(isIonCache()); return ionCache_; } QueryEntry &queryEntry() { - JS_ASSERT(isQuery()); + MOZ_ASSERT(isQuery()); return query_; } const IonEntry &ionEntry() const { - JS_ASSERT(isIon()); + MOZ_ASSERT(isIon()); return ion_; } const BaselineEntry &baselineEntry() const { - JS_ASSERT(isBaseline()); + MOZ_ASSERT(isBaseline()); return baseline_; } const IonCacheEntry &ionCacheEntry() const { - JS_ASSERT(isIonCache()); + MOZ_ASSERT(isIonCache()); return ionCache_; } const QueryEntry &queryEntry() const { - JS_ASSERT(isQuery()); + MOZ_ASSERT(isQuery()); return query_; } @@ -692,10 +692,10 @@ class JitcodeRegionEntry nativeOffset_(0), scriptDepth_(0), scriptPcStack_(nullptr), deltaRun_(nullptr) { - JS_ASSERT(data_ < end_); + MOZ_ASSERT(data_ < end_); unpack(); - JS_ASSERT(scriptPcStack_ < end_); - JS_ASSERT(deltaRun_ <= end_); + MOZ_ASSERT(scriptPcStack_ < end_); + MOZ_ASSERT(deltaRun_ <= end_); } uint32_t nativeOffset() const { @@ -722,22 +722,22 @@ class JitcodeRegionEntry bool hasMore() const { - JS_ASSERT((idx_ == count_) == (cur_ == end_)); - JS_ASSERT((idx_ < count_) == (cur_ < end_)); + MOZ_ASSERT((idx_ == count_) == (cur_ == end_)); + MOZ_ASSERT((idx_ < count_) == (cur_ < end_)); return cur_ < end_; } void readNext(uint32_t *scriptIdxOut, uint32_t *pcOffsetOut) { - JS_ASSERT(scriptIdxOut); - JS_ASSERT(pcOffsetOut); - JS_ASSERT(hasMore()); + MOZ_ASSERT(scriptIdxOut); + MOZ_ASSERT(pcOffsetOut); + MOZ_ASSERT(hasMore()); CompactBufferReader reader(cur_, end_); ReadScriptPc(reader, scriptIdxOut, pcOffsetOut); cur_ = reader.currentPosition(); - JS_ASSERT(cur_ <= end_); + MOZ_ASSERT(cur_ <= end_); idx_++; JS_ASSERT_IF(idx_ == count_, cur_ == end_); @@ -767,22 +767,22 @@ class JitcodeRegionEntry bool hasMore() const { - JS_ASSERT(cur_ <= end_); + MOZ_ASSERT(cur_ <= end_); return cur_ < end_; } void readNext(uint32_t *nativeDeltaOut, int32_t *pcDeltaOut) { - JS_ASSERT(nativeDeltaOut != nullptr); - JS_ASSERT(pcDeltaOut != nullptr); + MOZ_ASSERT(nativeDeltaOut != nullptr); + MOZ_ASSERT(pcDeltaOut != nullptr); - JS_ASSERT(hasMore()); + MOZ_ASSERT(hasMore()); CompactBufferReader reader(cur_, end_); ReadDelta(reader, nativeDeltaOut, pcDeltaOut); cur_ = reader.currentPosition(); - JS_ASSERT(cur_ <= end_); + MOZ_ASSERT(cur_ <= end_); } void reset() { @@ -823,7 +823,7 @@ class JitcodeIonTable } uint32_t regionOffset(uint32_t regionIndex) const { - JS_ASSERT(regionIndex < numRegions()); + MOZ_ASSERT(regionIndex < numRegions()); return regionOffsets_[regionIndex]; } @@ -836,7 +836,7 @@ class JitcodeIonTable } bool regionContainsOffset(uint32_t regionIndex, uint32_t nativeOffset) { - JS_ASSERT(regionIndex < numRegions()); + MOZ_ASSERT(regionIndex < numRegions()); JitcodeRegionEntry ent = regionEntry(regionIndex); if (nativeOffset < ent.nativeOffset()) diff --git a/js/src/jit/LIR-Common.h b/js/src/jit/LIR-Common.h index 067dac9e7c2f..dadc3dd389f0 100644 --- a/js/src/jit/LIR-Common.h +++ b/js/src/jit/LIR-Common.h @@ -56,7 +56,7 @@ class LOsiPoint : public LInstructionHelper<0, 0, 0> LOsiPoint(LSafepoint *safepoint, LSnapshot *snapshot) : safepoint_(safepoint) { - JS_ASSERT(safepoint && snapshot); + MOZ_ASSERT(safepoint && snapshot); assignSnapshot(snapshot); } @@ -420,7 +420,7 @@ class LPointer : public LInstructionHelper<1, 0, 0> } gc::Cell *gcptr() const { - JS_ASSERT(kind() == GC_THING); + MOZ_ASSERT(kind() == GC_THING); return (gc::Cell *) ptr_; } }; @@ -1412,7 +1412,7 @@ class LJSCallInstructionHelper : public LCallInstructionHelpernumStackArgs() >= 1); + MOZ_ASSERT(mir()->numStackArgs() >= 1); return mir()->numStackArgs() - 1; // |this| is not a formal argument. } // Does not include |this|. @@ -3404,11 +3404,11 @@ class LValueToInt32 : public LInstructionHelper<1, BOX_PIECES, 2> return getTemp(1); } MToInt32 *mirNormal() const { - JS_ASSERT(mode_ == NORMAL); + MOZ_ASSERT(mode_ == NORMAL); return mir_->toToInt32(); } MTruncateToInt32 *mirTruncate() const { - JS_ASSERT(mode_ == TRUNCATE); + MOZ_ASSERT(mode_ == TRUNCATE); return mir_->toTruncateToInt32(); } MInstruction *mir() const { @@ -6056,22 +6056,22 @@ class LPhi MOZ_FINAL : public LInstruction return 1; } LDefinition *getDef(size_t index) { - JS_ASSERT(index == 0); + MOZ_ASSERT(index == 0); return &def_; } void setDef(size_t index, const LDefinition &def) { - JS_ASSERT(index == 0); + MOZ_ASSERT(index == 0); def_ = def; } size_t numOperands() const { return mir_->toPhi()->numOperands(); } LAllocation *getOperand(size_t index) { - JS_ASSERT(index < numOperands()); + MOZ_ASSERT(index < numOperands()); return &inputs_[index]; } void setOperand(size_t index, const LAllocation &a) { - JS_ASSERT(index < numOperands()); + MOZ_ASSERT(index < numOperands()); inputs_[index] = a; } size_t numTemps() const { @@ -6388,23 +6388,23 @@ class LAsmJSCall MOZ_FINAL : public LInstruction return def_.isBogusTemp() ? 0 : 1; } LDefinition *getDef(size_t index) { - JS_ASSERT(numDefs() == 1); - JS_ASSERT(index == 0); + MOZ_ASSERT(numDefs() == 1); + MOZ_ASSERT(index == 0); return &def_; } void setDef(size_t index, const LDefinition &def) { - JS_ASSERT(index == 0); + MOZ_ASSERT(index == 0); def_ = def; } size_t numOperands() const { return numOperands_; } LAllocation *getOperand(size_t index) { - JS_ASSERT(index < numOperands_); + MOZ_ASSERT(index < numOperands_); return &operands_[index]; } void setOperand(size_t index, const LAllocation &a) { - JS_ASSERT(index < numOperands_); + MOZ_ASSERT(index < numOperands_); operands_[index] = a; } size_t numTemps() const { diff --git a/js/src/jit/LIR.cpp b/js/src/jit/LIR.cpp index bad572f792ab..56be77f7891f 100644 --- a/js/src/jit/LIR.cpp +++ b/js/src/jit/LIR.cpp @@ -35,7 +35,7 @@ LIRGraph::LIRGraph(MIRGraph *mir) bool LIRGraph::addConstantToPool(const Value &v, uint32_t *index) { - JS_ASSERT(constantPoolMap_.initialized()); + MOZ_ASSERT(constantPoolMap_.initialized()); ConstantPoolMap::AddPtr p = constantPoolMap_.lookupForAdd(v); if (p) { @@ -128,10 +128,10 @@ uint32_t LBlock::lastId() const { LInstruction *last = *instructions_.rbegin(); - JS_ASSERT(last->id()); + MOZ_ASSERT(last->id()); // The last instruction is a control flow instruction which does not have // any output. - JS_ASSERT(last->numDefs() == 0); + MOZ_ASSERT(last->numDefs() == 0); return last->id(); } @@ -473,7 +473,7 @@ LInstruction::printOperands(FILE *fp) void LInstruction::assignSnapshot(LSnapshot *snapshot) { - JS_ASSERT(!snapshot_); + MOZ_ASSERT(!snapshot_); snapshot_ = snapshot; #ifdef DEBUG @@ -534,9 +534,9 @@ LInstruction::dump() void LInstruction::initSafepoint(TempAllocator &alloc) { - JS_ASSERT(!safepoint_); + MOZ_ASSERT(!safepoint_); safepoint_ = new(alloc) LSafepoint(alloc); - JS_ASSERT(safepoint_); + MOZ_ASSERT(safepoint_); } bool diff --git a/js/src/jit/LIR.h b/js/src/jit/LIR.h index d80ddc0018d3..ac36cbef8f9a 100644 --- a/js/src/jit/LIR.h +++ b/js/src/jit/LIR.h @@ -85,12 +85,12 @@ class LAllocation : public TempObject return uint32_t(bits_) >> DATA_SHIFT; } void setData(uint32_t data) { - JS_ASSERT(data <= DATA_MASK); + MOZ_ASSERT(data <= DATA_MASK); bits_ &= ~(DATA_MASK << DATA_SHIFT); bits_ |= (data << DATA_SHIFT); } void setKindAndData(Kind kind, uint32_t data) { - JS_ASSERT(data <= DATA_MASK); + MOZ_ASSERT(data <= DATA_MASK); bits_ = (uint32_t(kind) << KIND_SHIFT) | data << DATA_SHIFT; } @@ -104,7 +104,7 @@ class LAllocation : public TempObject public: LAllocation() : bits_(0) { - JS_ASSERT(isBogus()); + MOZ_ASSERT(isBogus()); } static LAllocation *New(TempAllocator &alloc) { @@ -117,9 +117,9 @@ class LAllocation : public TempObject // The value pointer must be rooted in MIR and have its low bits cleared. explicit LAllocation(const Value *vp) { - JS_ASSERT(vp); + MOZ_ASSERT(vp); bits_ = uintptr_t(vp); - JS_ASSERT((bits_ & (KIND_MASK << KIND_SHIFT)) == 0); + MOZ_ASSERT((bits_ & (KIND_MASK << KIND_SHIFT)) == 0); bits_ |= CONSTANT_VALUE << KIND_SHIFT; } inline explicit LAllocation(AnyRegister reg); @@ -174,7 +174,7 @@ class LAllocation : public TempObject inline AnyRegister toRegister() const; const Value *toConstant() const { - JS_ASSERT(isConstantValue()); + MOZ_ASSERT(isConstantValue()); return reinterpret_cast(bits_ & ~(KIND_MASK << KIND_SHIFT)); } @@ -273,7 +273,7 @@ class LUse : public LAllocation } void setVirtualRegister(uint32_t index) { - JS_ASSERT(index < VREG_MASK); + MOZ_ASSERT(index < VREG_MASK); uint32_t old = data() & ~(VREG_MASK << VREG_SHIFT); setData(old | (index << VREG_SHIFT)); @@ -285,11 +285,11 @@ class LUse : public LAllocation } uint32_t virtualRegister() const { uint32_t index = (data() >> VREG_SHIFT) & VREG_MASK; - JS_ASSERT(index != 0); + MOZ_ASSERT(index != 0); return index; } uint32_t registerCode() const { - JS_ASSERT(policy() == FIXED); + MOZ_ASSERT(policy() == FIXED); return (data() >> REG_SHIFT) & REG_MASK; } bool isFixedRegister() const { @@ -465,7 +465,7 @@ class LDefinition LDefinition() : bits_(0) { - JS_ASSERT(isBogusTemp()); + MOZ_ASSERT(isBogusTemp()); } static LDefinition BogusTemp() { @@ -508,7 +508,7 @@ class LDefinition } uint32_t virtualRegister() const { uint32_t index = (bits_ >> VREG_SHIFT) & VREG_MASK; - //JS_ASSERT(index != 0); + //MOZ_ASSERT(index != 0); return index; } LAllocation *output() { @@ -524,7 +524,7 @@ class LDefinition return isFixed() && output()->isBogus(); } void setVirtualRegister(uint32_t index) { - JS_ASSERT(index < VREG_MASK); + MOZ_ASSERT(index < VREG_MASK); bits_ &= ~(VREG_MASK << VREG_SHIFT); bits_ |= index << VREG_SHIFT; } @@ -539,7 +539,7 @@ class LDefinition output_ = LConstantIndex::FromIndex(operand); } uint32_t getReusedInput() const { - JS_ASSERT(policy() == LDefinition::MUST_REUSE_INPUT); + MOZ_ASSERT(policy() == LDefinition::MUST_REUSE_INPUT); return output_.toConstantIndex()->index(); } @@ -680,8 +680,8 @@ class LInstruction return id_; } void setId(uint32_t id) { - JS_ASSERT(!id_); - JS_ASSERT(id); + MOZ_ASSERT(!id_); + MOZ_ASSERT(id); id_ = id; } LSnapshot *snapshot() const { @@ -820,7 +820,7 @@ class LBlock : public TempObject instructions_.insertAfter(at, ins); } void insertBefore(LInstruction *at, LInstruction *ins) { - JS_ASSERT(!at->isLabel()); + MOZ_ASSERT(!at->isLabel()); instructions_.insertBefore(at, ins); } uint32_t firstId() const; @@ -828,7 +828,7 @@ class LBlock : public TempObject // Return the label to branch to when branching to this block. Label *label() { - JS_ASSERT(!isTrivial()); + MOZ_ASSERT(!isTrivial()); return &label_; } @@ -889,20 +889,20 @@ class LInstructionHelper : public LInstruction return 0; } MBasicBlock *getSuccessor(size_t i) const { - JS_ASSERT(false); + MOZ_ASSERT(false); return nullptr; } void setSuccessor(size_t i, MBasicBlock *successor) { - JS_ASSERT(false); + MOZ_ASSERT(false); } // Default accessors, assuming a single input and output, respectively. const LAllocation *input() { - JS_ASSERT(numOperands() == 1); + MOZ_ASSERT(numOperands() == 1); return getOperand(0); } const LDefinition *output() { - JS_ASSERT(numDefs() == 1); + MOZ_ASSERT(numDefs() == 1); return getDef(0); } @@ -952,7 +952,7 @@ class LRecoverInfo : public TempObject return recoverOffset_; } void setRecoverOffset(RecoverOffset offset) { - JS_ASSERT(recoverOffset_ == INVALID_RECOVER_OFFSET); + MOZ_ASSERT(recoverOffset_ == INVALID_RECOVER_OFFSET); recoverOffset_ = offset; } @@ -1044,23 +1044,23 @@ class LSnapshot : public TempObject return numSlots_ / BOX_PIECES; } LAllocation *payloadOfSlot(size_t i) { - JS_ASSERT(i < numSlots()); + MOZ_ASSERT(i < numSlots()); size_t entryIndex = (i * BOX_PIECES) + (BOX_PIECES - 1); return getEntry(entryIndex); } #ifdef JS_NUNBOX32 LAllocation *typeOfSlot(size_t i) { - JS_ASSERT(i < numSlots()); + MOZ_ASSERT(i < numSlots()); size_t entryIndex = (i * BOX_PIECES) + (BOX_PIECES - 2); return getEntry(entryIndex); } #endif LAllocation *getEntry(size_t i) { - JS_ASSERT(i < numSlots_); + MOZ_ASSERT(i < numSlots_); return &slots_[i]; } void setEntry(size_t i, const LAllocation &alloc) { - JS_ASSERT(i < numSlots_); + MOZ_ASSERT(i < numSlots_); slots_[i] = alloc; } LRecoverInfo *recoverInfo() const { @@ -1076,11 +1076,11 @@ class LSnapshot : public TempObject return bailoutId_; } void setSnapshotOffset(SnapshotOffset offset) { - JS_ASSERT(snapshotOffset_ == INVALID_SNAPSHOT_OFFSET); + MOZ_ASSERT(snapshotOffset_ == INVALID_SNAPSHOT_OFFSET); snapshotOffset_ = offset; } void setBailoutId(BailoutId id) { - JS_ASSERT(bailoutId_ == INVALID_BAILOUT_ID); + MOZ_ASSERT(bailoutId_ == INVALID_BAILOUT_ID); bailoutId_ = id; } BailoutKind bailoutKind() const { @@ -1169,9 +1169,9 @@ class LSafepoint : public TempObject void assertInvariants() { // Every register in valueRegs and gcRegs should also be in liveRegs. #ifndef JS_NUNBOX32 - JS_ASSERT((valueRegs().bits() & ~liveRegs().gprs().bits()) == 0); + MOZ_ASSERT((valueRegs().bits() & ~liveRegs().gprs().bits()) == 0); #endif - JS_ASSERT((gcRegs().bits() & ~liveRegs().gprs().bits()) == 0); + MOZ_ASSERT((gcRegs().bits() & ~liveRegs().gprs().bits()) == 0); } explicit LSafepoint(TempAllocator &alloc) @@ -1239,7 +1239,7 @@ class LSafepoint : public TempObject bool addSlotsOrElementsPointer(LAllocation alloc) { if (alloc.isStackSlot()) return addSlotsOrElementsSlot(alloc.toStackSlot()->slot()); - JS_ASSERT(alloc.isRegister()); + MOZ_ASSERT(alloc.isRegister()); addSlotsOrElementsRegister(alloc.toRegister().gpr()); assertInvariants(); return true; @@ -1276,7 +1276,7 @@ class LSafepoint : public TempObject } return false; } - JS_ASSERT(alloc.isArgument()); + MOZ_ASSERT(alloc.isArgument()); return true; } @@ -1404,7 +1404,7 @@ class LSafepoint : public TempObject } return addValueSlot(slot); } - JS_ASSERT(alloc.isArgument()); + MOZ_ASSERT(alloc.isArgument()); return true; } @@ -1413,7 +1413,7 @@ class LSafepoint : public TempObject return valueRegs().has(alloc.toRegister().gpr()); if (alloc.isStackSlot()) return hasValueSlot(alloc.toStackSlot()->slot()); - JS_ASSERT(alloc.isArgument()); + MOZ_ASSERT(alloc.isArgument()); return true; } @@ -1423,7 +1423,7 @@ class LSafepoint : public TempObject return safepointOffset_ != INVALID_SAFEPOINT_OFFSET; } uint32_t offset() const { - JS_ASSERT(encoded()); + MOZ_ASSERT(encoded()); return safepointOffset_; } void setOffset(uint32_t offset) { @@ -1439,7 +1439,7 @@ class LSafepoint : public TempObject return osiCallPointOffset_; } void setOsiCallPointOffset(uint32_t osiCallPointOffset) { - JS_ASSERT(!osiCallPointOffset_); + MOZ_ASSERT(!osiCallPointOffset_); osiCallPointOffset_ = osiCallPointOffset; } void fixupOffset(MacroAssembler *masm) { @@ -1486,7 +1486,7 @@ public: } void next() { - JS_ASSERT(more()); + MOZ_ASSERT(more()); idx_++; handleOperandsEnd(); } @@ -1616,13 +1616,13 @@ class LIRGraph return &constantPool_[0]; } void setEntrySnapshot(LSnapshot *snapshot) { - JS_ASSERT(!entrySnapshot_); - JS_ASSERT(snapshot->bailoutKind() == Bailout_InitialState); + MOZ_ASSERT(!entrySnapshot_); + MOZ_ASSERT(snapshot->bailoutKind() == Bailout_InitialState); snapshot->setBailoutKind(Bailout_ArgumentCheck); entrySnapshot_ = snapshot; } LSnapshot *entrySnapshot() const { - JS_ASSERT(entrySnapshot_); + MOZ_ASSERT(entrySnapshot_); return entrySnapshot_; } bool noteNeedsSafepoint(LInstruction *ins); @@ -1654,7 +1654,7 @@ LAllocation::LAllocation(AnyRegister reg) AnyRegister LAllocation::toRegister() const { - JS_ASSERT(isRegister()); + MOZ_ASSERT(isRegister()); if (isFloatReg()) return AnyRegister(toFloatReg()->reg()); return AnyRegister(toGeneralReg()->reg()); @@ -1698,7 +1698,7 @@ namespace jit { #define LIROP(name) \ L##name *LInstruction::to##name() \ { \ - JS_ASSERT(is##name()); \ + MOZ_ASSERT(is##name()); \ return static_cast(this); \ } LIR_OPCODE_LIST(LIROP) @@ -1706,12 +1706,12 @@ namespace jit { #define LALLOC_CAST(type) \ L##type *LAllocation::to##type() { \ - JS_ASSERT(is##type()); \ + MOZ_ASSERT(is##type()); \ return static_cast(this); \ } #define LALLOC_CONST_CAST(type) \ const L##type *LAllocation::to##type() const { \ - JS_ASSERT(is##type()); \ + MOZ_ASSERT(is##type()); \ return static_cast(this); \ } @@ -1729,7 +1729,7 @@ LALLOC_CONST_CAST(ConstantIndex) static inline signed OffsetToOtherHalfOfNunbox(LDefinition::Type type) { - JS_ASSERT(type == LDefinition::TYPE || type == LDefinition::PAYLOAD); + MOZ_ASSERT(type == LDefinition::TYPE || type == LDefinition::PAYLOAD); signed offset = (type == LDefinition::TYPE) ? PAYLOAD_INDEX - TYPE_INDEX : TYPE_INDEX - PAYLOAD_INDEX; @@ -1739,8 +1739,8 @@ OffsetToOtherHalfOfNunbox(LDefinition::Type type) static inline void AssertTypesFormANunbox(LDefinition::Type type1, LDefinition::Type type2) { - JS_ASSERT((type1 == LDefinition::TYPE && type2 == LDefinition::PAYLOAD) || - (type2 == LDefinition::TYPE && type1 == LDefinition::PAYLOAD)); + MOZ_ASSERT((type1 == LDefinition::TYPE && type2 == LDefinition::PAYLOAD) || + (type2 == LDefinition::TYPE && type1 == LDefinition::PAYLOAD)); } static inline unsigned diff --git a/js/src/jit/Label.h b/js/src/jit/Label.h index 2a6cbcd62de0..f0cf0233f268 100644 --- a/js/src/jit/Label.h +++ b/js/src/jit/Label.h @@ -34,7 +34,7 @@ struct LabelBase return bound_; } int32_t offset() const { - JS_ASSERT(bound() || used()); + MOZ_ASSERT(bound() || used()); return offset_; } // Returns whether the label is not bound, but has incoming uses. @@ -43,10 +43,10 @@ struct LabelBase } // Binds the label, fixing its final position in the code stream. void bind(int32_t offset) { - JS_ASSERT(!bound()); + MOZ_ASSERT(!bound()); offset_ = offset; bound_ = true; - JS_ASSERT(offset_ == offset); + MOZ_ASSERT(offset_ == offset); } // Marks the label as neither bound nor used. void reset() { @@ -56,11 +56,11 @@ struct LabelBase // Sets the label's latest used position, returning the old use position in // the process. int32_t use(int32_t offset) { - JS_ASSERT(!bound()); + MOZ_ASSERT(!bound()); int32_t old = offset_; offset_ = offset; - JS_ASSERT(offset_ == offset); + MOZ_ASSERT(offset_ == offset); return old; } diff --git a/js/src/jit/LinearScan.cpp b/js/src/jit/LinearScan.cpp index ce152c1d94fe..734ffd763e37 100644 --- a/js/src/jit/LinearScan.cpp +++ b/js/src/jit/LinearScan.cpp @@ -84,8 +84,8 @@ LinearScanAllocator::allocateRegisters() // Iterate through all intervals in ascending start order. CodePosition prevPosition = CodePosition::MIN; while ((current = unhandled.dequeue()) != nullptr) { - JS_ASSERT(current->getAllocation()->isBogus()); - JS_ASSERT(current->numRanges() > 0); + MOZ_ASSERT(current->getAllocation()->isBogus()); + MOZ_ASSERT(current->numRanges() > 0); if (mir->shouldCancel("LSRA Allocate Registers (main loop)")) return false; @@ -100,12 +100,12 @@ LinearScanAllocator::allocateRegisters() // Shift active intervals to the inactive or handled sets as appropriate if (position != prevPosition) { - JS_ASSERT(position > prevPosition); + MOZ_ASSERT(position > prevPosition); prevPosition = position; for (IntervalIterator i(active.begin()); i != active.end(); ) { LiveInterval *it = *i; - JS_ASSERT(it->numRanges() > 0); + MOZ_ASSERT(it->numRanges() > 0); if (it->end() <= position) { i = active.removeAt(i); @@ -121,7 +121,7 @@ LinearScanAllocator::allocateRegisters() // Shift inactive intervals to the active or handled sets as appropriate for (IntervalIterator i(inactive.begin()); i != inactive.end(); ) { LiveInterval *it = *i; - JS_ASSERT(it->numRanges() > 0); + MOZ_ASSERT(it->numRanges() > 0); if (it->end() <= position) { i = inactive.removeAt(i); @@ -140,7 +140,7 @@ LinearScanAllocator::allocateRegisters() // If the interval has a hard requirement, grant it. if (req->kind() == Requirement::FIXED) { - JS_ASSERT(!req->allocation().isRegister()); + MOZ_ASSERT(!req->allocation().isRegister()); if (!assign(req->allocation())) return false; continue; @@ -196,7 +196,7 @@ LinearScanAllocator::allocateRegisters() } JitSpew(JitSpew_RegAlloc, " No registers available to spill"); - JS_ASSERT(req->kind() == Requirement::NONE); + MOZ_ASSERT(req->kind() == Requirement::NONE); if (!spill()) return false; @@ -232,19 +232,19 @@ LinearScanAllocator::resolveControlFlow() // Resolve phis to moves for (size_t j = 0; j < successor->numPhis(); j++) { LPhi *phi = successor->getPhi(j); - JS_ASSERT(phi->numDefs() == 1); + MOZ_ASSERT(phi->numDefs() == 1); LDefinition *def = phi->getDef(0); LinearScanVirtualRegister *vreg = &vregs[def]; LiveInterval *to = vreg->intervalFor(entryOf(successor)); - JS_ASSERT(to); + MOZ_ASSERT(to); for (size_t k = 0; k < mSuccessor->numPredecessors(); k++) { LBlock *predecessor = mSuccessor->getPredecessor(k)->lir(); - JS_ASSERT(predecessor->mir()->numSuccessors() == 1); + MOZ_ASSERT(predecessor->mir()->numSuccessors() == 1); LAllocation *input = phi->getOperand(k); LiveInterval *from = vregs[input].intervalFor(exitOf(predecessor)); - JS_ASSERT(from); + MOZ_ASSERT(from); if (!moveAtExit(predecessor, from, to, def->type())) return false; @@ -265,12 +265,12 @@ LinearScanAllocator::resolveControlFlow() for (BitSet::Iterator liveRegId(*live); liveRegId; liveRegId++) { LinearScanVirtualRegister *vreg = &vregs[*liveRegId]; LiveInterval *to = vreg->intervalFor(entryOf(successor)); - JS_ASSERT(to); + MOZ_ASSERT(to); for (size_t j = 0; j < mSuccessor->numPredecessors(); j++) { LBlock *predecessor = mSuccessor->getPredecessor(j)->lir(); LiveInterval *from = vregs[*liveRegId].intervalFor(exitOf(predecessor)); - JS_ASSERT(from); + MOZ_ASSERT(from); if (*from->getAllocation() == *to->getAllocation()) continue; @@ -278,13 +278,13 @@ LinearScanAllocator::resolveControlFlow() // If this value is spilled at its definition, other stores // are redundant. if (vreg->mustSpillAtDefinition() && to->getAllocation()->isStackSlot()) { - JS_ASSERT(vreg->canonicalSpill()); - JS_ASSERT(*vreg->canonicalSpill() == *to->getAllocation()); + MOZ_ASSERT(vreg->canonicalSpill()); + MOZ_ASSERT(*vreg->canonicalSpill() == *to->getAllocation()); continue; } if (mSuccessor->numPredecessors() > 1) { - JS_ASSERT(predecessor->mir()->numSuccessors() == 1); + MOZ_ASSERT(predecessor->mir()->numSuccessors() == 1); if (!moveAtExit(predecessor, from, to, vreg->type())) return false; } else { @@ -315,7 +315,7 @@ SetOsiPointUses(LiveInterval *interval, CodePosition defEnd, const LAllocation & // any OsiPoint uses of this interval to the allocation of the value // before the move. - JS_ASSERT(interval->index() == 0); + MOZ_ASSERT(interval->index() == 0); for (UsePositionIterator usePos(interval->usesBegin()); usePos != interval->usesEnd(); @@ -343,7 +343,7 @@ LinearScanAllocator::reifyAllocations() for (size_t k = 0; k < reg->numIntervals(); k++) { LiveInterval *interval = reg->getInterval(k); - JS_ASSERT(reg == &vregs[interval->vreg()]); + MOZ_ASSERT(reg == &vregs[interval->vreg()]); if (!interval->numRanges()) continue; @@ -356,7 +356,7 @@ LinearScanAllocator::reifyAllocations() if (!moveInput(usePos->pos, interval, to, reg->type())) return false; } else { - JS_ASSERT(UseCompatibleWith(usePos->use, *interval->getAllocation())); + MOZ_ASSERT(UseCompatibleWith(usePos->use, *interval->getAllocation())); *static_cast(usePos->use) = *interval->getAllocation(); } } @@ -387,14 +387,14 @@ LinearScanAllocator::reifyAllocations() LAllocation *inputAlloc = reg->ins()->getOperand(def->getReusedInput()); LAllocation *origAlloc = LAllocation::New(alloc(), *inputAlloc); - JS_ASSERT(!inputAlloc->isUse()); + MOZ_ASSERT(!inputAlloc->isUse()); *inputAlloc = *interval->getAllocation(); if (!moveInputAlloc(inputOf(reg->ins()), origAlloc, inputAlloc, def->type())) return false; } - JS_ASSERT(DefinitionCompatibleWith(reg->ins(), def, *interval->getAllocation())); + MOZ_ASSERT(DefinitionCompatibleWith(reg->ins(), def, *interval->getAllocation())); def->setOutput(*interval->getAllocation()); spillFrom = interval->getAllocation(); @@ -443,7 +443,7 @@ LinearScanAllocator::reifyAllocations() CodePosition start = interval->start(); InstructionData *data = &insData[start]; - JS_ASSERT(start == inputOf(data->ins()) || start == outputOf(data->ins())); + MOZ_ASSERT(start == inputOf(data->ins()) || start == outputOf(data->ins())); if (start.subpos() == CodePosition::INPUT) { if (!moveInput(inputOf(data->ins()), prevInterval, interval, reg->type())) @@ -478,7 +478,7 @@ LinearScanAllocator::isSpilledAt(LiveInterval *interval, CodePosition pos) return false; if (reg->mustSpillAtDefinition()) { - JS_ASSERT(reg->spillPosition() <= pos); + MOZ_ASSERT(reg->spillPosition() <= pos); return true; } @@ -541,7 +541,7 @@ LinearScanAllocator::populateSafepoints() return false; } } else if (!IsNunbox(reg)) { - JS_ASSERT(IsTraceable(reg)); + MOZ_ASSERT(IsTraceable(reg)); LiveInterval *interval = reg->intervalFor(inputOf(ins)); if (!interval) @@ -631,7 +631,7 @@ LinearScanAllocator::populateSafepoints() if (IsNunbox(reg)) { // Skip past the next half of this nunbox so we don't track the // same slot twice. - JS_ASSERT(&vregs[reg->def()->virtualRegister() + 1] == otherHalfOfNunbox(reg)); + MOZ_ASSERT(&vregs[reg->def()->virtualRegister() + 1] == otherHalfOfNunbox(reg)); i++; } #endif @@ -649,20 +649,20 @@ LinearScanAllocator::splitInterval(LiveInterval *interval, CodePosition pos) { // Make sure we're actually splitting this interval, not some other // interval in the same virtual register. - JS_ASSERT(interval->start() < pos && pos < interval->end()); + MOZ_ASSERT(interval->start() < pos && pos < interval->end()); LinearScanVirtualRegister *reg = &vregs[interval->vreg()]; // "Bogus" intervals cannot be split. - JS_ASSERT(reg); + MOZ_ASSERT(reg); // Do the split. LiveInterval *newInterval = LiveInterval::New(alloc(), interval->vreg(), interval->index() + 1); if (!interval->splitFrom(pos, newInterval)) return false; - JS_ASSERT(interval->numRanges() > 0); - JS_ASSERT(newInterval->numRanges() > 0); + MOZ_ASSERT(interval->numRanges() > 0); + MOZ_ASSERT(newInterval->numRanges() > 0); if (!reg->addInterval(newInterval)) return false; @@ -694,8 +694,8 @@ LinearScanAllocator::splitBlockingIntervals(AnyRegister allocatedReg) if (fixed->numRanges() > 0) { CodePosition fixedPos = current->intersect(fixed); if (fixedPos != CodePosition::MIN) { - JS_ASSERT(fixedPos > current->start()); - JS_ASSERT(fixedPos < current->end()); + MOZ_ASSERT(fixedPos > current->start()); + MOZ_ASSERT(fixedPos < current->end()); if (!splitInterval(current, fixedPos)) return false; } @@ -710,9 +710,9 @@ LinearScanAllocator::splitBlockingIntervals(AnyRegister allocatedReg) JitSpew(JitSpew_RegAlloc, " Splitting active interval %u = [%u, %u]", vregs[i->vreg()].ins()->id(), i->start().bits(), i->end().bits()); - JS_ASSERT(i->start() != current->start()); - JS_ASSERT(i->covers(current->start())); - JS_ASSERT(i->start() != current->start()); + MOZ_ASSERT(i->start() != current->start()); + MOZ_ASSERT(i->covers(current->start())); + MOZ_ASSERT(i->start() != current->start()); if (!splitInterval(*i, current->start())) return false; @@ -738,7 +738,7 @@ LinearScanAllocator::splitBlockingIntervals(AnyRegister allocatedReg) LiveInterval *it = *i; CodePosition nextActive = it->nextCoveredAfter(current->start()); - JS_ASSERT(nextActive != CodePosition::MIN); + MOZ_ASSERT(nextActive != CodePosition::MIN); if (!splitInterval(it, nextActive)) return false; @@ -772,7 +772,7 @@ LinearScanAllocator::assign(LAllocation allocation) // part of the second half of the interval and guarantees we never split // at the end (zero-length intervals are invalid). splitPos = splitPos.previous(); - JS_ASSERT (splitPos < current->end()); + MOZ_ASSERT(splitPos < current->end()); if (!splitInterval(current, splitPos)) return false; } @@ -786,7 +786,7 @@ LinearScanAllocator::assign(LAllocation allocation) if (reg && useAsCanonicalSpillSlot) { if (reg->canonicalSpill()) { - JS_ASSERT(allocation == *reg->canonicalSpill()); + MOZ_ASSERT(allocation == *reg->canonicalSpill()); // This interval is spilled more than once, so just always spill // it at its definition. @@ -865,7 +865,7 @@ LinearScanAllocator::spill() JitSpew(JitSpew_RegAlloc, " Decided to spill current interval"); // We can't spill bogus intervals - JS_ASSERT(current->hasVreg()); + MOZ_ASSERT(current->hasVreg()); LinearScanVirtualRegister *reg = &vregs[current->vreg()]; @@ -884,7 +884,7 @@ LinearScanAllocator::spill() // The other half of this nunbox already has a spill slot. To // ensure the Value is spilled contiguously, use the other half (it // was allocated double-wide). - JS_ASSERT(other->canonicalSpill()->isStackSlot()); + MOZ_ASSERT(other->canonicalSpill()->isStackSlot()); stackSlot = BaseOfNunboxSlot(other->type(), other->canonicalSpillSlot()); } else { // No canonical spill location exists for this nunbox yet. Allocate @@ -897,7 +897,7 @@ LinearScanAllocator::spill() { stackSlot = allocateSlotFor(current); } - JS_ASSERT(stackSlot <= stackSlotAllocator.stackHeight()); + MOZ_ASSERT(stackSlot <= stackSlotAllocator.stackHeight()); return assign(LStackSlot(stackSlot)); } @@ -950,7 +950,7 @@ void LinearScanAllocator::finishInterval(LiveInterval *interval) { LAllocation *alloc = interval->getAllocation(); - JS_ASSERT(!alloc->isUse()); + MOZ_ASSERT(!alloc->isUse()); // Toss out the bogus interval now that it's run its course if (!interval->hasVreg()) @@ -1218,38 +1218,38 @@ LinearScanAllocator::validateIntervals() return; for (IntervalIterator i(active.begin()); i != active.end(); i++) { - JS_ASSERT(i->numRanges() > 0); - JS_ASSERT(i->covers(current->start())); + MOZ_ASSERT(i->numRanges() > 0); + MOZ_ASSERT(i->covers(current->start())); for (IntervalIterator j(active.begin()); j != i; j++) - JS_ASSERT(canCoexist(*i, *j)); + MOZ_ASSERT(canCoexist(*i, *j)); } for (IntervalIterator i(inactive.begin()); i != inactive.end(); i++) { - JS_ASSERT(i->numRanges() > 0); - JS_ASSERT(i->end() >= current->start()); - JS_ASSERT(!i->covers(current->start())); + MOZ_ASSERT(i->numRanges() > 0); + MOZ_ASSERT(i->end() >= current->start()); + MOZ_ASSERT(!i->covers(current->start())); for (IntervalIterator j(active.begin()); j != active.end(); j++) { - JS_ASSERT(*i != *j); - JS_ASSERT(canCoexist(*i, *j)); + MOZ_ASSERT(*i != *j); + MOZ_ASSERT(canCoexist(*i, *j)); } for (IntervalIterator j(inactive.begin()); j != i; j++) - JS_ASSERT(canCoexist(*i, *j)); + MOZ_ASSERT(canCoexist(*i, *j)); } for (IntervalIterator i(handled.begin()); i != handled.end(); i++) { - JS_ASSERT(!i->getAllocation()->isUse()); - JS_ASSERT(i->numRanges() > 0); + MOZ_ASSERT(!i->getAllocation()->isUse()); + MOZ_ASSERT(i->numRanges() > 0); if (i->getAllocation()->isRegister()) { - JS_ASSERT(i->end() <= current->start()); - JS_ASSERT(!i->covers(current->start())); + MOZ_ASSERT(i->end() <= current->start()); + MOZ_ASSERT(!i->covers(current->start())); } for (IntervalIterator j(active.begin()); j != active.end(); j++) - JS_ASSERT(*i != *j); + MOZ_ASSERT(*i != *j); for (IntervalIterator j(inactive.begin()); j != inactive.end(); j++) - JS_ASSERT(*i != *j); + MOZ_ASSERT(*i != *j); } } @@ -1265,19 +1265,19 @@ LinearScanAllocator::validateAllocations() for (IntervalIterator i(handled.begin()); i != handled.end(); i++) { for (IntervalIterator j(handled.begin()); j != i; j++) { - JS_ASSERT(*i != *j); - JS_ASSERT(canCoexist(*i, *j)); + MOZ_ASSERT(*i != *j); + MOZ_ASSERT(canCoexist(*i, *j)); } LinearScanVirtualRegister *reg = &vregs[i->vreg()]; bool found = false; for (size_t j = 0; j < reg->numIntervals(); j++) { if (reg->getInterval(j) == *i) { - JS_ASSERT(j == i->index()); + MOZ_ASSERT(j == i->index()); found = true; break; } } - JS_ASSERT(found); + MOZ_ASSERT(found); } } @@ -1339,8 +1339,8 @@ LinearScanAllocator::go() void LinearScanAllocator::setIntervalRequirement(LiveInterval *interval) { - JS_ASSERT(interval->requirement()->kind() == Requirement::NONE); - JS_ASSERT(interval->hint()->kind() == Requirement::NONE); + MOZ_ASSERT(interval->requirement()->kind() == Requirement::NONE); + MOZ_ASSERT(interval->hint()->kind() == Requirement::NONE); // This function computes requirement by virtual register, other types of // interval should have requirements set manually @@ -1482,7 +1482,7 @@ LinearScanAllocator::UnhandledQueue::assertSorted() LiveInterval *prev = nullptr; for (IntervalIterator i(begin()); i != end(); i++) { if (prev) { - JS_ASSERT(prev->start() >= i->start()); + MOZ_ASSERT(prev->start() >= i->start()); JS_ASSERT_IF(prev->start() == i->start(), prev->requirement()->priority() >= i->requirement()->priority()); } diff --git a/js/src/jit/LiveRangeAllocator.cpp b/js/src/jit/LiveRangeAllocator.cpp index 1033dad329a3..55657650bc7c 100644 --- a/js/src/jit/LiveRangeAllocator.cpp +++ b/js/src/jit/LiveRangeAllocator.cpp @@ -93,7 +93,7 @@ LiveInterval::Range::contains(const Range *other) const void LiveInterval::Range::intersect(const Range *other, Range *pre, Range *inside, Range *post) const { - JS_ASSERT(pre->empty() && inside->empty() && post->empty()); + MOZ_ASSERT(pre->empty() && inside->empty() && post->empty()); CodePosition innerFrom = from; if (from < other->from) { @@ -149,8 +149,8 @@ LiveInterval::Range::dump() const bool LiveInterval::addRangeAtHead(CodePosition from, CodePosition to) { - JS_ASSERT(from < to); - JS_ASSERT(ranges_.empty() || from <= ranges_.back().from); + MOZ_ASSERT(from < to); + MOZ_ASSERT(ranges_.empty() || from <= ranges_.back().from); Range newRange(from, to); @@ -166,8 +166,8 @@ LiveInterval::addRangeAtHead(CodePosition from, CodePosition to) return true; } - JS_ASSERT(from < first.to); - JS_ASSERT(to > first.from); + MOZ_ASSERT(from < first.to); + MOZ_ASSERT(to > first.from); if (from < first.from) first.from = from; if (to > first.to) @@ -179,7 +179,7 @@ LiveInterval::addRangeAtHead(CodePosition from, CodePosition to) bool LiveInterval::addRange(CodePosition from, CodePosition to) { - JS_ASSERT(from < to); + MOZ_ASSERT(from < to); Range newRange(from, to); @@ -309,8 +309,8 @@ LiveInterval::intersect(LiveInterval *other) bool LiveInterval::splitFrom(CodePosition pos, LiveInterval *after) { - JS_ASSERT(pos >= start() && pos < end()); - JS_ASSERT(after->ranges_.empty()); + MOZ_ASSERT(pos >= start() && pos < end()); + MOZ_ASSERT(after->ranges_.empty()); // Move all intervals over to the target size_t bufferLength = ranges_.length(); @@ -372,7 +372,7 @@ LiveInterval::addUse(UsePosition *use) void LiveInterval::addUseAtEnd(UsePosition *use) { - JS_ASSERT(uses_.empty() || use->pos >= uses_.back()->pos); + MOZ_ASSERT(uses_.empty() || use->pos >= uses_.back()->pos); uses_.pushBack(use); } @@ -382,7 +382,7 @@ LiveInterval::nextUseAfter(CodePosition after) for (UsePositionIterator usePos(usesBegin()); usePos != usesEnd(); usePos++) { if (usePos->pos >= after) { LUse::Policy policy = usePos->use->policy(); - JS_ASSERT(policy != LUse::RECOVERED_INPUT); + MOZ_ASSERT(policy != LUse::RECOVERED_INPUT); if (policy != LUse::KEEPALIVE) return *usePos; } @@ -441,7 +441,7 @@ VirtualRegister::intervalFor(CodePosition pos) LiveInterval * VirtualRegister::getFirstInterval() { - JS_ASSERT(!intervals_.empty()); + MOZ_ASSERT(!intervals_.empty()); return intervals_[0]; } @@ -555,11 +555,11 @@ AddRegisterToSafepoint(LSafepoint *safepoint, AnyRegister reg, const LDefinition { safepoint->addLiveRegister(reg); - JS_ASSERT(def.type() == LDefinition::GENERAL || - def.type() == LDefinition::INT32 || - def.type() == LDefinition::DOUBLE || - def.type() == LDefinition::FLOAT32 || - def.type() == LDefinition::OBJECT); + MOZ_ASSERT(def.type() == LDefinition::GENERAL || + def.type() == LDefinition::INT32 || + def.type() == LDefinition::DOUBLE || + def.type() == LDefinition::FLOAT32 || + def.type() == LDefinition::OBJECT); if (def.type() == LDefinition::OBJECT) safepoint->addGcRegister(reg.gpr()); @@ -685,7 +685,7 @@ LiveRangeAllocator::buildLivenessInfo() // special handling for this, assert the next instruction // has no fixed uses. defineFixed guarantees this by inserting // an LNop. - JS_ASSERT(!NextInstructionHasFixedUses(block, *ins)); + MOZ_ASSERT(!NextInstructionHasFixedUses(block, *ins)); AnyRegister reg = def->output()->toRegister(); if (!addFixedRangeAtHead(reg, inputOf(*ins), outputOf(*ins).next())) return false; @@ -701,8 +701,8 @@ LiveRangeAllocator::buildLivenessInfo() // LUse::ANY policy to avoid allocating a register for the // input. LUse *inputUse = ins->getOperand(def->getReusedInput())->toUse(); - JS_ASSERT(inputUse->policy() == LUse::REGISTER); - JS_ASSERT(inputUse->usedAtStart()); + MOZ_ASSERT(inputUse->policy() == LUse::REGISTER); + MOZ_ASSERT(inputUse->usedAtStart()); *inputUse = LUse(inputUse->virtualRegister(), LUse::ANY, /* usedAtStart = */ true); } @@ -736,7 +736,7 @@ LiveRangeAllocator::buildLivenessInfo() if (LSafepoint *safepoint = ins->safepoint()) AddRegisterToSafepoint(safepoint, reg, *temp); } else { - JS_ASSERT(!ins->isCall()); + MOZ_ASSERT(!ins->isCall()); if (!vregs[temp].getInterval(0)->addRangeAtHead(inputOf(*ins), outputOf(*ins))) return false; } @@ -787,7 +787,7 @@ LiveRangeAllocator::buildLivenessInfo() // so that we don't assign the same register. if (ins->isCall() && use->usedAtStart()) { for (size_t i = 0; i < ins->numTemps(); i++) - JS_ASSERT(vregs[ins->getTemp(i)].isFloatReg() != vregs[use].isFloatReg()); + MOZ_ASSERT(vregs[ins->getTemp(i)].isFloatReg() != vregs[use].isFloatReg()); } // If there are both useRegisterAtStart(x) and useRegister(y) @@ -801,7 +801,7 @@ LiveRangeAllocator::buildLivenessInfo() hasUseRegister = true; } } - JS_ASSERT(!(hasUseRegister && hasUseRegisterAtStart)); + MOZ_ASSERT(!(hasUseRegister && hasUseRegisterAtStart)); // LSRA has issues with *AtStart, see bug 1039993. JS_ASSERT_IF(forLSRA && hasUnaliasedDouble() && hasFloat32Def @@ -884,7 +884,7 @@ LiveRangeAllocator::buildLivenessInfo() MBasicBlock *loopBlock = mblock->backedge(); while (true) { // Blocks must already have been visited to have a liveIn set. - JS_ASSERT(loopBlock->id() >= mblock->id()); + MOZ_ASSERT(loopBlock->id() >= mblock->id()); // Add an interval for this entire loop block CodePosition from = entryOf(loopBlock->lir()); @@ -928,7 +928,7 @@ LiveRangeAllocator::buildLivenessInfo() // If end is reached without finding a non-OSR block, then no more work items were found. if (loopBlock == osrBlock) { - JS_ASSERT(loopWorkList.empty()); + MOZ_ASSERT(loopWorkList.empty()); break; } } @@ -971,7 +971,7 @@ LiveRangeAllocator::dumpVregs() { #ifdef DEBUG // Virtual register number 0 is unused. - JS_ASSERT(vregs[0u].numIntervals() == 0); + MOZ_ASSERT(vregs[0u].numIntervals() == 0); for (uint32_t i = 1; i < graph.numVirtualRegisters(); i++) { fprintf(stderr, " "); VirtualRegister &vreg = vregs[i]; @@ -997,7 +997,7 @@ LiveInterval::validateRanges() for (size_t i = ranges_.length() - 1; i < ranges_.length(); i--) { Range *range = &ranges_[i]; - JS_ASSERT(range->from < range->to); + MOZ_ASSERT(range->from < range->to); JS_ASSERT_IF(prev, prev->to <= range->from); prev = range; } diff --git a/js/src/jit/LiveRangeAllocator.h b/js/src/jit/LiveRangeAllocator.h index 1771a0f39ea7..f5480a9fc993 100644 --- a/js/src/jit/LiveRangeAllocator.h +++ b/js/src/jit/LiveRangeAllocator.h @@ -37,7 +37,7 @@ class Requirement : kind_(kind) { // These have dedicated constructors. - JS_ASSERT(kind != FIXED && kind != MUST_REUSE_INPUT); + MOZ_ASSERT(kind != FIXED && kind != MUST_REUSE_INPUT); } Requirement(Kind kind, CodePosition at) @@ -45,14 +45,14 @@ class Requirement position_(at) { // These have dedicated constructors. - JS_ASSERT(kind != FIXED && kind != MUST_REUSE_INPUT); + MOZ_ASSERT(kind != FIXED && kind != MUST_REUSE_INPUT); } explicit Requirement(LAllocation fixed) : kind_(FIXED), allocation_(fixed) { - JS_ASSERT(!fixed.isBogus() && !fixed.isUse()); + MOZ_ASSERT(!fixed.isBogus() && !fixed.isUse()); } // Only useful as a hint, encodes where the fixed requirement is used to @@ -62,7 +62,7 @@ class Requirement allocation_(fixed), position_(at) { - JS_ASSERT(!fixed.isBogus() && !fixed.isUse()); + MOZ_ASSERT(!fixed.isBogus() && !fixed.isUse()); } Requirement(uint32_t vreg, CodePosition at) @@ -76,13 +76,13 @@ class Requirement } LAllocation allocation() const { - JS_ASSERT(!allocation_.isBogus() && !allocation_.isUse()); + MOZ_ASSERT(!allocation_.isBogus() && !allocation_.isUse()); return allocation_; } uint32_t virtualRegister() const { - JS_ASSERT(allocation_.isUse()); - JS_ASSERT(kind() == MUST_REUSE_INPUT); + MOZ_ASSERT(allocation_.isUse()); + MOZ_ASSERT(kind() == MUST_REUSE_INPUT); return allocation_.toUse()->virtualRegister(); } @@ -95,7 +95,7 @@ class Requirement bool mergeRequirement(const Requirement &newRequirement) { // Merge newRequirement with any existing requirement, returning false // if the new and old requirements conflict. - JS_ASSERT(newRequirement.kind() != Requirement::MUST_REUSE_INPUT); + MOZ_ASSERT(newRequirement.kind() != Requirement::MUST_REUSE_INPUT); if (newRequirement.kind() == Requirement::FIXED) { if (kind() == Requirement::FIXED) @@ -104,7 +104,7 @@ class Requirement return true; } - JS_ASSERT(newRequirement.kind() == Requirement::REGISTER); + MOZ_ASSERT(newRequirement.kind() == Requirement::REGISTER); if (kind() == Requirement::FIXED) return allocation().isRegister(); @@ -233,7 +233,7 @@ class LiveInterval : from(f), to(t) { - JS_ASSERT(from < to); + MOZ_ASSERT(from < to); } // The beginning of this range, inclusive. @@ -302,12 +302,12 @@ class LiveInterval CodePosition nextCoveredAfter(CodePosition pos); CodePosition start() const { - JS_ASSERT(!ranges_.empty()); + MOZ_ASSERT(!ranges_.empty()); return ranges_.back().from; } CodePosition end() const { - JS_ASSERT(!ranges_.empty()); + MOZ_ASSERT(!ranges_.empty()); return ranges_.begin()->to; } @@ -320,7 +320,7 @@ class LiveInterval void setLastProcessedRange(size_t range, mozilla::DebugOnly pos) { // If the range starts after pos, we may not be able to use // it in the next lastProcessedRangeIfValid call. - JS_ASSERT(ranges_[range].from <= pos); + MOZ_ASSERT(ranges_[range].from <= pos); lastProcessedRange_ = range; } size_t lastProcessedRangeIfValid(CodePosition pos) const { @@ -345,7 +345,7 @@ class LiveInterval return vreg_ != UINT32_MAX; } uint32_t vreg() const { - JS_ASSERT(hasVreg()); + MOZ_ASSERT(hasVreg()); return vreg_; } uint32_t index() const { @@ -360,7 +360,7 @@ class LiveInterval void setRequirement(const Requirement &requirement) { // A MUST_REUSE_INPUT requirement complicates regalloc too much; it // should only be used as hint. - JS_ASSERT(requirement.kind() != Requirement::MUST_REUSE_INPUT); + MOZ_ASSERT(requirement.kind() != Requirement::MUST_REUSE_INPUT); requirement_ = requirement; } bool addRequirement(const Requirement &newRequirement) { @@ -446,7 +446,7 @@ class VirtualRegister bool init(TempAllocator &alloc, LBlock *block, LInstruction *ins, LDefinition *def, bool isTemp) { - JS_ASSERT(block && !block_); + MOZ_ASSERT(block && !block_); block_ = block; ins_ = ins; def_ = def; @@ -478,17 +478,17 @@ class VirtualRegister return intervals_[i]; } LiveInterval *lastInterval() const { - JS_ASSERT(numIntervals() > 0); + MOZ_ASSERT(numIntervals() > 0); return getInterval(numIntervals() - 1); } void replaceInterval(LiveInterval *old, LiveInterval *interval) { - JS_ASSERT(intervals_[old->index()] == old); + MOZ_ASSERT(intervals_[old->index()] == old); interval->setIndex(old->index()); intervals_[old->index()] = interval; } bool addInterval(LiveInterval *interval) { - JS_ASSERT(interval->numRanges()); - JS_ASSERT(interval->vreg() != 0); + MOZ_ASSERT(interval->numRanges()); + MOZ_ASSERT(interval->vreg() != 0); // Preserve ascending order for faster lookups. LiveInterval **found = nullptr; @@ -553,7 +553,7 @@ class VirtualRegisterMap return vregs_[index]; } VREG &operator[](const LAllocation *alloc) { - JS_ASSERT(alloc->isUse()); + MOZ_ASSERT(alloc->isUse()); return vregs_[alloc->toUse()->virtualRegister()]; } VREG &operator[](const LDefinition *def) { @@ -646,8 +646,8 @@ class LiveRangeAllocator : protected RegisterAllocator LiveInterval *prev = nullptr; for (size_t j = 0; j < reg->numIntervals(); j++) { LiveInterval *interval = reg->getInterval(j); - JS_ASSERT(interval->vreg() == i); - JS_ASSERT(interval->index() == j); + MOZ_ASSERT(interval->vreg() == i); + MOZ_ASSERT(interval->index() == j); if (interval->numRanges() == 0) continue; @@ -671,7 +671,7 @@ class LiveRangeAllocator : protected RegisterAllocator #endif bool addMove(LMoveGroup *moves, LiveInterval *from, LiveInterval *to, LDefinition::Type type) { - JS_ASSERT(*from->getAllocation() != *to->getAllocation()); + MOZ_ASSERT(*from->getAllocation() != *to->getAllocation()); return moves->add(from->getAllocation(), to->getAllocation(), type); } diff --git a/js/src/jit/LoopUnroller.cpp b/js/src/jit/LoopUnroller.cpp index fd374327e387..300dc2509d3a 100644 --- a/js/src/jit/LoopUnroller.cpp +++ b/js/src/jit/LoopUnroller.cpp @@ -63,7 +63,7 @@ LoopUnroller::getReplacementDefinition(MDefinition *def) // After phi analysis (TypeAnalyzer::replaceRedundantPhi) the resume // point at the start of a block can contain definitions from within // the block itself. - JS_ASSERT(def->isConstant()); + MOZ_ASSERT(def->isConstant()); MConstant *constant = MConstant::New(alloc, def->toConstant()->value()); oldPreheader->insertBefore(*oldPreheader->begin(), constant); @@ -132,7 +132,7 @@ LoopUnroller::go(LoopIterationBound *bound) backedge = header->backedge(); oldPreheader = header->loopPredecessor(); - JS_ASSERT(oldPreheader->numSuccessors() == 1); + MOZ_ASSERT(oldPreheader->numSuccessors() == 1); // Only unroll loops with two blocks: an initial one ending with the // bound's test, and the body ending with the backedge. @@ -150,7 +150,7 @@ LoopUnroller::go(LoopIterationBound *bound) } if (backedge->numPredecessors() != 1 || backedge->numSuccessors() != 1) return; - JS_ASSERT(backedge->phisEmpty()); + MOZ_ASSERT(backedge->phisEmpty()); MBasicBlock *bodyBlocks[] = { header, backedge }; @@ -229,10 +229,10 @@ LoopUnroller::go(LoopIterationBound *bound) // Add phis to the unrolled loop header which correspond to the phis in the // original loop header. - JS_ASSERT(header->getPredecessor(0) == oldPreheader); + MOZ_ASSERT(header->getPredecessor(0) == oldPreheader); for (MPhiIterator iter(header->phisBegin()); iter != header->phisEnd(); iter++) { MPhi *old = *iter; - JS_ASSERT(old->numOperands() == 2); + MOZ_ASSERT(old->numOperands() == 2); MPhi *phi = MPhi::New(alloc); phi->setResultType(old->type()); phi->setResultTypeSet(old->resultTypeSet()); @@ -291,7 +291,7 @@ LoopUnroller::go(LoopIterationBound *bound) } // Generate the unrolled code. - JS_ASSERT(UnrollCount > 1); + MOZ_ASSERT(UnrollCount > 1); size_t unrollIndex = 0; while (true) { // Clone the contents of the original loop into the unrolled loop body. @@ -303,7 +303,7 @@ LoopUnroller::go(LoopIterationBound *bound) makeReplacementInstruction(*iter); } else { // Control instructions are handled separately. - JS_ASSERT(ins->isTest() || ins->isGoto() || ins->isInterruptCheck()); + MOZ_ASSERT(ins->isTest() || ins->isGoto() || ins->isInterruptCheck()); } } } @@ -311,7 +311,7 @@ LoopUnroller::go(LoopIterationBound *bound) // Compute the value of each loop header phi after the execution of // this unrolled iteration. MDefinitionVector phiValues(alloc); - JS_ASSERT(header->getPredecessor(1) == backedge); + MOZ_ASSERT(header->getPredecessor(1) == backedge); for (MPhiIterator iter(header->phisBegin()); iter != header->phisEnd(); iter++) { MPhi *old = *iter; MDefinition *oldInput = old->getOperand(1); @@ -329,7 +329,7 @@ LoopUnroller::go(LoopIterationBound *bound) MPhi *phi = *iter; phi->addInput(phiValues[phiIndex++]); } - JS_ASSERT(phiIndex == phiValues.length()); + MOZ_ASSERT(phiIndex == phiValues.length()); break; } @@ -340,7 +340,7 @@ LoopUnroller::go(LoopIterationBound *bound) if (!unrolledDefinitions.putNew(old, phiValues[phiIndex++])) CrashAtUnhandlableOOM("LoopUnroller::go"); } - JS_ASSERT(phiIndex == phiValues.length()); + MOZ_ASSERT(phiIndex == phiValues.length()); unrollIndex++; } @@ -349,7 +349,7 @@ LoopUnroller::go(LoopIterationBound *bound) unrolledBackedge->end(backedgeJump); // Place the old preheader before the unrolled loop. - JS_ASSERT(oldPreheader->lastIns()->isGoto()); + MOZ_ASSERT(oldPreheader->lastIns()->isGoto()); oldPreheader->discardLastIns(); oldPreheader->end(MGoto::New(alloc, unrolledHeader)); diff --git a/js/src/jit/Lowering.cpp b/js/src/jit/Lowering.cpp index 0ef0210deda2..92a60eaca9ce 100644 --- a/js/src/jit/Lowering.cpp +++ b/js/src/jit/Lowering.cpp @@ -28,8 +28,8 @@ using JS::GenericNaN; bool LIRGenerator::visitCloneLiteral(MCloneLiteral *ins) { - JS_ASSERT(ins->type() == MIRType_Object); - JS_ASSERT(ins->input()->type() == MIRType_Object); + MOZ_ASSERT(ins->type() == MIRType_Object); + MOZ_ASSERT(ins->input()->type() == MIRType_Object); LCloneLiteral *lir = new(alloc()) LCloneLiteral(useRegisterAtStart(ins->input())); return defineReturn(lir, ins) && assignSafepoint(lir, ins); @@ -88,7 +88,7 @@ LIRGenerator::visitTableSwitch(MTableSwitch *tableswitch) MDefinition *opd = tableswitch->getOperand(0); // There should be at least 1 successor. The default case! - JS_ASSERT(tableswitch->numSuccessors() > 0); + MOZ_ASSERT(tableswitch->numSuccessors() > 0); // If there are no cases, the default case is always taken. if (tableswitch->numSuccessors() == 1) @@ -238,7 +238,7 @@ LIRGenerator::visitNewCallObjectPar(MNewCallObjectPar *ins) bool LIRGenerator::visitNewStringObject(MNewStringObject *ins) { - JS_ASSERT(ins->input()->type() == MIRType_String); + MOZ_ASSERT(ins->input()->type() == MIRType_String); LNewStringObject *lir = new(alloc()) LNewStringObject(useRegister(ins->input()), temp()); return define(lir, ins) && assignSafepoint(lir, ins); @@ -361,8 +361,8 @@ LIRGenerator::visitReturnFromCtor(MReturnFromCtor *ins) bool LIRGenerator::visitComputeThis(MComputeThis *ins) { - JS_ASSERT(ins->type() == MIRType_Object); - JS_ASSERT(ins->input()->type() == MIRType_Value); + MOZ_ASSERT(ins->type() == MIRType_Object); + MOZ_ASSERT(ins->input()->type() == MIRType_Value); LComputeThis *lir = new(alloc()) LComputeThis(); @@ -378,8 +378,8 @@ LIRGenerator::visitComputeThis(MComputeThis *ins) bool LIRGenerator::visitLoadArrowThis(MLoadArrowThis *ins) { - JS_ASSERT(ins->type() == MIRType_Value); - JS_ASSERT(ins->callee()->type() == MIRType_Object); + MOZ_ASSERT(ins->type() == MIRType_Value); + MOZ_ASSERT(ins->callee()->type() == MIRType_Object); LLoadArrowThis *lir = new(alloc()) LLoadArrowThis(useRegister(ins->callee())); return defineBox(lir, ins); @@ -415,10 +415,10 @@ LIRGenerator::lowerCallArguments(MCall *call) bool LIRGenerator::visitCall(MCall *call) { - JS_ASSERT(CallTempReg0 != CallTempReg1); - JS_ASSERT(CallTempReg0 != ArgumentsRectifierReg); - JS_ASSERT(CallTempReg1 != ArgumentsRectifierReg); - JS_ASSERT(call->getFunction()->type() == MIRType_Object); + MOZ_ASSERT(CallTempReg0 != CallTempReg1); + MOZ_ASSERT(CallTempReg0 != ArgumentsRectifierReg); + MOZ_ASSERT(CallTempReg1 != ArgumentsRectifierReg); + MOZ_ASSERT(call->getFunction()->type() == MIRType_Object); if (!lowerCallArguments(call)) return false; @@ -428,7 +428,7 @@ LIRGenerator::visitCall(MCall *call) // Call DOM functions. if (call->isCallDOMNative()) { - JS_ASSERT(target && target->isNative()); + MOZ_ASSERT(target && target->isNative()); Register cxReg, objReg, privReg, argsReg; GetTempRegForIntArg(0, 0, &cxReg); GetTempRegForIntArg(1, 0, &objReg); @@ -473,15 +473,15 @@ LIRGenerator::visitCall(MCall *call) bool LIRGenerator::visitApplyArgs(MApplyArgs *apply) { - JS_ASSERT(apply->getFunction()->type() == MIRType_Object); + MOZ_ASSERT(apply->getFunction()->type() == MIRType_Object); // Assert if we cannot build a rectifier frame. - JS_ASSERT(CallTempReg0 != ArgumentsRectifierReg); - JS_ASSERT(CallTempReg1 != ArgumentsRectifierReg); + MOZ_ASSERT(CallTempReg0 != ArgumentsRectifierReg); + MOZ_ASSERT(CallTempReg1 != ArgumentsRectifierReg); // Assert if the return value is already erased. - JS_ASSERT(CallTempReg2 != JSReturnReg_Type); - JS_ASSERT(CallTempReg2 != JSReturnReg_Data); + MOZ_ASSERT(CallTempReg2 != JSReturnReg_Type); + MOZ_ASSERT(CallTempReg2 != JSReturnReg_Data); LApplyArgsGeneric *lir = new(alloc()) LApplyArgsGeneric( useFixed(apply->getFunction(), CallTempReg3), @@ -544,10 +544,10 @@ bool LIRGenerator::visitGetDynamicName(MGetDynamicName *ins) { MDefinition *scopeChain = ins->getScopeChain(); - JS_ASSERT(scopeChain->type() == MIRType_Object); + MOZ_ASSERT(scopeChain->type() == MIRType_Object); MDefinition *name = ins->getName(); - JS_ASSERT(name->type() == MIRType_String); + MOZ_ASSERT(name->type() == MIRType_String); LGetDynamicName *lir = new(alloc()) LGetDynamicName(useFixed(scopeChain, CallTempReg0), useFixed(name, CallTempReg1), @@ -589,10 +589,10 @@ bool LIRGenerator::visitCallDirectEval(MCallDirectEval *ins) { MDefinition *scopeChain = ins->getScopeChain(); - JS_ASSERT(scopeChain->type() == MIRType_Object); + MOZ_ASSERT(scopeChain->type() == MIRType_Object); MDefinition *string = ins->getString(); - JS_ASSERT(string->type() == MIRType_String || string->type() == MIRType_Value); + MOZ_ASSERT(string->type() == MIRType_String || string->type() == MIRType_Value); MDefinition *thisValue = ins->getThisValue(); @@ -636,8 +636,8 @@ static bool ShouldReorderCommutative(MDefinition *lhs, MDefinition *rhs, MInstruction *ins) { // lhs and rhs are used by the commutative operator. - JS_ASSERT(lhs->hasDefUses()); - JS_ASSERT(rhs->hasDefUses()); + MOZ_ASSERT(lhs->hasDefUses()); + MOZ_ASSERT(rhs->hasDefUses()); // Ensure that if there is a constant, then it is in rhs. if (rhs->isConstant()) @@ -788,8 +788,8 @@ LIRGenerator::visitTest(MTest *test) // Compare and branch booleans. if (comp->compareType() == MCompare::Compare_Boolean) { - JS_ASSERT(left->type() == MIRType_Value); - JS_ASSERT(right->type() == MIRType_Boolean); + MOZ_ASSERT(left->type() == MIRType_Value); + MOZ_ASSERT(right->type() == MIRType_Boolean); LAllocation rhs = useRegisterOrConstant(right); LCompareBAndBranch *lir = new(alloc()) LCompareBAndBranch(comp, rhs, ifTrue, ifFalse); @@ -873,7 +873,7 @@ LIRGenerator::visitTest(MTest *test) if (opd->type() == MIRType_Float32) return add(new(alloc()) LTestFAndBranch(useRegister(opd), ifTrue, ifFalse)); - JS_ASSERT(opd->type() == MIRType_Int32 || opd->type() == MIRType_Boolean); + MOZ_ASSERT(opd->type() == MIRType_Int32 || opd->type() == MIRType_Boolean); return add(new(alloc()) LTestIAndBranch(useRegister(opd), ifTrue, ifFalse)); } @@ -934,8 +934,8 @@ LIRGenerator::visitCompare(MCompare *comp) // Strict compare between value and string if (comp->compareType() == MCompare::Compare_StrictString) { - JS_ASSERT(left->type() == MIRType_Value); - JS_ASSERT(right->type() == MIRType_String); + MOZ_ASSERT(left->type() == MIRType_Value); + MOZ_ASSERT(right->type() == MIRType_String); LCompareStrictS *lir = new(alloc()) LCompareStrictS(useRegister(right), tempToUnbox()); if (!useBox(lir, LCompareStrictS::Lhs, left)) @@ -990,8 +990,8 @@ LIRGenerator::visitCompare(MCompare *comp) // Compare booleans. if (comp->compareType() == MCompare::Compare_Boolean) { - JS_ASSERT(left->type() == MIRType_Value); - JS_ASSERT(right->type() == MIRType_Boolean); + MOZ_ASSERT(left->type() == MIRType_Value); + MOZ_ASSERT(right->type() == MIRType_Boolean); LCompareB *lir = new(alloc()) LCompareB(useRegisterOrConstant(right)); if (!useBox(lir, LCompareB::Lhs, left)) @@ -1062,7 +1062,7 @@ bool LIRGenerator::visitTypeOf(MTypeOf *ins) { MDefinition *opd = ins->input(); - JS_ASSERT(opd->type() == MIRType_Value); + MOZ_ASSERT(opd->type() == MIRType_Value); LTypeOfV *lir = new(alloc()) LTypeOfV(tempToUnbox()); if (!useBox(lir, LTypeOfV::Input, opd)) @@ -1154,7 +1154,7 @@ LIRGenerator::lowerShiftOp(JSOp op, MShiftInstruction *ins) if (lhs->type() == MIRType_Int32 && rhs->type() == MIRType_Int32) { if (ins->type() == MIRType_Double) { - JS_ASSERT(op == JSOP_URSH); + MOZ_ASSERT(op == JSOP_URSH); return lowerUrshD(ins->toUrsh()); } @@ -1166,7 +1166,7 @@ LIRGenerator::lowerShiftOp(JSOp op, MShiftInstruction *ins) return lowerForShift(lir, ins, lhs, rhs); } - JS_ASSERT(ins->specialization() == MIRType_None); + MOZ_ASSERT(ins->specialization() == MIRType_None); if (op == JSOP_URSH) { // Result is either int32 or double so we have to use BinaryV. @@ -1203,7 +1203,7 @@ bool LIRGenerator::visitFloor(MFloor *ins) { MIRType type = ins->input()->type(); - JS_ASSERT(IsFloatingPointType(type)); + MOZ_ASSERT(IsFloatingPointType(type)); if (type == MIRType_Double) { LFloor *lir = new(alloc()) LFloor(useRegister(ins->input())); @@ -1222,7 +1222,7 @@ bool LIRGenerator::visitCeil(MCeil *ins) { MIRType type = ins->input()->type(); - JS_ASSERT(IsFloatingPointType(type)); + MOZ_ASSERT(IsFloatingPointType(type)); if (type == MIRType_Double) { LCeil *lir = new(alloc()) LCeil(useRegister(ins->input())); @@ -1241,7 +1241,7 @@ bool LIRGenerator::visitRound(MRound *ins) { MIRType type = ins->input()->type(); - JS_ASSERT(IsFloatingPointType(type)); + MOZ_ASSERT(IsFloatingPointType(type)); if (type == MIRType_Double) { LRound *lir = new (alloc()) LRound(useRegister(ins->input()), tempDouble()); @@ -1283,7 +1283,7 @@ bool LIRGenerator::visitAbs(MAbs *ins) { MDefinition *num = ins->input(); - JS_ASSERT(IsNumberType(num->type())); + MOZ_ASSERT(IsNumberType(num->type())); if (num->type() == MIRType_Int32) { LAbsI *lir = new(alloc()) LAbsI(useRegisterAtStart(num)); @@ -1314,7 +1314,7 @@ bool LIRGenerator::visitSqrt(MSqrt *ins) { MDefinition *num = ins->input(); - JS_ASSERT(IsFloatingPointType(num->type())); + MOZ_ASSERT(IsFloatingPointType(num->type())); if (num->type() == MIRType_Double) { LSqrtD *lir = new(alloc()) LSqrtD(useRegisterAtStart(num)); return define(lir, ins); @@ -1328,10 +1328,10 @@ bool LIRGenerator::visitAtan2(MAtan2 *ins) { MDefinition *y = ins->y(); - JS_ASSERT(y->type() == MIRType_Double); + MOZ_ASSERT(y->type() == MIRType_Double); MDefinition *x = ins->x(); - JS_ASSERT(x->type() == MIRType_Double); + MOZ_ASSERT(x->type() == MIRType_Double); LAtan2D *lir = new(alloc()) LAtan2D(useRegisterAtStart(y), useRegisterAtStart(x), tempFixed(CallTempReg0)); return defineReturn(lir, ins); @@ -1341,10 +1341,10 @@ bool LIRGenerator::visitHypot(MHypot *ins) { MDefinition *x = ins->x(); - JS_ASSERT(x->type() == MIRType_Double); + MOZ_ASSERT(x->type() == MIRType_Double); MDefinition *y = ins->y(); - JS_ASSERT(y->type() == MIRType_Double); + MOZ_ASSERT(y->type() == MIRType_Double); LHypot *lir = new(alloc()) LHypot(useRegisterAtStart(x), useRegisterAtStart(y), tempFixed(CallTempReg0)); return defineReturn(lir, ins); @@ -1354,10 +1354,10 @@ bool LIRGenerator::visitPow(MPow *ins) { MDefinition *input = ins->input(); - JS_ASSERT(input->type() == MIRType_Double); + MOZ_ASSERT(input->type() == MIRType_Double); MDefinition *power = ins->power(); - JS_ASSERT(power->type() == MIRType_Int32 || power->type() == MIRType_Double); + MOZ_ASSERT(power->type() == MIRType_Int32 || power->type() == MIRType_Double); if (power->type() == MIRType_Int32) { // Note: useRegisterAtStart here is safe, the temp is a GP register so @@ -1382,8 +1382,8 @@ LIRGenerator::visitRandom(MRandom *ins) bool LIRGenerator::visitMathFunction(MMathFunction *ins) { - JS_ASSERT(IsFloatingPointType(ins->type())); - JS_ASSERT(ins->type() == ins->input()->type()); + MOZ_ASSERT(IsFloatingPointType(ins->type())); + MOZ_ASSERT(ins->type() == ins->input()->type()); if (ins->type() == MIRType_Double) { // Note: useRegisterAtStart is safe here, the temp is not a FP register. @@ -1403,7 +1403,7 @@ template static void MaybeSetRecoversInput(S *mir, T *lir) { - JS_ASSERT(lir->mirRaw() == mir); + MOZ_ASSERT(lir->mirRaw() == mir); if (!mir->fallible()) return; @@ -1435,10 +1435,10 @@ LIRGenerator::visitAdd(MAdd *ins) MDefinition *lhs = ins->getOperand(0); MDefinition *rhs = ins->getOperand(1); - JS_ASSERT(lhs->type() == rhs->type()); + MOZ_ASSERT(lhs->type() == rhs->type()); if (ins->specialization() == MIRType_Int32) { - JS_ASSERT(lhs->type() == MIRType_Int32); + MOZ_ASSERT(lhs->type() == MIRType_Int32); ReorderCommutative(&lhs, &rhs, ins); LAddI *lir = new(alloc()) LAddI; @@ -1453,13 +1453,13 @@ LIRGenerator::visitAdd(MAdd *ins) } if (ins->specialization() == MIRType_Double) { - JS_ASSERT(lhs->type() == MIRType_Double); + MOZ_ASSERT(lhs->type() == MIRType_Double); ReorderCommutative(&lhs, &rhs, ins); return lowerForFPU(new(alloc()) LMathD(JSOP_ADD), ins, lhs, rhs); } if (ins->specialization() == MIRType_Float32) { - JS_ASSERT(lhs->type() == MIRType_Float32); + MOZ_ASSERT(lhs->type() == MIRType_Float32); ReorderCommutative(&lhs, &rhs, ins); return lowerForFPU(new(alloc()) LMathF(JSOP_ADD), ins, lhs, rhs); } @@ -1473,10 +1473,10 @@ LIRGenerator::visitSub(MSub *ins) MDefinition *lhs = ins->lhs(); MDefinition *rhs = ins->rhs(); - JS_ASSERT(lhs->type() == rhs->type()); + MOZ_ASSERT(lhs->type() == rhs->type()); if (ins->specialization() == MIRType_Int32) { - JS_ASSERT(lhs->type() == MIRType_Int32); + MOZ_ASSERT(lhs->type() == MIRType_Int32); LSubI *lir = new(alloc()) LSubI; if (ins->fallible() && !assignSnapshot(lir, Bailout_Overflow)) @@ -1489,11 +1489,11 @@ LIRGenerator::visitSub(MSub *ins) return true; } if (ins->specialization() == MIRType_Double) { - JS_ASSERT(lhs->type() == MIRType_Double); + MOZ_ASSERT(lhs->type() == MIRType_Double); return lowerForFPU(new(alloc()) LMathD(JSOP_SUB), ins, lhs, rhs); } if (ins->specialization() == MIRType_Float32) { - JS_ASSERT(lhs->type() == MIRType_Float32); + MOZ_ASSERT(lhs->type() == MIRType_Float32); return lowerForFPU(new(alloc()) LMathF(JSOP_SUB), ins, lhs, rhs); } @@ -1505,10 +1505,10 @@ LIRGenerator::visitMul(MMul *ins) { MDefinition *lhs = ins->lhs(); MDefinition *rhs = ins->rhs(); - JS_ASSERT(lhs->type() == rhs->type()); + MOZ_ASSERT(lhs->type() == rhs->type()); if (ins->specialization() == MIRType_Int32) { - JS_ASSERT(lhs->type() == MIRType_Int32); + MOZ_ASSERT(lhs->type() == MIRType_Int32); ReorderCommutative(&lhs, &rhs, ins); // If our RHS is a constant -1 and we don't have to worry about @@ -1519,7 +1519,7 @@ LIRGenerator::visitMul(MMul *ins) return lowerMulI(ins, lhs, rhs); } if (ins->specialization() == MIRType_Double) { - JS_ASSERT(lhs->type() == MIRType_Double); + MOZ_ASSERT(lhs->type() == MIRType_Double); ReorderCommutative(&lhs, &rhs, ins); // If our RHS is a constant -1.0, we can optimize to an LNegD. @@ -1529,7 +1529,7 @@ LIRGenerator::visitMul(MMul *ins) return lowerForFPU(new(alloc()) LMathD(JSOP_MUL), ins, lhs, rhs); } if (ins->specialization() == MIRType_Float32) { - JS_ASSERT(lhs->type() == MIRType_Float32); + MOZ_ASSERT(lhs->type() == MIRType_Float32); ReorderCommutative(&lhs, &rhs, ins); // We apply the same optimizations as for doubles @@ -1547,18 +1547,18 @@ LIRGenerator::visitDiv(MDiv *ins) { MDefinition *lhs = ins->lhs(); MDefinition *rhs = ins->rhs(); - JS_ASSERT(lhs->type() == rhs->type()); + MOZ_ASSERT(lhs->type() == rhs->type()); if (ins->specialization() == MIRType_Int32) { - JS_ASSERT(lhs->type() == MIRType_Int32); + MOZ_ASSERT(lhs->type() == MIRType_Int32); return lowerDivI(ins); } if (ins->specialization() == MIRType_Double) { - JS_ASSERT(lhs->type() == MIRType_Double); + MOZ_ASSERT(lhs->type() == MIRType_Double); return lowerForFPU(new(alloc()) LMathD(JSOP_DIV), ins, lhs, rhs); } if (ins->specialization() == MIRType_Float32) { - JS_ASSERT(lhs->type() == MIRType_Float32); + MOZ_ASSERT(lhs->type() == MIRType_Float32); return lowerForFPU(new(alloc()) LMathF(JSOP_DIV), ins, lhs, rhs); } @@ -1568,18 +1568,18 @@ LIRGenerator::visitDiv(MDiv *ins) bool LIRGenerator::visitMod(MMod *ins) { - JS_ASSERT(ins->lhs()->type() == ins->rhs()->type()); + MOZ_ASSERT(ins->lhs()->type() == ins->rhs()->type()); if (ins->specialization() == MIRType_Int32) { - JS_ASSERT(ins->type() == MIRType_Int32); - JS_ASSERT(ins->lhs()->type() == MIRType_Int32); + MOZ_ASSERT(ins->type() == MIRType_Int32); + MOZ_ASSERT(ins->lhs()->type() == MIRType_Int32); return lowerModI(ins); } if (ins->specialization() == MIRType_Double) { - JS_ASSERT(ins->type() == MIRType_Double); - JS_ASSERT(ins->lhs()->type() == MIRType_Double); - JS_ASSERT(ins->rhs()->type() == MIRType_Double); + MOZ_ASSERT(ins->type() == MIRType_Double); + MOZ_ASSERT(ins->lhs()->type() == MIRType_Double); + MOZ_ASSERT(ins->rhs()->type() == MIRType_Double); // Note: useRegisterAtStart is safe here, the temp is not a FP register. LModD *lir = new(alloc()) LModD(useRegisterAtStart(ins->lhs()), useRegisterAtStart(ins->rhs()), @@ -1596,8 +1596,8 @@ LIRGenerator::lowerBinaryV(JSOp op, MBinaryInstruction *ins) MDefinition *lhs = ins->getOperand(0); MDefinition *rhs = ins->getOperand(1); - JS_ASSERT(lhs->type() == MIRType_Value); - JS_ASSERT(rhs->type() == MIRType_Value); + MOZ_ASSERT(lhs->type() == MIRType_Value); + MOZ_ASSERT(rhs->type() == MIRType_Value); LBinaryV *lir = new(alloc()) LBinaryV(op); if (!useBoxAtStart(lir, LBinaryV::LhsInput, lhs)) @@ -1615,9 +1615,9 @@ LIRGenerator::visitConcat(MConcat *ins) MDefinition *lhs = ins->getOperand(0); MDefinition *rhs = ins->getOperand(1); - JS_ASSERT(lhs->type() == MIRType_String); - JS_ASSERT(rhs->type() == MIRType_String); - JS_ASSERT(ins->type() == MIRType_String); + MOZ_ASSERT(lhs->type() == MIRType_String); + MOZ_ASSERT(rhs->type() == MIRType_String); + MOZ_ASSERT(ins->type() == MIRType_String); LConcat *lir = new(alloc()) LConcat(useFixedAtStart(lhs, CallTempReg0), useFixedAtStart(rhs, CallTempReg1), @@ -1638,9 +1638,9 @@ LIRGenerator::visitConcatPar(MConcatPar *ins) MDefinition *lhs = ins->lhs(); MDefinition *rhs = ins->rhs(); - JS_ASSERT(lhs->type() == MIRType_String); - JS_ASSERT(rhs->type() == MIRType_String); - JS_ASSERT(ins->type() == MIRType_String); + MOZ_ASSERT(lhs->type() == MIRType_String); + MOZ_ASSERT(rhs->type() == MIRType_String); + MOZ_ASSERT(ins->type() == MIRType_String); LConcatPar *lir = new(alloc()) LConcatPar(useFixed(cx, CallTempReg4), useFixedAtStart(lhs, CallTempReg0), @@ -1660,8 +1660,8 @@ LIRGenerator::visitCharCodeAt(MCharCodeAt *ins) MDefinition *str = ins->getOperand(0); MDefinition *idx = ins->getOperand(1); - JS_ASSERT(str->type() == MIRType_String); - JS_ASSERT(idx->type() == MIRType_Int32); + MOZ_ASSERT(str->type() == MIRType_String); + MOZ_ASSERT(idx->type() == MIRType_Int32); LCharCodeAt *lir = new(alloc()) LCharCodeAt(useRegister(str), useRegister(idx)); if (!define(lir, ins)) @@ -1674,7 +1674,7 @@ LIRGenerator::visitFromCharCode(MFromCharCode *ins) { MDefinition *code = ins->getOperand(0); - JS_ASSERT(code->type() == MIRType_Int32); + MOZ_ASSERT(code->type() == MIRType_Int32); LFromCharCode *lir = new(alloc()) LFromCharCode(useRegister(code)); if (!define(lir, ins)) @@ -1758,16 +1758,16 @@ LIRGenerator::visitToDouble(MToDouble *convert) } case MIRType_Null: - JS_ASSERT(conversion != MToFPInstruction::NumbersOnly && - conversion != MToFPInstruction::NonNullNonStringPrimitives); + MOZ_ASSERT(conversion != MToFPInstruction::NumbersOnly && + conversion != MToFPInstruction::NonNullNonStringPrimitives); return lowerConstantDouble(0, convert); case MIRType_Undefined: - JS_ASSERT(conversion != MToFPInstruction::NumbersOnly); + MOZ_ASSERT(conversion != MToFPInstruction::NumbersOnly); return lowerConstantDouble(GenericNaN(), convert); case MIRType_Boolean: - JS_ASSERT(conversion != MToFPInstruction::NumbersOnly); + MOZ_ASSERT(conversion != MToFPInstruction::NumbersOnly); /* FALLTHROUGH */ case MIRType_Int32: @@ -1820,16 +1820,16 @@ LIRGenerator::visitToFloat32(MToFloat32 *convert) } case MIRType_Null: - JS_ASSERT(conversion != MToFPInstruction::NumbersOnly && - conversion != MToFPInstruction::NonNullNonStringPrimitives); + MOZ_ASSERT(conversion != MToFPInstruction::NumbersOnly && + conversion != MToFPInstruction::NonNullNonStringPrimitives); return lowerConstantFloat32(0, convert); case MIRType_Undefined: - JS_ASSERT(conversion != MToFPInstruction::NumbersOnly); + MOZ_ASSERT(conversion != MToFPInstruction::NumbersOnly); return lowerConstantFloat32(GenericNaN(), convert); case MIRType_Boolean: - JS_ASSERT(conversion != MToFPInstruction::NumbersOnly); + MOZ_ASSERT(conversion != MToFPInstruction::NumbersOnly); /* FALLTHROUGH */ case MIRType_Int32: @@ -1882,12 +1882,12 @@ LIRGenerator::visitToInt32(MToInt32 *convert) } case MIRType_Null: - JS_ASSERT(convert->conversion() == MacroAssembler::IntConversion_Any); + MOZ_ASSERT(convert->conversion() == MacroAssembler::IntConversion_Any); return define(new(alloc()) LInteger(0), convert); case MIRType_Boolean: - JS_ASSERT(convert->conversion() == MacroAssembler::IntConversion_Any || - convert->conversion() == MacroAssembler::IntConversion_NumbersOrBoolsOnly); + MOZ_ASSERT(convert->conversion() == MacroAssembler::IntConversion_Any || + convert->conversion() == MacroAssembler::IntConversion_NumbersOrBoolsOnly); return redefine(convert, opd); case MIRType_Int32: @@ -2063,7 +2063,7 @@ MustCloneRegExp(MRegExp *regexp) MRegExpTest *test = def->toRegExpTest(); if (test->indexOf(*iter) == 1) { // Optimized RegExp.prototype.test. - JS_ASSERT(test->regexp() == regexp); + MOZ_ASSERT(test->regexp() == regexp); continue; } } else if (def->isCall()) { @@ -2092,8 +2092,8 @@ LIRGenerator::visitRegExp(MRegExp *ins) bool LIRGenerator::visitRegExpExec(MRegExpExec *ins) { - JS_ASSERT(ins->regexp()->type() == MIRType_Object); - JS_ASSERT(ins->string()->type() == MIRType_String); + MOZ_ASSERT(ins->regexp()->type() == MIRType_Object); + MOZ_ASSERT(ins->string()->type() == MIRType_String); LRegExpExec *lir = new(alloc()) LRegExpExec(useRegisterAtStart(ins->regexp()), useRegisterAtStart(ins->string())); @@ -2103,8 +2103,8 @@ LIRGenerator::visitRegExpExec(MRegExpExec *ins) bool LIRGenerator::visitRegExpTest(MRegExpTest *ins) { - JS_ASSERT(ins->regexp()->type() == MIRType_Object); - JS_ASSERT(ins->string()->type() == MIRType_String); + MOZ_ASSERT(ins->regexp()->type() == MIRType_Object); + MOZ_ASSERT(ins->string()->type() == MIRType_String); LRegExpTest *lir = new(alloc()) LRegExpTest(useRegisterAtStart(ins->regexp()), useRegisterAtStart(ins->string())); @@ -2114,9 +2114,9 @@ LIRGenerator::visitRegExpTest(MRegExpTest *ins) bool LIRGenerator::visitRegExpReplace(MRegExpReplace *ins) { - JS_ASSERT(ins->pattern()->type() == MIRType_Object); - JS_ASSERT(ins->string()->type() == MIRType_String); - JS_ASSERT(ins->replacement()->type() == MIRType_String); + MOZ_ASSERT(ins->pattern()->type() == MIRType_Object); + MOZ_ASSERT(ins->string()->type() == MIRType_String); + MOZ_ASSERT(ins->replacement()->type() == MIRType_String); LRegExpReplace *lir = new(alloc()) LRegExpReplace(useRegisterOrConstantAtStart(ins->string()), useRegisterAtStart(ins->pattern()), @@ -2127,9 +2127,9 @@ LIRGenerator::visitRegExpReplace(MRegExpReplace *ins) bool LIRGenerator::visitStringReplace(MStringReplace *ins) { - JS_ASSERT(ins->pattern()->type() == MIRType_String); - JS_ASSERT(ins->string()->type() == MIRType_String); - JS_ASSERT(ins->replacement()->type() == MIRType_String); + MOZ_ASSERT(ins->pattern()->type() == MIRType_String); + MOZ_ASSERT(ins->string()->type() == MIRType_String); + MOZ_ASSERT(ins->replacement()->type() == MIRType_String); LStringReplace *lir = new(alloc()) LStringReplace(useRegisterOrConstantAtStart(ins->string()), useRegisterAtStart(ins->pattern()), @@ -2169,8 +2169,8 @@ LIRGenerator::visitLambdaArrow(MLambdaArrow *ins) bool LIRGenerator::visitLambdaPar(MLambdaPar *ins) { - JS_ASSERT(!ins->info().singletonType); - JS_ASSERT(!ins->info().useNewTypeForClone); + MOZ_ASSERT(!ins->info().singletonType); + MOZ_ASSERT(!ins->info().useNewTypeForClone); LLambdaPar *lir = new(alloc()) LLambdaPar(useRegister(ins->forkJoinContext()), useRegister(ins->scopeChain()), temp(), temp()); @@ -2205,8 +2205,8 @@ LIRGenerator::visitConvertElementsToDoubles(MConvertElementsToDoubles *ins) bool LIRGenerator::visitMaybeToDoubleElement(MMaybeToDoubleElement *ins) { - JS_ASSERT(ins->elements()->type() == MIRType_Elements); - JS_ASSERT(ins->value()->type() == MIRType_Int32); + MOZ_ASSERT(ins->elements()->type() == MIRType_Elements); + MOZ_ASSERT(ins->value()->type() == MIRType_Int32); LMaybeToDoubleElement *lir = new(alloc()) LMaybeToDoubleElement(useRegisterAtStart(ins->elements()), useRegisterAtStart(ins->value()), @@ -2307,9 +2307,9 @@ LIRGenerator::visitNewPar(MNewPar *ins) bool LIRGenerator::visitNewDenseArrayPar(MNewDenseArrayPar *ins) { - JS_ASSERT(ins->forkJoinContext()->type() == MIRType_ForkJoinContext); - JS_ASSERT(ins->length()->type() == MIRType_Int32); - JS_ASSERT(ins->type() == MIRType_Object); + MOZ_ASSERT(ins->forkJoinContext()->type() == MIRType_ForkJoinContext); + MOZ_ASSERT(ins->length()->type() == MIRType_Int32); + MOZ_ASSERT(ins->type() == MIRType_Object); LNewDenseArrayPar *lir = new(alloc()) LNewDenseArrayPar(useRegister(ins->forkJoinContext()), @@ -2364,7 +2364,7 @@ LIRGenerator::visitTypeBarrier(MTypeBarrier *ins) MIRType inputType = ins->getOperand(0)->type(); DebugOnly outputType = ins->type(); - JS_ASSERT(inputType == outputType); + MOZ_ASSERT(inputType == outputType); // Handle typebarrier that will always bail. // (Emit LBail for visibility). @@ -2449,17 +2449,17 @@ LIRGenerator::visitPostWriteBarrier(MPostWriteBarrier *ins) bool LIRGenerator::visitArrayLength(MArrayLength *ins) { - JS_ASSERT(ins->elements()->type() == MIRType_Elements); + MOZ_ASSERT(ins->elements()->type() == MIRType_Elements); return define(new(alloc()) LArrayLength(useRegisterAtStart(ins->elements())), ins); } bool LIRGenerator::visitSetArrayLength(MSetArrayLength *ins) { - JS_ASSERT(ins->elements()->type() == MIRType_Elements); - JS_ASSERT(ins->index()->type() == MIRType_Int32); + MOZ_ASSERT(ins->elements()->type() == MIRType_Elements); + MOZ_ASSERT(ins->index()->type() == MIRType_Int32); - JS_ASSERT(ins->index()->isConstant()); + MOZ_ASSERT(ins->index()->isConstant()); return add(new(alloc()) LSetArrayLength(useRegister(ins->elements()), useRegisterOrConstant(ins->index())), ins); } @@ -2467,21 +2467,21 @@ LIRGenerator::visitSetArrayLength(MSetArrayLength *ins) bool LIRGenerator::visitTypedArrayLength(MTypedArrayLength *ins) { - JS_ASSERT(ins->object()->type() == MIRType_Object); + MOZ_ASSERT(ins->object()->type() == MIRType_Object); return define(new(alloc()) LTypedArrayLength(useRegisterAtStart(ins->object())), ins); } bool LIRGenerator::visitTypedArrayElements(MTypedArrayElements *ins) { - JS_ASSERT(ins->type() == MIRType_Elements); + MOZ_ASSERT(ins->type() == MIRType_Elements); return define(new(alloc()) LTypedArrayElements(useRegisterAtStart(ins->object())), ins); } bool LIRGenerator::visitTypedObjectProto(MTypedObjectProto *ins) { - JS_ASSERT(ins->type() == MIRType_Object); + MOZ_ASSERT(ins->type() == MIRType_Object); return defineReturn(new(alloc()) LTypedObjectProto( useFixed(ins->object(), CallTempReg0), tempFixed(CallTempReg1)), @@ -2491,7 +2491,7 @@ LIRGenerator::visitTypedObjectProto(MTypedObjectProto *ins) bool LIRGenerator::visitTypedObjectElements(MTypedObjectElements *ins) { - JS_ASSERT(ins->type() == MIRType_Elements); + MOZ_ASSERT(ins->type() == MIRType_Elements); return define(new(alloc()) LTypedObjectElements(useRegister(ins->object())), ins); } @@ -2508,17 +2508,17 @@ LIRGenerator::visitSetTypedObjectOffset(MSetTypedObjectOffset *ins) bool LIRGenerator::visitInitializedLength(MInitializedLength *ins) { - JS_ASSERT(ins->elements()->type() == MIRType_Elements); + MOZ_ASSERT(ins->elements()->type() == MIRType_Elements); return define(new(alloc()) LInitializedLength(useRegisterAtStart(ins->elements())), ins); } bool LIRGenerator::visitSetInitializedLength(MSetInitializedLength *ins) { - JS_ASSERT(ins->elements()->type() == MIRType_Elements); - JS_ASSERT(ins->index()->type() == MIRType_Int32); + MOZ_ASSERT(ins->elements()->type() == MIRType_Elements); + MOZ_ASSERT(ins->index()->type() == MIRType_Int32); - JS_ASSERT(ins->index()->isConstant()); + MOZ_ASSERT(ins->index()->isConstant()); return add(new(alloc()) LSetInitializedLength(useRegister(ins->elements()), useRegisterOrConstant(ins->index())), ins); } @@ -2530,7 +2530,7 @@ LIRGenerator::visitNot(MNot *ins) // String is converted to length of string in the type analysis phase (see // TestPolicy). - JS_ASSERT(op->type() != MIRType_String); + MOZ_ASSERT(op->type() != MIRType_String); // - boolean: x xor 1 // - int32: LCompare(x, 0) @@ -2621,11 +2621,11 @@ LIRGenerator::visitBoundsCheckLower(MBoundsCheckLower *ins) bool LIRGenerator::visitInArray(MInArray *ins) { - JS_ASSERT(ins->elements()->type() == MIRType_Elements); - JS_ASSERT(ins->index()->type() == MIRType_Int32); - JS_ASSERT(ins->initLength()->type() == MIRType_Int32); - JS_ASSERT(ins->object()->type() == MIRType_Object); - JS_ASSERT(ins->type() == MIRType_Boolean); + MOZ_ASSERT(ins->elements()->type() == MIRType_Elements); + MOZ_ASSERT(ins->index()->type() == MIRType_Int32); + MOZ_ASSERT(ins->initLength()->type() == MIRType_Int32); + MOZ_ASSERT(ins->object()->type() == MIRType_Object); + MOZ_ASSERT(ins->type() == MIRType_Boolean); LAllocation object; if (ins->needsNegativeIntCheck()) @@ -2641,8 +2641,8 @@ LIRGenerator::visitInArray(MInArray *ins) bool LIRGenerator::visitLoadElement(MLoadElement *ins) { - JS_ASSERT(ins->elements()->type() == MIRType_Elements); - JS_ASSERT(ins->index()->type() == MIRType_Int32); + MOZ_ASSERT(ins->elements()->type() == MIRType_Elements); + MOZ_ASSERT(ins->index()->type() == MIRType_Int32); switch (ins->type()) { case MIRType_Value: @@ -2671,10 +2671,10 @@ LIRGenerator::visitLoadElement(MLoadElement *ins) bool LIRGenerator::visitLoadElementHole(MLoadElementHole *ins) { - JS_ASSERT(ins->elements()->type() == MIRType_Elements); - JS_ASSERT(ins->index()->type() == MIRType_Int32); - JS_ASSERT(ins->initLength()->type() == MIRType_Int32); - JS_ASSERT(ins->type() == MIRType_Value); + MOZ_ASSERT(ins->elements()->type() == MIRType_Elements); + MOZ_ASSERT(ins->index()->type() == MIRType_Int32); + MOZ_ASSERT(ins->initLength()->type() == MIRType_Int32); + MOZ_ASSERT(ins->type() == MIRType_Value); LLoadElementHole *lir = new(alloc()) LLoadElementHole(useRegister(ins->elements()), useRegisterOrConstant(ins->index()), @@ -2687,8 +2687,8 @@ LIRGenerator::visitLoadElementHole(MLoadElementHole *ins) bool LIRGenerator::visitStoreElement(MStoreElement *ins) { - JS_ASSERT(ins->elements()->type() == MIRType_Elements); - JS_ASSERT(ins->index()->type() == MIRType_Int32); + MOZ_ASSERT(ins->elements()->type() == MIRType_Elements); + MOZ_ASSERT(ins->index()->type() == MIRType_Int32); const LUse elements = useRegister(ins->elements()); const LAllocation index = useRegisterOrConstant(ins->index()); @@ -2718,8 +2718,8 @@ LIRGenerator::visitStoreElement(MStoreElement *ins) bool LIRGenerator::visitStoreElementHole(MStoreElementHole *ins) { - JS_ASSERT(ins->elements()->type() == MIRType_Elements); - JS_ASSERT(ins->index()->type() == MIRType_Int32); + MOZ_ASSERT(ins->elements()->type() == MIRType_Elements); + MOZ_ASSERT(ins->index()->type() == MIRType_Int32); const LUse object = useRegister(ins->object()); const LUse elements = useRegister(ins->elements()); @@ -2776,7 +2776,7 @@ LIRGenerator::visitArrayPopShift(MArrayPopShift *ins) bool LIRGenerator::visitArrayPush(MArrayPush *ins) { - JS_ASSERT(ins->type() == MIRType_Int32); + MOZ_ASSERT(ins->type() == MIRType_Int32); LUse object = useRegister(ins->object()); @@ -2801,9 +2801,9 @@ LIRGenerator::visitArrayPush(MArrayPush *ins) bool LIRGenerator::visitArrayConcat(MArrayConcat *ins) { - JS_ASSERT(ins->type() == MIRType_Object); - JS_ASSERT(ins->lhs()->type() == MIRType_Object); - JS_ASSERT(ins->rhs()->type() == MIRType_Object); + MOZ_ASSERT(ins->type() == MIRType_Object); + MOZ_ASSERT(ins->lhs()->type() == MIRType_Object); + MOZ_ASSERT(ins->rhs()->type() == MIRType_Object); LArrayConcat *lir = new(alloc()) LArrayConcat(useFixed(ins->lhs(), CallTempReg1), useFixed(ins->rhs(), CallTempReg2), @@ -2815,9 +2815,9 @@ LIRGenerator::visitArrayConcat(MArrayConcat *ins) bool LIRGenerator::visitArrayJoin(MArrayJoin *ins) { - JS_ASSERT(ins->type() == MIRType_String); - JS_ASSERT(ins->array()->type() == MIRType_Object); - JS_ASSERT(ins->sep()->type() == MIRType_String); + MOZ_ASSERT(ins->type() == MIRType_String); + MOZ_ASSERT(ins->array()->type() == MIRType_Object); + MOZ_ASSERT(ins->sep()->type() == MIRType_String); LArrayJoin *lir = new(alloc()) LArrayJoin(useRegisterAtStart(ins->array()), useRegisterAtStart(ins->sep())); @@ -2827,9 +2827,9 @@ LIRGenerator::visitArrayJoin(MArrayJoin *ins) bool LIRGenerator::visitStringSplit(MStringSplit *ins) { - JS_ASSERT(ins->type() == MIRType_Object); - JS_ASSERT(ins->string()->type() == MIRType_String); - JS_ASSERT(ins->separator()->type() == MIRType_String); + MOZ_ASSERT(ins->type() == MIRType_Object); + MOZ_ASSERT(ins->string()->type() == MIRType_String); + MOZ_ASSERT(ins->separator()->type() == MIRType_String); LStringSplit *lir = new(alloc()) LStringSplit(useRegisterAtStart(ins->string()), useRegisterAtStart(ins->separator())); @@ -2839,13 +2839,13 @@ LIRGenerator::visitStringSplit(MStringSplit *ins) bool LIRGenerator::visitLoadTypedArrayElement(MLoadTypedArrayElement *ins) { - JS_ASSERT(ins->elements()->type() == MIRType_Elements); - JS_ASSERT(ins->index()->type() == MIRType_Int32); + MOZ_ASSERT(ins->elements()->type() == MIRType_Elements); + MOZ_ASSERT(ins->index()->type() == MIRType_Int32); const LUse elements = useRegister(ins->elements()); const LAllocation index = useRegisterOrConstant(ins->index()); - JS_ASSERT(IsNumberType(ins->type())); + MOZ_ASSERT(IsNumberType(ins->type())); // We need a temp register for Uint32Array with known double result. LDefinition tempDef = LDefinition::BogusTemp(); @@ -2891,10 +2891,10 @@ LIRGenerator::visitClampToUint8(MClampToUint8 *ins) bool LIRGenerator::visitLoadTypedArrayElementHole(MLoadTypedArrayElementHole *ins) { - JS_ASSERT(ins->object()->type() == MIRType_Object); - JS_ASSERT(ins->index()->type() == MIRType_Int32); + MOZ_ASSERT(ins->object()->type() == MIRType_Object); + MOZ_ASSERT(ins->index()->type() == MIRType_Int32); - JS_ASSERT(ins->type() == MIRType_Value); + MOZ_ASSERT(ins->type() == MIRType_Value); const LUse object = useRegister(ins->object()); const LAllocation index = useRegisterOrConstant(ins->index()); @@ -2920,14 +2920,14 @@ LIRGenerator::visitLoadTypedArrayElementStatic(MLoadTypedArrayElementStatic *ins bool LIRGenerator::visitStoreTypedArrayElement(MStoreTypedArrayElement *ins) { - JS_ASSERT(ins->elements()->type() == MIRType_Elements); - JS_ASSERT(ins->index()->type() == MIRType_Int32); + MOZ_ASSERT(ins->elements()->type() == MIRType_Elements); + MOZ_ASSERT(ins->index()->type() == MIRType_Int32); if (ins->isFloatArray()) { JS_ASSERT_IF(ins->arrayType() == Scalar::Float32, ins->value()->type() == MIRType_Float32); JS_ASSERT_IF(ins->arrayType() == Scalar::Float64, ins->value()->type() == MIRType_Double); } else { - JS_ASSERT(ins->value()->type() == MIRType_Int32); + MOZ_ASSERT(ins->value()->type() == MIRType_Int32); } LUse elements = useRegister(ins->elements()); @@ -2945,15 +2945,15 @@ LIRGenerator::visitStoreTypedArrayElement(MStoreTypedArrayElement *ins) bool LIRGenerator::visitStoreTypedArrayElementHole(MStoreTypedArrayElementHole *ins) { - JS_ASSERT(ins->elements()->type() == MIRType_Elements); - JS_ASSERT(ins->index()->type() == MIRType_Int32); - JS_ASSERT(ins->length()->type() == MIRType_Int32); + MOZ_ASSERT(ins->elements()->type() == MIRType_Elements); + MOZ_ASSERT(ins->index()->type() == MIRType_Int32); + MOZ_ASSERT(ins->length()->type() == MIRType_Int32); if (ins->isFloatArray()) { JS_ASSERT_IF(ins->arrayType() == Scalar::Float32, ins->value()->type() == MIRType_Float32); JS_ASSERT_IF(ins->arrayType() == Scalar::Float64, ins->value()->type() == MIRType_Double); } else { - JS_ASSERT(ins->value()->type() == MIRType_Int32); + MOZ_ASSERT(ins->value()->type() == MIRType_Int32); } LUse elements = useRegister(ins->elements()); @@ -2972,7 +2972,7 @@ LIRGenerator::visitStoreTypedArrayElementHole(MStoreTypedArrayElementHole *ins) bool LIRGenerator::visitLoadFixedSlot(MLoadFixedSlot *ins) { - JS_ASSERT(ins->object()->type() == MIRType_Object); + MOZ_ASSERT(ins->object()->type() == MIRType_Object); if (ins->type() == MIRType_Value) { LLoadFixedSlotV *lir = new(alloc()) LLoadFixedSlotV(useRegister(ins->object())); @@ -2986,7 +2986,7 @@ LIRGenerator::visitLoadFixedSlot(MLoadFixedSlot *ins) bool LIRGenerator::visitStoreFixedSlot(MStoreFixedSlot *ins) { - JS_ASSERT(ins->object()->type() == MIRType_Object); + MOZ_ASSERT(ins->object()->type() == MIRType_Object); if (ins->value()->type() == MIRType_Value) { LStoreFixedSlotV *lir = new(alloc()) LStoreFixedSlotV(useRegister(ins->object())); @@ -3004,7 +3004,7 @@ LIRGenerator::visitStoreFixedSlot(MStoreFixedSlot *ins) bool LIRGenerator::visitGetNameCache(MGetNameCache *ins) { - JS_ASSERT(ins->scopeObj()->type() == MIRType_Object); + MOZ_ASSERT(ins->scopeObj()->type() == MIRType_Object); LGetNameCache *lir = new(alloc()) LGetNameCache(useRegister(ins->scopeObj())); if (!defineBox(lir, ins)) @@ -3024,7 +3024,7 @@ LIRGenerator::visitCallGetIntrinsicValue(MCallGetIntrinsicValue *ins) bool LIRGenerator::visitCallsiteCloneCache(MCallsiteCloneCache *ins) { - JS_ASSERT(ins->callee()->type() == MIRType_Object); + MOZ_ASSERT(ins->callee()->type() == MIRType_Object); LCallsiteCloneCache *lir = new(alloc()) LCallsiteCloneCache(useRegister(ins->callee())); if (!define(lir, ins)) @@ -3035,7 +3035,7 @@ LIRGenerator::visitCallsiteCloneCache(MCallsiteCloneCache *ins) bool LIRGenerator::visitGetPropertyCache(MGetPropertyCache *ins) { - JS_ASSERT(ins->object()->type() == MIRType_Object); + MOZ_ASSERT(ins->object()->type() == MIRType_Object); if (ins->type() == MIRType_Value) { LGetPropertyCacheV *lir = new(alloc()) LGetPropertyCacheV(useRegister(ins->object())); if (!defineBox(lir, ins)) @@ -3053,7 +3053,7 @@ LIRGenerator::visitGetPropertyCache(MGetPropertyCache *ins) bool LIRGenerator::visitGetPropertyPolymorphic(MGetPropertyPolymorphic *ins) { - JS_ASSERT(ins->obj()->type() == MIRType_Object); + MOZ_ASSERT(ins->obj()->type() == MIRType_Object); if (ins->type() == MIRType_Value) { LGetPropertyPolymorphicV *lir = new(alloc()) LGetPropertyPolymorphicV(useRegister(ins->obj())); @@ -3068,7 +3068,7 @@ LIRGenerator::visitGetPropertyPolymorphic(MGetPropertyPolymorphic *ins) bool LIRGenerator::visitSetPropertyPolymorphic(MSetPropertyPolymorphic *ins) { - JS_ASSERT(ins->obj()->type() == MIRType_Object); + MOZ_ASSERT(ins->obj()->type() == MIRType_Object); if (ins->value()->type() == MIRType_Value) { LSetPropertyPolymorphicV *lir = new(alloc()) LSetPropertyPolymorphicV(useRegister(ins->obj()), temp()); @@ -3086,17 +3086,17 @@ LIRGenerator::visitSetPropertyPolymorphic(MSetPropertyPolymorphic *ins) bool LIRGenerator::visitGetElementCache(MGetElementCache *ins) { - JS_ASSERT(ins->object()->type() == MIRType_Object); + MOZ_ASSERT(ins->object()->type() == MIRType_Object); if (ins->type() == MIRType_Value) { - JS_ASSERT(ins->index()->type() == MIRType_Value); + MOZ_ASSERT(ins->index()->type() == MIRType_Value); LGetElementCacheV *lir = new(alloc()) LGetElementCacheV(useRegister(ins->object())); if (!useBox(lir, LGetElementCacheV::Index, ins->index())) return false; return defineBox(lir, ins) && assignSafepoint(lir, ins); } - JS_ASSERT(ins->index()->type() == MIRType_Int32); + MOZ_ASSERT(ins->index()->type() == MIRType_Int32); LGetElementCacheT *lir = new(alloc()) LGetElementCacheT(useRegister(ins->object()), useRegister(ins->index()), tempForDispatchCache(ins->type())); @@ -3106,8 +3106,8 @@ LIRGenerator::visitGetElementCache(MGetElementCache *ins) bool LIRGenerator::visitBindNameCache(MBindNameCache *ins) { - JS_ASSERT(ins->scopeChain()->type() == MIRType_Object); - JS_ASSERT(ins->type() == MIRType_Object); + MOZ_ASSERT(ins->scopeChain()->type() == MIRType_Object); + MOZ_ASSERT(ins->type() == MIRType_Object); LBindNameCache *lir = new(alloc()) LBindNameCache(useRegister(ins->scopeChain())); return define(lir, ins) && assignSafepoint(lir, ins); @@ -3135,7 +3135,7 @@ LIRGenerator::visitGuardObject(MGuardObject *ins) { // The type policy does all the work, so at this point the input // is guaranteed to be an object. - JS_ASSERT(ins->input()->type() == MIRType_Object); + MOZ_ASSERT(ins->input()->type() == MIRType_Object); return redefine(ins, ins->input()); } @@ -3144,7 +3144,7 @@ LIRGenerator::visitGuardString(MGuardString *ins) { // The type policy does all the work, so at this point the input // is guaranteed to be a string. - JS_ASSERT(ins->input()->type() == MIRType_String); + MOZ_ASSERT(ins->input()->type() == MIRType_String); return redefine(ins, ins->input()); } @@ -3211,8 +3211,8 @@ LIRGenerator::visitCallGetProperty(MCallGetProperty *ins) bool LIRGenerator::visitCallGetElement(MCallGetElement *ins) { - JS_ASSERT(ins->lhs()->type() == MIRType_Value); - JS_ASSERT(ins->rhs()->type() == MIRType_Value); + MOZ_ASSERT(ins->lhs()->type() == MIRType_Value); + MOZ_ASSERT(ins->rhs()->type() == MIRType_Value); LCallGetElement *lir = new(alloc()) LCallGetElement(); if (!useBoxAtStart(lir, LCallGetElement::LhsInput, ins->lhs())) @@ -3281,8 +3281,8 @@ LIRGenerator::visitSetPropertyCache(MSetPropertyCache *ins) bool LIRGenerator::visitSetElementCache(MSetElementCache *ins) { - JS_ASSERT(ins->object()->type() == MIRType_Object); - JS_ASSERT(ins->index()->type() == MIRType_Value); + MOZ_ASSERT(ins->object()->type() == MIRType_Object); + MOZ_ASSERT(ins->index()->type() == MIRType_Value); // Due to lack of registers on x86, we reuse the object register as a // temporary. This register may be used in a 1-byte store, which on x86 @@ -3315,9 +3315,9 @@ LIRGenerator::visitSetElementCache(MSetElementCache *ins) bool LIRGenerator::visitCallSetElement(MCallSetElement *ins) { - JS_ASSERT(ins->object()->type() == MIRType_Object); - JS_ASSERT(ins->index()->type() == MIRType_Value); - JS_ASSERT(ins->value()->type() == MIRType_Value); + MOZ_ASSERT(ins->object()->type() == MIRType_Object); + MOZ_ASSERT(ins->index()->type() == MIRType_Value); + MOZ_ASSERT(ins->value()->type() == MIRType_Value); LCallSetElement *lir = new(alloc()) LCallSetElement(); lir->setOperand(0, useRegisterAtStart(ins->object())); @@ -3375,7 +3375,7 @@ LIRGenerator::visitIteratorEnd(MIteratorEnd *ins) bool LIRGenerator::visitStringLength(MStringLength *ins) { - JS_ASSERT(ins->string()->type() == MIRType_String); + MOZ_ASSERT(ins->string()->type() == MIRType_String); return define(new(alloc()) LStringLength(useRegisterAtStart(ins->string())), ins); } @@ -3424,7 +3424,7 @@ LIRGenerator::visitRunOncePrologue(MRunOncePrologue *ins) bool LIRGenerator::visitRest(MRest *ins) { - JS_ASSERT(ins->numActuals()->type() == MIRType_Int32); + MOZ_ASSERT(ins->numActuals()->type() == MIRType_Int32); LRest *lir = new(alloc()) LRest(useFixed(ins->numActuals(), CallTempReg0), tempFixed(CallTempReg1), @@ -3436,7 +3436,7 @@ LIRGenerator::visitRest(MRest *ins) bool LIRGenerator::visitRestPar(MRestPar *ins) { - JS_ASSERT(ins->numActuals()->type() == MIRType_Int32); + MOZ_ASSERT(ins->numActuals()->type() == MIRType_Int32); LRestPar *lir = new(alloc()) LRestPar(useRegister(ins->forkJoinContext()), useRegister(ins->numActuals()), @@ -3450,7 +3450,7 @@ bool LIRGenerator::visitThrow(MThrow *ins) { MDefinition *value = ins->getOperand(0); - JS_ASSERT(value->type() == MIRType_Value); + MOZ_ASSERT(value->type() == MIRType_Value); LThrow *lir = new(alloc()) LThrow; if (!useBoxAtStart(lir, LThrow::Value, value)) @@ -3464,8 +3464,8 @@ LIRGenerator::visitIn(MIn *ins) MDefinition *lhs = ins->lhs(); MDefinition *rhs = ins->rhs(); - JS_ASSERT(lhs->type() == MIRType_Value); - JS_ASSERT(rhs->type() == MIRType_Object); + MOZ_ASSERT(lhs->type() == MIRType_Value); + MOZ_ASSERT(rhs->type() == MIRType_Object); LIn *lir = new(alloc()) LIn(useRegisterAtStart(rhs)); if (!useBoxAtStart(lir, LIn::LHS, lhs)) @@ -3478,7 +3478,7 @@ LIRGenerator::visitInstanceOf(MInstanceOf *ins) { MDefinition *lhs = ins->getOperand(0); - JS_ASSERT(lhs->type() == MIRType_Value || lhs->type() == MIRType_Object); + MOZ_ASSERT(lhs->type() == MIRType_Value || lhs->type() == MIRType_Object); if (lhs->type() == MIRType_Object) { LInstanceOfO *lir = new(alloc()) LInstanceOfO(useRegister(lhs)); @@ -3495,8 +3495,8 @@ LIRGenerator::visitCallInstanceOf(MCallInstanceOf *ins) MDefinition *lhs = ins->lhs(); MDefinition *rhs = ins->rhs(); - JS_ASSERT(lhs->type() == MIRType_Value); - JS_ASSERT(rhs->type() == MIRType_Object); + MOZ_ASSERT(lhs->type() == MIRType_Value); + MOZ_ASSERT(rhs->type() == MIRType_Object); LCallInstanceOf *lir = new(alloc()) LCallInstanceOf(useRegisterAtStart(rhs)); if (!useBoxAtStart(lir, LCallInstanceOf::LHS, lhs)) @@ -3518,8 +3518,8 @@ LIRGenerator::visitProfilerStackOp(MProfilerStackOp *ins) bool LIRGenerator::visitIsCallable(MIsCallable *ins) { - JS_ASSERT(ins->object()->type() == MIRType_Object); - JS_ASSERT(ins->type() == MIRType_Boolean); + MOZ_ASSERT(ins->object()->type() == MIRType_Object); + MOZ_ASSERT(ins->type() == MIRType_Boolean); return define(new(alloc()) LIsCallable(useRegister(ins->object())), ins); } @@ -3527,7 +3527,7 @@ bool LIRGenerator::visitIsObject(MIsObject *ins) { MDefinition *opd = ins->input(); - JS_ASSERT(opd->type() == MIRType_Value); + MOZ_ASSERT(opd->type() == MIRType_Value); LIsObject *lir = new(alloc()) LIsObject(); if (!useBoxAtStart(lir, LIsObject::Input, opd)) return false; @@ -3540,8 +3540,8 @@ LIRGenerator::visitHaveSameClass(MHaveSameClass *ins) MDefinition *lhs = ins->lhs(); MDefinition *rhs = ins->rhs(); - JS_ASSERT(lhs->type() == MIRType_Object); - JS_ASSERT(rhs->type() == MIRType_Object); + MOZ_ASSERT(lhs->type() == MIRType_Object); + MOZ_ASSERT(rhs->type() == MIRType_Object); return define(new(alloc()) LHaveSameClass(useRegister(lhs), useRegister(rhs), temp()), ins); } @@ -3549,8 +3549,8 @@ LIRGenerator::visitHaveSameClass(MHaveSameClass *ins) bool LIRGenerator::visitHasClass(MHasClass *ins) { - JS_ASSERT(ins->object()->type() == MIRType_Object); - JS_ASSERT(ins->type() == MIRType_Boolean); + MOZ_ASSERT(ins->object()->type() == MIRType_Object); + MOZ_ASSERT(ins->type() == MIRType_Boolean); return define(new(alloc()) LHasClass(useRegister(ins->object())), ins); } @@ -3579,7 +3579,7 @@ LIRGenerator::visitAsmJSParameter(MAsmJSParameter *ins) if (abi.argInRegister()) return defineFixed(new(alloc()) LAsmJSParameter, ins, LAllocation(abi.reg())); - JS_ASSERT(IsNumberType(ins->type()) || IsSimdType(ins->type())); + MOZ_ASSERT(IsNumberType(ins->type()) || IsSimdType(ins->type())); return defineFixed(new(alloc()) LAsmJSParameter, ins, LArgument(abi.offsetFromArgBase())); } @@ -3611,7 +3611,7 @@ bool LIRGenerator::visitAsmJSPassStackArg(MAsmJSPassStackArg *ins) { if (IsFloatingPointType(ins->arg()->type()) || IsSimdType(ins->arg()->type())) { - JS_ASSERT(!ins->arg()->isEmittedAtUses()); + MOZ_ASSERT(!ins->arg()->isEmittedAtUses()); return add(new(alloc()) LAsmJSPassStackArg(useRegisterAtStart(ins->arg())), ins); } @@ -3709,7 +3709,7 @@ LIRGenerator::visitRecompileCheck(MRecompileCheck *ins) bool LIRGenerator::visitSimdConstant(MSimdConstant *ins) { - JS_ASSERT(IsSimdType(ins->type())); + MOZ_ASSERT(IsSimdType(ins->type())); if (ins->type() == MIRType_Int32x4) return define(new(alloc()) LInt32x4(), ins); @@ -3749,8 +3749,8 @@ LIRGenerator::visitSimdReinterpretCast(MSimdReinterpretCast *ins) bool LIRGenerator::visitSimdExtractElement(MSimdExtractElement *ins) { - JS_ASSERT(IsSimdType(ins->input()->type())); - JS_ASSERT(!IsSimdType(ins->type())); + MOZ_ASSERT(IsSimdType(ins->input()->type())); + MOZ_ASSERT(!IsSimdType(ins->type())); if (ins->input()->type() == MIRType_Int32x4) { // Note: there could be int16x8 in the future, which doesn't use the @@ -3770,7 +3770,7 @@ LIRGenerator::visitSimdExtractElement(MSimdExtractElement *ins) bool LIRGenerator::visitSimdInsertElement(MSimdInsertElement *ins) { - JS_ASSERT(IsSimdType(ins->type())); + MOZ_ASSERT(IsSimdType(ins->type())); LUse vec = useRegisterAtStart(ins->vector()); LUse val = useRegister(ins->value()); @@ -3823,7 +3823,7 @@ LIRGenerator::visitSimdBinaryComp(MSimdBinaryComp *ins) bool LIRGenerator::visitSimdBinaryArith(MSimdBinaryArith *ins) { - JS_ASSERT(IsSimdType(ins->type())); + MOZ_ASSERT(IsSimdType(ins->type())); if (ins->type() == MIRType_Int32x4) { LSimdBinaryArithIx4 *add = new(alloc()) LSimdBinaryArithIx4(); @@ -4004,7 +4004,7 @@ LIRGenerator::visitBlock(MBasicBlock *block) if (!ensureDefined(opd)) return false; - JS_ASSERT(opd->type() == phi->type()); + MOZ_ASSERT(opd->type() == phi->type()); if (phi->type() == MIRType_Value) { lowerUntypedPhiInput(*phi, position, successor->lir(), lirIndex); diff --git a/js/src/jit/MCallOptimize.cpp b/js/src/jit/MCallOptimize.cpp index d4ee45492c8f..c1b2182611ec 100644 --- a/js/src/jit/MCallOptimize.cpp +++ b/js/src/jit/MCallOptimize.cpp @@ -27,7 +27,7 @@ namespace jit { IonBuilder::InliningStatus IonBuilder::inlineNativeCall(CallInfo &callInfo, JSFunction *target) { - JS_ASSERT(target->isNative()); + MOZ_ASSERT(target->isNative()); JSNative native = target->native(); if (!optimizationInfo().inlineNative()) @@ -223,14 +223,14 @@ IonBuilder::inlineNativeCall(CallInfo &callInfo, JSFunction *target) IonBuilder::InliningStatus IonBuilder::inlineNativeGetter(CallInfo &callInfo, JSFunction *target) { - JS_ASSERT(target->isNative()); + MOZ_ASSERT(target->isNative()); JSNative native = target->native(); if (!optimizationInfo().inlineNative()) return InliningStatus_NotInlined; types::TemporaryTypeSet *thisTypes = callInfo.thisArg()->resultTypeSet(); - JS_ASSERT(callInfo.argc() == 0); + MOZ_ASSERT(callInfo.argc() == 0); // Try to optimize typed array lengths. There is one getter on // %TypedArray%.prototype for typed arrays and one getter on @@ -304,7 +304,7 @@ IonBuilder::inlineArray(CallInfo &callInfo) JSObject *templateObject = inspector->getTemplateObjectForNative(pc, js_Array); if (!templateObject) return InliningStatus_NotInlined; - JS_ASSERT(templateObject->is()); + MOZ_ASSERT(templateObject->is()); // Multiple arguments imply array initialization, not just construction. if (callInfo.argc() >= 2) { @@ -540,7 +540,7 @@ IonBuilder::inlineArrayPush(CallInfo &callInfo) { return InliningStatus_NotInlined; } - JS_ASSERT(obj == callInfo.thisArg() && value == callInfo.getArg(0)); + MOZ_ASSERT(obj == callInfo.thisArg() && value == callInfo.getArg(0)); if (getInlineReturnType() != MIRType_Int32) return InliningStatus_NotInlined; @@ -675,7 +675,7 @@ IonBuilder::inlineArrayConcat(CallInfo &callInfo) JSObject *templateObj = inspector->getTemplateObjectForNative(pc, js::array_concat); if (!templateObj || templateObj->type() != baseThisType) return InliningStatus_NotInlined; - JS_ASSERT(templateObj->is()); + MOZ_ASSERT(templateObj->is()); callInfo.setImplicitlyUsedUnchecked(); @@ -1191,7 +1191,7 @@ IonBuilder::inlineStringObject(CallInfo &callInfo) JSObject *templateObj = inspector->getTemplateObjectForNative(pc, js_String); if (!templateObj) return InliningStatus_NotInlined; - JS_ASSERT(templateObj->is()); + MOZ_ASSERT(templateObj->is()); callInfo.setImplicitlyUsedUnchecked(); @@ -1218,7 +1218,7 @@ IonBuilder::inlineStringSplit(CallInfo &callInfo) JSObject *templateObject = inspector->getTemplateObjectForNative(pc, js::str_split); if (!templateObject) return InliningStatus_NotInlined; - JS_ASSERT(templateObject->is()); + MOZ_ASSERT(templateObject->is()); types::TypeObjectKey *retType = types::TypeObjectKey::get(templateObject); if (retType->unknownProperties()) @@ -1575,7 +1575,7 @@ IonBuilder::elementAccessIsTypedObjectArrayOfScalarType(MDefinition* obj, MDefin if (elemPrediction.isUseless() || elemPrediction.kind() != type::Scalar) return false; - JS_ASSERT(type::isSized(elemPrediction.kind())); + MOZ_ASSERT(type::isSized(elemPrediction.kind())); *arrayType = elemPrediction.scalarType(); return true; } @@ -2117,8 +2117,8 @@ IonBuilder::inlineAssertFloat32(CallInfo &callInfo) MDefinition *secondArg = callInfo.getArg(1); - JS_ASSERT(secondArg->type() == MIRType_Boolean); - JS_ASSERT(secondArg->isConstant()); + MOZ_ASSERT(secondArg->type() == MIRType_Boolean); + MOZ_ASSERT(secondArg->isConstant()); bool mustBeFloat32 = secondArg->toConstant()->value().toBoolean(); current->add(MAssertFloat32::New(alloc(), callInfo.getArg(0), mustBeFloat32)); diff --git a/js/src/jit/MIR.cpp b/js/src/jit/MIR.cpp index 440503843284..5843914ee84a 100644 --- a/js/src/jit/MIR.cpp +++ b/js/src/jit/MIR.cpp @@ -257,7 +257,7 @@ MDefinition::analyzeEdgeCasesBackward() void MInstruction::setResumePoint(MResumePoint *resumePoint) { - JS_ASSERT(!resumePoint_); + MOZ_ASSERT(!resumePoint_); resumePoint_ = resumePoint; resumePoint_->setInstruction(this); } @@ -306,7 +306,7 @@ MTest::New(TempAllocator &alloc, MDefinition *ins, MBasicBlock *ifTrue, MBasicBl void MTest::cacheOperandMightEmulateUndefined() { - JS_ASSERT(operandMightEmulateUndefined()); + MOZ_ASSERT(operandMightEmulateUndefined()); if (!MaybeEmulatesUndefined(getOperand(0))) markOperandCantEmulateUndefined(); @@ -523,8 +523,8 @@ MDefinition::replaceAllUsesWith(MDefinition *dom) void MDefinition::justReplaceAllUsesWith(MDefinition *dom) { - JS_ASSERT(dom != nullptr); - JS_ASSERT(dom != this); + MOZ_ASSERT(dom != nullptr); + MOZ_ASSERT(dom != this); for (MUseIterator i(usesBegin()); i != usesEnd(); i++) i->setProducerUnchecked(dom); @@ -546,7 +546,7 @@ MConstant::New(TempAllocator &alloc, const Value &v, types::CompilerConstraintLi MConstant * MConstant::NewAsmJS(TempAllocator &alloc, const Value &v, MIRType type) { - JS_ASSERT(!IsSimdType(type)); + MOZ_ASSERT(!IsSimdType(type)); MConstant *constant = new(alloc) MConstant(v, nullptr); constant->setResultType(type); return constant; @@ -565,7 +565,7 @@ jit::MakeSingletonTypeSet(types::CompilerConstraintList *constraints, JSObject * // happens for instance when we mutate an object's __proto__, in this case // we want to invalidate and mark this TypeSet as containing AnyObject // (because mutating __proto__ will change an object's TypeObject). - JS_ASSERT(constraints); + MOZ_ASSERT(constraints); types::TypeObjectKey *objType = types::TypeObjectKey::get(obj); objType->hasFlags(constraints, types::OBJECT_FLAG_UNKNOWN_PROPERTIES); @@ -765,7 +765,7 @@ MSimdSplatX4::foldsTo(TempAllocator &alloc) MDefinition *op = getOperand(0); if (!op->isConstant()) return this; - JS_ASSERT(op->type() == scalarType); + MOZ_ASSERT(op->type() == scalarType); SimdConstant cst; switch (type()) { @@ -913,10 +913,10 @@ MCall * MCall::New(TempAllocator &alloc, JSFunction *target, size_t maxArgc, size_t numActualArgs, bool construct, bool isDOMCall) { - JS_ASSERT(maxArgc >= numActualArgs); + MOZ_ASSERT(maxArgc >= numActualArgs); MCall *ins; if (isDOMCall) { - JS_ASSERT(!construct); + MOZ_ASSERT(!construct); ins = new(alloc) MCallDOMNative(target, numActualArgs); } else { ins = new(alloc) MCall(target, numActualArgs, construct); @@ -931,7 +931,7 @@ MCallDOMNative::getAliasSet() const { const JSJitInfo *jitInfo = getJitInfo(); - JS_ASSERT(jitInfo->aliasSet() != JSJitInfo::AliasNone); + MOZ_ASSERT(jitInfo->aliasSet() != JSJitInfo::AliasNone); // If we don't know anything about the types of our arguments, we have to // assume that type-coercions can have side-effects, so we need to alias // everything. @@ -1016,7 +1016,7 @@ MCallDOMNative::congruentTo(const MDefinition *ins) const return false; // The other call had better be movable at this point! - JS_ASSERT(call->isMovable()); + MOZ_ASSERT(call->isMovable()); return true; } @@ -1024,10 +1024,10 @@ MCallDOMNative::congruentTo(const MDefinition *ins) const const JSJitInfo * MCallDOMNative::getJitInfo() const { - JS_ASSERT(getSingleTarget() && getSingleTarget()->isNative()); + MOZ_ASSERT(getSingleTarget() && getSingleTarget()->isNative()); const JSJitInfo *jitInfo = getSingleTarget()->jitInfo(); - JS_ASSERT(jitInfo); + MOZ_ASSERT(jitInfo); return jitInfo; } @@ -1066,7 +1066,7 @@ EnsureFloatInputOrConvert(MUnaryInstruction *owner, TempAllocator &alloc) void MFloor::trySpecializeFloat32(TempAllocator &alloc) { - JS_ASSERT(type() == MIRType_Int32); + MOZ_ASSERT(type() == MIRType_Int32); if (EnsureFloatInputOrConvert(this, alloc)) setPolicyType(MIRType_Float32); } @@ -1074,7 +1074,7 @@ MFloor::trySpecializeFloat32(TempAllocator &alloc) void MCeil::trySpecializeFloat32(TempAllocator &alloc) { - JS_ASSERT(type() == MIRType_Int32); + MOZ_ASSERT(type() == MIRType_Int32); if (EnsureFloatInputOrConvert(this, alloc)) setPolicyType(MIRType_Float32); } @@ -1082,7 +1082,7 @@ MCeil::trySpecializeFloat32(TempAllocator &alloc) void MRound::trySpecializeFloat32(TempAllocator &alloc) { - JS_ASSERT(type() == MIRType_Int32); + MOZ_ASSERT(type() == MIRType_Int32); if (EnsureFloatInputOrConvert(this, alloc)) setPolicyType(MIRType_Float32); } @@ -1097,8 +1097,8 @@ MCompare * MCompare::NewAsmJS(TempAllocator &alloc, MDefinition *left, MDefinition *right, JSOp op, CompareType compareType) { - JS_ASSERT(compareType == Compare_Int32 || compareType == Compare_UInt32 || - compareType == Compare_Double || compareType == Compare_Float32); + MOZ_ASSERT(compareType == Compare_Int32 || compareType == Compare_UInt32 || + compareType == Compare_Double || compareType == Compare_Float32); MCompare *comp = new(alloc) MCompare(left, right, op); comp->compareType_ = compareType; comp->operandMightEmulateUndefined_ = false; @@ -1115,7 +1115,7 @@ MTableSwitch::New(TempAllocator &alloc, MDefinition *ins, int32_t low, int32_t h MGoto * MGoto::New(TempAllocator &alloc, MBasicBlock *target) { - JS_ASSERT(target); + MOZ_ASSERT(target); return new(alloc) MGoto(target); } @@ -1161,21 +1161,21 @@ MPhi::assertLoopPhi() const // predecessors being at indices 0 and 1. MBasicBlock *pred = block()->getPredecessor(0); MBasicBlock *back = block()->getPredecessor(1); - JS_ASSERT(pred == block()->loopPredecessor()); - JS_ASSERT(pred->successorWithPhis() == block()); - JS_ASSERT(pred->positionInPhiSuccessor() == 0); - JS_ASSERT(back == block()->backedge()); - JS_ASSERT(back->successorWithPhis() == block()); - JS_ASSERT(back->positionInPhiSuccessor() == 1); + MOZ_ASSERT(pred == block()->loopPredecessor()); + MOZ_ASSERT(pred->successorWithPhis() == block()); + MOZ_ASSERT(pred->positionInPhiSuccessor() == 0); + MOZ_ASSERT(back == block()->backedge()); + MOZ_ASSERT(back->successorWithPhis() == block()); + MOZ_ASSERT(back->positionInPhiSuccessor() == 1); } #endif void MPhi::removeOperand(size_t index) { - JS_ASSERT(index < numOperands()); - JS_ASSERT(getUseFor(index)->index() == index); - JS_ASSERT(getUseFor(index)->consumer() == this); + MOZ_ASSERT(index < numOperands()); + MOZ_ASSERT(getUseFor(index)->index() == index); + MOZ_ASSERT(getUseFor(index)->consumer() == this); // If we have phi(..., a, b, c, d, ..., z) and we plan // on removing a, then first shift downward so that we have @@ -1329,7 +1329,7 @@ MPhi::reserveLength(size_t length) // Initializes a new MPhi to have an Operand vector of at least the given // capacity. This permits use of addInput() instead of addInputSlow(), the // latter of which may call pod_realloc(). - JS_ASSERT(numOperands() == 0); + MOZ_ASSERT(numOperands() == 0); #if DEBUG capacity_ = length; #endif @@ -1339,7 +1339,7 @@ MPhi::reserveLength(size_t length) static inline types::TemporaryTypeSet * MakeMIRTypeSet(MIRType type) { - JS_ASSERT(type != MIRType_Value); + MOZ_ASSERT(type != MIRType_Value); types::Type ntype = type == MIRType_Object ? types::Type::AnyObjectType() : types::Type::PrimitiveType(ValueTypeFromMIRType(type)); @@ -1388,11 +1388,11 @@ bool MPhi::specializeType() { #ifdef DEBUG - JS_ASSERT(!specialized_); + MOZ_ASSERT(!specialized_); specialized_ = true; #endif - JS_ASSERT(!inputs_.empty()); + MOZ_ASSERT(!inputs_.empty()); size_t start; if (hasBackedgeType_) { @@ -1422,7 +1422,7 @@ MPhi::specializeType() bool MPhi::addBackedgeType(MIRType type, types::TemporaryTypeSet *typeSet) { - JS_ASSERT(!specialized_); + MOZ_ASSERT(!specialized_); if (hasBackedgeType_) { MIRType resultType = this->type(); @@ -1469,7 +1469,7 @@ MPhi::addInput(MDefinition *ins) { // This can only been done if the length was reserved through reserveLength, // else the slower addInputSlow need to get called. - JS_ASSERT(inputs_.length() < capacity_); + MOZ_ASSERT(inputs_.length() < capacity_); inputs_.append(MUse()); inputs_.back().init(ins, this); @@ -1611,7 +1611,7 @@ void MBinaryBitwiseInstruction::specializeAsInt32() { specialization_ = MIRType_Int32; - JS_ASSERT(type() == MIRType_Int32); + MOZ_ASSERT(type() == MIRType_Int32); if (isBitOr() || isBitAnd() || isBitXor()) setCommutative(); @@ -2069,7 +2069,7 @@ SimpleArithOperand(MDefinition *op) void MBinaryArithInstruction::infer(TempAllocator &alloc, BaselineInspector *inspector, jsbytecode *pc) { - JS_ASSERT(this->type() == MIRType_Value); + MOZ_ASSERT(this->type() == MIRType_Value); specialization_ = MIRType_None; @@ -2114,8 +2114,8 @@ MBinaryArithInstruction::infer(TempAllocator &alloc, BaselineInspector *inspecto setResultType(MIRType_Double); } - JS_ASSERT(lhs < MIRType_String || lhs == MIRType_Value); - JS_ASSERT(rhs < MIRType_String || rhs == MIRType_Value); + MOZ_ASSERT(lhs < MIRType_String || lhs == MIRType_Value); + MOZ_ASSERT(rhs < MIRType_String || rhs == MIRType_Value); MIRType rval = this->type(); @@ -2320,7 +2320,7 @@ MBinaryInstruction::tryUseUnsignedOperands() void MCompare::infer(BaselineInspector *inspector, jsbytecode *pc) { - JS_ASSERT(operandMightEmulateUndefined()); + MOZ_ASSERT(operandMightEmulateUndefined()); if (!MaybeEmulatesUndefined(getOperand(0)) && !MaybeEmulatesUndefined(getOperand(1))) markNoOperandEmulatesUndefined(); @@ -2415,7 +2415,7 @@ MCompare::infer(BaselineInspector *inspector, jsbytecode *pc) // Handle strict comparison with lhs/rhs being typed Boolean. if (strictEq && (lhs == MIRType_Boolean || rhs == MIRType_Boolean)) { // bool/bool case got an int32 specialization earlier. - JS_ASSERT(!(lhs == MIRType_Boolean && rhs == MIRType_Boolean)); + MOZ_ASSERT(!(lhs == MIRType_Boolean && rhs == MIRType_Boolean)); // Ensure the boolean is on the right so that the type policy knows // which side to unbox. @@ -2453,7 +2453,7 @@ MBitNot::NewAsmJS(TempAllocator &alloc, MDefinition *input) { MBitNot *ins = new(alloc) MBitNot(input); ins->specialization_ = MIRType_Int32; - JS_ASSERT(ins->type() == MIRType_Int32); + MOZ_ASSERT(ins->type() == MIRType_Int32); return ins; } @@ -2471,7 +2471,7 @@ MBitNot::foldsTo(TempAllocator &alloc) } if (input->isBitNot() && input->toBitNot()->specialization_ == MIRType_Int32) { - JS_ASSERT(input->toBitNot()->getOperand(0)->type() == MIRType_Int32); + MOZ_ASSERT(input->toBitNot()->getOperand(0)->type() == MIRType_Int32); return input->toBitNot()->getOperand(0); // ~~x => x } @@ -2483,7 +2483,7 @@ MTypeOf::foldsTo(TempAllocator &alloc) { // Note: we can't use input->type() here, type analysis has // boxed the input. - JS_ASSERT(input()->type() == MIRType_Value); + MOZ_ASSERT(input()->type() == MIRType_Value); JSType type; @@ -2525,7 +2525,7 @@ MTypeOf::foldsTo(TempAllocator &alloc) void MTypeOf::cacheInputMaybeCallableOrEmulatesUndefined() { - JS_ASSERT(inputMaybeCallableOrEmulatesUndefined()); + MOZ_ASSERT(inputMaybeCallableOrEmulatesUndefined()); if (!MaybeEmulatesUndefined(input()) && !MaybeCallable(input())) markInputNotCallableOrEmulatesUndefined(); @@ -2844,8 +2844,8 @@ MCompare::tryFold(bool *result) JSOp op = jsop(); if (compareType_ == Compare_Null || compareType_ == Compare_Undefined) { - JS_ASSERT(op == JSOP_EQ || op == JSOP_STRICTEQ || - op == JSOP_NE || op == JSOP_STRICTNE); + MOZ_ASSERT(op == JSOP_EQ || op == JSOP_STRICTEQ || + op == JSOP_NE || op == JSOP_STRICTNE); // The LHS is the value we want to test against null or undefined. switch (lhs()->type()) { @@ -2880,8 +2880,8 @@ MCompare::tryFold(bool *result) } if (compareType_ == Compare_Boolean) { - JS_ASSERT(op == JSOP_STRICTEQ || op == JSOP_STRICTNE); - JS_ASSERT(rhs()->type() == MIRType_Boolean); + MOZ_ASSERT(op == JSOP_STRICTEQ || op == JSOP_STRICTNE); + MOZ_ASSERT(rhs()->type() == MIRType_Boolean); switch (lhs()->type()) { case MIRType_Value: @@ -2905,8 +2905,8 @@ MCompare::tryFold(bool *result) } if (compareType_ == Compare_StrictString) { - JS_ASSERT(op == JSOP_STRICTEQ || op == JSOP_STRICTNE); - JS_ASSERT(rhs()->type() == MIRType_String); + MOZ_ASSERT(op == JSOP_STRICTEQ || op == JSOP_STRICTNE); + MOZ_ASSERT(rhs()->type() == MIRType_String); switch (lhs()->type()) { case MIRType_Value: @@ -3053,7 +3053,7 @@ MCompare::foldsTo(TempAllocator &alloc) if (type() == MIRType_Int32) return MConstant::New(alloc, Int32Value(result)); - JS_ASSERT(type() == MIRType_Boolean); + MOZ_ASSERT(type() == MIRType_Boolean); return MConstant::New(alloc, BooleanValue(result)); } @@ -3086,8 +3086,8 @@ MCompare::filtersUndefinedOrNull(bool trueBranch, MDefinition **subject, bool *f if (compareType() != Compare_Undefined && compareType() != Compare_Null) return; - JS_ASSERT(jsop() == JSOP_STRICTNE || jsop() == JSOP_NE || - jsop() == JSOP_STRICTEQ || jsop() == JSOP_EQ); + MOZ_ASSERT(jsop() == JSOP_STRICTNE || jsop() == JSOP_NE || + jsop() == JSOP_STRICTEQ || jsop() == JSOP_EQ); // JSOP_*NE only removes undefined/null from if/true branch if (!trueBranch && (jsop() == JSOP_STRICTNE || jsop() == JSOP_NE)) @@ -3110,7 +3110,7 @@ MCompare::filtersUndefinedOrNull(bool trueBranch, MDefinition **subject, bool *f void MNot::cacheOperandMightEmulateUndefined() { - JS_ASSERT(operandMightEmulateUndefined()); + MOZ_ASSERT(operandMightEmulateUndefined()); if (!MaybeEmulatesUndefined(getOperand(0))) markOperandCantEmulateUndefined(); @@ -3241,7 +3241,7 @@ MObjectState::Copy(TempAllocator &alloc, MObjectState *state) bool MNewArray::shouldUseVM() const { - JS_ASSERT(count() < JSObject::NELEMENTS_LIMIT); + MOZ_ASSERT(count() < JSObject::NELEMENTS_LIMIT); size_t arraySlots = gc::GetGCKindSlots(templateObject()->asTenured()->getAllocKind()) - ObjectElements::VALUES_PER_HEADER; @@ -4134,7 +4134,7 @@ TryAddTypeBarrierForWrite(TempAllocator &alloc, types::CompilerConstraintList *c } } - JS_ASSERT(aggregateProperty); + MOZ_ASSERT(aggregateProperty); MIRType propertyType = aggregateProperty->knownMIRType(constraints); switch (propertyType) { @@ -4279,7 +4279,7 @@ jit::PropertyWriteNeedsTypeBarrier(TempAllocator &alloc, types::CompilerConstrai excluded = object; } - JS_ASSERT(excluded); + MOZ_ASSERT(excluded); *pobj = AddTypeGuard(alloc, current, *pobj, excluded, /* bailOnEquality = */ true); return false; diff --git a/js/src/jit/MIR.h b/js/src/jit/MIR.h index acd18aaa9ce2..6e288d7d2260 100644 --- a/js/src/jit/MIR.h +++ b/js/src/jit/MIR.h @@ -147,7 +147,7 @@ class MUse : public TempObject, public InlineListNode explicit MUse(const MUse &other) : producer_(other.producer_), consumer_(other.consumer_) { - JS_ASSERT(!other.next && !other.prev); + MOZ_ASSERT(!other.next && !other.prev); } // Set this use, which was previously clear. @@ -162,14 +162,14 @@ class MUse : public TempObject, public InlineListNode inline void releaseProducer(); MDefinition *producer() const { - JS_ASSERT(producer_ != nullptr); + MOZ_ASSERT(producer_ != nullptr); return producer_; } bool hasProducer() const { return producer_ != nullptr; } MNode *consumer() const { - JS_ASSERT(consumer_ != nullptr); + MOZ_ASSERT(consumer_ != nullptr); return consumer_; } @@ -310,11 +310,11 @@ class AliasSet { return AliasSet(None_); } static AliasSet Load(uint32_t flags) { - JS_ASSERT(flags && !(flags & Store_)); + MOZ_ASSERT(flags && !(flags & Store_)); return AliasSet(flags); } static AliasSet Store(uint32_t flags) { - JS_ASSERT(flags && !(flags & Store_)); + MOZ_ASSERT(flags && !(flags & Store_)); return AliasSet(flags | Store_); } }; @@ -463,11 +463,11 @@ class MDefinition : public MNode // errors. Instead, one should define the collectRangeInfoPreTrunc() to set // the right set of flags which are dependent on the range of the inputs. Range *range() const { - JS_ASSERT(type() != MIRType_None); + MOZ_ASSERT(type() != MIRType_None); return range_; } void setRange(Range *range) { - JS_ASSERT(type() != MIRType_None); + MOZ_ASSERT(type() != MIRType_None); range_ = range; } @@ -532,7 +532,7 @@ class MDefinition : public MNode } uint32_t id() const { - JS_ASSERT(block_); + MOZ_ASSERT(block_); return id_; } void setId(uint32_t id) { @@ -544,11 +544,11 @@ class MDefinition : public MNode return hasFlags(1 << flag);\ }\ void set##flag() {\ - JS_ASSERT(!hasFlags(1 << flag));\ + MOZ_ASSERT(!hasFlags(1 << flag));\ setFlags(1 << flag);\ }\ void setNot##flag() {\ - JS_ASSERT(hasFlags(1 << flag));\ + MOZ_ASSERT(hasFlags(1 << flag));\ removeFlags(1 << flag);\ }\ void set##flag##Unchecked() {\ @@ -678,7 +678,7 @@ class MDefinition : public MNode #endif } uint32_t virtualRegister() const { - JS_ASSERT(isLowered()); + MOZ_ASSERT(isLowered()); return virtualRegister_; } @@ -688,11 +688,11 @@ class MDefinition : public MNode return op() == MIRType::classOpcode; } template MIRType *to() { - JS_ASSERT(this->is()); + MOZ_ASSERT(this->is()); return static_cast(this); } template const MIRType *to() const { - JS_ASSERT(this->is()); + MOZ_ASSERT(this->is()); return static_cast(this); } # define OPCODE_CASTS(opcode) \ @@ -749,8 +749,8 @@ class MDefinition : public MNode // Return whether this load may depend on the specified store, given // that the alias sets intersect. This may be refined to exclude // possible aliasing in cases where alias set flags are too imprecise. - JS_ASSERT(!isEffectful() && store->isEffectful()); - JS_ASSERT(getAliasSet().flags() & store->getAliasSet().flags()); + MOZ_ASSERT(!isEffectful() && store->isEffectful()); + MOZ_ASSERT(getAliasSet().flags() & store->getAliasSet().flags()); return true; } @@ -786,7 +786,7 @@ class MUseDefIterator return current_ != def_->usesEnd(); } MUseDefIterator operator ++() { - JS_ASSERT(current_ != def_->usesEnd()); + MOZ_ASSERT(current_ != def_->usesEnd()); ++current_; current_ = search(current_); return *this; @@ -1266,12 +1266,12 @@ class MSimdValueX4 : public MQuaternaryInstruction MSimdValueX4(MIRType type, MDefinition *x, MDefinition *y, MDefinition *z, MDefinition *w) : MQuaternaryInstruction(x, y, z, w) { - JS_ASSERT(IsSimdType(type)); + MOZ_ASSERT(IsSimdType(type)); mozilla::DebugOnly scalarType = SimdTypeToScalarType(type); - JS_ASSERT(scalarType == x->type()); - JS_ASSERT(scalarType == y->type()); - JS_ASSERT(scalarType == z->type()); - JS_ASSERT(scalarType == w->type()); + MOZ_ASSERT(scalarType == x->type()); + MOZ_ASSERT(scalarType == y->type()); + MOZ_ASSERT(scalarType == z->type()); + MOZ_ASSERT(scalarType == w->type()); setMovable(); setResultType(type); @@ -1306,9 +1306,9 @@ class MSimdSplatX4 : public MUnaryInstruction MSimdSplatX4(MIRType type, MDefinition *v) : MUnaryInstruction(v) { - JS_ASSERT(IsSimdType(type)); + MOZ_ASSERT(IsSimdType(type)); mozilla::DebugOnly scalarType = SimdTypeToScalarType(type); - JS_ASSERT(scalarType == v->type()); + MOZ_ASSERT(scalarType == v->type()); setMovable(); setResultType(type); @@ -1342,7 +1342,7 @@ class MSimdConstant : public MNullaryInstruction protected: MSimdConstant(const SimdConstant &v, MIRType type) : value_(v) { - JS_ASSERT(IsSimdType(type)); + MOZ_ASSERT(IsSimdType(type)); setResultType(type); setMovable(); } @@ -1435,10 +1435,10 @@ class MSimdExtractElement : public MUnaryInstruction MSimdExtractElement(MDefinition *obj, MIRType type, SimdLane lane) : MUnaryInstruction(obj), lane_(lane) { - JS_ASSERT(IsSimdType(obj->type())); - JS_ASSERT(uint32_t(lane) < SimdTypeToLength(obj->type())); - JS_ASSERT(!IsSimdType(type)); - JS_ASSERT(SimdTypeToScalarType(obj->type()) == type); + MOZ_ASSERT(IsSimdType(obj->type())); + MOZ_ASSERT(uint32_t(lane) < SimdTypeToLength(obj->type())); + MOZ_ASSERT(!IsSimdType(type)); + MOZ_ASSERT(SimdTypeToScalarType(obj->type()) == type); setResultType(type); } @@ -1643,9 +1643,9 @@ class MSimdBinaryArith : public MBinaryInstruction : MBinaryInstruction(left, right), operation_(op) { JS_ASSERT_IF(type == MIRType_Int32x4, op == Add || op == Sub); - JS_ASSERT(IsSimdType(type)); - JS_ASSERT(left->type() == right->type()); - JS_ASSERT(left->type() == type); + MOZ_ASSERT(IsSimdType(type)); + MOZ_ASSERT(left->type() == right->type()); + MOZ_ASSERT(left->type() == type); setResultType(type); setMovable(); if (op == Add || op == Mul || op == Min || op == Max) @@ -1927,7 +1927,7 @@ class MTableSwitch MOZ_FINAL int32_t high_; void initOperand(size_t index, MDefinition *operand) { - JS_ASSERT(index == 0); + MOZ_ASSERT(index == 0); operand_.init(operand, this); } @@ -1944,12 +1944,12 @@ class MTableSwitch MOZ_FINAL protected: MUse *getUseFor(size_t index) { - JS_ASSERT(index == 0); + MOZ_ASSERT(index == 0); return &operand_; } const MUse *getUseFor(size_t index) const { - JS_ASSERT(index == 0); + MOZ_ASSERT(index == 0); return &operand_; } @@ -1962,19 +1962,19 @@ class MTableSwitch MOZ_FINAL } size_t addSuccessor(MBasicBlock *successor) { - JS_ASSERT(successors_.length() < (size_t)(high_ - low_ + 2)); - JS_ASSERT(!successors_.empty()); + MOZ_ASSERT(successors_.length() < (size_t)(high_ - low_ + 2)); + MOZ_ASSERT(!successors_.empty()); successors_.append(successor); return successors_.length() - 1; } MBasicBlock *getSuccessor(size_t i) const { - JS_ASSERT(i < numSuccessors()); + MOZ_ASSERT(i < numSuccessors()); return successors_[i]; } void replaceSuccessor(size_t i, MBasicBlock *successor) { - JS_ASSERT(i < numSuccessors()); + MOZ_ASSERT(i < numSuccessors()); successors_[i] = successor; } @@ -2007,7 +2007,7 @@ class MTableSwitch MOZ_FINAL } size_t addDefault(MBasicBlock *block) { - JS_ASSERT(successors_.empty()); + MOZ_ASSERT(successors_.empty()); successors_.append(block); return 0; } @@ -2017,7 +2017,7 @@ class MTableSwitch MOZ_FINAL } MBasicBlock *getBlock(size_t i) const { - JS_ASSERT(i < numBlocks()); + MOZ_ASSERT(i < numBlocks()); return blocks_[i]; } @@ -2026,7 +2026,7 @@ class MTableSwitch MOZ_FINAL } MDefinition *getOperand(size_t index) const { - JS_ASSERT(index == 0); + MOZ_ASSERT(index == 0); return operand_.producer(); } @@ -2040,7 +2040,7 @@ class MTableSwitch MOZ_FINAL } void replaceOperand(size_t index, MDefinition *operand) MOZ_FINAL MOZ_OVERRIDE { - JS_ASSERT(index == 0); + MOZ_ASSERT(index == 0); operand_.replaceProducer(operand); } @@ -2356,7 +2356,7 @@ class MNewArrayCopyOnWrite : public MNullaryInstruction : templateObject_(templateObject), initialHeap_(initialHeap) { - JS_ASSERT(!templateObject->hasSingletonType()); + MOZ_ASSERT(!templateObject->hasSingletonType()); setResultType(MIRType_Object); setResultTypeSet(MakeSingletonTypeSet(constraints, templateObject)); } @@ -3426,7 +3426,7 @@ class MCompare return AliasSet::None(); if (compareType_ == Compare_Unknown) return AliasSet::Store(AliasSet::Any); - JS_ASSERT(compareType_ <= Compare_Value); + MOZ_ASSERT(compareType_ <= Compare_Value); return AliasSet::None(); } @@ -3479,7 +3479,7 @@ class MBox : public MUnaryInstruction static MBox *New(TempAllocator &alloc, MDefinition *ins) { // Cannot box a box. - JS_ASSERT(ins->type() != MIRType_Value); + MOZ_ASSERT(ins->type() != MIRType_Value); return new(alloc) MBox(alloc, ins); } @@ -3529,12 +3529,12 @@ class MUnbox : public MUnaryInstruction, public BoxInputsPolicy::Data // during type analysis. JS_ASSERT_IF(ins->type() != MIRType_Value, type != ins->type()); - JS_ASSERT(type == MIRType_Boolean || - type == MIRType_Int32 || - type == MIRType_Double || - type == MIRType_String || - type == MIRType_Symbol || - type == MIRType_Object); + MOZ_ASSERT(type == MIRType_Boolean || + type == MIRType_Int32 || + type == MIRType_Double || + type == MIRType_String || + type == MIRType_Symbol || + type == MIRType_Object); setResultType(type); setResultTypeSet(ins->resultTypeSet()); @@ -3589,7 +3589,7 @@ class MUnbox : public MUnaryInstruction, public BoxInputsPolicy::Data } BailoutKind bailoutKind() const { // If infallible, no bailout should be generated. - JS_ASSERT(fallible()); + MOZ_ASSERT(fallible()); return bailoutKind_; } bool fallible() const { @@ -3606,7 +3606,7 @@ class MUnbox : public MUnaryInstruction, public BoxInputsPolicy::Data void printOpcode(FILE *fp) const; void makeInfallible() { // Should only be called if we're already Infallible or TypeBarrier - JS_ASSERT(mode() != Fallible); + MOZ_ASSERT(mode() != Fallible); mode_ = Infallible; } @@ -4707,7 +4707,7 @@ class MMinMax : MBinaryInstruction(left, right), isMax_(isMax) { - JS_ASSERT(IsNumberType(type)); + MOZ_ASSERT(IsNumberType(type)); setResultType(type); setMovable(); specialization_ = type; @@ -4758,7 +4758,7 @@ class MAbs : MUnaryInstruction(num), implicitTruncate_(false) { - JS_ASSERT(IsNumberType(type)); + MOZ_ASSERT(IsNumberType(type)); setResultType(type); setMovable(); specialization_ = type; @@ -4805,7 +4805,7 @@ class MClz : MUnaryInstruction(num), operandIsNeverZero_(false) { - JS_ASSERT(IsNumberType(num->type())); + MOZ_ASSERT(IsNumberType(num->type())); specialization_ = MIRType_Int32; setResultType(MIRType_Int32); setMovable(); @@ -4858,7 +4858,7 @@ class MSqrt return new(alloc) MSqrt(num, MIRType_Double); } static MSqrt *NewAsmJS(TempAllocator &alloc, MDefinition *num, MIRType type) { - JS_ASSERT(IsFloatingPointType(type)); + MOZ_ASSERT(IsFloatingPointType(type)); return new(alloc) MSqrt(num, type); } bool congruentTo(const MDefinition *ins) const { @@ -4986,7 +4986,7 @@ class MPow static MPow *New(TempAllocator &alloc, MDefinition *input, MDefinition *power, MIRType powerType) { - JS_ASSERT(powerType == MIRType_Double || powerType == MIRType_Int32); + MOZ_ASSERT(powerType == MIRType_Double || powerType == MIRType_Int32); return new(alloc) MPow(input, power, powerType); } @@ -5517,17 +5517,17 @@ class MMod : public MBinaryArithInstruction } bool canBeNegativeDividend() const { - JS_ASSERT(specialization_ == MIRType_Int32); + MOZ_ASSERT(specialization_ == MIRType_Int32); return canBeNegativeDividend_; } bool canBeDivideByZero() const { - JS_ASSERT(specialization_ == MIRType_Int32); + MOZ_ASSERT(specialization_ == MIRType_Int32); return canBeDivideByZero_; } bool canBePowerOfTwoDivisor() const { - JS_ASSERT(specialization_ == MIRType_Int32); + MOZ_ASSERT(specialization_ == MIRType_Int32); return canBePowerOfTwoDivisor_; } @@ -5560,7 +5560,7 @@ class MConcat : MBinaryInstruction(left, right) { // At least one input should be definitely string - JS_ASSERT(left->type() == MIRType_String || right->type() == MIRType_String); + MOZ_ASSERT(left->type() == MIRType_String || right->type() == MIRType_String); setMovable(); setResultType(MIRType_String); @@ -5595,7 +5595,7 @@ class MConcatPar { // Type analysis has already run, before replacing with the parallel // variant. - JS_ASSERT(left->type() == MIRType_String && right->type() == MIRType_String); + MOZ_ASSERT(left->type() == MIRType_String && right->type() == MIRType_String); setMovable(); setResultType(MIRType_String); @@ -5822,7 +5822,7 @@ class MPhi MOZ_FINAL : public MDefinition, public InlineListNode // operands such that they do not include the type sets of their // operands. This can arise during e.g. value numbering, where // definitions producing the same value may have different type sets. - JS_ASSERT(index < numOperands()); + MOZ_ASSERT(index < numOperands()); return &inputs_[index]; } const MUse *getUseFor(size_t index) const { @@ -6618,8 +6618,8 @@ class MLambdaPar types::TemporaryTypeSet *resultTypes, const LambdaFunctionInfo &info) : MBinaryInstruction(cx, scopeChain), info_(info) { - JS_ASSERT(!info_.singletonType); - JS_ASSERT(!info_.useNewTypeForClone); + MOZ_ASSERT(!info_.singletonType); + MOZ_ASSERT(!info_.useNewTypeForClone); setResultType(MIRType_Object); setResultTypeSet(resultTypes); } @@ -6795,7 +6795,7 @@ class MMaybeToDoubleElement MMaybeToDoubleElement(MDefinition *elements, MDefinition *value) : MBinaryInstruction(elements, value) { - JS_ASSERT(elements->type() == MIRType_Elements); + MOZ_ASSERT(elements->type() == MIRType_Elements); setMovable(); setResultType(MIRType_Value); } @@ -7060,7 +7060,7 @@ class MNeuterCheck explicit MNeuterCheck(MDefinition *object) : MUnaryInstruction(object) { - JS_ASSERT(object->type() == MIRType_Object); + MOZ_ASSERT(object->type() == MIRType_Object); setResultType(MIRType_Object); setResultTypeSet(object->resultTypeSet()); setGuard(); @@ -7128,8 +7128,8 @@ class MSetTypedObjectOffset MSetTypedObjectOffset(MDefinition *object, MDefinition *offset) : MBinaryInstruction(object, offset) { - JS_ASSERT(object->type() == MIRType_Object); - JS_ASSERT(offset->type() == MIRType_Int32); + MOZ_ASSERT(object->type() == MIRType_Object); + MOZ_ASSERT(offset->type() == MIRType_Int32); setResultType(MIRType_None); } @@ -7236,8 +7236,8 @@ class MBoundsCheck { setGuard(); setMovable(); - JS_ASSERT(index->type() == MIRType_Int32); - JS_ASSERT(length->type() == MIRType_Int32); + MOZ_ASSERT(index->type() == MIRType_Int32); + MOZ_ASSERT(length->type() == MIRType_Int32); // Returns the checked index. setResultType(MIRType_Int32); @@ -7296,7 +7296,7 @@ class MBoundsCheckLower { setGuard(); setMovable(); - JS_ASSERT(index->type() == MIRType_Int32); + MOZ_ASSERT(index->type() == MIRType_Int32); } public: @@ -7346,8 +7346,8 @@ class MLoadElement } setResultType(MIRType_Value); setMovable(); - JS_ASSERT(elements->type() == MIRType_Elements); - JS_ASSERT(index->type() == MIRType_Int32); + MOZ_ASSERT(elements->type() == MIRType_Elements); + MOZ_ASSERT(index->type() == MIRType_Int32); } public: @@ -7408,9 +7408,9 @@ class MLoadElementHole { setResultType(MIRType_Value); setMovable(); - JS_ASSERT(elements->type() == MIRType_Elements); - JS_ASSERT(index->type() == MIRType_Int32); - JS_ASSERT(initLength->type() == MIRType_Int32); + MOZ_ASSERT(elements->type() == MIRType_Elements); + MOZ_ASSERT(index->type() == MIRType_Int32); + MOZ_ASSERT(initLength->type() == MIRType_Int32); } public: @@ -7472,7 +7472,7 @@ class MStoreElementCommon return elementType_; } void setElementType(MIRType elementType) { - JS_ASSERT(elementType != MIRType_None); + MOZ_ASSERT(elementType != MIRType_None); elementType_ = elementType; } bool needsBarrier() const { @@ -7502,8 +7502,8 @@ class MStoreElement initOperand(1, index); initOperand(2, value); needsHoleCheck_ = needsHoleCheck; - JS_ASSERT(elements->type() == MIRType_Elements); - JS_ASSERT(index->type() == MIRType_Int32); + MOZ_ASSERT(elements->type() == MIRType_Elements); + MOZ_ASSERT(index->type() == MIRType_Int32); } public: @@ -7550,8 +7550,8 @@ class MStoreElementHole initOperand(1, elements); initOperand(2, index); initOperand(3, value); - JS_ASSERT(elements->type() == MIRType_Elements); - JS_ASSERT(index->type() == MIRType_Int32); + MOZ_ASSERT(elements->type() == MIRType_Elements); + MOZ_ASSERT(index->type() == MIRType_Int32); } public: @@ -7749,9 +7749,9 @@ class MLoadTypedArrayElement { setResultType(MIRType_Value); setMovable(); - JS_ASSERT(elements->type() == MIRType_Elements); - JS_ASSERT(index->type() == MIRType_Int32); - JS_ASSERT(arrayType >= 0 && arrayType < Scalar::TypeMax); + MOZ_ASSERT(elements->type() == MIRType_Elements); + MOZ_ASSERT(index->type() == MIRType_Int32); + MOZ_ASSERT(arrayType >= 0 && arrayType < Scalar::TypeMax); } public: @@ -7811,8 +7811,8 @@ class MLoadTypedArrayElementHole { setResultType(MIRType_Value); setMovable(); - JS_ASSERT(index->type() == MIRType_Int32); - JS_ASSERT(arrayType >= 0 && arrayType < Scalar::TypeMax); + MOZ_ASSERT(index->type() == MIRType_Int32); + MOZ_ASSERT(arrayType >= 0 && arrayType < Scalar::TypeMax); } public: @@ -7924,9 +7924,9 @@ class MStoreTypedArrayElement : MTernaryInstruction(elements, index, value), arrayType_(arrayType), racy_(false) { setMovable(); - JS_ASSERT(elements->type() == MIRType_Elements); - JS_ASSERT(index->type() == MIRType_Int32); - JS_ASSERT(arrayType >= 0 && arrayType < Scalar::TypeMax); + MOZ_ASSERT(elements->type() == MIRType_Elements); + MOZ_ASSERT(index->type() == MIRType_Int32); + MOZ_ASSERT(arrayType >= 0 && arrayType < Scalar::TypeMax); } public: @@ -7992,10 +7992,10 @@ class MStoreTypedArrayElementHole initOperand(2, index); initOperand(3, value); setMovable(); - JS_ASSERT(elements->type() == MIRType_Elements); - JS_ASSERT(length->type() == MIRType_Int32); - JS_ASSERT(index->type() == MIRType_Int32); - JS_ASSERT(arrayType >= 0 && arrayType < Scalar::TypeMax); + MOZ_ASSERT(elements->type() == MIRType_Elements); + MOZ_ASSERT(length->type() == MIRType_Int32); + MOZ_ASSERT(index->type() == MIRType_Int32); + MOZ_ASSERT(arrayType >= 0 && arrayType < Scalar::TypeMax); } public: @@ -8094,8 +8094,8 @@ class MEffectiveAddress : public MBinaryInstruction MEffectiveAddress(MDefinition *base, MDefinition *index, Scale scale, int32_t displacement) : MBinaryInstruction(base, index), scale_(scale), displacement_(displacement) { - JS_ASSERT(base->type() == MIRType_Int32); - JS_ASSERT(index->type() == MIRType_Int32); + MOZ_ASSERT(base->type() == MIRType_Int32); + MOZ_ASSERT(index->type() == MIRType_Int32); setMovable(); setResultType(MIRType_Int32); } @@ -8279,7 +8279,7 @@ class InlinePropertyTable : public TempObject { } void setPriorResumePoint(MResumePoint *resumePoint) { - JS_ASSERT(priorResumePoint_ == nullptr); + MOZ_ASSERT(priorResumePoint_ == nullptr); priorResumePoint_ = resumePoint; } MResumePoint *takePriorResumePoint() { @@ -8301,12 +8301,12 @@ class InlinePropertyTable : public TempObject } types::TypeObject *getTypeObject(size_t i) const { - JS_ASSERT(i < numEntries()); + MOZ_ASSERT(i < numEntries()); return entries_[i]->typeObj; } JSFunction *getFunction(size_t i) const { - JS_ASSERT(i < numEntries()); + MOZ_ASSERT(i < numEntries()); return entries_[i]->func; } @@ -8369,7 +8369,7 @@ class MGetPropertyCache } InlinePropertyTable *initInlinePropertyTable(TempAllocator &alloc, jsbytecode *pc) { - JS_ASSERT(inlinePropertyTable_ == nullptr); + MOZ_ASSERT(inlinePropertyTable_ == nullptr); inlinePropertyTable_ = new(alloc) InlinePropertyTable(alloc, pc); return inlinePropertyTable_; } @@ -8579,7 +8579,7 @@ class MDispatchInstruction MUse operand_; void initOperand(size_t index, MDefinition *operand) { - JS_ASSERT(index == 0); + MOZ_ASSERT(index == 0); operand_.init(operand, this); } @@ -8592,32 +8592,32 @@ class MDispatchInstruction protected: MUse *getUseFor(size_t index) MOZ_FINAL MOZ_OVERRIDE { - JS_ASSERT(index == 0); + MOZ_ASSERT(index == 0); return &operand_; } const MUse *getUseFor(size_t index) const MOZ_FINAL MOZ_OVERRIDE { - JS_ASSERT(index == 0); + MOZ_ASSERT(index == 0); return &operand_; } MDefinition *getOperand(size_t index) const MOZ_FINAL MOZ_OVERRIDE { - JS_ASSERT(index == 0); + MOZ_ASSERT(index == 0); return operand_.producer(); } size_t numOperands() const MOZ_FINAL MOZ_OVERRIDE { return 1; } size_t indexOf(const MUse *u) const MOZ_FINAL MOZ_OVERRIDE { - JS_ASSERT(u == getUseFor(0)); + MOZ_ASSERT(u == getUseFor(0)); return 0; } void replaceOperand(size_t index, MDefinition *operand) MOZ_FINAL MOZ_OVERRIDE { - JS_ASSERT(index == 0); + MOZ_ASSERT(index == 0); operand_.replaceProducer(operand); } public: void setSuccessor(size_t i, MBasicBlock *successor) { - JS_ASSERT(i < numSuccessors()); + MOZ_ASSERT(i < numSuccessors()); if (i == map_.length()) fallback_ = successor; else @@ -8630,7 +8630,7 @@ class MDispatchInstruction setSuccessor(i, successor); } MBasicBlock *getSuccessor(size_t i) const MOZ_FINAL MOZ_OVERRIDE { - JS_ASSERT(i < numSuccessors()); + MOZ_ASSERT(i < numSuccessors()); if (i == map_.length()) return fallback_; return map_[i].block; @@ -8654,11 +8654,11 @@ class MDispatchInstruction return bool(fallback_); } void addFallback(MBasicBlock *block) { - JS_ASSERT(!hasFallback()); + MOZ_ASSERT(!hasFallback()); fallback_ = block; } MBasicBlock *getFallback() const { - JS_ASSERT(hasFallback()); + MOZ_ASSERT(hasFallback()); return fallback_; } @@ -9029,7 +9029,7 @@ class MLoadSlot { setResultType(MIRType_Value); setMovable(); - JS_ASSERT(slots->type() == MIRType_Slots); + MOZ_ASSERT(slots->type() == MIRType_Slots); } public: @@ -9058,7 +9058,7 @@ class MLoadSlot MDefinition *foldsTo(TempAllocator &alloc); AliasSet getAliasSet() const { - JS_ASSERT(slots()->type() == MIRType_Slots); + MOZ_ASSERT(slots()->type() == MIRType_Slots); return AliasSet::Load(AliasSet::DynamicSlot); } bool mightAlias(const MDefinition *store) const; @@ -9168,7 +9168,7 @@ class MStoreSlot slotType_(MIRType_Value), needsBarrier_(barrier) { - JS_ASSERT(slots->type() == MIRType_Slots); + MOZ_ASSERT(slots->type() == MIRType_Slots); } public: @@ -9198,7 +9198,7 @@ class MStoreSlot return slotType_; } void setSlotType(MIRType slotType) { - JS_ASSERT(slotType != MIRType_None); + MOZ_ASSERT(slotType != MIRType_None); slotType_ = slotType; } bool needsBarrier() const { @@ -9692,8 +9692,8 @@ class MGetDOMProperty MGetDOMProperty(const JSJitInfo *jitinfo, MDefinition *obj, MDefinition *guard) : info_(jitinfo) { - JS_ASSERT(jitinfo); - JS_ASSERT(jitinfo->type() == JSJitInfo::Getter); + MOZ_ASSERT(jitinfo); + MOZ_ASSERT(jitinfo->type() == JSJitInfo::Getter); initOperand(0, obj); @@ -9702,7 +9702,7 @@ class MGetDOMProperty // We are movable iff the jitinfo says we can be. if (isDomMovable()) { - JS_ASSERT(jitinfo->aliasSet() != JSJitInfo::AliasEverything); + MOZ_ASSERT(jitinfo->aliasSet() != JSJitInfo::AliasEverything); setMovable(); } else { // If we're not movable, that means we shouldn't be DCEd either, @@ -9770,7 +9770,7 @@ class MGetDOMProperty return AliasSet::None(); if (aliasSet == JSJitInfo::AliasDOMSets) return AliasSet::Load(AliasSet::DOMProperty); - JS_ASSERT(aliasSet == JSJitInfo::AliasEverything); + MOZ_ASSERT(aliasSet == JSJitInfo::AliasEverything); return AliasSet::Store(AliasSet::Any); } @@ -10103,9 +10103,9 @@ class MInArray { setResultType(MIRType_Boolean); setMovable(); - JS_ASSERT(elements->type() == MIRType_Elements); - JS_ASSERT(index->type() == MIRType_Int32); - JS_ASSERT(initLength->type() == MIRType_Int32); + MOZ_ASSERT(elements->type() == MIRType_Elements); + MOZ_ASSERT(index->type() == MIRType_Int32); + MOZ_ASSERT(initLength->type() == MIRType_Int32); } public: @@ -10756,7 +10756,7 @@ class MProfilerStackOp : public MNullaryInstruction MProfilerStackOp(JSScript *script, Type type) : script_(script), type_(type) { - JS_ASSERT(script); + MOZ_ASSERT(script); setGuard(); } @@ -10811,7 +10811,7 @@ class MNewDenseArrayPar : public MBinaryInstruction : MBinaryInstruction(cx, length), templateObject_(templateObject) { - JS_ASSERT(length->type() == MIRType_Int32); + MOZ_ASSERT(length->type() == MIRType_Int32); setResultType(MIRType_Object); } @@ -11056,7 +11056,7 @@ class MHasClass : MUnaryInstruction(object) , class_(clasp) { - JS_ASSERT(object->type() == MIRType_Object); + MOZ_ASSERT(object->type() == MIRType_Object); setResultType(MIRType_Boolean); setMovable(); } @@ -11210,7 +11210,7 @@ class MAsmJSLoadGlobalVar : public MNullaryInstruction MAsmJSLoadGlobalVar(MIRType type, unsigned globalDataOffset, bool isConstant) : globalDataOffset_(globalDataOffset), isConstant_(isConstant) { - JS_ASSERT(IsNumberType(type) || IsSimdType(type)); + MOZ_ASSERT(IsNumberType(type) || IsSimdType(type)); setResultType(type); setMovable(); } @@ -11399,9 +11399,9 @@ class MAsmJSCall MOZ_FINAL : public MVariadicInstruction explicit Callee(MDefinition *callee) : which_(Dynamic) { u.dynamic_ = callee; } explicit Callee(AsmJSImmKind callee) : which_(Builtin) { u.builtin_ = callee; } Which which() const { return which_; } - Label *internal() const { JS_ASSERT(which_ == Internal); return u.internal_; } - MDefinition *dynamic() const { JS_ASSERT(which_ == Dynamic); return u.dynamic_; } - AsmJSImmKind builtin() const { JS_ASSERT(which_ == Builtin); return u.builtin_; } + Label *internal() const { MOZ_ASSERT(which_ == Internal); return u.internal_; } + MDefinition *dynamic() const { MOZ_ASSERT(which_ == Dynamic); return u.dynamic_; } + AsmJSImmKind builtin() const { MOZ_ASSERT(which_ == Builtin); return u.builtin_; } }; private: @@ -11431,7 +11431,7 @@ class MAsmJSCall MOZ_FINAL : public MVariadicInstruction return argRegs_.length(); } AnyRegister registerForArg(size_t index) const { - JS_ASSERT(index < numArgs()); + MOZ_ASSERT(index < numArgs()); return argRegs_[index]; } const CallSiteDesc &desc() const { @@ -11441,8 +11441,8 @@ class MAsmJSCall MOZ_FINAL : public MVariadicInstruction return callee_; } size_t dynamicCalleeOperandIndex() const { - JS_ASSERT(callee_.which() == Callee::Dynamic); - JS_ASSERT(numArgs() == numOperands() - 1); + MOZ_ASSERT(callee_.which() == Callee::Dynamic); + MOZ_ASSERT(numArgs() == numOperands() - 1); return numArgs(); } size_t spIncrement() const { @@ -11512,30 +11512,30 @@ void MUse::releaseProducer() MDefinition *MNode::toDefinition() { - JS_ASSERT(isDefinition()); + MOZ_ASSERT(isDefinition()); return (MDefinition *)this; } MResumePoint *MNode::toResumePoint() { - JS_ASSERT(isResumePoint()); + MOZ_ASSERT(isResumePoint()); return (MResumePoint *)this; } MInstruction *MDefinition::toInstruction() { - JS_ASSERT(!isPhi()); + MOZ_ASSERT(!isPhi()); return (MInstruction *)this; } const MInstruction *MDefinition::toInstruction() const { - JS_ASSERT(!isPhi()); + MOZ_ASSERT(!isPhi()); return (const MInstruction *)this; } MControlInstruction *MDefinition::toControlInstruction() { - JS_ASSERT(isControlInstruction()); + MOZ_ASSERT(isControlInstruction()); return (MControlInstruction *)this; } diff --git a/js/src/jit/MIRGenerator.h b/js/src/jit/MIRGenerator.h index 52783a15fbe3..adf786400c49 100644 --- a/js/src/jit/MIRGenerator.h +++ b/js/src/jit/MIRGenerator.h @@ -122,17 +122,17 @@ class MIRGenerator } uint32_t maxAsmJSStackArgBytes() const { - JS_ASSERT(compilingAsmJS()); + MOZ_ASSERT(compilingAsmJS()); return maxAsmJSStackArgBytes_; } uint32_t resetAsmJSMaxStackArgBytes() { - JS_ASSERT(compilingAsmJS()); + MOZ_ASSERT(compilingAsmJS()); uint32_t old = maxAsmJSStackArgBytes_; maxAsmJSStackArgBytes_ = 0; return old; } void setAsmJSMaxStackArgBytes(uint32_t n) { - JS_ASSERT(compilingAsmJS()); + MOZ_ASSERT(compilingAsmJS()); maxAsmJSStackArgBytes_ = n; } void setPerformsCall() { @@ -145,7 +145,7 @@ class MIRGenerator // the value is cached, so don't worry about calling it several times. bool usesSimd(); void initMinAsmJSHeapLength(uint32_t len) { - JS_ASSERT(minAsmJSHeapLength_ == 0); + MOZ_ASSERT(minAsmJSHeapLength_ == 0); minAsmJSHeapLength_ = len; } uint32_t minAsmJSHeapLength() const { diff --git a/js/src/jit/MIRGraph.cpp b/js/src/jit/MIRGraph.cpp index a92a47372faa..93356b14625c 100644 --- a/js/src/jit/MIRGraph.cpp +++ b/js/src/jit/MIRGraph.cpp @@ -62,7 +62,7 @@ MIRGenerator::usesSimd() // induction, at least one instruction with a SIMD type is reached // at some point. if (IsSimdType(inst->type())) { - JS_ASSERT(SupportsSimd); + MOZ_ASSERT(SupportsSimd); usesSimd_ = true; return true; } @@ -104,7 +104,7 @@ MIRGenerator::addAbortedNewScriptPropertiesType(types::TypeObject *type) void MIRGraph::addBlock(MBasicBlock *block) { - JS_ASSERT(block); + MOZ_ASSERT(block); block->setId(blockIdGen_++); blocks_.pushBack(block); numBlocks_++; @@ -216,7 +216,7 @@ MIRGraph::forkJoinContext() // easier to keep the IR coherent. - nmatsakis MBasicBlock *entry = entryBlock(); - JS_ASSERT(entry->info().executionMode() == ParallelExecution); + MOZ_ASSERT(entry->info().executionMode() == ParallelExecution); MInstruction *start = nullptr; for (MInstructionIterator ins(entry->begin()); ins != entry->end(); ins++) { @@ -225,7 +225,7 @@ MIRGraph::forkJoinContext() else if (ins->isStart()) start = *ins; } - JS_ASSERT(start); + MOZ_ASSERT(start); MForkJoinContext *cx = MForkJoinContext::New(alloc()); entry->insertAfter(start, cx); @@ -236,7 +236,7 @@ MBasicBlock * MBasicBlock::New(MIRGraph &graph, BytecodeAnalysis *analysis, CompileInfo &info, MBasicBlock *pred, const BytecodeSite &site, Kind kind) { - JS_ASSERT(site.pc() != nullptr); + MOZ_ASSERT(site.pc() != nullptr); MBasicBlock *block = new(graph.alloc()) MBasicBlock(graph, info, site, kind); if (!block->init()) @@ -289,7 +289,7 @@ MBasicBlock::NewPendingLoopHeader(MIRGraph &graph, CompileInfo &info, MBasicBlock *pred, const BytecodeSite &site, unsigned stackPhiCount) { - JS_ASSERT(site.pc() != nullptr); + MOZ_ASSERT(site.pc() != nullptr); MBasicBlock *block = new(graph.alloc()) MBasicBlock(graph, info, site, PENDING_LOOP_HEADER); if (!block->init()) @@ -332,7 +332,7 @@ MBasicBlock::NewAsmJS(MIRGraph &graph, CompileInfo &info, MBasicBlock *pred, Kin for (size_t i = 0; i < nphis; i++) { MDefinition *predSlot = pred->getSlot(i); - JS_ASSERT(predSlot->type() != MIRType_Value); + MOZ_ASSERT(predSlot->type() != MIRType_Value); MPhi *phi = new(phis + i) MPhi(alloc, predSlot->type()); JS_ALWAYS_TRUE(phi->reserveLength(2)); @@ -405,7 +405,7 @@ MBasicBlock::ensureHasSlots(size_t num) void MBasicBlock::copySlots(MBasicBlock *from) { - JS_ASSERT(stackPosition_ <= from->stackPosition_); + MOZ_ASSERT(stackPosition_ <= from->stackPosition_); for (uint32_t i = 0; i < stackPosition_; i++) slots_[i] = from->slots_[i]; @@ -417,19 +417,19 @@ MBasicBlock::inherit(TempAllocator &alloc, BytecodeAnalysis *analysis, MBasicBlo { if (pred) { stackPosition_ = pred->stackPosition_; - JS_ASSERT(stackPosition_ >= popped); + MOZ_ASSERT(stackPosition_ >= popped); stackPosition_ -= popped; if (kind_ != PENDING_LOOP_HEADER) copySlots(pred); } else { uint32_t stackDepth = analysis->info(pc()).stackDepth; stackPosition_ = info().firstStackSlot() + stackDepth; - JS_ASSERT(stackPosition_ >= popped); + MOZ_ASSERT(stackPosition_ >= popped); stackPosition_ -= popped; } - JS_ASSERT(info_.nslots() >= stackPosition_); - JS_ASSERT(!entryResumePoint_); + MOZ_ASSERT(info_.nslots() >= stackPosition_); + MOZ_ASSERT(!entryResumePoint_); // Propagate the caller resume point from the inherited block. MResumePoint *callerResumePoint = pred ? pred->callerResumePoint() : nullptr; @@ -454,8 +454,8 @@ MBasicBlock::inherit(TempAllocator &alloc, BytecodeAnalysis *analysis, MBasicBlo entryResumePoint()->initOperand(i, phi); } - JS_ASSERT(stackPhiCount <= stackDepth()); - JS_ASSERT(info().firstStackSlot() <= stackDepth() - stackPhiCount); + MOZ_ASSERT(stackPhiCount <= stackDepth()); + MOZ_ASSERT(info().firstStackSlot() <= stackDepth() - stackPhiCount); // Avoid creating new phis for stack values that aren't part of the // loop. Note that for loop headers that can OSR, all values on the @@ -498,9 +498,9 @@ MBasicBlock::inheritResumePoint(MBasicBlock *pred) for (uint32_t i = 0; i < stackPosition_; i++) slots_[i] = entryResumePoint_->getOperand(i); - JS_ASSERT(info_.nslots() >= stackPosition_); - JS_ASSERT(kind_ != PENDING_LOOP_HEADER); - JS_ASSERT(pred != nullptr); + MOZ_ASSERT(info_.nslots() >= stackPosition_); + MOZ_ASSERT(kind_ != PENDING_LOOP_HEADER); + MOZ_ASSERT(pred != nullptr); if (!predecessors_.append(pred)) return false; @@ -532,7 +532,7 @@ MBasicBlock::initEntrySlots(TempAllocator &alloc) MDefinition * MBasicBlock::getSlot(uint32_t index) { - JS_ASSERT(index < stackPosition_); + MOZ_ASSERT(index < stackPosition_); return slots_[index]; } @@ -550,8 +550,8 @@ MBasicBlock::shimmySlots(int discardDepth) // Move all slots above the given depth down by one, // overwriting the MDefinition at discardDepth. - JS_ASSERT(discardDepth < 0); - JS_ASSERT(stackPosition_ + discardDepth >= info_.firstStackSlot()); + MOZ_ASSERT(discardDepth < 0); + MOZ_ASSERT(stackPosition_ + discardDepth >= info_.firstStackSlot()); for (int i = discardDepth; i < -1; i++) slots_[stackPosition_ + i] = slots_[stackPosition_ + i + 1]; @@ -562,7 +562,7 @@ MBasicBlock::shimmySlots(int discardDepth) void MBasicBlock::linkOsrValues(MStart *start) { - JS_ASSERT(start->startType() == MStart::StartType_Osr); + MOZ_ASSERT(start->startType() == MStart::StartType_Osr); MResumePoint *res = start->resumePoint(); @@ -576,13 +576,13 @@ MBasicBlock::linkOsrValues(MStart *start) if (def->isOsrReturnValue()) cloneRp = def->toOsrReturnValue(); } else if (info().hasArguments() && i == info().argsObjSlot()) { - JS_ASSERT(def->isConstant() || def->isOsrArgumentsObject()); + MOZ_ASSERT(def->isConstant() || def->isOsrArgumentsObject()); JS_ASSERT_IF(def->isConstant(), def->toConstant()->value() == UndefinedValue()); if (def->isOsrArgumentsObject()) cloneRp = def->toOsrArgumentsObject(); } else { - JS_ASSERT(def->isOsrValue() || def->isGetArgumentsObjectArg() || def->isConstant() || - def->isParameter()); + MOZ_ASSERT(def->isOsrValue() || def->isGetArgumentsObjectArg() || def->isConstant() || + def->isParameter()); // A constant Undefined can show up here for an argument slot when the function uses // a heavyweight argsobj, but the argument in question is stored on the scope chain. @@ -610,7 +610,7 @@ MBasicBlock::setSlot(uint32_t slot, MDefinition *ins) void MBasicBlock::setVariable(uint32_t index) { - JS_ASSERT(stackPosition_ > info_.firstStackSlot()); + MOZ_ASSERT(stackPosition_ > info_.firstStackSlot()); setSlot(index, slots_[stackPosition_ - 1]); } @@ -641,15 +641,15 @@ MBasicBlock::rewriteSlot(uint32_t slot, MDefinition *ins) void MBasicBlock::rewriteAtDepth(int32_t depth, MDefinition *ins) { - JS_ASSERT(depth < 0); - JS_ASSERT(stackPosition_ + depth >= info_.firstStackSlot()); + MOZ_ASSERT(depth < 0); + MOZ_ASSERT(stackPosition_ + depth >= info_.firstStackSlot()); rewriteSlot(stackPosition_ + depth, ins); } void MBasicBlock::push(MDefinition *ins) { - JS_ASSERT(stackPosition_ < nslots()); + MOZ_ASSERT(stackPosition_ < nslots()); slots_[stackPosition_++] = ins; } @@ -680,15 +680,15 @@ MBasicBlock::pushSlot(uint32_t slot) MDefinition * MBasicBlock::pop() { - JS_ASSERT(stackPosition_ > info_.firstStackSlot()); + MOZ_ASSERT(stackPosition_ > info_.firstStackSlot()); return slots_[--stackPosition_]; } void MBasicBlock::popn(uint32_t n) { - JS_ASSERT(stackPosition_ - n >= info_.firstStackSlot()); - JS_ASSERT(stackPosition_ >= stackPosition_ - n); + MOZ_ASSERT(stackPosition_ - n >= info_.firstStackSlot()); + MOZ_ASSERT(stackPosition_ >= stackPosition_ - n); stackPosition_ -= n; } @@ -742,8 +742,8 @@ MBasicBlock::swapAt(int32_t depth) MDefinition * MBasicBlock::peek(int32_t depth) { - JS_ASSERT(depth < 0); - JS_ASSERT(stackPosition_ + depth >= info_.firstStackSlot()); + MOZ_ASSERT(depth < 0); + MOZ_ASSERT(stackPosition_ + depth >= info_.firstStackSlot()); return getSlot(stackPosition_ + depth); } @@ -756,7 +756,7 @@ MBasicBlock::discardLastIns() void MBasicBlock::addFromElsewhere(MInstruction *ins) { - JS_ASSERT(ins->block() != this); + MOZ_ASSERT(ins->block() != this); // Remove |ins| from its containing block. ins->block()->instructions_.remove(ins); @@ -769,7 +769,7 @@ void MBasicBlock::moveBefore(MInstruction *at, MInstruction *ins) { // Remove |ins| from the current block. - JS_ASSERT(ins->block() == this); + MOZ_ASSERT(ins->block() == this); instructions_.remove(ins); // Insert into new block, which may be distinct. @@ -928,7 +928,7 @@ MBasicBlock::discardAllResumePoints(bool discardEntry) void MBasicBlock::insertBefore(MInstruction *at, MInstruction *ins) { - JS_ASSERT(at->block() == this); + MOZ_ASSERT(at->block() == this); ins->setBlock(this); graph().allocDefinitionId(ins); instructions_.insertBefore(at, ins); @@ -938,7 +938,7 @@ MBasicBlock::insertBefore(MInstruction *at, MInstruction *ins) void MBasicBlock::insertAfter(MInstruction *at, MInstruction *ins) { - JS_ASSERT(at->block() == this); + MOZ_ASSERT(at->block() == this); ins->setBlock(this); graph().allocDefinitionId(ins); instructions_.insertAfter(at, ins); @@ -957,7 +957,7 @@ MBasicBlock::insertAtEnd(MInstruction *ins) void MBasicBlock::add(MInstruction *ins) { - JS_ASSERT(!hasLastIns()); + MOZ_ASSERT(!hasLastIns()); ins->setBlock(this); graph().allocDefinitionId(ins); instructions_.pushBack(ins); @@ -967,8 +967,8 @@ MBasicBlock::add(MInstruction *ins) void MBasicBlock::end(MControlInstruction *ins) { - JS_ASSERT(!hasLastIns()); // Existing control instructions should be removed first. - JS_ASSERT(ins); + MOZ_ASSERT(!hasLastIns()); // Existing control instructions should be removed first. + MOZ_ASSERT(ins); add(ins); } @@ -983,7 +983,7 @@ MBasicBlock::addPhi(MPhi *phi) MPhiIterator MBasicBlock::discardPhiAt(MPhiIterator &at) { - JS_ASSERT(!phis_.empty()); + MOZ_ASSERT(!phis_.empty()); at->removeAllOperands(); at->setDiscarded(); @@ -1036,12 +1036,12 @@ MBasicBlock::addPredecessor(TempAllocator &alloc, MBasicBlock *pred) bool MBasicBlock::addPredecessorPopN(TempAllocator &alloc, MBasicBlock *pred, uint32_t popped) { - JS_ASSERT(pred); - JS_ASSERT(predecessors_.length() > 0); + MOZ_ASSERT(pred); + MOZ_ASSERT(predecessors_.length() > 0); // Predecessors must be finished, and at the correct stack depth. - JS_ASSERT(pred->hasLastIns()); - JS_ASSERT(pred->stackPosition_ == stackPosition_ + popped); + MOZ_ASSERT(pred->hasLastIns()); + MOZ_ASSERT(pred->stackPosition_ == stackPosition_ + popped); for (uint32_t i = 0; i < stackPosition_; i++) { MDefinition *mine = getSlot(i); @@ -1052,7 +1052,7 @@ MBasicBlock::addPredecessorPopN(TempAllocator &alloc, MBasicBlock *pred, uint32_ // basic block, then we have already placed this phi and should // instead append to its operands. if (mine->isPhi() && mine->block() == this) { - JS_ASSERT(predecessors_.length()); + MOZ_ASSERT(predecessors_.length()); if (!mine->toPhi()->addInputSlow(other)) return false; } else { @@ -1070,7 +1070,7 @@ MBasicBlock::addPredecessorPopN(TempAllocator &alloc, MBasicBlock *pred, uint32_ return false; for (size_t j = 0; j < predecessors_.length(); j++) { - JS_ASSERT(predecessors_[j]->getSlot(i) == mine); + MOZ_ASSERT(predecessors_[j]->getSlot(i) == mine); phi->addInput(mine); } phi->addInput(other); @@ -1088,12 +1088,12 @@ MBasicBlock::addPredecessorPopN(TempAllocator &alloc, MBasicBlock *pred, uint32_ void MBasicBlock::addPredecessorSameInputsAs(MBasicBlock *pred, MBasicBlock *existingPred) { - JS_ASSERT(pred); - JS_ASSERT(predecessors_.length() > 0); + MOZ_ASSERT(pred); + MOZ_ASSERT(predecessors_.length() > 0); // Predecessors must be finished, and at the correct stack depth. - JS_ASSERT(pred->hasLastIns()); - JS_ASSERT(!pred->successorWithPhis()); + MOZ_ASSERT(pred->hasLastIns()); + MOZ_ASSERT(!pred->successorWithPhis()); if (!phisEmpty()) { size_t existingPosition = indexForPredecessor(existingPred); @@ -1111,7 +1111,7 @@ bool MBasicBlock::addPredecessorWithoutPhis(MBasicBlock *pred) { // Predecessors must be finished. - JS_ASSERT(pred && pred->hasLastIns()); + MOZ_ASSERT(pred && pred->hasLastIns()); return predecessors_.append(pred); } @@ -1150,12 +1150,12 @@ AbortReason MBasicBlock::setBackedge(MBasicBlock *pred) { // Predecessors must be finished, and at the correct stack depth. - JS_ASSERT(hasLastIns()); - JS_ASSERT(pred->hasLastIns()); - JS_ASSERT(pred->stackDepth() == entryResumePoint()->stackDepth()); + MOZ_ASSERT(hasLastIns()); + MOZ_ASSERT(pred->hasLastIns()); + MOZ_ASSERT(pred->stackDepth() == entryResumePoint()->stackDepth()); // We must be a pending loop header - JS_ASSERT(kind_ == PENDING_LOOP_HEADER); + MOZ_ASSERT(kind_ == PENDING_LOOP_HEADER); bool hadTypeChange = false; @@ -1182,12 +1182,12 @@ bool MBasicBlock::setBackedgeAsmJS(MBasicBlock *pred) { // Predecessors must be finished, and at the correct stack depth. - JS_ASSERT(hasLastIns()); - JS_ASSERT(pred->hasLastIns()); - JS_ASSERT(stackDepth() == pred->stackDepth()); + MOZ_ASSERT(hasLastIns()); + MOZ_ASSERT(pred->hasLastIns()); + MOZ_ASSERT(stackDepth() == pred->stackDepth()); // We must be a pending loop header - JS_ASSERT(kind_ == PENDING_LOOP_HEADER); + MOZ_ASSERT(kind_ == PENDING_LOOP_HEADER); // Add exit definitions to each corresponding phi at the entry. // Note: Phis are inserted in the same order as the slots. (see @@ -1198,11 +1198,11 @@ MBasicBlock::setBackedgeAsmJS(MBasicBlock *pred) MDefinition *exitDef = pred->getSlot(slot); // Assert that we already placed phis for each slot. - JS_ASSERT(entryDef->block() == this); + MOZ_ASSERT(entryDef->block() == this); // Assert that the phi already has the correct type. - JS_ASSERT(entryDef->type() == exitDef->type()); - JS_ASSERT(entryDef->type() != MIRType_Value); + MOZ_ASSERT(entryDef->type() == exitDef->type()); + MOZ_ASSERT(entryDef->type() != MIRType_Value); if (entryDef == exitDef) { // If the exit def is the same as the entry def, make a redundant @@ -1231,7 +1231,7 @@ MBasicBlock::setBackedgeAsmJS(MBasicBlock *pred) void MBasicBlock::clearLoopHeader() { - JS_ASSERT(isLoopHeader()); + MOZ_ASSERT(isLoopHeader()); kind_ = NORMAL; } @@ -1276,21 +1276,21 @@ MBasicBlock::setLoopHeader(MBasicBlock *newBackedge) size_t MBasicBlock::numSuccessors() const { - JS_ASSERT(lastIns()); + MOZ_ASSERT(lastIns()); return lastIns()->numSuccessors(); } MBasicBlock * MBasicBlock::getSuccessor(size_t index) const { - JS_ASSERT(lastIns()); + MOZ_ASSERT(lastIns()); return lastIns()->getSuccessor(index); } size_t MBasicBlock::getSuccessorIndex(MBasicBlock *block) const { - JS_ASSERT(lastIns()); + MOZ_ASSERT(lastIns()); for (size_t i = 0; i < numSuccessors(); i++) { if (getSuccessor(i) == block) return i; @@ -1311,7 +1311,7 @@ MBasicBlock::getPredecessorIndex(MBasicBlock *block) const void MBasicBlock::replaceSuccessor(size_t pos, MBasicBlock *split) { - JS_ASSERT(lastIns()); + MOZ_ASSERT(lastIns()); // Note, during split-critical-edges, successors-with-phis is not yet set. // During PAA, this case is handled before we enter. @@ -1330,7 +1330,7 @@ MBasicBlock::replacePredecessor(MBasicBlock *old, MBasicBlock *split) #ifdef DEBUG // The same block should not appear twice in the predecessor list. for (size_t j = i; j < numPredecessors(); j++) - JS_ASSERT(predecessors_[j] != old); + MOZ_ASSERT(predecessors_[j] != old); #endif return; @@ -1359,7 +1359,7 @@ MBasicBlock::removePredecessorWithoutPhiOperands(MBasicBlock *pred, size_t predI // Don't adjust successorWithPhis() if we haven't constructed this // information yet. if (pred->successorWithPhis()) { - JS_ASSERT(pred->positionInPhiSuccessor() == predIndex); + MOZ_ASSERT(pred->positionInPhiSuccessor() == predIndex); pred->setSuccessorWithPhis(nullptr, 0); for (size_t j = predIndex+1; j < numPredecessors(); j++) getPredecessor(j)->setSuccessorWithPhis(this, j - 1); @@ -1505,7 +1505,7 @@ MBasicBlock::immediateDominatorBranch(BranchDirection *pdirection) if (ins->isTest()) { MTest *test = ins->toTest(); - JS_ASSERT(test->ifTrue() == this || test->ifFalse() == this); + MOZ_ASSERT(test->ifTrue() == this || test->ifFalse() == this); if (test->ifTrue() == this && test->ifFalse() == this) return nullptr; diff --git a/js/src/jit/MIRGraph.h b/js/src/jit/MIRGraph.h index db128334ff1f..f551b1694e53 100644 --- a/js/src/jit/MIRGraph.h +++ b/js/src/jit/MIRGraph.h @@ -130,7 +130,7 @@ class MBasicBlock : public TempObject, public InlineListNode // Mark this block (and only this block) as unreachable. void setUnreachable() { - JS_ASSERT(!unreachable_); + MOZ_ASSERT(!unreachable_); setUnreachableUnchecked(); } void setUnreachableUnchecked() { @@ -342,7 +342,7 @@ class MBasicBlock : public TempObject, public InlineListNode } uint32_t domIndex() const { - JS_ASSERT(!isDead()); + MOZ_ASSERT(!isDead()); return domIndex_; } void setDomIndex(uint32_t d) { @@ -354,7 +354,7 @@ class MBasicBlock : public TempObject, public InlineListNode } size_t indexForPredecessor(MBasicBlock *block) const { // This should only be called before critical edge splitting. - JS_ASSERT(!block->successorWithPhis()); + MOZ_ASSERT(!block->successorWithPhis()); for (size_t i = 0; i < predecessors_.length(); i++) { if (predecessors_[i] == block) @@ -366,7 +366,7 @@ class MBasicBlock : public TempObject, public InlineListNode return !instructions_.empty() && instructions_.rbegin()->isControlInstruction(); } MControlInstruction *lastIns() const { - JS_ASSERT(hasLastIns()); + MOZ_ASSERT(hasLastIns()); return instructions_.rbegin()->toControlInstruction(); } MPhiIterator phisBegin() const { @@ -396,7 +396,7 @@ class MBasicBlock : public TempObject, public InlineListNode return instructions_.begin(); } MInstructionIterator begin(MInstruction *at) { - JS_ASSERT(at->block() == this); + MOZ_ASSERT(at->block() == this); return instructions_.begin(at); } MInstructionIterator end() { @@ -406,7 +406,7 @@ class MBasicBlock : public TempObject, public InlineListNode return instructions_.rbegin(); } MInstructionReverseIterator rbegin(MInstruction *at) { - JS_ASSERT(at->block() == this); + MOZ_ASSERT(at->block() == this); return instructions_.rbegin(at); } MInstructionReverseIterator rend() { @@ -416,20 +416,20 @@ class MBasicBlock : public TempObject, public InlineListNode return kind_ == LOOP_HEADER; } bool hasUniqueBackedge() const { - JS_ASSERT(isLoopHeader()); - JS_ASSERT(numPredecessors() >= 2); + MOZ_ASSERT(isLoopHeader()); + MOZ_ASSERT(numPredecessors() >= 2); return numPredecessors() == 2; } MBasicBlock *backedge() const { - JS_ASSERT(hasUniqueBackedge()); + MOZ_ASSERT(hasUniqueBackedge()); return getPredecessor(numPredecessors() - 1); } MBasicBlock *loopHeaderOfBackedge() const { - JS_ASSERT(isLoopBackedge()); + MOZ_ASSERT(isLoopBackedge()); return getSuccessor(numSuccessors() - 1); } MBasicBlock *loopPredecessor() const { - JS_ASSERT(isLoopHeader()); + MOZ_ASSERT(isLoopHeader()); return getPredecessor(0); } bool isLoopBackedge() const { @@ -497,7 +497,7 @@ class MBasicBlock : public TempObject, public InlineListNode // Return the number of blocks dominated by this block. All blocks // dominate at least themselves, so this will always be non-zero. size_t numDominated() const { - JS_ASSERT(numDominated_ != 0); + MOZ_ASSERT(numDominated_ != 0); return numDominated_; } @@ -543,7 +543,7 @@ class MBasicBlock : public TempObject, public InlineListNode return entryResumePoint()->numOperands(); } MDefinition *getEntrySlot(size_t i) const { - JS_ASSERT(i < numEntrySlots()); + MOZ_ASSERT(i < numEntrySlots()); return entryResumePoint()->getOperand(i); } @@ -551,7 +551,7 @@ class MBasicBlock : public TempObject, public InlineListNode return lir_; } void assignLir(LBlock *lir) { - JS_ASSERT(!lir_); + MOZ_ASSERT(!lir_); lir_ = lir; } @@ -590,7 +590,7 @@ class MBasicBlock : public TempObject, public InlineListNode // Track bailouts by storing the current pc in MIR instruction added at this // cycle. This is also used for tracking calls when profiling. void updateTrackedSite(const BytecodeSite &site) { - JS_ASSERT(site.tree() == trackedSite_.tree()); + MOZ_ASSERT(site.tree() == trackedSite_.tree()); trackedSite_ = site; } const BytecodeSite &trackedSite() const { @@ -745,12 +745,12 @@ class MIRGraph void removeBlock(MBasicBlock *block); void removeBlockIncludingPhis(MBasicBlock *block); void moveBlockToEnd(MBasicBlock *block) { - JS_ASSERT(block->id()); + MOZ_ASSERT(block->id()); blocks_.remove(block); blocks_.pushBack(block); } void moveBlockBefore(MBasicBlock *at, MBasicBlock *block) { - JS_ASSERT(block->id()); + MOZ_ASSERT(block->id()); blocks_.remove(block); blocks_.insertBefore(at, block); } @@ -777,7 +777,7 @@ class MIRGraph } void setOsrBlock(MBasicBlock *osrBlock) { - JS_ASSERT(!osrBlock_); + MOZ_ASSERT(!osrBlock_); osrBlock_ = osrBlock; } MBasicBlock *osrBlock() { diff --git a/js/src/jit/MoveResolver.cpp b/js/src/jit/MoveResolver.cpp index 13f7bf91f7b6..8ff02c6d9c01 100644 --- a/js/src/jit/MoveResolver.cpp +++ b/js/src/jit/MoveResolver.cpp @@ -26,7 +26,7 @@ bool MoveResolver::addMove(const MoveOperand &from, const MoveOperand &to, MoveOp::Type type) { // Assert that we're not doing no-op moves. - JS_ASSERT(!(from == to)); + MOZ_ASSERT(!(from == to)); PendingMove *pm = movePool_.allocate(); if (!pm) return false; diff --git a/js/src/jit/MoveResolver.h b/js/src/jit/MoveResolver.h index fc431e1ff47c..545e9bb53134 100644 --- a/js/src/jit/MoveResolver.h +++ b/js/src/jit/MoveResolver.h @@ -47,7 +47,7 @@ class MoveOperand code_(reg.code()), disp_(disp) { - JS_ASSERT(isMemoryOrEffectiveAddress()); + MOZ_ASSERT(isMemoryOrEffectiveAddress()); // With a zero offset, this is a plain reg-to-reg move. if (disp == 0 && kind_ == EFFECTIVE_ADDRESS) @@ -74,19 +74,19 @@ class MoveOperand return isMemory() || isEffectiveAddress(); } Register reg() const { - JS_ASSERT(isGeneralReg()); + MOZ_ASSERT(isGeneralReg()); return Register::FromCode(code_); } FloatRegister floatReg() const { - JS_ASSERT(isFloatReg()); + MOZ_ASSERT(isFloatReg()); return FloatRegister::FromCode(code_); } Register base() const { - JS_ASSERT(isMemoryOrEffectiveAddress()); + MOZ_ASSERT(isMemoryOrEffectiveAddress()); return Register::FromCode(code_); } int32_t disp() const { - JS_ASSERT(isMemoryOrEffectiveAddress()); + MOZ_ASSERT(isMemoryOrEffectiveAddress()); return disp_; } @@ -194,7 +194,7 @@ class MoveOp return type_; } Type endCycleType() const { - JS_ASSERT(isCycleBegin()); + MOZ_ASSERT(isCycleBegin()); return endCycleType_; } }; @@ -214,13 +214,13 @@ class MoveResolver { } void setCycleBegin(Type endCycleType, int cycleSlot) { - JS_ASSERT(!cycleBegin_); + MOZ_ASSERT(!cycleBegin_); cycleBegin_ = true; cycleBeginSlot_ = cycleSlot; endCycleType_ = endCycleType; } void setCycleEnd(int cycleSlot) { - JS_ASSERT(!cycleEnd_); + MOZ_ASSERT(!cycleEnd_); cycleEnd_ = true; cycleEndSlot_ = cycleSlot; } diff --git a/js/src/jit/ParallelFunctions.cpp b/js/src/jit/ParallelFunctions.cpp index 159d66e64d00..92d4287ebdab 100644 --- a/js/src/jit/ParallelFunctions.cpp +++ b/js/src/jit/ParallelFunctions.cpp @@ -39,7 +39,7 @@ jit::ForkJoinContextPar() JSObject * jit::NewGCThingPar(ForkJoinContext *cx, gc::AllocKind allocKind) { - JS_ASSERT(ForkJoinContext::current() == cx); + MOZ_ASSERT(ForkJoinContext::current() == cx); #ifdef JSGC_FJGENERATIONAL return js::NewGCObject(cx, allocKind, 0, gc::DefaultHeap); #else @@ -89,7 +89,7 @@ jit::ParallelWriteGuard(ForkJoinContext *cx, JSObject *object) // (which is a span of bytes within the output buffer) and not // just the output buffer itself. - JS_ASSERT(ForkJoinContext::current() == cx); + MOZ_ASSERT(ForkJoinContext::current() == cx); if (object->is()) { TypedObject &typedObj = object->as(); @@ -122,7 +122,7 @@ jit::ParallelWriteGuard(ForkJoinContext *cx, JSObject *object) bool jit::IsInTargetRegion(ForkJoinContext *cx, TypedObject *typedObj) { - JS_ASSERT(typedObj->is()); // in case JIT supplies something bogus + MOZ_ASSERT(typedObj->is()); // in case JIT supplies something bogus uint8_t *typedMem = typedObj->typedMem(); return typedMem >= cx->targetRegionStart && typedMem < cx->targetRegionEnd; @@ -131,7 +131,7 @@ jit::IsInTargetRegion(ForkJoinContext *cx, TypedObject *typedObj) bool jit::CheckOverRecursedPar(ForkJoinContext *cx) { - JS_ASSERT(ForkJoinContext::current() == cx); + MOZ_ASSERT(ForkJoinContext::current() == cx); int stackDummy_; // In PJS, unlike sequential execution, we don't overwrite the stack limit @@ -156,7 +156,7 @@ jit::CheckOverRecursedPar(ForkJoinContext *cx) bool jit::InterruptCheckPar(ForkJoinContext *cx) { - JS_ASSERT(ForkJoinContext::current() == cx); + MOZ_ASSERT(ForkJoinContext::current() == cx); bool result = cx->check(); if (!result) { cx->bailoutRecord->joinCause(ParallelBailoutInterrupt); @@ -179,12 +179,12 @@ bool jit::SetPropertyPar(ForkJoinContext *cx, HandleObject obj, HandlePropertyName name, HandleValue value, bool strict, jsbytecode *pc) { - JS_ASSERT(cx->isThreadLocal(obj)); + MOZ_ASSERT(cx->isThreadLocal(obj)); if (*pc == JSOP_SETALIASEDVAR) { // See comment in jit::SetProperty. Shape *shape = obj->nativeLookupPure(name); - JS_ASSERT(shape && shape->hasSlot()); + MOZ_ASSERT(shape && shape->hasSlot()); return obj->nativeSetSlotIfHasType(shape, value); } @@ -246,7 +246,7 @@ JSString * jit::PrimitiveToStringPar(ForkJoinContext *cx, HandleValue input) { // All other cases are handled in assembly. - JS_ASSERT(input.isDouble() || input.isInt32()); + MOZ_ASSERT(input.isDouble() || input.isInt32()); if (input.isInt32()) return Int32ToString(cx, input.toInt32()); @@ -579,7 +579,7 @@ jit::CallToUncompiledScriptPar(ForkJoinContext *cx, JSObject *obj) Spew(SpewBailouts, "Call to bound function (excessive depth: %d)", depth); } } else { - JS_ASSERT(func->isNative()); + MOZ_ASSERT(func->isNative()); Spew(SpewBailouts, "Call to native function"); } #endif @@ -594,10 +594,10 @@ jit::InitRestParameterPar(ForkJoinContext *cx, uint32_t length, Value *rest, // In parallel execution, we should always have succeeded in allocation // before this point. We can do the allocation here like in the sequential // path, but duplicating the initGCThing logic is too tedious. - JS_ASSERT(res); - JS_ASSERT(res->is()); - JS_ASSERT(!res->getDenseInitializedLength()); - JS_ASSERT(res->type() == templateObj->type()); + MOZ_ASSERT(res); + MOZ_ASSERT(res->is()); + MOZ_ASSERT(!res->getDenseInitializedLength()); + MOZ_ASSERT(res->type() == templateObj->type()); if (length > 0) { JSObject::EnsureDenseResult edr = diff --git a/js/src/jit/ParallelSafetyAnalysis.cpp b/js/src/jit/ParallelSafetyAnalysis.cpp index b502c67c7d6e..ee7db6c891a0 100644 --- a/js/src/jit/ParallelSafetyAnalysis.cpp +++ b/js/src/jit/ParallelSafetyAnalysis.cpp @@ -81,7 +81,7 @@ class ParallelSafetyVisitor : public MDefinitionVisitor // markUnsafe()". Sets the unsafe flag and returns true (since // this does not indicate an unrecoverable compilation failure). bool markUnsafe() { - JS_ASSERT(!unsafe_); + MOZ_ASSERT(!unsafe_); unsafe_ = true; return true; } @@ -450,8 +450,8 @@ ParallelSafetyVisitor::convertToBailout(MInstructionIterator &iter) // We expect iter to be settled on the unsafe instruction. MInstruction *ins = *iter; MBasicBlock *block = ins->block(); - JS_ASSERT(unsafe()); // `block` must have contained unsafe items - JS_ASSERT(block->isMarked()); // `block` must have been reachable to get here + MOZ_ASSERT(unsafe()); // `block` must have contained unsafe items + MOZ_ASSERT(block->isMarked()); // `block` must have been reachable to get here clearUnsafe(); @@ -610,7 +610,7 @@ ParallelSafetyVisitor::replace(MInstruction *oldInstruction, { replacementInstruction->trySpecializeFloat32(alloc()); } - JS_ASSERT(oldInstruction->type() == replacementInstruction->type()); + MOZ_ASSERT(oldInstruction->type() == replacementInstruction->type()); return true; } @@ -779,7 +779,7 @@ bool ParallelSafetyVisitor::visitThrow(MThrow *thr) { MBasicBlock *block = thr->block(); - JS_ASSERT(block->lastIns() == thr); + MOZ_ASSERT(block->lastIns() == thr); MBail *bail = MBail::New(alloc(), Bailout_ParallelUnsafe); TransplantResumePoint(thr, bail); block->discardLastIns(); diff --git a/js/src/jit/PerfSpewer.cpp b/js/src/jit/PerfSpewer.cpp index 30139d8f46f1..5472a89e38fb 100644 --- a/js/src/jit/PerfSpewer.cpp +++ b/js/src/jit/PerfSpewer.cpp @@ -61,7 +61,7 @@ openPerfMap(const char *dir) if (snprintf(filenameBuffer, bufferSize, "%sperf-%d.map", dir, getpid()) >= bufferSize) return false; - JS_ASSERT(!PerfFilePtr); + MOZ_ASSERT(!PerfFilePtr); PerfFilePtr = fopen(filenameBuffer, "a"); if (!PerfFilePtr) @@ -118,13 +118,13 @@ js::jit::CheckPerf() { bool js::jit::PerfBlockEnabled() { - JS_ASSERT(PerfMode); + MOZ_ASSERT(PerfMode); return PerfMode == PERF_MODE_BLOCK; } bool js::jit::PerfFuncEnabled() { - JS_ASSERT(PerfMode); + MOZ_ASSERT(PerfMode); return PerfMode == PERF_MODE_FUNC; } @@ -136,14 +136,14 @@ lockPerfMap(void) PR_Lock(PerfMutex); - JS_ASSERT(PerfFilePtr); + MOZ_ASSERT(PerfFilePtr); return true; } static void unlockPerfMap() { - JS_ASSERT(PerfFilePtr); + MOZ_ASSERT(PerfFilePtr); fflush(PerfFilePtr); PR_Unlock(PerfMutex); } @@ -240,7 +240,7 @@ PerfSpewer::writeProfile(JSScript *script, uintptr_t blockStart = funcStart + masm.actualOffset(r.start.offset()); uintptr_t blockEnd = funcStart + masm.actualOffset(r.end.offset()); - JS_ASSERT(cur <= blockStart); + MOZ_ASSERT(cur <= blockStart); if (cur < blockStart) { fprintf(PerfFilePtr, "%zx %zx %s:%zu: Func%02d-Block?\n", static_cast(cur), @@ -260,7 +260,7 @@ PerfSpewer::writeProfile(JSScript *script, } } - JS_ASSERT(cur <= funcEndInlineCode); + MOZ_ASSERT(cur <= funcEndInlineCode); if (cur < funcEndInlineCode) { fprintf(PerfFilePtr, "%zx %zx %s:%zu: Func%02d-Epilogue\n", cur, funcEndInlineCode - cur, @@ -268,7 +268,7 @@ PerfSpewer::writeProfile(JSScript *script, thisFunctionIndex); } - JS_ASSERT(funcEndInlineCode <= funcEnd); + MOZ_ASSERT(funcEndInlineCode <= funcEnd); if (funcEndInlineCode < funcEnd) { fprintf(PerfFilePtr, "%zx %zx %s:%zu: Func%02d-OOL\n", funcEndInlineCode, funcEnd - funcEndInlineCode, @@ -388,7 +388,7 @@ js::jit::writePerfSpewerAsmJSBlocksMap(uintptr_t baseAddress, size_t funcStartOf size_t blockStart = baseAddress + r.startOffset; size_t blockEnd = baseAddress + r.endOffset; - JS_ASSERT(cur <= blockStart); + MOZ_ASSERT(cur <= blockStart); if (cur < blockStart) { fprintf(PerfFilePtr, "%zx %zx %s: Function %s - unknown block\n", cur, blockStart - cur, @@ -406,12 +406,12 @@ js::jit::writePerfSpewerAsmJSBlocksMap(uintptr_t baseAddress, size_t funcStartOf } } - JS_ASSERT(cur <= funcEndInlineCode); + MOZ_ASSERT(cur <= funcEndInlineCode); if (cur < funcEndInlineCode) fprintf(PerfFilePtr, "%zx %zx %s: Function %s - Epilogue\n", cur, funcEndInlineCode - cur, filename, funcName); - JS_ASSERT(funcEndInlineCode <= funcEnd); + MOZ_ASSERT(funcEndInlineCode <= funcEnd); if (funcEndInlineCode < funcEnd) { fprintf(PerfFilePtr, "%zx %zx %s: Function %s - OOL\n", funcEndInlineCode, funcEnd - funcEndInlineCode, filename, funcName); diff --git a/js/src/jit/RangeAnalysis.cpp b/js/src/jit/RangeAnalysis.cpp index 12024d358df3..ba390ceef4d2 100644 --- a/js/src/jit/RangeAnalysis.cpp +++ b/js/src/jit/RangeAnalysis.cpp @@ -210,7 +210,7 @@ RangeAnalysis::addBetaNodes() // At this point, one of the operands if the compare is a constant, and // val is the other operand. - JS_ASSERT(val); + MOZ_ASSERT(val); Range comp; switch (jsop) { @@ -641,8 +641,8 @@ Range::sub(TempAllocator &alloc, const Range *lhs, const Range *rhs) Range * Range::and_(TempAllocator &alloc, const Range *lhs, const Range *rhs) { - JS_ASSERT(lhs->isInt32()); - JS_ASSERT(rhs->isInt32()); + MOZ_ASSERT(lhs->isInt32()); + MOZ_ASSERT(rhs->isInt32()); // If both numbers can be negative, result can be negative in the whole range if (lhs->lower() < 0 && rhs->lower() < 0) @@ -668,8 +668,8 @@ Range::and_(TempAllocator &alloc, const Range *lhs, const Range *rhs) Range * Range::or_(TempAllocator &alloc, const Range *lhs, const Range *rhs) { - JS_ASSERT(lhs->isInt32()); - JS_ASSERT(rhs->isInt32()); + MOZ_ASSERT(lhs->isInt32()); + MOZ_ASSERT(rhs->isInt32()); // When one operand is always 0 or always -1, it's a special case where we // can compute a fully precise result. Handling these up front also // protects the code below from calling CountLeadingZeroes32 with a zero @@ -725,8 +725,8 @@ Range::or_(TempAllocator &alloc, const Range *lhs, const Range *rhs) Range * Range::xor_(TempAllocator &alloc, const Range *lhs, const Range *rhs) { - JS_ASSERT(lhs->isInt32()); - JS_ASSERT(rhs->isInt32()); + MOZ_ASSERT(lhs->isInt32()); + MOZ_ASSERT(rhs->isInt32()); int32_t lhsLower = lhs->lower(); int32_t lhsUpper = lhs->upper(); int32_t rhsLower = rhs->lower(); @@ -789,7 +789,7 @@ Range::xor_(TempAllocator &alloc, const Range *lhs, const Range *rhs) Range * Range::not_(TempAllocator &alloc, const Range *op) { - JS_ASSERT(op->isInt32()); + MOZ_ASSERT(op->isInt32()); return Range::NewInt32Range(alloc, ~op->upper(), ~op->lower()); } @@ -831,7 +831,7 @@ Range::mul(TempAllocator &alloc, const Range *lhs, const Range *rhs) Range * Range::lsh(TempAllocator &alloc, const Range *lhs, int32_t c) { - JS_ASSERT(lhs->isInt32()); + MOZ_ASSERT(lhs->isInt32()); int32_t shift = c & 0x1f; // If the shift doesn't loose bits or shift bits into the sign bit, we @@ -850,7 +850,7 @@ Range::lsh(TempAllocator &alloc, const Range *lhs, int32_t c) Range * Range::rsh(TempAllocator &alloc, const Range *lhs, int32_t c) { - JS_ASSERT(lhs->isInt32()); + MOZ_ASSERT(lhs->isInt32()); int32_t shift = c & 0x1f; return Range::NewInt32Range(alloc, lhs->lower() >> shift, @@ -863,7 +863,7 @@ Range::ursh(TempAllocator &alloc, const Range *lhs, int32_t c) // ursh's left operand is uint32, not int32, but for range analysis we // currently approximate it as int32. We assume here that the range has // already been adjusted accordingly by our callers. - JS_ASSERT(lhs->isInt32()); + MOZ_ASSERT(lhs->isInt32()); int32_t shift = c & 0x1f; @@ -882,16 +882,16 @@ Range::ursh(TempAllocator &alloc, const Range *lhs, int32_t c) Range * Range::lsh(TempAllocator &alloc, const Range *lhs, const Range *rhs) { - JS_ASSERT(lhs->isInt32()); - JS_ASSERT(rhs->isInt32()); + MOZ_ASSERT(lhs->isInt32()); + MOZ_ASSERT(rhs->isInt32()); return Range::NewInt32Range(alloc, INT32_MIN, INT32_MAX); } Range * Range::rsh(TempAllocator &alloc, const Range *lhs, const Range *rhs) { - JS_ASSERT(lhs->isInt32()); - JS_ASSERT(rhs->isInt32()); + MOZ_ASSERT(lhs->isInt32()); + MOZ_ASSERT(rhs->isInt32()); return Range::NewInt32Range(alloc, Min(lhs->lower(), 0), Max(lhs->upper(), 0)); } @@ -901,8 +901,8 @@ Range::ursh(TempAllocator &alloc, const Range *lhs, const Range *rhs) // ursh's left operand is uint32, not int32, but for range analysis we // currently approximate it as int32. We assume here that the range has // already been adjusted accordingly by our callers. - JS_ASSERT(lhs->isInt32()); - JS_ASSERT(rhs->isInt32()); + MOZ_ASSERT(lhs->isInt32()); + MOZ_ASSERT(rhs->isInt32()); return Range::NewUInt32Range(alloc, 0, lhs->isFiniteNonNegative() ? lhs->upper() : UINT32_MAX); } @@ -1199,7 +1199,7 @@ MUrsh::computeRange(TempAllocator &alloc) setRange(Range::ursh(alloc, &left, c)); } - JS_ASSERT(range()->lower() >= 0); + MOZ_ASSERT(range()->lower() >= 0); } void @@ -1332,7 +1332,7 @@ MMod::computeRange(TempAllocator &alloc) // The result will never be equal to the rhs, and we shouldn't have // any rounding to worry about. - JS_ASSERT(!lhs.canHaveFractionalPart() && !rhs.canHaveFractionalPart()); + MOZ_ASSERT(!lhs.canHaveFractionalPart() && !rhs.canHaveFractionalPart()); --rhsBound; // This gives us two upper bounds, so we can take the best one. @@ -1392,7 +1392,7 @@ MDiv::computeRange(TempAllocator &alloc) } else if (unsigned_ && rhs.lower() >= 1) { // We shouldn't set the unsigned flag if the inputs can have // fractional parts. - JS_ASSERT(!lhs.canHaveFractionalPart() && !rhs.canHaveFractionalPart()); + MOZ_ASSERT(!lhs.canHaveFractionalPart() && !rhs.canHaveFractionalPart()); // Unsigned division by a non-zero rhs will return a uint32 value. setRange(Range::NewUInt32Range(alloc, 0, UINT32_MAX)); } @@ -1490,7 +1490,7 @@ MLoadTypedArrayElementStatic::computeRange(TempAllocator &alloc) { // We don't currently use MLoadTypedArrayElementStatic for uint32, so we // don't have to worry about it returning a value outside our type. - JS_ASSERT(AnyTypedArrayType(someTypedArray_) != Scalar::Uint32); + MOZ_ASSERT(AnyTypedArrayType(someTypedArray_) != Scalar::Uint32); setRange(GetTypedArrayRange(alloc, AnyTypedArrayType(someTypedArray_))); } @@ -1590,7 +1590,7 @@ MRandom::computeRange(TempAllocator &alloc) bool RangeAnalysis::analyzeLoop(MBasicBlock *header) { - JS_ASSERT(header->hasUniqueBackedge()); + MOZ_ASSERT(header->hasUniqueBackedge()); // Try to compute an upper bound on the number of times the loop backedge // will be taken. Look for tests that dominate the backedge and which have @@ -1823,7 +1823,7 @@ RangeAnalysis::analyzeLoopPhi(MBasicBlock *header, LoopIterationBound *loopBound // but is required to change at most N and be either nondecreasing or // nonincreasing. - JS_ASSERT(phi->numOperands() == 2); + MOZ_ASSERT(phi->numOperands() == 2); MDefinition *initial = phi->getLoopPredecessorOperand(); if (initial->block()->isMarked()) @@ -1923,7 +1923,7 @@ RangeAnalysis::tryHoistBoundsCheck(MBasicBlock *header, MBoundsCheck *ins) return false; MBasicBlock *preLoop = header->loopPredecessor(); - JS_ASSERT(!preLoop->isMarked()); + MOZ_ASSERT(!preLoop->isMarked()); MDefinition *lowerTerm = ConvertLinearSum(alloc(), preLoop, lower->sum); if (!lowerTerm) @@ -1979,7 +1979,7 @@ RangeAnalysis::analyze() for (ReversePostorderIterator iter(graph_.rpoBegin()); iter != graph_.rpoEnd(); iter++) { MBasicBlock *block = *iter; - JS_ASSERT(!block->unreachable()); + MOZ_ASSERT(!block->unreachable()); // If the block's immediate dominator is unreachable, the block is // unreachable. Iterating in RPO, we'll always see the immediate @@ -2283,7 +2283,7 @@ MMod::truncate(TruncateKind kind) bool MToDouble::truncate(TruncateKind kind) { - JS_ASSERT(type() == MIRType_Double); + MOZ_ASSERT(type() == MIRType_Double); setTruncateKind(kind); @@ -2479,7 +2479,7 @@ TruncateTest(TempAllocator &alloc, MTest *test) inner = MToInt32::New(alloc, inner); block->insertBefore(block->lastIns(), inner->toInstruction()); } - JS_ASSERT(inner->type() == MIRType_Int32); + MOZ_ASSERT(inner->type() == MIRType_Int32); phi->replaceOperand(i, inner); } @@ -2552,8 +2552,8 @@ RemoveTruncatesOnOutput(MDefinition *truncated) if (truncated->isCompare()) return; - JS_ASSERT(truncated->type() == MIRType_Int32); - JS_ASSERT(Range(truncated).isInt32()); + MOZ_ASSERT(truncated->type() == MIRType_Int32); + MOZ_ASSERT(Range(truncated).isInt32()); for (MUseDefIterator use(truncated); use; use++) { MDefinition *def = use.def(); @@ -2578,7 +2578,7 @@ AdjustTruncatedInputs(TempAllocator &alloc, MDefinition *truncated) continue; if (input->isToDouble() && input->getOperand(0)->type() == MIRType_Int32) { - JS_ASSERT(input->range()->isInt32()); + MOZ_ASSERT(input->range()->isInt32()); truncated->replaceOperand(i, input->getOperand(0)); } else { MInstruction *op; @@ -2879,7 +2879,7 @@ RangeAnalysis::prepareForUCE(bool *shouldRemoveDeadCode) if (block == test->ifTrue()) { constant = MConstant::New(alloc(), BooleanValue(false)); } else { - JS_ASSERT(block == test->ifFalse()); + MOZ_ASSERT(block == test->ifFalse()); constant = MConstant::New(alloc(), BooleanValue(true)); } test->block()->insertBefore(test, constant); diff --git a/js/src/jit/RangeAnalysis.h b/js/src/jit/RangeAnalysis.h index b0f4f6375916..903d5ad0226c 100644 --- a/js/src/jit/RangeAnalysis.h +++ b/js/src/jit/RangeAnalysis.h @@ -202,7 +202,7 @@ class Range : public TempObject { // consistency of this range. void assertInvariants() const { // Basic sanity :). - JS_ASSERT(lower_ <= upper_); + MOZ_ASSERT(lower_ <= upper_); // When hasInt32LowerBound_ or hasInt32UpperBound_ are false, we set // lower_ and upper_ to these specific values as it simplifies the @@ -211,9 +211,9 @@ class Range : public TempObject { JS_ASSERT_IF(!hasInt32UpperBound_, upper_ == JSVAL_INT_MAX); // max_exponent_ must be one of three possible things. - JS_ASSERT(max_exponent_ <= MaxFiniteExponent || - max_exponent_ == IncludesInfinity || - max_exponent_ == IncludesInfinityAndNaN); + MOZ_ASSERT(max_exponent_ <= MaxFiniteExponent || + max_exponent_ == IncludesInfinity || + max_exponent_ == IncludesInfinityAndNaN); // Forbid the max_exponent_ field from implying better bounds for // lower_/upper_ fields. We have to add 1 to the max_exponent_ when @@ -225,17 +225,17 @@ class Range : public TempObject { // of 0 but requires upper_ to be at least 2, which has exponent 1. JS_ASSERT_IF(!hasInt32LowerBound_ || !hasInt32UpperBound_, max_exponent_ + canHaveFractionalPart_ >= MaxInt32Exponent); - JS_ASSERT(max_exponent_ + canHaveFractionalPart_ >= - mozilla::FloorLog2(mozilla::Abs(upper_))); - JS_ASSERT(max_exponent_ + canHaveFractionalPart_ >= - mozilla::FloorLog2(mozilla::Abs(lower_))); + MOZ_ASSERT(max_exponent_ + canHaveFractionalPart_ >= + mozilla::FloorLog2(mozilla::Abs(upper_))); + MOZ_ASSERT(max_exponent_ + canHaveFractionalPart_ >= + mozilla::FloorLog2(mozilla::Abs(lower_))); // The following are essentially static assertions, but FloorLog2 isn't // trivially suitable for constexpr :(. - JS_ASSERT(mozilla::FloorLog2(JSVAL_INT_MIN) == MaxInt32Exponent); - JS_ASSERT(mozilla::FloorLog2(JSVAL_INT_MAX) == 30); - JS_ASSERT(mozilla::FloorLog2(UINT32_MAX) == MaxUInt32Exponent); - JS_ASSERT(mozilla::FloorLog2(0) == 0); + MOZ_ASSERT(mozilla::FloorLog2(JSVAL_INT_MIN) == MaxInt32Exponent); + MOZ_ASSERT(mozilla::FloorLog2(JSVAL_INT_MAX) == 30); + MOZ_ASSERT(mozilla::FloorLog2(UINT32_MAX) == MaxUInt32Exponent); + MOZ_ASSERT(mozilla::FloorLog2(0) == 0); } // Set the lower_ and hasInt32LowerBound_ values. @@ -275,7 +275,7 @@ class Range : public TempObject { // The number of bits needed to encode |max| is the power of 2 plus one. uint32_t max = Max(mozilla::Abs(lower()), mozilla::Abs(upper())); uint16_t result = mozilla::FloorLog2(max); - JS_ASSERT(result == (max == 0 ? 0 : mozilla::ExponentComponent(double(max)))); + MOZ_ASSERT(result == (max == 0 ? 0 : mozilla::ExponentComponent(double(max)))); return result; } @@ -494,7 +494,7 @@ class Range : public TempObject { } uint16_t exponent() const { - JS_ASSERT(!canBeInfiniteOrNaN()); + MOZ_ASSERT(!canBeInfiniteOrNaN()); return max_exponent_; } @@ -504,13 +504,13 @@ class Range : public TempObject { // Return the lower bound. Asserts that the value has an int32 bound. int32_t lower() const { - JS_ASSERT(hasInt32LowerBound()); + MOZ_ASSERT(hasInt32LowerBound()); return lower_; } // Return the upper bound. Asserts that the value has an int32 bound. int32_t upper() const { - JS_ASSERT(hasInt32UpperBound()); + MOZ_ASSERT(hasInt32UpperBound()); return upper_; } @@ -566,7 +566,7 @@ class Range : public TempObject { void setUnknown() { set(NoInt32LowerBound, NoInt32UpperBound, true, IncludesInfinityAndNaN); - JS_ASSERT(isUnknown()); + MOZ_ASSERT(isUnknown()); } void set(int64_t l, int64_t h, bool f, uint16_t e) { diff --git a/js/src/jit/RegisterAllocator.cpp b/js/src/jit/RegisterAllocator.cpp index 27892b0c0a53..591d41bc687b 100644 --- a/js/src/jit/RegisterAllocator.cpp +++ b/js/src/jit/RegisterAllocator.cpp @@ -27,7 +27,7 @@ AllocationIntegrityState::record() for (size_t i = 0; i < graph.numBlocks(); i++) { blocks.infallibleAppend(BlockInfo()); LBlock *block = graph.getBlock(i); - JS_ASSERT(block->mir()->id() == i); + MOZ_ASSERT(block->mir()->id() == i); BlockInfo &blockInfo = blocks[i]; if (!blockInfo.phis.reserve(block->numPhis())) @@ -37,7 +37,7 @@ AllocationIntegrityState::record() blockInfo.phis.infallibleAppend(InstructionInfo()); InstructionInfo &info = blockInfo.phis[j]; LPhi *phi = block->getPhi(j); - JS_ASSERT(phi->numDefs() == 1); + MOZ_ASSERT(phi->numDefs() == 1); uint32_t vreg = phi->getDef(0)->virtualRegister(); virtualRegisters[vreg] = phi->getDef(0); if (!info.outputs.append(*phi->getDef(0))) @@ -81,7 +81,7 @@ AllocationIntegrityState::record() bool AllocationIntegrityState::check(bool populateSafepoints) { - JS_ASSERT(!instructions.empty()); + MOZ_ASSERT(!instructions.empty()); #ifdef DEBUG if (JitSpewEnabled(JitSpew_RegAlloc)) @@ -95,11 +95,11 @@ AllocationIntegrityState::check(bool populateSafepoints) LInstruction *ins = *iter; for (LInstruction::InputIterator alloc(*ins); alloc.more(); alloc.next()) - JS_ASSERT(!alloc->isUse()); + MOZ_ASSERT(!alloc->isUse()); for (size_t i = 0; i < ins->numDefs(); i++) { LDefinition *def = ins->getDef(i); - JS_ASSERT(!def->output()->isUse()); + MOZ_ASSERT(!def->output()->isUse()); LDefinition oldDef = instructions[ins->id()].outputs[i]; JS_ASSERT_IF(oldDef.policy() == LDefinition::MUST_REUSE_INPUT, @@ -209,19 +209,19 @@ AllocationIntegrityState::checkIntegrity(LBlock *block, LInstruction *ins, if (def->isBogusTemp()) continue; if (info.outputs[i].virtualRegister() == vreg) { - JS_ASSERT(*def->output() == alloc); + MOZ_ASSERT(*def->output() == alloc); // Found the original definition, done scanning. return true; } else { - JS_ASSERT(*def->output() != alloc); + MOZ_ASSERT(*def->output() != alloc); } } for (size_t i = 0; i < ins->numTemps(); i++) { LDefinition *temp = ins->getTemp(i); if (!temp->isBogusTemp()) - JS_ASSERT(*temp->output() != alloc); + MOZ_ASSERT(*temp->output() != alloc); } if (ins->safepoint()) { @@ -265,7 +265,7 @@ AllocationIntegrityState::checkSafepointAllocation(LInstruction *ins, bool populateSafepoints) { LSafepoint *safepoint = ins->safepoint(); - JS_ASSERT(safepoint); + MOZ_ASSERT(safepoint); if (ins->isCall() && alloc.isRegister()) return true; @@ -275,7 +275,7 @@ AllocationIntegrityState::checkSafepointAllocation(LInstruction *ins, if (populateSafepoints) safepoint->addLiveRegister(reg); - JS_ASSERT(safepoint->liveRegs().has(reg)); + MOZ_ASSERT(safepoint->liveRegs().has(reg)); } LDefinition::Type type = virtualRegisters[vreg] @@ -290,7 +290,7 @@ AllocationIntegrityState::checkSafepointAllocation(LInstruction *ins, if (!safepoint->addGcPointer(alloc)) return false; } - JS_ASSERT(safepoint->hasGcPointer(alloc)); + MOZ_ASSERT(safepoint->hasGcPointer(alloc)); break; case LDefinition::SLOTS: if (populateSafepoints) { @@ -299,7 +299,7 @@ AllocationIntegrityState::checkSafepointAllocation(LInstruction *ins, if (!safepoint->addSlotsOrElementsPointer(alloc)) return false; } - JS_ASSERT(safepoint->hasSlotsOrElementsPointer(alloc)); + MOZ_ASSERT(safepoint->hasSlotsOrElementsPointer(alloc)); break; #ifdef JS_NUNBOX32 // Do not assert that safepoint information for nunbox types is complete, @@ -321,7 +321,7 @@ AllocationIntegrityState::checkSafepointAllocation(LInstruction *ins, if (!safepoint->addNunboxPayload(vreg, alloc)) return false; } - JS_ASSERT(safepoint->hasNunboxPayload(alloc)); + MOZ_ASSERT(safepoint->hasNunboxPayload(alloc)); break; #else case LDefinition::BOX: @@ -331,7 +331,7 @@ AllocationIntegrityState::checkSafepointAllocation(LInstruction *ins, if (!safepoint->addBoxedValue(alloc)) return false; } - JS_ASSERT(safepoint->hasBoxedValue(alloc)); + MOZ_ASSERT(safepoint->hasBoxedValue(alloc)); break; #endif default: @@ -488,8 +488,8 @@ LMoveGroup * RegisterAllocator::getInputMoveGroup(uint32_t ins) { InstructionData *data = &insData[ins]; - JS_ASSERT(!data->ins()->isPhi()); - JS_ASSERT(!data->ins()->isLabel()); + MOZ_ASSERT(!data->ins()->isPhi()); + MOZ_ASSERT(!data->ins()->isLabel()); if (data->inputMoves()) return data->inputMoves(); @@ -505,7 +505,7 @@ LMoveGroup * RegisterAllocator::getMoveGroupAfter(uint32_t ins) { InstructionData *data = &insData[ins]; - JS_ASSERT(!data->ins()->isPhi()); + MOZ_ASSERT(!data->ins()->isPhi()); if (data->movesAfter()) return data->movesAfter(); diff --git a/js/src/jit/RegisterAllocator.h b/js/src/jit/RegisterAllocator.h index 1c528f6b0035..083bc84baf7c 100644 --- a/js/src/jit/RegisterAllocator.h +++ b/js/src/jit/RegisterAllocator.h @@ -161,8 +161,8 @@ class CodePosition { } CodePosition(uint32_t instruction, SubPosition where) { - JS_ASSERT(instruction < 0x80000000u); - JS_ASSERT(((uint32_t)where & SUBPOSITION_MASK) == (uint32_t)where); + MOZ_ASSERT(instruction < 0x80000000u); + MOZ_ASSERT(((uint32_t)where & SUBPOSITION_MASK) == (uint32_t)where); bits_ = (instruction << INSTRUCTION_SHIFT) | (uint32_t)where; } @@ -203,16 +203,16 @@ class CodePosition } uint32_t operator -(CodePosition other) const { - JS_ASSERT(bits_ >= other.bits_); + MOZ_ASSERT(bits_ >= other.bits_); return bits_ - other.bits_; } CodePosition previous() const { - JS_ASSERT(*this != MIN); + MOZ_ASSERT(*this != MIN); return CodePosition(bits_ - 1); } CodePosition next() const { - JS_ASSERT(*this != MAX); + MOZ_ASSERT(*this != MAX); return CodePosition(bits_ + 1); } }; @@ -227,8 +227,8 @@ class InstructionData public: void init(LInstruction *ins, LBlock *block) { - JS_ASSERT(!ins_); - JS_ASSERT(!block_); + MOZ_ASSERT(!ins_); + MOZ_ASSERT(!block_); ins_ = ins; block_ = block; } diff --git a/js/src/jit/RegisterSets.h b/js/src/jit/RegisterSets.h index 4e0dbf47e2cb..0ccdf7065004 100644 --- a/js/src/jit/RegisterSets.h +++ b/js/src/jit/RegisterSets.h @@ -35,7 +35,7 @@ struct AnyRegister { code_ = fpu.code() + Registers::Total; } static AnyRegister FromCode(uint32_t i) { - JS_ASSERT(i < Total); + MOZ_ASSERT(i < Total); AnyRegister r; r.code_ = i; return r; @@ -44,11 +44,11 @@ struct AnyRegister { return code_ >= Registers::Total; } Register gpr() const { - JS_ASSERT(!isFloat()); + MOZ_ASSERT(!isFloat()); return Register::FromCode(code_); } FloatRegister fpu() const { - JS_ASSERT(isFloat()); + MOZ_ASSERT(isFloat()); return FloatRegister::FromCode(code_ - Registers::Total); } bool operator ==(AnyRegister other) const { @@ -172,20 +172,20 @@ class TypedOrValueRegister } data; AnyRegister &dataTyped() { - JS_ASSERT(hasTyped()); + MOZ_ASSERT(hasTyped()); return *data.typed.addr(); } ValueOperand &dataValue() { - JS_ASSERT(hasValue()); + MOZ_ASSERT(hasValue()); return *data.value.addr(); } AnyRegister dataTyped() const { - JS_ASSERT(hasTyped()); + MOZ_ASSERT(hasTyped()); return *data.typed.addr(); } const ValueOperand &dataValue() const { - JS_ASSERT(hasValue()); + MOZ_ASSERT(hasValue()); return *data.value.addr(); } @@ -247,11 +247,11 @@ class ConstantOrRegister } data; Value &dataValue() { - JS_ASSERT(constant()); + MOZ_ASSERT(constant()); return *data.constant.addr(); } TypedOrValueRegister &dataReg() { - JS_ASSERT(!constant()); + MOZ_ASSERT(!constant()); return *data.reg.addr(); } @@ -301,15 +301,15 @@ struct Int32Key { { } inline void bumpConstant(int diff) { - JS_ASSERT(!isRegister_); + MOZ_ASSERT(!isRegister_); constant_ += diff; } inline Register reg() const { - JS_ASSERT(isRegister_); + MOZ_ASSERT(isRegister_); return reg_; } inline int32_t constant() const { - JS_ASSERT(!isRegister_); + MOZ_ASSERT(!isRegister_); return constant_; } inline bool isRegister() const { @@ -389,7 +389,7 @@ class TypedRegisterSet for (uint32_t a = 0; a < reg.numAliased(); a++) { T tmp; reg.aliased(a, &tmp); - JS_ASSERT(!has(tmp)); + MOZ_ASSERT(!has(tmp)); } #endif addUnchecked(reg); @@ -415,7 +415,7 @@ class TypedRegisterSet return !bits_; } void take(T reg) { - JS_ASSERT(has(reg)); + MOZ_ASSERT(has(reg)); takeUnchecked(reg); } void takeUnchecked(T reg) { @@ -466,27 +466,27 @@ class TypedRegisterSet return getFirst(); } T getAnyExcluding(T preclude) { - JS_ASSERT(!empty()); + MOZ_ASSERT(!empty()); if (!has(preclude)) return getAny(); take(preclude); - JS_ASSERT(!empty()); + MOZ_ASSERT(!empty()); T result = getAny(); add(preclude); return result; } T getFirst() const { - JS_ASSERT(!empty()); + MOZ_ASSERT(!empty()); return T::FromCode(T::FirstBit(bits_)); } T getLast() const { - JS_ASSERT(!empty()); + MOZ_ASSERT(!empty()); int ireg = T::LastBit(bits_); return T::FromCode(ireg); } T takeAny() { - JS_ASSERT(!empty()); + MOZ_ASSERT(!empty()); T reg = getAny(); take(reg); return reg; @@ -509,13 +509,13 @@ class TypedRegisterSet #endif } T takeFirst() { - JS_ASSERT(!empty()); + MOZ_ASSERT(!empty()); T reg = getFirst(); take(reg); return reg; } T takeLast() { - JS_ASSERT(!empty()); + MOZ_ASSERT(!empty()); T reg = getLast(); take(reg); return reg; @@ -865,9 +865,9 @@ class ABIArg explicit ABIArg(uint32_t offset) : kind_(Stack) { u.offset_ = offset; } Kind kind() const { return kind_; } - Register gpr() const { JS_ASSERT(kind() == GPR); return Register::FromCode(u.gpr_); } - FloatRegister fpu() const { JS_ASSERT(kind() == FPU); return FloatRegister::FromCode(u.fpu_); } - uint32_t offsetFromArgBase() const { JS_ASSERT(kind() == Stack); return u.offset_; } + Register gpr() const { MOZ_ASSERT(kind() == GPR); return Register::FromCode(u.gpr_); } + FloatRegister fpu() const { MOZ_ASSERT(kind() == FPU); return FloatRegister::FromCode(u.fpu_); } + uint32_t offsetFromArgBase() const { MOZ_ASSERT(kind() == Stack); return u.offset_; } bool argInRegister() const { return kind() != Stack; } AnyRegister reg() const { return kind_ == GPR ? AnyRegister(gpr()) : AnyRegister(fpu()); } diff --git a/js/src/jit/Registers.h b/js/src/jit/Registers.h index e8ba494c4d09..219c473556e8 100644 --- a/js/src/jit/Registers.h +++ b/js/src/jit/Registers.h @@ -33,7 +33,7 @@ struct Register { typedef Codes::SetType SetType; Code code_; static Register FromCode(uint32_t i) { - JS_ASSERT(i < Registers::Total); + MOZ_ASSERT(i < Registers::Total); Register r = { (Registers::Code)i }; return r; } @@ -43,7 +43,7 @@ struct Register { return r; } Code code() const { - JS_ASSERT((uint32_t)code_ < Registers::Total); + MOZ_ASSERT((uint32_t)code_ < Registers::Total); return code_; } const char *name() const { @@ -69,7 +69,7 @@ struct Register { // miscompiled it on win64 when the value was simply returned. This // now has an explicit outparam for compatability. void aliased(uint32_t aliasIdx, Register *ret) const { - JS_ASSERT(aliasIdx == 0); + MOZ_ASSERT(aliasIdx == 0); *ret = *this; } static uint32_t SetSize(SetType x) { diff --git a/js/src/jit/RematerializedFrame.cpp b/js/src/jit/RematerializedFrame.cpp index 9e6408397b9c..7e5562f9c70e 100644 --- a/js/src/jit/RematerializedFrame.cpp +++ b/js/src/jit/RematerializedFrame.cpp @@ -103,7 +103,7 @@ RematerializedFrame::MarkInVector(JSTracer *trc, Vector & CallObject & RematerializedFrame::callObj() const { - JS_ASSERT(hasCallObj()); + MOZ_ASSERT(hasCallObj()); JSObject *scope = scopeChain(); while (!scope->is()) diff --git a/js/src/jit/RematerializedFrame.h b/js/src/jit/RematerializedFrame.h index 7c075d7e0117..5cf62d357667 100644 --- a/js/src/jit/RematerializedFrame.h +++ b/js/src/jit/RematerializedFrame.h @@ -146,24 +146,24 @@ class RematerializedFrame Value &unaliasedVar(unsigned i, MaybeCheckAliasing checkAliasing = CHECK_ALIASING) { JS_ASSERT_IF(checkAliasing, !script()->varIsAliased(i)); - JS_ASSERT(i < script()->nfixed()); + MOZ_ASSERT(i < script()->nfixed()); return locals()[i]; } Value &unaliasedLocal(unsigned i, MaybeCheckAliasing checkAliasing = CHECK_ALIASING) { - JS_ASSERT(i < script()->nfixed()); + MOZ_ASSERT(i < script()->nfixed()); #ifdef DEBUG CheckLocalUnaliased(checkAliasing, script(), i); #endif return locals()[i]; } Value &unaliasedFormal(unsigned i, MaybeCheckAliasing checkAliasing = CHECK_ALIASING) { - JS_ASSERT(i < numFormalArgs()); + MOZ_ASSERT(i < numFormalArgs()); JS_ASSERT_IF(checkAliasing, !script()->argsObjAliasesFormals() && !script()->formalIsAliased(i)); return argv()[i]; } Value &unaliasedActual(unsigned i, MaybeCheckAliasing checkAliasing = CHECK_ALIASING) { - JS_ASSERT(i < numActualArgs()); + MOZ_ASSERT(i < numActualArgs()); JS_ASSERT_IF(checkAliasing, !script()->argsObjAliasesFormals()); JS_ASSERT_IF(checkAliasing && i < numFormalArgs(), !script()->formalIsAliased(i)); return argv()[i]; diff --git a/js/src/jit/Safepoints.cpp b/js/src/jit/Safepoints.cpp index 1e68387a7307..c3f5796b62cd 100644 --- a/js/src/jit/Safepoints.cpp +++ b/js/src/jit/Safepoints.cpp @@ -65,7 +65,7 @@ WriteFloatRegisterMask(CompactBufferWriter &stream, uint64_t bits) } else if (sizeof(FloatRegisters::SetType) == 4) { stream.writeUnsigned(bits); } else { - JS_ASSERT(sizeof(FloatRegisters::SetType) == 8); + MOZ_ASSERT(sizeof(FloatRegisters::SetType) == 8); stream.writeUnsigned(bits & 0xffffffff); stream.writeUnsigned(bits >> 32); } @@ -78,7 +78,7 @@ ReadFloatRegisterMask(CompactBufferReader &stream) return stream.readByte(); if (sizeof(FloatRegisters::SetType) <= 4) return stream.readUnsigned(); - JS_ASSERT(sizeof(FloatRegisters::SetType) == 8); + MOZ_ASSERT(sizeof(FloatRegisters::SetType) == 8); uint64_t ret = stream.readUnsigned(); ret |= uint64_t(stream.readUnsigned()) << 32; return ret; @@ -105,8 +105,8 @@ SafepointWriter::writeGcRegs(LSafepoint *safepoint) } // GC registers are a subset of the spilled registers. - JS_ASSERT((valueRegs.bits() & ~spilledGpr.bits()) == 0); - JS_ASSERT((gc.bits() & ~spilledGpr.bits()) == 0); + MOZ_ASSERT((valueRegs.bits() & ~spilledGpr.bits()) == 0); + MOZ_ASSERT((gc.bits() & ~spilledGpr.bits()) == 0); WriteFloatRegisterMask(stream_, spilledFloat.bits()); @@ -138,8 +138,8 @@ MapSlotsToBitset(BitSet *set, CompactBufferWriter &stream, uint32_t nslots, uint // pointer size, since we only care about pointer-sized/aligned slots // here. Since the stack grows down, this means slots start at index 1, // so we subtract 1 to pack the bitset. - JS_ASSERT(slots[i] % sizeof(intptr_t) == 0); - JS_ASSERT(slots[i] / sizeof(intptr_t) > 0); + MOZ_ASSERT(slots[i] % sizeof(intptr_t) == 0); + MOZ_ASSERT(slots[i] / sizeof(intptr_t) > 0); set->insert(slots[i] / sizeof(intptr_t) - 1); } @@ -251,7 +251,7 @@ AllocationToPartKind(const LAllocation &a) return Part_Reg; if (a.isStackSlot()) return Part_Stack; - JS_ASSERT(a.isArgument()); + MOZ_ASSERT(a.isArgument()); return Part_Arg; } @@ -337,7 +337,7 @@ SafepointWriter::writeNunboxParts(LSafepoint *safepoint) stream_.writeUnsigned(payloadVal); } - JS_ASSERT(partials == 0); + MOZ_ASSERT(partials == 0); } #endif @@ -346,7 +346,7 @@ SafepointWriter::encode(LSafepoint *safepoint) { uint32_t safepointOffset = startEntry(); - JS_ASSERT(safepoint->osiCallPointOffset()); + MOZ_ASSERT(safepoint->osiCallPointOffset()); writeOsiCallPointOffset(safepoint->osiCallPointOffset()); writeGcRegs(safepoint); @@ -489,7 +489,7 @@ PartFromStream(CompactBufferReader &stream, NunboxPartKind kind, uint32_t info) if (kind == Part_Stack) return LStackSlot(info); - JS_ASSERT(kind == Part_Arg); + MOZ_ASSERT(kind == Part_Arg); return LArgument(info); } diff --git a/js/src/jit/Snapshots.cpp b/js/src/jit/Snapshots.cpp index 6eef9c0fc847..3d84d667d874 100644 --- a/js/src/jit/Snapshots.cpp +++ b/js/src/jit/Snapshots.cpp @@ -612,8 +612,8 @@ SnapshotWriter::startSnapshot(RecoverOffset recoverOffset, BailoutKind kind) JitSpew(JitSpew_IonSnapshots, "starting snapshot with recover offset %u, bailout kind %u", recoverOffset, kind); - JS_ASSERT(uint32_t(kind) < (1 << SNAPSHOT_BAILOUTKIND_BITS)); - JS_ASSERT(recoverOffset < (1 << SNAPSHOT_ROFFSET_BITS)); + MOZ_ASSERT(uint32_t(kind) < (1 << SNAPSHOT_BAILOUTKIND_BITS)); + MOZ_ASSERT(recoverOffset < (1 << SNAPSHOT_ROFFSET_BITS)); uint32_t bits = (uint32_t(kind) << SNAPSHOT_BAILOUTKIND_SHIFT) | (recoverOffset << SNAPSHOT_ROFFSET_SHIFT); diff --git a/js/src/jit/Snapshots.h b/js/src/jit/Snapshots.h index 575091395cea..fa8e8e3ecf86 100644 --- a/js/src/jit/Snapshots.h +++ b/js/src/jit/Snapshots.h @@ -192,17 +192,17 @@ class RValueAllocation // TYPED_REG or TYPED_STACK static RValueAllocation Typed(JSValueType type, Register reg) { - JS_ASSERT(type != JSVAL_TYPE_DOUBLE && - type != JSVAL_TYPE_MAGIC && - type != JSVAL_TYPE_NULL && - type != JSVAL_TYPE_UNDEFINED); + MOZ_ASSERT(type != JSVAL_TYPE_DOUBLE && + type != JSVAL_TYPE_MAGIC && + type != JSVAL_TYPE_NULL && + type != JSVAL_TYPE_UNDEFINED); return RValueAllocation(TYPED_REG, payloadOfValueType(type), payloadOfRegister(reg)); } static RValueAllocation Typed(JSValueType type, int32_t offset) { - JS_ASSERT(type != JSVAL_TYPE_MAGIC && - type != JSVAL_TYPE_NULL && - type != JSVAL_TYPE_UNDEFINED); + MOZ_ASSERT(type != JSVAL_TYPE_MAGIC && + type != JSVAL_TYPE_NULL && + type != JSVAL_TYPE_UNDEFINED); return RValueAllocation(TYPED_STACK, payloadOfValueType(type), payloadOfStackOffset(offset)); } @@ -272,33 +272,33 @@ class RValueAllocation } uint32_t index() const { - JS_ASSERT(layoutFromMode(mode()).type1 == PAYLOAD_INDEX); + MOZ_ASSERT(layoutFromMode(mode()).type1 == PAYLOAD_INDEX); return arg1_.index; } int32_t stackOffset() const { - JS_ASSERT(layoutFromMode(mode()).type1 == PAYLOAD_STACK_OFFSET); + MOZ_ASSERT(layoutFromMode(mode()).type1 == PAYLOAD_STACK_OFFSET); return arg1_.stackOffset; } Register reg() const { - JS_ASSERT(layoutFromMode(mode()).type1 == PAYLOAD_GPR); + MOZ_ASSERT(layoutFromMode(mode()).type1 == PAYLOAD_GPR); return arg1_.gpr; } FloatRegister fpuReg() const { - JS_ASSERT(layoutFromMode(mode()).type1 == PAYLOAD_FPU); + MOZ_ASSERT(layoutFromMode(mode()).type1 == PAYLOAD_FPU); FloatRegisterBits b = arg1_.fpu; return FloatRegister::FromCode(b.data); } JSValueType knownType() const { - JS_ASSERT(layoutFromMode(mode()).type1 == PAYLOAD_PACKED_TAG); + MOZ_ASSERT(layoutFromMode(mode()).type1 == PAYLOAD_PACKED_TAG); return arg1_.type; } int32_t stackOffset2() const { - JS_ASSERT(layoutFromMode(mode()).type2 == PAYLOAD_STACK_OFFSET); + MOZ_ASSERT(layoutFromMode(mode()).type2 == PAYLOAD_STACK_OFFSET); return arg2_.stackOffset; } Register reg2() const { - JS_ASSERT(layoutFromMode(mode()).type2 == PAYLOAD_GPR); + MOZ_ASSERT(layoutFromMode(mode()).type2 == PAYLOAD_GPR); return arg2_.gpr; } diff --git a/js/src/jit/StackSlotAllocator.h b/js/src/jit/StackSlotAllocator.h index bac022988ee5..cce61ae05e07 100644 --- a/js/src/jit/StackSlotAllocator.h +++ b/js/src/jit/StackSlotAllocator.h @@ -26,12 +26,12 @@ class StackSlotAllocator doubleSlots.append(index); } void freeQuadSlot(uint32_t index) { - JS_ASSERT(SupportsSimd); + MOZ_ASSERT(SupportsSimd); quadSlots.append(index); } uint32_t allocateQuadSlot() { - JS_ASSERT(SupportsSimd); + MOZ_ASSERT(SupportsSimd); // This relies on the fact that any architecture specific // alignment of the stack pointer is done a priori. if (!quadSlots.empty()) diff --git a/js/src/jit/StupidAllocator.cpp b/js/src/jit/StupidAllocator.cpp index 16ad71b15e44..3892760179f8 100644 --- a/js/src/jit/StupidAllocator.cpp +++ b/js/src/jit/StupidAllocator.cpp @@ -80,7 +80,7 @@ StupidAllocator::init() while (!remainingRegisters.empty(/* float = */ true)) registers[registerCount++].reg = AnyRegister(remainingRegisters.takeFloat()); - JS_ASSERT(registerCount <= MAX_REGISTERS); + MOZ_ASSERT(registerCount <= MAX_REGISTERS); } return true; @@ -149,10 +149,10 @@ StupidAllocator::allocateRegister(LInstruction *ins, uint32_t vreg) // Pick a register for vreg, evicting an existing register if necessary. // Spill code will be placed before ins, and no existing allocated input // for ins will be touched. - JS_ASSERT(ins); + MOZ_ASSERT(ins); LDefinition *def = virtualRegisters[vreg]; - JS_ASSERT(def); + MOZ_ASSERT(def); RegisterIndex best = UINT32_MAX; @@ -257,7 +257,7 @@ StupidAllocator::go() for (size_t blockIndex = 0; blockIndex < graph.numBlocks(); blockIndex++) { LBlock *block = graph.getBlock(blockIndex); - JS_ASSERT(block->mir()->id() == blockIndex); + MOZ_ASSERT(block->mir()->id() == blockIndex); for (size_t i = 0; i < registerCount; i++) registers[i].set(MISSING_ALLOCATION); @@ -378,7 +378,7 @@ StupidAllocator::allocateForInstruction(LInstruction *ins) continue; LUse *use = alloc->toUse(); uint32_t vreg = use->virtualRegister(); - JS_ASSERT(use->policy() != LUse::REGISTER && use->policy() != LUse::FIXED); + MOZ_ASSERT(use->policy() != LUse::REGISTER && use->policy() != LUse::FIXED); RegisterIndex index = findExistingRegister(vreg); if (index == UINT32_MAX) { diff --git a/js/src/jit/TypePolicy.cpp b/js/src/jit/TypePolicy.cpp index dc20958e5032..89818c47b66a 100644 --- a/js/src/jit/TypePolicy.cpp +++ b/js/src/jit/TypePolicy.cpp @@ -68,7 +68,7 @@ ArithPolicy::adjustInputs(TempAllocator &alloc, MInstruction *ins) if (specialization == MIRType_None) return BoxInputsPolicy::adjustInputs(alloc, ins); - JS_ASSERT(ins->type() == MIRType_Double || ins->type() == MIRType_Int32 || ins->type() == MIRType_Float32); + MOZ_ASSERT(ins->type() == MIRType_Double || ins->type() == MIRType_Int32 || ins->type() == MIRType_Float32); for (size_t i = 0, e = ins->numOperands(); i < e; i++) { MDefinition *in = ins->getOperand(i); @@ -97,7 +97,7 @@ ArithPolicy::adjustInputs(TempAllocator &alloc, MInstruction *ins) bool ComparePolicy::adjustInputs(TempAllocator &alloc, MInstruction *def) { - JS_ASSERT(def->isCompare()); + MOZ_ASSERT(def->isCompare()); MCompare *compare = def->toCompare(); // Convert Float32 operands to doubles @@ -140,8 +140,8 @@ ComparePolicy::adjustInputs(TempAllocator &alloc, MInstruction *def) return false; } - JS_ASSERT(def->getOperand(0)->type() != MIRType_Boolean); - JS_ASSERT(def->getOperand(1)->type() == MIRType_Boolean); + MOZ_ASSERT(def->getOperand(0)->type() != MIRType_Boolean); + MOZ_ASSERT(def->getOperand(1)->type() == MIRType_Boolean); return true; } @@ -166,8 +166,8 @@ ComparePolicy::adjustInputs(TempAllocator &alloc, MInstruction *def) return false; } - JS_ASSERT(def->getOperand(0)->type() != MIRType_String); - JS_ASSERT(def->getOperand(1)->type() == MIRType_String); + MOZ_ASSERT(def->getOperand(0)->type() != MIRType_String); + MOZ_ASSERT(def->getOperand(1)->type() == MIRType_String); return true; } @@ -180,8 +180,8 @@ ComparePolicy::adjustInputs(TempAllocator &alloc, MInstruction *def) // Convert all inputs to the right input type MIRType type = compare->inputType(); - JS_ASSERT(type == MIRType_Int32 || type == MIRType_Double || - type == MIRType_Object || type == MIRType_String || type == MIRType_Float32); + MOZ_ASSERT(type == MIRType_Int32 || type == MIRType_Double || + type == MIRType_Object || type == MIRType_String || type == MIRType_Float32); for (size_t i = 0; i < 2; i++) { MDefinition *in = def->getOperand(i); if (in->type() == type) @@ -254,19 +254,19 @@ TypeBarrierPolicy::adjustInputs(TempAllocator &alloc, MInstruction *def) if (outputType == MIRType_Value) { // XXX: Possible optimization: decrease resultTypeSet to only include // the inputType. This will remove the need for boxing. - JS_ASSERT(inputType != MIRType_Value); + MOZ_ASSERT(inputType != MIRType_Value); ins->replaceOperand(0, boxAt(alloc, ins, ins->getOperand(0))); return true; } // Input is a value. Unbox the input to the requested type. if (inputType == MIRType_Value) { - JS_ASSERT(outputType != MIRType_Value); + MOZ_ASSERT(outputType != MIRType_Value); // We can't unbox a value to null/undefined/lazyargs. So keep output // also a value. if (IsNullOrUndefined(outputType) || outputType == MIRType_MagicOptimizedArguments) { - JS_ASSERT(!ins->hasDefUses()); + MOZ_ASSERT(!ins->hasDefUses()); ins->setResultType(MIRType_Value); return true; } @@ -285,7 +285,7 @@ TypeBarrierPolicy::adjustInputs(TempAllocator &alloc, MInstruction *def) // In the remaining cases we will alway bail. OutputType doesn't matter. // Take inputType so we can use redefine during lowering. - JS_ASSERT(ins->alwaysBails()); + MOZ_ASSERT(ins->alwaysBails()); ins->setResultType(inputType); return true; @@ -353,7 +353,7 @@ bool PowPolicy::adjustInputs(TempAllocator &alloc, MInstruction *ins) { MIRType specialization = ins->typePolicySpecialization(); - JS_ASSERT(specialization == MIRType_Int32 || specialization == MIRType_Double); + MOZ_ASSERT(specialization == MIRType_Int32 || specialization == MIRType_Double); // Input must be a double. if (!DoublePolicy<0>::staticAdjustInputs(alloc, ins)) @@ -539,7 +539,7 @@ template bool BoxExceptPolicy<2, MIRType_String>::staticAdjustInputs(TempAllocat bool ToDoublePolicy::staticAdjustInputs(TempAllocator &alloc, MInstruction *ins) { - JS_ASSERT(ins->isToDouble() || ins->isToFloat32()); + MOZ_ASSERT(ins->isToDouble() || ins->isToFloat32()); MDefinition *in = ins->getOperand(0); MToFPInstruction::ConversionKind conversion; @@ -585,7 +585,7 @@ ToDoublePolicy::staticAdjustInputs(TempAllocator &alloc, MInstruction *ins) bool ToInt32Policy::staticAdjustInputs(TempAllocator &alloc, MInstruction *ins) { - JS_ASSERT(ins->isToInt32() || ins->isTruncateToInt32()); + MOZ_ASSERT(ins->isToInt32() || ins->isTruncateToInt32()); MacroAssembler::IntConversionInputKind conversion = MacroAssembler::IntConversion_Any; if (ins->isToInt32()) @@ -633,7 +633,7 @@ ToInt32Policy::staticAdjustInputs(TempAllocator &alloc, MInstruction *ins) bool ToStringPolicy::staticAdjustInputs(TempAllocator &alloc, MInstruction *ins) { - JS_ASSERT(ins->isToString()); + MOZ_ASSERT(ins->isToString()); MIRType type = ins->getOperand(0)->type(); if (type == MIRType_Object || type == MIRType_Symbol) { @@ -755,11 +755,11 @@ StoreTypedArrayPolicy::adjustValueInput(TempAllocator &alloc, MInstruction *ins, curValue = value; } - JS_ASSERT(value->type() == MIRType_Int32 || - value->type() == MIRType_Boolean || - value->type() == MIRType_Double || - value->type() == MIRType_Float32 || - value->type() == MIRType_Value); + MOZ_ASSERT(value->type() == MIRType_Int32 || + value->type() == MIRType_Boolean || + value->type() == MIRType_Double || + value->type() == MIRType_Float32 || + value->type() == MIRType_Value); switch (arrayType) { case Scalar::Int8: @@ -775,7 +775,7 @@ StoreTypedArrayPolicy::adjustValueInput(TempAllocator &alloc, MInstruction *ins, break; case Scalar::Uint8Clamped: // IonBuilder should have inserted ClampToUint8. - JS_ASSERT(value->type() == MIRType_Int32); + MOZ_ASSERT(value->type() == MIRType_Int32); break; case Scalar::Float32: if (value->type() != MIRType_Float32) { @@ -803,8 +803,8 @@ bool StoreTypedArrayPolicy::adjustInputs(TempAllocator &alloc, MInstruction *ins) { MStoreTypedArrayElement *store = ins->toStoreTypedArrayElement(); - JS_ASSERT(store->elements()->type() == MIRType_Elements); - JS_ASSERT(store->index()->type() == MIRType_Int32); + MOZ_ASSERT(store->elements()->type() == MIRType_Elements); + MOZ_ASSERT(store->index()->type() == MIRType_Int32); return adjustValueInput(alloc, ins, store->arrayType(), store->value(), 2); } @@ -813,9 +813,9 @@ bool StoreTypedArrayHolePolicy::adjustInputs(TempAllocator &alloc, MInstruction *ins) { MStoreTypedArrayElementHole *store = ins->toStoreTypedArrayElementHole(); - JS_ASSERT(store->elements()->type() == MIRType_Elements); - JS_ASSERT(store->index()->type() == MIRType_Int32); - JS_ASSERT(store->length()->type() == MIRType_Int32); + MOZ_ASSERT(store->elements()->type() == MIRType_Elements); + MOZ_ASSERT(store->index()->type() == MIRType_Int32); + MOZ_ASSERT(store->length()->type() == MIRType_Int32); return adjustValueInput(alloc, ins, store->arrayType(), store->value(), 3); } diff --git a/js/src/jit/TypedObjectPrediction.cpp b/js/src/jit/TypedObjectPrediction.cpp index db3f1f1c1bc0..67a31fb08416 100644 --- a/js/src/jit/TypedObjectPrediction.cpp +++ b/js/src/jit/TypedObjectPrediction.cpp @@ -45,7 +45,7 @@ TypedObjectPrediction::markAsCommonPrefix(const StructTypeDescr &descrA, break; if (&descrA.fieldDescr(i) != &descrB.fieldDescr(i)) break; - JS_ASSERT(descrA.fieldOffset(i) == descrB.fieldOffset(i)); + MOZ_ASSERT(descrA.fieldOffset(i) == descrB.fieldOffset(i)); } if (i == 0) { @@ -226,7 +226,7 @@ template typename T::Type TypedObjectPrediction::extractType() const { - JS_ASSERT(kind() == T::Kind); + MOZ_ASSERT(kind() == T::Kind); switch (predictionKind()) { case TypedObjectPrediction::Empty: case TypedObjectPrediction::Inconsistent: @@ -266,7 +266,7 @@ TypedObjectPrediction::simdType() const bool TypedObjectPrediction::hasKnownArrayLength(int32_t *length) const { - JS_ASSERT(ofArrayKind()); + MOZ_ASSERT(ofArrayKind()); switch (predictionKind()) { case TypedObjectPrediction::Empty: case TypedObjectPrediction::Inconsistent: @@ -301,7 +301,7 @@ DescrArrayElementType(const TypeDescr &descr) { TypedObjectPrediction TypedObjectPrediction::arrayElementType() const { - JS_ASSERT(ofArrayKind()); + MOZ_ASSERT(ofArrayKind()); switch (predictionKind()) { case TypedObjectPrediction::Empty: case TypedObjectPrediction::Inconsistent: @@ -347,7 +347,7 @@ TypedObjectPrediction::hasFieldNamed(jsid id, TypedObjectPrediction *fieldType, size_t *fieldIndex) const { - JS_ASSERT(kind() == type::Struct); + MOZ_ASSERT(kind() == type::Struct); switch (predictionKind()) { case TypedObjectPrediction::Empty: diff --git a/js/src/jit/TypedObjectPrediction.h b/js/src/jit/TypedObjectPrediction.h index f618a444b764..7594593c3928 100644 --- a/js/src/jit/TypedObjectPrediction.h +++ b/js/src/jit/TypedObjectPrediction.h @@ -96,17 +96,17 @@ class TypedObjectPrediction { } const TypedProto &proto() const { - JS_ASSERT(predictionKind() == Proto); + MOZ_ASSERT(predictionKind() == Proto); return *data_.proto; } const TypeDescr &descr() const { - JS_ASSERT(predictionKind() == Descr); + MOZ_ASSERT(predictionKind() == Descr); return *data_.descr; } const PrefixData &prefix() const { - JS_ASSERT(predictionKind() == Prefix); + MOZ_ASSERT(predictionKind() == Prefix); return data_.prefix; } diff --git a/js/src/jit/VMFunctions.cpp b/js/src/jit/VMFunctions.cpp index a7bd5e895dbb..67ae2e0df31e 100644 --- a/js/src/jit/VMFunctions.cpp +++ b/js/src/jit/VMFunctions.cpp @@ -313,8 +313,8 @@ NewInitObject(JSContext *cx, HandleObject templateObject) JSObject * NewInitObjectWithClassPrototype(JSContext *cx, HandleObject templateObject) { - JS_ASSERT(!templateObject->hasSingletonType()); - JS_ASSERT(!templateObject->hasLazyType()); + MOZ_ASSERT(!templateObject->hasSingletonType()); + MOZ_ASSERT(!templateObject->hasLazyType()); NewObjectKind newKind = templateObject->type()->shouldPreTenure() ? TenuredObject @@ -347,7 +347,7 @@ ArraySpliceDense(JSContext *cx, HandleObject obj, uint32_t start, uint32_t delet bool ArrayPopDense(JSContext *cx, HandleObject obj, MutableHandleValue rval) { - JS_ASSERT(obj->is()); + MOZ_ASSERT(obj->is()); AutoDetectInvalidation adi(cx, rval); @@ -368,7 +368,7 @@ ArrayPopDense(JSContext *cx, HandleObject obj, MutableHandleValue rval) bool ArrayPushDense(JSContext *cx, HandleObject obj, HandleValue v, uint32_t *length) { - JS_ASSERT(obj->is()); + MOZ_ASSERT(obj->is()); if (MOZ_LIKELY(obj->as().lengthIsWritable())) { uint32_t idx = obj->as().length(); @@ -399,7 +399,7 @@ ArrayPushDense(JSContext *cx, HandleObject obj, HandleValue v, uint32_t *length) bool ArrayShiftDense(JSContext *cx, HandleObject obj, MutableHandleValue rval) { - JS_ASSERT(obj->is()); + MOZ_ASSERT(obj->is()); AutoDetectInvalidation adi(cx, rval); @@ -512,7 +512,7 @@ SetProperty(JSContext *cx, HandleObject obj, HandlePropertyName name, HandleValu // Aliased var assigns ignore readonly attributes on the property, as // required for initializing 'const' closure variables. Shape *shape = obj->nativeLookup(cx, name); - JS_ASSERT(shape && shape->hasSlot()); + MOZ_ASSERT(shape && shape->hasSlot()); obj->nativeSetSlotWithType(cx, shape, value); return true; } @@ -726,14 +726,14 @@ FilterArgumentsOrEval(JSContext *cx, JSString *str) void PostWriteBarrier(JSRuntime *rt, JSObject *obj) { - JS_ASSERT(!IsInsideNursery(obj)); + MOZ_ASSERT(!IsInsideNursery(obj)); rt->gc.storeBuffer.putWholeCellFromMainThread(obj); } void PostGlobalWriteBarrier(JSRuntime *rt, JSObject *obj) { - JS_ASSERT(obj->is()); + MOZ_ASSERT(obj->is()); if (!obj->compartment()->globalWriteBarriered) { PostWriteBarrier(rt, obj); obj->compartment()->globalWriteBarriered = true; @@ -772,7 +772,7 @@ DebugPrologue(JSContext *cx, BaselineFrame *frame, jsbytecode *pc, bool *mustRet case JSTRAP_RETURN: // The script is going to return immediately, so we have to call the // debug epilogue handler as well. - JS_ASSERT(frame->hasReturnValue()); + MOZ_ASSERT(frame->hasReturnValue()); *mustReturn = true; return jit::DebugEpilogue(cx, frame, pc, true); @@ -872,8 +872,8 @@ InitRestParameter(JSContext *cx, uint32_t length, Value *rest, HandleObject temp if (objRes) { Rooted arrRes(cx, &objRes->as()); - JS_ASSERT(!arrRes->getDenseInitializedLength()); - JS_ASSERT(arrRes->type() == templateObj->type()); + MOZ_ASSERT(!arrRes->getDenseInitializedLength()); + MOZ_ASSERT(arrRes->type() == templateObj->type()); // Fast path: we managed to allocate the array inline; initialize the // slots. @@ -904,8 +904,8 @@ HandleDebugTrap(JSContext *cx, BaselineFrame *frame, uint8_t *retAddr, bool *mus RootedScript script(cx, frame->script()); jsbytecode *pc = script->baselineScript()->icEntryFromReturnAddress(retAddr).pc(script); - JS_ASSERT(cx->compartment()->debugMode()); - JS_ASSERT(script->stepModeEnabled() || script->hasBreakpointsAt(pc)); + MOZ_ASSERT(cx->compartment()->debugMode()); + MOZ_ASSERT(script->stepModeEnabled() || script->hasBreakpointsAt(pc)); RootedValue rval(cx); JSTrapStatus status = JSTRAP_CONTINUE; @@ -984,7 +984,7 @@ PopBlockScope(JSContext *cx, BaselineFrame *frame) bool DebugLeaveBlock(JSContext *cx, BaselineFrame *frame, jsbytecode *pc) { - JS_ASSERT(frame->script()->baselineScript()->debugMode()); + MOZ_ASSERT(frame->script()->baselineScript()->debugMode()); DebugScopes::onPopBlock(cx, frame, pc); @@ -1015,8 +1015,8 @@ JSObject * CreateDerivedTypedObj(JSContext *cx, HandleObject descr, HandleObject owner, int32_t offset) { - JS_ASSERT(descr->is()); - JS_ASSERT(owner->is()); + MOZ_ASSERT(descr->is()); + MOZ_ASSERT(owner->is()); Rooted descr1(cx, &descr->as()); Rooted owner1(cx, &owner->as()); return OutlineTypedObject::createDerived(cx, descr1, owner1, offset); @@ -1025,8 +1025,8 @@ CreateDerivedTypedObj(JSContext *cx, HandleObject descr, JSString * RegExpReplace(JSContext *cx, HandleString string, HandleObject regexp, HandleString repl) { - JS_ASSERT(string); - JS_ASSERT(repl); + MOZ_ASSERT(string); + MOZ_ASSERT(repl); RootedValue rval(cx); if (!str_replace_regexp_raw(cx, string, regexp, repl, &rval)) @@ -1038,9 +1038,9 @@ RegExpReplace(JSContext *cx, HandleString string, HandleObject regexp, HandleStr JSString * StringReplace(JSContext *cx, HandleString string, HandleString pattern, HandleString repl) { - JS_ASSERT(string); - JS_ASSERT(pattern); - JS_ASSERT(repl); + MOZ_ASSERT(string); + MOZ_ASSERT(pattern); + MOZ_ASSERT(repl); RootedValue rval(cx); if (!str_replace_string_raw(cx, string, pattern, repl, &rval)) @@ -1052,16 +1052,16 @@ StringReplace(JSContext *cx, HandleString string, HandleString pattern, HandleSt bool Recompile(JSContext *cx) { - JS_ASSERT(cx->currentlyRunningInJit()); + MOZ_ASSERT(cx->currentlyRunningInJit()); JitActivationIterator activations(cx->runtime()); JitFrameIterator iter(activations); - JS_ASSERT(iter.type() == JitFrame_Exit); + MOZ_ASSERT(iter.type() == JitFrame_Exit); ++iter; bool isConstructing = iter.isConstructing(); RootedScript script(cx, iter.script()); - JS_ASSERT(script->hasIonScript()); + MOZ_ASSERT(script->hasIonScript()); if (!IsIonEnabled(cx)) return true; @@ -1124,17 +1124,17 @@ AssertValidObjectPtr(JSContext *cx, JSObject *obj) { // Check what we can, so that we'll hopefully assert/crash if we get a // bogus object (pointer). - JS_ASSERT(obj->compartment() == cx->compartment()); - JS_ASSERT(obj->runtimeFromMainThread() == cx->runtime()); + MOZ_ASSERT(obj->compartment() == cx->compartment()); + MOZ_ASSERT(obj->runtimeFromMainThread() == cx->runtime()); JS_ASSERT_IF(!obj->hasLazyType(), obj->type()->clasp() == obj->lastProperty()->getObjectClass()); if (obj->isTenured()) { - JS_ASSERT(obj->isAligned()); + MOZ_ASSERT(obj->isAligned()); gc::AllocKind kind = obj->asTenured()->getAllocKind(); - JS_ASSERT(kind >= js::gc::FINALIZE_OBJECT0 && kind <= js::gc::FINALIZE_OBJECT_LAST); - JS_ASSERT(obj->asTenured()->zone() == cx->zone()); + MOZ_ASSERT(kind >= js::gc::FINALIZE_OBJECT0 && kind <= js::gc::FINALIZE_OBJECT_LAST); + MOZ_ASSERT(obj->asTenured()->zone() == cx->zone()); } } @@ -1143,28 +1143,28 @@ AssertValidStringPtr(JSContext *cx, JSString *str) { // We can't closely inspect strings from another runtime. if (str->runtimeFromAnyThread() != cx->runtime()) { - JS_ASSERT(str->isPermanentAtom()); + MOZ_ASSERT(str->isPermanentAtom()); return; } if (str->isAtom()) - JS_ASSERT(cx->runtime()->isAtomsZone(str->zone())); + MOZ_ASSERT(cx->runtime()->isAtomsZone(str->zone())); else - JS_ASSERT(str->zone() == cx->zone()); + MOZ_ASSERT(str->zone() == cx->zone()); - JS_ASSERT(str->runtimeFromMainThread() == cx->runtime()); - JS_ASSERT(str->isAligned()); - JS_ASSERT(str->length() <= JSString::MAX_LENGTH); + MOZ_ASSERT(str->runtimeFromMainThread() == cx->runtime()); + MOZ_ASSERT(str->isAligned()); + MOZ_ASSERT(str->length() <= JSString::MAX_LENGTH); gc::AllocKind kind = str->getAllocKind(); if (str->isFatInline()) - JS_ASSERT(kind == gc::FINALIZE_FAT_INLINE_STRING); + MOZ_ASSERT(kind == gc::FINALIZE_FAT_INLINE_STRING); else if (str->isExternal()) - JS_ASSERT(kind == gc::FINALIZE_EXTERNAL_STRING); + MOZ_ASSERT(kind == gc::FINALIZE_EXTERNAL_STRING); else if (str->isAtom() || str->isFlat()) - JS_ASSERT(kind == gc::FINALIZE_STRING || kind == gc::FINALIZE_FAT_INLINE_STRING); + MOZ_ASSERT(kind == gc::FINALIZE_STRING || kind == gc::FINALIZE_FAT_INLINE_STRING); else - JS_ASSERT(kind == gc::FINALIZE_STRING); + MOZ_ASSERT(kind == gc::FINALIZE_STRING); } void @@ -1174,16 +1174,16 @@ AssertValidSymbolPtr(JSContext *cx, JS::Symbol *sym) if (sym->runtimeFromAnyThread() != cx->runtime()) return; - JS_ASSERT(cx->runtime()->isAtomsZone(sym->zone())); + MOZ_ASSERT(cx->runtime()->isAtomsZone(sym->zone())); - JS_ASSERT(sym->runtimeFromMainThread() == cx->runtime()); - JS_ASSERT(sym->isAligned()); + MOZ_ASSERT(sym->runtimeFromMainThread() == cx->runtime()); + MOZ_ASSERT(sym->isAligned()); if (JSString *desc = sym->description()) { - JS_ASSERT(desc->isAtom()); + MOZ_ASSERT(desc->isAtom()); AssertValidStringPtr(cx, desc); } - JS_ASSERT(sym->getAllocKind() == gc::FINALIZE_SYMBOL); + MOZ_ASSERT(sym->getAllocKind() == gc::FINALIZE_SYMBOL); } void @@ -1202,7 +1202,7 @@ AssertValidValue(JSContext *cx, Value *v) JSObject * TypedObjectProto(JSObject *obj) { - JS_ASSERT(obj->is()); + MOZ_ASSERT(obj->is()); TypedObject &typedObj = obj->as(); return &typedObj.typedProto(); } diff --git a/js/src/jit/VMFunctions.h b/js/src/jit/VMFunctions.h index 9e0bf9b67665..b9c3d8f7fe6d 100644 --- a/js/src/jit/VMFunctions.h +++ b/js/src/jit/VMFunctions.h @@ -241,8 +241,8 @@ struct VMFunction // Check for valid failure/return type. JS_ASSERT_IF(outParam != Type_Void && executionMode == SequentialExecution, returnType == Type_Bool); - JS_ASSERT(returnType == Type_Bool || - returnType == Type_Object); + MOZ_ASSERT(returnType == Type_Bool || + returnType == Type_Object); } VMFunction(const VMFunction &o) { @@ -250,7 +250,7 @@ struct VMFunction } void init(const VMFunction &o) { - JS_ASSERT(!wrapped); + MOZ_ASSERT(!wrapped); *this = o; addToFunctions(); } @@ -272,13 +272,13 @@ struct VMFunctionsModal } inline const VMFunction &operator[](ExecutionMode mode) const { - JS_ASSERT((unsigned)mode < NumExecutionModes); + MOZ_ASSERT((unsigned)mode < NumExecutionModes); return funs_[mode]; } private: void add(const VMFunction &info) { - JS_ASSERT((unsigned)info.executionMode < NumExecutionModes); + MOZ_ASSERT((unsigned)info.executionMode < NumExecutionModes); funs_[info.executionMode].init(info); } @@ -596,7 +596,7 @@ class AutoDetectInvalidation AutoDetectInvalidation(JSContext *cx, MutableHandleValue rval, IonScript *ionScript = nullptr); void disable() { - JS_ASSERT(!disabled_); + MOZ_ASSERT(!disabled_); disabled_ = true; } diff --git a/js/src/jit/arm/Architecture-arm.h b/js/src/jit/arm/Architecture-arm.h index 8dc3acb4957b..3b3ebb8b79d1 100644 --- a/js/src/jit/arm/Architecture-arm.h +++ b/js/src/jit/arm/Architecture-arm.h @@ -250,7 +250,7 @@ class FloatRegisters } static const char *GetName(uint32_t i) { - JS_ASSERT(i < Total); + MOZ_ASSERT(i < Total); return GetName(Code(i)); } @@ -361,8 +361,8 @@ class VFPRegister : kind(Double), code_(id), _isInvalid(false), _isMissing(false) { } bool operator==(const VFPRegister &other) const { - JS_ASSERT(!isInvalid()); - JS_ASSERT(!other.isInvalid()); + MOZ_ASSERT(!isInvalid()); + MOZ_ASSERT(!other.isInvalid()); return kind == other.kind && code_ == other.code_; } bool isDouble() const { return kind == Double; } @@ -395,16 +395,16 @@ class VFPRegister VFPRegIndexSplit(uint32_t block_, uint32_t bit_) : block(block_), bit(bit_) { - JS_ASSERT(block == block_); - JS_ASSERT(bit == bit_); + MOZ_ASSERT(block == block_); + MOZ_ASSERT(bit == bit_); } }; Code code() const { - JS_ASSERT(!_isInvalid && !_isMissing); + MOZ_ASSERT(!_isInvalid && !_isMissing); // This should only be used in areas where we only have doubles and // singles. - JS_ASSERT(isFloat()); + MOZ_ASSERT(isFloat()); return Code(code_ | (kind << 5)); } uint32_t id() const { @@ -451,12 +451,12 @@ class VFPRegister return; } if (isDouble()) { - JS_ASSERT(code_ < NumAliasedDoubles); - JS_ASSERT(aliasIdx <= 2); + MOZ_ASSERT(code_ < NumAliasedDoubles); + MOZ_ASSERT(aliasIdx <= 2); *ret = singleOverlay(aliasIdx - 1); return; } - JS_ASSERT(aliasIdx == 1); + MOZ_ASSERT(aliasIdx == 1); *ret = doubleOverlay(aliasIdx - 1); } uint32_t numAlignedAliased() const { @@ -479,13 +479,13 @@ class VFPRegister *ret = *this; return; } - JS_ASSERT(aliasIdx == 1); + MOZ_ASSERT(aliasIdx == 1); if (isDouble()) { - JS_ASSERT(code_ < NumAliasedDoubles); + MOZ_ASSERT(code_ < NumAliasedDoubles); *ret = singleOverlay(aliasIdx - 1); return; } - JS_ASSERT((code_ & 1) == 0); + MOZ_ASSERT((code_ & 1) == 0); *ret = doubleOverlay(aliasIdx - 1); return; } diff --git a/js/src/jit/arm/Assembler-arm.cpp b/js/src/jit/arm/Assembler-arm.cpp index 5ac8ed0e44e6..5da324ac54e1 100644 --- a/js/src/jit/arm/Assembler-arm.cpp +++ b/js/src/jit/arm/Assembler-arm.cpp @@ -88,28 +88,28 @@ const Register ABIArgGenerator::NonReturn_VolatileReg1 = r3; uint32_t js::jit::RT(Register r) { - JS_ASSERT((r.code() & ~0xf) == 0); + MOZ_ASSERT((r.code() & ~0xf) == 0); return r.code() << 12; } uint32_t js::jit::RN(Register r) { - JS_ASSERT((r.code() & ~0xf) == 0); + MOZ_ASSERT((r.code() & ~0xf) == 0); return r.code() << 16; } uint32_t js::jit::RD(Register r) { - JS_ASSERT((r.code() & ~0xf) == 0); + MOZ_ASSERT((r.code() & ~0xf) == 0); return r.code() << 12; } uint32_t js::jit::RM(Register r) { - JS_ASSERT((r.code() & ~0xf) == 0); + MOZ_ASSERT((r.code() & ~0xf) == 0); return r.code() << 8; } @@ -122,7 +122,7 @@ js::jit::maybeRT(Register r) if (r == InvalidReg) return 0; - JS_ASSERT((r.code() & ~0xf) == 0); + MOZ_ASSERT((r.code() & ~0xf) == 0); return r.code() << 12; } @@ -132,7 +132,7 @@ js::jit::maybeRN(Register r) if (r == InvalidReg) return 0; - JS_ASSERT((r.code() & ~0xf) == 0); + MOZ_ASSERT((r.code() & ~0xf) == 0); return r.code() << 16; } @@ -142,7 +142,7 @@ js::jit::maybeRD(Register r) if (r == InvalidReg) return 0; - JS_ASSERT((r.code() & ~0xf) == 0); + MOZ_ASSERT((r.code() & ~0xf) == 0); return r.code() << 12; } @@ -203,7 +203,7 @@ js::jit::VM(VFPRegister vr) VFPRegister::VFPRegIndexSplit jit::VFPRegister::encode() { - JS_ASSERT(!_isInvalid); + MOZ_ASSERT(!_isInvalid); switch (kind) { case Double: @@ -521,7 +521,7 @@ Imm16::Imm16(uint32_t imm) upper((imm >> 12) & 0xf), invalid(0) { - JS_ASSERT(decode() == imm); + MOZ_ASSERT(decode() == imm); } Imm16::Imm16() @@ -538,7 +538,7 @@ jit::PatchJump(CodeLocationJump &jump_, CodeLocationLabel label) // jumpWithPatch() returns the offset of the jump and never a pool or nop. Assembler::Condition c; jump->extractCond(&c); - JS_ASSERT(jump->is() || jump->is()); + MOZ_ASSERT(jump->is() || jump->is()); int jumpOffset = label.raw() - jump_.raw(); if (BOffImm::IsInRange(jumpOffset)) { @@ -556,7 +556,7 @@ void Assembler::finish() { flush(); - JS_ASSERT(!isFinished); + MOZ_ASSERT(!isFinished); isFinished = true; for (unsigned int i = 0; i < tmpDataRelocations_.length(); i++) { @@ -581,7 +581,7 @@ Assembler::finish() void Assembler::executableCopy(uint8_t *buffer) { - JS_ASSERT(isFinished); + MOZ_ASSERT(isFinished); m_buffer.executableCopy(buffer); AutoFlushICache::setRange(uintptr_t(buffer), m_buffer.size()); } @@ -678,7 +678,7 @@ Assembler::GetCF32Target(Iter *iter) top->extractImm(&targ_top); // Make sure they are being loaded into the same register. - JS_ASSERT(top->checkDest(temp)); + MOZ_ASSERT(top->checkDest(temp)); // Make sure we're branching to the same register. #ifdef DEBUG @@ -687,7 +687,7 @@ Assembler::GetCF32Target(Iter *iter) if (!inst3->is()) { InstBranchReg *realBranch = inst3->is() ? inst3->as() : inst4->as(); - JS_ASSERT(realBranch->checkDest(temp)); + MOZ_ASSERT(realBranch->checkDest(temp)); } #endif @@ -747,7 +747,7 @@ Assembler::GetPtr32Target(Iter *start, Register *dest, RelocStyle *style) top->extractImm(&targ_top); // Make sure they are being loaded into the same register. - JS_ASSERT(top->checkDest(temp)); + MOZ_ASSERT(top->checkDest(temp)); if (dest) *dest = temp; @@ -875,7 +875,7 @@ Assembler::trace(JSTracer *trc) if (rp.kind == Relocation::JITCODE) { JitCode *code = JitCode::FromExecutable((uint8_t*)rp.target); MarkJitCodeUnbarriered(trc, &code, "masmrel32"); - JS_ASSERT(code == JitCode::FromExecutable((uint8_t*)rp.target)); + MOZ_ASSERT(code == JitCode::FromExecutable((uint8_t*)rp.target)); } } @@ -896,7 +896,7 @@ Assembler::processCodeLabels(uint8_t *rawCode) void Assembler::writeCodePointer(AbsoluteLabel *absoluteLabel) { - JS_ASSERT(!absoluteLabel->bound()); + MOZ_ASSERT(!absoluteLabel->bound()); BufferOffset off = writeInst(LabelBase::INVALID_OFFSET); // The x86/x64 makes general use of AbsoluteLabel and weaves a linked list @@ -965,11 +965,11 @@ Imm8::EncodeTwoImms(uint32_t imm) imm2 = no_n1; } else { imm2 = ((imm >> (32 - imm2shift)) | (imm << imm2shift)) & 0xff; - JS_ASSERT( ((no_n1 >> (32 - imm2shift)) | (no_n1 << imm2shift)) == - imm2); + MOZ_ASSERT( ((no_n1 >> (32 - imm2shift)) | (no_n1 << imm2shift)) == + imm2); } - JS_ASSERT((imm1shift & 0x1) == 0); - JS_ASSERT((imm2shift & 0x1) == 0); + MOZ_ASSERT((imm1shift & 0x1) == 0); + MOZ_ASSERT((imm2shift & 0x1) == 0); return TwoImm8mData(datastore::Imm8mData(imm1, imm1shift >> 1), datastore::Imm8mData(imm2, imm2shift >> 1)); } @@ -1004,15 +1004,15 @@ Imm8::EncodeTwoImms(uint32_t imm) // a rotate right from the lower 8 bits. int imm1shift = 8 - right; imm1 = 0xff & ((imm << imm1shift) | (imm >> (32 - imm1shift))); - JS_ASSERT ((imm1shift & ~0x1e) == 0); + MOZ_ASSERT((imm1shift & ~0x1e) == 0); // left + 8 + mid is the position of the leftmost bit of n_2. // We needed to rotate 0x000000ab right by 8 in order to get 0xab000000, // then shift again by the leftmost bit in order to get the constant that we // care about. int imm2shift = mid + 8; imm2 = ((imm >> (32 - imm2shift)) | (imm << imm2shift)) & 0xff; - JS_ASSERT((imm1shift & 0x1) == 0); - JS_ASSERT((imm2shift & 0x1) == 0); + MOZ_ASSERT((imm1shift & 0x1) == 0); + MOZ_ASSERT((imm2shift & 0x1) == 0); return TwoImm8mData(datastore::Imm8mData(imm1, imm1shift >> 1), datastore::Imm8mData(imm2, imm2shift >> 1)); } @@ -1048,7 +1048,7 @@ jit::ALUNeg(ALUOp op, Register dest, Imm32 *imm, Register *negDest) *imm = Imm32(-imm->value); return OpCmp; case OpTst: - JS_ASSERT(dest == InvalidReg); + MOZ_ASSERT(dest == InvalidReg); *imm = Imm32(~imm->value); *negDest = ScratchRegister; return OpBic; @@ -1134,34 +1134,34 @@ jit::O2Reg(Register r) { O2RegImmShift jit::lsl(Register r, int amt) { - JS_ASSERT(0 <= amt && amt <= 31); + MOZ_ASSERT(0 <= amt && amt <= 31); return O2RegImmShift(r, LSL, amt); } O2RegImmShift jit::lsr(Register r, int amt) { - JS_ASSERT(1 <= amt && amt <= 32); + MOZ_ASSERT(1 <= amt && amt <= 32); return O2RegImmShift(r, LSR, amt); } O2RegImmShift jit::ror(Register r, int amt) { - JS_ASSERT(1 <= amt && amt <= 31); + MOZ_ASSERT(1 <= amt && amt <= 31); return O2RegImmShift(r, ROR, amt); } O2RegImmShift jit::rol(Register r, int amt) { - JS_ASSERT(1 <= amt && amt <= 31); + MOZ_ASSERT(1 <= amt && amt <= 31); return O2RegImmShift(r, ROR, 32 - amt); } O2RegImmShift jit::asr (Register r, int amt) { - JS_ASSERT(1 <= amt && amt <= 32); + MOZ_ASSERT(1 <= amt && amt <= 32); return O2RegImmShift(r, ASR, amt); } @@ -1220,8 +1220,8 @@ BOffImm::getDest(Instruction *src) VFPRegister VFPRegister::doubleOverlay(unsigned int which) const { - JS_ASSERT(!_isInvalid); - JS_ASSERT(which == 0); + MOZ_ASSERT(!_isInvalid); + MOZ_ASSERT(which == 0); if (kind != Double) return VFPRegister(code_ >> 1, Double); return *this; @@ -1229,41 +1229,41 @@ VFPRegister::doubleOverlay(unsigned int which) const VFPRegister VFPRegister::singleOverlay(unsigned int which) const { - JS_ASSERT(!_isInvalid); + MOZ_ASSERT(!_isInvalid); if (kind == Double) { // There are no corresponding float registers for d16-d31. - JS_ASSERT(code_ < 16); - JS_ASSERT(which < 2); + MOZ_ASSERT(code_ < 16); + MOZ_ASSERT(which < 2); return VFPRegister((code_ << 1) + which, Single); } - JS_ASSERT(which == 0); + MOZ_ASSERT(which == 0); return VFPRegister(code_, Single); } VFPRegister VFPRegister::sintOverlay(unsigned int which) const { - JS_ASSERT(!_isInvalid); + MOZ_ASSERT(!_isInvalid); if (kind == Double) { // There are no corresponding float registers for d16-d31. - JS_ASSERT(code_ < 16); - JS_ASSERT(which < 2); + MOZ_ASSERT(code_ < 16); + MOZ_ASSERT(which < 2); return VFPRegister((code_ << 1) + which, Int); } - JS_ASSERT(which == 0); + MOZ_ASSERT(which == 0); return VFPRegister(code_, Int); } VFPRegister VFPRegister::uintOverlay(unsigned int which) const { - JS_ASSERT(!_isInvalid); + MOZ_ASSERT(!_isInvalid); if (kind == Double) { // There are no corresponding float registers for d16-d31. - JS_ASSERT(code_ < 16); - JS_ASSERT(which < 2); + MOZ_ASSERT(code_ < 16); + MOZ_ASSERT(which < 2); return VFPRegister((code_ << 1) + which, UInt); } - JS_ASSERT(which == 0); + MOZ_ASSERT(which == 0); return VFPRegister(code_, UInt); } @@ -1276,7 +1276,7 @@ VFPRegister::isInvalid() const bool VFPRegister::isMissing() const { - JS_ASSERT(!_isInvalid); + MOZ_ASSERT(!_isInvalid); return _isMissing; } @@ -1351,7 +1351,7 @@ Assembler::writeBranchInst(uint32_t x) void Assembler::WriteInstStatic(uint32_t x, uint32_t *dest) { - JS_ASSERT(dest != nullptr); + MOZ_ASSERT(dest != nullptr); *dest = x; } @@ -1502,13 +1502,13 @@ Assembler::as_uxth(Register dest, Register src, int rotate, Condition c) BufferOffset Assembler::as_movw(Register dest, Imm16 imm, Condition c, Instruction *pos) { - JS_ASSERT(HasMOVWT()); + MOZ_ASSERT(HasMOVWT()); return writeInst(0x03000000 | c | imm.encode() | RD(dest), (uint32_t*)pos); } BufferOffset Assembler::as_movt(Register dest, Imm16 imm, Condition c, Instruction *pos) { - JS_ASSERT(HasMOVWT()); + MOZ_ASSERT(HasMOVWT()); return writeInst(0x03400000 | c | imm.encode() | RD(dest), (uint32_t*)pos); } @@ -1596,8 +1596,8 @@ BufferOffset Assembler::as_dtr(LoadStore ls, int size, Index mode, Register rt, DTRAddr addr, Condition c, uint32_t *dest) { - JS_ASSERT (mode == Offset || (rt != addr.getBase() && pc != addr.getBase())); - JS_ASSERT(size == 32 || size == 8); + MOZ_ASSERT(mode == Offset || (rt != addr.getBase() && pc != addr.getBase())); + MOZ_ASSERT(size == 32 || size == 8); return writeInst( 0x04000000 | ls | (size == 8 ? 0x00400000 : 0) | mode | c | RT(rt) | addr.encode(), dest); @@ -1626,20 +1626,20 @@ class PoolHintData { public: void init(uint32_t index, Assembler::Condition cond, LoadType lt, Register destReg) { index_ = index; - JS_ASSERT(index_ == index); + MOZ_ASSERT(index_ == index); cond_ = cond >> 28; - JS_ASSERT(cond_ == cond >> 28); + MOZ_ASSERT(cond_ == cond >> 28); loadType_ = lt; ONES = ExpectedOnes; destReg_ = destReg.code(); destType_ = 0; } void init(uint32_t index, Assembler::Condition cond, LoadType lt, const VFPRegister &destReg) { - JS_ASSERT(destReg.isFloat()); + MOZ_ASSERT(destReg.isFloat()); index_ = index; - JS_ASSERT(index_ == index); + MOZ_ASSERT(index_ == index); cond_ = cond >> 28; - JS_ASSERT(cond_ == cond >> 28); + MOZ_ASSERT(cond_ == cond >> 28); loadType_ = lt; ONES = ExpectedOnes; destReg_ = destReg.id(); @@ -1661,9 +1661,9 @@ class PoolHintData { return index_; } void setIndex(uint32_t index) { - JS_ASSERT(ONES == ExpectedOnes && loadType_ != PoolBOGUS); + MOZ_ASSERT(ONES == ExpectedOnes && loadType_ != PoolBOGUS); index_ = index; - JS_ASSERT(index_ == index); + MOZ_ASSERT(index_ == index); } LoadType getLoadType() { @@ -1700,8 +1700,8 @@ Assembler::as_extdtr(LoadStore ls, int size, bool IsSigned, Index mode, int extra_bits1 = 0; switch(size) { case 8: - JS_ASSERT(IsSigned); - JS_ASSERT(ls != IsStore); + MOZ_ASSERT(IsSigned); + MOZ_ASSERT(ls != IsStore); extra_bits1 = 0x1; extra_bits2 = 0x2; break; @@ -1711,7 +1711,7 @@ Assembler::as_extdtr(LoadStore ls, int size, bool IsSigned, Index mode, extra_bits2 = 0x01; extra_bits1 = (ls == IsStore) ? 0 : 1; if (IsSigned) { - JS_ASSERT(ls != IsStore); + MOZ_ASSERT(ls != IsStore); extra_bits2 |= 0x2; } break; @@ -1745,7 +1745,7 @@ Assembler::as_Imm32Pool(Register dest, uint32_t value, Condition c) void Assembler::as_WritePoolEntry(Instruction *addr, Condition c, uint32_t data) { - JS_ASSERT(addr->is()); + MOZ_ASSERT(addr->is()); int32_t offset = addr->encode() & 0xfff; if ((addr->encode() & IsUp) != IsUp) offset = -offset; @@ -1754,7 +1754,7 @@ Assembler::as_WritePoolEntry(Instruction *addr, Condition c, uint32_t data) *dest = data; Condition orig_cond; addr->extractCond(&orig_cond); - JS_ASSERT(orig_cond == c); + MOZ_ASSERT(orig_cond == c); } BufferOffset @@ -1778,7 +1778,7 @@ Assembler::as_BranchPool(uint32_t value, RepatchLabel *label, ARMBuffer::PoolEnt BufferOffset Assembler::as_FImm64Pool(VFPRegister dest, double value, Condition c) { - JS_ASSERT(dest.isDouble()); + MOZ_ASSERT(dest.isDouble()); PoolHintPun php; php.phd.init(0, c, PoolHintData::PoolVDTR, dest); return m_buffer.allocEntry(1, 2, (uint8_t*)&php.raw, (uint8_t*)&value); @@ -1790,7 +1790,7 @@ Assembler::as_FImm32Pool(VFPRegister dest, float value, Condition c) // Insert floats into the double pool as they have the same limitations on // immediate offset. This wastes 4 bytes padding per float. An alternative // would be to have a separate pool for floats. - JS_ASSERT(dest.isSingle()); + MOZ_ASSERT(dest.isSingle()); PoolHintPun php; php.phd.init(0, c, PoolHintData::PoolVDTR, dest); return m_buffer.allocEntry(1, 1, (uint8_t*)&php.raw, (uint8_t*)&value); @@ -1840,7 +1840,7 @@ Assembler::PatchConstantPoolLoad(void* loadAddr, void* constPoolAddr) case PoolHintData::PoolVDTR: { VFPRegister dest = data.getVFPReg(); int32_t imm = offset + (data.getIndex() * 4) - 8; - JS_ASSERT(-1024 < imm && imm < 1024); + MOZ_ASSERT(-1024 < imm && imm < 1024); Dummy->as_vdtr(IsLoad, dest, VFPAddr(pc, VFPOffImm(imm)), data.getCond(), instAddr); break; } @@ -1988,7 +1988,7 @@ Assembler::as_b(Label *l, Condition c) ret = as_b(inv, c); } DebugOnly check = l->use(ret.getOffset()); - JS_ASSERT(check == old); + MOZ_ASSERT(check == old); return ret; } BufferOffset @@ -2050,7 +2050,7 @@ Assembler::as_bl(Label *l, Condition c) ret = as_bl(inv, c); } DebugOnly check = l->use(ret.getOffset()); - JS_ASSERT(check == old); + MOZ_ASSERT(check == old); return ret; } BufferOffset @@ -2071,7 +2071,7 @@ Assembler::as_msr(Register r, Condition c) { // Hardcode the 'mask' field to 0b11 for now. It is bits 18 and 19, which // are the two high bits of the 'c' in this constant. - JS_ASSERT((r.code() & ~0xf) == 0); + MOZ_ASSERT((r.code() & ~0xf) == 0); return writeInst(0x012cf000 | int(c) | r.code()); } @@ -2083,8 +2083,8 @@ enum vfp_tags { BufferOffset Assembler::writeVFPInst(vfp_size sz, uint32_t blob, uint32_t *dest) { - JS_ASSERT((sz & blob) == 0); - JS_ASSERT((VfpTag & blob) == 0); + MOZ_ASSERT((sz & blob) == 0); + MOZ_ASSERT((VfpTag & blob) == 0); return writeInst(VfpTag | sz | blob, dest); } @@ -2207,14 +2207,14 @@ Assembler::as_vxfer(Register vt1, Register vt2, VFPRegister vm, FloatToCore_ f2c // registers, and 32 double registers so there is no way to encode the // last 16 double registers. sz = IsDouble; - JS_ASSERT(idx == 0 || idx == 1); + MOZ_ASSERT(idx == 0 || idx == 1); // If we are transferring a single half of the double then it must be // moving a VFP reg to a core reg. if (vt2 == InvalidReg) - JS_ASSERT(f2c == FloatToCore); + MOZ_ASSERT(f2c == FloatToCore); idx = idx << 21; } else { - JS_ASSERT(idx == 0); + MOZ_ASSERT(idx == 0); } if (vt2 == InvalidReg) { @@ -2248,7 +2248,7 @@ Assembler::as_vcvt(VFPRegister vd, VFPRegister vm, bool useFPSCR, Condition c) { // Unlike other cases, the source and dest types cannot be the same. - JS_ASSERT(!vd.equiv(vm)); + MOZ_ASSERT(!vd.equiv(vm)); vfp_size sz = IsDouble; if (vd.isFloat() && vm.isFloat()) { // Doing a float -> float conversion. @@ -2261,7 +2261,7 @@ Assembler::as_vcvt(VFPRegister vd, VFPRegister vm, bool useFPSCR, vcvt_destFloatness destFloat; vcvt_Signedness opSign; vcvt_toZero doToZero = VcvtToFPSCR; - JS_ASSERT(vd.isFloat() || vm.isFloat()); + MOZ_ASSERT(vd.isFloat() || vm.isFloat()); if (vd.isSingle() || vm.isSingle()) { sz = IsSingle; } @@ -2279,12 +2279,12 @@ Assembler::as_vcvt(VFPRegister vd, VFPRegister vm, bool useFPSCR, BufferOffset Assembler::as_vcvtFixed(VFPRegister vd, bool isSigned, uint32_t fixedPoint, bool toFixed, Condition c) { - JS_ASSERT(vd.isFloat()); + MOZ_ASSERT(vd.isFloat()); uint32_t sx = 0x1; vfp_size sf = vd.isDouble() ? IsDouble : IsSingle; int32_t imm5 = fixedPoint; imm5 = (sx ? 32 : 16) - imm5; - JS_ASSERT(imm5 >= 0); + MOZ_ASSERT(imm5 >= 0); imm5 = imm5 >> 1 | (imm5 & 1) << 5; return writeVFPInst(sf, 0x02BA0040 | VD(vd) | toFixed << 18 | sx << 7 | (!isSigned) << 16 | imm5 | c); @@ -2307,7 +2307,7 @@ BufferOffset Assembler::as_vdtm(LoadStore st, Register rn, VFPRegister vd, int length, /* also has update conditions */ Condition c) { - JS_ASSERT(length <= 16 && length >= 0); + MOZ_ASSERT(length <= 16 && length >= 0); vfp_size sz = vd.isDouble() ? IsDouble : IsSingle; if (vd.isDouble()) @@ -2320,7 +2320,7 @@ Assembler::as_vdtm(LoadStore st, Register rn, VFPRegister vd, int length, BufferOffset Assembler::as_vimm(VFPRegister vd, VFPImm imm, Condition c) { - JS_ASSERT(imm.isValid()); + MOZ_ASSERT(imm.isValid()); vfp_size sz = vd.isDouble() ? IsDouble : IsSingle; return writeVFPInst(sz, c | imm.encode() | VD(vd) | 0x02B00000); @@ -2341,7 +2341,7 @@ bool Assembler::nextLink(BufferOffset b, BufferOffset *next) { Instruction branch = *editSrc(b); - JS_ASSERT(branch.is()); + MOZ_ASSERT(branch.is()); BOffImm destOff; branch.as()->extractImm(&destOff); @@ -2436,7 +2436,7 @@ Assembler::retarget(Label *label, Label *target) // The target is unbound and unused. We can just take the head of // the list hanging off of label, and dump that into target. DebugOnly prev = target->use(label->offset()); - JS_ASSERT((int32_t)prev == Label::INVALID_OFFSET); + MOZ_ASSERT((int32_t)prev == Label::INVALID_OFFSET); } } label->reset(); @@ -2492,7 +2492,7 @@ Assembler::leaveNoPool() ptrdiff_t Assembler::GetBranchOffset(const Instruction *i_) { - JS_ASSERT(i_->is()); + MOZ_ASSERT(i_->is()); InstBranchImm *i = i_->as(); BOffImm dest; i->extractImm(&dest); @@ -2551,7 +2551,7 @@ struct PoolHeader : Instruction { Header(const Instruction *i) { JS_STATIC_ASSERT(sizeof(Header) == sizeof(uint32_t)); memcpy(this, i, sizeof(Header)); - JS_ASSERT(ONES == 0xffff); + MOZ_ASSERT(ONES == 0xffff); } uint32_t raw() const { @@ -2593,9 +2593,9 @@ Assembler::WritePoolHeader(uint8_t *start, Pool *p, bool isNatural) // Go through the usual rigmarole to get the size of the pool. pool += p->getPoolSize(); uint32_t size = pool - start; - JS_ASSERT((size & 3) == 0); + MOZ_ASSERT((size & 3) == 0); size = size >> 2; - JS_ASSERT(size < (1 << 15)); + MOZ_ASSERT(size < (1 << 15)); PoolHeader header(size, isNatural); *(PoolHeader*)start = header; } @@ -2630,7 +2630,7 @@ Assembler::PatchDataWithValueCheck(CodeLocationLabel label, PatchedImmPtr newVal Register dest; Assembler::RelocStyle rs; DebugOnly val = GetPtr32Target(&iter, &dest, &rs); - JS_ASSERT((uint32_t)(const uint32_t *)val == uint32_t(expectedValue.value)); + MOZ_ASSERT((uint32_t)(const uint32_t *)val == uint32_t(expectedValue.value)); reinterpret_cast(Dummy)->ma_movPatchable(Imm32(int32_t(newValue.value)), dest, Always, rs, ptr); // L_LDR won't cause any instructions to be updated. @@ -2780,7 +2780,7 @@ Assembler::ToggleToJmp(CodeLocationLabel inst_) uint32_t *ptr = (uint32_t *)inst_.raw(); DebugOnly inst = (Instruction *)inst_.raw(); - JS_ASSERT(inst->is()); + MOZ_ASSERT(inst->is()); // Zero bits 20-27, then set 24-27 to be correct for a branch. // 20-23 will be party of the B's immediate, and should be 0. @@ -2794,16 +2794,16 @@ Assembler::ToggleToCmp(CodeLocationLabel inst_) uint32_t *ptr = (uint32_t *)inst_.raw(); DebugOnly inst = (Instruction *)inst_.raw(); - JS_ASSERT(inst->is()); + MOZ_ASSERT(inst->is()); // Ensure that this masking operation doesn't affect the offset of the // branch instruction when it gets toggled back. - JS_ASSERT((*ptr & (0xf << 20)) == 0); + MOZ_ASSERT((*ptr & (0xf << 20)) == 0); // Also make sure that the CMP is valid. Part of having a valid CMP is that // all of the bits describing the destination in most ALU instructions are // all unset (looks like it is encoding r0). - JS_ASSERT(toRD(*inst) == r0); + MOZ_ASSERT(toRD(*inst) == r0); // Zero out bits 20-27, then set them to be correct for a compare. *ptr = (*ptr & ~(0xff << 20)) | (0x35 << 20); @@ -2817,17 +2817,17 @@ Assembler::ToggleCall(CodeLocationLabel inst_, bool enabled) Instruction *inst = (Instruction *)inst_.raw(); // Skip a pool with an artificial guard. inst = inst->skipPool(); - JS_ASSERT(inst->is() || inst->is()); + MOZ_ASSERT(inst->is() || inst->is()); if (inst->is()) { // If it looks like the start of a movw/movt sequence, then make sure we // have all of it (and advance the iterator past the full sequence). inst = inst->next(); - JS_ASSERT(inst->is()); + MOZ_ASSERT(inst->is()); } inst = inst->next(); - JS_ASSERT(inst->is() || inst->is()); + MOZ_ASSERT(inst->is() || inst->is()); if (enabled == inst->is()) { // Nothing to do. @@ -2848,17 +2848,17 @@ Assembler::ToggledCallSize(uint8_t *code) Instruction *inst = (Instruction *)code; // Skip a pool with an artificial guard. inst = inst->skipPool(); - JS_ASSERT(inst->is() || inst->is()); + MOZ_ASSERT(inst->is() || inst->is()); if (inst->is()) { // If it looks like the start of a movw/movt sequence, then make sure we // have all of it (and advance the iterator past the full sequence). inst = inst->next(); - JS_ASSERT(inst->is()); + MOZ_ASSERT(inst->is()); } inst = inst->next(); - JS_ASSERT(inst->is() || inst->is()); + MOZ_ASSERT(inst->is() || inst->is()); return uintptr_t(inst) + 4 - uintptr_t(code); } @@ -2868,23 +2868,23 @@ Assembler::BailoutTableStart(uint8_t *code) Instruction *inst = (Instruction *)code; // Skip a pool with an artificial guard or NOP fill. inst = inst->skipPool(); - JS_ASSERT(inst->is()); + MOZ_ASSERT(inst->is()); return (uint8_t *) inst; } void Assembler::UpdateBoundsCheck(uint32_t heapSize, Instruction *inst) { - JS_ASSERT(inst->is()); + MOZ_ASSERT(inst->is()); InstCMP *cmp = inst->as(); Register index; cmp->extractOp1(&index); Operand2 op = cmp->extractOp2(); - JS_ASSERT(op.isImm8()); + MOZ_ASSERT(op.isImm8()); Imm8 imm8 = Imm8(heapSize); - JS_ASSERT(!imm8.invalid); + MOZ_ASSERT(!imm8.invalid); *inst = InstALU(InvalidReg, index, imm8, OpCmp, SetCond, Always); // NOTE: we don't update the Auto Flush Cache! this function is currently diff --git a/js/src/jit/arm/Assembler-arm.h b/js/src/jit/arm/Assembler-arm.h index 8c6e3ed2d81d..bda94f7c41f7 100644 --- a/js/src/jit/arm/Assembler-arm.h +++ b/js/src/jit/arm/Assembler-arm.h @@ -398,7 +398,7 @@ struct Imm8mData uint32_t invalid : 1; uint32_t encode() { - JS_ASSERT(!invalid); + MOZ_ASSERT(!invalid); return data | rot << 8; }; @@ -410,8 +410,8 @@ struct Imm8mData Imm8mData(uint32_t data_, uint32_t rot_) : data(data_), rot(rot_), invalid(0) { - JS_ASSERT(data == data_); - JS_ASSERT(rot == rot_); + MOZ_ASSERT(data == data_); + MOZ_ASSERT(rot == rot_); } }; @@ -427,7 +427,7 @@ struct Imm8Data return imm4L | (imm4H << 8); }; Imm8Data(uint32_t imm) : imm4L(imm & 0xf), imm4H(imm >> 4) { - JS_ASSERT(imm <= 0xff); + MOZ_ASSERT(imm <= 0xff); } }; @@ -442,7 +442,7 @@ struct Imm8VFPOffData return data; }; Imm8VFPOffData(uint32_t imm) : data (imm) { - JS_ASSERT((imm & ~(0xff)) == 0); + MOZ_ASSERT((imm & ~(0xff)) == 0); } }; @@ -464,7 +464,7 @@ struct Imm8VFPImmData Imm8VFPImmData(uint32_t imm) : imm4L(imm&0xf), imm4H(imm >> 4), isInvalid(0) { - JS_ASSERT(imm <= 0xff); + MOZ_ASSERT(imm <= 0xff); } uint32_t encode() { @@ -484,7 +484,7 @@ struct Imm12Data Imm12Data(uint32_t imm) : data(imm) { - JS_ASSERT(data == imm); + MOZ_ASSERT(data == imm); } }; @@ -499,7 +499,7 @@ struct RIS RIS(uint32_t imm) : ShiftAmount(imm) { - JS_ASSERT(ShiftAmount == imm); + MOZ_ASSERT(ShiftAmount == imm); } explicit RIS(Reg r) : ShiftAmount(r.ShiftAmount) {} }; @@ -513,7 +513,7 @@ struct RRS RRS(uint32_t rs) : RS(rs) { - JS_ASSERT(rs == RS); + MOZ_ASSERT(rs == RS); } uint32_t encode () { @@ -712,7 +712,7 @@ class DtrOffImm : public DtrOff DtrOffImm(int32_t imm) : DtrOff(datastore::Imm12Data(mozilla::Abs(imm)), imm >= 0 ? IsUp : IsDown) { - JS_ASSERT(mozilla::Abs(imm) < 4096); + MOZ_ASSERT(mozilla::Abs(imm) < 4096); } }; @@ -797,7 +797,7 @@ class EDtrOffImm : public EDtrOff EDtrOffImm(int32_t imm) : EDtrOff(datastore::Imm8Data(mozilla::Abs(imm)), (imm >= 0) ? IsUp : IsDown) { - JS_ASSERT(mozilla::Abs(imm) < 256); + MOZ_ASSERT(mozilla::Abs(imm) < 256); } }; @@ -846,7 +846,7 @@ class VFPOffImm : public VFPOff VFPOffImm(int32_t imm) : VFPOff(datastore::Imm8VFPOffData(mozilla::Abs(imm) / 4), imm < 0 ? IsDown : IsUp) { - JS_ASSERT(mozilla::Abs(imm) <= 255 * 4); + MOZ_ASSERT(mozilla::Abs(imm) <= 255 * 4); } }; class VFPAddr @@ -904,7 +904,7 @@ class BOffImm explicit BOffImm(int offset) : data ((offset - 8) >> 2 & 0x00ffffff) { - JS_ASSERT((offset & 0x3) == 0); + MOZ_ASSERT((offset & 0x3) == 0); if (!IsInRange(offset)) CrashAtUnhandlableOOM("BOffImm"); } @@ -1001,17 +1001,17 @@ class Operand } Operand2 toOp2() const { - JS_ASSERT(Tag == OP2); + MOZ_ASSERT(Tag == OP2); return O2Reg(Register::FromCode(reg)); } Register toReg() const { - JS_ASSERT(Tag == OP2); + MOZ_ASSERT(Tag == OP2); return Register::FromCode(reg); } void toAddr(Register *r, Imm32 *dest) const { - JS_ASSERT(Tag == MEM); + MOZ_ASSERT(Tag == MEM); *r = Register::FromCode(reg); *dest = Imm32(offset); } @@ -1019,12 +1019,12 @@ class Operand return Address(Register::FromCode(reg), offset); } int32_t disp() const { - JS_ASSERT(Tag == MEM); + MOZ_ASSERT(Tag == MEM); return offset; } int32_t base() const { - JS_ASSERT(Tag == MEM); + MOZ_ASSERT(Tag == MEM); return reg; } Register baseReg() const { @@ -1133,7 +1133,7 @@ class Assembler : public AssemblerShared return (Condition) (0xf0000000 & inst); } static inline Condition ConditionFromDoubleCondition(DoubleCondition cond) { - JS_ASSERT(!(cond & DoubleConditionBitSpecial)); + MOZ_ASSERT(!(cond & DoubleConditionBitSpecial)); return static_cast(cond); } @@ -1608,7 +1608,7 @@ class Assembler : public AssemblerShared // The buffer is about to be linked, make sure any constant pools or excess // bookkeeping has been flushed to the instruction stream. void flush() { - JS_ASSERT(!isFinished); + MOZ_ASSERT(!isFinished); m_buffer.flushPool(); return; } @@ -1625,7 +1625,7 @@ class Assembler : public AssemblerShared DTMMode mode, DTMWriteBack update = NoWriteBack, Condition c = Always) { - JS_ASSERT(!dtmActive); + MOZ_ASSERT(!dtmActive); dtmUpdate = update; dtmBase = rm; dtmLoadStore = ls; @@ -1637,8 +1637,8 @@ class Assembler : public AssemblerShared } void transferReg(Register rn) { - JS_ASSERT(dtmActive); - JS_ASSERT(rn.code() > dtmLastReg); + MOZ_ASSERT(dtmActive); + MOZ_ASSERT(rn.code() > dtmLastReg); dtmRegBitField |= 1 << rn.code(); if (dtmLoadStore == IsLoad && rn.code() == 13 && dtmBase.code() == 13) { MOZ_CRASH("ARM Spec says this is invalid"); @@ -1653,7 +1653,7 @@ class Assembler : public AssemblerShared DTMMode mode, DTMWriteBack update = NoWriteBack, Condition c = Always) { - JS_ASSERT(!dtmActive); + MOZ_ASSERT(!dtmActive); dtmActive = true; dtmUpdate = update; dtmLoadStore = ls; @@ -1670,18 +1670,18 @@ class Assembler : public AssemblerShared } else { if (dtmDelta == 0) { dtmDelta = rn.code() - dtmLastReg; - JS_ASSERT(dtmDelta == 1 || dtmDelta == -1); + MOZ_ASSERT(dtmDelta == 1 || dtmDelta == -1); } - JS_ASSERT(dtmLastReg >= 0); - JS_ASSERT(rn.code() == unsigned(dtmLastReg) + dtmDelta); + MOZ_ASSERT(dtmLastReg >= 0); + MOZ_ASSERT(rn.code() == unsigned(dtmLastReg) + dtmDelta); } dtmLastReg = rn.code(); } void finishFloatTransfer() { - JS_ASSERT(dtmActive); + MOZ_ASSERT(dtmActive); dtmActive = false; - JS_ASSERT(dtmLastReg != -1); + MOZ_ASSERT(dtmLastReg != -1); dtmDelta = dtmDelta ? dtmDelta : 1; // The operand for the vstr/vldr instruction is the lowest register in the range. int low = Min(dtmLastReg, vdtmFirstReg); @@ -1805,11 +1805,11 @@ class Instruction // cannot be made conditional, and have the usually invalid 4b1111 cond // field. Instruction (uint32_t data_, bool fake = false) : data(data_ | 0xf0000000) { - JS_ASSERT (fake || ((data_ & 0xf0000000) == 0)); + MOZ_ASSERT(fake || ((data_ & 0xf0000000) == 0)); } // Standard constructor. Instruction (uint32_t data_, Assembler::Condition c) : data(data_ | (uint32_t) c) { - JS_ASSERT ((data_ & 0xf0000000) == 0); + MOZ_ASSERT((data_ & 0xf0000000) == 0); } // You should never create an instruction directly. You should create a more // specific instruction which will eventually call one of these constructors @@ -2116,8 +2116,8 @@ GetTempRegForIntArg(uint32_t usedIntArgs, uint32_t usedFloatArgs, Register *out) static inline uint32_t GetArgStackDisp(uint32_t arg) { - JS_ASSERT(!UseHardFpABI()); - JS_ASSERT(arg >= NumIntArgRegs); + MOZ_ASSERT(!UseHardFpABI()); + MOZ_ASSERT(arg >= NumIntArgRegs); return (arg - NumIntArgRegs) * sizeof(intptr_t); } @@ -2129,7 +2129,7 @@ GetArgStackDisp(uint32_t arg) static inline bool GetFloat32ArgReg(uint32_t usedIntArgs, uint32_t usedFloatArgs, FloatRegister *out) { - JS_ASSERT(UseHardFpABI()); + MOZ_ASSERT(UseHardFpABI()); if (usedFloatArgs >= NumFloatArgRegs) return false; *out = VFPRegister(usedFloatArgs, VFPRegister::Single); @@ -2138,8 +2138,8 @@ GetFloat32ArgReg(uint32_t usedIntArgs, uint32_t usedFloatArgs, FloatRegister *ou static inline bool GetDoubleArgReg(uint32_t usedIntArgs, uint32_t usedFloatArgs, FloatRegister *out) { - JS_ASSERT(UseHardFpABI()); - JS_ASSERT((usedFloatArgs % 2) == 0); + MOZ_ASSERT(UseHardFpABI()); + MOZ_ASSERT((usedFloatArgs % 2) == 0); if (usedFloatArgs >= NumFloatArgRegs) return false; *out = VFPRegister(usedFloatArgs>>1, VFPRegister::Double); @@ -2149,8 +2149,8 @@ GetDoubleArgReg(uint32_t usedIntArgs, uint32_t usedFloatArgs, FloatRegister *out static inline uint32_t GetIntArgStackDisp(uint32_t usedIntArgs, uint32_t usedFloatArgs, uint32_t *padding) { - JS_ASSERT(UseHardFpABI()); - JS_ASSERT(usedIntArgs >= NumIntArgRegs); + MOZ_ASSERT(UseHardFpABI()); + MOZ_ASSERT(usedIntArgs >= NumIntArgRegs); uint32_t doubleSlots = Max(0, (int32_t)usedFloatArgs - (int32_t)NumFloatArgRegs); doubleSlots *= 2; int intSlots = usedIntArgs - NumIntArgRegs; @@ -2160,8 +2160,8 @@ GetIntArgStackDisp(uint32_t usedIntArgs, uint32_t usedFloatArgs, uint32_t *paddi static inline uint32_t GetFloat32ArgStackDisp(uint32_t usedIntArgs, uint32_t usedFloatArgs, uint32_t *padding) { - JS_ASSERT(UseHardFpABI()); - JS_ASSERT(usedFloatArgs >= NumFloatArgRegs); + MOZ_ASSERT(UseHardFpABI()); + MOZ_ASSERT(usedFloatArgs >= NumFloatArgRegs); uint32_t intSlots = 0; if (usedIntArgs > NumIntArgRegs) intSlots = usedIntArgs - NumIntArgRegs; @@ -2172,8 +2172,8 @@ GetFloat32ArgStackDisp(uint32_t usedIntArgs, uint32_t usedFloatArgs, uint32_t *p static inline uint32_t GetDoubleArgStackDisp(uint32_t usedIntArgs, uint32_t usedFloatArgs, uint32_t *padding) { - JS_ASSERT(UseHardFpABI()); - JS_ASSERT(usedFloatArgs >= NumFloatArgRegs); + MOZ_ASSERT(UseHardFpABI()); + MOZ_ASSERT(usedFloatArgs >= NumFloatArgRegs); uint32_t intSlots = 0; if (usedIntArgs > NumIntArgRegs) { intSlots = usedIntArgs - NumIntArgRegs; diff --git a/js/src/jit/arm/Bailouts-arm.cpp b/js/src/jit/arm/Bailouts-arm.cpp index b4f35077bd7f..85be8b26b622 100644 --- a/js/src/jit/arm/Bailouts-arm.cpp +++ b/js/src/jit/arm/Bailouts-arm.cpp @@ -41,7 +41,7 @@ class BailoutStack return FrameSizeClass::FromClass(frameClassId_); } uintptr_t tableOffset() const { - JS_ASSERT(frameClass() != FrameSizeClass::None()); + MOZ_ASSERT(frameClass() != FrameSizeClass::None()); return tableOffset_; } uint32_t frameSize() const { @@ -53,7 +53,7 @@ class BailoutStack return MachineState::FromBailout(regs_, fpregs_); } SnapshotOffset snapshotOffset() const { - JS_ASSERT(frameClass() == FrameSizeClass::None()); + MOZ_ASSERT(frameClass() == FrameSizeClass::None()); return snapshotOffset_; } uint8_t *parentStackPointer() const { @@ -99,12 +99,12 @@ IonBailoutIterator::IonBailoutIterator(const JitActivationIterator &activations, uintptr_t tableOffset = bailout->tableOffset(); uintptr_t tableStart = reinterpret_cast(Assembler::BailoutTableStart(code->raw())); - JS_ASSERT(tableOffset >= tableStart && - tableOffset < tableStart + code->instructionsSize()); - JS_ASSERT((tableOffset - tableStart) % BAILOUT_TABLE_ENTRY_SIZE == 0); + MOZ_ASSERT(tableOffset >= tableStart && + tableOffset < tableStart + code->instructionsSize()); + MOZ_ASSERT((tableOffset - tableStart) % BAILOUT_TABLE_ENTRY_SIZE == 0); uint32_t bailoutId = ((tableOffset - tableStart) / BAILOUT_TABLE_ENTRY_SIZE) - 1; - JS_ASSERT(bailoutId < BAILOUT_TABLE_SIZE); + MOZ_ASSERT(bailoutId < BAILOUT_TABLE_SIZE); snapshotOffset_ = topIonScript_->bailoutToSnapshot(bailoutId); } diff --git a/js/src/jit/arm/BaselineHelpers-arm.h b/js/src/jit/arm/BaselineHelpers-arm.h index 18b87206a3e5..17e4094d0ba2 100644 --- a/js/src/jit/arm/BaselineHelpers-arm.h +++ b/js/src/jit/arm/BaselineHelpers-arm.h @@ -42,7 +42,7 @@ EmitCallIC(CodeOffsetLabel *patchOffset, MacroAssembler &masm) // Load stubcode pointer from BaselineStubEntry. // R2 won't be active when we call ICs, so we can use r0. - JS_ASSERT(R2 == ValueOperand(r1, r0)); + MOZ_ASSERT(R2 == ValueOperand(r1, r0)); masm.loadPtr(Address(BaselineStubReg, ICStub::offsetOfStubCode()), r0); // Call the stubcode via a direct branch-and-link. @@ -59,7 +59,7 @@ EmitEnterTypeMonitorIC(MacroAssembler &masm, // Load stubcode pointer from BaselineStubEntry. // R2 won't be active when we call ICs, so we can use r0. - JS_ASSERT(R2 == ValueOperand(r1, r0)); + MOZ_ASSERT(R2 == ValueOperand(r1, r0)); masm.loadPtr(Address(BaselineStubReg, ICStub::offsetOfStubCode()), r0); // Jump to the stubcode. @@ -83,7 +83,7 @@ EmitTailCallVM(JitCode *target, MacroAssembler &masm, uint32_t argSize) { // We assume during this that R0 and R1 have been pushed, and that R2 is // unused. - JS_ASSERT(R2 == ValueOperand(r1, r0)); + MOZ_ASSERT(R2 == ValueOperand(r1, r0)); // Compute frame size. masm.movePtr(BaselineFrameReg, r0); @@ -98,7 +98,7 @@ EmitTailCallVM(JitCode *target, MacroAssembler &masm, uint32_t argSize) // BaselineTailCallReg (lr) already contains the return address (as we keep // it there through the stub calls), but the VMWrapper code being called // expects the return address to also be pushed on the stack. - JS_ASSERT(BaselineTailCallReg == lr); + MOZ_ASSERT(BaselineTailCallReg == lr); masm.makeFrameDescriptor(r0, JitFrame_BaselineJS); masm.push(r0); masm.push(lr); @@ -132,7 +132,7 @@ static const uint32_t STUB_FRAME_SAVED_STUB_OFFSET = sizeof(void *); inline void EmitEnterStubFrame(MacroAssembler &masm, Register scratch) { - JS_ASSERT(scratch != BaselineTailCallReg); + MOZ_ASSERT(scratch != BaselineTailCallReg); // Compute frame size. masm.mov(BaselineFrameReg, scratch); @@ -186,7 +186,7 @@ EmitLeaveStubFrame(MacroAssembler &masm, bool calledIntoIon = false) inline void EmitStowICValues(MacroAssembler &masm, int values) { - JS_ASSERT(values >= 0 && values <= 2); + MOZ_ASSERT(values >= 0 && values <= 2); switch(values) { case 1: // Stow R0. @@ -203,7 +203,7 @@ EmitStowICValues(MacroAssembler &masm, int values) inline void EmitUnstowICValues(MacroAssembler &masm, int values, bool discard = false) { - JS_ASSERT(values >= 0 && values <= 2); + MOZ_ASSERT(values >= 0 && values <= 2); switch(values) { case 1: // Unstow R0. @@ -227,7 +227,7 @@ EmitUnstowICValues(MacroAssembler &masm, int values, bool discard = false) inline void EmitCallTypeUpdateIC(MacroAssembler &masm, JitCode *code, uint32_t objectOffset) { - JS_ASSERT(R2 == ValueOperand(r1, r0)); + MOZ_ASSERT(R2 == ValueOperand(r1, r0)); // R0 contains the value that needs to be typechecked. The object we're // updating is a boxed Value on the stack, at offset objectOffset from esp, @@ -294,7 +294,7 @@ EmitPreBarrier(MacroAssembler &masm, const AddrType &addr, MIRType type) inline void EmitStubGuardFailure(MacroAssembler &masm) { - JS_ASSERT(R2 == ValueOperand(r1, r0)); + MOZ_ASSERT(R2 == ValueOperand(r1, r0)); // NOTE: This routine assumes that the stub guard code left the stack in the // same state it was in when it was entered. @@ -308,7 +308,7 @@ EmitStubGuardFailure(MacroAssembler &masm) masm.loadPtr(Address(BaselineStubReg, ICStub::offsetOfStubCode()), r0); // Return address is already loaded, just jump to the next stubcode. - JS_ASSERT(BaselineTailCallReg == lr); + MOZ_ASSERT(BaselineTailCallReg == lr); masm.branch(r0); } diff --git a/js/src/jit/arm/BaselineIC-arm.cpp b/js/src/jit/arm/BaselineIC-arm.cpp index 2539e8e854a6..a23e8d3c5a13 100644 --- a/js/src/jit/arm/BaselineIC-arm.cpp +++ b/js/src/jit/arm/BaselineIC-arm.cpp @@ -133,8 +133,8 @@ ICBinaryArith_Int32::Compiler::generateStubCode(MacroAssembler &masm) // The call will preserve registers r4-r11. Save R0 and the link // register. - JS_ASSERT(R1 == ValueOperand(r5, r4)); - JS_ASSERT(R0 == ValueOperand(r3, r2)); + MOZ_ASSERT(R1 == ValueOperand(r5, r4)); + MOZ_ASSERT(R0 == ValueOperand(r3, r2)); masm.moveValue(R0, savedValue); masm.setupAlignedABICall(2); diff --git a/js/src/jit/arm/CodeGenerator-arm.cpp b/js/src/jit/arm/CodeGenerator-arm.cpp index 6fe7979224ce..692e3e6ec808 100644 --- a/js/src/jit/arm/CodeGenerator-arm.cpp +++ b/js/src/jit/arm/CodeGenerator-arm.cpp @@ -40,7 +40,7 @@ CodeGeneratorARM::CodeGeneratorARM(MIRGenerator *gen, LIRGraph *graph, MacroAsse bool CodeGeneratorARM::generatePrologue() { - JS_ASSERT(!gen->compilingAsmJS()); + MOZ_ASSERT(!gen->compilingAsmJS()); // Note that this automatically sets MacroAssembler::framePushed(). masm.reserveStack(frameSize()); @@ -51,7 +51,7 @@ CodeGeneratorARM::generatePrologue() bool CodeGeneratorARM::generateEpilogue() { - JS_ASSERT(!gen->compilingAsmJS()); + MOZ_ASSERT(!gen->compilingAsmJS()); masm.bind(&returnLabel_); #ifdef JS_TRACE_LOGGING @@ -64,7 +64,7 @@ CodeGeneratorARM::generateEpilogue() #endif masm.freeStack(frameSize()); - JS_ASSERT(masm.framePushed() == 0); + MOZ_ASSERT(masm.framePushed() == 0); masm.pop(pc); masm.flushBuffer(); return true; @@ -197,8 +197,8 @@ CodeGeneratorARM::bailoutFrom(Label *label, LSnapshot *snapshot) { if (masm.bailed()) return false; - JS_ASSERT(label->used()); - JS_ASSERT(!label->bound()); + MOZ_ASSERT(label->used()); + MOZ_ASSERT(!label->bound()); if (!encode(snapshot)) return false; @@ -248,7 +248,7 @@ CodeGeneratorARM::visitMinMaxD(LMinMaxD *ins) FloatRegister second = ToFloatRegister(ins->second()); FloatRegister output = ToFloatRegister(ins->output()); - JS_ASSERT(first == output); + MOZ_ASSERT(first == output); Assembler::Condition cond = ins->mir()->isMax() ? Assembler::VFP_LessThanOrEqual @@ -297,7 +297,7 @@ CodeGeneratorARM::visitMinMaxF(LMinMaxF *ins) FloatRegister second = ToFloatRegister(ins->second()); FloatRegister output = ToFloatRegister(ins->output()); - JS_ASSERT(first == output); + MOZ_ASSERT(first == output); Assembler::Condition cond = ins->mir()->isMax() ? Assembler::VFP_LessThanOrEqual @@ -343,7 +343,7 @@ bool CodeGeneratorARM::visitAbsD(LAbsD *ins) { FloatRegister input = ToFloatRegister(ins->input()); - JS_ASSERT(input == ToFloatRegister(ins->output())); + MOZ_ASSERT(input == ToFloatRegister(ins->output())); masm.ma_vabs(input, input); return true; } @@ -352,7 +352,7 @@ bool CodeGeneratorARM::visitAbsF(LAbsF *ins) { FloatRegister input = ToFloatRegister(ins->input()); - JS_ASSERT(input == ToFloatRegister(ins->output())); + MOZ_ASSERT(input == ToFloatRegister(ins->output())); masm.ma_vabs_f32(input, input); return true; } @@ -551,7 +551,7 @@ CodeGeneratorARM::divICommon(MDiv *mir, Register lhs, Register rhs, Register out masm.ma_b(&done); masm.bind(&skip); } else { - JS_ASSERT(mir->fallible()); + MOZ_ASSERT(mir->fallible()); if (!bailoutIf(Assembler::Equal, snapshot)) return false; } @@ -568,7 +568,7 @@ CodeGeneratorARM::divICommon(MDiv *mir, Register lhs, Register rhs, Register out masm.ma_b(&done); masm.bind(&skip); } else { - JS_ASSERT(mir->fallible()); + MOZ_ASSERT(mir->fallible()); if (!bailoutIf(Assembler::Equal, snapshot)) return false; } @@ -580,7 +580,7 @@ CodeGeneratorARM::divICommon(MDiv *mir, Register lhs, Register rhs, Register out masm.ma_cmp(lhs, Imm32(0)); masm.ma_b(&nonzero, Assembler::NotEqual); masm.ma_cmp(rhs, Imm32(0)); - JS_ASSERT(mir->fallible()); + MOZ_ASSERT(mir->fallible()); if (!bailoutIf(Assembler::LessThan, snapshot)) return false; masm.bind(&nonzero); @@ -646,7 +646,7 @@ CodeGeneratorARM::visitSoftDivI(LSoftDivI *ins) masm.callWithABI(JS_FUNC_TO_DATA_PTR(void *, __aeabi_idivmod)); // idivmod returns the quotient in r0, and the remainder in r1. if (!mir->canTruncateRemainder()) { - JS_ASSERT(mir->fallible()); + MOZ_ASSERT(mir->fallible()); masm.ma_cmp(r1, Imm32(0)); if (!bailoutIf(Assembler::NonZero, ins->snapshot())) return false; @@ -726,7 +726,7 @@ CodeGeneratorARM::modICommon(MMod *mir, Register lhs, Register rhs, Register out masm.ma_b(&done); masm.bind(&skip); } else { - JS_ASSERT(mir->fallible()); + MOZ_ASSERT(mir->fallible()); if (!bailoutIf(Assembler::Equal, snapshot)) return false; } @@ -758,7 +758,7 @@ CodeGeneratorARM::visitModI(LModI *ins) if (mir->isTruncated()) { // -0.0|0 == 0 } else { - JS_ASSERT(mir->fallible()); + MOZ_ASSERT(mir->fallible()); // See if X < 0 masm.ma_cmp(output, Imm32(0)); masm.ma_b(&done, Assembler::NotEqual); @@ -784,7 +784,7 @@ CodeGeneratorARM::visitSoftModI(LSoftModI *ins) Label done; // Save the lhs in case we end up with a 0 that should be a -0.0 because lhs < 0. - JS_ASSERT(callTemp.code() > r3.code() && callTemp.code() < r12.code()); + MOZ_ASSERT(callTemp.code() > r3.code() && callTemp.code() < r12.code()); masm.ma_mov(lhs, callTemp); // Prevent INT_MIN % -1; @@ -802,7 +802,7 @@ CodeGeneratorARM::visitSoftModI(LSoftModI *ins) masm.ma_b(&done); masm.bind(&skip); } else { - JS_ASSERT(mir->fallible()); + MOZ_ASSERT(mir->fallible()); if (!bailoutIf(Assembler::Equal, ins->snapshot())) return false; } @@ -824,7 +824,7 @@ CodeGeneratorARM::visitSoftModI(LSoftModI *ins) if (mir->isTruncated()) { // -0.0|0 == 0 } else { - JS_ASSERT(mir->fallible()); + MOZ_ASSERT(mir->fallible()); // See if X < 0 masm.ma_cmp(r1, Imm32(0)); masm.ma_b(&done, Assembler::NotEqual); @@ -853,7 +853,7 @@ CodeGeneratorARM::visitModPowTwoI(LModPowTwoI *ins) masm.ma_rsb(Imm32(0), out, SetCond, Assembler::Signed); if (mir->canBeNegativeDividend()) { if (!mir->isTruncated()) { - JS_ASSERT(mir->fallible()); + MOZ_ASSERT(mir->fallible()); if (!bailoutIf(Assembler::Zero, ins->snapshot())) return false; } else { @@ -875,7 +875,7 @@ CodeGeneratorARM::visitModMaskI(LModMaskI *ins) masm.ma_mod_mask(src, dest, tmp1, tmp2, ins->shift()); if (mir->canBeNegativeDividend()) { if (!mir->isTruncated()) { - JS_ASSERT(mir->fallible()); + MOZ_ASSERT(mir->fallible()); if (!bailoutIf(Assembler::Zero, ins->snapshot())) return false; } else { @@ -891,7 +891,7 @@ CodeGeneratorARM::visitBitNotI(LBitNotI *ins) const LDefinition *dest = ins->getDef(0); // This will not actually be true on arm. We can not an imm8m in order to // get a wider range of numbers - JS_ASSERT(!input->isConstant()); + MOZ_ASSERT(!input->isConstant()); masm.ma_mvn(ToRegister(input), ToRegister(dest)); return true; @@ -1064,7 +1064,7 @@ CodeGeneratorARM::toMoveOperand(const LAllocation *a) const if (a->isFloatReg()) return MoveOperand(ToFloatRegister(a)); int32_t offset = ToStackOffset(a); - JS_ASSERT((offset & 3) == 0); + MOZ_ASSERT((offset & 3) == 0); return MoveOperand(StackPointer, offset); } @@ -1352,8 +1352,8 @@ FrameSizeClass::ClassLimit() uint32_t FrameSizeClass::frameSize() const { - JS_ASSERT(class_ != NO_FRAME_SIZE_CLASS_ID); - JS_ASSERT(class_ < JS_ARRAY_LENGTH(FrameSizes)); + MOZ_ASSERT(class_ != NO_FRAME_SIZE_CLASS_ID); + MOZ_ASSERT(class_ < JS_ARRAY_LENGTH(FrameSizes)); return FrameSizes[class_]; } @@ -1396,7 +1396,7 @@ CodeGeneratorARM::visitBox(LBox *box) { const LDefinition *type = box->getDef(TYPE_INDEX); - JS_ASSERT(!box->getOperand(0)->isConstant()); + MOZ_ASSERT(!box->getOperand(0)->isConstant()); // On x86, the input operand and the output payload have the same virtual // register. All that needs to be written is the type tag for the type @@ -1557,7 +1557,7 @@ CodeGeneratorARM::visitCompareB(LCompareB *lir) const LAllocation *rhs = lir->rhs(); const Register output = ToRegister(lir->output()); - JS_ASSERT(mir->jsop() == JSOP_STRICTEQ || mir->jsop() == JSOP_STRICTNE); + MOZ_ASSERT(mir->jsop() == JSOP_STRICTEQ || mir->jsop() == JSOP_STRICTNE); Label notBoolean, done; masm.branchTestBoolean(Assembler::NotEqual, lhs, ¬Boolean); @@ -1586,7 +1586,7 @@ CodeGeneratorARM::visitCompareBAndBranch(LCompareBAndBranch *lir) const ValueOperand lhs = ToValue(lir, LCompareBAndBranch::Lhs); const LAllocation *rhs = lir->rhs(); - JS_ASSERT(mir->jsop() == JSOP_STRICTEQ || mir->jsop() == JSOP_STRICTNE); + MOZ_ASSERT(mir->jsop() == JSOP_STRICTEQ || mir->jsop() == JSOP_STRICTNE); Assembler::Condition cond = masm.testBoolean(Assembler::NotEqual, lhs); jumpToBlock((mir->jsop() == JSOP_STRICTEQ) ? lir->ifFalse() : lir->ifTrue(), cond); @@ -1608,8 +1608,8 @@ CodeGeneratorARM::visitCompareV(LCompareV *lir) const ValueOperand rhs = ToValue(lir, LCompareV::RhsInput); const Register output = ToRegister(lir->output()); - JS_ASSERT(mir->jsop() == JSOP_EQ || mir->jsop() == JSOP_STRICTEQ || - mir->jsop() == JSOP_NE || mir->jsop() == JSOP_STRICTNE); + MOZ_ASSERT(mir->jsop() == JSOP_EQ || mir->jsop() == JSOP_STRICTEQ || + mir->jsop() == JSOP_NE || mir->jsop() == JSOP_STRICTNE); Label notEqual, done; masm.cmp32(lhs.typeReg(), rhs.typeReg()); @@ -1636,8 +1636,8 @@ CodeGeneratorARM::visitCompareVAndBranch(LCompareVAndBranch *lir) const ValueOperand lhs = ToValue(lir, LCompareVAndBranch::LhsInput); const ValueOperand rhs = ToValue(lir, LCompareVAndBranch::RhsInput); - JS_ASSERT(mir->jsop() == JSOP_EQ || mir->jsop() == JSOP_STRICTEQ || - mir->jsop() == JSOP_NE || mir->jsop() == JSOP_STRICTNE); + MOZ_ASSERT(mir->jsop() == JSOP_EQ || mir->jsop() == JSOP_STRICTEQ || + mir->jsop() == JSOP_NE || mir->jsop() == JSOP_STRICTNE); MBasicBlock *notEqual = (cond == Assembler::Equal) ? lir->ifFalse() : lir->ifTrue(); @@ -1892,9 +1892,9 @@ CodeGeneratorARM::visitAsmJSLoadHeap(LAsmJSLoadHeap *ins) const LAllocation *ptr = ins->ptr(); if (ptr->isConstant()) { - JS_ASSERT(mir->skipBoundsCheck()); + MOZ_ASSERT(mir->skipBoundsCheck()); int32_t ptrImm = ptr->toConstant()->toInt32(); - JS_ASSERT(ptrImm >= 0); + MOZ_ASSERT(ptrImm >= 0); if (isFloat) { VFPRegister vd(ToFloatRegister(ins->output())); if (size == 32) @@ -1966,9 +1966,9 @@ CodeGeneratorARM::visitAsmJSStoreHeap(LAsmJSStoreHeap *ins) } const LAllocation *ptr = ins->ptr(); if (ptr->isConstant()) { - JS_ASSERT(mir->skipBoundsCheck()); + MOZ_ASSERT(mir->skipBoundsCheck()); int32_t ptrImm = ptr->toConstant()->toInt32(); - JS_ASSERT(ptrImm >= 0); + MOZ_ASSERT(ptrImm >= 0); if (isFloat) { VFPRegister vd(ToFloatRegister(ins->value())); if (size == 32) @@ -2050,7 +2050,7 @@ CodeGeneratorARM::visitUDiv(LUDiv *ins) masm.ma_b(&done); masm.bind(&skip); } else { - JS_ASSERT(ins->mir()->fallible()); + MOZ_ASSERT(ins->mir()->fallible()); if (!bailoutIf(Assembler::Equal, ins->snapshot())) return false; } @@ -2086,7 +2086,7 @@ CodeGeneratorARM::visitUMod(LUMod *ins) masm.ma_b(&done); masm.bind(&skip); } else { - JS_ASSERT(ins->mir()->fallible()); + MOZ_ASSERT(ins->mir()->fallible()); if (!bailoutIf(Assembler::Equal, ins->snapshot())) return false; } @@ -2111,9 +2111,9 @@ CodeGeneratorARM::visitSoftUDivOrMod(LSoftUDivOrMod *ins) Register rhs = ToRegister(ins->rhs()); Register output = ToRegister(ins->output()); - JS_ASSERT(lhs == r0); - JS_ASSERT(rhs == r1); - JS_ASSERT(ins->mirRaw()->isDiv() || ins->mirRaw()->isMod()); + MOZ_ASSERT(lhs == r0); + MOZ_ASSERT(rhs == r1); + MOZ_ASSERT(ins->mirRaw()->isDiv() || ins->mirRaw()->isMod()); JS_ASSERT_IF(ins->mirRaw()->isDiv(), output == r0); JS_ASSERT_IF(ins->mirRaw()->isMod(), output == r1); @@ -2172,7 +2172,7 @@ CodeGeneratorARM::visitAsmJSStoreGlobalVar(LAsmJSStoreGlobalVar *ins) const MAsmJSStoreGlobalVar *mir = ins->mir(); MIRType type = mir->value()->type(); - JS_ASSERT(IsNumberType(type)); + MOZ_ASSERT(IsNumberType(type)); unsigned addr = mir->globalDataOffset() - AsmJSGlobalRegBias; if (mir->value()->type() == MIRType_Int32) { masm.ma_dtr(IsStore, GlobalReg, Imm32(addr), ToRegister(ins->value())); diff --git a/js/src/jit/arm/Lowering-arm.cpp b/js/src/jit/arm/Lowering-arm.cpp index 467d0508a227..f52a2ed69f06 100644 --- a/js/src/jit/arm/Lowering-arm.cpp +++ b/js/src/jit/arm/Lowering-arm.cpp @@ -21,7 +21,7 @@ bool LIRGeneratorARM::useBox(LInstruction *lir, size_t n, MDefinition *mir, LUse::Policy policy, bool useAtStart) { - JS_ASSERT(mir->type() == MIRType_Value); + MOZ_ASSERT(mir->type() == MIRType_Value); if (!ensureDefined(mir)) return false; lir->setOperand(n, LUse(mir->virtualRegister(), policy, useAtStart)); @@ -33,8 +33,8 @@ bool LIRGeneratorARM::useBoxFixed(LInstruction *lir, size_t n, MDefinition *mir, Register reg1, Register reg2) { - JS_ASSERT(mir->type() == MIRType_Value); - JS_ASSERT(reg1 != reg2); + MOZ_ASSERT(mir->type() == MIRType_Value); + MOZ_ASSERT(reg1 != reg2); if (!ensureDefined(mir)) return false; @@ -126,7 +126,7 @@ LIRGeneratorARM::visitUnbox(MUnbox *unbox) // a payload. Unlike most instructions conusming a box, we ask for the type // second, so that the result can re-use the first input. MDefinition *inner = unbox->getOperand(0); - JS_ASSERT(inner->type() == MIRType_Value); + MOZ_ASSERT(inner->type() == MIRType_Value); if (!ensureDefined(inner)) return false; @@ -160,7 +160,7 @@ bool LIRGeneratorARM::visitReturn(MReturn *ret) { MDefinition *opd = ret->getOperand(0); - JS_ASSERT(opd->type() == MIRType_Value); + MOZ_ASSERT(opd->type() == MIRType_Value); LReturn *ins = new(alloc()) LReturn; ins->setOperand(0, LUse(JSReturnReg_Type)); @@ -229,7 +229,7 @@ LIRGeneratorARM::defineUntypedPhi(MPhi *phi, size_t lirIndex) uint32_t payloadVreg = getVirtualRegister(); if (payloadVreg >= MAX_VIRTUAL_REGISTERS) return false; - JS_ASSERT(typeVreg + 1 == payloadVreg); + MOZ_ASSERT(typeVreg + 1 == payloadVreg); type->setDef(0, LDefinition(typeVreg, LDefinition::TYPE)); payload->setDef(0, LDefinition(payloadVreg, LDefinition::PAYLOAD)); @@ -346,7 +346,7 @@ bool LIRGeneratorARM::visitPowHalf(MPowHalf *ins) { MDefinition *input = ins->input(); - JS_ASSERT(input->type() == MIRType_Double); + MOZ_ASSERT(input->type() == MIRType_Double); LPowHalfD *lir = new(alloc()) LPowHalfD(useRegisterAtStart(input)); return defineReuseInput(lir, ins, 0); } @@ -367,7 +367,7 @@ LIRGeneratorARM::newLTableSwitchV(MTableSwitch *tableswitch) bool LIRGeneratorARM::visitGuardShape(MGuardShape *ins) { - JS_ASSERT(ins->obj()->type() == MIRType_Object); + MOZ_ASSERT(ins->obj()->type() == MIRType_Object); LDefinition tempObj = temp(LDefinition::OBJECT); LGuardShape *guard = new(alloc()) LGuardShape(useRegister(ins->obj()), tempObj); @@ -381,7 +381,7 @@ LIRGeneratorARM::visitGuardShape(MGuardShape *ins) bool LIRGeneratorARM::visitGuardObjectType(MGuardObjectType *ins) { - JS_ASSERT(ins->obj()->type() == MIRType_Object); + MOZ_ASSERT(ins->obj()->type() == MIRType_Object); LDefinition tempObj = temp(LDefinition::OBJECT); LGuardObjectType *guard = new(alloc()) LGuardObjectType(useRegister(ins->obj()), tempObj); @@ -398,8 +398,8 @@ LIRGeneratorARM::lowerUrshD(MUrsh *mir) MDefinition *lhs = mir->lhs(); MDefinition *rhs = mir->rhs(); - JS_ASSERT(lhs->type() == MIRType_Int32); - JS_ASSERT(rhs->type() == MIRType_Int32); + MOZ_ASSERT(lhs->type() == MIRType_Int32); + MOZ_ASSERT(rhs->type() == MIRType_Int32); LUrshD *lir = new(alloc()) LUrshD(useRegister(lhs), useRegisterOrConstant(rhs), temp()); return define(lir, mir); @@ -414,7 +414,7 @@ LIRGeneratorARM::visitAsmJSNeg(MAsmJSNeg *ins) if(ins->type() == MIRType_Float32) return define(new(alloc()) LNegF(useRegisterAtStart(ins->input())), ins); - JS_ASSERT(ins->type() == MIRType_Double); + MOZ_ASSERT(ins->type() == MIRType_Double); return define(new(alloc()) LNegD(useRegisterAtStart(ins->input())), ins); } @@ -465,7 +465,7 @@ LIRGeneratorARM::lowerUMod(MMod *mod) bool LIRGeneratorARM::visitAsmJSUnsignedToDouble(MAsmJSUnsignedToDouble *ins) { - JS_ASSERT(ins->input()->type() == MIRType_Int32); + MOZ_ASSERT(ins->input()->type() == MIRType_Int32); LAsmJSUInt32ToDouble *lir = new(alloc()) LAsmJSUInt32ToDouble(useRegisterAtStart(ins->input())); return define(lir, ins); } @@ -473,7 +473,7 @@ LIRGeneratorARM::visitAsmJSUnsignedToDouble(MAsmJSUnsignedToDouble *ins) bool LIRGeneratorARM::visitAsmJSUnsignedToFloat32(MAsmJSUnsignedToFloat32 *ins) { - JS_ASSERT(ins->input()->type() == MIRType_Int32); + MOZ_ASSERT(ins->input()->type() == MIRType_Int32); LAsmJSUInt32ToFloat32 *lir = new(alloc()) LAsmJSUInt32ToFloat32(useRegisterAtStart(ins->input())); return define(lir, ins); } @@ -482,14 +482,14 @@ bool LIRGeneratorARM::visitAsmJSLoadHeap(MAsmJSLoadHeap *ins) { MDefinition *ptr = ins->ptr(); - JS_ASSERT(ptr->type() == MIRType_Int32); + MOZ_ASSERT(ptr->type() == MIRType_Int32); LAllocation ptrAlloc; // For the ARM it is best to keep the 'ptr' in a register if a bounds check is needed. if (ptr->isConstant() && ins->skipBoundsCheck()) { int32_t ptrValue = ptr->toConstant()->value().toInt32(); // A bounds check is only skipped for a positive index. - JS_ASSERT(ptrValue >= 0); + MOZ_ASSERT(ptrValue >= 0); ptrAlloc = LAllocation(ptr->toConstant()->vp()); } else ptrAlloc = useRegisterAtStart(ptr); @@ -501,11 +501,11 @@ bool LIRGeneratorARM::visitAsmJSStoreHeap(MAsmJSStoreHeap *ins) { MDefinition *ptr = ins->ptr(); - JS_ASSERT(ptr->type() == MIRType_Int32); + MOZ_ASSERT(ptr->type() == MIRType_Int32); LAllocation ptrAlloc; if (ptr->isConstant() && ins->skipBoundsCheck()) { - JS_ASSERT(ptr->toConstant()->value().toInt32() >= 0); + MOZ_ASSERT(ptr->toConstant()->value().toInt32() >= 0); ptrAlloc = LAllocation(ptr->toConstant()->vp()); } else ptrAlloc = useRegisterAtStart(ptr); @@ -523,7 +523,7 @@ bool LIRGeneratorARM::lowerTruncateDToInt32(MTruncateToInt32 *ins) { MDefinition *opd = ins->input(); - JS_ASSERT(opd->type() == MIRType_Double); + MOZ_ASSERT(opd->type() == MIRType_Double); return define(new(alloc()) LTruncateDToInt32(useRegister(opd), LDefinition::BogusTemp()), ins); } @@ -532,7 +532,7 @@ bool LIRGeneratorARM::lowerTruncateFToInt32(MTruncateToInt32 *ins) { MDefinition *opd = ins->input(); - JS_ASSERT(opd->type() == MIRType_Float32); + MOZ_ASSERT(opd->type() == MIRType_Float32); return define(new(alloc()) LTruncateFToInt32(useRegister(opd), LDefinition::BogusTemp()), ins); } diff --git a/js/src/jit/arm/MacroAssembler-arm.cpp b/js/src/jit/arm/MacroAssembler-arm.cpp index 7ab134b3baa3..a26e84c6e9fd 100644 --- a/js/src/jit/arm/MacroAssembler-arm.cpp +++ b/js/src/jit/arm/MacroAssembler-arm.cpp @@ -164,8 +164,8 @@ MacroAssemblerARM::convertFloat32ToInt32(FloatRegister src, Register dest, void MacroAssemblerARM::convertFloat32ToDouble(FloatRegister src, FloatRegister dest) { - JS_ASSERT(dest.isDouble()); - JS_ASSERT(src.isSingle()); + MOZ_ASSERT(dest.isDouble()); + MOZ_ASSERT(src.isSingle()); as_vcvt(VFPRegister(dest), VFPRegister(src).singleOverlay()); } @@ -270,7 +270,7 @@ MacroAssemblerARM::ma_alu(Register src1, Imm32 imm, Register dest, // As it turns out, if you ask for a compare-like instruction you *probably* // want it to set condition codes. if (dest == InvalidReg) - JS_ASSERT(sc == SetCond); + MOZ_ASSERT(sc == SetCond); // The operator gives us the ability to determine how this can be used. Imm8 imm8 = Imm8(imm.value); @@ -305,7 +305,7 @@ MacroAssemblerARM::ma_alu(Register src1, Imm32 imm, Register dest, // so we can set the register this way. movt leaves the bottom 16 // bits in tact, so it is unsuitable to move a constant that if (op == OpMov && ((imm.value & ~ 0xffff) == 0)) { - JS_ASSERT(src1 == InvalidReg); + MOZ_ASSERT(src1 == InvalidReg); as_movw(dest, (uint16_t)imm.value, c); return; } @@ -313,7 +313,7 @@ MacroAssemblerARM::ma_alu(Register src1, Imm32 imm, Register dest, // If they asked for a mvn rfoo, imm, where ~imm fits into 16 bits // then do it. if (op == OpMvn && (((~imm.value) & ~ 0xffff) == 0)) { - JS_ASSERT(src1 == InvalidReg); + MOZ_ASSERT(src1 == InvalidReg); as_movw(dest, (uint16_t)~imm.value, c); return; } @@ -388,7 +388,7 @@ void MacroAssemblerARM::ma_alu(Register src1, Operand op2, Register dest, ALUOp op, SetCond_ sc, Assembler::Condition c) { - JS_ASSERT(op2.getTag() == Operand::OP2); + MOZ_ASSERT(op2.getTag() == Operand::OP2); as_alu(dest, src1, op2.toOp2(), op, sc, c); } @@ -1048,8 +1048,8 @@ MacroAssemblerARM::ma_str(Register rt, const Operand &addr, Index mode, Conditio void MacroAssemblerARM::ma_strd(Register rt, DebugOnly rt2, EDtrAddr addr, Index mode, Condition cc) { - JS_ASSERT((rt.code() & 1) == 0); - JS_ASSERT(rt2.value.code() == rt.code() + 1); + MOZ_ASSERT((rt.code() & 1) == 0); + MOZ_ASSERT(rt2.value.code() == rt.code() + 1); as_extdtr(IsStore, 64, true, mode, rt, addr, cc); } @@ -1090,8 +1090,8 @@ void MacroAssemblerARM::ma_ldrd(EDtrAddr addr, Register rt, DebugOnly rt2, Index mode, Condition cc) { - JS_ASSERT((rt.code() & 1) == 0); - JS_ASSERT(rt2.value.code() == rt.code() + 1); + MOZ_ASSERT((rt.code() & 1) == 0); + MOZ_ASSERT(rt2.value.code() == rt.code() + 1); as_extdtr(IsLoad, 64, true, mode, rt, addr, cc); } void @@ -1116,8 +1116,8 @@ MacroAssemblerARM::ma_dataTransferN(LoadStore ls, int size, bool IsSigned, return as_dtr(ls, size, mode, rt, DTRAddr(rn, DtrRegImmShift(rm, LSL, shiftAmount)), cc); } else { if (shiftAmount != 0) { - JS_ASSERT(rn != ScratchRegister); - JS_ASSERT(rt != ScratchRegister); + MOZ_ASSERT(rn != ScratchRegister); + MOZ_ASSERT(rt != ScratchRegister); ma_lsl(Imm32(shiftAmount), rm, ScratchRegister); rm = ScratchRegister; } @@ -1188,7 +1188,7 @@ MacroAssemblerARM::ma_dataTransferN(LoadStore ls, int size, bool IsSigned, // is updated. if (mode == PreIndex) base = rn; - JS_ASSERT(mode != PostIndex); + MOZ_ASSERT(mode != PostIndex); // At this point, both off - bottom and off + neg_bottom will be // reasonable-ish quantities. // @@ -1206,7 +1206,7 @@ MacroAssemblerARM::ma_dataTransferN(LoadStore ls, int size, bool IsSigned, sub_off = Imm8(-(off + neg_bottom)); if (!sub_off.invalid && bottom != 0) { // Guarded against by: bottom != 0 - JS_ASSERT(neg_bottom < 0x1000); + MOZ_ASSERT(neg_bottom < 0x1000); // - sub_off = neg_bottom + off as_sub(ScratchRegister, rn, sub_off, NoSetCond, cc); return as_dtr(ls, size, Offset, rt, DTRAddr(ScratchRegister, DtrOffImm(-neg_bottom)), cc); @@ -1223,7 +1223,7 @@ MacroAssemblerARM::ma_dataTransferN(LoadStore ls, int size, bool IsSigned, sub_off = Imm8(off + neg_bottom); if (!sub_off.invalid && bottom != 0) { // Guarded against by: bottom != 0 - JS_ASSERT(neg_bottom < 0x1000); + MOZ_ASSERT(neg_bottom < 0x1000); // sub_off = neg_bottom + off as_add(ScratchRegister, rn, sub_off, NoSetCond, cc); return as_dtr(ls, size, Offset, rt, DTRAddr(ScratchRegister, DtrOffImm(-neg_bottom)), cc); @@ -1260,7 +1260,7 @@ MacroAssemblerARM::ma_dataTransferN(LoadStore ls, int size, bool IsSigned, sub_off = Imm8(-(off + neg_bottom)); if (!sub_off.invalid && bottom != 0) { // Guarded against by: bottom != 0 - JS_ASSERT(neg_bottom < 0x100); + MOZ_ASSERT(neg_bottom < 0x100); // - sub_off = neg_bottom + off as_sub(ScratchRegister, rn, sub_off, NoSetCond, cc); return as_extdtr(ls, size, IsSigned, Offset, rt, @@ -1281,7 +1281,7 @@ MacroAssemblerARM::ma_dataTransferN(LoadStore ls, int size, bool IsSigned, sub_off = Imm8(off + neg_bottom); if (!sub_off.invalid && bottom != 0) { // Guarded against by: bottom != 0 - JS_ASSERT(neg_bottom < 0x100); + MOZ_ASSERT(neg_bottom < 0x100); // sub_off = neg_bottom + off as_add(ScratchRegister, rn, sub_off, NoSetCond, cc); return as_extdtr(ls, size, IsSigned, Offset, rt, @@ -1600,58 +1600,58 @@ MacroAssemblerARM::ma_vcmpz_f32(FloatRegister src1, Condition cc) void MacroAssemblerARM::ma_vcvt_F64_I32(FloatRegister src, FloatRegister dest, Condition cc) { - JS_ASSERT(src.isDouble()); - JS_ASSERT(dest.isSInt()); + MOZ_ASSERT(src.isDouble()); + MOZ_ASSERT(dest.isSInt()); as_vcvt(dest, src, false, cc); } void MacroAssemblerARM::ma_vcvt_F64_U32(FloatRegister src, FloatRegister dest, Condition cc) { - JS_ASSERT(src.isDouble()); - JS_ASSERT(dest.isUInt()); + MOZ_ASSERT(src.isDouble()); + MOZ_ASSERT(dest.isUInt()); as_vcvt(dest, src, false, cc); } void MacroAssemblerARM::ma_vcvt_I32_F64(FloatRegister src, FloatRegister dest, Condition cc) { - JS_ASSERT(src.isSInt()); - JS_ASSERT(dest.isDouble()); + MOZ_ASSERT(src.isSInt()); + MOZ_ASSERT(dest.isDouble()); as_vcvt(dest, src, false, cc); } void MacroAssemblerARM::ma_vcvt_U32_F64(FloatRegister src, FloatRegister dest, Condition cc) { - JS_ASSERT(src.isUInt()); - JS_ASSERT(dest.isDouble()); + MOZ_ASSERT(src.isUInt()); + MOZ_ASSERT(dest.isDouble()); as_vcvt(dest, src, false, cc); } void MacroAssemblerARM::ma_vcvt_F32_I32(FloatRegister src, FloatRegister dest, Condition cc) { - JS_ASSERT(src.isSingle()); - JS_ASSERT(dest.isSInt()); + MOZ_ASSERT(src.isSingle()); + MOZ_ASSERT(dest.isSInt()); as_vcvt(VFPRegister(dest).sintOverlay(), VFPRegister(src).singleOverlay(), false, cc); } void MacroAssemblerARM::ma_vcvt_F32_U32(FloatRegister src, FloatRegister dest, Condition cc) { - JS_ASSERT(src.isSingle()); - JS_ASSERT(dest.isUInt()); + MOZ_ASSERT(src.isSingle()); + MOZ_ASSERT(dest.isUInt()); as_vcvt(VFPRegister(dest).uintOverlay(), VFPRegister(src).singleOverlay(), false, cc); } void MacroAssemblerARM::ma_vcvt_I32_F32(FloatRegister src, FloatRegister dest, Condition cc) { - JS_ASSERT(src.isSInt()); - JS_ASSERT(dest.isSingle()); + MOZ_ASSERT(src.isSInt()); + MOZ_ASSERT(dest.isSingle()); as_vcvt(VFPRegister(dest).singleOverlay(), VFPRegister(src).sintOverlay(), false, cc); } void MacroAssemblerARM::ma_vcvt_U32_F32(FloatRegister src, FloatRegister dest, Condition cc) { - JS_ASSERT(src.isUInt()); - JS_ASSERT(dest.isSingle()); + MOZ_ASSERT(src.isUInt()); + MOZ_ASSERT(dest.isSingle()); as_vcvt(VFPRegister(dest).singleOverlay(), VFPRegister(src).uintOverlay(), false, cc); } @@ -1677,7 +1677,7 @@ BufferOffset MacroAssemblerARM::ma_vdtr(LoadStore ls, const Operand &addr, VFPRegister rt, Condition cc) { int off = addr.disp(); - JS_ASSERT((off & 3) == 0); + MOZ_ASSERT((off & 3) == 0); Register base = Register::FromCode(addr.base()); if (off > -1024 && off < 1024) return as_vdtr(ls, rt, addr.toVFPAddr(), cc); @@ -1704,7 +1704,7 @@ MacroAssemblerARM::ma_vdtr(LoadStore ls, const Operand &addr, VFPRegister rt, Co sub_off = Imm8(-(off + neg_bottom)); if (!sub_off.invalid && bottom != 0) { // Guarded against by: bottom != 0 - JS_ASSERT(neg_bottom < 0x400); + MOZ_ASSERT(neg_bottom < 0x400); // - sub_off = neg_bottom + off as_sub(ScratchRegister, base, sub_off, NoSetCond, cc); return as_vdtr(ls, rt, VFPAddr(ScratchRegister, VFPOffImm(-neg_bottom)), cc); @@ -1721,7 +1721,7 @@ MacroAssemblerARM::ma_vdtr(LoadStore ls, const Operand &addr, VFPRegister rt, Co sub_off = Imm8(off + neg_bottom); if (!sub_off.invalid && bottom != 0) { // Guarded against by: bottom != 0 - JS_ASSERT(neg_bottom < 0x400); + MOZ_ASSERT(neg_bottom < 0x400); // sub_off = neg_bottom + off as_add(ScratchRegister, base, sub_off, NoSetCond, cc); return as_vdtr(ls, rt, VFPAddr(ScratchRegister, VFPOffImm(-neg_bottom)), cc); @@ -1785,8 +1785,8 @@ MacroAssemblerARMCompat::buildFakeExitFrame(Register scratch, uint32_t *offset) uint32_t pseudoReturnOffset = currentOffset(); leaveNoPool(); - JS_ASSERT(framePushed() == initialDepth + IonExitFrameLayout::Size()); - JS_ASSERT(pseudoReturnOffset - offsetBeforePush == 8); + MOZ_ASSERT(framePushed() == initialDepth + IonExitFrameLayout::Size()); + MOZ_ASSERT(pseudoReturnOffset - offsetBeforePush == 8); *offset = pseudoReturnOffset; return true; @@ -1842,7 +1842,7 @@ MacroAssemblerARMCompat::callWithExitFrame(JitCode *target, Register dynStack) void MacroAssemblerARMCompat::callIon(Register callee) { - JS_ASSERT((framePushed() & 3) == 0); + MOZ_ASSERT((framePushed() & 3) == 0); if ((framePushed() & 7) == 4) { ma_callIonHalfPush(callee); } else { @@ -1884,7 +1884,7 @@ MacroAssemblerARMCompat::reserveStack(uint32_t amount) void MacroAssemblerARMCompat::freeStack(uint32_t amount) { - JS_ASSERT(amount <= framePushed_); + MOZ_ASSERT(amount <= framePushed_); if (amount) ma_add(Imm32(amount), sp); adjustFrame(-amount); @@ -1898,7 +1898,7 @@ MacroAssemblerARMCompat::freeStack(Register amount) void MacroAssembler::PushRegsInMask(RegisterSet set, FloatRegisterSet simdSet) { - JS_ASSERT(!SupportsSimd() && simdSet.size() == 0); + MOZ_ASSERT(!SupportsSimd() && simdSet.size() == 0); int32_t diffF = set.fpus().getPushSizeInBytes(); int32_t diffG = set.gprs().size() * sizeof(intptr_t); @@ -1917,17 +1917,17 @@ MacroAssembler::PushRegsInMask(RegisterSet set, FloatRegisterSet simdSet) storePtr(*iter, Address(StackPointer, diffG)); } } - JS_ASSERT(diffG == 0); + MOZ_ASSERT(diffG == 0); adjustFrame(diffF); diffF += transferMultipleByRuns(set.fpus(), IsStore, StackPointer, DB); - JS_ASSERT(diffF == 0); + MOZ_ASSERT(diffF == 0); } void MacroAssembler::PopRegsInMaskIgnore(RegisterSet set, RegisterSet ignore, FloatRegisterSet simdSet) { - JS_ASSERT(!SupportsSimd() && simdSet.size() == 0); + MOZ_ASSERT(!SupportsSimd() && simdSet.size() == 0); int32_t diffG = set.gprs().size() * sizeof(intptr_t); int32_t diffF = set.fpus().getPushSizeInBytes(); const int32_t reservedG = diffG; @@ -1948,7 +1948,7 @@ MacroAssembler::PopRegsInMaskIgnore(RegisterSet set, RegisterSet ignore, FloatRe } freeStack(reservedF); } - JS_ASSERT(diffF == 0); + MOZ_ASSERT(diffF == 0); if (set.gprs().size() > 1 && ignore.empty(false)) { startDataTransferM(IsLoad, StackPointer, IA, WriteBack); @@ -1966,7 +1966,7 @@ MacroAssembler::PopRegsInMaskIgnore(RegisterSet set, RegisterSet ignore, FloatRe } freeStack(reservedG); } - JS_ASSERT(diffG == 0); + MOZ_ASSERT(diffG == 0); } void @@ -2532,7 +2532,7 @@ MacroAssemblerARMCompat::storePtr(Register src, AbsoluteAddress dest) void MacroAssembler::clampDoubleToUint8(FloatRegister input, Register output) { - JS_ASSERT(input != ScratchDoubleReg); + MOZ_ASSERT(input != ScratchDoubleReg); ma_vimm(0.5, ScratchDoubleReg); if (HasVFPv3()) { Label notSplit; @@ -2585,7 +2585,7 @@ MacroAssembler::clampDoubleToUint8(FloatRegister input, Register output) void MacroAssemblerARMCompat::cmp32(Register lhs, Imm32 rhs) { - JS_ASSERT(lhs != ScratchRegister); + MOZ_ASSERT(lhs != ScratchRegister); ma_cmp(lhs, rhs); } @@ -2598,7 +2598,7 @@ MacroAssemblerARMCompat::cmp32(const Operand &lhs, Register rhs) void MacroAssemblerARMCompat::cmp32(const Operand &lhs, Imm32 rhs) { - JS_ASSERT(lhs.toReg() != ScratchRegister); + MOZ_ASSERT(lhs.toReg() != ScratchRegister); ma_cmp(lhs.toReg(), rhs); } @@ -2611,7 +2611,7 @@ MacroAssemblerARMCompat::cmp32(Register lhs, Register rhs) void MacroAssemblerARMCompat::cmpPtr(Register lhs, ImmWord rhs) { - JS_ASSERT(lhs != ScratchRegister); + MOZ_ASSERT(lhs != ScratchRegister); ma_cmp(lhs, Imm32(rhs.value)); } @@ -2784,7 +2784,7 @@ MacroAssemblerARMCompat::branchFloat(DoubleCondition cond, FloatRegister lhs, Assembler::Condition MacroAssemblerARMCompat::testInt32(Assembler::Condition cond, const ValueOperand &value) { - JS_ASSERT(cond == Assembler::Equal || cond == Assembler::NotEqual); + MOZ_ASSERT(cond == Assembler::Equal || cond == Assembler::NotEqual); ma_cmp(value.typeReg(), ImmType(JSVAL_TYPE_INT32)); return cond; } @@ -2792,14 +2792,14 @@ MacroAssemblerARMCompat::testInt32(Assembler::Condition cond, const ValueOperand Assembler::Condition MacroAssemblerARMCompat::testBoolean(Assembler::Condition cond, const ValueOperand &value) { - JS_ASSERT(cond == Assembler::Equal || cond == Assembler::NotEqual); + MOZ_ASSERT(cond == Assembler::Equal || cond == Assembler::NotEqual); ma_cmp(value.typeReg(), ImmType(JSVAL_TYPE_BOOLEAN)); return cond; } Assembler::Condition MacroAssemblerARMCompat::testDouble(Assembler::Condition cond, const ValueOperand &value) { - JS_ASSERT(cond == Assembler::Equal || cond == Assembler::NotEqual); + MOZ_ASSERT(cond == Assembler::Equal || cond == Assembler::NotEqual); Assembler::Condition actual = (cond == Equal) ? Below : AboveOrEqual; ma_cmp(value.typeReg(), ImmTag(JSVAL_TAG_CLEAR)); return actual; @@ -2808,7 +2808,7 @@ MacroAssemblerARMCompat::testDouble(Assembler::Condition cond, const ValueOperan Assembler::Condition MacroAssemblerARMCompat::testNull(Assembler::Condition cond, const ValueOperand &value) { - JS_ASSERT(cond == Assembler::Equal || cond == Assembler::NotEqual); + MOZ_ASSERT(cond == Assembler::Equal || cond == Assembler::NotEqual); ma_cmp(value.typeReg(), ImmType(JSVAL_TYPE_NULL)); return cond; } @@ -2816,7 +2816,7 @@ MacroAssemblerARMCompat::testNull(Assembler::Condition cond, const ValueOperand Assembler::Condition MacroAssemblerARMCompat::testUndefined(Assembler::Condition cond, const ValueOperand &value) { - JS_ASSERT(cond == Assembler::Equal || cond == Assembler::NotEqual); + MOZ_ASSERT(cond == Assembler::Equal || cond == Assembler::NotEqual); ma_cmp(value.typeReg(), ImmType(JSVAL_TYPE_UNDEFINED)); return cond; } @@ -2861,7 +2861,7 @@ MacroAssemblerARMCompat::testPrimitive(Assembler::Condition cond, const ValueOpe Assembler::Condition MacroAssemblerARMCompat::testInt32(Assembler::Condition cond, Register tag) { - JS_ASSERT(cond == Equal || cond == NotEqual); + MOZ_ASSERT(cond == Equal || cond == NotEqual); ma_cmp(tag, ImmTag(JSVAL_TAG_INT32)); return cond; } @@ -2869,7 +2869,7 @@ MacroAssemblerARMCompat::testInt32(Assembler::Condition cond, Register tag) Assembler::Condition MacroAssemblerARMCompat::testBoolean(Assembler::Condition cond, Register tag) { - JS_ASSERT(cond == Equal || cond == NotEqual); + MOZ_ASSERT(cond == Equal || cond == NotEqual); ma_cmp(tag, ImmTag(JSVAL_TAG_BOOLEAN)); return cond; } @@ -2877,7 +2877,7 @@ MacroAssemblerARMCompat::testBoolean(Assembler::Condition cond, Register tag) Assembler::Condition MacroAssemblerARMCompat::testNull(Assembler::Condition cond, Register tag) { - JS_ASSERT(cond == Equal || cond == NotEqual); + MOZ_ASSERT(cond == Equal || cond == NotEqual); ma_cmp(tag, ImmTag(JSVAL_TAG_NULL)); return cond; } @@ -2885,7 +2885,7 @@ MacroAssemblerARMCompat::testNull(Assembler::Condition cond, Register tag) Assembler::Condition MacroAssemblerARMCompat::testUndefined(Assembler::Condition cond, Register tag) { - JS_ASSERT(cond == Equal || cond == NotEqual); + MOZ_ASSERT(cond == Equal || cond == NotEqual); ma_cmp(tag, ImmTag(JSVAL_TAG_UNDEFINED)); return cond; } @@ -2893,7 +2893,7 @@ MacroAssemblerARMCompat::testUndefined(Assembler::Condition cond, Register tag) Assembler::Condition MacroAssemblerARMCompat::testString(Assembler::Condition cond, Register tag) { - JS_ASSERT(cond == Equal || cond == NotEqual); + MOZ_ASSERT(cond == Equal || cond == NotEqual); ma_cmp(tag, ImmTag(JSVAL_TAG_STRING)); return cond; } @@ -2901,7 +2901,7 @@ MacroAssemblerARMCompat::testString(Assembler::Condition cond, Register tag) Assembler::Condition MacroAssemblerARMCompat::testSymbol(Assembler::Condition cond, Register tag) { - JS_ASSERT(cond == Equal || cond == NotEqual); + MOZ_ASSERT(cond == Equal || cond == NotEqual); ma_cmp(tag, ImmTag(JSVAL_TAG_SYMBOL)); return cond; } @@ -2909,7 +2909,7 @@ MacroAssemblerARMCompat::testSymbol(Assembler::Condition cond, Register tag) Assembler::Condition MacroAssemblerARMCompat::testObject(Assembler::Condition cond, Register tag) { - JS_ASSERT(cond == Equal || cond == NotEqual); + MOZ_ASSERT(cond == Equal || cond == NotEqual); ma_cmp(tag, ImmTag(JSVAL_TAG_OBJECT)); return cond; } @@ -2917,7 +2917,7 @@ MacroAssemblerARMCompat::testObject(Assembler::Condition cond, Register tag) Assembler::Condition MacroAssemblerARMCompat::testMagic(Assembler::Condition cond, Register tag) { - JS_ASSERT(cond == Equal || cond == NotEqual); + MOZ_ASSERT(cond == Equal || cond == NotEqual); ma_cmp(tag, ImmTag(JSVAL_TAG_MAGIC)); return cond; } @@ -2925,7 +2925,7 @@ MacroAssemblerARMCompat::testMagic(Assembler::Condition cond, Register tag) Assembler::Condition MacroAssemblerARMCompat::testPrimitive(Assembler::Condition cond, Register tag) { - JS_ASSERT(cond == Equal || cond == NotEqual); + MOZ_ASSERT(cond == Equal || cond == NotEqual); ma_cmp(tag, ImmTag(JSVAL_UPPER_EXCL_TAG_OF_PRIMITIVE_SET)); return cond == Equal ? Below : AboveOrEqual; } @@ -2933,7 +2933,7 @@ MacroAssemblerARMCompat::testPrimitive(Assembler::Condition cond, Register tag) Assembler::Condition MacroAssemblerARMCompat::testGCThing(Assembler::Condition cond, const Address &address) { - JS_ASSERT(cond == Equal || cond == NotEqual); + MOZ_ASSERT(cond == Equal || cond == NotEqual); extractTag(address, ScratchRegister); ma_cmp(ScratchRegister, ImmTag(JSVAL_LOWER_INCL_TAG_OF_GCTHING_SET)); return cond == Equal ? AboveOrEqual : Below; @@ -2942,7 +2942,7 @@ MacroAssemblerARMCompat::testGCThing(Assembler::Condition cond, const Address &a Assembler::Condition MacroAssemblerARMCompat::testMagic(Assembler::Condition cond, const Address &address) { - JS_ASSERT(cond == Equal || cond == NotEqual); + MOZ_ASSERT(cond == Equal || cond == NotEqual); extractTag(address, ScratchRegister); ma_cmp(ScratchRegister, ImmTag(JSVAL_TAG_MAGIC)); return cond; @@ -2951,7 +2951,7 @@ MacroAssemblerARMCompat::testMagic(Assembler::Condition cond, const Address &add Assembler::Condition MacroAssemblerARMCompat::testInt32(Assembler::Condition cond, const Address &address) { - JS_ASSERT(cond == Equal || cond == NotEqual); + MOZ_ASSERT(cond == Equal || cond == NotEqual); extractTag(address, ScratchRegister); ma_cmp(ScratchRegister, ImmTag(JSVAL_TAG_INT32)); return cond; @@ -2960,7 +2960,7 @@ MacroAssemblerARMCompat::testInt32(Assembler::Condition cond, const Address &add Assembler::Condition MacroAssemblerARMCompat::testDouble(Condition cond, const Address &address) { - JS_ASSERT(cond == Equal || cond == NotEqual); + MOZ_ASSERT(cond == Equal || cond == NotEqual); extractTag(address, ScratchRegister); return testDouble(cond, ScratchRegister); } @@ -2968,7 +2968,7 @@ MacroAssemblerARMCompat::testDouble(Condition cond, const Address &address) Assembler::Condition MacroAssemblerARMCompat::testBoolean(Condition cond, const Address &address) { - JS_ASSERT(cond == Equal || cond == NotEqual); + MOZ_ASSERT(cond == Equal || cond == NotEqual); extractTag(address, ScratchRegister); return testBoolean(cond, ScratchRegister); } @@ -2976,7 +2976,7 @@ MacroAssemblerARMCompat::testBoolean(Condition cond, const Address &address) Assembler::Condition MacroAssemblerARMCompat::testNull(Condition cond, const Address &address) { - JS_ASSERT(cond == Equal || cond == NotEqual); + MOZ_ASSERT(cond == Equal || cond == NotEqual); extractTag(address, ScratchRegister); return testNull(cond, ScratchRegister); } @@ -2984,7 +2984,7 @@ MacroAssemblerARMCompat::testNull(Condition cond, const Address &address) Assembler::Condition MacroAssemblerARMCompat::testUndefined(Condition cond, const Address &address) { - JS_ASSERT(cond == Equal || cond == NotEqual); + MOZ_ASSERT(cond == Equal || cond == NotEqual); extractTag(address, ScratchRegister); return testUndefined(cond, ScratchRegister); } @@ -2992,7 +2992,7 @@ MacroAssemblerARMCompat::testUndefined(Condition cond, const Address &address) Assembler::Condition MacroAssemblerARMCompat::testString(Condition cond, const Address &address) { - JS_ASSERT(cond == Equal || cond == NotEqual); + MOZ_ASSERT(cond == Equal || cond == NotEqual); extractTag(address, ScratchRegister); return testString(cond, ScratchRegister); } @@ -3000,7 +3000,7 @@ MacroAssemblerARMCompat::testString(Condition cond, const Address &address) Assembler::Condition MacroAssemblerARMCompat::testSymbol(Condition cond, const Address &address) { - JS_ASSERT(cond == Equal || cond == NotEqual); + MOZ_ASSERT(cond == Equal || cond == NotEqual); extractTag(address, ScratchRegister); return testSymbol(cond, ScratchRegister); } @@ -3008,7 +3008,7 @@ MacroAssemblerARMCompat::testSymbol(Condition cond, const Address &address) Assembler::Condition MacroAssemblerARMCompat::testObject(Condition cond, const Address &address) { - JS_ASSERT(cond == Equal || cond == NotEqual); + MOZ_ASSERT(cond == Equal || cond == NotEqual); extractTag(address, ScratchRegister); return testObject(cond, ScratchRegister); } @@ -3016,7 +3016,7 @@ MacroAssemblerARMCompat::testObject(Condition cond, const Address &address) Assembler::Condition MacroAssemblerARMCompat::testNumber(Condition cond, const Address &address) { - JS_ASSERT(cond == Equal || cond == NotEqual); + MOZ_ASSERT(cond == Equal || cond == NotEqual); extractTag(address, ScratchRegister); return testNumber(cond, ScratchRegister); } @@ -3024,7 +3024,7 @@ MacroAssemblerARMCompat::testNumber(Condition cond, const Address &address) Assembler::Condition MacroAssemblerARMCompat::testDouble(Condition cond, Register tag) { - JS_ASSERT(cond == Assembler::Equal || cond == Assembler::NotEqual); + MOZ_ASSERT(cond == Assembler::Equal || cond == Assembler::NotEqual); Condition actual = (cond == Equal) ? Below : AboveOrEqual; ma_cmp(tag, ImmTag(JSVAL_TAG_CLEAR)); return actual; @@ -3033,7 +3033,7 @@ MacroAssemblerARMCompat::testDouble(Condition cond, Register tag) Assembler::Condition MacroAssemblerARMCompat::testNumber(Condition cond, Register tag) { - JS_ASSERT(cond == Equal || cond == NotEqual); + MOZ_ASSERT(cond == Equal || cond == NotEqual); ma_cmp(tag, ImmTag(JSVAL_UPPER_INCL_TAG_OF_NUMBER_SET)); return cond == Equal ? BelowOrEqual : Above; } @@ -3041,7 +3041,7 @@ MacroAssemblerARMCompat::testNumber(Condition cond, Register tag) Assembler::Condition MacroAssemblerARMCompat::testUndefined(Condition cond, const BaseIndex &src) { - JS_ASSERT(cond == Equal || cond == NotEqual); + MOZ_ASSERT(cond == Equal || cond == NotEqual); extractTag(src, ScratchRegister); ma_cmp(ScratchRegister, ImmTag(JSVAL_TAG_UNDEFINED)); return cond; @@ -3050,7 +3050,7 @@ MacroAssemblerARMCompat::testUndefined(Condition cond, const BaseIndex &src) Assembler::Condition MacroAssemblerARMCompat::testNull(Condition cond, const BaseIndex &src) { - JS_ASSERT(cond == Equal || cond == NotEqual); + MOZ_ASSERT(cond == Equal || cond == NotEqual); extractTag(src, ScratchRegister); ma_cmp(ScratchRegister, ImmTag(JSVAL_TAG_NULL)); return cond; @@ -3059,7 +3059,7 @@ MacroAssemblerARMCompat::testNull(Condition cond, const BaseIndex &src) Assembler::Condition MacroAssemblerARMCompat::testBoolean(Condition cond, const BaseIndex &src) { - JS_ASSERT(cond == Equal || cond == NotEqual); + MOZ_ASSERT(cond == Equal || cond == NotEqual); extractTag(src, ScratchRegister); ma_cmp(ScratchRegister, ImmTag(JSVAL_TAG_BOOLEAN)); return cond; @@ -3068,7 +3068,7 @@ MacroAssemblerARMCompat::testBoolean(Condition cond, const BaseIndex &src) Assembler::Condition MacroAssemblerARMCompat::testString(Condition cond, const BaseIndex &src) { - JS_ASSERT(cond == Equal || cond == NotEqual); + MOZ_ASSERT(cond == Equal || cond == NotEqual); extractTag(src, ScratchRegister); ma_cmp(ScratchRegister, ImmTag(JSVAL_TAG_STRING)); return cond; @@ -3077,7 +3077,7 @@ MacroAssemblerARMCompat::testString(Condition cond, const BaseIndex &src) Assembler::Condition MacroAssemblerARMCompat::testSymbol(Condition cond, const BaseIndex &src) { - JS_ASSERT(cond == Equal || cond == NotEqual); + MOZ_ASSERT(cond == Equal || cond == NotEqual); extractTag(src, ScratchRegister); ma_cmp(ScratchRegister, ImmTag(JSVAL_TAG_SYMBOL)); return cond; @@ -3086,7 +3086,7 @@ MacroAssemblerARMCompat::testSymbol(Condition cond, const BaseIndex &src) Assembler::Condition MacroAssemblerARMCompat::testInt32(Condition cond, const BaseIndex &src) { - JS_ASSERT(cond == Equal || cond == NotEqual); + MOZ_ASSERT(cond == Equal || cond == NotEqual); extractTag(src, ScratchRegister); ma_cmp(ScratchRegister, ImmTag(JSVAL_TAG_INT32)); return cond; @@ -3095,7 +3095,7 @@ MacroAssemblerARMCompat::testInt32(Condition cond, const BaseIndex &src) Assembler::Condition MacroAssemblerARMCompat::testObject(Condition cond, const BaseIndex &src) { - JS_ASSERT(cond == Equal || cond == NotEqual); + MOZ_ASSERT(cond == Equal || cond == NotEqual); extractTag(src, ScratchRegister); ma_cmp(ScratchRegister, ImmTag(JSVAL_TAG_OBJECT)); return cond; @@ -3104,7 +3104,7 @@ MacroAssemblerARMCompat::testObject(Condition cond, const BaseIndex &src) Assembler::Condition MacroAssemblerARMCompat::testDouble(Condition cond, const BaseIndex &src) { - JS_ASSERT(cond == Equal || cond == NotEqual); + MOZ_ASSERT(cond == Equal || cond == NotEqual); Assembler::Condition actual = (cond == Equal) ? Below : AboveOrEqual; extractTag(src, ScratchRegister); ma_cmp(ScratchRegister, ImmTag(JSVAL_TAG_CLEAR)); @@ -3114,7 +3114,7 @@ MacroAssemblerARMCompat::testDouble(Condition cond, const BaseIndex &src) Assembler::Condition MacroAssemblerARMCompat::testMagic(Condition cond, const BaseIndex &address) { - JS_ASSERT(cond == Equal || cond == NotEqual); + MOZ_ASSERT(cond == Equal || cond == NotEqual); extractTag(address, ScratchRegister); ma_cmp(ScratchRegister, ImmTag(JSVAL_TAG_MAGIC)); return cond; @@ -3123,7 +3123,7 @@ MacroAssemblerARMCompat::testMagic(Condition cond, const BaseIndex &address) Assembler::Condition MacroAssemblerARMCompat::testGCThing(Condition cond, const BaseIndex &address) { - JS_ASSERT(cond == Equal || cond == NotEqual); + MOZ_ASSERT(cond == Equal || cond == NotEqual); extractTag(address, ScratchRegister); ma_cmp(ScratchRegister, ImmTag(JSVAL_LOWER_INCL_TAG_OF_GCTHING_SET)); return cond == Equal ? AboveOrEqual : Below; @@ -3153,7 +3153,7 @@ void MacroAssemblerARMCompat::branchTestValue(Condition cond, const Address &valaddr, const ValueOperand &value, Label *label) { - JS_ASSERT(cond == Equal || cond == NotEqual); + MOZ_ASSERT(cond == Equal || cond == NotEqual); // Check payload before tag, since payload is more likely to differ. if (cond == NotEqual) { @@ -3551,7 +3551,7 @@ MacroAssemblerARMCompat::loadValue(Address src, ValueOperand val) void MacroAssemblerARMCompat::tagValue(JSValueType type, Register payload, ValueOperand dest) { - JS_ASSERT(dest.typeReg() != dest.payloadReg()); + MOZ_ASSERT(dest.typeReg() != dest.payloadReg()); if (payload != dest.payloadReg()) ma_mov(payload, dest.payloadReg()); ma_mov(ImmType(type), dest.typeReg()); @@ -3565,7 +3565,7 @@ MacroAssemblerARMCompat::pushValue(ValueOperand val) { void MacroAssemblerARMCompat::pushValue(const Address &addr) { - JS_ASSERT(addr.base != StackPointer); + MOZ_ASSERT(addr.base != StackPointer); Operand srcOp = Operand(addr); Operand payload = ToPayload(srcOp); Operand type = ToType(srcOp); @@ -3737,7 +3737,7 @@ void MacroAssemblerARMCompat::simulatorStop(const char* msg) { #if defined(JS_ARM_SIMULATOR) - JS_ASSERT(sizeof(char*) == 4); + MOZ_ASSERT(sizeof(char*) == 4); writeInst(0xefffffff); writeInst((int)msg); #endif @@ -3768,7 +3768,7 @@ MacroAssemblerARMCompat::breakpoint(Condition cc) void MacroAssemblerARMCompat::setupABICall(uint32_t args) { - JS_ASSERT(!inCall_); + MOZ_ASSERT(!inCall_); inCall_ = true; args_ = args; passedArgs_ = 0; @@ -3973,7 +3973,7 @@ void MacroAssemblerARMCompat::checkStackAlignment() void MacroAssemblerARMCompat::callWithABIPre(uint32_t *stackAdjust, bool callFromAsmJS) { - JS_ASSERT(inCall_); + MOZ_ASSERT(inCall_); *stackAdjust = ((usedIntSlots_ > NumIntArgRegs) ? usedIntSlots_ - NumIntArgRegs : 0) * sizeof(intptr_t); #if defined(JS_CODEGEN_ARM_HARDFP) || defined(JS_ARM_SIMULATOR) @@ -4022,7 +4022,7 @@ MacroAssemblerARMCompat::callWithABIPre(uint32_t *stackAdjust, bool callFromAsmJ else ma_vxfer(from.floatReg(), to0); } else { - JS_ASSERT(from.isMemory()); + MOZ_ASSERT(from.isMemory()); // Note: We can safely use the MoveOperand's displacement here, // even if the base is SP: MoveEmitter::toOperand adjusts // SP-relative operands by the difference between the current @@ -4077,7 +4077,7 @@ MacroAssemblerARMCompat::callWithABIPost(uint32_t stackAdjust, MoveOp::Type resu as_dtr(IsLoad, 32, Offset, sp, DTRAddr(sp, DtrOffImm(0))); } - JS_ASSERT(inCall_); + MOZ_ASSERT(inCall_); inCall_ = false; } @@ -4647,9 +4647,9 @@ void MacroAssemblerARMCompat::branchPtrInNurseryRange(Condition cond, Register ptr, Register temp, Label *label) { - JS_ASSERT(cond == Assembler::Equal || cond == Assembler::NotEqual); - JS_ASSERT(ptr != temp); - JS_ASSERT(ptr != secondScratchReg_); + MOZ_ASSERT(cond == Assembler::Equal || cond == Assembler::NotEqual); + MOZ_ASSERT(ptr != temp); + MOZ_ASSERT(ptr != secondScratchReg_); const Nursery &nursery = GetIonContext()->runtime->gcNursery(); uintptr_t startChunk = nursery.start() >> Nursery::ChunkShift; @@ -4664,7 +4664,7 @@ void MacroAssemblerARMCompat::branchValueIsNurseryObject(Condition cond, ValueOperand value, Register temp, Label *label) { - JS_ASSERT(cond == Assembler::Equal || cond == Assembler::NotEqual); + MOZ_ASSERT(cond == Assembler::Equal || cond == Assembler::NotEqual); Label done; diff --git a/js/src/jit/arm/MacroAssembler-arm.h b/js/src/jit/arm/MacroAssembler-arm.h index 151e78c629ae..76e3d1803236 100644 --- a/js/src/jit/arm/MacroAssembler-arm.h +++ b/js/src/jit/arm/MacroAssembler-arm.h @@ -57,7 +57,7 @@ class MacroAssemblerARM : public Assembler { } void setSecondScratchReg(Register reg) { - JS_ASSERT(reg != ScratchRegister); + MOZ_ASSERT(reg != ScratchRegister); secondScratchReg_ = reg; } @@ -436,7 +436,7 @@ private: transferMultipleByRunsImpl(FloatRegisterSet set, LoadStore ls, Register rm, DTMMode mode, int32_t sign) { - JS_ASSERT(sign == 1 || sign == -1); + MOZ_ASSERT(sign == 1 || sign == -1); int32_t delta = sign * sizeof(float); int32_t offset = 0; @@ -944,7 +944,7 @@ class MacroAssemblerARMCompat : public MacroAssemblerARM } void branchTestMagicValue(Condition cond, const ValueOperand &val, JSWhyMagic why, Label *label) { - JS_ASSERT(cond == Equal || cond == NotEqual); + MOZ_ASSERT(cond == Equal || cond == NotEqual); branchTestValue(cond, val, MagicValue(why), label); } void branchTestInt32Truthy(bool truthy, const ValueOperand &operand, Label *label) { @@ -964,7 +964,7 @@ class MacroAssemblerARMCompat : public MacroAssemblerARM ma_b(label, c); } void branchTest32(Condition cond, Register lhs, Register rhs, Label *label) { - JS_ASSERT(cond == Zero || cond == NonZero || cond == Signed || cond == NotSigned); + MOZ_ASSERT(cond == Zero || cond == NonZero || cond == Signed || cond == NotSigned); // x86 likes test foo, foo rather than cmp foo, #0. // Convert the former into the latter. if (lhs == rhs && (cond == Zero || cond == NonZero)) @@ -974,7 +974,7 @@ class MacroAssemblerARMCompat : public MacroAssemblerARM ma_b(label, cond); } void branchTest32(Condition cond, Register lhs, Imm32 imm, Label *label) { - JS_ASSERT(cond == Zero || cond == NonZero || cond == Signed || cond == NotSigned); + MOZ_ASSERT(cond == Zero || cond == NonZero || cond == Signed || cond == NotSigned); ma_tst(lhs, imm); ma_b(label, cond); } @@ -1101,8 +1101,8 @@ class MacroAssemblerARMCompat : public MacroAssemblerARM if (s1 == d0) { if (s0 == d1) { // If both are, this is just a swap of two registers. - JS_ASSERT(d1 != ScratchRegister); - JS_ASSERT(d0 != ScratchRegister); + MOZ_ASSERT(d1 != ScratchRegister); + MOZ_ASSERT(d0 != ScratchRegister); ma_mov(d1, ScratchRegister); ma_mov(d0, d1); ma_mov(ScratchRegister, d0); @@ -1123,7 +1123,7 @@ class MacroAssemblerARMCompat : public MacroAssemblerARM void storeValue(ValueOperand val, const BaseIndex &dest); void storeValue(JSValueType type, Register reg, BaseIndex dest) { // Harder cases not handled yet. - JS_ASSERT(dest.offset == 0); + MOZ_ASSERT(dest.offset == 0); ma_alu(dest.base, lsl(dest.index, dest.scale), ScratchRegister, OpAdd); storeValue(type, reg, Address(ScratchRegister, 0)); } @@ -1147,7 +1147,7 @@ class MacroAssemblerARMCompat : public MacroAssemblerARM } void storeValue(const Value &val, BaseIndex dest) { // Harder cases not handled yet. - JS_ASSERT(dest.offset == 0); + MOZ_ASSERT(dest.offset == 0); ma_alu(dest.base, lsl(dest.index, dest.scale), ScratchRegister, OpAdd); storeValue(val, Address(ScratchRegister, 0)); } @@ -1249,7 +1249,7 @@ class MacroAssemblerARMCompat : public MacroAssemblerARM adjustFrame(-sizeof(intptr_t)); } void implicitPop(uint32_t args) { - JS_ASSERT(args % sizeof(intptr_t) == 0); + MOZ_ASSERT(args % sizeof(intptr_t) == 0); adjustFrame(-args); } uint32_t framePushed() const { @@ -1389,7 +1389,7 @@ class MacroAssemblerARMCompat : public MacroAssemblerARM } void storeDouble(FloatRegister src, BaseIndex addr) { // Harder cases not handled yet. - JS_ASSERT(addr.offset == 0); + MOZ_ASSERT(addr.offset == 0); uint32_t scale = Imm32::ShiftOf(addr.scale).value; ma_vstr(src, addr.base, addr.index, scale); } @@ -1402,7 +1402,7 @@ class MacroAssemblerARMCompat : public MacroAssemblerARM } void storeFloat32(FloatRegister src, BaseIndex addr) { // Harder cases not handled yet. - JS_ASSERT(addr.offset == 0); + MOZ_ASSERT(addr.offset == 0); uint32_t scale = Imm32::ShiftOf(addr.scale).value; ma_vstr(VFPRegister(src).singleOverlay(), addr.base, addr.index, scale); } diff --git a/js/src/jit/arm/MoveEmitter-arm.cpp b/js/src/jit/arm/MoveEmitter-arm.cpp index 54c44645fee8..8285e16b8751 100644 --- a/js/src/jit/arm/MoveEmitter-arm.cpp +++ b/js/src/jit/arm/MoveEmitter-arm.cpp @@ -42,7 +42,7 @@ Operand MoveEmitterARM::cycleSlot(uint32_t slot, uint32_t subslot) const { int32_t offset = masm.framePushed() - pushedAtCycle_; - JS_ASSERT(offset < 4096 && offset > -4096); + MOZ_ASSERT(offset < 4096 && offset > -4096); return Operand(StackPointer, offset + slot * sizeof(double) + subslot); } @@ -51,7 +51,7 @@ Operand MoveEmitterARM::spillSlot() const { int32_t offset = masm.framePushed() - pushedAtSpill_; - JS_ASSERT(offset < 4096 && offset > -4096); + MOZ_ASSERT(offset < 4096 && offset > -4096); return Operand(StackPointer, offset); } @@ -60,11 +60,11 @@ MoveEmitterARM::toOperand(const MoveOperand &operand, bool isFloat) const { if (operand.isMemoryOrEffectiveAddress()) { if (operand.base() != StackPointer) { - JS_ASSERT(operand.disp() < 1024 && operand.disp() > -1024); + MOZ_ASSERT(operand.disp() < 1024 && operand.disp() > -1024); return Operand(operand.base(), operand.disp()); } - JS_ASSERT(operand.disp() >= 0); + MOZ_ASSERT(operand.disp() >= 0); // Otherwise, the stack offset may need to be adjusted. return Operand(StackPointer, operand.disp() + (masm.framePushed() - pushedAtStart_)); @@ -73,7 +73,7 @@ MoveEmitterARM::toOperand(const MoveOperand &operand, bool isFloat) const if (operand.isGeneralReg()) return Operand(operand.reg()); - JS_ASSERT(operand.isFloatReg()); + MOZ_ASSERT(operand.isFloatReg()); return Operand(operand.floatReg()); } @@ -180,7 +180,7 @@ MoveEmitterARM::completeCycle(const MoveOperand &from, const MoveOperand &to, Mo break; case MoveOp::INT32: case MoveOp::GENERAL: - JS_ASSERT(slotId == 0); + MOZ_ASSERT(slotId == 0); if (to.isMemory()) { Register temp = tempReg(); masm.ma_ldr(cycleSlot(slotId, 0), temp); @@ -226,7 +226,7 @@ MoveEmitterARM::emitMove(const MoveOperand &from, const MoveOperand &to) MOZ_CRASH("strange move!"); } } else if (to.isGeneralReg()) { - JS_ASSERT(from.isMemoryOrEffectiveAddress()); + MOZ_ASSERT(from.isMemoryOrEffectiveAddress()); if (from.isMemory()) masm.ma_ldr(toOperand(from, false), to.reg()); else @@ -235,12 +235,12 @@ MoveEmitterARM::emitMove(const MoveOperand &from, const MoveOperand &to) // Memory to memory gpr move. Register reg = tempReg(); - JS_ASSERT(from.isMemoryOrEffectiveAddress()); + MOZ_ASSERT(from.isMemoryOrEffectiveAddress()); if (from.isMemory()) masm.ma_ldr(toOperand(from, false), reg); else masm.ma_add(from.base(), Imm32(from.disp()), reg); - JS_ASSERT(to.base() != reg); + MOZ_ASSERT(to.base() != reg); masm.ma_str(reg, toOperand(to, false)); } } @@ -259,7 +259,7 @@ MoveEmitterARM::emitFloat32Move(const MoveOperand &from, const MoveOperand &to) VFPRegister(to.floatReg()).singleOverlay()); } else { // Memory to memory move. - JS_ASSERT(from.isMemory()); + MOZ_ASSERT(from.isMemory()); FloatRegister reg = ScratchFloat32Reg; masm.ma_vldr(toOperand(from, true), VFPRegister(reg).singleOverlay()); @@ -280,7 +280,7 @@ MoveEmitterARM::emitDoubleMove(const MoveOperand &from, const MoveOperand &to) masm.ma_vldr(toOperand(from, true), to.floatReg()); } else { // Memory to memory move. - JS_ASSERT(from.isMemory()); + MOZ_ASSERT(from.isMemory()); FloatRegister reg = ScratchDoubleReg; masm.ma_vldr(toOperand(from, true), reg); masm.ma_vstr(reg, toOperand(to, true)); @@ -302,9 +302,9 @@ MoveEmitterARM::emit(const MoveOp &move) } if (move.isCycleEnd()) { - JS_ASSERT(inCycle_); + MOZ_ASSERT(inCycle_); completeCycle(from, to, move.type(), move.cycleEndSlot()); - JS_ASSERT(inCycle_ > 0); + MOZ_ASSERT(inCycle_ > 0); inCycle_--; return; } @@ -333,7 +333,7 @@ MoveEmitterARM::emit(const MoveOp &move) void MoveEmitterARM::assertDone() { - JS_ASSERT(inCycle_ == 0); + MOZ_ASSERT(inCycle_ == 0); } void diff --git a/js/src/jit/arm/Trampoline-arm.cpp b/js/src/jit/arm/Trampoline-arm.cpp index f77a55c94228..8c2cb24fb516 100644 --- a/js/src/jit/arm/Trampoline-arm.cpp +++ b/js/src/jit/arm/Trampoline-arm.cpp @@ -110,7 +110,7 @@ JitRuntime::generateEnterJIT(JSContext *cx, EnterJitType type) const Address slot_token(sp, offsetof(EnterJITStack, token)); const Address slot_vp(sp, offsetof(EnterJITStack, vp)); - JS_ASSERT(OsrFrameReg == r3); + MOZ_ASSERT(OsrFrameReg == r3); MacroAssembler masm(cx); Assembler *aasm = &masm; @@ -279,7 +279,7 @@ JitRuntime::generateEnterJIT(JSContext *cx, EnterJitType type) masm.pop(jitcode); masm.pop(framePtr); - JS_ASSERT(jitcode != ReturnReg); + MOZ_ASSERT(jitcode != ReturnReg); Label error; masm.addPtr(Imm32(IonExitFrameLayout::SizeWithFooter()), sp); @@ -298,7 +298,7 @@ JitRuntime::generateEnterJIT(JSContext *cx, EnterJitType type) masm.bind(¬Osr); // Load the scope chain in R1. - JS_ASSERT(R1.scratchReg() != r0); + MOZ_ASSERT(R1.scratchReg() != r0); masm.loadPtr(Address(r11, offsetof(EnterJITStack, scopeChain)), R1.scratchReg()); } @@ -326,7 +326,7 @@ JitRuntime::generateEnterJIT(JSContext *cx, EnterJitType type) // :TODO: Optimize storeValue with: // We're using a load-double here. In order for that to work, the data needs // to be stored in two consecutive registers, make sure this is the case - // JS_ASSERT(JSReturnReg_Type.code() == JSReturnReg_Data.code()+1); + // MOZ_ASSERT(JSReturnReg_Type.code() == JSReturnReg_Data.code()+1); // aasm->as_extdtr(IsStore, 64, true, Offset, // JSReturnReg_Data, EDtrAddr(r5, EDtrOffImm(0))); @@ -421,7 +421,7 @@ JitRuntime::generateArgumentsRectifier(JSContext *cx, ExecutionMode mode, void * MacroAssembler masm(cx); // ArgumentsRectifierReg contains the |nargs| pushed onto the current frame. // Including |this|, there are (|nargs| + 1) arguments to copy. - JS_ASSERT(ArgumentsRectifierReg == r8); + MOZ_ASSERT(ArgumentsRectifierReg == r8); // Copy number of actual arguments into r0. masm.ma_ldr(DTRAddr(sp, DtrOffImm(IonRectifierFrameLayout::offsetOfNumActualArgs())), r0); @@ -724,8 +724,8 @@ JitRuntime::generateBailoutHandler(JSContext *cx, ExecutionMode mode) JitCode * JitRuntime::generateVMWrapper(JSContext *cx, const VMFunction &f) { - JS_ASSERT(functionWrappers_); - JS_ASSERT(functionWrappers_->initialized()); + MOZ_ASSERT(functionWrappers_); + MOZ_ASSERT(functionWrappers_->initialized()); VMWrapperMap::AddPtr p = functionWrappers_->lookupForAdd(&f); if (p) return p->value(); @@ -791,7 +791,7 @@ JitRuntime::generateVMWrapper(JSContext *cx, const VMFunction &f) break; default: - JS_ASSERT(f.outParam == Type_Void); + MOZ_ASSERT(f.outParam == Type_Void); break; } @@ -811,7 +811,7 @@ JitRuntime::generateVMWrapper(JSContext *cx, const VMFunction &f) case VMFunction::DoubleByValue: // Values should be passed by reference, not by value, so we assert // that the argument is a double-precision float. - JS_ASSERT(f.argPassedInFloatReg(explicitArg)); + MOZ_ASSERT(f.argPassedInFloatReg(explicitArg)); masm.passABIArg(MoveOperand(argsBase, argDisp), MoveOp::DOUBLE); argDisp += sizeof(double); break; @@ -875,7 +875,7 @@ JitRuntime::generateVMWrapper(JSContext *cx, const VMFunction &f) break; default: - JS_ASSERT(f.outParam == Type_Void); + MOZ_ASSERT(f.outParam == Type_Void); break; } masm.leaveExitFrame(); @@ -916,7 +916,7 @@ JitRuntime::generatePreBarrier(JSContext *cx, MIRType type) } masm.PushRegsInMask(save); - JS_ASSERT(PreBarrierReg == r1); + MOZ_ASSERT(PreBarrierReg == r1); masm.movePtr(ImmPtr(cx->runtime()), r0); masm.setupUnalignedABICall(2, r2); diff --git a/js/src/jit/mips/Architecture-mips.h b/js/src/jit/mips/Architecture-mips.h index 7faaaeaded58..01bf4a241f98 100644 --- a/js/src/jit/mips/Architecture-mips.h +++ b/js/src/jit/mips/Architecture-mips.h @@ -366,8 +366,8 @@ class FloatRegister { } bool operator==(const FloatRegister &other) const { - JS_ASSERT(!isInvalid()); - JS_ASSERT(!other.isInvalid()); + MOZ_ASSERT(!isInvalid()); + MOZ_ASSERT(!other.isInvalid()); return kind_ == other.kind_ && code_ == other.code_; } bool isDouble() const { return kind_ == Double; } @@ -384,7 +384,7 @@ class FloatRegister FloatRegister uintOverlay(unsigned int which = 0) const; Code code() const { - JS_ASSERT(!isInvalid()); + MOZ_ASSERT(!isInvalid()); return Code(code_ | (kind_ << 5)); } uint32_t id() const { diff --git a/js/src/jit/mips/CodeGenerator-mips.cpp b/js/src/jit/mips/CodeGenerator-mips.cpp index cdb91c9d5983..2ca1fcfcf208 100644 --- a/js/src/jit/mips/CodeGenerator-mips.cpp +++ b/js/src/jit/mips/CodeGenerator-mips.cpp @@ -63,7 +63,7 @@ CodeGeneratorMIPS::generateEpilogue() #endif masm.freeStack(frameSize()); - JS_ASSERT(masm.framePushed() == 0); + MOZ_ASSERT(masm.framePushed() == 0); masm.ret(); return true; } diff --git a/js/src/jit/mips/Lowering-mips.cpp b/js/src/jit/mips/Lowering-mips.cpp index 9ad18d710ada..f789f3f9094a 100644 --- a/js/src/jit/mips/Lowering-mips.cpp +++ b/js/src/jit/mips/Lowering-mips.cpp @@ -128,7 +128,7 @@ LIRGeneratorMIPS::visitUnbox(MUnbox *unbox) // a payload. Unlike most instructions consuming a box, we ask for the type // second, so that the result can re-use the first input. MDefinition *inner = unbox->getOperand(0); - JS_ASSERT(inner->type() == MIRType_Value); + MOZ_ASSERT(inner->type() == MIRType_Value); if (!ensureDefined(inner)) return false; diff --git a/js/src/jit/mips/MacroAssembler-mips.cpp b/js/src/jit/mips/MacroAssembler-mips.cpp index 10356e331db7..59cdc5f5dda0 100644 --- a/js/src/jit/mips/MacroAssembler-mips.cpp +++ b/js/src/jit/mips/MacroAssembler-mips.cpp @@ -1560,7 +1560,7 @@ MacroAssemblerMIPSCompat::freeStack(Register amount) void MacroAssembler::PushRegsInMask(RegisterSet set, FloatRegisterSet simdSet) { - JS_ASSERT(!SupportsSimd() && simdSet.size() == 0); + MOZ_ASSERT(!SupportsSimd() && simdSet.size() == 0); int32_t diffF = set.fpus().getPushSizeInBytes(); int32_t diffG = set.gprs().size() * sizeof(intptr_t); @@ -1588,7 +1588,7 @@ MacroAssembler::PushRegsInMask(RegisterSet set, FloatRegisterSet simdSet) void MacroAssembler::PopRegsInMaskIgnore(RegisterSet set, RegisterSet ignore, FloatRegisterSet simdSet) { - JS_ASSERT(!SupportsSimd() && simdSet.size() == 0); + MOZ_ASSERT(!SupportsSimd() && simdSet.size() == 0); int32_t diffG = set.gprs().size() * sizeof(intptr_t); int32_t diffF = set.fpus().getPushSizeInBytes(); const int32_t reservedG = diffG; @@ -2061,7 +2061,7 @@ MacroAssemblerMIPSCompat::storePtr(Register src, AbsoluteAddress dest) void MacroAssembler::clampDoubleToUint8(FloatRegister input, Register output) { - JS_ASSERT(input != ScratchDoubleReg); + MOZ_ASSERT(input != ScratchDoubleReg); Label positive, done; // <= 0 or NaN --> 0 @@ -3562,9 +3562,9 @@ void MacroAssemblerMIPSCompat::branchPtrInNurseryRange(Condition cond, Register ptr, Register temp, Label *label) { - JS_ASSERT(cond == Assembler::Equal || cond == Assembler::NotEqual); - JS_ASSERT(ptr != temp); - JS_ASSERT(ptr != SecondScratchReg); + MOZ_ASSERT(cond == Assembler::Equal || cond == Assembler::NotEqual); + MOZ_ASSERT(ptr != temp); + MOZ_ASSERT(ptr != SecondScratchReg); const Nursery &nursery = GetIonContext()->runtime->gcNursery(); movePtr(ImmWord(-ptrdiff_t(nursery.start())), SecondScratchReg); @@ -3577,7 +3577,7 @@ void MacroAssemblerMIPSCompat::branchValueIsNurseryObject(Condition cond, ValueOperand value, Register temp, Label *label) { - JS_ASSERT(cond == Assembler::Equal || cond == Assembler::NotEqual); + MOZ_ASSERT(cond == Assembler::Equal || cond == Assembler::NotEqual); Label done; diff --git a/js/src/jit/mips/MacroAssembler-mips.h b/js/src/jit/mips/MacroAssembler-mips.h index ee1ba9730182..aa351f67aa8e 100644 --- a/js/src/jit/mips/MacroAssembler-mips.h +++ b/js/src/jit/mips/MacroAssembler-mips.h @@ -839,8 +839,8 @@ public: if (s1 == d0) { if (s0 == d1) { // If both are, this is just a swap of two registers. - JS_ASSERT(d1 != ScratchRegister); - JS_ASSERT(d0 != ScratchRegister); + MOZ_ASSERT(d1 != ScratchRegister); + MOZ_ASSERT(d0 != ScratchRegister); move32(d1, ScratchRegister); move32(d0, d1); move32(ScratchRegister, d0); diff --git a/js/src/jit/shared/Assembler-shared.h b/js/src/jit/shared/Assembler-shared.h index 8f3d6449a38f..577e1da53f38 100644 --- a/js/src/jit/shared/Assembler-shared.h +++ b/js/src/jit/shared/Assembler-shared.h @@ -53,7 +53,7 @@ IsShiftInScaleRange(int i) static inline Scale ShiftToScale(int i) { - JS_ASSERT(IsShiftInScaleRange(i)); + MOZ_ASSERT(IsShiftInScaleRange(i)); return Scale(i); } @@ -144,42 +144,42 @@ struct ImmPtr { // To make code serialization-safe, asm.js compilation should only // compile pointer immediates using AsmJSImmPtr. - JS_ASSERT(CanUsePointerImmediates()); + MOZ_ASSERT(CanUsePointerImmediates()); } template explicit ImmPtr(R (*pf)()) : value(JS_FUNC_TO_DATA_PTR(void *, pf)) { - JS_ASSERT(CanUsePointerImmediates()); + MOZ_ASSERT(CanUsePointerImmediates()); } template explicit ImmPtr(R (*pf)(A1)) : value(JS_FUNC_TO_DATA_PTR(void *, pf)) { - JS_ASSERT(CanUsePointerImmediates()); + MOZ_ASSERT(CanUsePointerImmediates()); } template explicit ImmPtr(R (*pf)(A1, A2)) : value(JS_FUNC_TO_DATA_PTR(void *, pf)) { - JS_ASSERT(CanUsePointerImmediates()); + MOZ_ASSERT(CanUsePointerImmediates()); } template explicit ImmPtr(R (*pf)(A1, A2, A3)) : value(JS_FUNC_TO_DATA_PTR(void *, pf)) { - JS_ASSERT(CanUsePointerImmediates()); + MOZ_ASSERT(CanUsePointerImmediates()); } template explicit ImmPtr(R (*pf)(A1, A2, A3, A4)) : value(JS_FUNC_TO_DATA_PTR(void *, pf)) { - JS_ASSERT(CanUsePointerImmediates()); + MOZ_ASSERT(CanUsePointerImmediates()); } }; @@ -205,11 +205,11 @@ struct ImmGCPtr explicit ImmGCPtr(const gc::Cell *ptr) : value(ptr) { - JS_ASSERT(!IsPoisonedPtr(ptr)); + MOZ_ASSERT(!IsPoisonedPtr(ptr)); JS_ASSERT_IF(ptr, ptr->isTenured()); // asm.js shouldn't be creating GC things - JS_ASSERT(!IsCompilingAsmJS()); + MOZ_ASSERT(!IsCompilingAsmJS()); } protected: @@ -222,10 +222,10 @@ struct ImmMaybeNurseryPtr : public ImmGCPtr explicit ImmMaybeNurseryPtr(gc::Cell *ptr) { this->value = ptr; - JS_ASSERT(!IsPoisonedPtr(ptr)); + MOZ_ASSERT(!IsPoisonedPtr(ptr)); // asm.js shouldn't be creating GC things - JS_ASSERT(!IsCompilingAsmJS()); + MOZ_ASSERT(!IsCompilingAsmJS()); } }; @@ -238,7 +238,7 @@ struct AbsoluteAddress explicit AbsoluteAddress(const void *addr) : addr(const_cast(addr)) { - JS_ASSERT(CanUsePointerImmediates()); + MOZ_ASSERT(CanUsePointerImmediates()); } AbsoluteAddress offset(ptrdiff_t delta) { @@ -313,27 +313,27 @@ class RepatchLabel RepatchLabel() : offset_(INVALID_OFFSET), bound_(0) {} void use(uint32_t newOffset) { - JS_ASSERT(offset_ == INVALID_OFFSET); - JS_ASSERT(newOffset != (uint32_t)INVALID_OFFSET); + MOZ_ASSERT(offset_ == INVALID_OFFSET); + MOZ_ASSERT(newOffset != (uint32_t)INVALID_OFFSET); offset_ = newOffset; } bool bound() const { return bound_; } void bind(int32_t dest) { - JS_ASSERT(!bound_); - JS_ASSERT(dest != INVALID_OFFSET); + MOZ_ASSERT(!bound_); + MOZ_ASSERT(dest != INVALID_OFFSET); offset_ = dest; bound_ = true; } int32_t target() { - JS_ASSERT(bound()); + MOZ_ASSERT(bound()); int32_t ret = offset_; offset_ = INVALID_OFFSET; return ret; } int32_t offset() { - JS_ASSERT(!bound()); + MOZ_ASSERT(!bound()); return offset_; } bool used() const { @@ -352,7 +352,7 @@ struct AbsoluteLabel : public LabelBase AbsoluteLabel(const AbsoluteLabel &label) : LabelBase(label) { } int32_t prev() const { - JS_ASSERT(!bound()); + MOZ_ASSERT(!bound()); if (!used()) return INVALID_OFFSET; return offset(); @@ -499,17 +499,17 @@ class CodeLocationJump void repoint(JitCode *code, MacroAssembler* masm = nullptr); uint8_t *raw() const { - JS_ASSERT(state_ == Absolute); + MOZ_ASSERT(state_ == Absolute); return raw_; } uint8_t *offset() const { - JS_ASSERT(state_ == Relative); + MOZ_ASSERT(state_ == Relative); return raw_; } #ifdef JS_SMALL_BRANCH uint8_t *jumpTableEntry() const { - JS_ASSERT(state_ == Absolute); + MOZ_ASSERT(state_ == Absolute); return jumpTableEntry_; } #endif @@ -574,11 +574,11 @@ class CodeLocationLabel #endif uint8_t *raw() const { - JS_ASSERT(state_ == Absolute); + MOZ_ASSERT(state_ == Absolute); return raw_; } uint8_t *offset() const { - JS_ASSERT(state_ == Relative); + MOZ_ASSERT(state_ == Relative); return raw_; } }; @@ -604,7 +604,7 @@ class CallSiteDesc CallSiteDesc(uint32_t line, uint32_t column, Kind kind) : line_(line), column_(column), kind_(kind) { - JS_ASSERT(column <= INT32_MAX); + MOZ_ASSERT(column <= INT32_MAX); } uint32_t line() const { return line_; } uint32_t column() const { return column_; } @@ -797,7 +797,7 @@ class AsmJSImmPtr public: AsmJSImmKind kind() const { return kind_; } // This needs to be MOZ_IMPLICIT in order to make MacroAssember::CallWithABINoProfiling compile. - MOZ_IMPLICIT AsmJSImmPtr(AsmJSImmKind kind) : kind_(kind) { JS_ASSERT(IsCompilingAsmJS()); } + MOZ_IMPLICIT AsmJSImmPtr(AsmJSImmKind kind) : kind_(kind) { MOZ_ASSERT(IsCompilingAsmJS()); } AsmJSImmPtr() {} }; @@ -808,7 +808,7 @@ class AsmJSAbsoluteAddress AsmJSImmKind kind_; public: AsmJSImmKind kind() const { return kind_; } - explicit AsmJSAbsoluteAddress(AsmJSImmKind kind) : kind_(kind) { JS_ASSERT(IsCompilingAsmJS()); } + explicit AsmJSAbsoluteAddress(AsmJSImmKind kind) : kind_(kind) { MOZ_ASSERT(IsCompilingAsmJS()); } AsmJSAbsoluteAddress() {} }; diff --git a/js/src/jit/shared/Assembler-x86-shared.cpp b/js/src/jit/shared/Assembler-x86-shared.cpp index 9761c29d736d..61811a1ba954 100644 --- a/js/src/jit/shared/Assembler-x86-shared.cpp +++ b/js/src/jit/shared/Assembler-x86-shared.cpp @@ -83,7 +83,7 @@ AssemblerX86Shared::trace(JSTracer *trc) if (rp.kind == Relocation::JITCODE) { JitCode *code = JitCode::FromExecutable((uint8_t *)rp.target); MarkJitCodeUnbarriered(trc, &code, "masmrel32"); - JS_ASSERT(code == JitCode::FromExecutable((uint8_t *)rp.target)); + MOZ_ASSERT(code == JitCode::FromExecutable((uint8_t *)rp.target)); } } if (dataRelocations_.length()) { diff --git a/js/src/jit/shared/Assembler-x86-shared.h b/js/src/jit/shared/Assembler-x86-shared.h index 8ce9e55f3b45..fe4c145819ce 100644 --- a/js/src/jit/shared/Assembler-x86-shared.h +++ b/js/src/jit/shared/Assembler-x86-shared.h @@ -72,12 +72,12 @@ class Operand { } Address toAddress() const { - JS_ASSERT(kind() == MEM_REG_DISP); + MOZ_ASSERT(kind() == MEM_REG_DISP); return Address(Register::FromCode(base()), disp()); } BaseIndex toBaseIndex() const { - JS_ASSERT(kind() == MEM_SCALE); + MOZ_ASSERT(kind() == MEM_SCALE); return BaseIndex(Register::FromCode(base()), Register::FromCode(index()), scale(), disp()); } @@ -85,31 +85,31 @@ class Operand return kind_; } Registers::Code reg() const { - JS_ASSERT(kind() == REG); + MOZ_ASSERT(kind() == REG); return (Registers::Code)base_; } Registers::Code base() const { - JS_ASSERT(kind() == MEM_REG_DISP || kind() == MEM_SCALE); + MOZ_ASSERT(kind() == MEM_REG_DISP || kind() == MEM_SCALE); return (Registers::Code)base_; } Registers::Code index() const { - JS_ASSERT(kind() == MEM_SCALE); + MOZ_ASSERT(kind() == MEM_SCALE); return (Registers::Code)index_; } Scale scale() const { - JS_ASSERT(kind() == MEM_SCALE); + MOZ_ASSERT(kind() == MEM_SCALE); return scale_; } FloatRegisters::Code fpu() const { - JS_ASSERT(kind() == FPREG); + MOZ_ASSERT(kind() == FPREG); return (FloatRegisters::Code)base_; } int32_t disp() const { - JS_ASSERT(kind() == MEM_REG_DISP || kind() == MEM_SCALE); + MOZ_ASSERT(kind() == MEM_REG_DISP || kind() == MEM_SCALE); return disp_; } void *address() const { - JS_ASSERT(kind() == MEM_ADDRESS32); + MOZ_ASSERT(kind() == MEM_ADDRESS32); return reinterpret_cast(disp_); } @@ -198,7 +198,7 @@ class AssemblerX86Shared : public AssemblerShared void writeDataRelocation(const Value &val) { if (val.isMarkable()) { - JS_ASSERT(static_cast(val.toGCThing())->isTenured()); + MOZ_ASSERT(static_cast(val.toGCThing())->isTenured()); dataRelocations_.writeUnsigned(masm.currentOffset()); } } @@ -377,7 +377,7 @@ class AssemblerX86Shared : public AssemblerShared masm.align(alignment); } void writeCodePointer(AbsoluteLabel *label) { - JS_ASSERT(!label->bound()); + MOZ_ASSERT(!label->bound()); // Thread the patch list through the unpatched address word in the // instruction stream. masm.jumpTablePointer(label->prev()); @@ -464,16 +464,16 @@ class AssemblerX86Shared : public AssemblerShared // Eventually movapd should be overloaded to support loads and // stores too. void movapd(FloatRegister src, FloatRegister dest) { - JS_ASSERT(HasSSE2()); + MOZ_ASSERT(HasSSE2()); masm.movapd_rr(src.code(), dest.code()); } void movaps(FloatRegister src, FloatRegister dest) { - JS_ASSERT(HasSSE2()); + MOZ_ASSERT(HasSSE2()); masm.movaps_rr(src.code(), dest.code()); } void movaps(const Operand &src, FloatRegister dest) { - JS_ASSERT(HasSSE2()); + MOZ_ASSERT(HasSSE2()); switch (src.kind()) { case Operand::MEM_REG_DISP: masm.movaps_mr(src.disp(), src.base(), dest.code()); @@ -486,7 +486,7 @@ class AssemblerX86Shared : public AssemblerShared } } void movaps(FloatRegister src, const Operand &dest) { - JS_ASSERT(HasSSE2()); + MOZ_ASSERT(HasSSE2()); switch (dest.kind()) { case Operand::MEM_REG_DISP: masm.movaps_rm(src.code(), dest.disp(), dest.base()); @@ -499,7 +499,7 @@ class AssemblerX86Shared : public AssemblerShared } } void movups(const Operand &src, FloatRegister dest) { - JS_ASSERT(HasSSE2()); + MOZ_ASSERT(HasSSE2()); switch (src.kind()) { case Operand::MEM_REG_DISP: masm.movups_mr(src.disp(), src.base(), dest.code()); @@ -512,7 +512,7 @@ class AssemblerX86Shared : public AssemblerShared } } void movups(FloatRegister src, const Operand &dest) { - JS_ASSERT(HasSSE2()); + MOZ_ASSERT(HasSSE2()); switch (dest.kind()) { case Operand::MEM_REG_DISP: masm.movups_rm(src.code(), dest.disp(), dest.base()); @@ -560,7 +560,7 @@ class AssemblerX86Shared : public AssemblerShared masm.movss_rr(src.code(), dest.code()); } void movdqu(const Operand &src, FloatRegister dest) { - JS_ASSERT(HasSSE2()); + MOZ_ASSERT(HasSSE2()); switch (src.kind()) { case Operand::MEM_REG_DISP: masm.movdqu_mr(src.disp(), src.base(), dest.code()); @@ -573,7 +573,7 @@ class AssemblerX86Shared : public AssemblerShared } } void movdqu(FloatRegister src, const Operand &dest) { - JS_ASSERT(HasSSE2()); + MOZ_ASSERT(HasSSE2()); switch (dest.kind()) { case Operand::MEM_REG_DISP: masm.movdqu_rm(src.code(), dest.disp(), dest.base()); @@ -586,7 +586,7 @@ class AssemblerX86Shared : public AssemblerShared } } void movdqa(const Operand &src, FloatRegister dest) { - JS_ASSERT(HasSSE2()); + MOZ_ASSERT(HasSSE2()); switch (src.kind()) { case Operand::MEM_REG_DISP: masm.movdqa_mr(src.disp(), src.base(), dest.code()); @@ -599,7 +599,7 @@ class AssemblerX86Shared : public AssemblerShared } } void movdqa(FloatRegister src, const Operand &dest) { - JS_ASSERT(HasSSE2()); + MOZ_ASSERT(HasSSE2()); switch (dest.kind()) { case Operand::MEM_REG_DISP: masm.movdqa_rm(src.code(), dest.disp(), dest.base()); @@ -612,15 +612,15 @@ class AssemblerX86Shared : public AssemblerShared } } void movdqa(FloatRegister src, FloatRegister dest) { - JS_ASSERT(HasSSE2()); + MOZ_ASSERT(HasSSE2()); masm.movdqa_rr(src.code(), dest.code()); } void cvtss2sd(FloatRegister src, FloatRegister dest) { - JS_ASSERT(HasSSE2()); + MOZ_ASSERT(HasSSE2()); masm.cvtss2sd_rr(src.code(), dest.code()); } void cvtsd2ss(FloatRegister src, FloatRegister dest) { - JS_ASSERT(HasSSE2()); + MOZ_ASSERT(HasSSE2()); masm.cvtsd2ss_rr(src.code(), dest.code()); } void movzbl(const Operand &src, Register dest) { @@ -1018,8 +1018,8 @@ class AssemblerX86Shared : public AssemblerShared masm.setCC_r(static_cast(cond), r.code()); } void testb(Register lhs, Register rhs) { - JS_ASSERT(GeneralRegisterSet(Registers::SingleByteRegs).has(lhs)); - JS_ASSERT(GeneralRegisterSet(Registers::SingleByteRegs).has(rhs)); + MOZ_ASSERT(GeneralRegisterSet(Registers::SingleByteRegs).has(lhs)); + MOZ_ASSERT(GeneralRegisterSet(Registers::SingleByteRegs).has(rhs)); masm.testb_rr(rhs.code(), lhs.code()); } void testw(Register lhs, Register rhs) { @@ -1415,15 +1415,15 @@ class AssemblerX86Shared : public AssemblerShared } void unpcklps(FloatRegister src, FloatRegister dest) { - JS_ASSERT(HasSSE2()); + MOZ_ASSERT(HasSSE2()); masm.unpcklps_rr(src.code(), dest.code()); } void pinsrd(unsigned lane, Register src, FloatRegister dest) { - JS_ASSERT(HasSSE41()); + MOZ_ASSERT(HasSSE41()); masm.pinsrd_irr(lane, src.code(), dest.code()); } void pinsrd(unsigned lane, const Operand &src, FloatRegister dest) { - JS_ASSERT(HasSSE41()); + MOZ_ASSERT(HasSSE41()); switch (src.kind()) { case Operand::REG: masm.pinsrd_irr(lane, src.reg(), dest.code()); @@ -1436,15 +1436,15 @@ class AssemblerX86Shared : public AssemblerShared } } void psrldq(Imm32 shift, FloatRegister dest) { - JS_ASSERT(HasSSE2()); + MOZ_ASSERT(HasSSE2()); masm.psrldq_ir(shift.value, dest.code()); } void psllq(Imm32 shift, FloatRegister dest) { - JS_ASSERT(HasSSE2()); + MOZ_ASSERT(HasSSE2()); masm.psllq_ir(shift.value, dest.code()); } void psrlq(Imm32 shift, FloatRegister dest) { - JS_ASSERT(HasSSE2()); + MOZ_ASSERT(HasSSE2()); masm.psrlq_ir(shift.value, dest.code()); } void pslld(FloatRegister src, FloatRegister dest) { @@ -1473,7 +1473,7 @@ class AssemblerX86Shared : public AssemblerShared } void cvtsi2sd(const Operand &src, FloatRegister dest) { - JS_ASSERT(HasSSE2()); + MOZ_ASSERT(HasSSE2()); switch (src.kind()) { case Operand::REG: masm.cvtsi2sd_rr(src.reg(), dest.code()); @@ -1489,15 +1489,15 @@ class AssemblerX86Shared : public AssemblerShared } } void cvttsd2si(FloatRegister src, Register dest) { - JS_ASSERT(HasSSE2()); + MOZ_ASSERT(HasSSE2()); masm.cvttsd2si_rr(src.code(), dest.code()); } void cvttss2si(FloatRegister src, Register dest) { - JS_ASSERT(HasSSE2()); + MOZ_ASSERT(HasSSE2()); masm.cvttss2si_rr(src.code(), dest.code()); } void cvtsi2ss(const Operand &src, FloatRegister dest) { - JS_ASSERT(HasSSE2()); + MOZ_ASSERT(HasSSE2()); switch (src.kind()) { case Operand::REG: masm.cvtsi2ss_rr(src.reg(), dest.code()); @@ -1513,11 +1513,11 @@ class AssemblerX86Shared : public AssemblerShared } } void cvtsi2ss(Register src, FloatRegister dest) { - JS_ASSERT(HasSSE2()); + MOZ_ASSERT(HasSSE2()); masm.cvtsi2ss_rr(src.code(), dest.code()); } void cvtsi2sd(Register src, FloatRegister dest) { - JS_ASSERT(HasSSE2()); + MOZ_ASSERT(HasSSE2()); masm.cvtsi2sd_rr(src.code(), dest.code()); } void cvttps2dq(FloatRegister src, FloatRegister dest) { @@ -1529,27 +1529,27 @@ class AssemblerX86Shared : public AssemblerShared masm.cvtdq2ps_rr(src.code(), dest.code()); } void movmskpd(FloatRegister src, Register dest) { - JS_ASSERT(HasSSE2()); + MOZ_ASSERT(HasSSE2()); masm.movmskpd_rr(src.code(), dest.code()); } void movmskps(FloatRegister src, Register dest) { - JS_ASSERT(HasSSE2()); + MOZ_ASSERT(HasSSE2()); masm.movmskps_rr(src.code(), dest.code()); } void ptest(FloatRegister lhs, FloatRegister rhs) { - JS_ASSERT(HasSSE41()); + MOZ_ASSERT(HasSSE41()); masm.ptest_rr(rhs.code(), lhs.code()); } void ucomisd(FloatRegister lhs, FloatRegister rhs) { - JS_ASSERT(HasSSE2()); + MOZ_ASSERT(HasSSE2()); masm.ucomisd_rr(rhs.code(), lhs.code()); } void ucomiss(FloatRegister lhs, FloatRegister rhs) { - JS_ASSERT(HasSSE2()); + MOZ_ASSERT(HasSSE2()); masm.ucomiss_rr(rhs.code(), lhs.code()); } void pcmpeqw(FloatRegister lhs, FloatRegister rhs) { - JS_ASSERT(HasSSE2()); + MOZ_ASSERT(HasSSE2()); masm.pcmpeqw_rr(rhs.code(), lhs.code()); } void pcmpeqd(const Operand &src, FloatRegister dest) { @@ -1601,15 +1601,15 @@ class AssemblerX86Shared : public AssemblerShared } } void movd(Register src, FloatRegister dest) { - JS_ASSERT(HasSSE2()); + MOZ_ASSERT(HasSSE2()); masm.movd_rr(src.code(), dest.code()); } void movd(FloatRegister src, Register dest) { - JS_ASSERT(HasSSE2()); + MOZ_ASSERT(HasSSE2()); masm.movd_rr(src.code(), dest.code()); } void paddd(const Operand &src, FloatRegister dest) { - JS_ASSERT(HasSSE2()); + MOZ_ASSERT(HasSSE2()); switch (src.kind()) { case Operand::FPREG: masm.paddd_rr(src.fpu(), dest.code()); @@ -1625,7 +1625,7 @@ class AssemblerX86Shared : public AssemblerShared } } void psubd(const Operand &src, FloatRegister dest) { - JS_ASSERT(HasSSE2()); + MOZ_ASSERT(HasSSE2()); switch (src.kind()) { case Operand::FPREG: masm.psubd_rr(src.fpu(), dest.code()); @@ -1641,7 +1641,7 @@ class AssemblerX86Shared : public AssemblerShared } } void addps(const Operand &src, FloatRegister dest) { - JS_ASSERT(HasSSE2()); + MOZ_ASSERT(HasSSE2()); switch (src.kind()) { case Operand::FPREG: masm.addps_rr(src.fpu(), dest.code()); @@ -1657,7 +1657,7 @@ class AssemblerX86Shared : public AssemblerShared } } void subps(const Operand &src, FloatRegister dest) { - JS_ASSERT(HasSSE2()); + MOZ_ASSERT(HasSSE2()); switch (src.kind()) { case Operand::FPREG: masm.subps_rr(src.fpu(), dest.code()); @@ -1673,7 +1673,7 @@ class AssemblerX86Shared : public AssemblerShared } } void mulps(const Operand &src, FloatRegister dest) { - JS_ASSERT(HasSSE2()); + MOZ_ASSERT(HasSSE2()); switch (src.kind()) { case Operand::FPREG: masm.mulps_rr(src.fpu(), dest.code()); @@ -1689,7 +1689,7 @@ class AssemblerX86Shared : public AssemblerShared } } void divps(const Operand &src, FloatRegister dest) { - JS_ASSERT(HasSSE2()); + MOZ_ASSERT(HasSSE2()); switch (src.kind()) { case Operand::FPREG: masm.divps_rr(src.fpu(), dest.code()); @@ -1705,7 +1705,7 @@ class AssemblerX86Shared : public AssemblerShared } } void maxps(const Operand &src, FloatRegister dest) { - JS_ASSERT(HasSSE2()); + MOZ_ASSERT(HasSSE2()); switch (src.kind()) { case Operand::FPREG: masm.maxps_rr(src.fpu(), dest.code()); @@ -1721,7 +1721,7 @@ class AssemblerX86Shared : public AssemblerShared } } void minps(const Operand &src, FloatRegister dest) { - JS_ASSERT(HasSSE2()); + MOZ_ASSERT(HasSSE2()); switch (src.kind()) { case Operand::FPREG: masm.minps_rr(src.fpu(), dest.code()); @@ -1753,7 +1753,7 @@ class AssemblerX86Shared : public AssemblerShared } } void andnps(const Operand &src, FloatRegister dest) { - JS_ASSERT(HasSSE2()); + MOZ_ASSERT(HasSSE2()); switch (src.kind()) { case Operand::FPREG: masm.andnps_rr(src.fpu(), dest.code()); @@ -1801,31 +1801,31 @@ class AssemblerX86Shared : public AssemblerShared } } void pxor(FloatRegister src, FloatRegister dest) { - JS_ASSERT(HasSSE2()); + MOZ_ASSERT(HasSSE2()); masm.pxor_rr(src.code(), dest.code()); } void pshufd(uint32_t mask, FloatRegister src, FloatRegister dest) { - JS_ASSERT(HasSSE2()); + MOZ_ASSERT(HasSSE2()); masm.pshufd_irr(mask, src.code(), dest.code()); } void movhlps(FloatRegister src, FloatRegister dest) { - JS_ASSERT(HasSSE2()); + MOZ_ASSERT(HasSSE2()); masm.movhlps_rr(src.code(), dest.code()); } void shufps(uint32_t mask, FloatRegister src, FloatRegister dest) { - JS_ASSERT(HasSSE2()); + MOZ_ASSERT(HasSSE2()); masm.shufps_irr(mask, src.code(), dest.code()); } void addsd(FloatRegister src, FloatRegister dest) { - JS_ASSERT(HasSSE2()); + MOZ_ASSERT(HasSSE2()); masm.addsd_rr(src.code(), dest.code()); } void addss(FloatRegister src, FloatRegister dest) { - JS_ASSERT(HasSSE2()); + MOZ_ASSERT(HasSSE2()); masm.addss_rr(src.code(), dest.code()); } void addsd(const Operand &src, FloatRegister dest) { - JS_ASSERT(HasSSE2()); + MOZ_ASSERT(HasSSE2()); switch (src.kind()) { case Operand::FPREG: masm.addsd_rr(src.fpu(), dest.code()); @@ -1841,7 +1841,7 @@ class AssemblerX86Shared : public AssemblerShared } } void addss(const Operand &src, FloatRegister dest) { - JS_ASSERT(HasSSE2()); + MOZ_ASSERT(HasSSE2()); switch (src.kind()) { case Operand::FPREG: masm.addss_rr(src.fpu(), dest.code()); @@ -1857,15 +1857,15 @@ class AssemblerX86Shared : public AssemblerShared } } void subsd(FloatRegister src, FloatRegister dest) { - JS_ASSERT(HasSSE2()); + MOZ_ASSERT(HasSSE2()); masm.subsd_rr(src.code(), dest.code()); } void subss(FloatRegister src, FloatRegister dest) { - JS_ASSERT(HasSSE2()); + MOZ_ASSERT(HasSSE2()); masm.subss_rr(src.code(), dest.code()); } void subsd(const Operand &src, FloatRegister dest) { - JS_ASSERT(HasSSE2()); + MOZ_ASSERT(HasSSE2()); switch (src.kind()) { case Operand::FPREG: masm.subsd_rr(src.fpu(), dest.code()); @@ -1878,7 +1878,7 @@ class AssemblerX86Shared : public AssemblerShared } } void subss(const Operand &src, FloatRegister dest) { - JS_ASSERT(HasSSE2()); + MOZ_ASSERT(HasSSE2()); switch (src.kind()) { case Operand::FPREG: masm.subss_rr(src.fpu(), dest.code()); @@ -1891,11 +1891,11 @@ class AssemblerX86Shared : public AssemblerShared } } void mulsd(FloatRegister src, FloatRegister dest) { - JS_ASSERT(HasSSE2()); + MOZ_ASSERT(HasSSE2()); masm.mulsd_rr(src.code(), dest.code()); } void mulsd(const Operand &src, FloatRegister dest) { - JS_ASSERT(HasSSE2()); + MOZ_ASSERT(HasSSE2()); switch (src.kind()) { case Operand::FPREG: masm.mulsd_rr(src.fpu(), dest.code()); @@ -1908,7 +1908,7 @@ class AssemblerX86Shared : public AssemblerShared } } void mulss(const Operand &src, FloatRegister dest) { - JS_ASSERT(HasSSE2()); + MOZ_ASSERT(HasSSE2()); switch (src.kind()) { case Operand::FPREG: masm.mulss_rr(src.fpu(), dest.code()); @@ -1921,19 +1921,19 @@ class AssemblerX86Shared : public AssemblerShared } } void mulss(FloatRegister src, FloatRegister dest) { - JS_ASSERT(HasSSE2()); + MOZ_ASSERT(HasSSE2()); masm.mulss_rr(src.code(), dest.code()); } void divsd(FloatRegister src, FloatRegister dest) { - JS_ASSERT(HasSSE2()); + MOZ_ASSERT(HasSSE2()); masm.divsd_rr(src.code(), dest.code()); } void divss(FloatRegister src, FloatRegister dest) { - JS_ASSERT(HasSSE2()); + MOZ_ASSERT(HasSSE2()); masm.divss_rr(src.code(), dest.code()); } void divsd(const Operand &src, FloatRegister dest) { - JS_ASSERT(HasSSE2()); + MOZ_ASSERT(HasSSE2()); switch (src.kind()) { case Operand::FPREG: masm.divsd_rr(src.fpu(), dest.code()); @@ -1946,7 +1946,7 @@ class AssemblerX86Shared : public AssemblerShared } } void divss(const Operand &src, FloatRegister dest) { - JS_ASSERT(HasSSE2()); + MOZ_ASSERT(HasSSE2()); switch (src.kind()) { case Operand::FPREG: masm.divss_rr(src.fpu(), dest.code()); @@ -1959,43 +1959,43 @@ class AssemblerX86Shared : public AssemblerShared } } void xorpd(FloatRegister src, FloatRegister dest) { - JS_ASSERT(HasSSE2()); + MOZ_ASSERT(HasSSE2()); masm.xorpd_rr(src.code(), dest.code()); } void xorps(FloatRegister src, FloatRegister dest) { - JS_ASSERT(HasSSE2()); + MOZ_ASSERT(HasSSE2()); masm.xorps_rr(src.code(), dest.code()); } void orpd(FloatRegister src, FloatRegister dest) { - JS_ASSERT(HasSSE2()); + MOZ_ASSERT(HasSSE2()); masm.orpd_rr(src.code(), dest.code()); } void orps(FloatRegister src, FloatRegister dest) { - JS_ASSERT(HasSSE2()); + MOZ_ASSERT(HasSSE2()); masm.orps_rr(src.code(), dest.code()); } void andpd(FloatRegister src, FloatRegister dest) { - JS_ASSERT(HasSSE2()); + MOZ_ASSERT(HasSSE2()); masm.andpd_rr(src.code(), dest.code()); } void andps(FloatRegister src, FloatRegister dest) { - JS_ASSERT(HasSSE2()); + MOZ_ASSERT(HasSSE2()); masm.andps_rr(src.code(), dest.code()); } void sqrtsd(FloatRegister src, FloatRegister dest) { - JS_ASSERT(HasSSE2()); + MOZ_ASSERT(HasSSE2()); masm.sqrtsd_rr(src.code(), dest.code()); } void sqrtss(FloatRegister src, FloatRegister dest) { - JS_ASSERT(HasSSE2()); + MOZ_ASSERT(HasSSE2()); masm.sqrtss_rr(src.code(), dest.code()); } void roundsd(FloatRegister src, FloatRegister dest, X86Assembler::RoundingMode mode) { - JS_ASSERT(HasSSE41()); + MOZ_ASSERT(HasSSE41()); masm.roundsd_rr(src.code(), dest.code(), mode); } void roundss(FloatRegister src, FloatRegister dest, X86Assembler::RoundingMode mode) { - JS_ASSERT(HasSSE41()); + MOZ_ASSERT(HasSSE41()); masm.roundss_rr(src.code(), dest.code(), mode); } unsigned insertpsMask(SimdLane sourceLane, SimdLane destLane, unsigned zeroMask = 0) @@ -2010,15 +2010,15 @@ class AssemblerX86Shared : public AssemblerShared return ret; } void insertps(FloatRegister src, FloatRegister dest, unsigned mask) { - JS_ASSERT(HasSSE41()); + MOZ_ASSERT(HasSSE41()); masm.insertps_irr(mask, src.code(), dest.code()); } void minsd(FloatRegister src, FloatRegister dest) { - JS_ASSERT(HasSSE2()); + MOZ_ASSERT(HasSSE2()); masm.minsd_rr(src.code(), dest.code()); } void minsd(const Operand &src, FloatRegister dest) { - JS_ASSERT(HasSSE2()); + MOZ_ASSERT(HasSSE2()); switch (src.kind()) { case Operand::FPREG: masm.minsd_rr(src.fpu(), dest.code()); @@ -2031,15 +2031,15 @@ class AssemblerX86Shared : public AssemblerShared } } void minss(FloatRegister src, FloatRegister dest) { - JS_ASSERT(HasSSE2()); + MOZ_ASSERT(HasSSE2()); masm.minss_rr(src.code(), dest.code()); } void maxsd(FloatRegister src, FloatRegister dest) { - JS_ASSERT(HasSSE2()); + MOZ_ASSERT(HasSSE2()); masm.maxsd_rr(src.code(), dest.code()); } void maxsd(const Operand &src, FloatRegister dest) { - JS_ASSERT(HasSSE2()); + MOZ_ASSERT(HasSSE2()); switch (src.kind()) { case Operand::FPREG: masm.maxsd_rr(src.fpu(), dest.code()); @@ -2052,11 +2052,11 @@ class AssemblerX86Shared : public AssemblerShared } } void maxss(FloatRegister src, FloatRegister dest) { - JS_ASSERT(HasSSE2()); + MOZ_ASSERT(HasSSE2()); masm.maxss_rr(src.code(), dest.code()); } void fisttp(const Operand &dest) { - JS_ASSERT(HasSSE3()); + MOZ_ASSERT(HasSSE3()); switch (dest.kind()) { case Operand::MEM_REG_DISP: masm.fisttp_m(dest.disp(), dest.base()); @@ -2120,7 +2120,7 @@ class AssemblerX86Shared : public AssemblerShared uint8_t *start = startLabel.raw(); *start = 0xE8; ptrdiff_t offset = target - startLabel - PatchWrite_NearCallSize(); - JS_ASSERT(int32_t(offset) == offset); + MOZ_ASSERT(int32_t(offset) == offset); *((int32_t *) (start + 1)) = offset; } @@ -2132,7 +2132,7 @@ class AssemblerX86Shared : public AssemblerShared PatchedImmPtr expectedData) { // The pointer given is a pointer to *after* the data. uintptr_t *ptr = ((uintptr_t *) data.raw()) - 1; - JS_ASSERT(*ptr == (uintptr_t)expectedData.value); + MOZ_ASSERT(*ptr == (uintptr_t)expectedData.value); *ptr = (uintptr_t)newData.value; } static void PatchDataWithValueCheck(CodeLocationLabel data, ImmPtr newData, ImmPtr expectedData) { @@ -2153,18 +2153,18 @@ class AssemblerX86Shared : public AssemblerShared // Toggle a jmp or cmp emitted by toggledJump(). static void ToggleToJmp(CodeLocationLabel inst) { uint8_t *ptr = (uint8_t *)inst.raw(); - JS_ASSERT(*ptr == 0x3D); + MOZ_ASSERT(*ptr == 0x3D); *ptr = 0xE9; } static void ToggleToCmp(CodeLocationLabel inst) { uint8_t *ptr = (uint8_t *)inst.raw(); - JS_ASSERT(*ptr == 0xE9); + MOZ_ASSERT(*ptr == 0xE9); *ptr = 0x3D; } static void ToggleCall(CodeLocationLabel inst, bool enabled) { uint8_t *ptr = (uint8_t *)inst.raw(); - JS_ASSERT(*ptr == 0x3D || // CMP - *ptr == 0xE8); // CALL + MOZ_ASSERT(*ptr == 0x3D || // CMP + *ptr == 0xE8); // CALL *ptr = enabled ? 0xE8 : 0x3D; } }; diff --git a/js/src/jit/shared/AssemblerBuffer-x86-shared.h b/js/src/jit/shared/AssemblerBuffer-x86-shared.h index a021697190fc..ad1dea50dd76 100644 --- a/js/src/jit/shared/AssemblerBuffer-x86-shared.h +++ b/js/src/jit/shared/AssemblerBuffer-x86-shared.h @@ -170,7 +170,7 @@ namespace jit { *poolp = NULL; return 0; } - JS_ASSERT(*poolp); + MOZ_ASSERT(*poolp); js::jit::ExecutableAllocator::makeWritable(result, m_size); diff --git a/js/src/jit/shared/BaseAssembler-x86-shared.h b/js/src/jit/shared/BaseAssembler-x86-shared.h index 38f0e9aa5e1c..7bf755009fa9 100644 --- a/js/src/jit/shared/BaseAssembler-x86-shared.h +++ b/js/src/jit/shared/BaseAssembler-x86-shared.h @@ -155,7 +155,7 @@ namespace X86Registers { } inline RegisterID getSubregH(RegisterID reg) { - JS_ASSERT(hasSubregH(reg)); + MOZ_ASSERT(hasSubregH(reg)); return RegisterID(reg + 4); } @@ -2879,7 +2879,7 @@ public: void pshufd_irr(uint32_t mask, XMMRegisterID src, XMMRegisterID dst) { - JS_ASSERT(mask < 256); + MOZ_ASSERT(mask < 256); spew("pshufd 0x%x, %s, %s", mask, nameFPReg(src), nameFPReg(dst)); m_formatter.prefix(PRE_SSE_66); @@ -2889,7 +2889,7 @@ public: void shufps_irr(uint32_t mask, XMMRegisterID src, XMMRegisterID dst) { - JS_ASSERT(mask < 256); + MOZ_ASSERT(mask < 256); spew("shufps 0x%x, %s, %s", mask, nameFPReg(src), nameFPReg(dst)); m_formatter.twoByteOp(OP2_SHUFPS_VpsWpsIb, (RegisterID)dst, (RegisterID)src); diff --git a/js/src/jit/shared/BaselineCompiler-shared.cpp b/js/src/jit/shared/BaselineCompiler-shared.cpp index c7bfd00e1cd2..bc719a4f4d07 100644 --- a/js/src/jit/shared/BaselineCompiler-shared.cpp +++ b/js/src/jit/shared/BaselineCompiler-shared.cpp @@ -40,7 +40,7 @@ BaselineCompilerShared::callVM(const VMFunction &fun, CallVMPhase phase) #ifdef DEBUG // Assert prepareVMCall() has been called. - JS_ASSERT(inCall_); + MOZ_ASSERT(inCall_); inCall_ = false; #endif @@ -49,7 +49,7 @@ BaselineCompilerShared::callVM(const VMFunction &fun, CallVMPhase phase) uint32_t argSize = fun.explicitStackSlots() * sizeof(void *) + sizeof(void *); // Assert all arguments were pushed. - JS_ASSERT(masm.framePushed() - pushedBeforeCall_ == argSize); + MOZ_ASSERT(masm.framePushed() - pushedBeforeCall_ == argSize); Address frameSizeAddress(BaselineFrameReg, BaselineFrame::reverseOffsetOfFrameSize()); uint32_t frameVals = frame.nlocals() + frame.stackDepth(); @@ -66,7 +66,7 @@ BaselineCompilerShared::callVM(const VMFunction &fun, CallVMPhase phase) masm.push(Imm32(descriptor)); } else { - JS_ASSERT(phase == CHECK_OVER_RECURSED); + MOZ_ASSERT(phase == CHECK_OVER_RECURSED); Label afterWrite; Label writePostInitialize; diff --git a/js/src/jit/shared/BaselineCompiler-shared.h b/js/src/jit/shared/BaselineCompiler-shared.h index a093fd7808fc..e532d18f6812 100644 --- a/js/src/jit/shared/BaselineCompiler-shared.h +++ b/js/src/jit/shared/BaselineCompiler-shared.h @@ -47,7 +47,7 @@ class BaselineCompilerShared void fixupNativeOffset(MacroAssembler &masm) { CodeOffsetLabel offset(nativeOffset); offset.fixup(&masm); - JS_ASSERT(offset.offset() <= UINT32_MAX); + MOZ_ASSERT(offset.offset() <= UINT32_MAX); nativeOffset = (uint32_t) offset.offset(); } }; @@ -88,7 +88,7 @@ class BaselineCompilerShared } bool addICLoadLabel(CodeOffsetLabel label) { - JS_ASSERT(!icEntries_.empty()); + MOZ_ASSERT(!icEntries_.empty()); ICLoadLabel loadLabel; loadLabel.label = label; loadLabel.icEntry = icEntries_.length() - 1; @@ -102,7 +102,7 @@ class BaselineCompilerShared } PCMappingSlotInfo getStackTopSlotInfo() { - JS_ASSERT(frame.numUnsyncedSlots() <= 2); + MOZ_ASSERT(frame.numUnsyncedSlots() <= 2); switch (frame.numUnsyncedSlots()) { case 0: return PCMappingSlotInfo::MakeSlotInfo(); diff --git a/js/src/jit/shared/CodeGenerator-shared-inl.h b/js/src/jit/shared/CodeGenerator-shared-inl.h index 95babe1faefb..540e3e25a6eb 100644 --- a/js/src/jit/shared/CodeGenerator-shared-inl.h +++ b/js/src/jit/shared/CodeGenerator-shared-inl.h @@ -31,7 +31,7 @@ ToDouble(const LAllocation *a) static inline Register ToRegister(const LAllocation &a) { - JS_ASSERT(a.isGeneralReg()); + MOZ_ASSERT(a.isGeneralReg()); return a.toGeneralReg()->reg(); } @@ -70,7 +70,7 @@ ToRegisterOrInvalid(const LDefinition *a) static inline FloatRegister ToFloatRegister(const LAllocation &a) { - JS_ASSERT(a.isFloatReg()); + MOZ_ASSERT(a.isFloatReg()); return a.toFloatReg()->reg(); } @@ -89,7 +89,7 @@ ToFloatRegister(const LDefinition *def) static inline AnyRegister ToAnyRegister(const LAllocation &a) { - JS_ASSERT(a.isGeneralReg() || a.isFloatReg()); + MOZ_ASSERT(a.isGeneralReg() || a.isFloatReg()); if (a.isGeneralReg()) return AnyRegister(ToRegister(a)); return AnyRegister(ToFloatRegister(a)); @@ -144,7 +144,7 @@ GetTempValue(Register type, Register payload) void CodeGeneratorShared::saveLive(LInstruction *ins) { - JS_ASSERT(!ins->isCall()); + MOZ_ASSERT(!ins->isCall()); LSafepoint *safepoint = ins->safepoint(); masm.PushRegsInMask(safepoint->liveRegs()); } @@ -152,7 +152,7 @@ CodeGeneratorShared::saveLive(LInstruction *ins) void CodeGeneratorShared::restoreLive(LInstruction *ins) { - JS_ASSERT(!ins->isCall()); + MOZ_ASSERT(!ins->isCall()); LSafepoint *safepoint = ins->safepoint(); masm.PopRegsInMask(safepoint->liveRegs()); } @@ -160,7 +160,7 @@ CodeGeneratorShared::restoreLive(LInstruction *ins) void CodeGeneratorShared::restoreLiveIgnore(LInstruction *ins, RegisterSet ignore) { - JS_ASSERT(!ins->isCall()); + MOZ_ASSERT(!ins->isCall()); LSafepoint *safepoint = ins->safepoint(); masm.PopRegsInMaskIgnore(safepoint->liveRegs(), ignore); } @@ -168,7 +168,7 @@ CodeGeneratorShared::restoreLiveIgnore(LInstruction *ins, RegisterSet ignore) void CodeGeneratorShared::saveLiveVolatile(LInstruction *ins) { - JS_ASSERT(!ins->isCall()); + MOZ_ASSERT(!ins->isCall()); LSafepoint *safepoint = ins->safepoint(); RegisterSet regs = RegisterSet::Intersect(safepoint->liveRegs(), RegisterSet::Volatile()); masm.PushRegsInMask(regs); @@ -177,7 +177,7 @@ CodeGeneratorShared::saveLiveVolatile(LInstruction *ins) void CodeGeneratorShared::restoreLiveVolatile(LInstruction *ins) { - JS_ASSERT(!ins->isCall()); + MOZ_ASSERT(!ins->isCall()); LSafepoint *safepoint = ins->safepoint(); RegisterSet regs = RegisterSet::Intersect(safepoint->liveRegs(), RegisterSet::Volatile()); masm.PopRegsInMask(regs); diff --git a/js/src/jit/shared/CodeGenerator-shared.cpp b/js/src/jit/shared/CodeGenerator-shared.cpp index 16227afe0d94..a1694d67cd99 100644 --- a/js/src/jit/shared/CodeGenerator-shared.cpp +++ b/js/src/jit/shared/CodeGenerator-shared.cpp @@ -73,7 +73,7 @@ CodeGeneratorShared::CodeGeneratorShared(MIRGenerator *gen, LIRGraph *graph, Mac // Since asm.js uses the system ABI which does not necessarily use a // regular array where all slots are sizeof(Value), it maintains the max // argument stack depth separately. - JS_ASSERT(graph->argumentSlotCount() == 0); + MOZ_ASSERT(graph->argumentSlotCount() == 0); frameDepth_ += gen->maxAsmJSStackArgBytes(); if (gen->usesSimd()) { @@ -140,7 +140,7 @@ CodeGeneratorShared::generateOutOfLineCode() bool CodeGeneratorShared::addOutOfLineCode(OutOfLineCode *code, const MInstruction *mir) { - JS_ASSERT(mir); + MOZ_ASSERT(mir); return addOutOfLineCode(code, mir->trackedSite()); } @@ -160,8 +160,8 @@ CodeGeneratorShared::addNativeToBytecodeEntry(const BytecodeSite &site) if (!isNativeToBytecodeMapEnabled()) return true; - JS_ASSERT(site.tree()); - JS_ASSERT(site.pc()); + MOZ_ASSERT(site.tree()); + MOZ_ASSERT(site.pc()); InlineScriptTree *tree = site.tree(); jsbytecode *pc = site.pc(); @@ -173,7 +173,7 @@ CodeGeneratorShared::addNativeToBytecodeEntry(const BytecodeSite &site) size_t lastIdx = nativeToBytecodeList_.length() - 1; NativeToBytecode &lastEntry = nativeToBytecodeList_[lastIdx]; - JS_ASSERT(nativeOffset >= lastEntry.nativeOffset.offset()); + MOZ_ASSERT(nativeOffset >= lastEntry.nativeOffset.offset()); // If the new entry is for the same inlineScriptTree and same // bytecodeOffset, but the nativeOffset has changed, do nothing. @@ -271,10 +271,10 @@ static inline int32_t ToStackIndex(LAllocation *a) { if (a->isStackSlot()) { - JS_ASSERT(a->toStackSlot()->slot() >= 1); + MOZ_ASSERT(a->toStackSlot()->slot() >= 1); return a->toStackSlot()->slot(); } - JS_ASSERT(-int32_t(sizeof(IonJSFrameLayout)) <= a->toArgument()->index()); + MOZ_ASSERT(-int32_t(sizeof(IonJSFrameLayout)) <= a->toArgument()->index()); return -int32_t(sizeof(IonJSFrameLayout) + a->toArgument()->index()); } @@ -365,7 +365,7 @@ CodeGeneratorShared::encodeAllocation(LSnapshot *snapshot, MDefinition *mir, } default: { - JS_ASSERT(mir->type() == MIRType_Value); + MOZ_ASSERT(mir->type() == MIRType_Value); LAllocation *payload = snapshot->payloadOfSlot(*allocIndex); #ifdef JS_NUNBOX32 LAllocation *type = snapshot->typeOfSlot(*allocIndex); @@ -406,7 +406,7 @@ CodeGeneratorShared::encode(LRecoverInfo *recover) (void *)recover, recover->mir()->frameCount(), numInstructions); MResumePoint::Mode mode = recover->mir()->mode(); - JS_ASSERT(mode != MResumePoint::Outer); + MOZ_ASSERT(mode != MResumePoint::Outer); bool resumeAfter = (mode == MResumePoint::ResumeAfter); RecoverOffset offset = recovers_.startRecover(numInstructions, resumeAfter); @@ -476,7 +476,7 @@ CodeGeneratorShared::encode(LSnapshot *snapshot) bool CodeGeneratorShared::assignBailoutId(LSnapshot *snapshot) { - JS_ASSERT(snapshot->snapshotOffset() != INVALID_SNAPSHOT_OFFSET); + MOZ_ASSERT(snapshot->snapshotOffset() != INVALID_SNAPSHOT_OFFSET); // Can we not use bailout tables at all? if (!deoptTable_) @@ -489,7 +489,7 @@ CodeGeneratorShared::assignBailoutId(LSnapshot *snapshot) default: MOZ_CRASH("No such execution mode"); } - JS_ASSERT(frameClass_ != FrameSizeClass::None()); + MOZ_ASSERT(frameClass_ != FrameSizeClass::None()); if (snapshot->bailoutId() != INVALID_BAILOUT_ID) return true; @@ -561,7 +561,7 @@ CodeGeneratorShared::createNativeToBytecodeScriptList(JSContext *cx) } // Otherwise, we must have reached the top without finding any siblings. - JS_ASSERT(tree->isOutermostCaller()); + MOZ_ASSERT(tree->isOutermostCaller()); break; } @@ -582,12 +582,12 @@ CodeGeneratorShared::createNativeToBytecodeScriptList(JSContext *cx) bool CodeGeneratorShared::generateCompactNativeToBytecodeMap(JSContext *cx, JitCode *code) { - JS_ASSERT(nativeToBytecodeScriptListLength_ == 0); - JS_ASSERT(nativeToBytecodeScriptList_ == nullptr); - JS_ASSERT(nativeToBytecodeMap_ == nullptr); - JS_ASSERT(nativeToBytecodeMapSize_ == 0); - JS_ASSERT(nativeToBytecodeTableOffset_ == 0); - JS_ASSERT(nativeToBytecodeNumRegions_ == 0); + MOZ_ASSERT(nativeToBytecodeScriptListLength_ == 0); + MOZ_ASSERT(nativeToBytecodeScriptList_ == nullptr); + MOZ_ASSERT(nativeToBytecodeMap_ == nullptr); + MOZ_ASSERT(nativeToBytecodeMapSize_ == 0); + MOZ_ASSERT(nativeToBytecodeTableOffset_ == 0); + MOZ_ASSERT(nativeToBytecodeNumRegions_ == 0); // Iterate through all nativeToBytecode entries, fix up their masm offsets. for (unsigned i = 0; i < nativeToBytecodeList_.length(); i++) { @@ -600,8 +600,8 @@ CodeGeneratorShared::generateCompactNativeToBytecodeMap(JSContext *cx, JitCode * if (!createNativeToBytecodeScriptList(cx)) return false; - JS_ASSERT(nativeToBytecodeScriptListLength_ > 0); - JS_ASSERT(nativeToBytecodeScriptList_ != nullptr); + MOZ_ASSERT(nativeToBytecodeScriptListLength_ > 0); + MOZ_ASSERT(nativeToBytecodeScriptList_ != nullptr); CompactBufferWriter writer; uint32_t tableOffset = 0; @@ -616,8 +616,8 @@ CodeGeneratorShared::generateCompactNativeToBytecodeMap(JSContext *cx, JitCode * return false; } - JS_ASSERT(tableOffset > 0); - JS_ASSERT(numRegions > 0); + MOZ_ASSERT(tableOffset > 0); + MOZ_ASSERT(numRegions > 0); // Writer is done, copy it to sized buffer. uint8_t *data = cx->runtime()->pod_malloc(writer.length()); @@ -642,31 +642,31 @@ void CodeGeneratorShared::verifyCompactNativeToBytecodeMap(JitCode *code) { #ifdef DEBUG - JS_ASSERT(nativeToBytecodeScriptListLength_ > 0); - JS_ASSERT(nativeToBytecodeScriptList_ != nullptr); - JS_ASSERT(nativeToBytecodeMap_ != nullptr); - JS_ASSERT(nativeToBytecodeMapSize_ > 0); - JS_ASSERT(nativeToBytecodeTableOffset_ > 0); - JS_ASSERT(nativeToBytecodeNumRegions_ > 0); + MOZ_ASSERT(nativeToBytecodeScriptListLength_ > 0); + MOZ_ASSERT(nativeToBytecodeScriptList_ != nullptr); + MOZ_ASSERT(nativeToBytecodeMap_ != nullptr); + MOZ_ASSERT(nativeToBytecodeMapSize_ > 0); + MOZ_ASSERT(nativeToBytecodeTableOffset_ > 0); + MOZ_ASSERT(nativeToBytecodeNumRegions_ > 0); // The pointer to the table must be 4-byte aligned const uint8_t *tablePtr = nativeToBytecodeMap_ + nativeToBytecodeTableOffset_; - JS_ASSERT(uintptr_t(tablePtr) % sizeof(uint32_t) == 0); + MOZ_ASSERT(uintptr_t(tablePtr) % sizeof(uint32_t) == 0); // Verify that numRegions was encoded correctly. const JitcodeIonTable *ionTable = reinterpret_cast(tablePtr); - JS_ASSERT(ionTable->numRegions() == nativeToBytecodeNumRegions_); + MOZ_ASSERT(ionTable->numRegions() == nativeToBytecodeNumRegions_); // Region offset for first region should be at the start of the payload region. // Since the offsets are backward from the start of the table, the first entry // backoffset should be equal to the forward table offset from the start of the // allocated data. - JS_ASSERT(ionTable->regionOffset(0) == nativeToBytecodeTableOffset_); + MOZ_ASSERT(ionTable->regionOffset(0) == nativeToBytecodeTableOffset_); // Verify each region. for (uint32_t i = 0; i < ionTable->numRegions(); i++) { // Back-offset must point into the payload region preceding the table, not before it. - JS_ASSERT(ionTable->regionOffset(i) <= nativeToBytecodeTableOffset_); + MOZ_ASSERT(ionTable->regionOffset(i) <= nativeToBytecodeTableOffset_); // Back-offset must point to a later area in the payload region than previous // back-offset. This means that back-offsets decrease monotonically. @@ -675,7 +675,7 @@ CodeGeneratorShared::verifyCompactNativeToBytecodeMap(JitCode *code) JitcodeRegionEntry entry = ionTable->regionEntry(i); // Ensure native code offset for region falls within jitcode. - JS_ASSERT(entry.nativeOffset() <= code->instructionsSize()); + MOZ_ASSERT(entry.nativeOffset() <= code->instructionsSize()); // Read out script/pc stack and verify. JitcodeRegionEntry::ScriptPcIterator scriptPcIter = entry.scriptPcIterator(); @@ -684,11 +684,11 @@ CodeGeneratorShared::verifyCompactNativeToBytecodeMap(JitCode *code) scriptPcIter.readNext(&scriptIdx, &pcOffset); // Ensure scriptIdx refers to a valid script in the list. - JS_ASSERT(scriptIdx < nativeToBytecodeScriptListLength_); + MOZ_ASSERT(scriptIdx < nativeToBytecodeScriptListLength_); JSScript *script = nativeToBytecodeScriptList_[scriptIdx]; // Ensure pcOffset falls within the script. - JS_ASSERT(pcOffset < script->length()); + MOZ_ASSERT(pcOffset < script->length()); } // Obtain the original nativeOffset and pcOffset and script. @@ -713,10 +713,10 @@ CodeGeneratorShared::verifyCompactNativeToBytecodeMap(JitCode *code) curPcOffset = uint32_t(int32_t(curPcOffset) + pcDelta); // Ensure that nativeOffset still falls within jitcode after delta. - JS_ASSERT(curNativeOffset <= code->instructionsSize()); + MOZ_ASSERT(curNativeOffset <= code->instructionsSize()); // Ensure that pcOffset still falls within bytecode after delta. - JS_ASSERT(curPcOffset < script->length()); + MOZ_ASSERT(curPcOffset < script->length()); } } #endif // DEBUG @@ -760,7 +760,7 @@ CodeGeneratorShared::ensureOsiSpace() for (int32_t i = 0; i < paddingSize; ++i) masm.nop(); } - JS_ASSERT(masm.currentOffset() - lastOsiPointOffset_ >= Assembler::PatchWrite_NearCallSize()); + MOZ_ASSERT(masm.currentOffset() - lastOsiPointOffset_ >= Assembler::PatchWrite_NearCallSize()); lastOsiPointOffset_ = masm.currentOffset(); } @@ -992,7 +992,7 @@ bool CodeGeneratorShared::callVM(const VMFunction &fun, LInstruction *ins, const Register *dynStack) { // Different execution modes have different sets of VM functions. - JS_ASSERT(fun.executionMode == gen->info().executionMode()); + MOZ_ASSERT(fun.executionMode == gen->info().executionMode()); // If we're calling a function with an out parameter type of double, make // sure we have an FPU. @@ -1000,7 +1000,7 @@ CodeGeneratorShared::callVM(const VMFunction &fun, LInstruction *ins, const Regi #ifdef DEBUG if (ins->mirRaw()) { - JS_ASSERT(ins->mirRaw()->isInstruction()); + MOZ_ASSERT(ins->mirRaw()->isInstruction()); MInstruction *mir = ins->mirRaw()->toInstruction(); JS_ASSERT_IF(mir->needsResumePoint(), mir->resumePoint()); } @@ -1015,7 +1015,7 @@ CodeGeneratorShared::callVM(const VMFunction &fun, LInstruction *ins, const Regi // ... frame ... // [args] #ifdef DEBUG - JS_ASSERT(pushedArgs_ == fun.explicitArgs); + MOZ_ASSERT(pushedArgs_ == fun.explicitArgs); pushedArgs_ = 0; #endif @@ -1174,7 +1174,7 @@ CodeGeneratorShared::emitAsmJSCall(LAsmJSCall *ins) if (mir->spIncrement()) masm.freeStack(mir->spIncrement()); - JS_ASSERT((sizeof(AsmJSFrame) + masm.framePushed()) % AsmJSStackAlignment == 0); + MOZ_ASSERT((sizeof(AsmJSFrame) + masm.framePushed()) % AsmJSStackAlignment == 0); #ifdef DEBUG static_assert(AsmJSStackAlignment >= ABIStackAlignment && @@ -1254,7 +1254,7 @@ CodeGeneratorShared::labelForBackedgeWithImplicitCheck(MBasicBlock *mir) } else { // The interrupt check should be the first instruction in the // loop header other than the initial label and move groups. - JS_ASSERT(iter->isInterruptCheck() || iter->isInterruptCheckPar()); + MOZ_ASSERT(iter->isInterruptCheck() || iter->isInterruptCheckPar()); return nullptr; } } @@ -1320,7 +1320,7 @@ CodeGeneratorShared::addCacheLocations(const CacheLocationList &locs, size_t *nu new (&runtimeData_[curIndex]) CacheLocation(iter->pc, iter->script); numLocations++; } - JS_ASSERT(numLocations != 0); + MOZ_ASSERT(numLocations != 0); *numLocs = numLocations; return firstIndex; } @@ -1328,7 +1328,7 @@ CodeGeneratorShared::addCacheLocations(const CacheLocationList &locs, size_t *nu ReciprocalMulConstants CodeGeneratorShared::computeDivisionConstants(int d) { // In what follows, d is positive and is not a power of 2. - JS_ASSERT(d > 0 && (d & (d - 1)) != 0); + MOZ_ASSERT(d > 0 && (d & (d - 1)) != 0); // Speeding up division by non power-of-2 constants is possible by // calculating, during compilation, a value M such that high-order diff --git a/js/src/jit/shared/CodeGenerator-shared.h b/js/src/jit/shared/CodeGenerator-shared.h index 97924672fa88..36be89e98c8c 100644 --- a/js/src/jit/shared/CodeGenerator-shared.h +++ b/js/src/jit/shared/CodeGenerator-shared.h @@ -133,7 +133,7 @@ class CodeGeneratorShared : public LInstructionVisitor } inline void setOsrEntryOffset(size_t offset) { - JS_ASSERT(osrEntryOffset_ == 0); + MOZ_ASSERT(osrEntryOffset_ == 0); osrEntryOffset_ = offset; } inline size_t getOsrEntryOffset() const { @@ -145,7 +145,7 @@ class CodeGeneratorShared : public LInstructionVisitor size_t skipArgCheckEntryOffset_; inline void setSkipArgCheckEntryOffset(size_t offset) { - JS_ASSERT(skipArgCheckEntryOffset_ == 0); + MOZ_ASSERT(skipArgCheckEntryOffset_ == 0); skipArgCheckEntryOffset_ = offset; } inline size_t getSkipArgCheckEntryOffset() const { @@ -191,9 +191,9 @@ class CodeGeneratorShared : public LInstructionVisitor } inline int32_t SlotToStackOffset(int32_t slot) const { - JS_ASSERT(slot > 0 && slot <= int32_t(graph.localSlotCount())); + MOZ_ASSERT(slot > 0 && slot <= int32_t(graph.localSlotCount())); int32_t offset = masm.framePushed() - frameInitialAdjustment_ - slot; - JS_ASSERT(offset >= 0); + MOZ_ASSERT(offset >= 0); return offset; } inline int32_t StackOffsetToSlot(int32_t offset) const { @@ -209,7 +209,7 @@ class CodeGeneratorShared : public LInstructionVisitor // For argument construction for calls. Argslots are Value-sized. inline int32_t StackOffsetOfPassedArg(int32_t slot) const { // A slot of 0 is permitted only to calculate %esp offset for calls. - JS_ASSERT(slot >= 0 && slot <= int32_t(graph.argumentSlotCount())); + MOZ_ASSERT(slot >= 0 && slot <= int32_t(graph.argumentSlotCount())); int32_t offset = masm.framePushed() - graph.paddedLocalSlotsSize() - (slot * sizeof(Value)); @@ -220,8 +220,8 @@ class CodeGeneratorShared : public LInstructionVisitor // by sizeof(Value) is desirable since everything on the stack is a Value. // Note that paddedLocalSlotCount() aligns to at least a Value boundary // specifically to support this. - JS_ASSERT(offset >= 0); - JS_ASSERT(offset % sizeof(Value) == 0); + MOZ_ASSERT(offset >= 0); + MOZ_ASSERT(offset % sizeof(Value) == 0); return offset; } @@ -288,7 +288,7 @@ class CodeGeneratorShared : public LInstructionVisitor protected: size_t allocateData(size_t size) { - JS_ASSERT(size % sizeof(void *) == 0); + MOZ_ASSERT(size % sizeof(void *) == 0); size_t dataOffset = runtimeData_.length(); masm.propagateOOM(runtimeData_.appendN(0, size)); return dataOffset; @@ -300,7 +300,7 @@ class CodeGeneratorShared : public LInstructionVisitor if (masm.oom()) return SIZE_MAX; // Use the copy constructor on the allocated space. - JS_ASSERT(index == cacheList_.back()); + MOZ_ASSERT(index == cacheList_.back()); new (&runtimeData_[index]) T(cache); return index; } @@ -358,7 +358,7 @@ class CodeGeneratorShared : public LInstructionVisitor // actually branch directly to. MBasicBlock *skipTrivialBlocks(MBasicBlock *block) { while (block->lir()->isTrivial()) { - JS_ASSERT(block->lir()->rbegin()->numSuccessors() == 1); + MOZ_ASSERT(block->lir()->rbegin()->numSuccessors() == 1); block = block->lir()->rbegin()->getSuccessor(0); } return block; @@ -767,8 +767,8 @@ inline OutOfLineCode * CodeGeneratorShared::oolCallVM(const VMFunction &fun, LInstruction *lir, const ArgSeq &args, const StoreOutputTo &out) { - JS_ASSERT(lir->mirRaw()); - JS_ASSERT(lir->mirRaw()->isInstruction()); + MOZ_ASSERT(lir->mirRaw()); + MOZ_ASSERT(lir->mirRaw()->isInstruction()); OutOfLineCode *ool = new(alloc()) OutOfLineCallVM(lir, fun, args, out); if (!addOutOfLineCode(ool, lir->mirRaw()->toInstruction())) diff --git a/js/src/jit/shared/CodeGenerator-x86-shared.cpp b/js/src/jit/shared/CodeGenerator-x86-shared.cpp index 483ca47d5690..48b1ee927130 100644 --- a/js/src/jit/shared/CodeGenerator-x86-shared.cpp +++ b/js/src/jit/shared/CodeGenerator-x86-shared.cpp @@ -41,7 +41,7 @@ CodeGeneratorX86Shared::CodeGeneratorX86Shared(MIRGenerator *gen, LIRGraph *grap bool CodeGeneratorX86Shared::generatePrologue() { - JS_ASSERT(!gen->compilingAsmJS()); + MOZ_ASSERT(!gen->compilingAsmJS()); // Note that this automatically sets MacroAssembler::framePushed(). masm.reserveStack(frameSize()); @@ -52,7 +52,7 @@ CodeGeneratorX86Shared::generatePrologue() bool CodeGeneratorX86Shared::generateEpilogue() { - JS_ASSERT(!gen->compilingAsmJS()); + MOZ_ASSERT(!gen->compilingAsmJS()); masm.bind(&returnLabel_); @@ -67,7 +67,7 @@ CodeGeneratorX86Shared::generateEpilogue() // Pop the stack we allocated at the start of the function. masm.freeStack(frameSize()); - JS_ASSERT(masm.framePushed() == 0); + MOZ_ASSERT(masm.framePushed() == 0); masm.ret(); return true; @@ -457,14 +457,14 @@ CodeGeneratorX86Shared::bailoutIf(Assembler::Condition condition, LSnapshot *sna bool CodeGeneratorX86Shared::bailoutIf(Assembler::DoubleCondition condition, LSnapshot *snapshot) { - JS_ASSERT(Assembler::NaNCondFromDoubleCondition(condition) == Assembler::NaN_HandledByCond); + MOZ_ASSERT(Assembler::NaNCondFromDoubleCondition(condition) == Assembler::NaN_HandledByCond); return bailoutIf(Assembler::ConditionFromDoubleCondition(condition), snapshot); } bool CodeGeneratorX86Shared::bailoutFrom(Label *label, LSnapshot *snapshot) { - JS_ASSERT(label->used() && !label->bound()); + MOZ_ASSERT(label->used() && !label->bound()); return bailout(BailoutLabel(label), snapshot); } @@ -491,7 +491,7 @@ CodeGeneratorX86Shared::visitMinMaxD(LMinMaxD *ins) FloatRegister second = ToFloatRegister(ins->second()); #ifdef DEBUG FloatRegister output = ToFloatRegister(ins->output()); - JS_ASSERT(first == output); + MOZ_ASSERT(first == output); #endif Label done, nan, minMaxInst; @@ -543,7 +543,7 @@ CodeGeneratorX86Shared::visitMinMaxF(LMinMaxF *ins) FloatRegister second = ToFloatRegister(ins->second()); #ifdef DEBUG FloatRegister output = ToFloatRegister(ins->output()); - JS_ASSERT(first == output); + MOZ_ASSERT(first == output); #endif Label done, nan, minMaxInst; @@ -592,7 +592,7 @@ bool CodeGeneratorX86Shared::visitAbsD(LAbsD *ins) { FloatRegister input = ToFloatRegister(ins->input()); - JS_ASSERT(input == ToFloatRegister(ins->output())); + MOZ_ASSERT(input == ToFloatRegister(ins->output())); // Load a value which is all ones except for the sign bit. masm.loadConstantDouble(SpecificNaN(0, FloatingPoint::kSignificandBits), ScratchDoubleReg); @@ -604,7 +604,7 @@ bool CodeGeneratorX86Shared::visitAbsF(LAbsF *ins) { FloatRegister input = ToFloatRegister(ins->input()); - JS_ASSERT(input == ToFloatRegister(ins->output())); + MOZ_ASSERT(input == ToFloatRegister(ins->output())); // Same trick as visitAbsD above. masm.loadConstantFloat32(SpecificNaN(0, FloatingPoint::kSignificandBits), ScratchFloat32Reg); @@ -656,7 +656,7 @@ bool CodeGeneratorX86Shared::visitPowHalfD(LPowHalfD *ins) { FloatRegister input = ToFloatRegister(ins->input()); - JS_ASSERT(input == ToFloatRegister(ins->output())); + MOZ_ASSERT(input == ToFloatRegister(ins->output())); Label done, sqrt; @@ -759,7 +759,7 @@ CodeGeneratorX86Shared::visitOutOfLineUndoALUOperation(OutOfLineUndoALUOperation mozilla::DebugOnly lhs = ins->getOperand(0); LAllocation *rhs = ins->getOperand(1); - JS_ASSERT(reg == ToRegister(lhs)); + MOZ_ASSERT(reg == ToRegister(lhs)); JS_ASSERT_IF(rhs->isGeneralReg(), reg != ToRegister(rhs)); // Undo the effect of the ALU operation, which was performed on the output @@ -902,7 +902,7 @@ CodeGeneratorX86Shared::visitUDivOrMod(LUDivOrMod *ins) Register output = ToRegister(ins->output()); JS_ASSERT_IF(lhs != rhs, rhs != eax); - JS_ASSERT(rhs != edx); + MOZ_ASSERT(rhs != edx); JS_ASSERT_IF(output == eax, ToRegister(ins->remainder()) == edx); ReturnZero *ool = nullptr; @@ -985,7 +985,7 @@ CodeGeneratorX86Shared::visitDivPowTwoI(LDivPowTwoI *ins) // We use defineReuseInput so these should always be the same, which is // convenient since all of our instructions here are two-address. - JS_ASSERT(lhs == output); + MOZ_ASSERT(lhs == output); if (!mir->isTruncated() && negativeDivisor) { // 0 divided by a negative number must return a double. @@ -1007,7 +1007,7 @@ CodeGeneratorX86Shared::visitDivPowTwoI(LDivPowTwoI *ins) // Power of 2" in Henry S. Warren, Jr.'s Hacker's Delight. if (mir->canBeNegativeDividend()) { Register lhsCopy = ToRegister(ins->numeratorCopy()); - JS_ASSERT(lhsCopy != lhs); + MOZ_ASSERT(lhsCopy != lhs); if (shift > 1) masm.sarl(Imm32(31), lhs); masm.shrl(Imm32(32 - shift), lhs); @@ -1034,13 +1034,13 @@ CodeGeneratorX86Shared::visitDivOrModConstantI(LDivOrModConstantI *ins) { int32_t d = ins->denominator(); // This emits the division answer into edx or the modulus answer into eax. - JS_ASSERT(output == eax || output == edx); - JS_ASSERT(lhs != eax && lhs != edx); + MOZ_ASSERT(output == eax || output == edx); + MOZ_ASSERT(lhs != eax && lhs != edx); bool isDiv = (output == edx); // The absolute value of the denominator isn't a power of 2 (see LDivPowTwoI // and LModPowTwoI). - JS_ASSERT((Abs(d) & (Abs(d) - 1)) != 0); + MOZ_ASSERT((Abs(d) & (Abs(d) - 1)) != 0); // We will first divide by Abs(d), and negate the answer if d is negative. // If desired, this can be avoided by generalizing computeDivisionConstants. @@ -1120,9 +1120,9 @@ CodeGeneratorX86Shared::visitDivI(LDivI *ins) MDiv *mir = ins->mir(); JS_ASSERT_IF(lhs != rhs, rhs != eax); - JS_ASSERT(rhs != edx); - JS_ASSERT(remainder == edx); - JS_ASSERT(output == eax); + MOZ_ASSERT(rhs != edx); + MOZ_ASSERT(remainder == edx); + MOZ_ASSERT(output == eax); Label done; ReturnZero *ool = nullptr; @@ -1141,7 +1141,7 @@ CodeGeneratorX86Shared::visitDivI(LDivI *ins) ool = new(alloc()) ReturnZero(output); masm.j(Assembler::Zero, ool->entry()); } else { - JS_ASSERT(mir->fallible()); + MOZ_ASSERT(mir->fallible()); if (!bailoutIf(Assembler::Zero, ins->snapshot())) return false; } @@ -1158,7 +1158,7 @@ CodeGeneratorX86Shared::visitDivI(LDivI *ins) // output register (lhs == eax). masm.j(Assembler::Equal, &done); } else { - JS_ASSERT(mir->fallible()); + MOZ_ASSERT(mir->fallible()); if (!bailoutIf(Assembler::Equal, ins->snapshot())) return false; } @@ -1293,9 +1293,9 @@ CodeGeneratorX86Shared::visitModI(LModI *ins) // Required to use idiv. JS_ASSERT_IF(lhs != rhs, rhs != eax); - JS_ASSERT(rhs != edx); - JS_ASSERT(remainder == edx); - JS_ASSERT(ToRegister(ins->getTemp(0)) == eax); + MOZ_ASSERT(rhs != edx); + MOZ_ASSERT(remainder == edx); + MOZ_ASSERT(ToRegister(ins->getTemp(0)) == eax); Label done; ReturnZero *ool = nullptr; @@ -1328,7 +1328,7 @@ CodeGeneratorX86Shared::visitModI(LModI *ins) { // Check if rhs is a power-of-two. if (ins->mir()->canBePowerOfTwoDivisor()) { - JS_ASSERT(rhs != remainder); + MOZ_ASSERT(rhs != remainder); // Rhs y is a power-of-two if (y & (y-1)) == 0. Note that if // y is any negative number other than INT32_MIN, both y and @@ -1396,7 +1396,7 @@ bool CodeGeneratorX86Shared::visitBitNotI(LBitNotI *ins) { const LAllocation *input = ins->getOperand(0); - JS_ASSERT(!input->isConstant()); + MOZ_ASSERT(!input->isConstant()); masm.notl(ToOperand(input)); return true; @@ -1465,7 +1465,7 @@ CodeGeneratorX86Shared::visitShiftI(LShiftI *ins) MOZ_CRASH("Unexpected shift op"); } } else { - JS_ASSERT(ToRegister(rhs) == ecx); + MOZ_ASSERT(ToRegister(rhs) == ecx); switch (ins->bitop()) { case JSOP_LSH: masm.shll_cl(lhs); @@ -1494,7 +1494,7 @@ bool CodeGeneratorX86Shared::visitUrshD(LUrshD *ins) { Register lhs = ToRegister(ins->lhs()); - JS_ASSERT(ToRegister(ins->temp()) == lhs); + MOZ_ASSERT(ToRegister(ins->temp()) == lhs); const LAllocation *rhs = ins->rhs(); FloatRegister out = ToFloatRegister(ins->output()); @@ -1504,7 +1504,7 @@ CodeGeneratorX86Shared::visitUrshD(LUrshD *ins) if (shift) masm.shrl(Imm32(shift), lhs); } else { - JS_ASSERT(ToRegister(rhs) == ecx); + MOZ_ASSERT(ToRegister(rhs) == ecx); masm.shrl_cl(lhs); } @@ -1609,7 +1609,7 @@ CodeGeneratorX86Shared::visitMathD(LMathD *math) FloatRegister lhs = ToFloatRegister(math->lhs()); Operand rhs = ToOperand(math->rhs()); - JS_ASSERT(ToFloatRegister(math->output()) == lhs); + MOZ_ASSERT(ToFloatRegister(math->output()) == lhs); switch (math->jsop()) { case JSOP_ADD: @@ -1636,7 +1636,7 @@ CodeGeneratorX86Shared::visitMathF(LMathF *math) FloatRegister lhs = ToFloatRegister(math->lhs()); Operand rhs = ToOperand(math->rhs()); - JS_ASSERT(ToFloatRegister(math->output()) == lhs); + MOZ_ASSERT(ToFloatRegister(math->output()) == lhs); switch (math->jsop()) { case JSOP_ADD: @@ -2128,7 +2128,7 @@ bool CodeGeneratorX86Shared::visitNegI(LNegI *ins) { Register input = ToRegister(ins->input()); - JS_ASSERT(input == ToRegister(ins->output())); + MOZ_ASSERT(input == ToRegister(ins->output())); masm.neg32(input); return true; @@ -2138,7 +2138,7 @@ bool CodeGeneratorX86Shared::visitNegD(LNegD *ins) { FloatRegister input = ToFloatRegister(ins->input()); - JS_ASSERT(input == ToFloatRegister(ins->output())); + MOZ_ASSERT(input == ToFloatRegister(ins->output())); masm.negateDouble(input); return true; @@ -2148,7 +2148,7 @@ bool CodeGeneratorX86Shared::visitNegF(LNegF *ins) { FloatRegister input = ToFloatRegister(ins->input()); - JS_ASSERT(input == ToFloatRegister(ins->output())); + MOZ_ASSERT(input == ToFloatRegister(ins->output())); masm.negateFloat(input); return true; @@ -2442,7 +2442,7 @@ CodeGeneratorX86Shared::visitSimdBinaryArithIx4(LSimdBinaryArithIx4 *ins) { FloatRegister lhs = ToFloatRegister(ins->lhs()); Operand rhs = ToOperand(ins->rhs()); - JS_ASSERT(ToFloatRegister(ins->output()) == lhs); + MOZ_ASSERT(ToFloatRegister(ins->output()) == lhs); MSimdBinaryArith::Operation op = ins->operation(); switch (op) { @@ -2475,7 +2475,7 @@ CodeGeneratorX86Shared::visitSimdBinaryArithFx4(LSimdBinaryArithFx4 *ins) { FloatRegister lhs = ToFloatRegister(ins->lhs()); Operand rhs = ToOperand(ins->rhs()); - JS_ASSERT(ToFloatRegister(ins->output()) == lhs); + MOZ_ASSERT(ToFloatRegister(ins->output()) == lhs); MSimdBinaryArith::Operation op = ins->operation(); switch (op) { diff --git a/js/src/jit/shared/LIR-x86-shared.h b/js/src/jit/shared/LIR-x86-shared.h index ff6b8146007d..b51873e4842b 100644 --- a/js/src/jit/shared/LIR-x86-shared.h +++ b/js/src/jit/shared/LIR-x86-shared.h @@ -97,7 +97,7 @@ class LDivOrModConstantI : public LInstructionHelper<1, 1, 1> return denominator_; } MBinaryArithInstruction *mir() const { - JS_ASSERT(mir_->isDiv() || mir_->isMod()); + MOZ_ASSERT(mir_->isDiv() || mir_->isMod()); return static_cast(mir_); } bool canBeNegativeDividend() const { @@ -152,7 +152,7 @@ class LUDivOrMod : public LBinaryMath<1> } MBinaryArithInstruction *mir() const { - JS_ASSERT(mir_->isDiv() || mir_->isMod()); + MOZ_ASSERT(mir_->isDiv() || mir_->isMod()); return static_cast(mir_); } diff --git a/js/src/jit/shared/Lowering-shared-inl.h b/js/src/jit/shared/Lowering-shared-inl.h index b18d2a692664..061e629e2b4a 100644 --- a/js/src/jit/shared/Lowering-shared-inl.h +++ b/js/src/jit/shared/Lowering-shared-inl.h @@ -18,7 +18,7 @@ namespace jit { bool LIRGeneratorShared::emitAtUses(MInstruction *mir) { - JS_ASSERT(mir->canEmitAtUses()); + MOZ_ASSERT(mir->canEmitAtUses()); mir->setEmittedAtUses(); mir->setVirtualRegister(0); return true; @@ -29,7 +29,7 @@ LIRGeneratorShared::use(MDefinition *mir, LUse policy) { // It is illegal to call use() on an instruction with two defs. #if BOX_PIECES > 1 - JS_ASSERT(mir->type() != MIRType_Value); + MOZ_ASSERT(mir->type() != MIRType_Value); #endif if (!ensureDefined(mir)) return policy; @@ -41,7 +41,7 @@ template bool LIRGeneratorShared::define(LInstructionHelper<1, X, Y> *lir, MDefinition *mir, const LDefinition &def) { // Call instructions should use defineReturn. - JS_ASSERT(!lir->isCall()); + MOZ_ASSERT(!lir->isCall()); uint32_t vreg = getVirtualRegister(); if (vreg >= MAX_VIRTUAL_REGISTERS) @@ -88,7 +88,7 @@ template bool LIRGeneratorShared::defineReuseInput(LInstructionHelper<1, Ops, Temps> *lir, MDefinition *mir, uint32_t operand) { // The input should be used at the start of the instruction, to avoid moves. - JS_ASSERT(lir->getOperand(operand)->toUse()->usedAtStart()); + MOZ_ASSERT(lir->getOperand(operand)->toUse()->usedAtStart()); LDefinition::Type type = LDefinition::TypeFrom(mir->type()); @@ -103,7 +103,7 @@ LIRGeneratorShared::defineBox(LInstructionHelper *lir, M LDefinition::Policy policy) { // Call instructions should use defineReturn. - JS_ASSERT(!lir->isCall()); + MOZ_ASSERT(!lir->isCall()); uint32_t vreg = getVirtualRegister(); if (vreg >= MAX_VIRTUAL_REGISTERS) @@ -128,7 +128,7 @@ LIRGeneratorShared::defineReturn(LInstruction *lir, MDefinition *mir) { lir->setMir(mir); - JS_ASSERT(lir->isCall()); + MOZ_ASSERT(lir->isCall()); uint32_t vreg = getVirtualRegister(); if (vreg >= MAX_VIRTUAL_REGISTERS) @@ -162,7 +162,7 @@ LIRGeneratorShared::defineReturn(LInstruction *lir, MDefinition *mir) break; default: LDefinition::Type type = LDefinition::TypeFrom(mir->type()); - JS_ASSERT(type != LDefinition::DOUBLE && type != LDefinition::FLOAT32); + MOZ_ASSERT(type != LDefinition::DOUBLE && type != LDefinition::FLOAT32); lir->setDef(0, LDefinition(vreg, type, LGeneralReg(ReturnReg))); break; } @@ -201,7 +201,7 @@ IsCompatibleLIRCoercion(MIRType to, MIRType from) bool LIRGeneratorShared::redefine(MDefinition *def, MDefinition *as) { - JS_ASSERT(IsCompatibleLIRCoercion(def->type(), as->type())); + MOZ_ASSERT(IsCompatibleLIRCoercion(def->type(), as->type())); // Try to emit MIR marked as emitted-at-uses at, well, uses. For // snapshotting reasons we delay the MIRTypes match, or when we are @@ -240,7 +240,7 @@ LIRGeneratorShared::ensureDefined(MDefinition *mir) if (mir->isEmittedAtUses()) { if (!mir->toInstruction()->accept(this)) return false; - JS_ASSERT(mir->isLowered()); + MOZ_ASSERT(mir->isLowered()); } return true; } @@ -430,7 +430,7 @@ LIRGeneratorShared::tempDouble() LDefinition LIRGeneratorShared::tempCopy(MDefinition *input, uint32_t reusedInput) { - JS_ASSERT(input->virtualRegister()); + MOZ_ASSERT(input->virtualRegister()); LDefinition t = temp(LDefinition::TypeFrom(input->type()), LDefinition::MUST_REUSE_INPUT); t.setReusedInput(reusedInput); return t; @@ -445,10 +445,10 @@ LIRGeneratorShared::annotate(T *ins) template bool LIRGeneratorShared::add(T *ins, MInstruction *mir) { - JS_ASSERT(!ins->isPhi()); + MOZ_ASSERT(!ins->isPhi()); current->add(ins); if (mir) { - JS_ASSERT(current == mir->block()->lir()); + MOZ_ASSERT(current == mir->block()->lir()); ins->setMir(mir); } annotate(ins); @@ -478,7 +478,7 @@ VirtualRegisterOfPayload(MDefinition *mir) LUse LIRGeneratorShared::useType(MDefinition *mir, LUse::Policy policy) { - JS_ASSERT(mir->type() == MIRType_Value); + MOZ_ASSERT(mir->type() == MIRType_Value); return LUse(mir->virtualRegister() + VREG_TYPE_OFFSET, policy); } @@ -486,7 +486,7 @@ LIRGeneratorShared::useType(MDefinition *mir, LUse::Policy policy) LUse LIRGeneratorShared::usePayload(MDefinition *mir, LUse::Policy policy) { - JS_ASSERT(mir->type() == MIRType_Value); + MOZ_ASSERT(mir->type() == MIRType_Value); return LUse(VirtualRegisterOfPayload(mir), policy); } @@ -494,7 +494,7 @@ LIRGeneratorShared::usePayload(MDefinition *mir, LUse::Policy policy) LUse LIRGeneratorShared::usePayloadAtStart(MDefinition *mir, LUse::Policy policy) { - JS_ASSERT(mir->type() == MIRType_Value); + MOZ_ASSERT(mir->type() == MIRType_Value); return LUse(VirtualRegisterOfPayload(mir), policy, true); } diff --git a/js/src/jit/shared/Lowering-shared.cpp b/js/src/jit/shared/Lowering-shared.cpp index 3cbc05eb1d34..c5bc00e92b21 100644 --- a/js/src/jit/shared/Lowering-shared.cpp +++ b/js/src/jit/shared/Lowering-shared.cpp @@ -32,7 +32,7 @@ LIRGeneratorShared::visitConstant(MConstant *ins) default: // Constants of special types (undefined, null) should never flow into // here directly. Operations blindly consuming them require a Box. - JS_ASSERT(!"unexpected constant type"); + MOZ_ASSERT(!"unexpected constant type"); return false; } } @@ -203,7 +203,7 @@ LIRGeneratorShared::assignSnapshot(LInstruction *ins, BailoutKind kind) { // assignSnapshot must be called before define/add, since // it may add new instructions for emitted-at-use operands. - JS_ASSERT(ins->id() == 0); + MOZ_ASSERT(ins->id() == 0); LSnapshot *snapshot = buildSnapshot(ins, lastResumePoint_, kind); if (!snapshot) @@ -216,8 +216,8 @@ LIRGeneratorShared::assignSnapshot(LInstruction *ins, BailoutKind kind) bool LIRGeneratorShared::assignSafepoint(LInstruction *ins, MInstruction *mir, BailoutKind kind) { - JS_ASSERT(!osiPoint_); - JS_ASSERT(!ins->safepoint()); + MOZ_ASSERT(!osiPoint_); + MOZ_ASSERT(!ins->safepoint()); ins->initSafepoint(alloc()); diff --git a/js/src/jit/shared/Lowering-x86-shared.cpp b/js/src/jit/shared/Lowering-x86-shared.cpp index 2b9099b7d586..ef8b5e59c81d 100644 --- a/js/src/jit/shared/Lowering-x86-shared.cpp +++ b/js/src/jit/shared/Lowering-x86-shared.cpp @@ -34,7 +34,7 @@ LIRGeneratorX86Shared::newLTableSwitchV(MTableSwitch *tableswitch) bool LIRGeneratorX86Shared::visitGuardShape(MGuardShape *ins) { - JS_ASSERT(ins->obj()->type() == MIRType_Object); + MOZ_ASSERT(ins->obj()->type() == MIRType_Object); LGuardShape *guard = new(alloc()) LGuardShape(useRegisterAtStart(ins->obj())); if (!assignSnapshot(guard, ins->bailoutKind())) @@ -47,7 +47,7 @@ LIRGeneratorX86Shared::visitGuardShape(MGuardShape *ins) bool LIRGeneratorX86Shared::visitGuardObjectType(MGuardObjectType *ins) { - JS_ASSERT(ins->obj()->type() == MIRType_Object); + MOZ_ASSERT(ins->obj()->type() == MIRType_Object); LGuardObjectType *guard = new(alloc()) LGuardObjectType(useRegisterAtStart(ins->obj())); if (!assignSnapshot(guard, Bailout_ObjectIdentityOrTypeGuard)) @@ -61,7 +61,7 @@ bool LIRGeneratorX86Shared::visitPowHalf(MPowHalf *ins) { MDefinition *input = ins->input(); - JS_ASSERT(input->type() == MIRType_Double); + MOZ_ASSERT(input->type() == MIRType_Double); LPowHalfD *lir = new(alloc()) LPowHalfD(useRegisterAtStart(input)); return defineReuseInput(lir, ins, 0); } @@ -215,7 +215,7 @@ LIRGeneratorX86Shared::visitAsmJSNeg(MAsmJSNeg *ins) if (ins->type() == MIRType_Float32) return defineReuseInput(new(alloc()) LNegF(useRegisterAtStart(ins->input())), ins, 0); - JS_ASSERT(ins->type() == MIRType_Double); + MOZ_ASSERT(ins->type() == MIRType_Double); return defineReuseInput(new(alloc()) LNegD(useRegisterAtStart(ins->input())), ins, 0); } @@ -247,12 +247,12 @@ LIRGeneratorX86Shared::lowerUrshD(MUrsh *mir) MDefinition *lhs = mir->lhs(); MDefinition *rhs = mir->rhs(); - JS_ASSERT(lhs->type() == MIRType_Int32); - JS_ASSERT(rhs->type() == MIRType_Int32); - JS_ASSERT(mir->type() == MIRType_Double); + MOZ_ASSERT(lhs->type() == MIRType_Int32); + MOZ_ASSERT(rhs->type() == MIRType_Int32); + MOZ_ASSERT(mir->type() == MIRType_Double); #ifdef JS_CODEGEN_X64 - JS_ASSERT(ecx == rcx); + MOZ_ASSERT(ecx == rcx); #endif LUse lhsUse = useRegisterAtStart(lhs); @@ -294,7 +294,7 @@ bool LIRGeneratorX86Shared::lowerTruncateDToInt32(MTruncateToInt32 *ins) { MDefinition *opd = ins->input(); - JS_ASSERT(opd->type() == MIRType_Double); + MOZ_ASSERT(opd->type() == MIRType_Double); LDefinition maybeTemp = Assembler::HasSSE3() ? LDefinition::BogusTemp() : tempDouble(); return define(new(alloc()) LTruncateDToInt32(useRegister(opd), maybeTemp), ins); @@ -304,7 +304,7 @@ bool LIRGeneratorX86Shared::lowerTruncateFToInt32(MTruncateToInt32 *ins) { MDefinition *opd = ins->input(); - JS_ASSERT(opd->type() == MIRType_Float32); + MOZ_ASSERT(opd->type() == MIRType_Float32); LDefinition maybeTemp = Assembler::HasSSE3() ? LDefinition::BogusTemp() : tempFloat32(); return define(new(alloc()) LTruncateFToInt32(useRegister(opd), maybeTemp), ins); diff --git a/js/src/jit/shared/MacroAssembler-x86-shared.cpp b/js/src/jit/shared/MacroAssembler-x86-shared.cpp index c294b70b353c..debae6be6124 100644 --- a/js/src/jit/shared/MacroAssembler-x86-shared.cpp +++ b/js/src/jit/shared/MacroAssembler-x86-shared.cpp @@ -28,7 +28,7 @@ MacroAssembler::PushRegsInMask(RegisterSet set, FloatRegisterSet simdSet) diffG -= sizeof(intptr_t); Push(*iter); } - JS_ASSERT(diffG == 0); + MOZ_ASSERT(diffG == 0); reserveStack(diffF); for (FloatRegisterBackwardIterator iter(doubleSet); iter.more(); iter++) { @@ -36,15 +36,15 @@ MacroAssembler::PushRegsInMask(RegisterSet set, FloatRegisterSet simdSet) numDouble -= 1; storeDouble(*iter, Address(StackPointer, diffF)); } - JS_ASSERT(numDouble == 0); + MOZ_ASSERT(numDouble == 0); for (FloatRegisterBackwardIterator iter(simdSet); iter.more(); iter++) { diffF -= Simd128DataSize; numSimd -= 1; // XXX how to choose the right move type? storeUnalignedInt32x4(*iter, Address(StackPointer, diffF)); } - JS_ASSERT(numSimd == 0); - JS_ASSERT(diffF == 0); + MOZ_ASSERT(numSimd == 0); + MOZ_ASSERT(diffF == 0); } void @@ -66,7 +66,7 @@ MacroAssembler::PopRegsInMaskIgnore(RegisterSet set, RegisterSet ignore, FloatRe // XXX how to choose the right move type? loadUnalignedInt32x4(Address(StackPointer, diffF), *iter); } - JS_ASSERT(numSimd == 0); + MOZ_ASSERT(numSimd == 0); for (FloatRegisterBackwardIterator iter(doubleSet); iter.more(); iter++) { diffF -= sizeof(double); numDouble -= 1; @@ -74,8 +74,8 @@ MacroAssembler::PopRegsInMaskIgnore(RegisterSet set, RegisterSet ignore, FloatRe loadDouble(Address(StackPointer, diffF), *iter); } freeStack(reservedF); - JS_ASSERT(numDouble == 0); - JS_ASSERT(diffF == 0); + MOZ_ASSERT(numDouble == 0); + MOZ_ASSERT(diffF == 0); // On x86, use pop to pop the integer registers, if we're not going to // ignore any slots, as it's fast on modern hardware and it's a small @@ -93,14 +93,14 @@ MacroAssembler::PopRegsInMaskIgnore(RegisterSet set, RegisterSet ignore, FloatRe } freeStack(reservedG); } - JS_ASSERT(diffG == 0); + MOZ_ASSERT(diffG == 0); } // Note: this function clobbers the input register. void MacroAssembler::clampDoubleToUint8(FloatRegister input, Register output) { - JS_ASSERT(input != ScratchDoubleReg); + MOZ_ASSERT(input != ScratchDoubleReg); Label positive, done; // <= 0 or NaN --> 0 @@ -161,7 +161,7 @@ MacroAssemblerX86Shared::buildFakeExitFrame(Register scratch, uint32_t *offset) bind(cl.src()); *offset = currentOffset(); - JS_ASSERT(framePushed() == initialDepth + IonExitFrameLayout::Size()); + MOZ_ASSERT(framePushed() == initialDepth + IonExitFrameLayout::Size()); return addCodeLabel(cl); } diff --git a/js/src/jit/shared/MacroAssembler-x86-shared.h b/js/src/jit/shared/MacroAssembler-x86-shared.h index a1ba82bb0573..7ac03f1f3972 100644 --- a/js/src/jit/shared/MacroAssembler-x86-shared.h +++ b/js/src/jit/shared/MacroAssembler-x86-shared.h @@ -59,7 +59,7 @@ class MacroAssemblerX86Shared : public Assembler return; } - JS_ASSERT(!(cond & DoubleConditionBitSpecial)); + MOZ_ASSERT(!(cond & DoubleConditionBitSpecial)); j(ConditionFromDoubleCondition(cond), label); } @@ -86,7 +86,7 @@ class MacroAssemblerX86Shared : public Assembler return; } - JS_ASSERT(!(cond & DoubleConditionBitSpecial)); + MOZ_ASSERT(!(cond & DoubleConditionBitSpecial)); j(ConditionFromDoubleCondition(cond), label); } @@ -232,17 +232,17 @@ class MacroAssemblerX86Shared : public Assembler j(cond, label); } void branchTest32(Condition cond, Register lhs, Register rhs, Label *label) { - JS_ASSERT(cond == Zero || cond == NonZero || cond == Signed || cond == NotSigned); + MOZ_ASSERT(cond == Zero || cond == NonZero || cond == Signed || cond == NotSigned); testl(lhs, rhs); j(cond, label); } void branchTest32(Condition cond, Register lhs, Imm32 imm, Label *label) { - JS_ASSERT(cond == Zero || cond == NonZero || cond == Signed || cond == NotSigned); + MOZ_ASSERT(cond == Zero || cond == NonZero || cond == Signed || cond == NotSigned); testl(lhs, imm); j(cond, label); } void branchTest32(Condition cond, const Address &address, Imm32 imm, Label *label) { - JS_ASSERT(cond == Zero || cond == NonZero || cond == Signed || cond == NotSigned); + MOZ_ASSERT(cond == Zero || cond == NonZero || cond == Signed || cond == NotSigned); testl(Operand(address), imm); j(cond, label); } @@ -275,7 +275,7 @@ class MacroAssemblerX86Shared : public Assembler framePushed_ -= sizeof(double); } void implicitPop(uint32_t args) { - JS_ASSERT(args % sizeof(intptr_t) == 0); + MOZ_ASSERT(args % sizeof(intptr_t) == 0); framePushed_ -= args; } uint32_t framePushed() const { @@ -581,7 +581,7 @@ class MacroAssemblerX86Shared : public Assembler (uint32_t(z) << 4) | (uint32_t(y) << 2) | uint32_t(x); - JS_ASSERT(r < 256); + MOZ_ASSERT(r < 256); return r; } diff --git a/js/src/jit/shared/MoveEmitter-x86-shared.cpp b/js/src/jit/shared/MoveEmitter-x86-shared.cpp index 6df64b483811..35c7b57f7c1a 100644 --- a/js/src/jit/shared/MoveEmitter-x86-shared.cpp +++ b/js/src/jit/shared/MoveEmitter-x86-shared.cpp @@ -103,14 +103,14 @@ MoveEmitterX86::emit(const MoveResolver &moves) const MoveOperand &to = move.to(); if (move.isCycleEnd()) { - JS_ASSERT(inCycle_); + MOZ_ASSERT(inCycle_); completeCycle(to, move.type()); inCycle_ = false; continue; } if (move.isCycleBegin()) { - JS_ASSERT(!inCycle_); + MOZ_ASSERT(!inCycle_); // Characterize the cycle. bool allGeneralRegs = true, allFloatRegs = true; @@ -176,7 +176,7 @@ MoveEmitterX86::toAddress(const MoveOperand &operand) const if (operand.base() != StackPointer) return Address(operand.base(), operand.disp()); - JS_ASSERT(operand.disp() >= 0); + MOZ_ASSERT(operand.disp() >= 0); // Otherwise, the stack offset may need to be adjusted. return Address(StackPointer, operand.disp() + (masm.framePushed() - pushedAtStart_)); @@ -193,7 +193,7 @@ MoveEmitterX86::toOperand(const MoveOperand &operand) const if (operand.isGeneralReg()) return Operand(operand.reg()); - JS_ASSERT(operand.isFloatReg()); + MOZ_ASSERT(operand.isFloatReg()); return Operand(operand.floatReg()); } @@ -206,7 +206,7 @@ MoveEmitterX86::toPopOperand(const MoveOperand &operand) const if (operand.base() != StackPointer) return Operand(operand.base(), operand.disp()); - JS_ASSERT(operand.disp() >= 0); + MOZ_ASSERT(operand.disp() >= 0); // Otherwise, the stack offset may need to be adjusted. // Note the adjustment by the stack slot here, to offset for the fact that pop @@ -217,7 +217,7 @@ MoveEmitterX86::toPopOperand(const MoveOperand &operand) const if (operand.isGeneralReg()) return Operand(operand.reg()); - JS_ASSERT(operand.isFloatReg()); + MOZ_ASSERT(operand.isFloatReg()); return Operand(operand.floatReg()); } @@ -293,8 +293,8 @@ MoveEmitterX86::completeCycle(const MoveOperand &to, MoveOp::Type type) // saved value of B, to A. switch (type) { case MoveOp::INT32X4: - JS_ASSERT(pushedAtCycle_ != -1); - JS_ASSERT(pushedAtCycle_ - pushedAtStart_ >= Simd128DataSize); + MOZ_ASSERT(pushedAtCycle_ != -1); + MOZ_ASSERT(pushedAtCycle_ - pushedAtStart_ >= Simd128DataSize); if (to.isMemory()) { masm.loadAlignedInt32x4(cycleSlot(), ScratchSimdReg); masm.storeAlignedInt32x4(ScratchSimdReg, toAddress(to)); @@ -303,8 +303,8 @@ MoveEmitterX86::completeCycle(const MoveOperand &to, MoveOp::Type type) } break; case MoveOp::FLOAT32X4: - JS_ASSERT(pushedAtCycle_ != -1); - JS_ASSERT(pushedAtCycle_ - pushedAtStart_ >= Simd128DataSize); + MOZ_ASSERT(pushedAtCycle_ != -1); + MOZ_ASSERT(pushedAtCycle_ - pushedAtStart_ >= Simd128DataSize); if (to.isMemory()) { masm.loadAlignedFloat32x4(cycleSlot(), ScratchSimdReg); masm.storeAlignedFloat32x4(ScratchSimdReg, toAddress(to)); @@ -313,8 +313,8 @@ MoveEmitterX86::completeCycle(const MoveOperand &to, MoveOp::Type type) } break; case MoveOp::FLOAT32: - JS_ASSERT(pushedAtCycle_ != -1); - JS_ASSERT(pushedAtCycle_ - pushedAtStart_ >= sizeof(float)); + MOZ_ASSERT(pushedAtCycle_ != -1); + MOZ_ASSERT(pushedAtCycle_ - pushedAtStart_ >= sizeof(float)); if (to.isMemory()) { masm.loadFloat32(cycleSlot(), ScratchFloat32Reg); masm.storeFloat32(ScratchFloat32Reg, toAddress(to)); @@ -323,8 +323,8 @@ MoveEmitterX86::completeCycle(const MoveOperand &to, MoveOp::Type type) } break; case MoveOp::DOUBLE: - JS_ASSERT(pushedAtCycle_ != -1); - JS_ASSERT(pushedAtCycle_ - pushedAtStart_ >= sizeof(double)); + MOZ_ASSERT(pushedAtCycle_ != -1); + MOZ_ASSERT(pushedAtCycle_ - pushedAtStart_ >= sizeof(double)); if (to.isMemory()) { masm.loadDouble(cycleSlot(), ScratchDoubleReg); masm.storeDouble(ScratchDoubleReg, toAddress(to)); @@ -334,8 +334,8 @@ MoveEmitterX86::completeCycle(const MoveOperand &to, MoveOp::Type type) break; case MoveOp::INT32: #ifdef JS_CODEGEN_X64 - JS_ASSERT(pushedAtCycle_ != -1); - JS_ASSERT(pushedAtCycle_ - pushedAtStart_ >= sizeof(int32_t)); + MOZ_ASSERT(pushedAtCycle_ != -1); + MOZ_ASSERT(pushedAtCycle_ - pushedAtStart_ >= sizeof(int32_t)); // x64 can't pop to a 32-bit destination. if (to.isMemory()) { masm.load32(cycleSlot(), ScratchReg); @@ -346,7 +346,7 @@ MoveEmitterX86::completeCycle(const MoveOperand &to, MoveOp::Type type) break; #endif case MoveOp::GENERAL: - JS_ASSERT(masm.framePushed() - pushedAtStart_ >= sizeof(intptr_t)); + MOZ_ASSERT(masm.framePushed() - pushedAtStart_ >= sizeof(intptr_t)); masm.Pop(toPopOperand(to)); break; default: @@ -360,11 +360,11 @@ MoveEmitterX86::emitInt32Move(const MoveOperand &from, const MoveOperand &to) if (from.isGeneralReg()) { masm.move32(from.reg(), toOperand(to)); } else if (to.isGeneralReg()) { - JS_ASSERT(from.isMemory()); + MOZ_ASSERT(from.isMemory()); masm.load32(toAddress(from), to.reg()); } else { // Memory to memory gpr move. - JS_ASSERT(from.isMemory()); + MOZ_ASSERT(from.isMemory()); #ifdef JS_CODEGEN_X64 // x64 has a ScratchReg. Use it. masm.load32(toAddress(from), ScratchReg); @@ -383,7 +383,7 @@ MoveEmitterX86::emitGeneralMove(const MoveOperand &from, const MoveOperand &to) if (from.isGeneralReg()) { masm.mov(from.reg(), toOperand(to)); } else if (to.isGeneralReg()) { - JS_ASSERT(from.isMemoryOrEffectiveAddress()); + MOZ_ASSERT(from.isMemoryOrEffectiveAddress()); if (from.isMemory()) masm.loadPtr(toAddress(from), to.reg()); else @@ -401,7 +401,7 @@ MoveEmitterX86::emitGeneralMove(const MoveOperand &from, const MoveOperand &to) #endif } else { // Effective address to memory move. - JS_ASSERT(from.isEffectiveAddress()); + MOZ_ASSERT(from.isEffectiveAddress()); #ifdef JS_CODEGEN_X64 // x64 has a ScratchReg. Use it. masm.lea(toOperand(from), ScratchReg); @@ -429,7 +429,7 @@ MoveEmitterX86::emitFloat32Move(const MoveOperand &from, const MoveOperand &to) masm.loadFloat32(toAddress(from), to.floatReg()); } else { // Memory to memory move. - JS_ASSERT(from.isMemory()); + MOZ_ASSERT(from.isMemory()); masm.loadFloat32(toAddress(from), ScratchFloat32Reg); masm.storeFloat32(ScratchFloat32Reg, toAddress(to)); } @@ -447,7 +447,7 @@ MoveEmitterX86::emitDoubleMove(const MoveOperand &from, const MoveOperand &to) masm.loadDouble(toAddress(from), to.floatReg()); } else { // Memory to memory move. - JS_ASSERT(from.isMemory()); + MOZ_ASSERT(from.isMemory()); masm.loadDouble(toAddress(from), ScratchDoubleReg); masm.storeDouble(ScratchDoubleReg, toAddress(to)); } @@ -465,7 +465,7 @@ MoveEmitterX86::emitInt32X4Move(const MoveOperand &from, const MoveOperand &to) masm.loadAlignedInt32x4(toAddress(from), to.floatReg()); } else { // Memory to memory move. - JS_ASSERT(from.isMemory()); + MOZ_ASSERT(from.isMemory()); masm.loadAlignedInt32x4(toAddress(from), ScratchSimdReg); masm.storeAlignedInt32x4(ScratchSimdReg, toAddress(to)); } @@ -483,7 +483,7 @@ MoveEmitterX86::emitFloat32X4Move(const MoveOperand &from, const MoveOperand &to masm.loadAlignedFloat32x4(toAddress(from), to.floatReg()); } else { // Memory to memory move. - JS_ASSERT(from.isMemory()); + MOZ_ASSERT(from.isMemory()); masm.loadAlignedFloat32x4(toAddress(from), ScratchSimdReg); masm.storeAlignedFloat32x4(ScratchSimdReg, toAddress(to)); } @@ -492,7 +492,7 @@ MoveEmitterX86::emitFloat32X4Move(const MoveOperand &from, const MoveOperand &to void MoveEmitterX86::assertDone() { - JS_ASSERT(!inCycle_); + MOZ_ASSERT(!inCycle_); } void diff --git a/js/src/jit/x64/Architecture-x64.h b/js/src/jit/x64/Architecture-x64.h index 9969ecd1bd02..df32cae23d40 100644 --- a/js/src/jit/x64/Architecture-x64.h +++ b/js/src/jit/x64/Architecture-x64.h @@ -195,12 +195,12 @@ struct FloatRegister { Code code_; static FloatRegister FromCode(uint32_t i) { - JS_ASSERT(i < FloatRegisters::Total); + MOZ_ASSERT(i < FloatRegisters::Total); FloatRegister r = { (FloatRegisters::Code)i }; return r; } Code code() const { - JS_ASSERT((uint32_t)code_ < FloatRegisters::Total); + MOZ_ASSERT((uint32_t)code_ < FloatRegisters::Total); return code_; } const char *name() const { @@ -225,7 +225,7 @@ struct FloatRegister { // N.B. FloatRegister is an explicit outparam here because msvc-2010 // miscompiled it on win64 when the value was simply returned void aliased(uint32_t aliasIdx, FloatRegister *ret) { - JS_ASSERT(aliasIdx == 0); + MOZ_ASSERT(aliasIdx == 0); *ret = *this; } // This function mostly exists for the ARM backend. It is to ensure that two @@ -243,7 +243,7 @@ struct FloatRegister { return 1; } void alignedAliased(uint32_t aliasIdx, FloatRegister *ret) { - JS_ASSERT(aliasIdx == 0); + MOZ_ASSERT(aliasIdx == 0); *ret = *this; } static TypedRegisterSet ReduceSetForPush(const TypedRegisterSet &s); diff --git a/js/src/jit/x64/Assembler-x64.cpp b/js/src/jit/x64/Assembler-x64.cpp index b86dccbf892b..53a4cf9e0e70 100644 --- a/js/src/jit/x64/Assembler-x64.cpp +++ b/js/src/jit/x64/Assembler-x64.cpp @@ -126,7 +126,7 @@ Assembler::writeRelocation(JmpSrc src, Relocation::Kind reloc) void Assembler::addPendingJump(JmpSrc src, ImmPtr target, Relocation::Kind reloc) { - JS_ASSERT(target.value != nullptr); + MOZ_ASSERT(target.value != nullptr); // Emit reloc before modifying the jump table, since it computes a 0-based // index. This jump is not patchable at runtime. @@ -156,7 +156,7 @@ Assembler::PatchableJumpAddress(JitCode *code, size_t index) uint32_t jumpOffset = * (uint32_t *) code->jumpRelocTable(); jumpOffset += index * SizeOfJumpTableEntry; - JS_ASSERT(jumpOffset + SizeOfExtendedJump <= code->instructionsSize()); + MOZ_ASSERT(jumpOffset + SizeOfExtendedJump <= code->instructionsSize()); return code->raw() + jumpOffset; } @@ -191,14 +191,14 @@ Assembler::finish() size_t oldSize = masm.size(); #endif masm.jmp_rip(2); - JS_ASSERT(masm.size() - oldSize == 6); + MOZ_ASSERT(masm.size() - oldSize == 6); // Following an indirect branch with ud2 hints to the hardware that // there's no fall-through. This also aligns the 64-bit immediate. masm.ud2(); - JS_ASSERT(masm.size() - oldSize == 8); + MOZ_ASSERT(masm.size() - oldSize == 8); masm.immediate64(0); - JS_ASSERT(masm.size() - oldSize == SizeOfExtendedJump); - JS_ASSERT(masm.size() - oldSize == SizeOfJumpTableEntry); + MOZ_ASSERT(masm.size() - oldSize == SizeOfExtendedJump); + MOZ_ASSERT(masm.size() - oldSize == SizeOfJumpTableEntry); } } @@ -221,8 +221,8 @@ Assembler::executableCopy(uint8_t *buffer) } else { // An extended jump table must exist, and its offset must be in // range. - JS_ASSERT(extendedJumpTable_); - JS_ASSERT((extendedJumpTable_ + i * SizeOfJumpTableEntry) <= size() - SizeOfJumpTableEntry); + MOZ_ASSERT(extendedJumpTable_); + MOZ_ASSERT((extendedJumpTable_ + i * SizeOfJumpTableEntry) <= size() - SizeOfJumpTableEntry); // Patch the jump to go to the extended jump entry. uint8_t *entry = buffer + extendedJumpTable_ + i * SizeOfJumpTableEntry; @@ -272,7 +272,7 @@ Assembler::CodeFromJump(JitCode *code, uint8_t *jump) if (target >= code->raw() && target < code->raw() + code->instructionsSize()) { // This jump is within the code buffer, so it has been redirected to // the extended jump table. - JS_ASSERT(target + SizeOfJumpTableEntry <= code->raw() + code->instructionsSize()); + MOZ_ASSERT(target + SizeOfJumpTableEntry <= code->raw() + code->instructionsSize()); target = (uint8_t *)X86Assembler::getPointer(target + SizeOfExtendedJump); } @@ -287,7 +287,7 @@ Assembler::TraceJumpRelocations(JSTracer *trc, JitCode *code, CompactBufferReade while (iter.read()) { JitCode *child = CodeFromJump(code, code->raw() + iter.offset()); MarkJitCodeUnbarriered(trc, &child, "rel32"); - JS_ASSERT(child == CodeFromJump(code, code->raw() + iter.offset())); + MOZ_ASSERT(child == CodeFromJump(code, code->raw() + iter.offset())); } } diff --git a/js/src/jit/x64/Assembler-x64.h b/js/src/jit/x64/Assembler-x64.h index bd633ada45f0..b9720cc0f327 100644 --- a/js/src/jit/x64/Assembler-x64.h +++ b/js/src/jit/x64/Assembler-x64.h @@ -571,7 +571,7 @@ class Assembler : public AssemblerX86Shared movq(src, dest); } void mov(AbsoluteLabel *label, Register dest) { - JS_ASSERT(!label->bound()); + MOZ_ASSERT(!label->bound()); // Thread the patch list through the unpatched address word in the // instruction stream. masm.movq_i64r(label->prev(), dest.code()); @@ -734,7 +734,7 @@ class Assembler : public AssemblerX86Shared CodeOffsetLabel offset(size()); JmpSrc src = enabled ? masm.call() : masm.cmp_eax(); addPendingJump(src, ImmPtr(target->raw()), Relocation::JITCODE); - JS_ASSERT(size() - offset.offset() == ToggledCallSize(nullptr)); + MOZ_ASSERT(size() - offset.offset() == ToggledCallSize(nullptr)); return offset; } diff --git a/js/src/jit/x64/BaselineHelpers-x64.h b/js/src/jit/x64/BaselineHelpers-x64.h index 9e46139758b0..f776ff0fbc5d 100644 --- a/js/src/jit/x64/BaselineHelpers-x64.h +++ b/js/src/jit/x64/BaselineHelpers-x64.h @@ -168,7 +168,7 @@ EmitLeaveStubFrame(MacroAssembler &masm, bool calledIntoIon = false) inline void EmitStowICValues(MacroAssembler &masm, int values) { - JS_ASSERT(values >= 0 && values <= 2); + MOZ_ASSERT(values >= 0 && values <= 2); switch(values) { case 1: // Stow R0 @@ -189,7 +189,7 @@ EmitStowICValues(MacroAssembler &masm, int values) inline void EmitUnstowICValues(MacroAssembler &masm, int values, bool discard = false) { - JS_ASSERT(values >= 0 && values <= 2); + MOZ_ASSERT(values >= 0 && values <= 2); switch(values) { case 1: // Unstow R0 diff --git a/js/src/jit/x64/BaselineIC-x64.cpp b/js/src/jit/x64/BaselineIC-x64.cpp index caeae9b1cc10..38c1a119c917 100644 --- a/js/src/jit/x64/BaselineIC-x64.cpp +++ b/js/src/jit/x64/BaselineIC-x64.cpp @@ -79,9 +79,9 @@ ICBinaryArith_Int32::Compiler::generateStubCode(MacroAssembler &masm) break; case JSOP_DIV: { - JS_ASSERT(R2.scratchReg() == rax); - JS_ASSERT(R0.valueReg() != rdx); - JS_ASSERT(R1.valueReg() != rdx); + MOZ_ASSERT(R2.scratchReg() == rax); + MOZ_ASSERT(R0.valueReg() != rdx); + MOZ_ASSERT(R1.valueReg() != rdx); masm.unboxInt32(R0, eax); masm.unboxInt32(R1, ExtractTemp0); @@ -108,9 +108,9 @@ ICBinaryArith_Int32::Compiler::generateStubCode(MacroAssembler &masm) } case JSOP_MOD: { - JS_ASSERT(R2.scratchReg() == rax); - JS_ASSERT(R0.valueReg() != rdx); - JS_ASSERT(R1.valueReg() != rdx); + MOZ_ASSERT(R2.scratchReg() == rax); + MOZ_ASSERT(R0.valueReg() != rdx); + MOZ_ASSERT(R1.valueReg() != rdx); masm.unboxInt32(R0, eax); masm.unboxInt32(R1, ExtractTemp0); diff --git a/js/src/jit/x64/CodeGenerator-x64.cpp b/js/src/jit/x64/CodeGenerator-x64.cpp index 0b869618632a..58429139705d 100644 --- a/js/src/jit/x64/CodeGenerator-x64.cpp +++ b/js/src/jit/x64/CodeGenerator-x64.cpp @@ -148,7 +148,7 @@ CodeGeneratorX64::visitCompareB(LCompareB *lir) const LAllocation *rhs = lir->rhs(); const Register output = ToRegister(lir->output()); - JS_ASSERT(mir->jsop() == JSOP_STRICTEQ || mir->jsop() == JSOP_STRICTNE); + MOZ_ASSERT(mir->jsop() == JSOP_STRICTEQ || mir->jsop() == JSOP_STRICTNE); // Load boxed boolean in ScratchReg. if (rhs->isConstant()) @@ -170,7 +170,7 @@ CodeGeneratorX64::visitCompareBAndBranch(LCompareBAndBranch *lir) const ValueOperand lhs = ToValue(lir, LCompareBAndBranch::Lhs); const LAllocation *rhs = lir->rhs(); - JS_ASSERT(mir->jsop() == JSOP_STRICTEQ || mir->jsop() == JSOP_STRICTNE); + MOZ_ASSERT(mir->jsop() == JSOP_STRICTEQ || mir->jsop() == JSOP_STRICTNE); // Load boxed boolean in ScratchReg. if (rhs->isConstant()) @@ -191,7 +191,7 @@ CodeGeneratorX64::visitCompareV(LCompareV *lir) const ValueOperand rhs = ToValue(lir, LCompareV::RhsInput); const Register output = ToRegister(lir->output()); - JS_ASSERT(IsEqualityOp(mir->jsop())); + MOZ_ASSERT(IsEqualityOp(mir->jsop())); masm.cmpq(lhs.valueReg(), rhs.valueReg()); masm.emitSet(JSOpToCondition(mir->compareType(), mir->jsop()), output); @@ -206,8 +206,8 @@ CodeGeneratorX64::visitCompareVAndBranch(LCompareVAndBranch *lir) const ValueOperand lhs = ToValue(lir, LCompareVAndBranch::LhsInput); const ValueOperand rhs = ToValue(lir, LCompareVAndBranch::RhsInput); - JS_ASSERT(mir->jsop() == JSOP_EQ || mir->jsop() == JSOP_STRICTEQ || - mir->jsop() == JSOP_NE || mir->jsop() == JSOP_STRICTNE); + MOZ_ASSERT(mir->jsop() == JSOP_EQ || mir->jsop() == JSOP_STRICTEQ || + mir->jsop() == JSOP_NE || mir->jsop() == JSOP_STRICTNE); masm.cmpq(lhs.valueReg(), rhs.valueReg()); emitBranch(JSOpToCondition(mir->compareType(), mir->jsop()), lir->ifTrue(), lir->ifFalse()); @@ -258,7 +258,7 @@ CodeGeneratorX64::visitAsmJSLoadHeap(LAsmJSLoadHeap *ins) if (ptr->isConstant()) { int32_t ptrImm = ptr->toConstant()->toInt32(); - JS_ASSERT(ptrImm >= 0); + MOZ_ASSERT(ptrImm >= 0); srcAddr = Operand(HeapReg, ptrImm); } else { srcAddr = Operand(HeapReg, ToRegister(ptr), TimesOne); @@ -306,7 +306,7 @@ CodeGeneratorX64::visitAsmJSStoreHeap(LAsmJSStoreHeap *ins) if (ptr->isConstant()) { int32_t ptrImm = ptr->toConstant()->toInt32(); - JS_ASSERT(ptrImm >= 0); + MOZ_ASSERT(ptrImm >= 0); dstAddr = Operand(HeapReg, ptrImm); } else { dstAddr = Operand(HeapReg, ToRegister(ptr), TimesOne); @@ -357,7 +357,7 @@ CodeGeneratorX64::visitAsmJSLoadGlobalVar(LAsmJSLoadGlobalVar *ins) MAsmJSLoadGlobalVar *mir = ins->mir(); MIRType type = mir->type(); - JS_ASSERT(IsNumberType(type) || IsSimdType(type)); + MOZ_ASSERT(IsNumberType(type) || IsSimdType(type)); CodeOffsetLabel label; switch (type) { @@ -392,7 +392,7 @@ CodeGeneratorX64::visitAsmJSStoreGlobalVar(LAsmJSStoreGlobalVar *ins) MAsmJSStoreGlobalVar *mir = ins->mir(); MIRType type = mir->value()->type(); - JS_ASSERT(IsNumberType(type) || IsSimdType(type)); + MOZ_ASSERT(IsNumberType(type) || IsSimdType(type)); CodeOffsetLabel label; switch (type) { diff --git a/js/src/jit/x64/Lowering-x64.cpp b/js/src/jit/x64/Lowering-x64.cpp index a46a1f98f65a..54cda310da14 100644 --- a/js/src/jit/x64/Lowering-x64.cpp +++ b/js/src/jit/x64/Lowering-x64.cpp @@ -18,7 +18,7 @@ bool LIRGeneratorX64::useBox(LInstruction *lir, size_t n, MDefinition *mir, LUse::Policy policy, bool useAtStart) { - JS_ASSERT(mir->type() == MIRType_Value); + MOZ_ASSERT(mir->type() == MIRType_Value); if (!ensureDefined(mir)) return false; @@ -29,7 +29,7 @@ LIRGeneratorX64::useBox(LInstruction *lir, size_t n, MDefinition *mir, bool LIRGeneratorX64::useBoxFixed(LInstruction *lir, size_t n, MDefinition *mir, Register reg1, Register) { - JS_ASSERT(mir->type() == MIRType_Value); + MOZ_ASSERT(mir->type() == MIRType_Value); if (!ensureDefined(mir)) return false; @@ -75,7 +75,7 @@ bool LIRGeneratorX64::visitUnbox(MUnbox *unbox) { MDefinition *box = unbox->getOperand(0); - JS_ASSERT(box->type() == MIRType_Value); + MOZ_ASSERT(box->type() == MIRType_Value); LUnboxBase *lir; if (IsFloatingPointType(unbox->type())) @@ -93,7 +93,7 @@ bool LIRGeneratorX64::visitReturn(MReturn *ret) { MDefinition *opd = ret->getOperand(0); - JS_ASSERT(opd->type() == MIRType_Value); + MOZ_ASSERT(opd->type() == MIRType_Value); LReturn *ins = new(alloc()) LReturn; ins->setOperand(0, useFixed(opd, JSReturnReg)); @@ -115,7 +115,7 @@ LIRGeneratorX64::lowerUntypedPhiInput(MPhi *phi, uint32_t inputPosition, LBlock bool LIRGeneratorX64::visitAsmJSUnsignedToDouble(MAsmJSUnsignedToDouble *ins) { - JS_ASSERT(ins->input()->type() == MIRType_Int32); + MOZ_ASSERT(ins->input()->type() == MIRType_Int32); LAsmJSUInt32ToDouble *lir = new(alloc()) LAsmJSUInt32ToDouble(useRegisterAtStart(ins->input())); return define(lir, ins); } @@ -123,7 +123,7 @@ LIRGeneratorX64::visitAsmJSUnsignedToDouble(MAsmJSUnsignedToDouble *ins) bool LIRGeneratorX64::visitAsmJSUnsignedToFloat32(MAsmJSUnsignedToFloat32 *ins) { - JS_ASSERT(ins->input()->type() == MIRType_Int32); + MOZ_ASSERT(ins->input()->type() == MIRType_Int32); LAsmJSUInt32ToFloat32 *lir = new(alloc()) LAsmJSUInt32ToFloat32(useRegisterAtStart(ins->input())); return define(lir, ins); } @@ -132,7 +132,7 @@ bool LIRGeneratorX64::visitAsmJSLoadHeap(MAsmJSLoadHeap *ins) { MDefinition *ptr = ins->ptr(); - JS_ASSERT(ptr->type() == MIRType_Int32); + MOZ_ASSERT(ptr->type() == MIRType_Int32); LAllocation ptrAlloc; bool useConstant = false; @@ -156,7 +156,7 @@ bool LIRGeneratorX64::visitAsmJSStoreHeap(MAsmJSStoreHeap *ins) { MDefinition *ptr = ins->ptr(); - JS_ASSERT(ptr->type() == MIRType_Int32); + MOZ_ASSERT(ptr->type() == MIRType_Int32); LAsmJSStoreHeap *lir; // Note only a positive constant index is accepted because a negative offset diff --git a/js/src/jit/x64/MacroAssembler-x64.cpp b/js/src/jit/x64/MacroAssembler-x64.cpp index 49986e8c1f86..ec23f49e7c9d 100644 --- a/js/src/jit/x64/MacroAssembler-x64.cpp +++ b/js/src/jit/x64/MacroAssembler-x64.cpp @@ -37,7 +37,7 @@ MacroAssemblerX64::loadConstantDouble(double d, FloatRegister dest) return; } Double &dbl = doubles_[doubleIndex]; - JS_ASSERT(!dbl.uses.bound()); + MOZ_ASSERT(!dbl.uses.bound()); // The constants will be stored in a pool appended to the text (see // finish()), so they will always be a fixed distance from the @@ -71,7 +71,7 @@ MacroAssemblerX64::loadConstantFloat32(float f, FloatRegister dest) return; } Float &flt = floats_[floatIndex]; - JS_ASSERT(!flt.uses.bound()); + MOZ_ASSERT(!flt.uses.bound()); // See comment in loadConstantDouble JmpSrc j = masm.movss_ripr(dest.code()); @@ -104,7 +104,7 @@ MacroAssemblerX64::getSimdData(const SimdConstant &v) void MacroAssemblerX64::loadConstantInt32x4(const SimdConstant &v, FloatRegister dest) { - JS_ASSERT(v.type() == SimdConstant::Int32x4); + MOZ_ASSERT(v.type() == SimdConstant::Int32x4); if (maybeInlineInt32x4(v, dest)) return; @@ -112,8 +112,8 @@ MacroAssemblerX64::loadConstantInt32x4(const SimdConstant &v, FloatRegister dest if (!val) return; - JS_ASSERT(!val->uses.bound()); - JS_ASSERT(val->type() == SimdConstant::Int32x4); + MOZ_ASSERT(!val->uses.bound()); + MOZ_ASSERT(val->type() == SimdConstant::Int32x4); JmpSrc j = masm.movdqa_ripr(dest.code()); JmpSrc prev = JmpSrc(val->uses.use(j.offset())); @@ -123,7 +123,7 @@ MacroAssemblerX64::loadConstantInt32x4(const SimdConstant &v, FloatRegister dest void MacroAssemblerX64::loadConstantFloat32x4(const SimdConstant&v, FloatRegister dest) { - JS_ASSERT(v.type() == SimdConstant::Float32x4); + MOZ_ASSERT(v.type() == SimdConstant::Float32x4); if (maybeInlineFloat32x4(v, dest)) return; @@ -131,8 +131,8 @@ MacroAssemblerX64::loadConstantFloat32x4(const SimdConstant&v, FloatRegister des if (!val) return; - JS_ASSERT(!val->uses.bound()); - JS_ASSERT(val->type() == SimdConstant::Float32x4); + MOZ_ASSERT(!val->uses.bound()); + MOZ_ASSERT(val->type() == SimdConstant::Float32x4); JmpSrc j = masm.movaps_ripr(dest.code()); JmpSrc prev = JmpSrc(val->uses.use(j.offset())); @@ -177,7 +177,7 @@ MacroAssemblerX64::finish() void MacroAssemblerX64::setupABICall(uint32_t args) { - JS_ASSERT(!inCall_); + MOZ_ASSERT(!inCall_); inCall_ = true; args_ = args; @@ -264,8 +264,8 @@ MacroAssemblerX64::passABIArg(FloatRegister reg, MoveOp::Type type) void MacroAssemblerX64::callWithABIPre(uint32_t *stackAdjust) { - JS_ASSERT(inCall_); - JS_ASSERT(args_ == passedIntArgs_ + passedFloatArgs_); + MOZ_ASSERT(inCall_); + MOZ_ASSERT(args_ == passedIntArgs_ + passedFloatArgs_); if (dynamicAlignment_) { *stackAdjust = stackForCall_ @@ -308,7 +308,7 @@ MacroAssemblerX64::callWithABIPost(uint32_t stackAdjust, MoveOp::Type result) if (dynamicAlignment_) pop(rsp); - JS_ASSERT(inCall_); + MOZ_ASSERT(inCall_); inCall_ = false; } @@ -351,7 +351,7 @@ MacroAssemblerX64::callWithABI(Address fun, MoveOp::Type result) fun.base = r10; } - JS_ASSERT(!IsIntArgReg(fun.base)); + MOZ_ASSERT(!IsIntArgReg(fun.base)); uint32_t stackAdjust; callWithABIPre(&stackAdjust); @@ -484,9 +484,9 @@ MacroAssemblerX64::storeUnboxedValue(ConstantOrRegister value, MIRType valueType void MacroAssemblerX64::branchPtrInNurseryRange(Condition cond, Register ptr, Register temp, Label *label) { - JS_ASSERT(cond == Assembler::Equal || cond == Assembler::NotEqual); - JS_ASSERT(ptr != temp); - JS_ASSERT(ptr != ScratchReg); + MOZ_ASSERT(cond == Assembler::Equal || cond == Assembler::NotEqual); + MOZ_ASSERT(ptr != temp); + MOZ_ASSERT(ptr != ScratchReg); const Nursery &nursery = GetIonContext()->runtime->gcNursery(); movePtr(ImmWord(-ptrdiff_t(nursery.start())), ScratchReg); @@ -499,7 +499,7 @@ void MacroAssemblerX64::branchValueIsNurseryObject(Condition cond, ValueOperand value, Register temp, Label *label) { - JS_ASSERT(cond == Assembler::Equal || cond == Assembler::NotEqual); + MOZ_ASSERT(cond == Assembler::Equal || cond == Assembler::NotEqual); // 'Value' representing the start of the nursery tagged as a JSObject const Nursery &nursery = GetIonContext()->runtime->gcNursery(); diff --git a/js/src/jit/x64/MacroAssembler-x64.h b/js/src/jit/x64/MacroAssembler-x64.h index 7b7799150aa2..264af7991cf5 100644 --- a/js/src/jit/x64/MacroAssembler-x64.h +++ b/js/src/jit/x64/MacroAssembler-x64.h @@ -194,7 +194,7 @@ class MacroAssemblerX64 : public MacroAssemblerX86Shared loadValue(Operand(src), val); } void tagValue(JSValueType type, Register payload, ValueOperand dest) { - JS_ASSERT(dest.valueReg() != ScratchReg); + MOZ_ASSERT(dest.valueReg() != ScratchReg); if (payload != dest.valueReg()) movq(payload, dest.valueReg()); mov(ImmShiftedTag(type), ScratchReg); @@ -245,7 +245,7 @@ class MacroAssemblerX64 : public MacroAssemblerX86Shared movq(src.valueReg(), dest.valueReg()); } void boxValue(JSValueType type, Register src, Register dest) { - JS_ASSERT(src != dest); + MOZ_ASSERT(src != dest); JSValueShiftedTag tag = (JSValueShiftedTag)JSVAL_TYPE_TO_SHIFTED_TAG(type); #ifdef DEBUG @@ -262,58 +262,58 @@ class MacroAssemblerX64 : public MacroAssemblerX86Shared } Condition testUndefined(Condition cond, Register tag) { - JS_ASSERT(cond == Equal || cond == NotEqual); + MOZ_ASSERT(cond == Equal || cond == NotEqual); cmpl(tag, ImmTag(JSVAL_TAG_UNDEFINED)); return cond; } Condition testInt32(Condition cond, Register tag) { - JS_ASSERT(cond == Equal || cond == NotEqual); + MOZ_ASSERT(cond == Equal || cond == NotEqual); cmpl(tag, ImmTag(JSVAL_TAG_INT32)); return cond; } Condition testBoolean(Condition cond, Register tag) { - JS_ASSERT(cond == Equal || cond == NotEqual); + MOZ_ASSERT(cond == Equal || cond == NotEqual); cmpl(tag, ImmTag(JSVAL_TAG_BOOLEAN)); return cond; } Condition testNull(Condition cond, Register tag) { - JS_ASSERT(cond == Equal || cond == NotEqual); + MOZ_ASSERT(cond == Equal || cond == NotEqual); cmpl(tag, ImmTag(JSVAL_TAG_NULL)); return cond; } Condition testString(Condition cond, Register tag) { - JS_ASSERT(cond == Equal || cond == NotEqual); + MOZ_ASSERT(cond == Equal || cond == NotEqual); cmpl(tag, ImmTag(JSVAL_TAG_STRING)); return cond; } Condition testSymbol(Condition cond, Register tag) { - JS_ASSERT(cond == Equal || cond == NotEqual); + MOZ_ASSERT(cond == Equal || cond == NotEqual); cmpl(tag, ImmTag(JSVAL_TAG_SYMBOL)); return cond; } Condition testObject(Condition cond, Register tag) { - JS_ASSERT(cond == Equal || cond == NotEqual); + MOZ_ASSERT(cond == Equal || cond == NotEqual); cmpl(tag, ImmTag(JSVAL_TAG_OBJECT)); return cond; } Condition testDouble(Condition cond, Register tag) { - JS_ASSERT(cond == Equal || cond == NotEqual); + MOZ_ASSERT(cond == Equal || cond == NotEqual); cmpl(tag, Imm32(JSVAL_TAG_MAX_DOUBLE)); return cond == Equal ? BelowOrEqual : Above; } Condition testNumber(Condition cond, Register tag) { - JS_ASSERT(cond == Equal || cond == NotEqual); + MOZ_ASSERT(cond == Equal || cond == NotEqual); cmpl(tag, Imm32(JSVAL_UPPER_INCL_TAG_OF_NUMBER_SET)); return cond == Equal ? BelowOrEqual : Above; } Condition testGCThing(Condition cond, Register tag) { - JS_ASSERT(cond == Equal || cond == NotEqual); + MOZ_ASSERT(cond == Equal || cond == NotEqual); cmpl(tag, Imm32(JSVAL_LOWER_INCL_TAG_OF_GCTHING_SET)); return cond == Equal ? AboveOrEqual : Below; } Condition testMagic(Condition cond, Register tag) { - JS_ASSERT(cond == Equal || cond == NotEqual); + MOZ_ASSERT(cond == Equal || cond == NotEqual); cmpl(tag, ImmTag(JSVAL_TAG_MAGIC)); return cond; } @@ -321,7 +321,7 @@ class MacroAssemblerX64 : public MacroAssemblerX86Shared return testMagic(cond, tag); } Condition testPrimitive(Condition cond, Register tag) { - JS_ASSERT(cond == Equal || cond == NotEqual); + MOZ_ASSERT(cond == Equal || cond == NotEqual); cmpl(tag, ImmTag(JSVAL_UPPER_EXCL_TAG_OF_PRIMITIVE_SET)); return cond == Equal ? Below : AboveOrEqual; } @@ -470,7 +470,7 @@ class MacroAssemblerX64 : public MacroAssemblerX86Shared } void cmpPtr(Register lhs, const ImmWord rhs) { - JS_ASSERT(lhs != ScratchReg); + MOZ_ASSERT(lhs != ScratchReg); if (intptr_t(rhs.value) <= INT32_MAX && intptr_t(rhs.value) >= INT32_MIN) { cmpq(lhs, Imm32(int32_t(rhs.value))); } else { @@ -482,7 +482,7 @@ class MacroAssemblerX64 : public MacroAssemblerX86Shared cmpPtr(lhs, ImmWord(uintptr_t(rhs.value))); } void cmpPtr(Register lhs, const ImmGCPtr rhs) { - JS_ASSERT(lhs != ScratchReg); + MOZ_ASSERT(lhs != ScratchReg); movq(rhs, ScratchReg); cmpq(lhs, ScratchReg); } @@ -490,7 +490,7 @@ class MacroAssemblerX64 : public MacroAssemblerX86Shared cmpq(lhs, rhs); } void cmpPtr(const Operand &lhs, const ImmGCPtr rhs) { - JS_ASSERT(!lhs.containsReg(ScratchReg)); + MOZ_ASSERT(!lhs.containsReg(ScratchReg)); movq(rhs, ScratchReg); cmpq(lhs, ScratchReg); } @@ -546,7 +546,7 @@ class MacroAssemblerX64 : public MacroAssemblerX86Shared framePushed_ += amount; } void freeStack(uint32_t amount) { - JS_ASSERT(amount <= framePushed_); + MOZ_ASSERT(amount <= framePushed_); if (amount) addq(Imm32(amount), StackPointer); framePushed_ -= amount; @@ -568,7 +568,7 @@ class MacroAssemblerX64 : public MacroAssemblerX86Shared addq(imm, dest); } void addPtr(ImmWord imm, Register dest) { - JS_ASSERT(dest != ScratchReg); + MOZ_ASSERT(dest != ScratchReg); if ((intptr_t)imm.value <= INT32_MAX && (intptr_t)imm.value >= INT32_MIN) { addq(Imm32((int32_t)imm.value), dest); } else { @@ -626,7 +626,7 @@ class MacroAssemblerX64 : public MacroAssemblerX86Shared // Specialization for AbsoluteAddress. void branchPtr(Condition cond, AbsoluteAddress addr, Register ptr, Label *label) { - JS_ASSERT(ptr != ScratchReg); + MOZ_ASSERT(ptr != ScratchReg); if (X86Assembler::isAddressImmediate(addr.addr)) { branchPtr(cond, Operand(addr), ptr, label); } else { @@ -635,7 +635,7 @@ class MacroAssemblerX64 : public MacroAssemblerX86Shared } } void branchPtr(Condition cond, AsmJSAbsoluteAddress addr, Register ptr, Label *label) { - JS_ASSERT(ptr != ScratchReg); + MOZ_ASSERT(ptr != ScratchReg); mov(AsmJSImmPtr(addr.kind()), ScratchReg); branchPtr(cond, Operand(ScratchReg, 0x0), ptr, label); } @@ -882,39 +882,39 @@ class MacroAssemblerX64 : public MacroAssemblerX86Shared // of the type is limited to 32 bits. This avoids loading into a register, // accesses half as much memory, and removes a right-shift. void branchTestUndefined(Condition cond, const Operand &operand, Label *label) { - JS_ASSERT(cond == Equal || cond == NotEqual); + MOZ_ASSERT(cond == Equal || cond == NotEqual); cmpl(ToUpper32(operand), Imm32(Upper32Of(GetShiftedTag(JSVAL_TYPE_UNDEFINED)))); j(cond, label); } void branchTestUndefined(Condition cond, const Address &address, Label *label) { - JS_ASSERT(cond == Equal || cond == NotEqual); + MOZ_ASSERT(cond == Equal || cond == NotEqual); branchTestUndefined(cond, Operand(address), label); } void branchTestInt32(Condition cond, const Operand &operand, Label *label) { - JS_ASSERT(cond == Equal || cond == NotEqual); + MOZ_ASSERT(cond == Equal || cond == NotEqual); cmpl(ToUpper32(operand), Imm32(Upper32Of(GetShiftedTag(JSVAL_TYPE_INT32)))); j(cond, label); } void branchTestInt32(Condition cond, const Address &address, Label *label) { - JS_ASSERT(cond == Equal || cond == NotEqual); + MOZ_ASSERT(cond == Equal || cond == NotEqual); branchTestInt32(cond, Operand(address), label); } void branchTestDouble(Condition cond, const Operand &operand, Label *label) { - JS_ASSERT(cond == Equal || cond == NotEqual); + MOZ_ASSERT(cond == Equal || cond == NotEqual); splitTag(operand, ScratchReg); branchTestDouble(cond, ScratchReg, label); } void branchTestDouble(Condition cond, const Address &address, Label *label) { - JS_ASSERT(cond == Equal || cond == NotEqual); + MOZ_ASSERT(cond == Equal || cond == NotEqual); branchTestDouble(cond, Operand(address), label); } void branchTestBoolean(Condition cond, const Operand &operand, Label *label) { - JS_ASSERT(cond == Equal || cond == NotEqual); + MOZ_ASSERT(cond == Equal || cond == NotEqual); cmpl(ToUpper32(operand), Imm32(Upper32Of(GetShiftedTag(JSVAL_TYPE_BOOLEAN)))); j(cond, label); } void branchTestNull(Condition cond, const Operand &operand, Label *label) { - JS_ASSERT(cond == Equal || cond == NotEqual); + MOZ_ASSERT(cond == Equal || cond == NotEqual); cmpl(ToUpper32(operand), Imm32(Upper32Of(GetShiftedTag(JSVAL_TYPE_NULL)))); j(cond, label); } @@ -1011,7 +1011,7 @@ class MacroAssemblerX64 : public MacroAssemblerX86Shared void branchTestMagicValue(Condition cond, const ValueOperand &val, JSWhyMagic why, Label *label) { - JS_ASSERT(cond == Equal || cond == NotEqual); + MOZ_ASSERT(cond == Equal || cond == NotEqual); branchTestValue(cond, val, MagicValue(why), label); } Condition testMagic(Condition cond, const ValueOperand &src) { @@ -1022,7 +1022,7 @@ class MacroAssemblerX64 : public MacroAssemblerX86Shared return testMagic(cond, src); } void branchTestValue(Condition cond, const ValueOperand &value, const Value &v, Label *label) { - JS_ASSERT(value.valueReg() != ScratchReg); + MOZ_ASSERT(value.valueReg() != ScratchReg); moveValue(v, ScratchReg); cmpq(value.valueReg(), ScratchReg); j(cond, label); @@ -1030,7 +1030,7 @@ class MacroAssemblerX64 : public MacroAssemblerX86Shared void branchTestValue(Condition cond, const Address &valaddr, const ValueOperand &value, Label *label) { - JS_ASSERT(cond == Equal || cond == NotEqual); + MOZ_ASSERT(cond == Equal || cond == NotEqual); branchPtr(cond, valaddr, value.valueReg(), label); } @@ -1053,7 +1053,7 @@ class MacroAssemblerX64 : public MacroAssemblerX86Shared movq(src, dest.valueReg()); } void boxNonDouble(JSValueType type, Register src, const ValueOperand &dest) { - JS_ASSERT(src != dest.valueReg()); + MOZ_ASSERT(src != dest.valueReg()); boxValue(type, src, dest.valueReg()); } @@ -1124,7 +1124,7 @@ class MacroAssemblerX64 : public MacroAssemblerX86Shared } void unboxNonDouble(const Operand &src, Register dest) { // Explicitly permits |dest| to be used in |src|. - JS_ASSERT(dest != ScratchReg); + MOZ_ASSERT(dest != ScratchReg); if (src.containsReg(dest)) { mov(ImmWord(JSVAL_PAYLOAD_MASK), ScratchReg); movq(src, dest); @@ -1149,7 +1149,7 @@ class MacroAssemblerX64 : public MacroAssemblerX86Shared // that register. Otherwise, provides a move to the given scratch register, // and returns that. Register extractObject(const Address &address, Register scratch) { - JS_ASSERT(scratch != ScratchReg); + MOZ_ASSERT(scratch != ScratchReg); loadPtr(address, ScratchReg); // We have a special coupling with unboxObject. As long as the registers // aren't equal, it doesn't use ScratchReg. @@ -1157,28 +1157,28 @@ class MacroAssemblerX64 : public MacroAssemblerX86Shared return scratch; } Register extractObject(const ValueOperand &value, Register scratch) { - JS_ASSERT(scratch != ScratchReg); + MOZ_ASSERT(scratch != ScratchReg); unboxObject(value, scratch); return scratch; } Register extractInt32(const ValueOperand &value, Register scratch) { - JS_ASSERT(scratch != ScratchReg); + MOZ_ASSERT(scratch != ScratchReg); unboxInt32(value, scratch); return scratch; } Register extractBoolean(const ValueOperand &value, Register scratch) { - JS_ASSERT(scratch != ScratchReg); + MOZ_ASSERT(scratch != ScratchReg); unboxBoolean(value, scratch); return scratch; } Register extractTag(const Address &address, Register scratch) { - JS_ASSERT(scratch != ScratchReg); + MOZ_ASSERT(scratch != ScratchReg); loadPtr(address, scratch); splitTag(scratch, scratch); return scratch; } Register extractTag(const ValueOperand &value, Register scratch) { - JS_ASSERT(scratch != ScratchReg); + MOZ_ASSERT(scratch != ScratchReg); splitTag(value, scratch); return scratch; } @@ -1382,7 +1382,7 @@ class MacroAssemblerX64 : public MacroAssemblerX86Shared unsigned globalDataOffset) { uint8_t *nextInsn = code + patchAt.offset(); - JS_ASSERT(nextInsn <= globalData); + MOZ_ASSERT(nextInsn <= globalData); uint8_t *target = globalData + globalDataOffset; ((int32_t *)nextInsn)[-1] = target - nextInsn; } diff --git a/js/src/jit/x64/Trampoline-x64.cpp b/js/src/jit/x64/Trampoline-x64.cpp index eb42c8632dfb..f5f9e61e8bbc 100644 --- a/js/src/jit/x64/Trampoline-x64.cpp +++ b/js/src/jit/x64/Trampoline-x64.cpp @@ -38,7 +38,7 @@ JitRuntime::generateEnterJIT(JSContext *cx, EnterJitType type) const Register reg_code = IntArgReg0; const Register reg_argc = IntArgReg1; const Register reg_argv = IntArgReg2; - JS_ASSERT(OsrFrameReg == IntArgReg3); + MOZ_ASSERT(OsrFrameReg == IntArgReg3); #if defined(_WIN64) const Operand token = Operand(rbp, 16 + ShadowStackSpace); @@ -225,7 +225,7 @@ JitRuntime::generateEnterJIT(JSContext *cx, EnterJitType type) masm.pop(reg_code); masm.pop(framePtr); - JS_ASSERT(reg_code != ReturnReg); + MOZ_ASSERT(reg_code != ReturnReg); Label error; masm.addPtr(Imm32(IonExitFrameLayout::SizeWithFooter()), rsp); @@ -367,7 +367,7 @@ JitRuntime::generateArgumentsRectifier(JSContext *cx, ExecutionMode mode, void * // ArgumentsRectifierReg contains the |nargs| pushed onto the current frame. // Including |this|, there are (|nargs| + 1) arguments to copy. - JS_ASSERT(ArgumentsRectifierReg == r8); + MOZ_ASSERT(ArgumentsRectifierReg == r8); // Load the number of |undefined|s to push into %rcx. masm.loadPtr(Address(rsp, IonRectifierFrameLayout::offsetOfCalleeToken()), rax); @@ -554,8 +554,8 @@ JitRuntime::generateBailoutHandler(JSContext *cx, ExecutionMode mode) JitCode * JitRuntime::generateVMWrapper(JSContext *cx, const VMFunction &f) { - JS_ASSERT(functionWrappers_); - JS_ASSERT(functionWrappers_->initialized()); + MOZ_ASSERT(functionWrappers_); + MOZ_ASSERT(functionWrappers_->initialized()); VMWrapperMap::AddPtr p = functionWrappers_->lookupForAdd(&f); if (p) return p->value(); @@ -626,7 +626,7 @@ JitRuntime::generateVMWrapper(JSContext *cx, const VMFunction &f) break; default: - JS_ASSERT(f.outParam == Type_Void); + MOZ_ASSERT(f.outParam == Type_Void); break; } @@ -698,7 +698,7 @@ JitRuntime::generateVMWrapper(JSContext *cx, const VMFunction &f) break; case Type_Double: - JS_ASSERT(cx->runtime()->jitSupportsFloatingPoint); + MOZ_ASSERT(cx->runtime()->jitSupportsFloatingPoint); masm.loadDouble(Address(esp, 0), ReturnDoubleReg); masm.freeStack(sizeof(double)); break; @@ -709,7 +709,7 @@ JitRuntime::generateVMWrapper(JSContext *cx, const VMFunction &f) break; default: - JS_ASSERT(f.outParam == Type_Void); + MOZ_ASSERT(f.outParam == Type_Void); break; } masm.leaveExitFrame(); @@ -743,7 +743,7 @@ JitRuntime::generatePreBarrier(JSContext *cx, MIRType type) FloatRegisterSet(FloatRegisters::VolatileMask)); masm.PushRegsInMask(regs); - JS_ASSERT(PreBarrierReg == rdx); + MOZ_ASSERT(PreBarrierReg == rdx); masm.mov(ImmPtr(cx->runtime()), rcx); masm.setupUnalignedABICall(2, rax); diff --git a/js/src/jit/x86/Architecture-x86.h b/js/src/jit/x86/Architecture-x86.h index 177755ceee26..38b749e5db8a 100644 --- a/js/src/jit/x86/Architecture-x86.h +++ b/js/src/jit/x86/Architecture-x86.h @@ -171,12 +171,12 @@ struct FloatRegister { Code code_; static FloatRegister FromCode(uint32_t i) { - JS_ASSERT(i < FloatRegisters::Total); + MOZ_ASSERT(i < FloatRegisters::Total); FloatRegister r = { (FloatRegisters::Code)i }; return r; } Code code() const { - JS_ASSERT((uint32_t)code_ < FloatRegisters::Total); + MOZ_ASSERT((uint32_t)code_ < FloatRegisters::Total); return code_; } const char *name() const { @@ -200,7 +200,7 @@ struct FloatRegister { // N.B. FloatRegister is an explicit outparam here because msvc-2010 // miscompiled it on win64 when the value was simply returned void aliased(uint32_t aliasIdx, FloatRegister *ret) { - JS_ASSERT(aliasIdx == 0); + MOZ_ASSERT(aliasIdx == 0); *ret = *this; } // This function mostly exists for the ARM backend. It is to ensure that two @@ -218,7 +218,7 @@ struct FloatRegister { return 1; } void alignedAliased(uint32_t aliasIdx, FloatRegister *ret) { - JS_ASSERT(aliasIdx == 0); + MOZ_ASSERT(aliasIdx == 0); *ret = *this; } static TypedRegisterSet ReduceSetForPush(const TypedRegisterSet &s); diff --git a/js/src/jit/x86/Assembler-x86.cpp b/js/src/jit/x86/Assembler-x86.cpp index 15aba0dea5b3..f45aee72a0a0 100644 --- a/js/src/jit/x86/Assembler-x86.cpp +++ b/js/src/jit/x86/Assembler-x86.cpp @@ -98,7 +98,7 @@ Assembler::TraceJumpRelocations(JSTracer *trc, JitCode *code, CompactBufferReade while (iter.read()) { JitCode *child = CodeFromJump(code->raw() + iter.offset()); MarkJitCodeUnbarriered(trc, &child, "rel32"); - JS_ASSERT(child == CodeFromJump(code->raw() + iter.offset())); + MOZ_ASSERT(child == CodeFromJump(code->raw() + iter.offset())); } } diff --git a/js/src/jit/x86/Assembler-x86.h b/js/src/jit/x86/Assembler-x86.h index fe1b329fa5ea..100553bf9845 100644 --- a/js/src/jit/x86/Assembler-x86.h +++ b/js/src/jit/x86/Assembler-x86.h @@ -158,8 +158,8 @@ PatchJump(CodeLocationJump jump, CodeLocationLabel label) // 0F 80+cc , or // E9 unsigned char *x = (unsigned char *)jump.raw() - 5; - JS_ASSERT(((*x >= 0x80 && *x <= 0x8F) && *(x - 1) == 0x0F) || - (*x == 0xE9)); + MOZ_ASSERT(((*x >= 0x80 && *x <= 0x8F) && *(x - 1) == 0x0F) || + (*x == 0xE9)); #endif X86Assembler::setRel32(jump.raw(), label.raw()); } @@ -290,7 +290,7 @@ class Assembler : public AssemblerX86Shared movl(imm, dest); } void mov(AbsoluteLabel *label, Register dest) { - JS_ASSERT(!label->bound()); + MOZ_ASSERT(!label->bound()); // Thread the patch list through the unpatched address word in the // instruction stream. masm.movl_i32r(label->prev(), dest.code()); @@ -396,7 +396,7 @@ class Assembler : public AssemblerX86Shared CodeOffsetLabel offset(size()); JmpSrc src = enabled ? masm.call() : masm.cmp_eax(); addPendingJump(src, ImmPtr(target->raw()), Relocation::JITCODE); - JS_ASSERT(size() - offset.offset() == ToggledCallSize(nullptr)); + MOZ_ASSERT(size() - offset.offset() == ToggledCallSize(nullptr)); return offset; } @@ -450,12 +450,12 @@ class Assembler : public AssemblerX86Shared return CodeOffsetLabel(masm.currentOffset()); } CodeOffsetLabel movssWithPatch(Address src, FloatRegister dest) { - JS_ASSERT(HasSSE2()); + MOZ_ASSERT(HasSSE2()); masm.movss_mr_disp32(src.offset, src.base.code(), dest.code()); return CodeOffsetLabel(masm.currentOffset()); } CodeOffsetLabel movsdWithPatch(Address src, FloatRegister dest) { - JS_ASSERT(HasSSE2()); + MOZ_ASSERT(HasSSE2()); masm.movsd_mr_disp32(src.offset, src.base.code(), dest.code()); return CodeOffsetLabel(masm.currentOffset()); } @@ -474,12 +474,12 @@ class Assembler : public AssemblerX86Shared return CodeOffsetLabel(masm.currentOffset()); } CodeOffsetLabel movssWithPatch(FloatRegister src, Address dest) { - JS_ASSERT(HasSSE2()); + MOZ_ASSERT(HasSSE2()); masm.movss_rm_disp32(src.code(), dest.offset, dest.base.code()); return CodeOffsetLabel(masm.currentOffset()); } CodeOffsetLabel movsdWithPatch(FloatRegister src, Address dest) { - JS_ASSERT(HasSSE2()); + MOZ_ASSERT(HasSSE2()); masm.movsd_rm_disp32(src.code(), dest.offset, dest.base.code()); return CodeOffsetLabel(masm.currentOffset()); } @@ -514,22 +514,22 @@ class Assembler : public AssemblerX86Shared return CodeOffsetLabel(masm.currentOffset()); } CodeOffsetLabel movssWithPatch(PatchedAbsoluteAddress src, FloatRegister dest) { - JS_ASSERT(HasSSE2()); + MOZ_ASSERT(HasSSE2()); masm.movss_mr(src.addr, dest.code()); return CodeOffsetLabel(masm.currentOffset()); } CodeOffsetLabel movsdWithPatch(PatchedAbsoluteAddress src, FloatRegister dest) { - JS_ASSERT(HasSSE2()); + MOZ_ASSERT(HasSSE2()); masm.movsd_mr(src.addr, dest.code()); return CodeOffsetLabel(masm.currentOffset()); } CodeOffsetLabel movdqaWithPatch(PatchedAbsoluteAddress src, FloatRegister dest) { - JS_ASSERT(HasSSE2()); + MOZ_ASSERT(HasSSE2()); masm.movdqa_mr(src.addr, dest.code()); return CodeOffsetLabel(masm.currentOffset()); } CodeOffsetLabel movapsWithPatch(PatchedAbsoluteAddress src, FloatRegister dest) { - JS_ASSERT(HasSSE2()); + MOZ_ASSERT(HasSSE2()); masm.movaps_mr(src.addr, dest.code()); return CodeOffsetLabel(masm.currentOffset()); } @@ -548,22 +548,22 @@ class Assembler : public AssemblerX86Shared return CodeOffsetLabel(masm.currentOffset()); } CodeOffsetLabel movssWithPatch(FloatRegister src, PatchedAbsoluteAddress dest) { - JS_ASSERT(HasSSE2()); + MOZ_ASSERT(HasSSE2()); masm.movss_rm(src.code(), dest.addr); return CodeOffsetLabel(masm.currentOffset()); } CodeOffsetLabel movsdWithPatch(FloatRegister src, PatchedAbsoluteAddress dest) { - JS_ASSERT(HasSSE2()); + MOZ_ASSERT(HasSSE2()); masm.movsd_rm(src.code(), dest.addr); return CodeOffsetLabel(masm.currentOffset()); } CodeOffsetLabel movdqaWithPatch(FloatRegister src, PatchedAbsoluteAddress dest) { - JS_ASSERT(HasSSE2()); + MOZ_ASSERT(HasSSE2()); masm.movdqa_rm(src.code(), dest.addr); return CodeOffsetLabel(masm.currentOffset()); } CodeOffsetLabel movapsWithPatch(FloatRegister src, PatchedAbsoluteAddress dest) { - JS_ASSERT(HasSSE2()); + MOZ_ASSERT(HasSSE2()); masm.movaps_rm(src.code(), dest.addr); return CodeOffsetLabel(masm.currentOffset()); } diff --git a/js/src/jit/x86/Bailouts-x86.cpp b/js/src/jit/x86/Bailouts-x86.cpp index 7e372d403bc7..ee14b5d081c7 100644 --- a/js/src/jit/x86/Bailouts-x86.cpp +++ b/js/src/jit/x86/Bailouts-x86.cpp @@ -36,7 +36,7 @@ class BailoutStack return FrameSizeClass::FromClass(frameClassId_); } uintptr_t tableOffset() const { - JS_ASSERT(frameClass() != FrameSizeClass::None()); + MOZ_ASSERT(frameClass() != FrameSizeClass::None()); return tableOffset_; } uint32_t frameSize() const { @@ -48,7 +48,7 @@ class BailoutStack return MachineState::FromBailout(regs_, fpregs_); } SnapshotOffset snapshotOffset() const { - JS_ASSERT(frameClass() == FrameSizeClass::None()); + MOZ_ASSERT(frameClass() == FrameSizeClass::None()); return snapshotOffset_; } uint8_t *parentStackPointer() const { @@ -95,12 +95,12 @@ IonBailoutIterator::IonBailoutIterator(const JitActivationIterator &activations, uintptr_t tableOffset = bailout->tableOffset(); uintptr_t tableStart = reinterpret_cast(code->raw()); - JS_ASSERT(tableOffset >= tableStart && - tableOffset < tableStart + code->instructionsSize()); - JS_ASSERT((tableOffset - tableStart) % BAILOUT_TABLE_ENTRY_SIZE == 0); + MOZ_ASSERT(tableOffset >= tableStart && + tableOffset < tableStart + code->instructionsSize()); + MOZ_ASSERT((tableOffset - tableStart) % BAILOUT_TABLE_ENTRY_SIZE == 0); uint32_t bailoutId = ((tableOffset - tableStart) / BAILOUT_TABLE_ENTRY_SIZE) - 1; - JS_ASSERT(bailoutId < BAILOUT_TABLE_SIZE); + MOZ_ASSERT(bailoutId < BAILOUT_TABLE_SIZE); snapshotOffset_ = topIonScript_->bailoutToSnapshot(bailoutId); } diff --git a/js/src/jit/x86/BaselineHelpers-x86.h b/js/src/jit/x86/BaselineHelpers-x86.h index c79e69d23b99..897188c66563 100644 --- a/js/src/jit/x86/BaselineHelpers-x86.h +++ b/js/src/jit/x86/BaselineHelpers-x86.h @@ -119,7 +119,7 @@ static const uint32_t STUB_FRAME_SAVED_STUB_OFFSET = sizeof(void *); inline void EmitEnterStubFrame(MacroAssembler &masm, Register scratch) { - JS_ASSERT(scratch != BaselineTailCallReg); + MOZ_ASSERT(scratch != BaselineTailCallReg); EmitRestoreTailCallReg(masm); @@ -174,7 +174,7 @@ EmitLeaveStubFrame(MacroAssembler &masm, bool calledIntoIon = false) inline void EmitStowICValues(MacroAssembler &masm, int values) { - JS_ASSERT(values >= 0 && values <= 2); + MOZ_ASSERT(values >= 0 && values <= 2); switch(values) { case 1: // Stow R0 @@ -195,7 +195,7 @@ EmitStowICValues(MacroAssembler &masm, int values) inline void EmitUnstowICValues(MacroAssembler &masm, int values, bool discard = false) { - JS_ASSERT(values >= 0 && values <= 2); + MOZ_ASSERT(values >= 0 && values <= 2); switch(values) { case 1: // Unstow R0 diff --git a/js/src/jit/x86/BaselineIC-x86.cpp b/js/src/jit/x86/BaselineIC-x86.cpp index 5488a6a4ca4f..8cca04842487 100644 --- a/js/src/jit/x86/BaselineIC-x86.cpp +++ b/js/src/jit/x86/BaselineIC-x86.cpp @@ -100,7 +100,7 @@ ICBinaryArith_Int32::Compiler::generateStubCode(MacroAssembler &masm) masm.bind(¬Zero); // For idiv we need eax. - JS_ASSERT(R1.typeReg() == eax); + MOZ_ASSERT(R1.typeReg() == eax); masm.movl(R0.payloadReg(), eax); // Preserve R0.payloadReg()/edx, eax is JSVAL_TYPE_INT32. masm.movl(R0.payloadReg(), scratchReg); @@ -123,7 +123,7 @@ ICBinaryArith_Int32::Compiler::generateStubCode(MacroAssembler &masm) masm.branchTest32(Assembler::Zero, R0.payloadReg(), Imm32(0x7fffffff), &failure); // For idiv we need eax. - JS_ASSERT(R1.typeReg() == eax); + MOZ_ASSERT(R1.typeReg() == eax); masm.movl(R0.payloadReg(), eax); // Preserve R0.payloadReg()/edx, eax is JSVAL_TYPE_INT32. masm.movl(R0.payloadReg(), scratchReg); @@ -139,8 +139,8 @@ ICBinaryArith_Int32::Compiler::generateStubCode(MacroAssembler &masm) masm.bind(&done); // Result is in edx, tag in ecx remains untouched. - JS_ASSERT(R0.payloadReg() == edx); - JS_ASSERT(R0.typeReg() == ecx); + MOZ_ASSERT(R0.payloadReg() == edx); + MOZ_ASSERT(R0.typeReg() == ecx); break; } case JSOP_BITOR: @@ -156,7 +156,7 @@ ICBinaryArith_Int32::Compiler::generateStubCode(MacroAssembler &masm) break; case JSOP_LSH: // RHS needs to be in ecx for shift operations. - JS_ASSERT(R0.typeReg() == ecx); + MOZ_ASSERT(R0.typeReg() == ecx); masm.movl(R1.payloadReg(), ecx); masm.shll_cl(R0.payloadReg()); // We need to tag again, because we overwrote it. diff --git a/js/src/jit/x86/CodeGenerator-x86.cpp b/js/src/jit/x86/CodeGenerator-x86.cpp index 9cf75d922091..c6778289ba52 100644 --- a/js/src/jit/x86/CodeGenerator-x86.cpp +++ b/js/src/jit/x86/CodeGenerator-x86.cpp @@ -54,8 +54,8 @@ FrameSizeClass::ClassLimit() uint32_t FrameSizeClass::frameSize() const { - JS_ASSERT(class_ != NO_FRAME_SIZE_CLASS_ID); - JS_ASSERT(class_ < JS_ARRAY_LENGTH(FrameSizes)); + MOZ_ASSERT(class_ != NO_FRAME_SIZE_CLASS_ID); + MOZ_ASSERT(class_ < JS_ARRAY_LENGTH(FrameSizes)); return FrameSizes[class_]; } @@ -98,7 +98,7 @@ CodeGeneratorX86::visitBox(LBox *box) const LDefinition *type = box->getDef(TYPE_INDEX); DebugOnly a = box->getOperand(0); - JS_ASSERT(!a->isConstant()); + MOZ_ASSERT(!a->isConstant()); // On x86, the input operand and the output payload have the same // virtual register. All that needs to be written is the type tag for @@ -146,7 +146,7 @@ CodeGeneratorX86::visitCompareB(LCompareB *lir) const LAllocation *rhs = lir->rhs(); const Register output = ToRegister(lir->output()); - JS_ASSERT(mir->jsop() == JSOP_STRICTEQ || mir->jsop() == JSOP_STRICTNE); + MOZ_ASSERT(mir->jsop() == JSOP_STRICTEQ || mir->jsop() == JSOP_STRICTNE); Label notBoolean, done; masm.branchTestBoolean(Assembler::NotEqual, lhs, ¬Boolean); @@ -174,7 +174,7 @@ CodeGeneratorX86::visitCompareBAndBranch(LCompareBAndBranch *lir) const ValueOperand lhs = ToValue(lir, LCompareBAndBranch::Lhs); const LAllocation *rhs = lir->rhs(); - JS_ASSERT(mir->jsop() == JSOP_STRICTEQ || mir->jsop() == JSOP_STRICTNE); + MOZ_ASSERT(mir->jsop() == JSOP_STRICTEQ || mir->jsop() == JSOP_STRICTNE); Assembler::Condition cond = masm.testBoolean(Assembler::NotEqual, lhs); jumpToBlock((mir->jsop() == JSOP_STRICTEQ) ? lir->ifFalse() : lir->ifTrue(), cond); @@ -196,7 +196,7 @@ CodeGeneratorX86::visitCompareV(LCompareV *lir) const ValueOperand rhs = ToValue(lir, LCompareV::RhsInput); const Register output = ToRegister(lir->output()); - JS_ASSERT(IsEqualityOp(mir->jsop())); + MOZ_ASSERT(IsEqualityOp(mir->jsop())); Label notEqual, done; masm.cmp32(lhs.typeReg(), rhs.typeReg()); @@ -223,8 +223,8 @@ CodeGeneratorX86::visitCompareVAndBranch(LCompareVAndBranch *lir) const ValueOperand lhs = ToValue(lir, LCompareVAndBranch::LhsInput); const ValueOperand rhs = ToValue(lir, LCompareVAndBranch::RhsInput); - JS_ASSERT(mir->jsop() == JSOP_EQ || mir->jsop() == JSOP_STRICTEQ || - mir->jsop() == JSOP_NE || mir->jsop() == JSOP_STRICTNE); + MOZ_ASSERT(mir->jsop() == JSOP_EQ || mir->jsop() == JSOP_STRICTEQ || + mir->jsop() == JSOP_NE || mir->jsop() == JSOP_STRICTNE); MBasicBlock *notEqual = (cond == Assembler::Equal) ? lir->ifFalse() : lir->ifTrue(); @@ -346,7 +346,7 @@ CodeGeneratorX86::visitAsmJSCall(LAsmJSCall *ins) masm.loadFloat32(op, ReturnFloat32Reg); masm.freeStack(sizeof(float)); } else { - JS_ASSERT(mir->type() == MIRType_Double); + MOZ_ASSERT(mir->type() == MIRType_Double); masm.reserveStack(sizeof(double)); Operand op(esp, 0); masm.fstp(op); @@ -489,7 +489,7 @@ CodeGeneratorX86::visitAsmJSLoadGlobalVar(LAsmJSLoadGlobalVar *ins) { MAsmJSLoadGlobalVar *mir = ins->mir(); MIRType type = mir->type(); - JS_ASSERT(IsNumberType(type) || IsSimdType(type)); + MOZ_ASSERT(IsNumberType(type) || IsSimdType(type)); CodeOffsetLabel label; switch (type) { @@ -523,7 +523,7 @@ CodeGeneratorX86::visitAsmJSStoreGlobalVar(LAsmJSStoreGlobalVar *ins) MAsmJSStoreGlobalVar *mir = ins->mir(); MIRType type = mir->value()->type(); - JS_ASSERT(IsNumberType(type) || IsSimdType(type)); + MOZ_ASSERT(IsNumberType(type) || IsSimdType(type)); CodeOffsetLabel label; switch (type) { @@ -587,7 +587,7 @@ GetPropertyParIC::initializeAddCacheState(LInstruction *ins, AddCacheState *addS { // We don't have a scratch register, but only use the temp if we needed // one, it's BogusTemp otherwise. - JS_ASSERT(ins->isGetPropertyCacheV() || ins->isGetPropertyCacheT()); + MOZ_ASSERT(ins->isGetPropertyCacheV() || ins->isGetPropertyCacheT()); if (ins->isGetPropertyCacheV() || ins->toGetPropertyCacheT()->temp()->isBogusTemp()) addState->dispatchScratch = output_.scratchReg().gpr(); else @@ -599,7 +599,7 @@ GetElementParIC::initializeAddCacheState(LInstruction *ins, AddCacheState *addSt { // We don't have a scratch register, but only use the temp if we needed // one, it's BogusTemp otherwise. - JS_ASSERT(ins->isGetElementCacheV() || ins->isGetElementCacheT()); + MOZ_ASSERT(ins->isGetElementCacheV() || ins->isGetElementCacheT()); if (ins->isGetElementCacheV() || ins->toGetElementCacheT()->temp()->isBogusTemp()) addState->dispatchScratch = output_.scratchReg().gpr(); else @@ -610,7 +610,7 @@ void SetPropertyParIC::initializeAddCacheState(LInstruction *ins, AddCacheState *addState) { // We don't have an output register to reuse, so we always need a temp. - JS_ASSERT(ins->isSetPropertyCacheV() || ins->isSetPropertyCacheT()); + MOZ_ASSERT(ins->isSetPropertyCacheV() || ins->isSetPropertyCacheT()); if (ins->isSetPropertyCacheV()) addState->dispatchScratch = ToRegister(ins->toSetPropertyCacheV()->tempForDispatchCache()); else @@ -622,7 +622,7 @@ SetElementParIC::initializeAddCacheState(LInstruction *ins, AddCacheState *addSt { // We don't have an output register to reuse, but luckily SetElementCache // already needs a temp. - JS_ASSERT(ins->isSetElementCacheV() || ins->isSetElementCacheT()); + MOZ_ASSERT(ins->isSetElementCacheV() || ins->isSetElementCacheT()); if (ins->isSetElementCacheV()) addState->dispatchScratch = ToRegister(ins->toSetElementCacheV()->temp()); else diff --git a/js/src/jit/x86/LIR-x86.h b/js/src/jit/x86/LIR-x86.h index 2b0bc66b9a53..f4b52e46d10d 100644 --- a/js/src/jit/x86/LIR-x86.h +++ b/js/src/jit/x86/LIR-x86.h @@ -41,7 +41,7 @@ class LBoxFloatingPoint : public LInstructionHelper<2, 1, 1> LBoxFloatingPoint(const LAllocation &in, const LDefinition &temp, MIRType type) : type_(type) { - JS_ASSERT(IsFloatingPointType(type)); + MOZ_ASSERT(IsFloatingPointType(type)); setOperand(0, in); setTemp(0, temp); } diff --git a/js/src/jit/x86/Lowering-x86.cpp b/js/src/jit/x86/Lowering-x86.cpp index af38b4b79d94..d6a214d2e828 100644 --- a/js/src/jit/x86/Lowering-x86.cpp +++ b/js/src/jit/x86/Lowering-x86.cpp @@ -41,7 +41,7 @@ bool LIRGeneratorX86::useBox(LInstruction *lir, size_t n, MDefinition *mir, LUse::Policy policy, bool useAtStart) { - JS_ASSERT(mir->type() == MIRType_Value); + MOZ_ASSERT(mir->type() == MIRType_Value); if (!ensureDefined(mir)) return false; @@ -54,8 +54,8 @@ bool LIRGeneratorX86::useBoxFixed(LInstruction *lir, size_t n, MDefinition *mir, Register reg1, Register reg2) { - JS_ASSERT(mir->type() == MIRType_Value); - JS_ASSERT(reg1 != reg2); + MOZ_ASSERT(mir->type() == MIRType_Value); + MOZ_ASSERT(reg1 != reg2); if (!ensureDefined(mir)) return false; @@ -119,7 +119,7 @@ LIRGeneratorX86::visitUnbox(MUnbox *unbox) // a payload. Unlike most instructions conusming a box, we ask for the type // second, so that the result can re-use the first input. MDefinition *inner = unbox->getOperand(0); - JS_ASSERT(inner->type() == MIRType_Value); + MOZ_ASSERT(inner->type() == MIRType_Value); if (!ensureDefined(inner)) return false; @@ -153,7 +153,7 @@ bool LIRGeneratorX86::visitReturn(MReturn *ret) { MDefinition *opd = ret->getOperand(0); - JS_ASSERT(opd->type() == MIRType_Value); + MOZ_ASSERT(opd->type() == MIRType_Value); LReturn *ins = new(alloc()) LReturn; ins->setOperand(0, LUse(JSReturnReg_Type)); @@ -176,7 +176,7 @@ LIRGeneratorX86::defineUntypedPhi(MPhi *phi, size_t lirIndex) uint32_t payloadVreg = getVirtualRegister(); if (payloadVreg >= MAX_VIRTUAL_REGISTERS) return false; - JS_ASSERT(typeVreg + 1 == payloadVreg); + MOZ_ASSERT(typeVreg + 1 == payloadVreg); type->setDef(0, LDefinition(typeVreg, LDefinition::TYPE)); payload->setDef(0, LDefinition(payloadVreg, LDefinition::PAYLOAD)); @@ -198,7 +198,7 @@ LIRGeneratorX86::lowerUntypedPhiInput(MPhi *phi, uint32_t inputPosition, LBlock bool LIRGeneratorX86::visitAsmJSUnsignedToDouble(MAsmJSUnsignedToDouble *ins) { - JS_ASSERT(ins->input()->type() == MIRType_Int32); + MOZ_ASSERT(ins->input()->type() == MIRType_Int32); LAsmJSUInt32ToDouble *lir = new(alloc()) LAsmJSUInt32ToDouble(useRegisterAtStart(ins->input()), temp()); return define(lir, ins); } @@ -206,7 +206,7 @@ LIRGeneratorX86::visitAsmJSUnsignedToDouble(MAsmJSUnsignedToDouble *ins) bool LIRGeneratorX86::visitAsmJSUnsignedToFloat32(MAsmJSUnsignedToFloat32 *ins) { - JS_ASSERT(ins->input()->type() == MIRType_Int32); + MOZ_ASSERT(ins->input()->type() == MIRType_Int32); LAsmJSUInt32ToFloat32 *lir = new(alloc()) LAsmJSUInt32ToFloat32(useRegisterAtStart(ins->input()), temp()); return define(lir, ins); } @@ -216,13 +216,13 @@ LIRGeneratorX86::visitAsmJSLoadHeap(MAsmJSLoadHeap *ins) { MDefinition *ptr = ins->ptr(); LAllocation ptrAlloc; - JS_ASSERT(ptr->type() == MIRType_Int32); + MOZ_ASSERT(ptr->type() == MIRType_Int32); // For the x86 it is best to keep the 'ptr' in a register if a bounds check is needed. if (ptr->isConstant() && ins->skipBoundsCheck()) { int32_t ptrValue = ptr->toConstant()->value().toInt32(); // A bounds check is only skipped for a positive index. - JS_ASSERT(ptrValue >= 0); + MOZ_ASSERT(ptrValue >= 0); ptrAlloc = LAllocation(ptr->toConstant()->vp()); } else { ptrAlloc = useRegisterAtStart(ptr); @@ -236,11 +236,11 @@ LIRGeneratorX86::visitAsmJSStoreHeap(MAsmJSStoreHeap *ins) { MDefinition *ptr = ins->ptr(); LAsmJSStoreHeap *lir; - JS_ASSERT(ptr->type() == MIRType_Int32); + MOZ_ASSERT(ptr->type() == MIRType_Int32); if (ptr->isConstant() && ins->skipBoundsCheck()) { int32_t ptrValue = ptr->toConstant()->value().toInt32(); - JS_ASSERT(ptrValue >= 0); + MOZ_ASSERT(ptrValue >= 0); LAllocation ptrAlloc = LAllocation(ptr->toConstant()->vp()); switch (ins->viewType()) { case Scalar::Int8: case Scalar::Uint8: diff --git a/js/src/jit/x86/MacroAssembler-x86.cpp b/js/src/jit/x86/MacroAssembler-x86.cpp index 23d1224fa1e0..90919d2bd2e2 100644 --- a/js/src/jit/x86/MacroAssembler-x86.cpp +++ b/js/src/jit/x86/MacroAssembler-x86.cpp @@ -38,7 +38,7 @@ MacroAssemblerX86::getDouble(double d) return nullptr; } Double &dbl = doubles_[doubleIndex]; - JS_ASSERT(!dbl.uses.bound()); + MOZ_ASSERT(!dbl.uses.bound()); return &dbl; } @@ -84,7 +84,7 @@ MacroAssemblerX86::getFloat(float f) return nullptr; } Float &flt = floats_[floatIndex]; - JS_ASSERT(!flt.uses.bound()); + MOZ_ASSERT(!flt.uses.bound()); return &flt; } @@ -130,20 +130,20 @@ MacroAssemblerX86::getSimdData(const SimdConstant &v) return nullptr; } SimdData &simd = simds_[index]; - JS_ASSERT(!simd.uses.bound()); + MOZ_ASSERT(!simd.uses.bound()); return &simd; } void MacroAssemblerX86::loadConstantInt32x4(const SimdConstant &v, FloatRegister dest) { - JS_ASSERT(v.type() == SimdConstant::Int32x4); + MOZ_ASSERT(v.type() == SimdConstant::Int32x4); if (maybeInlineInt32x4(v, dest)) return; SimdData *i4 = getSimdData(v); if (!i4) return; - JS_ASSERT(i4->type() == SimdConstant::Int32x4); + MOZ_ASSERT(i4->type() == SimdConstant::Int32x4); masm.movdqa_mr(reinterpret_cast(i4->uses.prev()), dest.code()); i4->uses.setPrev(masm.size()); } @@ -151,13 +151,13 @@ MacroAssemblerX86::loadConstantInt32x4(const SimdConstant &v, FloatRegister dest void MacroAssemblerX86::loadConstantFloat32x4(const SimdConstant &v, FloatRegister dest) { - JS_ASSERT(v.type() == SimdConstant::Float32x4); + MOZ_ASSERT(v.type() == SimdConstant::Float32x4); if (maybeInlineFloat32x4(v, dest)) return; SimdData *f4 = getSimdData(v); if (!f4) return; - JS_ASSERT(f4->type() == SimdConstant::Float32x4); + MOZ_ASSERT(f4->type() == SimdConstant::Float32x4); masm.movaps_mr(reinterpret_cast(f4->uses.prev()), dest.code()); f4->uses.setPrev(masm.size()); } @@ -205,7 +205,7 @@ MacroAssemblerX86::finish() void MacroAssemblerX86::setupABICall(uint32_t args) { - JS_ASSERT(!inCall_); + MOZ_ASSERT(!inCall_); inCall_ = true; args_ = args; @@ -261,8 +261,8 @@ MacroAssemblerX86::passABIArg(FloatRegister reg, MoveOp::Type type) void MacroAssemblerX86::callWithABIPre(uint32_t *stackAdjust) { - JS_ASSERT(inCall_); - JS_ASSERT(args_ == passedArgs_); + MOZ_ASSERT(inCall_); + MOZ_ASSERT(args_ == passedArgs_); if (dynamicAlignment_) { *stackAdjust = stackForCall_ @@ -317,7 +317,7 @@ MacroAssemblerX86::callWithABIPost(uint32_t stackAdjust, MoveOp::Type result) if (dynamicAlignment_) pop(esp); - JS_ASSERT(inCall_); + MOZ_ASSERT(inCall_); inCall_ = false; } @@ -447,7 +447,7 @@ MacroAssemblerX86::branchTestValue(Condition cond, const ValueOperand &value, co } bind(&done); } else { - JS_ASSERT(cond == NotEqual); + MOZ_ASSERT(cond == NotEqual); j(NotEqual, label); cmpl(value.typeReg(), Imm32(jv.s.tag)); @@ -490,9 +490,9 @@ void MacroAssemblerX86::branchPtrInNurseryRange(Condition cond, Register ptr, Register temp, Label *label) { - JS_ASSERT(cond == Assembler::Equal || cond == Assembler::NotEqual); - JS_ASSERT(ptr != temp); - JS_ASSERT(temp != InvalidReg); // A temp register is required for x86. + MOZ_ASSERT(cond == Assembler::Equal || cond == Assembler::NotEqual); + MOZ_ASSERT(ptr != temp); + MOZ_ASSERT(temp != InvalidReg); // A temp register is required for x86. const Nursery &nursery = GetIonContext()->runtime->gcNursery(); movePtr(ImmWord(-ptrdiff_t(nursery.start())), temp); @@ -505,7 +505,7 @@ void MacroAssemblerX86::branchValueIsNurseryObject(Condition cond, ValueOperand value, Register temp, Label *label) { - JS_ASSERT(cond == Assembler::Equal || cond == Assembler::NotEqual); + MOZ_ASSERT(cond == Assembler::Equal || cond == Assembler::NotEqual); Label done; diff --git a/js/src/jit/x86/MacroAssembler-x86.h b/js/src/jit/x86/MacroAssembler-x86.h index 152de502c3cd..ce285af7c100 100644 --- a/js/src/jit/x86/MacroAssembler-x86.h +++ b/js/src/jit/x86/MacroAssembler-x86.h @@ -186,14 +186,14 @@ class MacroAssemblerX86 : public MacroAssemblerX86Shared Register indexReg = (src.kind() == Operand::MEM_SCALE) ? Register::FromCode(src.index()) : InvalidReg; if (baseReg == val.payloadReg() || indexReg == val.payloadReg()) { - JS_ASSERT(baseReg != val.typeReg()); - JS_ASSERT(indexReg != val.typeReg()); + MOZ_ASSERT(baseReg != val.typeReg()); + MOZ_ASSERT(indexReg != val.typeReg()); movl(type, val.typeReg()); movl(payload, val.payloadReg()); } else { - JS_ASSERT(baseReg != val.payloadReg()); - JS_ASSERT(indexReg != val.payloadReg()); + MOZ_ASSERT(baseReg != val.payloadReg()); + MOZ_ASSERT(indexReg != val.payloadReg()); movl(payload, val.payloadReg()); movl(type, val.typeReg()); @@ -206,7 +206,7 @@ class MacroAssemblerX86 : public MacroAssemblerX86Shared loadValue(Operand(src), val); } void tagValue(JSValueType type, Register payload, ValueOperand dest) { - JS_ASSERT(dest.typeReg() != dest.payloadReg()); + MOZ_ASSERT(dest.typeReg() != dest.payloadReg()); if (payload != dest.payloadReg()) movl(payload, dest.payloadReg()); movl(ImmType(type), dest.typeReg()); @@ -270,78 +270,78 @@ class MacroAssemblerX86 : public MacroAssemblerX86Shared } Condition testUndefined(Condition cond, Register tag) { - JS_ASSERT(cond == Equal || cond == NotEqual); + MOZ_ASSERT(cond == Equal || cond == NotEqual); cmpl(tag, ImmTag(JSVAL_TAG_UNDEFINED)); return cond; } Condition testBoolean(Condition cond, Register tag) { - JS_ASSERT(cond == Equal || cond == NotEqual); + MOZ_ASSERT(cond == Equal || cond == NotEqual); cmpl(tag, ImmTag(JSVAL_TAG_BOOLEAN)); return cond; } Condition testInt32(Condition cond, Register tag) { - JS_ASSERT(cond == Equal || cond == NotEqual); + MOZ_ASSERT(cond == Equal || cond == NotEqual); cmpl(tag, ImmTag(JSVAL_TAG_INT32)); return cond; } Condition testDouble(Condition cond, Register tag) { - JS_ASSERT(cond == Assembler::Equal || cond == Assembler::NotEqual); + MOZ_ASSERT(cond == Assembler::Equal || cond == Assembler::NotEqual); Condition actual = (cond == Equal) ? Below : AboveOrEqual; cmpl(tag, ImmTag(JSVAL_TAG_CLEAR)); return actual; } Condition testNull(Condition cond, Register tag) { - JS_ASSERT(cond == Equal || cond == NotEqual); + MOZ_ASSERT(cond == Equal || cond == NotEqual); cmpl(tag, ImmTag(JSVAL_TAG_NULL)); return cond; } Condition testString(Condition cond, Register tag) { - JS_ASSERT(cond == Equal || cond == NotEqual); + MOZ_ASSERT(cond == Equal || cond == NotEqual); cmpl(tag, ImmTag(JSVAL_TAG_STRING)); return cond; } Condition testSymbol(Condition cond, Register tag) { - JS_ASSERT(cond == Equal || cond == NotEqual); + MOZ_ASSERT(cond == Equal || cond == NotEqual); cmpl(tag, ImmTag(JSVAL_TAG_SYMBOL)); return cond; } Condition testObject(Condition cond, Register tag) { - JS_ASSERT(cond == Equal || cond == NotEqual); + MOZ_ASSERT(cond == Equal || cond == NotEqual); cmpl(tag, ImmTag(JSVAL_TAG_OBJECT)); return cond; } Condition testNumber(Condition cond, Register tag) { - JS_ASSERT(cond == Equal || cond == NotEqual); + MOZ_ASSERT(cond == Equal || cond == NotEqual); cmpl(tag, ImmTag(JSVAL_UPPER_INCL_TAG_OF_NUMBER_SET)); return cond == Equal ? BelowOrEqual : Above; } Condition testGCThing(Condition cond, Register tag) { - JS_ASSERT(cond == Equal || cond == NotEqual); + MOZ_ASSERT(cond == Equal || cond == NotEqual); cmpl(tag, ImmTag(JSVAL_LOWER_INCL_TAG_OF_GCTHING_SET)); return cond == Equal ? AboveOrEqual : Below; } Condition testGCThing(Condition cond, const Address &address) { - JS_ASSERT(cond == Equal || cond == NotEqual); + MOZ_ASSERT(cond == Equal || cond == NotEqual); cmpl(tagOf(address), ImmTag(JSVAL_LOWER_INCL_TAG_OF_GCTHING_SET)); return cond == Equal ? AboveOrEqual : Below; } Condition testMagic(Condition cond, const Address &address) { - JS_ASSERT(cond == Equal || cond == NotEqual); + MOZ_ASSERT(cond == Equal || cond == NotEqual); cmpl(tagOf(address), ImmTag(JSVAL_TAG_MAGIC)); return cond; } Condition testMagic(Condition cond, Register tag) { - JS_ASSERT(cond == Equal || cond == NotEqual); + MOZ_ASSERT(cond == Equal || cond == NotEqual); cmpl(tag, ImmTag(JSVAL_TAG_MAGIC)); return cond; } Condition testMagic(Condition cond, const Operand &operand) { - JS_ASSERT(cond == Equal || cond == NotEqual); + MOZ_ASSERT(cond == Equal || cond == NotEqual); cmpl(ToType(operand), ImmTag(JSVAL_TAG_MAGIC)); return cond; } Condition testPrimitive(Condition cond, Register tag) { - JS_ASSERT(cond == Equal || cond == NotEqual); + MOZ_ASSERT(cond == Equal || cond == NotEqual); cmpl(tag, ImmTag(JSVAL_UPPER_EXCL_TAG_OF_PRIMITIVE_SET)); return cond == Equal ? Below : AboveOrEqual; } @@ -349,28 +349,28 @@ class MacroAssemblerX86 : public MacroAssemblerX86Shared return testMagic(cond, tag); } Condition testInt32(Condition cond, const Operand &operand) { - JS_ASSERT(cond == Equal || cond == NotEqual); + MOZ_ASSERT(cond == Equal || cond == NotEqual); cmpl(ToType(operand), ImmTag(JSVAL_TAG_INT32)); return cond; } Condition testInt32(Condition cond, const Address &address) { - JS_ASSERT(cond == Equal || cond == NotEqual); + MOZ_ASSERT(cond == Equal || cond == NotEqual); return testInt32(cond, Operand(address)); } Condition testDouble(Condition cond, const Operand &operand) { - JS_ASSERT(cond == Equal || cond == NotEqual); + MOZ_ASSERT(cond == Equal || cond == NotEqual); Condition actual = (cond == Equal) ? Below : AboveOrEqual; cmpl(ToType(operand), ImmTag(JSVAL_TAG_CLEAR)); return actual; } Condition testDouble(Condition cond, const Address &address) { - JS_ASSERT(cond == Equal || cond == NotEqual); + MOZ_ASSERT(cond == Equal || cond == NotEqual); return testDouble(cond, Operand(address)); } Condition testUndefined(Condition cond, const Operand &operand) { - JS_ASSERT(cond == Equal || cond == NotEqual); + MOZ_ASSERT(cond == Equal || cond == NotEqual); cmpl(ToType(operand), ImmTag(JSVAL_TAG_UNDEFINED)); return cond; } @@ -421,53 +421,53 @@ class MacroAssemblerX86 : public MacroAssemblerX86Shared Condition testUndefined(Condition cond, const BaseIndex &address) { - JS_ASSERT(cond == Equal || cond == NotEqual); + MOZ_ASSERT(cond == Equal || cond == NotEqual); cmpl(tagOf(address), ImmTag(JSVAL_TAG_UNDEFINED)); return cond; } Condition testNull(Condition cond, const BaseIndex &address) { - JS_ASSERT(cond == Equal || cond == NotEqual); + MOZ_ASSERT(cond == Equal || cond == NotEqual); cmpl(tagOf(address), ImmTag(JSVAL_TAG_NULL)); return cond; } Condition testBoolean(Condition cond, const BaseIndex &address) { - JS_ASSERT(cond == Equal || cond == NotEqual); + MOZ_ASSERT(cond == Equal || cond == NotEqual); cmpl(tagOf(address), ImmTag(JSVAL_TAG_BOOLEAN)); return cond; } Condition testString(Condition cond, const BaseIndex &address) { - JS_ASSERT(cond == Equal || cond == NotEqual); + MOZ_ASSERT(cond == Equal || cond == NotEqual); cmpl(tagOf(address), ImmTag(JSVAL_TAG_STRING)); return cond; } Condition testSymbol(Condition cond, const BaseIndex &address) { - JS_ASSERT(cond == Equal || cond == NotEqual); + MOZ_ASSERT(cond == Equal || cond == NotEqual); cmpl(tagOf(address), ImmTag(JSVAL_TAG_SYMBOL)); return cond; } Condition testInt32(Condition cond, const BaseIndex &address) { - JS_ASSERT(cond == Equal || cond == NotEqual); + MOZ_ASSERT(cond == Equal || cond == NotEqual); cmpl(tagOf(address), ImmTag(JSVAL_TAG_INT32)); return cond; } Condition testObject(Condition cond, const BaseIndex &address) { - JS_ASSERT(cond == Equal || cond == NotEqual); + MOZ_ASSERT(cond == Equal || cond == NotEqual); cmpl(tagOf(address), ImmTag(JSVAL_TAG_OBJECT)); return cond; } Condition testDouble(Condition cond, const BaseIndex &address) { - JS_ASSERT(cond == Equal || cond == NotEqual); + MOZ_ASSERT(cond == Equal || cond == NotEqual); Condition actual = (cond == Equal) ? Below : AboveOrEqual; cmpl(tagOf(address), ImmTag(JSVAL_TAG_CLEAR)); return actual; } Condition testMagic(Condition cond, const BaseIndex &address) { - JS_ASSERT(cond == Equal || cond == NotEqual); + MOZ_ASSERT(cond == Equal || cond == NotEqual); cmpl(tagOf(address), ImmTag(JSVAL_TAG_MAGIC)); return cond; } Condition testGCThing(Condition cond, const BaseIndex &address) { - JS_ASSERT(cond == Equal || cond == NotEqual); + MOZ_ASSERT(cond == Equal || cond == NotEqual); cmpl(tagOf(address), ImmTag(JSVAL_LOWER_INCL_TAG_OF_GCTHING_SET)); return cond == Equal ? AboveOrEqual : Below; } @@ -478,7 +478,7 @@ class MacroAssemblerX86 : public MacroAssemblerX86Shared void branchTestValue(Condition cond, const Address &valaddr, const ValueOperand &value, Label *label) { - JS_ASSERT(cond == Equal || cond == NotEqual); + MOZ_ASSERT(cond == Equal || cond == NotEqual); // Check payload before tag, since payload is more likely to differ. if (cond == NotEqual) { branchPtr(NotEqual, payloadOf(valaddr), value.payloadReg(), label); @@ -563,7 +563,7 @@ class MacroAssemblerX86 : public MacroAssemblerX86Shared framePushed_ += amount; } void freeStack(uint32_t amount) { - JS_ASSERT(amount <= framePushed_); + MOZ_ASSERT(amount <= framePushed_); if (amount) addl(Imm32(amount), StackPointer); framePushed_ -= amount; @@ -816,7 +816,7 @@ class MacroAssemblerX86 : public MacroAssemblerX86Shared void branchTestMagicValue(Condition cond, const ValueOperand &val, JSWhyMagic why, Label *label) { - JS_ASSERT(cond == Equal || cond == NotEqual); + MOZ_ASSERT(cond == Equal || cond == NotEqual); branchTestValue(cond, val, MagicValue(why), label); } @@ -853,7 +853,7 @@ class MacroAssemblerX86 : public MacroAssemblerX86Shared loadDouble(Operand(src), dest); } void unboxDouble(const ValueOperand &src, FloatRegister dest) { - JS_ASSERT(dest != ScratchDoubleReg); + MOZ_ASSERT(dest != ScratchDoubleReg); if (Assembler::HasSSE41()) { movd(src.payloadReg(), dest); pinsrd(1, src.typeReg(), dest); @@ -865,7 +865,7 @@ class MacroAssemblerX86 : public MacroAssemblerX86Shared } void unboxDouble(const Operand &payload, const Operand &type, Register scratch, FloatRegister dest) { - JS_ASSERT(dest != ScratchDoubleReg); + MOZ_ASSERT(dest != ScratchDoubleReg); if (Assembler::HasSSE41()) { movl(payload, scratch); movd(scratch, dest); diff --git a/js/src/jit/x86/Trampoline-x86.cpp b/js/src/jit/x86/Trampoline-x86.cpp index 5537c8f31a06..456c1032dceb 100644 --- a/js/src/jit/x86/Trampoline-x86.cpp +++ b/js/src/jit/x86/Trampoline-x86.cpp @@ -218,7 +218,7 @@ JitRuntime::generateEnterJIT(JSContext *cx, EnterJitType type) masm.pop(jitcode); masm.pop(framePtr); - JS_ASSERT(jitcode != ReturnReg); + MOZ_ASSERT(jitcode != ReturnReg); Label error; masm.addPtr(Imm32(IonExitFrameLayout::SizeWithFooter()), esp); @@ -361,7 +361,7 @@ JitRuntime::generateArgumentsRectifier(JSContext *cx, ExecutionMode mode, void * // ArgumentsRectifierReg contains the |nargs| pushed onto the current frame. // Including |this|, there are (|nargs| + 1) arguments to copy. - JS_ASSERT(ArgumentsRectifierReg == esi); + MOZ_ASSERT(ArgumentsRectifierReg == esi); // Load the number of |undefined|s to push into %ecx. masm.loadPtr(Address(esp, IonRectifierFrameLayout::offsetOfCalleeToken()), eax); @@ -593,8 +593,8 @@ JitRuntime::generateBailoutHandler(JSContext *cx, ExecutionMode mode) JitCode * JitRuntime::generateVMWrapper(JSContext *cx, const VMFunction &f) { - JS_ASSERT(functionWrappers_); - JS_ASSERT(functionWrappers_->initialized()); + MOZ_ASSERT(functionWrappers_); + MOZ_ASSERT(functionWrappers_->initialized()); VMWrapperMap::AddPtr p = functionWrappers_->lookupForAdd(&f); if (p) return p->value(); @@ -658,7 +658,7 @@ JitRuntime::generateVMWrapper(JSContext *cx, const VMFunction &f) break; default: - JS_ASSERT(f.outParam == Type_Void); + MOZ_ASSERT(f.outParam == Type_Void); break; } @@ -743,7 +743,7 @@ JitRuntime::generateVMWrapper(JSContext *cx, const VMFunction &f) break; default: - JS_ASSERT(f.outParam == Type_Void); + MOZ_ASSERT(f.outParam == Type_Void); break; } masm.leaveExitFrame(); @@ -783,7 +783,7 @@ JitRuntime::generatePreBarrier(JSContext *cx, MIRType type) } masm.PushRegsInMask(save); - JS_ASSERT(PreBarrierReg == edx); + MOZ_ASSERT(PreBarrierReg == edx); masm.movl(ImmPtr(cx->runtime()), ecx); masm.setupUnalignedABICall(2, eax); diff --git a/js/src/jsapi-tests/testCallNonGenericMethodOnProxy.cpp b/js/src/jsapi-tests/testCallNonGenericMethodOnProxy.cpp index f10bafd73d76..d1b1cede1217 100644 --- a/js/src/jsapi-tests/testCallNonGenericMethodOnProxy.cpp +++ b/js/src/jsapi-tests/testCallNonGenericMethodOnProxy.cpp @@ -29,7 +29,7 @@ IsCustomClass(JS::Handle v) static bool CustomMethodImpl(JSContext *cx, CallArgs args) { - JS_ASSERT(IsCustomClass(args.thisv())); + MOZ_ASSERT(IsCustomClass(args.thisv())); args.rval().set(JS_GetReservedSlot(&args.thisv().toObject(), CUSTOM_SLOT)); return true; } diff --git a/js/src/jsapi-tests/testLooselyEqual.cpp b/js/src/jsapi-tests/testLooselyEqual.cpp index 9527020b6c41..b1433e579394 100644 --- a/js/src/jsapi-tests/testLooselyEqual.cpp +++ b/js/src/jsapi-tests/testLooselyEqual.cpp @@ -63,8 +63,8 @@ struct LooseEqualityData #ifdef XP_WIN # define copysign _copysign #endif - JS_ASSERT(copysign(1.0, poszero.toDouble()) == 1.0); - JS_ASSERT(copysign(1.0, negzero.toDouble()) == -1.0); + MOZ_ASSERT(copysign(1.0, poszero.toDouble()) == 1.0); + MOZ_ASSERT(copysign(1.0, negzero.toDouble()) == -1.0); #ifdef XP_WIN # undef copysign #endif diff --git a/js/src/jsapi-tests/testOOM.cpp b/js/src/jsapi-tests/testOOM.cpp index 3fa6828a52be..9a69b7055826 100644 --- a/js/src/jsapi-tests/testOOM.cpp +++ b/js/src/jsapi-tests/testOOM.cpp @@ -13,7 +13,7 @@ BEGIN_TEST(testOOM) char16_t ch; if (!JS_GetStringCharAt(cx, jsstr, 0, &ch)) return false; - JS_ASSERT(ch == '9'); + MOZ_ASSERT(ch == '9'); return true; } diff --git a/js/src/jsapi-tests/testParseJSON.cpp b/js/src/jsapi-tests/testParseJSON.cpp index 29b95d1278b2..7b4bc5752276 100644 --- a/js/src/jsapi-tests/testParseJSON.cpp +++ b/js/src/jsapi-tests/testParseJSON.cpp @@ -330,9 +330,9 @@ static bool Censor(JSContext *cx, unsigned argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); - JS_ASSERT(args.length() == 2); + MOZ_ASSERT(args.length() == 2); #ifdef DEBUG - JS_ASSERT(args[0].isString()); + MOZ_ASSERT(args[0].isString()); #endif args.rval().setNull(); return true; diff --git a/js/src/jsapi-tests/testSetProperty.cpp b/js/src/jsapi-tests/testSetProperty.cpp index e7149136d431..04c476426532 100644 --- a/js/src/jsapi-tests/testSetProperty.cpp +++ b/js/src/jsapi-tests/testSetProperty.cpp @@ -67,7 +67,7 @@ BEGIN_TEST(testSetProperty_InheritedGlobalSetter) // This is a JSAPI test because jsapi-test globals do not have a resolve // hook and therefore can use the property cache in some cases where the // shell can't. - JS_ASSERT(JS_GetClass(global)->resolve == &JS_ResolveStub); + MOZ_ASSERT(JS_GetClass(global)->resolve == &JS_ResolveStub); CHECK(JS_DefineProperty(cx, global, "HOTLOOP", 8, 0)); EXEC("var n = 0;\n" diff --git a/js/src/jsapi-tests/tests.h b/js/src/jsapi-tests/tests.h index 3604e781f55b..85717b5d5fe2 100644 --- a/js/src/jsapi-tests/tests.h +++ b/js/src/jsapi-tests/tests.h @@ -68,9 +68,9 @@ class JSAPITest } virtual ~JSAPITest() { - JS_ASSERT(!rt); - JS_ASSERT(!cx); - JS_ASSERT(!global); + MOZ_ASSERT(!rt); + MOZ_ASSERT(!cx); + MOZ_ASSERT(!global); } virtual bool init(); @@ -290,8 +290,8 @@ class JSAPITest } virtual void destroyRuntime() { - JS_ASSERT(!cx); - JS_ASSERT(rt); + MOZ_ASSERT(!cx); + MOZ_ASSERT(rt); JS_DestroyRuntime(rt); } diff --git a/js/src/jsapi.cpp b/js/src/jsapi.cpp index a9d70c370d98..7500cecd8fc3 100644 --- a/js/src/jsapi.cpp +++ b/js/src/jsapi.cpp @@ -163,7 +163,7 @@ JS_GetEmptyStringValue(JSContext *cx) JS_PUBLIC_API(JSString *) JS_GetEmptyString(JSRuntime *rt) { - JS_ASSERT(rt->hasContexts()); + MOZ_ASSERT(rt->hasContexts()); return rt->emptyString; } @@ -172,7 +172,7 @@ namespace js { void AssertHeapIsIdle(JSRuntime *rt) { - JS_ASSERT(!rt->isHeapBusy()); + MOZ_ASSERT(!rt->isHeapBusy()); } void @@ -186,7 +186,7 @@ AssertHeapIsIdle(JSContext *cx) static void AssertHeapIsIdleOrIterating(JSRuntime *rt) { - JS_ASSERT(!rt->isHeapCollecting()); + MOZ_ASSERT(!rt->isHeapCollecting()); } static void @@ -468,7 +468,7 @@ JS_LooselyEqual(JSContext *cx, HandleValue value1, HandleValue value2, bool *equ AssertHeapIsIdle(cx); CHECK_REQUEST(cx); assertSameCompartment(cx, value1, value2); - JS_ASSERT(equal); + MOZ_ASSERT(equal); return LooselyEqual(cx, value1, value2, equal); } @@ -536,7 +536,7 @@ CheckMessageParameterCounts() // Assert that each message format has the correct number of braced // parameters. # define MSG_DEF(name, count, exception, format) \ - JS_ASSERT(MessageParameterCount(format) == count); + MOZ_ASSERT(MessageParameterCount(format) == count); # include "js.msg" # undef MSG_DEF } @@ -676,7 +676,7 @@ static void StartRequest(JSContext *cx) { JSRuntime *rt = cx->runtime(); - JS_ASSERT(CurrentThreadCanAccessRuntime(rt)); + MOZ_ASSERT(CurrentThreadCanAccessRuntime(rt)); if (rt->requestDepth) { rt->requestDepth++; @@ -691,9 +691,9 @@ static void StopRequest(JSContext *cx) { JSRuntime *rt = cx->runtime(); - JS_ASSERT(CurrentThreadCanAccessRuntime(rt)); + MOZ_ASSERT(CurrentThreadCanAccessRuntime(rt)); - JS_ASSERT(rt->requestDepth != 0); + MOZ_ASSERT(rt->requestDepth != 0); if (rt->requestDepth != 1) { rt->requestDepth--; } else { @@ -713,7 +713,7 @@ JS_BeginRequest(JSContext *cx) JS_PUBLIC_API(void) JS_EndRequest(JSContext *cx) { - JS_ASSERT(cx->outstandingRequests != 0); + MOZ_ASSERT(cx->outstandingRequests != 0); cx->outstandingRequests--; StopRequest(cx); } @@ -721,7 +721,7 @@ JS_EndRequest(JSContext *cx) JS_PUBLIC_API(bool) JS_IsInRequest(JSRuntime *rt) { - JS_ASSERT(CurrentThreadCanAccessRuntime(rt)); + MOZ_ASSERT(CurrentThreadCanAccessRuntime(rt)); return rt->requestDepth != 0; } @@ -741,14 +741,14 @@ JS_NewContext(JSRuntime *rt, size_t stackChunkSize) JS_PUBLIC_API(void) JS_DestroyContext(JSContext *cx) { - JS_ASSERT(!cx->compartment()); + MOZ_ASSERT(!cx->compartment()); DestroyContext(cx, DCM_FORCE_GC); } JS_PUBLIC_API(void) JS_DestroyContextNoGC(JSContext *cx) { - JS_ASSERT(!cx->compartment()); + MOZ_ASSERT(!cx->compartment()); DestroyContext(cx, DCM_NO_GC); } @@ -1059,9 +1059,9 @@ JS_PUBLIC_API(JSObject *) JS_TransplantObject(JSContext *cx, HandleObject origobj, HandleObject target) { AssertHeapIsIdle(cx); - JS_ASSERT(origobj != target); - JS_ASSERT(!origobj->is()); - JS_ASSERT(!target->is()); + MOZ_ASSERT(origobj != target); + MOZ_ASSERT(!origobj->is()); + MOZ_ASSERT(!target->is()); RootedValue origv(cx, ObjectValue(*origobj)); RootedObject newIdentity(cx); @@ -1108,7 +1108,7 @@ JS_TransplantObject(JSContext *cx, HandleObject origobj, HandleObject target) AutoCompartment ac(cx, origobj); if (!JS_WrapObject(cx, &newIdentityWrapper)) MOZ_CRASH(); - JS_ASSERT(Wrapper::wrappedObject(newIdentityWrapper) == newIdentity); + MOZ_ASSERT(Wrapper::wrappedObject(newIdentityWrapper) == newIdentity); if (!JSObject::swap(cx, origobj, newIdentityWrapper)) MOZ_CRASH(); origobj->compartment()->putWrapper(cx, CrossCompartmentKey(newIdentity), origv); @@ -1134,7 +1134,7 @@ JS_RefreshCrossCompartmentWrappers(JSContext *cx, HandleObject obj) JS_PUBLIC_API(bool) JS_InitStandardClasses(JSContext *cx, HandleObject obj) { - JS_ASSERT(!cx->runtime()->isAtomsCompartment(cx->compartment())); + MOZ_ASSERT(!cx->runtime()->isAtomsCompartment(cx->compartment())); AssertHeapIsIdle(cx); CHECK_REQUEST(cx); @@ -1638,7 +1638,7 @@ class DumpingTracer static void DumpNotify(JSTracer *trc, void **thingp, JSGCTraceKind kind) { - JS_ASSERT(trc->callback == DumpNotify); + MOZ_ASSERT(trc->callback == DumpNotify); DumpingTracer *dtrc = (DumpingTracer *)trc; void *thing = *thingp; @@ -1687,7 +1687,7 @@ DumpNotify(JSTracer *trc, void **thingp, JSGCTraceKind kind) node->parent = dtrc->parentNode; js_memcpy(node->edgeName, edgeName, edgeNameSize); - JS_ASSERT(!*dtrc->lastNodep); + MOZ_ASSERT(!*dtrc->lastNodep); *dtrc->lastNodep = node; dtrc->lastNodep = &node->next; } @@ -1775,7 +1775,7 @@ JS_DumpHeap(JSRuntime *rt, FILE *fp, void* startThing, JSGCTraceKind startKind, JSHeapDumpNode *node = nullptr; dtrc.lastNodep = &node; if (!startThing) { - JS_ASSERT(startKind == JSTRACE_OBJECT); + MOZ_ASSERT(startKind == JSTRACE_OBJECT); TraceRuntime(&dtrc.base); } else { JS_TraceChildren(&dtrc.base, startThing, startKind); @@ -1824,13 +1824,13 @@ JS_DumpHeap(JSRuntime *rt, FILE *fp, void* startThing, JSGCTraceKind startKind, break; if (!parent) return dtrc.ok; - JS_ASSERT(depth > 1); + MOZ_ASSERT(depth > 1); --depth; node = parent; } } - JS_ASSERT(depth == 1); + MOZ_ASSERT(depth == 1); return dtrc.ok; } @@ -1846,7 +1846,7 @@ JS_IsGCMarkingTracer(JSTracer *trc) extern JS_PUBLIC_API(bool) JS_IsMarkingGray(JSTracer *trc) { - JS_ASSERT(JS_IsGCMarkingTracer(trc)); + MOZ_ASSERT(JS_IsGCMarkingTracer(trc)); return trc->callback == GCMarker::GrayCallback; } #endif @@ -1928,13 +1928,13 @@ JS_GetGCParameter(JSRuntime *rt, JSGCParamKey key) JS_PUBLIC_API(void) JS_SetGCParameterForThread(JSContext *cx, JSGCParamKey key, uint32_t value) { - JS_ASSERT(key == JSGC_MAX_CODE_CACHE_BYTES); + MOZ_ASSERT(key == JSGC_MAX_CODE_CACHE_BYTES); } JS_PUBLIC_API(uint32_t) JS_GetGCParameterForThread(JSContext *cx, JSGCParamKey key) { - JS_ASSERT(key == JSGC_MAX_CODE_CACHE_BYTES); + MOZ_ASSERT(key == JSGC_MAX_CODE_CACHE_BYTES); return 0; } @@ -2029,7 +2029,7 @@ js::RecomputeStackLimit(JSRuntime *rt, StackKind kind) if (stackSize == 0) { rt->mainThread.nativeStackLimit[kind] = UINTPTR_MAX; } else { - JS_ASSERT(rt->nativeStackBase <= size_t(-1) - stackSize); + MOZ_ASSERT(rt->nativeStackBase <= size_t(-1) - stackSize); rt->mainThread.nativeStackLimit[kind] = rt->nativeStackBase + stackSize - 1; } @@ -2037,7 +2037,7 @@ js::RecomputeStackLimit(JSRuntime *rt, StackKind kind) if (stackSize == 0) { rt->mainThread.nativeStackLimit[kind] = 0; } else { - JS_ASSERT(rt->nativeStackBase >= stackSize); + MOZ_ASSERT(rt->nativeStackBase >= stackSize); rt->mainThread.nativeStackLimit[kind] = rt->nativeStackBase - (stackSize - 1); } @@ -2089,7 +2089,7 @@ JS_IdArrayLength(JSContext *cx, JSIdArray *ida) JS_PUBLIC_API(jsid) JS_IdArrayGet(JSContext *cx, JSIdArray *ida, unsigned index) { - JS_ASSERT(index < unsigned(ida->length)); + MOZ_ASSERT(index < unsigned(ida->length)); return ida->vector[index]; } @@ -2133,8 +2133,8 @@ JS_DefaultValue(JSContext *cx, HandleObject obj, JSType hint, MutableHandleValue { AssertHeapIsIdle(cx); CHECK_REQUEST(cx); - JS_ASSERT(obj != nullptr); - JS_ASSERT(hint == JSTYPE_VOID || hint == JSTYPE_STRING || hint == JSTYPE_NUMBER); + MOZ_ASSERT(obj != nullptr); + MOZ_ASSERT(hint == JSTYPE_VOID || hint == JSTYPE_STRING || hint == JSTYPE_NUMBER); return JSObject::defaultValue(cx, obj, hint, vp); } @@ -2172,8 +2172,8 @@ JS_ResolveStub(JSContext *cx, HandleObject obj, HandleId id) JS_PUBLIC_API(bool) JS_ConvertStub(JSContext *cx, HandleObject obj, JSType type, MutableHandleValue vp) { - JS_ASSERT(type != JSTYPE_OBJECT && type != JSTYPE_FUNCTION); - JS_ASSERT(obj); + MOZ_ASSERT(type != JSTYPE_OBJECT && type != JSTYPE_FUNCTION); + MOZ_ASSERT(obj); return DefaultValue(cx, obj, type, vp); } @@ -2280,7 +2280,7 @@ JS_SetPrototype(JSContext *cx, JS::Handle obj, JS::Handle JS_PUBLIC_API(JSObject *) JS_GetParent(JSObject *obj) { - JS_ASSERT(!obj->is()); + MOZ_ASSERT(!obj->is()); return obj->getParent(); } @@ -2289,8 +2289,8 @@ JS_SetParent(JSContext *cx, HandleObject obj, HandleObject parent) { AssertHeapIsIdle(cx); CHECK_REQUEST(cx); - JS_ASSERT(!obj->is()); - JS_ASSERT(parent || !obj->getParent()); + MOZ_ASSERT(!obj->is()); + MOZ_ASSERT(parent || !obj->getParent()); assertSameCompartment(cx, obj, parent); return JSObject::setParent(cx, obj, parent); @@ -2398,8 +2398,8 @@ JS_NewGlobalObject(JSContext *cx, const JSClass *clasp, JSPrincipals *principals { AssertHeapIsIdle(cx); CHECK_REQUEST(cx); - JS_ASSERT(!cx->runtime()->isAtomsCompartment(cx->compartment())); - JS_ASSERT(!cx->isExceptionPending()); + MOZ_ASSERT(!cx->runtime()->isAtomsCompartment(cx->compartment())); + MOZ_ASSERT(!cx->isExceptionPending()); JSRuntime *rt = cx->runtime(); @@ -2439,7 +2439,7 @@ JS_NewGlobalObject(JSContext *cx, const JSClass *clasp, JSPrincipals *principals JS_PUBLIC_API(void) JS_GlobalObjectTraceHook(JSTracer *trc, JSObject *global) { - JS_ASSERT(global->is()); + MOZ_ASSERT(global->is()); // Off thread parsing and compilation tasks create a dummy global which is then // merged back into the host compartment. Since it used to be a global, it will still @@ -2471,7 +2471,7 @@ JS_FireOnNewGlobalObject(JSContext *cx, JS::HandleObject global) JS_PUBLIC_API(JSObject *) JS_NewObject(JSContext *cx, const JSClass *jsclasp, HandleObject proto, HandleObject parent) { - JS_ASSERT(!cx->runtime()->isAtomsCompartment(cx->compartment())); + MOZ_ASSERT(!cx->runtime()->isAtomsCompartment(cx->compartment())); AssertHeapIsIdle(cx); CHECK_REQUEST(cx); assertSameCompartment(cx, proto, parent); @@ -2480,8 +2480,8 @@ JS_NewObject(JSContext *cx, const JSClass *jsclasp, HandleObject proto, HandleOb if (!clasp) clasp = &JSObject::class_; /* default class is Object */ - JS_ASSERT(clasp != &JSFunction::class_); - JS_ASSERT(!(clasp->flags & JSCLASS_IS_GLOBAL)); + MOZ_ASSERT(clasp != &JSFunction::class_); + MOZ_ASSERT(!(clasp->flags & JSCLASS_IS_GLOBAL)); JSObject *obj = NewObjectWithClassProto(cx, clasp, proto, parent); JS_ASSERT_IF(obj, obj->getParent()); @@ -2491,7 +2491,7 @@ JS_NewObject(JSContext *cx, const JSClass *jsclasp, HandleObject proto, HandleOb JS_PUBLIC_API(JSObject *) JS_NewObjectWithGivenProto(JSContext *cx, const JSClass *jsclasp, HandleObject proto, HandleObject parent) { - JS_ASSERT(!cx->runtime()->isAtomsCompartment(cx->compartment())); + MOZ_ASSERT(!cx->runtime()->isAtomsCompartment(cx->compartment())); AssertHeapIsIdle(cx); CHECK_REQUEST(cx); assertSameCompartment(cx, proto, parent); @@ -2500,8 +2500,8 @@ JS_NewObjectWithGivenProto(JSContext *cx, const JSClass *jsclasp, HandleObject p if (!clasp) clasp = &JSObject::class_; /* default class is Object */ - JS_ASSERT(clasp != &JSFunction::class_); - JS_ASSERT(!(clasp->flags & JSCLASS_IS_GLOBAL)); + MOZ_ASSERT(clasp != &JSFunction::class_); + MOZ_ASSERT(!(clasp->flags & JSCLASS_IS_GLOBAL)); JSObject *obj = NewObjectWithGivenProto(cx, clasp, proto, parent); if (obj) @@ -2823,7 +2823,7 @@ DefinePropertyById(JSContext *cx, HandleObject obj, HandleId id, HandleValue val // of something with JSNative property descriptors. If we are, wrap them in // JS Function objects. if (attrs & JSPROP_NATIVE_ACCESSORS) { - JS_ASSERT(!(attrs & (JSPROP_GETTER | JSPROP_SETTER))); + MOZ_ASSERT(!(attrs & (JSPROP_GETTER | JSPROP_SETTER))); JSFunction::Flags zeroFlags = JSAPIToJSFunctionFlags(0); // We can't just use JS_NewFunctionById here because it assumes a @@ -3037,7 +3037,7 @@ DefineSelfHostedProperty(JSContext *cx, { return false; } - JS_ASSERT(getterValue.isObject() && getterValue.toObject().is()); + MOZ_ASSERT(getterValue.isObject() && getterValue.toObject().is()); RootedFunction getterFunc(cx, &getterValue.toObject().as()); JSPropertyOp getterOp = JS_DATA_TO_FUNC_PTR(PropertyOp, getterFunc.get()); @@ -3053,7 +3053,7 @@ DefineSelfHostedProperty(JSContext *cx, { return false; } - JS_ASSERT(setterValue.isObject() && setterValue.toObject().is()); + MOZ_ASSERT(setterValue.isObject() && setterValue.toObject().is()); setterFunc = &getterValue.toObject().as(); } JSStrictPropertyOp setterOp = JS_DATA_TO_FUNC_PTR(StrictPropertyOp, setterFunc.get()); @@ -3265,7 +3265,7 @@ JS_DefineProperties(JSContext *cx, HandleObject obj, const JSPropertySpec *ps) if (ps->flags & JSPROP_NATIVE_ACCESSORS) { // If you declare native accessors, then you should have a native // getter. - JS_ASSERT(ps->getter.propertyOp.op); + MOZ_ASSERT(ps->getter.propertyOp.op); // If you do not have a self-hosted getter, you should not have a // self-hosted setter. This is the closest approximation to that // assertion we can have with our setup. @@ -3276,8 +3276,8 @@ JS_DefineProperties(JSContext *cx, HandleObject obj, const JSPropertySpec *ps) } else { // If you have self-hosted getter/setter, you can't have a // native one. - JS_ASSERT(!ps->getter.propertyOp.op && !ps->setter.propertyOp.op); - JS_ASSERT(ps->flags & JSPROP_GETTER); + MOZ_ASSERT(!ps->getter.propertyOp.op && !ps->setter.propertyOp.op); + MOZ_ASSERT(ps->flags & JSPROP_GETTER); ok = DefineSelfHostedProperty(cx, obj, ps->name, ps->getter.selfHosted.funname, @@ -3326,7 +3326,7 @@ GetPropertyDescriptorById(JSContext *cx, HandleObject obj, HandleId id, desc.setAttributes(shape->attributes()); desc.setGetter(shape->getter()); desc.setSetter(shape->setter()); - JS_ASSERT(desc.value().isUndefined()); + MOZ_ASSERT(desc.value().isUndefined()); if (shape->hasSlot()) desc.value().set(obj2->nativeGetSlot(shape->slot())); } @@ -3335,9 +3335,9 @@ GetPropertyDescriptorById(JSContext *cx, HandleObject obj, HandleId id, return Proxy::getPropertyDescriptor(cx, obj2, id, desc); if (!JSObject::getGenericAttributes(cx, obj2, id, &desc.attributesRef())) return false; - JS_ASSERT(desc.getter() == nullptr); - JS_ASSERT(desc.setter() == nullptr); - JS_ASSERT(desc.value().isUndefined()); + MOZ_ASSERT(desc.getter() == nullptr); + MOZ_ASSERT(desc.setter() == nullptr); + MOZ_ASSERT(desc.value().isUndefined()); } return true; } @@ -3723,14 +3723,14 @@ JS_NextProperty(JSContext *cx, HandleObject iterobj, MutableHandleId idp) int32_t i = iterobj->getSlot(JSSLOT_ITER_INDEX).toInt32(); if (i < 0) { /* Native case: private data is a property tree node pointer. */ - JS_ASSERT(iterobj->getParent()->isNative()); + MOZ_ASSERT(iterobj->getParent()->isNative()); Shape *shape = static_cast(iterobj->getPrivate()); while (shape->previous() && !shape->enumerable()) shape = shape->previous(); if (!shape->previous()) { - JS_ASSERT(shape->isEmptyShape()); + MOZ_ASSERT(shape->isEmptyShape()); idp.set(JSID_VOID); } else { iterobj->setPrivateGCThing(const_cast(shape->previous().get())); @@ -3739,7 +3739,7 @@ JS_NextProperty(JSContext *cx, HandleObject iterobj, MutableHandleId idp) } else { /* Non-native case: use the ida enumerated when iterobj was created. */ JSIdArray *ida = (JSIdArray *) iterobj->getPrivate(); - JS_ASSERT(i <= ida->length); + MOZ_ASSERT(i <= ida->length); STATIC_ASSUME(i <= ida->length); if (i == 0) { idp.set(JSID_VOID); @@ -3766,7 +3766,7 @@ JS_SetReservedSlot(JSObject *obj, uint32_t index, Value value) JS_PUBLIC_API(JSObject *) JS_NewArrayObject(JSContext *cx, const JS::HandleValueArray& contents) { - JS_ASSERT(!cx->runtime()->isAtomsCompartment(cx->compartment())); + MOZ_ASSERT(!cx->runtime()->isAtomsCompartment(cx->compartment())); AssertHeapIsIdle(cx); CHECK_REQUEST(cx); @@ -3777,7 +3777,7 @@ JS_NewArrayObject(JSContext *cx, const JS::HandleValueArray& contents) JS_PUBLIC_API(JSObject *) JS_NewArrayObject(JSContext *cx, size_t length) { - JS_ASSERT(!cx->runtime()->isAtomsCompartment(cx->compartment())); + MOZ_ASSERT(!cx->runtime()->isAtomsCompartment(cx->compartment())); AssertHeapIsIdle(cx); CHECK_REQUEST(cx); @@ -3835,7 +3835,7 @@ JS_DropPrincipals(JSRuntime *rt, JSPrincipals *principals) JS_PUBLIC_API(void) JS_SetSecurityCallbacks(JSRuntime *rt, const JSSecurityCallbacks *scb) { - JS_ASSERT(scb != &NullSecurityCallbacks); + MOZ_ASSERT(scb != &NullSecurityCallbacks); rt->securityCallbacks = scb ? scb : &NullSecurityCallbacks; } @@ -3854,8 +3854,8 @@ JS_SetTrustedPrincipals(JSRuntime *rt, const JSPrincipals *prin) extern JS_PUBLIC_API(void) JS_InitDestroyPrincipalsCallback(JSRuntime *rt, JSDestroyPrincipalsOp destroyPrincipals) { - JS_ASSERT(destroyPrincipals); - JS_ASSERT(!rt->destroyPrincipals); + MOZ_ASSERT(destroyPrincipals); + MOZ_ASSERT(!rt->destroyPrincipals); rt->destroyPrincipals = destroyPrincipals; } @@ -3863,7 +3863,7 @@ JS_PUBLIC_API(JSFunction *) JS_NewFunction(JSContext *cx, JSNative native, unsigned nargs, unsigned flags, HandleObject parent, const char *name) { - JS_ASSERT(!cx->runtime()->isAtomsCompartment(cx->compartment())); + MOZ_ASSERT(!cx->runtime()->isAtomsCompartment(cx->compartment())); AssertHeapIsIdle(cx); CHECK_REQUEST(cx); @@ -3884,9 +3884,9 @@ JS_PUBLIC_API(JSFunction *) JS_NewFunctionById(JSContext *cx, JSNative native, unsigned nargs, unsigned flags, HandleObject parent, HandleId id) { - JS_ASSERT(JSID_IS_STRING(id)); - JS_ASSERT(!cx->runtime()->isAtomsCompartment(cx->compartment())); - JS_ASSERT(native); + MOZ_ASSERT(JSID_IS_STRING(id)); + MOZ_ASSERT(!cx->runtime()->isAtomsCompartment(cx->compartment())); + MOZ_ASSERT(native); AssertHeapIsIdle(cx); CHECK_REQUEST(cx); assertSameCompartment(cx, parent); @@ -3899,8 +3899,8 @@ JS_NewFunctionById(JSContext *cx, JSNative native, unsigned nargs, unsigned flag JS_PUBLIC_API(JSFunction *) JS::GetSelfHostedFunction(JSContext *cx, const char *selfHostedName, HandleId id, unsigned nargs) { - JS_ASSERT(JSID_IS_STRING(id)); - JS_ASSERT(!cx->runtime()->isAtomsCompartment(cx->compartment())); + MOZ_ASSERT(JSID_IS_STRING(id)); + MOZ_ASSERT(!cx->runtime()->isAtomsCompartment(cx->compartment())); AssertHeapIsIdle(cx); CHECK_REQUEST(cx); @@ -4039,7 +4039,7 @@ js_generic_native_method_dispatcher(JSContext *cx, unsigned argc, Value *vp) const JSFunctionSpec *fs = (JSFunctionSpec *) args.callee().as().getExtendedSlot(0).toPrivate(); - JS_ASSERT((fs->flags & JSFUN_GENERIC_NATIVE) != 0); + MOZ_ASSERT((fs->flags & JSFUN_GENERIC_NATIVE) != 0); if (argc < 1) { js_ReportMissingArg(cx, args.calleev(), 0); @@ -4063,7 +4063,7 @@ js_generic_native_method_dispatcher(JSContext *cx, unsigned argc, Value *vp) JS_PUBLIC_API(bool) JS_DefineFunctions(JSContext *cx, HandleObject obj, const JSFunctionSpec *fs) { - JS_ASSERT(!cx->runtime()->isAtomsCompartment(cx->compartment())); + MOZ_ASSERT(!cx->runtime()->isAtomsCompartment(cx->compartment())); AssertHeapIsIdle(cx); CHECK_REQUEST(cx); assertSameCompartment(cx, obj); @@ -4093,7 +4093,7 @@ JS_DefineFunctions(JSContext *cx, HandleObject obj, const JSFunctionSpec *fs) // the prototype and constructor in the global slots before invoking // JS_DefineFunctions on the proto. JSProtoKey key = JSCLASS_CACHED_PROTO_KEY(obj->getClass()); - JS_ASSERT(obj == &obj->global().getPrototype(key).toObject()); + MOZ_ASSERT(obj == &obj->global().getPrototype(key).toObject()); RootedObject ctor(cx, &obj->global().getConstructor(key).toObject()); flags &= ~JSFUN_GENERIC_NATIVE; @@ -4118,8 +4118,8 @@ JS_DefineFunctions(JSContext *cx, HandleObject obj, const JSFunctionSpec *fs) * call paths then call InitializeLazyFunctionScript if !hasScript. */ if (fs->selfHostedName) { - JS_ASSERT(!fs->call.op); - JS_ASSERT(!fs->call.info); + MOZ_ASSERT(!fs->call.op); + MOZ_ASSERT(!fs->call.info); RootedAtom shName(cx, Atomize(cx, fs->selfHostedName, strlen(fs->selfHostedName))); if (!shName) @@ -4144,7 +4144,7 @@ JS_PUBLIC_API(JSFunction *) JS_DefineFunction(JSContext *cx, HandleObject obj, const char *name, JSNative call, unsigned nargs, unsigned attrs) { - JS_ASSERT(!cx->runtime()->isAtomsCompartment(cx->compartment())); + MOZ_ASSERT(!cx->runtime()->isAtomsCompartment(cx->compartment())); AssertHeapIsIdle(cx); CHECK_REQUEST(cx); assertSameCompartment(cx, obj); @@ -4160,7 +4160,7 @@ JS_DefineUCFunction(JSContext *cx, HandleObject obj, const char16_t *name, size_t namelen, JSNative call, unsigned nargs, unsigned attrs) { - JS_ASSERT(!cx->runtime()->isAtomsCompartment(cx->compartment())); + MOZ_ASSERT(!cx->runtime()->isAtomsCompartment(cx->compartment())); AssertHeapIsIdle(cx); CHECK_REQUEST(cx); assertSameCompartment(cx, obj); @@ -4175,7 +4175,7 @@ extern JS_PUBLIC_API(JSFunction *) JS_DefineFunctionById(JSContext *cx, HandleObject obj, HandleId id, JSNative call, unsigned nargs, unsigned attrs) { - JS_ASSERT(!cx->runtime()->isAtomsCompartment(cx->compartment())); + MOZ_ASSERT(!cx->runtime()->isAtomsCompartment(cx->compartment())); AssertHeapIsIdle(cx); CHECK_REQUEST(cx); assertSameCompartment(cx, obj); @@ -4188,7 +4188,7 @@ struct AutoLastFrameCheck MOZ_GUARD_OBJECT_NOTIFIER_PARAM) : cx(cx) { - JS_ASSERT(cx); + MOZ_ASSERT(cx); MOZ_GUARD_OBJECT_NOTIFIER_INIT; } @@ -4262,7 +4262,7 @@ class AutoFile bool open(JSContext *cx, const char *filename); bool readAll(JSContext *cx, FileContents &buffer) { - JS_ASSERT(fp_); + MOZ_ASSERT(fp_); return ReadCompleteFile(cx, fp_, buffer); } }; @@ -4427,7 +4427,7 @@ bool JS::Compile(JSContext *cx, HandleObject obj, const ReadOnlyCompileOptions &options, SourceBufferHolder &srcBuf, MutableHandleScript script) { - JS_ASSERT(!cx->runtime()->isAtomsCompartment(cx->compartment())); + MOZ_ASSERT(!cx->runtime()->isAtomsCompartment(cx->compartment())); AssertHeapIsIdle(cx); CHECK_REQUEST(cx); assertSameCompartment(cx, obj); @@ -4512,14 +4512,14 @@ JS::CompileOffThread(JSContext *cx, const ReadOnlyCompileOptions &options, const char16_t *chars, size_t length, OffThreadCompileCallback callback, void *callbackData) { - JS_ASSERT(CanCompileOffThread(cx, options, length)); + MOZ_ASSERT(CanCompileOffThread(cx, options, length)); return StartOffThreadParseScript(cx, options, chars, length, callback, callbackData); } JS_PUBLIC_API(JSScript *) JS::FinishOffThreadScript(JSContext *maybecx, JSRuntime *rt, void *token) { - JS_ASSERT(CurrentThreadCanAccessRuntime(rt)); + MOZ_ASSERT(CurrentThreadCanAccessRuntime(rt)); if (maybecx) { RootedScript script(maybecx); @@ -4588,7 +4588,7 @@ JS_BufferIsCompilableUnit(JSContext *cx, HandleObject obj, const char *utf8, siz JS_PUBLIC_API(JSObject *) JS_GetGlobalFromScript(JSScript *script) { - JS_ASSERT(!script->isCachedEval()); + MOZ_ASSERT(!script->isCachedEval()); return &script->global(); } @@ -4597,7 +4597,7 @@ JS::CompileFunction(JSContext *cx, HandleObject obj, const ReadOnlyCompileOption const char *name, unsigned nargs, const char *const *argnames, SourceBufferHolder &srcBuf, MutableHandleFunction fun) { - JS_ASSERT(!cx->runtime()->isAtomsCompartment(cx->compartment())); + MOZ_ASSERT(!cx->runtime()->isAtomsCompartment(cx->compartment())); AssertHeapIsIdle(cx); CHECK_REQUEST(cx); assertSameCompartment(cx, obj); @@ -4681,7 +4681,7 @@ JS_CompileFunction(JSContext *cx, JS::HandleObject obj, const char *name, JS_PUBLIC_API(JSString *) JS_DecompileScript(JSContext *cx, HandleScript script, const char *name, unsigned indent) { - JS_ASSERT(!cx->runtime()->isAtomsCompartment(cx->compartment())); + MOZ_ASSERT(!cx->runtime()->isAtomsCompartment(cx->compartment())); AssertHeapIsIdle(cx); CHECK_REQUEST(cx); @@ -4698,7 +4698,7 @@ JS_DecompileScript(JSContext *cx, HandleScript script, const char *name, unsigne JS_PUBLIC_API(JSString *) JS_DecompileFunction(JSContext *cx, HandleFunction fun, unsigned indent) { - JS_ASSERT(!cx->runtime()->isAtomsCompartment(cx->compartment())); + MOZ_ASSERT(!cx->runtime()->isAtomsCompartment(cx->compartment())); AssertHeapIsIdle(cx); CHECK_REQUEST(cx); assertSameCompartment(cx, fun); @@ -4708,7 +4708,7 @@ JS_DecompileFunction(JSContext *cx, HandleFunction fun, unsigned indent) JS_PUBLIC_API(JSString *) JS_DecompileFunctionBody(JSContext *cx, HandleFunction fun, unsigned indent) { - JS_ASSERT(!cx->runtime()->isAtomsCompartment(cx->compartment())); + MOZ_ASSERT(!cx->runtime()->isAtomsCompartment(cx->compartment())); AssertHeapIsIdle(cx); CHECK_REQUEST(cx); assertSameCompartment(cx, fun); @@ -4720,7 +4720,7 @@ ExecuteScript(JSContext *cx, HandleObject obj, HandleScript scriptArg, jsval *rv { RootedScript script(cx, scriptArg); - JS_ASSERT(!cx->runtime()->isAtomsCompartment(cx->compartment())); + MOZ_ASSERT(!cx->runtime()->isAtomsCompartment(cx->compartment())); AssertHeapIsIdle(cx); CHECK_REQUEST(cx); assertSameCompartment(cx, obj, scriptArg); @@ -4774,7 +4774,7 @@ Evaluate(JSContext *cx, HandleObject obj, const ReadOnlyCompileOptions &optionsA SourceBufferHolder &srcBuf, JS::Value *rval) { CompileOptions options(cx, optionsArg); - JS_ASSERT(!cx->runtime()->isAtomsCompartment(cx->compartment())); + MOZ_ASSERT(!cx->runtime()->isAtomsCompartment(cx->compartment())); AssertHeapIsIdle(cx); CHECK_REQUEST(cx); assertSameCompartment(cx, obj); @@ -4790,7 +4790,7 @@ Evaluate(JSContext *cx, HandleObject obj, const ReadOnlyCompileOptions &optionsA if (!script) return false; - JS_ASSERT(script->getVersion() == options.version); + MOZ_ASSERT(script->getVersion() == options.version); bool result = Execute(cx, script, *obj, rval); if (!sct.complete()) @@ -4951,7 +4951,7 @@ JS_PUBLIC_API(bool) JS_CallFunction(JSContext *cx, HandleObject obj, HandleFunction fun, const HandleValueArray& args, MutableHandleValue rval) { - JS_ASSERT(!cx->runtime()->isAtomsCompartment(cx->compartment())); + MOZ_ASSERT(!cx->runtime()->isAtomsCompartment(cx->compartment())); AssertHeapIsIdle(cx); CHECK_REQUEST(cx); assertSameCompartment(cx, obj, fun, args); @@ -4964,7 +4964,7 @@ JS_PUBLIC_API(bool) JS_CallFunctionName(JSContext *cx, HandleObject obj, const char *name, const HandleValueArray& args, MutableHandleValue rval) { - JS_ASSERT(!cx->runtime()->isAtomsCompartment(cx->compartment())); + MOZ_ASSERT(!cx->runtime()->isAtomsCompartment(cx->compartment())); AssertHeapIsIdle(cx); CHECK_REQUEST(cx); assertSameCompartment(cx, obj, args); @@ -4986,7 +4986,7 @@ JS_PUBLIC_API(bool) JS_CallFunctionValue(JSContext *cx, HandleObject obj, HandleValue fval, const HandleValueArray& args, MutableHandleValue rval) { - JS_ASSERT(!cx->runtime()->isAtomsCompartment(cx->compartment())); + MOZ_ASSERT(!cx->runtime()->isAtomsCompartment(cx->compartment())); AssertHeapIsIdle(cx); CHECK_REQUEST(cx); assertSameCompartment(cx, obj, fval, args); @@ -5160,8 +5160,8 @@ JS_StringHasBeenInterned(JSContext *cx, JSString *str) JS_PUBLIC_API(jsid) INTERNED_STRING_TO_JSID(JSContext *cx, JSString *str) { - JS_ASSERT(str); - JS_ASSERT(((size_t)str & JSID_TYPE_MASK) == 0); + MOZ_ASSERT(str); + MOZ_ASSERT(((size_t)str & JSID_TYPE_MASK) == 0); JS_ASSERT_IF(cx, JS_StringHasBeenInterned(cx, str)); return AtomToId(&str->asAtom()); } @@ -5258,7 +5258,7 @@ JS_PUBLIC_API(const JS::Latin1Char *) JS_GetLatin1StringCharsAndLength(JSContext *cx, const JS::AutoCheckCannotGC &nogc, JSString *str, size_t *plength) { - JS_ASSERT(plength); + MOZ_ASSERT(plength); AssertHeapIsIdleOrStringIsFlat(cx, str); CHECK_REQUEST(cx); assertSameCompartment(cx, str); @@ -5273,7 +5273,7 @@ JS_PUBLIC_API(const char16_t *) JS_GetTwoByteStringCharsAndLength(JSContext *cx, const JS::AutoCheckCannotGC &nogc, JSString *str, size_t *plength) { - JS_ASSERT(plength); + MOZ_ASSERT(plength); AssertHeapIsIdleOrStringIsFlat(cx, str); CHECK_REQUEST(cx); assertSameCompartment(cx, str); @@ -5330,7 +5330,7 @@ JS_CopyStringChars(JSContext *cx, mozilla::Range dest, JSString *str) JS_PUBLIC_API(const Latin1Char *) JS_Latin1InternedStringChars(const JS::AutoCheckCannotGC &nogc, JSString *str) { - JS_ASSERT(str->isAtom()); + MOZ_ASSERT(str->isAtom()); JSFlatString *flat = str->ensureFlat(nullptr); if (!flat) return nullptr; @@ -5340,7 +5340,7 @@ JS_Latin1InternedStringChars(const JS::AutoCheckCannotGC &nogc, JSString *str) JS_PUBLIC_API(const char16_t *) JS_GetTwoByteInternedStringChars(const JS::AutoCheckCannotGC &nogc, JSString *str) { - JS_ASSERT(str->isAtom()); + MOZ_ASSERT(str->isAtom()); JSFlatString *flat = str->ensureFlat(nullptr); if (!flat) return nullptr; @@ -5548,14 +5548,14 @@ JS_EncodeStringToBuffer(JSContext *cx, JSString *str, char *buffer, size_t lengt &writtenLength); } if (res) { - JS_ASSERT(writtenLength <= length); + MOZ_ASSERT(writtenLength <= length); return writtenLength; } - JS_ASSERT(writtenLength <= length); + MOZ_ASSERT(writtenLength <= length); size_t necessaryLength = str->length(); if (necessaryLength == size_t(-1)) return size_t(-1); - JS_ASSERT(writtenLength == length); // C strings are NOT encoded. + MOZ_ASSERT(writtenLength == length); // C strings are NOT encoded. return necessaryLength; } @@ -5875,7 +5875,7 @@ JS_ClearRegExpStatics(JSContext *cx, HandleObject obj) { AssertHeapIsIdle(cx); CHECK_REQUEST(cx); - JS_ASSERT(obj); + MOZ_ASSERT(obj); RegExpStatics *res = obj->as().getRegExpStatics(cx); if (!res) @@ -6045,7 +6045,7 @@ JS_ReportPendingException(JSContext *cx) // This can only fail due to oom. bool ok = js_ReportUncaughtException(cx); - JS_ASSERT(!cx->isExceptionPending()); + MOZ_ASSERT(!cx->isExceptionPending()); return ok; } @@ -6392,7 +6392,7 @@ GetScriptedCallerGlobal(JSContext *cx) // Noone should be running code in the atoms compartment or running code in // a compartment without any live objects, so there should definitely be a // live global. - JS_ASSERT(global); + MOZ_ASSERT(global); return global; } @@ -6439,7 +6439,7 @@ AutoGCRooter::AutoGCRooter(JSContext *cx, ptrdiff_t tag) tag_(tag), stackTop(&ContextFriendFields::get(cx)->autoGCRooters) { - JS_ASSERT(this != *stackTop); + MOZ_ASSERT(this != *stackTop); *stackTop = this; } @@ -6448,7 +6448,7 @@ AutoGCRooter::AutoGCRooter(ContextFriendFields *cx, ptrdiff_t tag) tag_(tag), stackTop(&cx->autoGCRooters) { - JS_ASSERT(this != *stackTop); + MOZ_ASSERT(this != *stackTop); *stackTop = this; } @@ -6540,7 +6540,7 @@ JS_PUBLIC_API(bool) JS::CaptureCurrentStack(JSContext *cx, JS::MutableHandleObject stackp, unsigned maxFrameCount) { JSCompartment *compartment = cx->compartment(); - JS_ASSERT(compartment); + MOZ_ASSERT(compartment); Rooted frame(cx); if (!compartment->savedStacks().saveCurrentStack(cx, &frame, maxFrameCount)) return false; diff --git a/js/src/jsapi.h b/js/src/jsapi.h index 7a2d52646f89..e60a495d208e 100644 --- a/js/src/jsapi.h +++ b/js/src/jsapi.h @@ -98,11 +98,11 @@ class AutoValueArray : public AutoGCRooter Value *begin() { return elements_; } HandleValue operator[](unsigned i) const { - JS_ASSERT(i < N); + MOZ_ASSERT(i < N); return HandleValue::fromMarkedLocation(&elements_[i]); } MutableHandleValue operator[](unsigned i) { - JS_ASSERT(i < N); + MOZ_ASSERT(i < N); return MutableHandleValue::fromMarkedLocation(&elements_[i]); } @@ -596,7 +596,7 @@ class HandleValueArray } static HandleValueArray subarray(const HandleValueArray& values, size_t startIndex, size_t len) { - JS_ASSERT(startIndex + len <= values.length()); + MOZ_ASSERT(startIndex + len <= values.length()); return HandleValueArray(len, values.begin() + startIndex); } @@ -608,7 +608,7 @@ class HandleValueArray const Value *begin() const { return elements_; } HandleValue operator[](size_t i) const { - JS_ASSERT(i < length_); + MOZ_ASSERT(i < length_); return HandleValue::fromMarkedLocation(&elements_[i]); } }; @@ -879,7 +879,7 @@ class MOZ_STACK_CLASS SourceBufferHolder MOZ_FINAL // the buffer. Taking and then free'ing an unowned buffer will have dire // consequences. char16_t *take() { - JS_ASSERT(ownsChars_); + MOZ_ASSERT(ownsChars_); ownsChars_ = false; return const_cast(data_); } @@ -1353,14 +1353,14 @@ class JSAutoCheckRequest { #ifdef JS_DEBUG mContext = cx; - JS_ASSERT(JS_IsInRequest(JS_GetRuntime(cx))); + MOZ_ASSERT(JS_IsInRequest(JS_GetRuntime(cx))); #endif MOZ_GUARD_OBJECT_NOTIFIER_INIT; } ~JSAutoCheckRequest() { #ifdef JS_DEBUG - JS_ASSERT(JS_IsInRequest(JS_GetRuntime(mContext))); + MOZ_ASSERT(JS_IsInRequest(JS_GetRuntime(mContext))); #endif } @@ -2252,7 +2252,7 @@ class AutoIdArray : private AutoGCRooter return !idArray; } jsid operator[](size_t i) const { - JS_ASSERT(idArray); + MOZ_ASSERT(idArray); return JS_IdArrayGet(context, idArray, unsigned(i)); } size_t length() const { @@ -2633,7 +2633,7 @@ class JS_PUBLIC_API(CompartmentOptions) Override &extraWarningsOverride() { return extraWarningsOverride_; } void *zonePointer() const { - JS_ASSERT(uintptr_t(zone_.pointer) > uintptr_t(JS::SystemZone)); + MOZ_ASSERT(uintptr_t(zone_.pointer) > uintptr_t(JS::SystemZone)); return zone_.pointer; } ZoneSpecifier zoneSpecifier() const { return zone_.spec; } @@ -4050,7 +4050,7 @@ static inline bool Call(JSContext *cx, JS::HandleValue thisv, JS::HandleObject funObj, const JS::HandleValueArray& args, MutableHandleValue rval) { - JS_ASSERT(funObj); + MOZ_ASSERT(funObj); JS::RootedValue fun(cx, JS::ObjectValue(*funObj)); return Call(cx, thisv, fun, args, rval); } @@ -4197,12 +4197,12 @@ JS_FileEscapedString(FILE *fp, JSString *str, char quote); * JSFlatString *fstr = JS_FlattenString(cx, str); * if (!fstr) * return false; - * JS_ASSERT(fstr == JS_ASSERT_STRING_IS_FLAT(str)); + * MOZ_ASSERT(fstr == JS_ASSERT_STRING_IS_FLAT(str)); * * // in an infallible context, for the same 'str' * AutoCheckCannotGC nogc; * const char16_t *chars = JS_GetTwoByteFlatStringChars(nogc, fstr) - * JS_ASSERT(chars); + * MOZ_ASSERT(chars); * * Flat strings and interned strings are always null-terminated, so * JS_FlattenString can be used to get a null-terminated string. @@ -4262,14 +4262,14 @@ JS_GetTwoByteFlatStringChars(const JS::AutoCheckCannotGC &nogc, JSFlatString *st static MOZ_ALWAYS_INLINE JSFlatString * JSID_TO_FLAT_STRING(jsid id) { - JS_ASSERT(JSID_IS_STRING(id)); + MOZ_ASSERT(JSID_IS_STRING(id)); return (JSFlatString *)(JSID_BITS(id)); } static MOZ_ALWAYS_INLINE JSFlatString * JS_ASSERT_STRING_IS_FLAT(JSString *str) { - JS_ASSERT(JS_StringIsFlat(str)); + MOZ_ASSERT(JS_StringIsFlat(str)); return (JSFlatString *)str; } @@ -4361,7 +4361,7 @@ class JSAutoByteString MOZ_GUARD_OBJECT_NOTIFIER_PARAM) : mBytes(JS_EncodeString(cx, str)) { - JS_ASSERT(cx); + MOZ_ASSERT(cx); MOZ_GUARD_OBJECT_NOTIFIER_INIT; } @@ -4377,13 +4377,13 @@ class JSAutoByteString /* Take ownership of the given byte array. */ void initBytes(char *bytes) { - JS_ASSERT(!mBytes); + MOZ_ASSERT(!mBytes); mBytes = bytes; } char *encodeLatin1(JSContext *cx, JSString *str) { - JS_ASSERT(!mBytes); - JS_ASSERT(cx); + MOZ_ASSERT(!mBytes); + MOZ_ASSERT(cx); mBytes = JS_EncodeString(cx, str); return mBytes; } @@ -4391,8 +4391,8 @@ class JSAutoByteString char *encodeLatin1(js::ExclusiveContext *cx, JSString *str); char *encodeUtf8(JSContext *cx, JS::HandleString str) { - JS_ASSERT(!mBytes); - JS_ASSERT(cx); + MOZ_ASSERT(!mBytes); + MOZ_ASSERT(cx); mBytes = JS_EncodeStringToUTF8(cx, str); return mBytes; } diff --git a/js/src/jsarray.cpp b/js/src/jsarray.cpp index dd221669cc54..5432342820d5 100644 --- a/js/src/jsarray.cpp +++ b/js/src/jsarray.cpp @@ -129,7 +129,7 @@ StringIsArrayIndex(const CharT *s, uint32_t length, uint32_t *indexp) /* Make sure we didn't overflow. */ if (previous < (MAX_ARRAY_INDEX / 10) || (previous == (MAX_ARRAY_INDEX / 10) && c <= (MAX_ARRAY_INDEX % 10))) { - JS_ASSERT(index <= MAX_ARRAY_INDEX); + MOZ_ASSERT(index <= MAX_ARRAY_INDEX); *indexp = index; return true; } @@ -197,8 +197,8 @@ template static void AssertGreaterThanZero(IndexType index) { - JS_ASSERT(index >= 0); - JS_ASSERT(index == floor(index)); + MOZ_ASSERT(index >= 0); + MOZ_ASSERT(index == floor(index)); } template<> @@ -280,7 +280,7 @@ js::GetElements(JSContext *cx, HandleObject aobj, uint32_t length, Value *vp) static bool SetArrayElement(JSContext *cx, HandleObject obj, double index, HandleValue v) { - JS_ASSERT(index >= 0); + MOZ_ASSERT(index >= 0); if (obj->is() && !obj->isIndexed()) { Rooted arr(cx, &obj->as()); @@ -306,7 +306,7 @@ SetArrayElement(JSContext *cx, HandleObject obj, double index, HandleValue v) if (result == JSObject::ED_FAILED) return false; - JS_ASSERT(result == JSObject::ED_SPARSE); + MOZ_ASSERT(result == JSObject::ED_SPARSE); } RootedId id(cx); @@ -332,8 +332,8 @@ SetArrayElement(JSContext *cx, HandleObject obj, double index, HandleValue v) static bool DeleteArrayElement(JSContext *cx, HandleObject obj, double index, bool *succeeded) { - JS_ASSERT(index >= 0); - JS_ASSERT(floor(index) == index); + MOZ_ASSERT(index >= 0); + MOZ_ASSERT(floor(index) == index); if (obj->is() && !obj->isIndexed()) { if (index <= UINT32_MAX) { @@ -827,7 +827,7 @@ js::ObjectMayHaveExtraIndexedProperties(JSObject *obj) * and indexed properties or elements along its prototype chain. */ - JS_ASSERT(obj->isNative()); + MOZ_ASSERT(obj->isNative()); if (obj->isIndexed()) return true; @@ -867,7 +867,7 @@ AddLengthProperty(ExclusiveContext *cx, HandleObject obj) */ RootedId lengthId(cx, NameToId(cx->names().length)); - JS_ASSERT(!obj->nativeLookup(cx, lengthId)); + MOZ_ASSERT(!obj->nativeLookup(cx, lengthId)); return JSObject::addProperty(cx, obj, lengthId, array_length_getter, array_length_setter, SHAPE_INVALID_SLOT, JSPROP_PERMANENT | JSPROP_SHARED, 0, @@ -1015,7 +1015,7 @@ ArrayJoinKernel(JSContext *cx, SeparatorOp sepOp, HandleObject obj, uint32_t len */ break; } else { - JS_ASSERT(elem.isMagic(JS_ELEMENTS_HOLE) || elem.isNullOrUndefined()); + MOZ_ASSERT(elem.isMagic(JS_ELEMENTS_HOLE) || elem.isNullOrUndefined()); } if (++i != length && !sepOp(cx, sb)) @@ -1248,7 +1248,7 @@ enum ShouldUpdateTypes static bool InitArrayElements(JSContext *cx, HandleObject obj, uint32_t start, uint32_t count, const Value *vector, ShouldUpdateTypes updateTypes) { - JS_ASSERT(count <= MAX_ARRAY_INDEX); + MOZ_ASSERT(count <= MAX_ARRAY_INDEX); if (count == 0) return true; @@ -1282,7 +1282,7 @@ InitArrayElements(JSContext *cx, HandleObject obj, uint32_t start, uint32_t coun if (result != JSObject::ED_OK) { if (result == JSObject::ED_FAILED) return false; - JS_ASSERT(result == JSObject::ED_SPARSE); + MOZ_ASSERT(result == JSObject::ED_SPARSE); break; } @@ -1290,7 +1290,7 @@ InitArrayElements(JSContext *cx, HandleObject obj, uint32_t start, uint32_t coun if (newlen > arr->length()) arr->setLengthInt32(newlen); - JS_ASSERT(count < UINT32_MAX / sizeof(Value)); + MOZ_ASSERT(count < UINT32_MAX / sizeof(Value)); arr->copyDenseElements(start, vector, count); JS_ASSERT_IF(count != 0, !arr->getDenseElement(newlen - 1).isMagic(JS_ELEMENTS_HOLE)); return true; @@ -1307,7 +1307,7 @@ InitArrayElements(JSContext *cx, HandleObject obj, uint32_t start, uint32_t coun if (vector == end) return true; - JS_ASSERT(start == MAX_ARRAY_INDEX + 1); + MOZ_ASSERT(start == MAX_ARRAY_INDEX + 1); RootedValue value(cx); RootedId id(cx); RootedValue indexv(cx); @@ -1363,7 +1363,7 @@ array_reverse(JSContext *cx, unsigned argc, Value *vp) if (result != JSObject::ED_OK) { if (result == JSObject::ED_FAILED) return false; - JS_ASSERT(result == JSObject::ED_SPARSE); + MOZ_ASSERT(result == JSObject::ED_SPARSE); break; } @@ -1499,10 +1499,10 @@ CompareLexicographicInt32(const Value &a, const Value &b, bool *lessOrEqualp) if (digitsa == digitsb) { *lessOrEqualp = (auint <= buint); } else if (digitsa > digitsb) { - JS_ASSERT((digitsa - digitsb) < ArrayLength(powersOf10)); + MOZ_ASSERT((digitsa - digitsb) < ArrayLength(powersOf10)); *lessOrEqualp = (uint64_t(auint) < uint64_t(buint) * powersOf10[digitsa - digitsb]); } else { /* if (digitsb > digitsa) */ - JS_ASSERT((digitsb - digitsa) < ArrayLength(powersOf10)); + MOZ_ASSERT((digitsb - digitsa) < ArrayLength(powersOf10)); *lessOrEqualp = (uint64_t(auint) * powersOf10[digitsb - digitsa] <= uint64_t(buint)); } } @@ -1597,8 +1597,8 @@ SortComparatorFunction::operator()(const Value &a, const Value &b, bool *lessOrE * array_sort deals with holes and undefs on its own and they should not * come here. */ - JS_ASSERT(!a.isMagic() && !a.isUndefined()); - JS_ASSERT(!a.isMagic() && !b.isUndefined()); + MOZ_ASSERT(!a.isMagic() && !a.isUndefined()); + MOZ_ASSERT(!a.isMagic() && !b.isUndefined()); if (!CheckForInterrupt(cx)) return false; @@ -1799,7 +1799,7 @@ MergeSortByKey(K keys, size_t len, K scratch, C comparator, AutoValueVector *vec static bool SortLexicographically(JSContext *cx, AutoValueVector *vec, size_t len) { - JS_ASSERT(vec->length() >= len); + MOZ_ASSERT(vec->length() >= len); StringBuffer sb(cx); Vector strElements(cx); @@ -1839,7 +1839,7 @@ SortLexicographically(JSContext *cx, AutoValueVector *vec, size_t len) static bool SortNumerically(JSContext *cx, AutoValueVector *vec, size_t len, ComparatorMatchResult comp) { - JS_ASSERT(vec->length() >= len); + MOZ_ASSERT(vec->length() >= len); Vector numElements(cx); @@ -2041,11 +2041,11 @@ js::NewbornArrayPush(JSContext *cx, HandleObject obj, const Value &v) { Rooted arr(cx, &obj->as()); - JS_ASSERT(!v.isMagic()); - JS_ASSERT(arr->lengthIsWritable()); + MOZ_ASSERT(!v.isMagic()); + MOZ_ASSERT(arr->lengthIsWritable()); uint32_t length = arr->length(); - JS_ASSERT(length <= arr->getDenseCapacity()); + MOZ_ASSERT(length <= arr->getDenseCapacity()); if (!arr->ensureElements(cx, length + 1)) return false; @@ -2154,8 +2154,8 @@ js::array_pop(JSContext *cx, unsigned argc, Value *vp) void js::ArrayShiftMoveElements(JSObject *obj) { - JS_ASSERT(obj->is()); - JS_ASSERT(obj->as().lengthIsWritable()); + MOZ_ASSERT(obj->is()); + MOZ_ASSERT(obj->as().lengthIsWritable()); /* * At this point the length and initialized length have already been @@ -2274,7 +2274,7 @@ js::array_unshift(JSContext *cx, unsigned argc, Value *vp) if (result != JSObject::ED_OK) { if (result == JSObject::ED_FAILED) return false; - JS_ASSERT(result == JSObject::ED_SPARSE); + MOZ_ASSERT(result == JSObject::ED_SPARSE); break; } obj->moveDenseElements(args.length(), 0, length); @@ -2327,7 +2327,7 @@ TryReuseArrayType(JSObject *obj, ArrayObject *narr) * as obj. This can only be performed if the original object is an array * and has the same prototype. */ - JS_ASSERT(narr->getProto()->hasNewType(&ArrayObject::class_, narr->type())); + MOZ_ASSERT(narr->getProto()->hasNewType(&ArrayObject::class_, narr->type())); if (obj->is() && !obj->hasSingletonType() && obj->getProto() == narr->getProto()) narr->setType(obj->type()); @@ -2427,7 +2427,7 @@ js::array_splice_impl(JSContext *cx, unsigned argc, Value *vp, bool returnValueI actualDeleteCount = len - actualStart; } - JS_ASSERT(len - actualStart >= actualDeleteCount); + MOZ_ASSERT(len - actualStart >= actualDeleteCount); /* Steps 2, 8-9. */ Rooted arr(cx); @@ -2606,10 +2606,10 @@ js::array_concat_dense(JSContext *cx, Handle arr1, Handle result) { uint32_t initlen1 = arr1->getDenseInitializedLength(); - JS_ASSERT(initlen1 == arr1->length()); + MOZ_ASSERT(initlen1 == arr1->length()); uint32_t initlen2 = arr2->getDenseInitializedLength(); - JS_ASSERT(initlen2 == arr2->length()); + MOZ_ASSERT(initlen2 == arr2->length()); /* No overflow here due to nelements limit. */ uint32_t len = initlen1 + initlen2; @@ -2617,7 +2617,7 @@ js::array_concat_dense(JSContext *cx, Handle arr1, HandleensureElements(cx, len)) return false; - JS_ASSERT(!result->getDenseInitializedLength()); + MOZ_ASSERT(!result->getDenseInitializedLength()); result->setDenseInitializedLength(len); result->initDenseElements(0, arr1->getDenseElements(), initlen1); @@ -2779,7 +2779,7 @@ js::array_slice(JSContext *cx, unsigned argc, Value *vp) } // Fallthrough - JS_ASSERT(result == JSObject::ED_SPARSE); + MOZ_ASSERT(result == JSObject::ED_SPARSE); } @@ -2852,7 +2852,7 @@ array_filter(JSContext *cx, unsigned argc, Value *vp) uint32_t to = 0; /* Step 9. */ - JS_ASSERT(!InParallelSection()); + MOZ_ASSERT(!InParallelSection()); FastInvokeGuard fig(cx, ObjectValue(*callable)); InvokeArgs &args2 = fig.args(); RootedValue kValue(cx); @@ -3101,7 +3101,7 @@ js_Array(JSContext *cx, unsigned argc, Value *vp) static JSObject * CreateArrayPrototype(JSContext *cx, JSProtoKey key) { - JS_ASSERT(key == JSProto_Array); + MOZ_ASSERT(key == JSProto_Array); RootedObject proto(cx, cx->global()->getOrCreateObjectPrototype(cx)); if (!proto) return nullptr; @@ -3186,7 +3186,7 @@ NewArray(ExclusiveContext *cxArg, uint32_t length, JSObject *protoArg, NewObjectKind newKind = GenericObject) { gc::AllocKind allocKind = GuessArrayGCKind(length); - JS_ASSERT(CanBeFinalizedInBackground(allocKind, &ArrayObject::class_)); + MOZ_ASSERT(CanBeFinalizedInBackground(allocKind, &ArrayObject::class_)); allocKind = GetBackgroundAllocKind(allocKind); NewObjectCache::EntryIndex entry = -1; @@ -3212,7 +3212,7 @@ NewArray(ExclusiveContext *cxArg, uint32_t length, } else { RootedObject proto(cxArg, protoArg); obj = cache.newObjectFromHit(cx, entry, heap); - JS_ASSERT(!obj); + MOZ_ASSERT(!obj); protoArg = proto; } } @@ -3315,7 +3315,7 @@ js::NewDenseArray(ExclusiveContext *cx, uint32_t length, HandleTypeObject type, } else if (allocating == NewArray_PartlyAllocating) { arr = NewDensePartlyAllocatedArray(cx, length, nullptr, newKind); } else { - JS_ASSERT(allocating == NewArray_FullyAllocating); + MOZ_ASSERT(allocating == NewArray_FullyAllocating); arr = NewDenseFullyAllocatedArray(cx, length, nullptr, newKind); } if (!arr) @@ -3336,13 +3336,13 @@ ArrayObject * js::NewDenseCopiedArray(JSContext *cx, uint32_t length, HandleObject src, uint32_t elementOffset, JSObject *proto /* = nullptr */) { - JS_ASSERT(!src->isIndexed()); + MOZ_ASSERT(!src->isIndexed()); ArrayObject* arr = NewArray(cx, length, proto); if (!arr) return nullptr; - JS_ASSERT(arr->getDenseCapacity() >= length); + MOZ_ASSERT(arr->getDenseCapacity() >= length); const Value* vp = src->getDenseElements() + elementOffset; arr->setDenseInitializedLength(vp ? length : 0); @@ -3362,7 +3362,7 @@ js::NewDenseCopiedArray(JSContext *cx, uint32_t length, const Value *values, if (!arr) return nullptr; - JS_ASSERT(arr->getDenseCapacity() >= length); + MOZ_ASSERT(arr->getDenseCapacity() >= length); arr->setDenseInitializedLength(values ? length : 0); @@ -3376,7 +3376,7 @@ ArrayObject * js::NewDenseFullyAllocatedArrayWithTemplate(JSContext *cx, uint32_t length, JSObject *templateObject) { gc::AllocKind allocKind = GuessArrayGCKind(length); - JS_ASSERT(CanBeFinalizedInBackground(allocKind, &ArrayObject::class_)); + MOZ_ASSERT(CanBeFinalizedInBackground(allocKind, &ArrayObject::class_)); allocKind = GetBackgroundAllocKind(allocKind); RootedTypeObject type(cx, templateObject->type()); @@ -3400,7 +3400,7 @@ js::NewDenseCopyOnWriteArray(JSContext *cx, HandleObject templateObject, gc::Ini { RootedShape shape(cx, templateObject->lastProperty()); - JS_ASSERT(!gc::IsInsideNursery(templateObject)); + MOZ_ASSERT(!gc::IsInsideNursery(templateObject)); JSObject *metadata = nullptr; if (!NewObjectMetadata(cx, &metadata)) diff --git a/js/src/jsarray.h b/js/src/jsarray.h index 1a960640e7e8..762e74e55e15 100644 --- a/js/src/jsarray.h +++ b/js/src/jsarray.h @@ -22,7 +22,7 @@ js_IdIsIndex(jsid id, uint32_t *indexp) { if (JSID_IS_INT(id)) { int32_t i = JSID_TO_INT(id); - JS_ASSERT(i >= 0); + MOZ_ASSERT(i >= 0); *indexp = (uint32_t)i; return true; } diff --git a/js/src/jsatom.cpp b/js/src/jsatom.cpp index 6d11272e5dae..50baad4b1506 100644 --- a/js/src/jsatom.cpp +++ b/js/src/jsatom.cpp @@ -148,7 +148,7 @@ JSRuntime::initializeAtoms(JSContext *cx) return false; names->init(atom->asPropertyName()); } - JS_ASSERT(uintptr_t(names) == uintptr_t(commonNames + 1)); + MOZ_ASSERT(uintptr_t(names) == uintptr_t(commonNames + 1)); emptyString = commonNames->empty; @@ -267,12 +267,12 @@ JSRuntime::sweepAtoms() bool JSRuntime::transformToPermanentAtoms() { - JS_ASSERT(!parentRuntime); + MOZ_ASSERT(!parentRuntime); // All static strings were created as permanent atoms, now move the contents // of the atoms table into permanentAtoms and mark each as permanent. - JS_ASSERT(permanentAtoms && permanentAtoms->empty()); + MOZ_ASSERT(permanentAtoms && permanentAtoms->empty()); AtomSet *temp = atoms_; atoms_ = permanentAtoms; @@ -385,9 +385,9 @@ js::AtomizeString(ExclusiveContext *cx, JSString *str, AutoLockForExclusiveAccess lock(cx); p = cx->atoms().lookup(lookup); - JS_ASSERT(p); /* Non-static atom must exist in atom state set. */ - JS_ASSERT(p->asPtr() == &atom); - JS_ASSERT(ib == InternAtom); + MOZ_ASSERT(p); /* Non-static atom must exist in atom state set. */ + MOZ_ASSERT(p->asPtr() == &atom); + MOZ_ASSERT(ib == InternAtom); p->setTagged(bool(ib)); return &atom; } @@ -435,7 +435,7 @@ js::AtomizeChars(ExclusiveContext *cx, const char16_t *chars, size_t length, Int bool js::IndexToIdSlow(ExclusiveContext *cx, uint32_t index, MutableHandleId idp) { - JS_ASSERT(index > JSID_INT_MAX); + MOZ_ASSERT(index > JSID_INT_MAX); char16_t buf[UINT32_CHAR_BUFFER_LENGTH]; RangedPtr end(ArrayEnd(buf), buf, ArrayEnd(buf)); @@ -453,7 +453,7 @@ template static JSAtom * ToAtomSlow(ExclusiveContext *cx, typename MaybeRooted::HandleType arg) { - JS_ASSERT(!arg.isString()); + MOZ_ASSERT(!arg.isString()); Value v = arg; if (!v.isPrimitive()) { diff --git a/js/src/jsatom.h b/js/src/jsatom.h index 20fa666d3909..4bda550cfdba 100644 --- a/js/src/jsatom.h +++ b/js/src/jsatom.h @@ -64,7 +64,7 @@ class AtomStateEntry AtomStateEntry(JSAtom *ptr, bool tagged) : bits(uintptr_t(ptr) | uintptr_t(tagged)) { - JS_ASSERT((uintptr_t(ptr) & 0x1) == 0); + MOZ_ASSERT((uintptr_t(ptr) & 0x1) == 0); } bool isTagged() const { diff --git a/js/src/jsatominlines.h b/js/src/jsatominlines.h index 2b7b6da49726..f0aa8c2b17dd 100644 --- a/js/src/jsatominlines.h +++ b/js/src/jsatominlines.h @@ -20,7 +20,7 @@ inline JSAtom * js::AtomStateEntry::asPtr() const { - JS_ASSERT(bits != 0); + MOZ_ASSERT(bits != 0); JSAtom *atom = reinterpret_cast(bits & NO_TAG_MASK); JSString::readBarrier(atom); return atom; @@ -183,7 +183,7 @@ AtomHasher::match(const AtomStateEntry &entry, const Lookup &lookup) inline Handle TypeName(JSType type, const JSAtomState &names) { - JS_ASSERT(type < JSTYPE_LIMIT); + MOZ_ASSERT(type < JSTYPE_LIMIT); JS_STATIC_ASSERT(offsetof(JSAtomState, undefined) + JSTYPE_LIMIT * sizeof(ImmutablePropertyNamePtr) <= sizeof(JSAtomState)); @@ -194,7 +194,7 @@ TypeName(JSType type, const JSAtomState &names) inline Handle ClassName(JSProtoKey key, JSAtomState &atomState) { - JS_ASSERT(key < JSProto_LIMIT); + MOZ_ASSERT(key < JSProto_LIMIT); JS_STATIC_ASSERT(offsetof(JSAtomState, Null) + JSProto_LIMIT * sizeof(ImmutablePropertyNamePtr) <= sizeof(JSAtomState)); diff --git a/js/src/jsbool.cpp b/js/src/jsbool.cpp index 474e34dcc0cf..266ba60ec5d1 100644 --- a/js/src/jsbool.cpp +++ b/js/src/jsbool.cpp @@ -48,7 +48,7 @@ MOZ_ALWAYS_INLINE bool bool_toSource_impl(JSContext *cx, CallArgs args) { HandleValue thisv = args.thisv(); - JS_ASSERT(IsBoolean(thisv)); + MOZ_ASSERT(IsBoolean(thisv)); bool b = thisv.isBoolean() ? thisv.toBoolean() : thisv.toObject().as().unbox(); @@ -75,7 +75,7 @@ MOZ_ALWAYS_INLINE bool bool_toString_impl(JSContext *cx, CallArgs args) { HandleValue thisv = args.thisv(); - JS_ASSERT(IsBoolean(thisv)); + MOZ_ASSERT(IsBoolean(thisv)); bool b = thisv.isBoolean() ? thisv.toBoolean() : thisv.toObject().as().unbox(); args.rval().setString(js_BooleanToString(cx, b)); @@ -93,7 +93,7 @@ MOZ_ALWAYS_INLINE bool bool_valueOf_impl(JSContext *cx, CallArgs args) { HandleValue thisv = args.thisv(); - JS_ASSERT(IsBoolean(thisv)); + MOZ_ASSERT(IsBoolean(thisv)); bool b = thisv.isBoolean() ? thisv.toBoolean() : thisv.toObject().as().unbox(); args.rval().setBoolean(b); @@ -136,7 +136,7 @@ Boolean(JSContext *cx, unsigned argc, Value *vp) JSObject * js_InitBooleanClass(JSContext *cx, HandleObject obj) { - JS_ASSERT(obj->isNative()); + MOZ_ASSERT(obj->isNative()); Rooted global(cx, &obj->as()); @@ -187,7 +187,7 @@ js::ToBooleanSlow(HandleValue v) if (v.isString()) return v.toString()->length() != 0; - JS_ASSERT(v.isObject()); + MOZ_ASSERT(v.isObject()); return !EmulatesUndefined(&v.toObject()); } @@ -199,6 +199,6 @@ bool js::BooleanGetPrimitiveValueSlow(HandleObject wrappedBool) { JSObject *obj = wrappedBool->as().target(); - JS_ASSERT(obj); + MOZ_ASSERT(obj); return obj->as().unbox(); } diff --git a/js/src/jscntxt.cpp b/js/src/jscntxt.cpp index 7e66b07a9a02..f765d87cbc38 100644 --- a/js/src/jscntxt.cpp +++ b/js/src/jscntxt.cpp @@ -116,15 +116,15 @@ JSFunction * js::ExistingCloneFunctionAtCallsite(const CallsiteCloneTable &table, JSFunction *fun, JSScript *script, jsbytecode *pc) { - JS_ASSERT(fun->nonLazyScript()->shouldCloneAtCallsite()); - JS_ASSERT(!fun->nonLazyScript()->enclosingStaticScope()); - JS_ASSERT(types::UseNewTypeForClone(fun)); + MOZ_ASSERT(fun->nonLazyScript()->shouldCloneAtCallsite()); + MOZ_ASSERT(!fun->nonLazyScript()->enclosingStaticScope()); + MOZ_ASSERT(types::UseNewTypeForClone(fun)); /* * If we start allocating function objects in the nursery, then the callsite * clone table will need a postbarrier. */ - JS_ASSERT(fun->isTenured()); + MOZ_ASSERT(fun->isTenured()); if (!table.initialized()) return nullptr; @@ -258,7 +258,7 @@ js::DestroyContext(JSContext *cx, DestroyContextMode mode) c->types.print(cx, false); } if (mode == DCM_FORCE_GC) { - JS_ASSERT(!rt->isHeapBusy()); + MOZ_ASSERT(!rt->isHeapBusy()); JS::PrepareForFullGC(rt); rt->gc.gc(GC_NORMAL, JS::gcreason::DESTROY_CONTEXT); } @@ -269,17 +269,17 @@ void ContextFriendFields::checkNoGCRooters() { #ifdef DEBUG for (int i = 0; i < THING_ROOT_LIMIT; ++i) - JS_ASSERT(thingGCRooters[i] == nullptr); + MOZ_ASSERT(thingGCRooters[i] == nullptr); #endif } bool AutoResolving::alreadyStartedSlow() const { - JS_ASSERT(link); + MOZ_ASSERT(link); AutoResolving *cursor = link; do { - JS_ASSERT(this != cursor); + MOZ_ASSERT(this != cursor); if (object.get() == cursor->object && id.get() == cursor->id && kind == cursor->kind) return true; } while (!!(cursor = cursor->link)); @@ -296,7 +296,7 @@ ReportError(JSContext *cx, const char *message, JSErrorReport *reportp, * exception is thrown, then the JSREPORT_EXCEPTION flag will be set * on the error report, and exception-aware hosts should ignore it. */ - JS_ASSERT(reportp); + MOZ_ASSERT(reportp); if ((!callback || callback == js_GetErrorMessage) && reportp->errorNumber == JSMSG_UNCAUGHT_EXCEPTION) { @@ -402,7 +402,7 @@ js_ReportOutOfMemory(ThreadSafeContext *cxArg) * does not need wrapping. If no JS code is running, no exception should be * set at all. */ - JS_ASSERT(!cx->isExceptionPending()); + MOZ_ASSERT(!cx->isExceptionPending()); } JS_FRIEND_API(void) @@ -525,9 +525,9 @@ js::ReportUsageError(JSContext *cx, HandleObject callee, const char *msg) PropertyName *usageAtom = Atomize(cx, usageStr, strlen(usageStr))->asPropertyName(); RootedId id(cx, NameToId(usageAtom)); DebugOnly shape = static_cast(callee->nativeLookup(cx, id)); - JS_ASSERT(!shape->configurable()); - JS_ASSERT(!shape->writable()); - JS_ASSERT(shape->hasDefaultGetter()); + MOZ_ASSERT(!shape->configurable()); + MOZ_ASSERT(!shape->writable()); + MOZ_ASSERT(shape->hasDefaultGetter()); RootedValue usage(cx); if (!JS_LookupProperty(cx, callee, "usage", &usage)) @@ -657,7 +657,7 @@ js_ExpandErrorArguments(ExclusiveContext *cx, JSErrorCallback callback, size_t totalArgsLength = 0; size_t argLengths[10]; /* only {0} thru {9} supported */ argCount = efs->argCount; - JS_ASSERT(argCount <= 10); + MOZ_ASSERT(argCount <= 10); if (argCount > 0) { /* * Gather the arguments into an array, and accumulate @@ -666,7 +666,7 @@ js_ExpandErrorArguments(ExclusiveContext *cx, JSErrorCallback callback, * pointers later. */ if (messageArgsPassed) { - JS_ASSERT(!reportp->messageArgs[argCount]); + MOZ_ASSERT(!reportp->messageArgs[argCount]); } else { reportp->messageArgs = cx->pod_malloc(argCount + 1); if (!reportp->messageArgs) @@ -721,7 +721,7 @@ js_ExpandErrorArguments(ExclusiveContext *cx, JSErrorCallback callback, if (*fmt == '{') { if (isdigit(fmt[1])) { int d = JS7_UNDEC(fmt[1]); - JS_ASSERT(d < argCount); + MOZ_ASSERT(d < argCount); js_strncpy(out, reportp->messageArgs[d], argLengths[d]); out += argLengths[d]; @@ -732,7 +732,7 @@ js_ExpandErrorArguments(ExclusiveContext *cx, JSErrorCallback callback, } *out++ = *fmt++; } - JS_ASSERT(expandedArgs == argCount); + MOZ_ASSERT(expandedArgs == argCount); *out = 0; js_free(buffer); size_t msgLen = PointerRangeSize(static_cast(reportp->ucmessage), @@ -744,7 +744,7 @@ js_ExpandErrorArguments(ExclusiveContext *cx, JSErrorCallback callback, } } else { /* Non-null messageArgs should have at least one non-null arg. */ - JS_ASSERT(!reportp->messageArgs); + MOZ_ASSERT(!reportp->messageArgs); /* * Zero arguments: the format string (if it exists) is the * entire message. @@ -872,8 +872,8 @@ js_ReportErrorNumberUCArray(JSContext *cx, unsigned flags, JSErrorCallback callb void js::CallErrorReporter(JSContext *cx, const char *message, JSErrorReport *reportp) { - JS_ASSERT(message); - JS_ASSERT(reportp); + MOZ_ASSERT(message); + MOZ_ASSERT(reportp); if (JSErrorReporter onError = cx->runtime()->errorReporter) onError(cx, message, reportp); @@ -908,7 +908,7 @@ js_ReportIsNullOrUndefined(JSContext *cx, int spindex, HandleValue v, JSMSG_UNEXPECTED_TYPE, bytes, js_undefined_str, nullptr); } else { - JS_ASSERT(v.isNull()); + MOZ_ASSERT(v.isNull()); ok = JS_ReportErrorFlagsAndNumber(cx, JSREPORT_ERROR, js_GetErrorMessage, nullptr, JSMSG_UNEXPECTED_TYPE, bytes, @@ -949,8 +949,8 @@ js_ReportValueErrorFlags(JSContext *cx, unsigned flags, const unsigned errorNumb char *bytes; bool ok; - JS_ASSERT(js_ErrorFormatString[errorNumber].argCount >= 1); - JS_ASSERT(js_ErrorFormatString[errorNumber].argCount <= 3); + MOZ_ASSERT(js_ErrorFormatString[errorNumber].argCount >= 1); + MOZ_ASSERT(js_ErrorFormatString[errorNumber].argCount <= 3); bytes = DecompileValueGenerator(cx, spindex, v, fallback); if (!bytes) return false; @@ -979,10 +979,10 @@ js_GetErrorMessage(void *userRef, const unsigned errorNumber) bool js::InvokeInterruptCallback(JSContext *cx) { - JS_ASSERT(cx->runtime()->requestDepth >= 1); + MOZ_ASSERT(cx->runtime()->requestDepth >= 1); JSRuntime *rt = cx->runtime(); - JS_ASSERT(rt->interrupt); + MOZ_ASSERT(rt->interrupt); // Reset the callback counter first, then run GC and yield. If another // thread is racing us here we will accumulate another callback request @@ -1077,7 +1077,7 @@ ThreadSafeContext::isForkJoinContext() const ForkJoinContext * ThreadSafeContext::asForkJoinContext() { - JS_ASSERT(isForkJoinContext()); + MOZ_ASSERT(isForkJoinContext()); return reinterpret_cast(this); } @@ -1115,20 +1115,20 @@ JSContext::JSContext(JSRuntime *rt) #endif innermostGenerator_(nullptr) { - JS_ASSERT(static_cast(this) == - ContextFriendFields::get(this)); + MOZ_ASSERT(static_cast(this) == + ContextFriendFields::get(this)); } JSContext::~JSContext() { /* Free the stuff hanging off of cx. */ - JS_ASSERT(!resolvingList); + MOZ_ASSERT(!resolvingList); } bool JSContext::getPendingException(MutableHandleValue rval) { - JS_ASSERT(throwing); + MOZ_ASSERT(throwing); rval.set(unwrappedException_); if (IsAtomsCompartment(compartment())) return true; @@ -1149,7 +1149,7 @@ JSContext::isThrowingOutOfMemory() void JSContext::enterGenerator(JSGenerator *gen) { - JS_ASSERT(!gen->prevGenerator); + MOZ_ASSERT(!gen->prevGenerator); gen->prevGenerator = innermostGenerator_; innermostGenerator_ = gen; } @@ -1157,7 +1157,7 @@ JSContext::enterGenerator(JSGenerator *gen) void JSContext::leaveGenerator(JSGenerator *gen) { - JS_ASSERT(innermostGenerator_ == gen); + MOZ_ASSERT(innermostGenerator_ == gen); innermostGenerator_ = innermostGenerator_->prevGenerator; gen->prevGenerator = nullptr; } @@ -1181,7 +1181,7 @@ JSContext::saveFrameChain() void JSContext::restoreFrameChain() { - JS_ASSERT(enterCompartmentDepth_ == 0); // We're about to clobber it, and it + MOZ_ASSERT(enterCompartmentDepth_ == 0); // We're about to clobber it, and it // will be wrong forevermore. SavedFrameChain sfc = savedFrameChains_.popCopy(); setCompartment(sfc.compartment); @@ -1331,8 +1331,8 @@ JSContext::findVersion() const JS::AutoCheckRequestDepth::AutoCheckRequestDepth(JSContext *cx) : cx(cx) { - JS_ASSERT(cx->runtime()->requestDepth || cx->runtime()->isHeapBusy()); - JS_ASSERT(CurrentThreadCanAccessRuntime(cx->runtime())); + MOZ_ASSERT(cx->runtime()->requestDepth || cx->runtime()->isHeapBusy()); + MOZ_ASSERT(CurrentThreadCanAccessRuntime(cx->runtime())); cx->runtime()->checkRequestDepth++; } @@ -1340,8 +1340,8 @@ JS::AutoCheckRequestDepth::AutoCheckRequestDepth(ContextFriendFields *cxArg) : cx(static_cast(cxArg)->maybeJSContext()) { if (cx) { - JS_ASSERT(cx->runtime()->requestDepth || cx->runtime()->isHeapBusy()); - JS_ASSERT(CurrentThreadCanAccessRuntime(cx->runtime())); + MOZ_ASSERT(cx->runtime()->requestDepth || cx->runtime()->isHeapBusy()); + MOZ_ASSERT(CurrentThreadCanAccessRuntime(cx->runtime())); cx->runtime()->checkRequestDepth++; } } @@ -1349,7 +1349,7 @@ JS::AutoCheckRequestDepth::AutoCheckRequestDepth(ContextFriendFields *cxArg) JS::AutoCheckRequestDepth::~AutoCheckRequestDepth() { if (cx) { - JS_ASSERT(cx->runtime()->checkRequestDepth != 0); + MOZ_ASSERT(cx->runtime()->checkRequestDepth != 0); cx->runtime()->checkRequestDepth--; } } diff --git a/js/src/jscntxt.h b/js/src/jscntxt.h index 049968ee69e7..27148fd20340 100644 --- a/js/src/jscntxt.h +++ b/js/src/jscntxt.h @@ -195,7 +195,7 @@ struct ThreadSafeContext : ContextFriendFields, // ThreadSafeContext to a JSContext. This ensures that trying to use // the context as a JSContext off the main thread will nullptr crash // rather than race. - JS_ASSERT(isJSContext()); + MOZ_ASSERT(isJSContext()); return maybeJSContext(); } @@ -207,7 +207,7 @@ struct ThreadSafeContext : ContextFriendFields, // for such cases and produce either a soft failure in release builds or // an assertion failure in debug builds. bool shouldBeJSContext() const { - JS_ASSERT(isJSContext()); + MOZ_ASSERT(isJSContext()); return isJSContext(); } @@ -222,7 +222,7 @@ struct ThreadSafeContext : ContextFriendFields, } ExclusiveContext *asExclusiveContext() const { - JS_ASSERT(isExclusiveContext()); + MOZ_ASSERT(isExclusiveContext()); return maybeExclusiveContext(); } @@ -613,12 +613,12 @@ struct AutoResolving { : context(cx), object(obj), id(id), kind(kind), link(cx->resolvingList) { MOZ_GUARD_OBJECT_NOTIFIER_INIT; - JS_ASSERT(obj); + MOZ_ASSERT(obj); cx->resolvingList = this; } ~AutoResolving() { - JS_ASSERT(context->resolvingList == this); + MOZ_ASSERT(context->resolvingList == this); context->resolvingList = link; } @@ -653,12 +653,12 @@ public: } void next() { - JS_ASSERT(!done()); + MOZ_ASSERT(!done()); iter = iter->getNext(); } JSContext *get() const { - JS_ASSERT(!done()); + MOZ_ASSERT(!done()); return iter; } @@ -906,12 +906,12 @@ class AutoArrayRooter : private JS::AutoGCRooter : JS::AutoGCRooter(cx, len), array(vec) { MOZ_GUARD_OBJECT_NOTIFIER_INIT; - JS_ASSERT(tag_ >= 0); + MOZ_ASSERT(tag_ >= 0); } void changeLength(size_t newLength) { tag_ = ptrdiff_t(newLength); - JS_ASSERT(tag_ >= 0); + MOZ_ASSERT(tag_ >= 0); } void changeArray(Value *newArray, size_t newLength) { @@ -924,24 +924,24 @@ class AutoArrayRooter : private JS::AutoGCRooter } size_t length() { - JS_ASSERT(tag_ >= 0); + MOZ_ASSERT(tag_ >= 0); return size_t(tag_); } MutableHandleValue handleAt(size_t i) { - JS_ASSERT(i < size_t(tag_)); + MOZ_ASSERT(i < size_t(tag_)); return MutableHandleValue::fromMarkedLocation(&array[i]); } HandleValue handleAt(size_t i) const { - JS_ASSERT(i < size_t(tag_)); + MOZ_ASSERT(i < size_t(tag_)); return HandleValue::fromMarkedLocation(&array[i]); } MutableHandleValue operator[](size_t i) { - JS_ASSERT(i < size_t(tag_)); + MOZ_ASSERT(i < size_t(tag_)); return MutableHandleValue::fromMarkedLocation(&array[i]); } HandleValue operator[](size_t i) const { - JS_ASSERT(i < size_t(tag_)); + MOZ_ASSERT(i < size_t(tag_)); return HandleValue::fromMarkedLocation(&array[i]); } @@ -1018,7 +1018,7 @@ class AutoLockForExclusiveAccess runtime->exclusiveAccessOwner = PR_GetCurrentThread(); #endif } else { - JS_ASSERT(!runtime->mainThreadHasExclusiveAccess); + MOZ_ASSERT(!runtime->mainThreadHasExclusiveAccess); runtime->mainThreadHasExclusiveAccess = true; } } @@ -1034,11 +1034,11 @@ class AutoLockForExclusiveAccess } ~AutoLockForExclusiveAccess() { if (runtime->numExclusiveThreads) { - JS_ASSERT(runtime->exclusiveAccessOwner == PR_GetCurrentThread()); + MOZ_ASSERT(runtime->exclusiveAccessOwner == PR_GetCurrentThread()); runtime->exclusiveAccessOwner = nullptr; PR_Unlock(runtime->exclusiveAccessLock); } else { - JS_ASSERT(runtime->mainThreadHasExclusiveAccess); + MOZ_ASSERT(runtime->mainThreadHasExclusiveAccess); runtime->mainThreadHasExclusiveAccess = false; } } diff --git a/js/src/jscntxtinlines.h b/js/src/jscntxtinlines.h index 3bd52725556f..8b89aacc9309 100644 --- a/js/src/jscntxtinlines.h +++ b/js/src/jscntxtinlines.h @@ -59,8 +59,8 @@ class CompartmentChecker /* Note: should only be used when neither c1 nor c2 may be the atoms compartment. */ static void check(JSCompartment *c1, JSCompartment *c2) { - JS_ASSERT(!c1->runtimeFromAnyThread()->isAtomsCompartment(c1)); - JS_ASSERT(!c2->runtimeFromAnyThread()->isAtomsCompartment(c2)); + MOZ_ASSERT(!c1->runtimeFromAnyThread()->isAtomsCompartment(c1)); + MOZ_ASSERT(!c2->runtimeFromAnyThread()->isAtomsCompartment(c2)); if (c1 != c2) fail(c1, c2); } @@ -260,7 +260,7 @@ CallJSNativeConstructor(JSContext *cx, Native native, const CallArgs &args) RootedObject callee(cx, &args.callee()); #endif - JS_ASSERT(args.thisv().isMagic()); + MOZ_ASSERT(args.thisv().isMagic()); if (!CallJSNative(cx, native, args)) return false; @@ -366,7 +366,7 @@ ExclusiveContext::typeLifoAlloc() inline void JSContext::setPendingException(js::Value v) { - JS_ASSERT(!IsPoisonedValue(v)); + MOZ_ASSERT(!IsPoisonedValue(v)); this->throwing = true; this->unwrappedException_ = v; // We don't use assertSameCompartment here to allow @@ -398,7 +398,7 @@ js::ExclusiveContext::enterNullCompartment() inline void js::ExclusiveContext::leaveCompartment(JSCompartment *oldCompartment) { - JS_ASSERT(hasEnteredCompartment()); + MOZ_ASSERT(hasEnteredCompartment()); enterCompartmentDepth_--; // Only call leave() after we've setCompartment()-ed away from the current @@ -452,7 +452,7 @@ JSContext::currentScript(jsbytecode **ppc, if (!act) return nullptr; - JS_ASSERT(act->cx() == this); + MOZ_ASSERT(act->cx() == this); if (act->isJit()) { JSScript *script = nullptr; @@ -465,10 +465,10 @@ JSContext::currentScript(jsbytecode **ppc, if (act->isAsmJS()) return nullptr; - JS_ASSERT(act->isInterpreter()); + MOZ_ASSERT(act->isInterpreter()); js::InterpreterFrame *fp = act->asInterpreter()->current(); - JS_ASSERT(!fp->runningInJit()); + MOZ_ASSERT(!fp->runningInJit()); JSScript *script = fp->script(); if (!allowCrossCompartment && script->compartment() != compartment()) @@ -476,7 +476,7 @@ JSContext::currentScript(jsbytecode **ppc, if (ppc) { *ppc = act->asInterpreter()->regs().pc; - JS_ASSERT(script->containsPC(*ppc)); + MOZ_ASSERT(script->containsPC(*ppc)); } return script; } diff --git a/js/src/jscompartment.cpp b/js/src/jscompartment.cpp index 56829754c5b9..c7df853ef88d 100644 --- a/js/src/jscompartment.cpp +++ b/js/src/jscompartment.cpp @@ -130,7 +130,7 @@ JSRuntime::createJitRuntime(JSContext *cx) // interrupt. AutoLockForInterrupt lock(this); - JS_ASSERT(!jitRuntime_); + MOZ_ASSERT(!jitRuntime_); jitRuntime_ = cx->new_(); @@ -229,7 +229,7 @@ JSCompartment::checkWrapperMapAfterMovingGC() CheckGCThingAfterMovingGC(static_cast(e.front().value().get().toGCThing())); WrapperMap::Ptr ptr = crossCompartmentWrappers.lookup(key); - JS_ASSERT(ptr.found() && &*ptr == &e.front()); + MOZ_ASSERT(ptr.found() && &*ptr == &e.front()); } } #endif @@ -239,17 +239,17 @@ JSCompartment::checkWrapperMapAfterMovingGC() bool JSCompartment::putWrapper(JSContext *cx, const CrossCompartmentKey &wrapped, const js::Value &wrapper) { - JS_ASSERT(wrapped.wrapped); - JS_ASSERT(!IsPoisonedPtr(wrapped.wrapped)); - JS_ASSERT(!IsPoisonedPtr(wrapped.debugger)); - JS_ASSERT(!IsPoisonedPtr(wrapper.toGCThing())); + MOZ_ASSERT(wrapped.wrapped); + MOZ_ASSERT(!IsPoisonedPtr(wrapped.wrapped)); + MOZ_ASSERT(!IsPoisonedPtr(wrapped.debugger)); + MOZ_ASSERT(!IsPoisonedPtr(wrapper.toGCThing())); JS_ASSERT_IF(wrapped.kind == CrossCompartmentKey::StringWrapper, wrapper.isString()); JS_ASSERT_IF(wrapped.kind != CrossCompartmentKey::StringWrapper, wrapper.isObject()); bool success = crossCompartmentWrappers.put(wrapped, ReadBarriered(wrapper)); #ifdef JSGC_GENERATIONAL /* There's no point allocating wrappers in the nursery since we will tenure them anyway. */ - JS_ASSERT(!IsInsideNursery(static_cast(wrapper.toGCThing()))); + MOZ_ASSERT(!IsInsideNursery(static_cast(wrapper.toGCThing()))); if (success && (IsInsideNursery(wrapped.wrapped) || IsInsideNursery(wrapped.debugger))) { WrapperMapRef ref(&crossCompartmentWrappers, wrapped); @@ -310,8 +310,8 @@ CopyStringPure(JSContext *cx, JSString *str) bool JSCompartment::wrap(JSContext *cx, MutableHandleString strp) { - JS_ASSERT(!cx->runtime()->isAtomsCompartment(this)); - JS_ASSERT(cx->compartment() == this); + MOZ_ASSERT(!cx->runtime()->isAtomsCompartment(this)); + MOZ_ASSERT(cx->compartment() == this); /* If the string is already in this compartment, we are done. */ JSString *str = strp; @@ -320,8 +320,8 @@ JSCompartment::wrap(JSContext *cx, MutableHandleString strp) /* If the string is an atom, we don't have to copy. */ if (str->isAtom()) { - JS_ASSERT(str->isPermanentAtom() || - cx->runtime()->isAtomsZone(str->zone())); + MOZ_ASSERT(str->isPermanentAtom() || + cx->runtime()->isAtomsZone(str->zone())); return true; } @@ -346,8 +346,8 @@ JSCompartment::wrap(JSContext *cx, MutableHandleString strp) bool JSCompartment::wrap(JSContext *cx, MutableHandleObject obj, HandleObject existingArg) { - JS_ASSERT(!cx->runtime()->isAtomsCompartment(this)); - JS_ASSERT(cx->compartment() == this); + MOZ_ASSERT(!cx->runtime()->isAtomsCompartment(this)); + MOZ_ASSERT(cx->compartment() == this); JS_ASSERT_IF(existingArg, existingArg->compartment() == cx->compartment()); JS_ASSERT_IF(existingArg, IsDeadProxyObject(existingArg)); @@ -362,8 +362,8 @@ JSCompartment::wrap(JSContext *cx, MutableHandleObject obj, HandleObject existin // This loses us some transparency, and is generally very cheesy. HandleObject global = cx->global(); RootedObject objGlobal(cx, &obj->global()); - JS_ASSERT(global); - JS_ASSERT(objGlobal); + MOZ_ASSERT(global); + MOZ_ASSERT(objGlobal); const JSWrapObjectCallbacks *cb = cx->runtime()->wrapObjectCallbacks; @@ -376,8 +376,8 @@ JSCompartment::wrap(JSContext *cx, MutableHandleObject obj, HandleObject existin // associated with the self-hosting global. We don't want to create // wrappers for objects in other runtimes, which may be the case for the // self-hosting global. - JS_ASSERT(!cx->runtime()->isSelfHostingGlobal(global) && - !cx->runtime()->isSelfHostingGlobal(objGlobal)); + MOZ_ASSERT(!cx->runtime()->isSelfHostingGlobal(global) && + !cx->runtime()->isSelfHostingGlobal(objGlobal)); // Unwrap the object, but don't unwrap outer windows. RootedObject objectPassedToWrap(cx, obj); @@ -417,8 +417,8 @@ JSCompartment::wrap(JSContext *cx, MutableHandleObject obj, HandleObject existin RootedValue key(cx, ObjectValue(*obj)); if (WrapperMap::Ptr p = crossCompartmentWrappers.lookup(CrossCompartmentKey(key))) { obj.set(&p->value().get().toObject()); - JS_ASSERT(obj->is()); - JS_ASSERT(obj->getParent() == global); + MOZ_ASSERT(obj->is()); + MOZ_ASSERT(obj->getParent() == global); return true; } @@ -441,7 +441,7 @@ JSCompartment::wrap(JSContext *cx, MutableHandleObject obj, HandleObject existin // We maintain the invariant that the key in the cross-compartment wrapper // map is always directly wrapped by the value. - JS_ASSERT(Wrapper::wrappedObject(obj) == &key.get().toObject()); + MOZ_ASSERT(Wrapper::wrappedObject(obj) == &key.get().toObject()); return putWrapper(cx, CrossCompartmentKey(key), ObjectValue(*obj)); } @@ -501,7 +501,7 @@ JSCompartment::wrap(JSContext *cx, MutableHandle desc) void JSCompartment::markCrossCompartmentWrappers(JSTracer *trc) { - JS_ASSERT(!zone()->isCollecting()); + MOZ_ASSERT(!zone()->isCollecting()); for (WrapperMap::Enum e(crossCompartmentWrappers); !e.empty(); e.popFront()) { Value v = e.front().value(); @@ -514,7 +514,7 @@ JSCompartment::markCrossCompartmentWrappers(JSTracer *trc) */ Value referent = wrapper->private_(); MarkValueRoot(trc, &referent, "cross-compartment wrapper"); - JS_ASSERT(referent == wrapper->private_()); + MOZ_ASSERT(referent == wrapper->private_()); } } } @@ -528,7 +528,7 @@ JSCompartment::trace(JSTracer *trc) void JSCompartment::markRoots(JSTracer *trc) { - JS_ASSERT(!trc->runtime()->isHeapMinorCollecting()); + MOZ_ASSERT(!trc->runtime()->isHeapMinorCollecting()); if (jitCompartment_) jitCompartment_->mark(trc, this); @@ -642,7 +642,7 @@ JSCompartment::sweepCrossCompartmentWrappers() bool valDying = IsValueAboutToBeFinalized(e.front().value().unsafeGet()); bool dbgDying = key.debugger && IsObjectAboutToBeFinalized(&key.debugger); if (keyDying || valDying || dbgDying) { - JS_ASSERT(key.kind != CrossCompartmentKey::StringWrapper); + MOZ_ASSERT(key.kind != CrossCompartmentKey::StringWrapper); e.removeFront(); } else if (key.wrapped != e.front().key().wrapped || key.debugger != e.front().key().debugger) @@ -719,13 +719,13 @@ JSCompartment::clearTables() // No scripts should have run in this compartment. This is used when // merging a compartment that has been used off thread into another // compartment and zone. - JS_ASSERT(crossCompartmentWrappers.empty()); + MOZ_ASSERT(crossCompartmentWrappers.empty()); JS_ASSERT_IF(callsiteClones.initialized(), callsiteClones.empty()); - JS_ASSERT(!jitCompartment_); - JS_ASSERT(!debugScopes); - JS_ASSERT(!gcWeakMapList); - JS_ASSERT(enumerators->next() == enumerators); - JS_ASSERT(regExps.empty()); + MOZ_ASSERT(!jitCompartment_); + MOZ_ASSERT(!debugScopes); + MOZ_ASSERT(!gcWeakMapList); + MOZ_ASSERT(enumerators->next() == enumerators); + MOZ_ASSERT(regExps.empty()); types.clearTables(); if (baseShapes.initialized()) diff --git a/js/src/jscompartment.h b/js/src/jscompartment.h index c97fd12897a0..0d3f9e64602a 100644 --- a/js/src/jscompartment.h +++ b/js/src/jscompartment.h @@ -93,7 +93,7 @@ struct CrossCompartmentKey struct WrapperHasher : public DefaultHasher { static HashNumber hash(const CrossCompartmentKey &key) { - JS_ASSERT(!IsPoisonedPtr(key.wrapped)); + MOZ_ASSERT(!IsPoisonedPtr(key.wrapped)); return uint32_t(uintptr_t(key.wrapped)) | uint32_t(key.kind); } @@ -160,7 +160,7 @@ struct JSCompartment const JS::CompartmentOptions &options() const { return options_; } JSRuntime *runtimeFromMainThread() { - JS_ASSERT(CurrentThreadCanAccessRuntime(runtime_)); + MOZ_ASSERT(CurrentThreadCanAccessRuntime(runtime_)); return runtime_; } @@ -551,7 +551,7 @@ class AssertCompartmentUnchanged } ~AssertCompartmentUnchanged() { - JS_ASSERT(cx->compartment() == oldCompartment); + MOZ_ASSERT(cx->compartment() == oldCompartment); } protected: diff --git a/js/src/jscompartmentinlines.h b/js/src/jscompartmentinlines.h index 5d9dd78d41a3..036e00726934 100644 --- a/js/src/jscompartmentinlines.h +++ b/js/src/jscompartmentinlines.h @@ -16,8 +16,8 @@ inline void JSCompartment::initGlobal(js::GlobalObject &global) { - JS_ASSERT(global.compartment() == this); - JS_ASSERT(!global_); + MOZ_ASSERT(global.compartment() == this); + MOZ_ASSERT(!global_); global_.set(&global); } @@ -78,7 +78,7 @@ JSCompartment::wrap(JSContext *cx, JS::MutableHandleValue vp, JS::HandleObject e return true; } - JS_ASSERT(vp.isObject()); + MOZ_ASSERT(vp.isObject()); /* * All that's left are objects. diff --git a/js/src/jsdate.cpp b/js/src/jsdate.cpp index 2b52e7b5f7bf..6e26beb1d765 100644 --- a/js/src/jsdate.cpp +++ b/js/src/jsdate.cpp @@ -122,7 +122,7 @@ TimeWithinDay(double t) static inline bool IsLeapYear(double year) { - JS_ASSERT(ToInteger(year) == year); + MOZ_ASSERT(ToInteger(year) == year); return fmod(year, 4) == 0 && (fmod(year, 100) != 0 || fmod(year, 400) == 0); } @@ -155,7 +155,7 @@ YearFromTime(double t) if (!IsFinite(t)) return GenericNaN(); - JS_ASSERT(ToInteger(t) == t); + MOZ_ASSERT(ToInteger(t) == t); double y = floor(t / (msPerDay * 365.2425)) + 1970; double t2 = TimeFromYear(y); @@ -278,7 +278,7 @@ WeekDay(double t) * We can't assert TimeClip(t) == t because we call this function with * local times, which can be offset outside TimeClip's permitted range. */ - JS_ASSERT(ToInteger(t) == t); + MOZ_ASSERT(ToInteger(t) == t); int result = (int(Day(t)) + 4) % 7; if (result < 0) result += 7; @@ -297,7 +297,7 @@ DayFromMonth(int month, bool isLeapYear) {0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366} }; - JS_ASSERT(0 <= month && month <= 12); + MOZ_ASSERT(0 <= month && month <= 12); return firstDayOfMonth[isLeapYear][month]; } @@ -518,8 +518,8 @@ MakeTime(double hour, double min, double sec, double ms) static bool date_convert(JSContext *cx, HandleObject obj, JSType hint, MutableHandleValue vp) { - JS_ASSERT(hint == JSTYPE_NUMBER || hint == JSTYPE_STRING || hint == JSTYPE_VOID); - JS_ASSERT(obj->is()); + MOZ_ASSERT(hint == JSTYPE_NUMBER || hint == JSTYPE_STRING || hint == JSTYPE_VOID); + MOZ_ASSERT(obj->is()); return DefaultValue(cx, obj, (hint == JSTYPE_VOID) ? JSTYPE_STRING : hint, vp); } @@ -1023,7 +1023,7 @@ ParseDate(const CharT *s, size_t length, double *result, DateTimeInfo *dtInfo) * AM/PM. Count 12:30 AM as 00:30, 12:30 PM as * 12:30, instead of blindly adding 12 if PM. */ - JS_ASSERT(action == -1 || action == -2); + MOZ_ASSERT(action == -1 || action == -2); if (hour > 12 || hour < 0) return false; @@ -2358,7 +2358,7 @@ static const char * const months[] = static void print_gmt_string(char* buf, size_t size, double utctime) { - JS_ASSERT(TimeClip(utctime) == utctime); + MOZ_ASSERT(TimeClip(utctime) == utctime); JS_snprintf(buf, size, "%s, %.2d %s %.4d %.2d:%.2d:%.2d GMT", days[int(WeekDay(utctime))], int(DateFromTime(utctime)), @@ -2372,7 +2372,7 @@ print_gmt_string(char* buf, size_t size, double utctime) static void print_iso_string(char* buf, size_t size, double utctime) { - JS_ASSERT(TimeClip(utctime) == utctime); + MOZ_ASSERT(TimeClip(utctime) == utctime); JS_snprintf(buf, size, "%.4d-%.2d-%.2dT%.2d:%.2d:%.2d.%.3dZ", int(YearFromTime(utctime)), int(MonthFromTime(utctime)) + 1, @@ -2524,7 +2524,7 @@ date_format(JSContext *cx, double date, formatspec format, MutableHandleValue rv if (!IsFinite(date)) { JS_snprintf(buf, sizeof buf, js_NaN_date_str); } else { - JS_ASSERT(TimeClip(date) == date); + MOZ_ASSERT(TimeClip(date) == date); double local = LocalTime(date, &cx->runtime()->dateTimeInfo); @@ -3054,7 +3054,7 @@ JS_FRIEND_API(JSObject *) js_NewDateObject(JSContext *cx, int year, int mon, int mday, int hour, int min, int sec) { - JS_ASSERT(mon < 12); + MOZ_ASSERT(mon < 12); double msec_time = date_msecFromDate(year, mon, mday, hour, min, sec, 0); return js_NewDateObjectMsec(cx, UTC(msec_time, &cx->runtime()->dateTimeInfo)); } @@ -3069,7 +3069,7 @@ JS_FRIEND_API(int) js_DateGetYear(JSContext *cx, JSObject *obj) { /* Preserve legacy API behavior of returning 0 for invalid dates. */ - JS_ASSERT(obj); + MOZ_ASSERT(obj); double localtime = obj->as().cachedLocalTime(&cx->runtime()->dateTimeInfo); if (IsNaN(localtime)) return 0; @@ -3080,7 +3080,7 @@ js_DateGetYear(JSContext *cx, JSObject *obj) JS_FRIEND_API(int) js_DateGetMonth(JSContext *cx, JSObject *obj) { - JS_ASSERT(obj); + MOZ_ASSERT(obj); double localtime = obj->as().cachedLocalTime(&cx->runtime()->dateTimeInfo); if (IsNaN(localtime)) return 0; @@ -3091,7 +3091,7 @@ js_DateGetMonth(JSContext *cx, JSObject *obj) JS_FRIEND_API(int) js_DateGetDate(JSContext *cx, JSObject *obj) { - JS_ASSERT(obj); + MOZ_ASSERT(obj); double localtime = obj->as().cachedLocalTime(&cx->runtime()->dateTimeInfo); if (IsNaN(localtime)) return 0; @@ -3102,7 +3102,7 @@ js_DateGetDate(JSContext *cx, JSObject *obj) JS_FRIEND_API(int) js_DateGetHours(JSContext *cx, JSObject *obj) { - JS_ASSERT(obj); + MOZ_ASSERT(obj); double localtime = obj->as().cachedLocalTime(&cx->runtime()->dateTimeInfo); if (IsNaN(localtime)) return 0; @@ -3113,7 +3113,7 @@ js_DateGetHours(JSContext *cx, JSObject *obj) JS_FRIEND_API(int) js_DateGetMinutes(JSContext *cx, JSObject *obj) { - JS_ASSERT(obj); + MOZ_ASSERT(obj); double localtime = obj->as().cachedLocalTime(&cx->runtime()->dateTimeInfo); if (IsNaN(localtime)) return 0; diff --git a/js/src/jsdtoa.cpp b/js/src/jsdtoa.cpp index ba29fc35c27e..88bc29c055ea 100644 --- a/js/src/jsdtoa.cpp +++ b/js/src/jsdtoa.cpp @@ -82,9 +82,9 @@ js_dtostr(DtoaState *state, char *buffer, size_t bufferSize, JSDToStrMode mode, char *numBegin; /* Pointer to the digits returned by js_dtoa */ char *numEnd = 0; /* Pointer past the digits returned by js_dtoa */ - JS_ASSERT(bufferSize >= (size_t)(mode <= DTOSTR_STANDARD_EXPONENTIAL - ? DTOSTR_STANDARD_BUFFER_SIZE - : DTOSTR_VARIABLE_BUFFER_SIZE(precision))); + MOZ_ASSERT(bufferSize >= (size_t)(mode <= DTOSTR_STANDARD_EXPONENTIAL + ? DTOSTR_STANDARD_BUFFER_SIZE + : DTOSTR_VARIABLE_BUFFER_SIZE(precision))); /* * Change mode here rather than below because the buffer may not be large @@ -100,7 +100,7 @@ js_dtostr(DtoaState *state, char *buffer, size_t bufferSize, JSDToStrMode mode, } nDigits = numEnd - numBegin; - JS_ASSERT((size_t) nDigits <= bufferSize - 2); + MOZ_ASSERT((size_t) nDigits <= bufferSize - 2); if ((size_t) nDigits > bufferSize - 2) { return nullptr; } @@ -134,7 +134,7 @@ js_dtostr(DtoaState *state, char *buffer, size_t bufferSize, JSDToStrMode mode, break; case DTOSTR_EXPONENTIAL: - JS_ASSERT(precision > 0); + MOZ_ASSERT(precision > 0); minNDigits = precision; /* Fall through */ case DTOSTR_STANDARD_EXPONENTIAL: @@ -142,7 +142,7 @@ js_dtostr(DtoaState *state, char *buffer, size_t bufferSize, JSDToStrMode mode, break; case DTOSTR_PRECISION: - JS_ASSERT(precision > 0); + MOZ_ASSERT(precision > 0); minNDigits = precision; if (decPt < -5 || decPt > precision) exponentialNotation = true; @@ -169,7 +169,7 @@ js_dtostr(DtoaState *state, char *buffer, size_t bufferSize, JSDToStrMode mode, JS_snprintf(numEnd, bufferSize - (numEnd - buffer), "e%+d", decPt-1); } else if (decPt != nDigits) { /* Some kind of a fraction in fixed notation */ - JS_ASSERT(decPt <= nDigits); + MOZ_ASSERT(decPt <= nDigits); if (decPt > 0) { /* dd...dd . dd...dd */ p = --numBegin; @@ -183,7 +183,7 @@ js_dtostr(DtoaState *state, char *buffer, size_t bufferSize, JSDToStrMode mode, p = numEnd; numEnd += 1 - decPt; q = numEnd; - JS_ASSERT(numEnd < buffer + bufferSize); + MOZ_ASSERT(numEnd < buffer + bufferSize); *numEnd = '\0'; while (p != numBegin) *--q = *--p; @@ -217,7 +217,7 @@ divrem(Bigint *b, uint32_t divisor) ULong *bx; ULong *bp; - JS_ASSERT(divisor > 0 && divisor <= 65536); + MOZ_ASSERT(divisor > 0 && divisor <= 65536); if (!n) return 0; /* b is zero */ @@ -230,11 +230,11 @@ divrem(Bigint *b, uint32_t divisor) ULong quotientLo; remainder = dividend - quotientHi*divisor; - JS_ASSERT(quotientHi <= 0xFFFF && remainder < divisor); + MOZ_ASSERT(quotientHi <= 0xFFFF && remainder < divisor); dividend = remainder << 16 | (a & 0xFFFF); quotientLo = dividend / divisor; remainder = dividend - quotientLo*divisor; - JS_ASSERT(quotientLo <= 0xFFFF && remainder < divisor); + MOZ_ASSERT(quotientLo <= 0xFFFF && remainder < divisor); *bp = quotientHi << 16 | quotientLo; } while (bp != bx); /* Decrease the size of the number if its most significant word is now zero. */ @@ -257,13 +257,13 @@ static uint32_t quorem2(Bigint *b, int32_t k) w = b->wds - n; if (w <= 0) return 0; - JS_ASSERT(w <= 2); + MOZ_ASSERT(w <= 2); bx = b->x; bxe = bx + n; result = *bxe >> k; *bxe &= mask; if (w == 2) { - JS_ASSERT(!(bxe[1] & ~mask)); + MOZ_ASSERT(!(bxe[1] & ~mask)); if (k) result |= bxe[1] << (32 - k); } @@ -295,7 +295,7 @@ js_dtobasestr(DtoaState *state, int base, double dinput) U di; /* d truncated to an integer */ U df; /* The fractional part of d */ - JS_ASSERT(base >= 2 && base <= 36); + MOZ_ASSERT(base >= 2 && base <= 36); dval(d) = dinput; buffer = (char*) js_malloc(DTOBASESTR_BUFFER_SIZE); @@ -328,7 +328,7 @@ js_dtobasestr(DtoaState *state, int base, double dinput) uint32_t m = n / base; digit = n - m*base; n = m; - JS_ASSERT(digit < (uint32_t)base); + MOZ_ASSERT(digit < (uint32_t)base); *p++ = BASEDIGIT(digit); } while (n); else *p++ = '0'; @@ -347,7 +347,7 @@ js_dtobasestr(DtoaState *state, int base, double dinput) } do { digit = divrem(b, base); - JS_ASSERT(digit < (uint32_t)base); + MOZ_ASSERT(digit < (uint32_t)base); *p++ = BASEDIGIT(digit); } while (b->wds); Bfree(PASS_STATE b); @@ -381,7 +381,7 @@ js_dtobasestr(DtoaState *state, int base, double dinput) js_free(buffer); return nullptr; } - JS_ASSERT(e < 0); + MOZ_ASSERT(e < 0); /* At this point df = b * 2^e. e must be less than zero because 0 < df < 1. */ s2 = -(int32_t)(word0(d) >> Exp_shift1 & Exp_mask>>Exp_shift1); @@ -391,7 +391,7 @@ js_dtobasestr(DtoaState *state, int base, double dinput) #endif s2 += Bias + P; /* 1/2^s2 = (nextDouble(d) - d)/2 */ - JS_ASSERT(-s2 < e); + MOZ_ASSERT(-s2 < e); mlo = i2b(PASS_STATE 1); if (!mlo) goto nomem2; @@ -484,7 +484,7 @@ js_dtobasestr(DtoaState *state, int base, double dinput) digit++; done = true; } - JS_ASSERT(digit < (uint32_t)base); + MOZ_ASSERT(digit < (uint32_t)base); *p++ = BASEDIGIT(digit); } while (!done); Bfree(PASS_STATE b); @@ -493,7 +493,7 @@ js_dtobasestr(DtoaState *state, int base, double dinput) Bfree(PASS_STATE mlo); Bfree(PASS_STATE mhi); } - JS_ASSERT(p < buffer + DTOBASESTR_BUFFER_SIZE); + MOZ_ASSERT(p < buffer + DTOBASESTR_BUFFER_SIZE); *p = '\0'; return buffer; } diff --git a/js/src/jsexn.cpp b/js/src/jsexn.cpp index d2e83aa6f6d3..ed570ca781d1 100644 --- a/js/src/jsexn.cpp +++ b/js/src/jsexn.cpp @@ -167,7 +167,7 @@ js::CopyErrorReport(JSContext *cx, JSErrorReport *report) argsCopySize += JS_CHARS_SIZE(report->messageArgs[i]); /* Non-null messageArgs should have at least one non-null arg. */ - JS_ASSERT(i != 0); + MOZ_ASSERT(i != 0); argsArraySize = (i + 1) * sizeof(const char16_t *); } } @@ -196,7 +196,7 @@ js::CopyErrorReport(JSContext *cx, JSErrorReport *report) cursor += argSize; } copy->messageArgs[i] = nullptr; - JS_ASSERT(cursor == (uint8_t *)copy->messageArgs[0] + argsCopySize); + MOZ_ASSERT(cursor == (uint8_t *)copy->messageArgs[0] + argsCopySize); } if (report->ucmessage) { @@ -229,7 +229,7 @@ js::CopyErrorReport(JSContext *cx, JSErrorReport *report) copy->filename = (const char *)cursor; js_memcpy(cursor, report->filename, filenameSize); } - JS_ASSERT(cursor + filenameSize == (uint8_t *)copy + mallocSize); + MOZ_ASSERT(cursor + filenameSize == (uint8_t *)copy + mallocSize); /* Copy non-pointer members. */ copy->isMuted = report->isMuted; @@ -554,7 +554,7 @@ js_ErrorToException(JSContext *cx, const char *message, JSErrorReport *reportp, JSErrorCallback callback, void *userRef) { // Tell our caller to report immediately if this report is just a warning. - JS_ASSERT(reportp); + MOZ_ASSERT(reportp); if (JSREPORT_IS_WARNING(reportp->flags)) return false; diff --git a/js/src/jsexn.h b/js/src/jsexn.h index 858df5187eca..ff5b3c66ad89 100644 --- a/js/src/jsexn.h +++ b/js/src/jsexn.h @@ -89,8 +89,8 @@ js_CopyErrorObject(JSContext *cx, JS::Handle errobj); static inline JSProtoKey GetExceptionProtoKey(JSExnType exn) { - JS_ASSERT(JSEXN_ERR <= exn); - JS_ASSERT(exn < JSEXN_LIMIT); + MOZ_ASSERT(JSEXN_ERR <= exn); + MOZ_ASSERT(exn < JSEXN_LIMIT); return JSProtoKey(JSProto_Error + int(exn)); } @@ -98,8 +98,8 @@ static inline JSExnType ExnTypeFromProtoKey(JSProtoKey key) { JSExnType type = static_cast(key - JSProto_Error); - JS_ASSERT(type >= JSEXN_ERR); - JS_ASSERT(type < JSEXN_LIMIT); + MOZ_ASSERT(type >= JSEXN_ERR); + MOZ_ASSERT(type < JSEXN_LIMIT); return type; } diff --git a/js/src/jsfriendapi.cpp b/js/src/jsfriendapi.cpp index 775fefd27088..621ada1671cd 100644 --- a/js/src/jsfriendapi.cpp +++ b/js/src/jsfriendapi.cpp @@ -81,7 +81,7 @@ JS_SetGrayGCRootsTracer(JSRuntime *rt, JSTraceDataOp traceOp, void *data) JS_FRIEND_API(JSString *) JS_GetAnonymousString(JSRuntime *rt) { - JS_ASSERT(rt->hasContexts()); + MOZ_ASSERT(rt->hasContexts()); return rt->commonNames->anonymous; } @@ -245,7 +245,7 @@ JS_SetCompartmentPrincipals(JSCompartment *compartment, JSPrincipals *principals // with the old one, but JSPrincipals doesn't give us a way to do that. // But we can at least assert that we're not switching between system // and non-system. - JS_ASSERT(compartment->isSystem == isSystem); + MOZ_ASSERT(compartment->isSystem == isSystem); } // Set up the new principals. @@ -295,7 +295,7 @@ DefineHelpProperty(JSContext *cx, HandleObject obj, const char *prop, const char JS_FRIEND_API(bool) JS_DefineFunctionsWithHelp(JSContext *cx, HandleObject obj, const JSFunctionSpecWithHelp *fs) { - JS_ASSERT(!cx->runtime()->isAtomsCompartment(cx->compartment())); + MOZ_ASSERT(!cx->runtime()->isAtomsCompartment(cx->compartment())); CHECK_REQUEST(cx); assertSameCompartment(cx, obj); @@ -400,8 +400,8 @@ js::GetGlobalForObjectCrossCompartment(JSObject *obj) JS_FRIEND_API(JSObject *) js::GetPrototypeNoProxy(JSObject *obj) { - JS_ASSERT(!obj->is()); - JS_ASSERT(!obj->getTaggedProto().isLazy()); + MOZ_ASSERT(!obj->is()); + MOZ_ASSERT(!obj->getTaggedProto().isLazy()); return obj->getTaggedProto().toObjectOrNull(); } @@ -421,7 +421,7 @@ js::AssertSameCompartment(JSContext *cx, JSObject *obj) JS_FRIEND_API(void) js::AssertSameCompartment(JSObject *objA, JSObject *objB) { - JS_ASSERT(objA->compartment() == objB->compartment()); + MOZ_ASSERT(objA->compartment() == objB->compartment()); } #endif @@ -472,7 +472,7 @@ js::DefineFunctionWithReserved(JSContext *cx, JSObject *objArg, const char *name unsigned nargs, unsigned attrs) { RootedObject obj(cx, objArg); - JS_ASSERT(!cx->runtime()->isAtomsCompartment(cx->compartment())); + MOZ_ASSERT(!cx->runtime()->isAtomsCompartment(cx->compartment())); CHECK_REQUEST(cx); assertSameCompartment(cx, obj); JSAtom *atom = Atomize(cx, name, strlen(name)); @@ -487,7 +487,7 @@ js::NewFunctionWithReserved(JSContext *cx, JSNative native, unsigned nargs, unsi JSObject *parentArg, const char *name) { RootedObject parent(cx, parentArg); - JS_ASSERT(!cx->runtime()->isAtomsCompartment(cx->compartment())); + MOZ_ASSERT(!cx->runtime()->isAtomsCompartment(cx->compartment())); CHECK_REQUEST(cx); assertSameCompartment(cx, parent); @@ -509,8 +509,8 @@ js::NewFunctionByIdWithReserved(JSContext *cx, JSNative native, unsigned nargs, jsid id) { RootedObject parent(cx, parentArg); - JS_ASSERT(JSID_IS_STRING(id)); - JS_ASSERT(!cx->runtime()->isAtomsCompartment(cx->compartment())); + MOZ_ASSERT(JSID_IS_STRING(id)); + MOZ_ASSERT(!cx->runtime()->isAtomsCompartment(cx->compartment())); CHECK_REQUEST(cx); assertSameCompartment(cx, parent); @@ -523,14 +523,14 @@ js::NewFunctionByIdWithReserved(JSContext *cx, JSNative native, unsigned nargs, JS_FRIEND_API(const Value &) js::GetFunctionNativeReserved(JSObject *fun, size_t which) { - JS_ASSERT(fun->as().isNative()); + MOZ_ASSERT(fun->as().isNative()); return fun->as().getExtendedSlot(which); } JS_FRIEND_API(void) js::SetFunctionNativeReserved(JSObject *fun, size_t which, const Value &val) { - JS_ASSERT(fun->as().isNative()); + MOZ_ASSERT(fun->as().isNative()); MOZ_ASSERT_IF(val.isObject(), val.toObject().compartment() == fun->compartment()); fun->as().setExtendedSlot(which, val); } @@ -642,7 +642,7 @@ js::ZoneGlobalsAreAllGray(JS::Zone *zone) JS_FRIEND_API(JSGCTraceKind) js::GCThingTraceKind(void *thing) { - JS_ASSERT(thing); + MOZ_ASSERT(thing); return gc::GetGCThingTraceKind(thing); } @@ -751,7 +751,7 @@ static char * FormatFrame(JSContext *cx, const NonBuiltinScriptFrameIter &iter, char *buf, int num, bool showArgs, bool showLocals, bool showThisProps) { - JS_ASSERT(!cx->isExceptionPending()); + MOZ_ASSERT(!cx->isExceptionPending()); RootedScript script(cx, iter.script()); jsbytecode* pc = iter.pc(); @@ -911,7 +911,7 @@ FormatFrame(JSContext *cx, const NonBuiltinScriptFrameIter &iter, char *buf, int } } - JS_ASSERT(!cx->isExceptionPending()); + MOZ_ASSERT(!cx->isExceptionPending()); return buf; } @@ -1140,7 +1140,7 @@ JS::AutoDisableGenerationalGC::~AutoDisableGenerationalGC() gc->enableGenerationalGC(); #if defined(JSGC_GENERATIONAL) && defined(JS_GC_ZEAL) if (restartVerifier) { - JS_ASSERT(gc->isGenerationalGCEnabled()); + MOZ_ASSERT(gc->isGenerationalGCEnabled()); gc->startVerifyPostBarriers(); } #endif @@ -1170,7 +1170,7 @@ JS::IncrementalObjectBarrier(JSObject *obj) if (!obj) return; - JS_ASSERT(!obj->zone()->runtimeFromMainThread()->isHeapMajorCollecting()); + MOZ_ASSERT(!obj->zone()->runtimeFromMainThread()->isHeapMajorCollecting()); JSObject::writeBarrierPre(obj); } @@ -1190,7 +1190,7 @@ JS::IncrementalReferenceBarrier(void *ptr, JSGCTraceKind kind) Zone *zone = kind == JSTRACE_OBJECT ? static_cast(cell)->zone() : cell->asTenured()->zone(); - JS_ASSERT(!zone->runtimeFromMainThread()->isHeapMajorCollecting()); + MOZ_ASSERT(!zone->runtimeFromMainThread()->isHeapMajorCollecting()); #endif if (kind == JSTRACE_OBJECT) @@ -1231,7 +1231,7 @@ JS_FRIEND_API(JSCompartment *) js::GetAnyCompartmentInZone(JS::Zone *zone) { CompartmentsInZoneIter comp(zone); - JS_ASSERT(!comp.done()); + MOZ_ASSERT(!comp.done()); return comp.get(); } @@ -1323,10 +1323,10 @@ js::DefaultJSContext(JSRuntime *rt) { if (rt->defaultJSContextCallback) { JSContext *cx = rt->defaultJSContextCallback(rt); - JS_ASSERT(cx); + MOZ_ASSERT(cx); return cx; } - JS_ASSERT(rt->contextList.getFirst() == rt->contextList.getLast()); + MOZ_ASSERT(rt->contextList.getFirst() == rt->contextList.getLast()); return rt->contextList.getFirst(); } @@ -1383,8 +1383,8 @@ js::GetObjectMetadata(JSObject *obj) JS_FRIEND_API(void) js::UnsafeDefineElement(JSContext *cx, JS::HandleObject obj, uint32_t index, JS::HandleValue value) { - JS_ASSERT(obj->isNative()); - JS_ASSERT(index < obj->getDenseInitializedLength()); + MOZ_ASSERT(obj->isNative()); + MOZ_ASSERT(index < obj->getDenseInitializedLength()); obj->setDenseElementWithType(cx, index, value); } diff --git a/js/src/jsfriendapi.h b/js/src/jsfriendapi.h index 0793200d71d9..4c5bd87ae229 100644 --- a/js/src/jsfriendapi.h +++ b/js/src/jsfriendapi.h @@ -711,7 +711,7 @@ IsCallObject(JSObject *obj); inline JSObject * GetObjectParent(JSObject *obj) { - JS_ASSERT(!IsScopeObject(obj)); + MOZ_ASSERT(!IsScopeObject(obj)); return reinterpret_cast(obj)->shape->base->parent; } @@ -800,7 +800,7 @@ GetObjectPrivate(JSObject *obj) inline const JS::Value & GetReservedSlot(JSObject *obj, size_t slot) { - JS_ASSERT(slot < JSCLASS_RESERVED_SLOTS(GetObjectClass(obj))); + MOZ_ASSERT(slot < JSCLASS_RESERVED_SLOTS(GetObjectClass(obj))); return reinterpret_cast(obj)->slotRef(slot); } @@ -810,7 +810,7 @@ SetReservedSlotWithBarrier(JSObject *obj, size_t slot, const JS::Value &value); inline void SetReservedSlot(JSObject *obj, size_t slot, const JS::Value &value) { - JS_ASSERT(slot < JSCLASS_RESERVED_SLOTS(GetObjectClass(obj))); + MOZ_ASSERT(slot < JSCLASS_RESERVED_SLOTS(GetObjectClass(obj))); shadow::Object *sobj = reinterpret_cast(obj); if (sobj->slotRef(slot).isMarkable() #ifdef JSGC_GENERATIONAL @@ -830,7 +830,7 @@ GetObjectSlotSpan(JSObject *obj); inline const JS::Value & GetObjectSlot(JSObject *obj, size_t slot) { - JS_ASSERT(slot < GetObjectSlotSpan(obj)); + MOZ_ASSERT(slot < GetObjectSlotSpan(obj)); return reinterpret_cast(obj)->slotRef(slot); } @@ -1785,7 +1785,7 @@ const size_t TypedArrayLengthSlot = 1; inline void \ Get ## Type ## ArrayLengthAndData(JSObject *obj, uint32_t *length, type **data) \ { \ - JS_ASSERT(GetObjectClass(obj) == detail::Type ## ArrayClassPtr); \ + MOZ_ASSERT(GetObjectClass(obj) == detail::Type ## ArrayClassPtr); \ const JS::Value &slot = GetReservedSlot(obj, detail::TypedArrayLengthSlot); \ *length = mozilla::AssertedCast(slot.toInt32()); \ *data = static_cast(GetObjectPrivate(obj)); \ @@ -2411,7 +2411,7 @@ inline int CheckIsParallelNative(JSParallelNative parallelNative); static MOZ_ALWAYS_INLINE const JSJitInfo * FUNCTION_VALUE_TO_JITINFO(const JS::Value& v) { - JS_ASSERT(js::GetObjectClass(&v.toObject()) == js::FunctionClassPtr); + MOZ_ASSERT(js::GetObjectClass(&v.toObject()) == js::FunctionClassPtr); return reinterpret_cast(&v.toObject())->jitinfo; } @@ -2422,7 +2422,7 @@ static MOZ_ALWAYS_INLINE void SET_JITINFO(JSFunction * func, const JSJitInfo *info) { js::shadow::Function *fun = reinterpret_cast(func); - JS_ASSERT(!(fun->flags & JS_FUNCTION_INTERPRETED_BIT)); + MOZ_ASSERT(!(fun->flags & JS_FUNCTION_INTERPRETED_BIT)); fun->jitinfo = info; } @@ -2469,9 +2469,9 @@ bool IdMatchesAtom(jsid id, JSAtom *atom); static MOZ_ALWAYS_INLINE jsid NON_INTEGER_ATOM_TO_JSID(JSAtom *atom) { - JS_ASSERT(((size_t)atom & 0x7) == 0); + MOZ_ASSERT(((size_t)atom & 0x7) == 0); jsid id = JSID_FROM_BITS((size_t)atom); - JS_ASSERT(js::detail::IdMatchesAtom(id, atom)); + MOZ_ASSERT(js::detail::IdMatchesAtom(id, atom)); return id; } @@ -2507,7 +2507,7 @@ IdToValue(jsid id) return JS::Int32Value(JSID_TO_INT(id)); if (JSID_IS_SYMBOL(id)) return JS::SymbolValue(JSID_TO_SYMBOL(id)); - JS_ASSERT(JSID_IS_VOID(id)); + MOZ_ASSERT(JSID_IS_VOID(id)); return JS::UndefinedValue(); } diff --git a/js/src/jsfun.cpp b/js/src/jsfun.cpp index 3715de7724c2..bdca702b5ab1 100644 --- a/js/src/jsfun.cpp +++ b/js/src/jsfun.cpp @@ -387,15 +387,15 @@ ResolveInterpretedFunctionPrototype(JSContext *cx, HandleObject obj) { #ifdef DEBUG JSFunction *fun = &obj->as(); - JS_ASSERT(fun->isInterpreted() || fun->isAsmJSNative()); - JS_ASSERT(!fun->isFunctionPrototype()); + MOZ_ASSERT(fun->isInterpreted() || fun->isAsmJSNative()); + MOZ_ASSERT(!fun->isFunctionPrototype()); #endif // Assert that fun is not a compiler-created function object, which // must never leak to script or embedding code and then be mutated. // Also assert that obj is not bound, per the ES5 15.3.4.5 ref above. - JS_ASSERT(!IsInternalFunctionObject(obj)); - JS_ASSERT(!obj->isBoundFunction()); + MOZ_ASSERT(!IsInternalFunctionObject(obj)); + MOZ_ASSERT(!obj->isBoundFunction()); // Make the prototype object an instance of Object with the same parent as // the function object itself, unless the function is an ES6 generator. In @@ -481,7 +481,7 @@ js::fun_resolve(JSContext *cx, HandleObject obj, HandleId id, MutableHandleObjec } if (JSID_IS_ATOM(id, cx->names().length) || JSID_IS_ATOM(id, cx->names().name)) { - JS_ASSERT(!IsInternalFunctionObject(obj)); + MOZ_ASSERT(!IsInternalFunctionObject(obj)); RootedValue v(cx); if (JSID_IS_ATOM(id, cx->names().length)) { @@ -548,7 +548,7 @@ js::XDRInterpretedFunction(XDRState *xdr, HandleObject enclosingScope, Han // This can only happen for re-lazified cloned functions, so this // does not apply to any JSFunction produced by the parser, only to // JSFunction created by the runtime. - JS_ASSERT(!fun->lazyScript()->maybeScript()); + MOZ_ASSERT(!fun->lazyScript()->maybeScript()); // Encode a lazy script. firstword |= IsLazy; @@ -616,7 +616,7 @@ js::XDRInterpretedFunction(XDRState *xdr, HandleObject enclosingScope, Han } else { fun->initScript(script); script->setFunction(fun); - JS_ASSERT(fun->nargs() == script->bindings.numArgs()); + MOZ_ASSERT(fun->nargs() == script->bindings.numArgs()); } bool singleton = firstword & HasSingletonType; @@ -779,7 +779,7 @@ CreateFunctionConstructor(JSContext *cx, JSProtoKey key) if (!functionCtor) return nullptr; - JS_ASSERT(ctor == functionCtor); + MOZ_ASSERT(ctor == functionCtor); return functionCtor; } @@ -807,7 +807,7 @@ CreateFunctionPrototype(JSContext *cx, JSProtoKey key) if (!proto) return nullptr; - JS_ASSERT(proto == functionProto); + MOZ_ASSERT(proto == functionProto); functionProto->setIsFunctionPrototype(); } @@ -963,12 +963,12 @@ js::FindBody(JSContext *cx, HandleFunction fun, HandleLinearString src, size_t * if (end[-1] == '}') { end--; } else { - JS_ASSERT(!braced); + MOZ_ASSERT(!braced); for (; unicode::IsSpaceOrBOM2(end[-1]); end--) ; } *bodyEnd = end - srcChars.start(); - JS_ASSERT(*bodyStart <= *bodyEnd); + MOZ_ASSERT(*bodyStart <= *bodyEnd); return true; } @@ -1080,7 +1080,7 @@ js::FunctionToString(JSContext *cx, HandleFunction fun, bool bodyOnly, bool lamb // If the function is defined in the Function constructor, we // already have a body. if (!funCon) { - JS_ASSERT(!buildBody); + MOZ_ASSERT(!buildBody); if (!FindBody(cx, fun, src, &bodyStart, &bodyEnd)) return nullptr; } else { @@ -1132,7 +1132,7 @@ js::FunctionToString(JSContext *cx, HandleFunction fun, bool bodyOnly, bool lamb if (!lambdaParen && fun->isLambda() && !fun->isArrow() && !out.append(")")) return nullptr; } else { - JS_ASSERT(!fun->isExprClosure()); + MOZ_ASSERT(!fun->isExprClosure()); if ((!bodyOnly && !out.append("() {\n ")) || !out.append("[native code]") @@ -1165,7 +1165,7 @@ bool js::fun_toString(JSContext *cx, unsigned argc, Value *vp) { CallArgs args = CallArgsFromVp(argc, vp); - JS_ASSERT(IsFunctionObject(args.calleev())); + MOZ_ASSERT(IsFunctionObject(args.calleev())); uint32_t indent = 0; @@ -1189,7 +1189,7 @@ static bool fun_toSource(JSContext *cx, unsigned argc, Value *vp) { CallArgs args = CallArgsFromVp(argc, vp); - JS_ASSERT(IsFunctionObject(args.calleev())); + MOZ_ASSERT(IsFunctionObject(args.calleev())); RootedObject obj(cx, ToObject(cx, args.thisv())); if (!obj) @@ -1257,7 +1257,7 @@ js_fun_apply(JSContext *cx, unsigned argc, Value *vp) if (args[1].isMagic(JS_OPTIMIZED_ARGUMENTS)) { // Step 3-6. ScriptFrameIter iter(cx); - JS_ASSERT(iter.numActualArgs() <= ARGS_LENGTH_MAX); + MOZ_ASSERT(iter.numActualArgs() <= ARGS_LENGTH_MAX); if (!args2.init(iter.numActualArgs())) return false; @@ -1343,7 +1343,7 @@ JSFunction::initBoundFunction(JSContext *cx, HandleValue thisArg, const js::Value & JSFunction::getBoundFunctionThis() const { - JS_ASSERT(isBoundFunction()); + MOZ_ASSERT(isBoundFunction()); return getSlot(JSSLOT_BOUND_FUNCTION_THIS); } @@ -1351,8 +1351,8 @@ JSFunction::getBoundFunctionThis() const const js::Value & JSFunction::getBoundFunctionArgument(unsigned which) const { - JS_ASSERT(isBoundFunction()); - JS_ASSERT(which < getBoundFunctionArgumentCount()); + MOZ_ASSERT(isBoundFunction()); + MOZ_ASSERT(which < getBoundFunctionArgumentCount()); return getSlot(BOUND_FUNCTION_RESERVED_SLOTS + which); } @@ -1360,7 +1360,7 @@ JSFunction::getBoundFunctionArgument(unsigned which) const size_t JSFunction::getBoundFunctionArgumentCount() const { - JS_ASSERT(isBoundFunction()); + MOZ_ASSERT(isBoundFunction()); return getSlot(JSSLOT_BOUND_FUNCTION_ARGS_COUNT).toPrivateUint32(); } @@ -1368,7 +1368,7 @@ JSFunction::getBoundFunctionArgumentCount() const /* static */ bool JSFunction::createScriptForLazilyInterpretedFunction(JSContext *cx, HandleFunction fun) { - JS_ASSERT(fun->isInterpretedLazy()); + MOZ_ASSERT(fun->isInterpretedLazy()); Rooted lazy(cx, fun->lazyScriptOrNull()); if (lazy) { @@ -1435,7 +1435,7 @@ JSFunction::createScriptForLazilyInterpretedFunction(JSContext *cx, HandleFuncti return true; } - JS_ASSERT(lazy->source()->hasSourceData()); + MOZ_ASSERT(lazy->source()->hasSourceData()); // Parse and compile the script from source. UncompressedSourceCache::AutoHoldEntry holder; @@ -1475,7 +1475,7 @@ JSFunction::createScriptForLazilyInterpretedFunction(JSContext *cx, HandleFuncti } /* Lazily cloned self-hosted script. */ - JS_ASSERT(fun->isSelfHostedBuiltin()); + MOZ_ASSERT(fun->isSelfHostedBuiltin()); RootedAtom funAtom(cx, &fun->getExtendedSlot(0).toString()->asAtom()); if (!funAtom) return false; @@ -1487,9 +1487,9 @@ void JSFunction::relazify(JSTracer *trc) { JSScript *script = nonLazyScript(); - JS_ASSERT(script->isRelazifiable()); - JS_ASSERT(!compartment()->hasBeenEntered()); - JS_ASSERT(!compartment()->debugMode()); + MOZ_ASSERT(script->isRelazifiable()); + MOZ_ASSERT(!compartment()->hasBeenEntered()); + MOZ_ASSERT(!compartment()->debugMode()); // If the script's canonical function isn't lazy, we have to mark the // script. Otherwise, the following scenario would leave it unmarked @@ -1508,7 +1508,7 @@ JSFunction::relazify(JSTracer *trc) LazyScript *lazy = script->maybeLazyScript(); u.i.s.lazy_ = lazy; if (lazy) { - JS_ASSERT(!isSelfHostedBuiltin()); + MOZ_ASSERT(!isSelfHostedBuiltin()); // If this is the script stored in the lazy script to be cloned // for un-lazifying other functions, reset it so the script can // be freed. @@ -1516,9 +1516,9 @@ JSFunction::relazify(JSTracer *trc) lazy->resetScript(); MarkLazyScriptUnbarriered(trc, &u.i.s.lazy_, "lazyScript"); } else { - JS_ASSERT(isSelfHostedBuiltin()); - JS_ASSERT(isExtended()); - JS_ASSERT(getExtendedSlot(0).toString()->isAtom()); + MOZ_ASSERT(isSelfHostedBuiltin()); + MOZ_ASSERT(isExtended()); + MOZ_ASSERT(getExtendedSlot(0).toString()->isAtom()); } } @@ -1528,7 +1528,7 @@ js::CallOrConstructBoundFunction(JSContext *cx, unsigned argc, Value *vp) { CallArgs args = CallArgsFromVp(argc, vp); RootedFunction fun(cx, &args.callee().as()); - JS_ASSERT(fun->isBoundFunction()); + MOZ_ASSERT(fun->isBoundFunction()); /* 15.3.4.5.1 step 1, 15.3.4.5.2 step 3. */ unsigned argslen = fun->getBoundFunctionArgumentCount(); @@ -1658,7 +1658,7 @@ OnBadFormal(JSContext *cx, TokenKind tt) if (tt != TOK_ERROR) JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_BAD_FORMAL); else - JS_ASSERT(cx->isExceptionPending()); + MOZ_ASSERT(cx->isExceptionPending()); return false; } @@ -1693,7 +1693,7 @@ FunctionConstructor(JSContext *cx, unsigned argc, Value *vp, GeneratorKind gener bool hasRest = false; bool isStarGenerator = generatorKind == StarGenerator; - JS_ASSERT(generatorKind != LegacyGenerator); + MOZ_ASSERT(generatorKind != LegacyGenerator); RootedScript maybeScript(cx); const char *filename; @@ -1850,7 +1850,7 @@ FunctionConstructor(JSContext *cx, unsigned argc, Value *vp, GeneratorKind gener #ifdef DEBUG for (unsigned i = 0; i < formals.length(); ++i) { JSString *str = formals[i]; - JS_ASSERT(str->asAtom().asPropertyName() == formals[i]); + MOZ_ASSERT(str->asAtom().asPropertyName() == formals[i]); } #endif @@ -1941,14 +1941,14 @@ js::NewFunctionWithProto(ExclusiveContext *cx, HandleObject funobjArg, Native na gc::AllocKind allocKind /* = JSFunction::FinalizeKind */, NewObjectKind newKind /* = GenericObject */) { - JS_ASSERT(allocKind == JSFunction::FinalizeKind || allocKind == JSFunction::ExtendedFinalizeKind); - JS_ASSERT(sizeof(JSFunction) <= gc::Arena::thingSize(JSFunction::FinalizeKind)); - JS_ASSERT(sizeof(FunctionExtended) <= gc::Arena::thingSize(JSFunction::ExtendedFinalizeKind)); + MOZ_ASSERT(allocKind == JSFunction::FinalizeKind || allocKind == JSFunction::ExtendedFinalizeKind); + MOZ_ASSERT(sizeof(JSFunction) <= gc::Arena::thingSize(JSFunction::FinalizeKind)); + MOZ_ASSERT(sizeof(FunctionExtended) <= gc::Arena::thingSize(JSFunction::ExtendedFinalizeKind)); RootedObject funobj(cx, funobjArg); if (funobj) { - JS_ASSERT(funobj->is()); - JS_ASSERT(funobj->getParent() == parent); + MOZ_ASSERT(funobj->is()); + MOZ_ASSERT(funobj->getParent() == parent); JS_ASSERT_IF(native, funobj->hasSingletonType()); } else { // Don't give asm.js module functions a singleton type since they @@ -1970,12 +1970,12 @@ js::NewFunctionWithProto(ExclusiveContext *cx, HandleObject funobjArg, Native na fun->setArgCount(uint16_t(nargs)); fun->setFlags(flags); if (fun->isInterpreted()) { - JS_ASSERT(!native); + MOZ_ASSERT(!native); fun->mutableScript().init(nullptr); fun->initEnvironment(parent); } else { - JS_ASSERT(fun->isNative()); - JS_ASSERT(native); + MOZ_ASSERT(fun->isNative()); + MOZ_ASSERT(native); fun->initNative(native, nullptr); } if (allocKind == JSFunction::ExtendedFinalizeKind) @@ -1989,8 +1989,8 @@ JSFunction * js::CloneFunctionObject(JSContext *cx, HandleFunction fun, HandleObject parent, gc::AllocKind allocKind, NewObjectKind newKindArg /* = GenericObject */) { - JS_ASSERT(parent); - JS_ASSERT(!fun->isBoundFunction()); + MOZ_ASSERT(parent); + MOZ_ASSERT(!fun->isBoundFunction()); bool useSameScript = cx->compartment() == fun->compartment() && !fun->hasSingletonType() && @@ -2112,20 +2112,20 @@ js::ReportIncompatibleMethod(JSContext *cx, CallReceiver call, const Class *clas #ifdef DEBUG if (thisv.isObject()) { - JS_ASSERT(thisv.toObject().getClass() != clasp || - !thisv.toObject().isNative() || - !thisv.toObject().getProto() || - thisv.toObject().getProto()->getClass() != clasp); + MOZ_ASSERT(thisv.toObject().getClass() != clasp || + !thisv.toObject().isNative() || + !thisv.toObject().getProto() || + thisv.toObject().getProto()->getClass() != clasp); } else if (thisv.isString()) { - JS_ASSERT(clasp != &StringObject::class_); + MOZ_ASSERT(clasp != &StringObject::class_); } else if (thisv.isNumber()) { - JS_ASSERT(clasp != &NumberObject::class_); + MOZ_ASSERT(clasp != &NumberObject::class_); } else if (thisv.isBoolean()) { - JS_ASSERT(clasp != &BooleanObject::class_); + MOZ_ASSERT(clasp != &BooleanObject::class_); } else if (thisv.isSymbol()) { - JS_ASSERT(clasp != &SymbolObject::class_); + MOZ_ASSERT(clasp != &SymbolObject::class_); } else { - JS_ASSERT(thisv.isUndefined() || thisv.isNull()); + MOZ_ASSERT(thisv.isUndefined() || thisv.isNull()); } #endif @@ -2181,9 +2181,9 @@ CheckIsValidConstructible(Value calleev) { JSObject *callee = &calleev.toObject(); if (callee->is()) - JS_ASSERT(callee->as().isNativeConstructor()); + MOZ_ASSERT(callee->as().isNativeConstructor()); else - JS_ASSERT(callee->constructHook() != nullptr); + MOZ_ASSERT(callee->constructHook() != nullptr); } } // namespace detail diff --git a/js/src/jsfun.h b/js/src/jsfun.h index a6514b04785a..76fd256a4dde 100644 --- a/js/src/jsfun.h +++ b/js/src/jsfun.h @@ -93,7 +93,7 @@ class JSFunction : public JSObject /* Call objects must be created for each invocation of a heavyweight function. */ bool isHeavyweight() const { - JS_ASSERT(!isInterpretedLazy()); + MOZ_ASSERT(!isInterpretedLazy()); if (isNative()) return false; @@ -187,17 +187,17 @@ class JSFunction : public JSObject } void setIsSelfHostedBuiltin() { - JS_ASSERT(!isSelfHostedBuiltin()); + MOZ_ASSERT(!isSelfHostedBuiltin()); flags_ |= SELF_HOSTED; } void setIsSelfHostedConstructor() { - JS_ASSERT(!isSelfHostedConstructor()); + MOZ_ASSERT(!isSelfHostedConstructor()); flags_ |= SELF_HOSTED_CTOR; } void setIsFunctionPrototype() { - JS_ASSERT(!isFunctionPrototype()); + MOZ_ASSERT(!isFunctionPrototype()); flags_ |= IS_FUN_PROTO; } @@ -219,9 +219,9 @@ class JSFunction : public JSObject } void setGuessedAtom(JSAtom *atom) { - JS_ASSERT(!atom_); - JS_ASSERT(atom); - JS_ASSERT(!hasGuessedAtom()); + MOZ_ASSERT(!atom_); + MOZ_ASSERT(atom); + MOZ_ASSERT(!hasGuessedAtom()); atom_ = atom; flags_ |= HAS_GUESSED_ATOM; } @@ -234,17 +234,17 @@ class JSFunction : public JSObject * activations (stack frames) of the function. */ JSObject *environment() const { - JS_ASSERT(isInterpreted()); + MOZ_ASSERT(isInterpreted()); return u.i.env_; } void setEnvironment(JSObject *obj) { - JS_ASSERT(isInterpreted()); + MOZ_ASSERT(isInterpreted()); *(js::HeapPtrObject *)&u.i.env_ = obj; } void initEnvironment(JSObject *obj) { - JS_ASSERT(isInterpreted()); + MOZ_ASSERT(isInterpreted()); ((js::HeapPtrObject *)&u.i.env_)->init(obj); } @@ -278,8 +278,8 @@ class JSFunction : public JSObject // - For functions known to have a JSScript, nonLazyScript() will get it. JSScript *getOrCreateScript(JSContext *cx) { - JS_ASSERT(isInterpreted()); - JS_ASSERT(cx); + MOZ_ASSERT(isInterpreted()); + MOZ_ASSERT(cx); if (isInterpretedLazy()) { JS::RootedFunction self(cx, this); if (!createScriptForLazilyInterpretedFunction(cx, self)) @@ -313,8 +313,8 @@ class JSFunction : public JSObject } JSScript *nonLazyScript() const { - JS_ASSERT(hasScript()); - JS_ASSERT(u.i.s.script_); + MOZ_ASSERT(hasScript()); + MOZ_ASSERT(u.i.s.script_); return u.i.s.script_; } @@ -329,17 +329,17 @@ class JSFunction : public JSObject } js::HeapPtrScript &mutableScript() { - JS_ASSERT(isInterpreted()); + MOZ_ASSERT(isInterpreted()); return *(js::HeapPtrScript *)&u.i.s.script_; } js::LazyScript *lazyScript() const { - JS_ASSERT(isInterpretedLazy() && u.i.s.lazy_); + MOZ_ASSERT(isInterpretedLazy() && u.i.s.lazy_); return u.i.s.lazy_; } js::LazyScript *lazyScriptOrNull() const { - JS_ASSERT(isInterpretedLazy()); + MOZ_ASSERT(isInterpretedLazy()); return u.i.s.lazy_; } @@ -350,7 +350,7 @@ class JSFunction : public JSObject return nonLazyScript()->generatorKind(); if (js::LazyScript *lazy = lazyScriptOrNull()) return lazy->generatorKind(); - JS_ASSERT(isSelfHostedBuiltin()); + MOZ_ASSERT(isSelfHostedBuiltin()); return js::NotGenerator; } @@ -361,19 +361,19 @@ class JSFunction : public JSObject bool isStarGenerator() const { return generatorKind() == js::StarGenerator; } void setScript(JSScript *script_) { - JS_ASSERT(hasScript()); + MOZ_ASSERT(hasScript()); mutableScript() = script_; } void initScript(JSScript *script_) { - JS_ASSERT(hasScript()); + MOZ_ASSERT(hasScript()); mutableScript().init(script_); } void setUnlazifiedScript(JSScript *script) { // Note: createScriptForLazilyInterpretedFunction triggers a barrier on // lazy script before it is overwritten here. - JS_ASSERT(isInterpretedLazy()); + MOZ_ASSERT(isInterpretedLazy()); if (!lazyScript()->maybeScript()) lazyScript()->initScript(script); flags_ &= ~INTERPRETED_LAZY; @@ -382,14 +382,14 @@ class JSFunction : public JSObject } void initLazyScript(js::LazyScript *lazy) { - JS_ASSERT(isInterpreted()); + MOZ_ASSERT(isInterpreted()); flags_ &= ~INTERPRETED; flags_ |= INTERPRETED_LAZY; u.i.s.lazy_ = lazy; } JSNative native() const { - JS_ASSERT(isNative()); + MOZ_ASSERT(isNative()); return u.n.native; } @@ -398,7 +398,7 @@ class JSFunction : public JSObject } JSParallelNative parallelNative() const { - JS_ASSERT(hasParallelNative()); + MOZ_ASSERT(hasParallelNative()); return jitInfo()->parallelNative; } @@ -407,18 +407,18 @@ class JSFunction : public JSObject } void initNative(js::Native native, const JSJitInfo *jitinfo) { - JS_ASSERT(native); + MOZ_ASSERT(native); u.n.native = native; u.n.jitinfo = jitinfo; } const JSJitInfo *jitInfo() const { - JS_ASSERT(isNative()); + MOZ_ASSERT(isNative()); return u.n.jitinfo; } void setJitInfo(const JSJitInfo *data) { - JS_ASSERT(isNative()); + MOZ_ASSERT(isNative()); u.n.jitinfo = data; } @@ -444,7 +444,7 @@ class JSFunction : public JSObject const js::Value *args, unsigned argslen); JSObject *getBoundFunctionTarget() const { - JS_ASSERT(isBoundFunction()); + MOZ_ASSERT(isBoundFunction()); /* Bound functions abuse |parent| to store their target function. */ return getParent(); @@ -582,23 +582,23 @@ FindBody(JSContext *cx, HandleFunction fun, HandleLinearString src, size_t *body inline js::FunctionExtended * JSFunction::toExtended() { - JS_ASSERT(isExtended()); + MOZ_ASSERT(isExtended()); return static_cast(this); } inline const js::FunctionExtended * JSFunction::toExtended() const { - JS_ASSERT(isExtended()); + MOZ_ASSERT(isExtended()); return static_cast(this); } inline void JSFunction::initializeExtended() { - JS_ASSERT(isExtended()); + MOZ_ASSERT(isExtended()); - JS_ASSERT(mozilla::ArrayLength(toExtended()->extendedSlots) == 2); + MOZ_ASSERT(mozilla::ArrayLength(toExtended()->extendedSlots) == 2); toExtended()->extendedSlots[0].init(js::UndefinedValue()); toExtended()->extendedSlots[1].init(js::UndefinedValue()); } @@ -606,21 +606,21 @@ JSFunction::initializeExtended() inline void JSFunction::initExtendedSlot(size_t which, const js::Value &val) { - JS_ASSERT(which < mozilla::ArrayLength(toExtended()->extendedSlots)); + MOZ_ASSERT(which < mozilla::ArrayLength(toExtended()->extendedSlots)); toExtended()->extendedSlots[which].init(val); } inline void JSFunction::setExtendedSlot(size_t which, const js::Value &val) { - JS_ASSERT(which < mozilla::ArrayLength(toExtended()->extendedSlots)); + MOZ_ASSERT(which < mozilla::ArrayLength(toExtended()->extendedSlots)); toExtended()->extendedSlots[which] = val; } inline const js::Value & JSFunction::getExtendedSlot(size_t which) const { - JS_ASSERT(which < mozilla::ArrayLength(toExtended()->extendedSlots)); + MOZ_ASSERT(which < mozilla::ArrayLength(toExtended()->extendedSlots)); return toExtended()->extendedSlots[which]; } diff --git a/js/src/jsgc.cpp b/js/src/jsgc.cpp index bce7b332c061..3cef22b42eca 100644 --- a/js/src/jsgc.cpp +++ b/js/src/jsgc.cpp @@ -418,7 +418,7 @@ template<> JSObject * ArenaCellIterImpl::get() const { - JS_ASSERT(!done()); + MOZ_ASSERT(!done()); return reinterpret_cast(getCell()); } @@ -430,7 +430,7 @@ ArenaHeader::checkSynchronizedWithFreeList() const * Do not allow to access the free list when its real head is still stored * in FreeLists and is not synchronized with this one. */ - JS_ASSERT(allocated()); + MOZ_ASSERT(allocated()); /* * We can be called from the background finalization thread when the free @@ -451,7 +451,7 @@ ArenaHeader::checkSynchronizedWithFreeList() const * Here this arena has free things, FreeList::lists[thingKind] is not * empty and also points to this arena. Thus they must be the same. */ - JS_ASSERT(freeList->isSameNonEmptySpan(firstSpan)); + MOZ_ASSERT(freeList->isSameNonEmptySpan(firstSpan)); } #endif @@ -483,15 +483,15 @@ inline size_t Arena::finalize(FreeOp *fop, AllocKind thingKind, size_t thingSize) { /* Enforce requirements on size of T. */ - JS_ASSERT(thingSize % CellSize == 0); - JS_ASSERT(thingSize <= 255); + MOZ_ASSERT(thingSize % CellSize == 0); + MOZ_ASSERT(thingSize <= 255); - JS_ASSERT(aheader.allocated()); - JS_ASSERT(thingKind == aheader.getAllocKind()); - JS_ASSERT(thingSize == aheader.getThingSize()); - JS_ASSERT(!aheader.hasDelayedMarking); - JS_ASSERT(!aheader.markOverflow); - JS_ASSERT(!aheader.allocatedDuringIncremental); + MOZ_ASSERT(aheader.allocated()); + MOZ_ASSERT(thingKind == aheader.getAllocKind()); + MOZ_ASSERT(thingSize == aheader.getThingSize()); + MOZ_ASSERT(!aheader.hasDelayedMarking); + MOZ_ASSERT(!aheader.markOverflow); + MOZ_ASSERT(!aheader.allocatedDuringIncremental); uintptr_t firstThing = thingsStart(thingKind); uintptr_t firstThingOrSuccessorOfLastMarkedThing = firstThing; @@ -523,12 +523,12 @@ Arena::finalize(FreeOp *fop, AllocKind thingKind, size_t thingSize) if (nmarked == 0) { // Do nothing. The caller will update the arena header appropriately. - JS_ASSERT(newListTail == &newListHead); + MOZ_ASSERT(newListTail == &newListHead); JS_EXTRA_POISON(data, JS_SWEPT_TENURED_PATTERN, sizeof(data)); return nmarked; } - JS_ASSERT(firstThingOrSuccessorOfLastMarkedThing != firstThing); + MOZ_ASSERT(firstThingOrSuccessorOfLastMarkedThing != firstThing); uintptr_t lastMarkedThing = firstThingOrSuccessorOfLastMarkedThing - thingSize; if (lastThing == lastMarkedThing) { // If the last thing was marked, we will have already set the bounds of @@ -543,7 +543,7 @@ Arena::finalize(FreeOp *fop, AllocKind thingKind, size_t thingSize) size_t nfree = 0; for (const FreeSpan *span = &newListHead; !span->isEmpty(); span = span->nextSpan()) nfree += span->length(thingSize); - JS_ASSERT(nfree + nmarked == thingsPerArena(thingSize)); + MOZ_ASSERT(nfree + nmarked == thingsPerArena(thingSize)); #endif aheader.setFirstFreeSpan(&newListHead); return nmarked; @@ -665,11 +665,11 @@ ChunkPool::get(JSRuntime *rt) { Chunk *chunk = emptyChunkListHead; if (!chunk) { - JS_ASSERT(!emptyCount); + MOZ_ASSERT(!emptyCount); return nullptr; } - JS_ASSERT(emptyCount); + MOZ_ASSERT(emptyCount); emptyChunkListHead = chunk->info.next; --emptyCount; return chunk; @@ -696,14 +696,14 @@ ChunkPool::Enum::front() inline void ChunkPool::Enum::popFront() { - JS_ASSERT(!empty()); + MOZ_ASSERT(!empty()); chunkp = &front()->info.next; } inline void ChunkPool::Enum::removeAndPopFront() { - JS_ASSERT(!empty()); + MOZ_ASSERT(!empty()); *chunkp = front()->info.next; --pool.emptyCount; } @@ -722,8 +722,8 @@ GCRuntime::expireChunkPool(bool shrinkBuffers, bool releaseAll) unsigned freeChunkCount = 0; for (ChunkPool::Enum e(chunkPool); !e.empty(); ) { Chunk *chunk = e.front(); - JS_ASSERT(chunk->unused()); - JS_ASSERT(!chunkSet.has(chunk)); + MOZ_ASSERT(chunk->unused()); + MOZ_ASSERT(!chunkSet.has(chunk)); if (releaseAll || freeChunkCount >= tunables.maxEmptyChunkCount() || (freeChunkCount >= tunables.minEmptyChunkCount() && (shrinkBuffers || chunk->info.age == MAX_EMPTY_CHUNK_AGE))) @@ -739,7 +739,7 @@ GCRuntime::expireChunkPool(bool shrinkBuffers, bool releaseAll) e.popFront(); } } - JS_ASSERT(chunkPool.getEmptyCount() <= tunables.maxEmptyChunkCount()); + MOZ_ASSERT(chunkPool.getEmptyCount() <= tunables.maxEmptyChunkCount()); JS_ASSERT_IF(shrinkBuffers, chunkPool.getEmptyCount() <= tunables.minEmptyChunkCount()); JS_ASSERT_IF(releaseAll, chunkPool.getEmptyCount() == 0); return freeList; @@ -749,7 +749,7 @@ void GCRuntime::freeChunkList(Chunk *chunkListHead) { while (Chunk *chunk = chunkListHead) { - JS_ASSERT(!chunk->info.numArenasFreeCommitted); + MOZ_ASSERT(!chunk->info.numArenasFreeCommitted); chunkListHead = chunk->info.next; FreeChunk(rt, chunk); } @@ -776,7 +776,7 @@ Chunk::allocate(JSRuntime *rt) inline void GCRuntime::releaseChunk(Chunk *chunk) { - JS_ASSERT(chunk); + MOZ_ASSERT(chunk); prepareToFreeChunk(chunk->info); FreeChunk(rt, chunk); } @@ -784,7 +784,7 @@ GCRuntime::releaseChunk(Chunk *chunk) inline void GCRuntime::prepareToFreeChunk(ChunkInfo &info) { - JS_ASSERT(numArenasFreeCommitted >= info.numArenasFreeCommitted); + MOZ_ASSERT(numArenasFreeCommitted >= info.numArenasFreeCommitted); numArenasFreeCommitted -= info.numArenasFreeCommitted; stats.count(gcstats::STAT_DESTROY_CHUNK); #ifdef DEBUG @@ -851,13 +851,13 @@ Chunk::addToAvailableList(Zone *zone) inline void Chunk::insertToAvailableList(Chunk **insertPoint) { - JS_ASSERT(hasAvailableArenas()); - JS_ASSERT(!info.prevp); - JS_ASSERT(!info.next); + MOZ_ASSERT(hasAvailableArenas()); + MOZ_ASSERT(!info.prevp); + MOZ_ASSERT(!info.next); info.prevp = insertPoint; Chunk *insertBefore = *insertPoint; if (insertBefore) { - JS_ASSERT(insertBefore->info.prevp == insertPoint); + MOZ_ASSERT(insertBefore->info.prevp == insertPoint); insertBefore->info.prevp = &info.next; } info.next = insertBefore; @@ -867,10 +867,10 @@ Chunk::insertToAvailableList(Chunk **insertPoint) inline void Chunk::removeFromAvailableList() { - JS_ASSERT(info.prevp); + MOZ_ASSERT(info.prevp); *info.prevp = info.next; if (info.next) { - JS_ASSERT(info.next->info.prevp == &info.next); + MOZ_ASSERT(info.next->info.prevp == &info.next); info.next->info.prevp = info.prevp; } info.prevp = nullptr; @@ -899,8 +899,8 @@ Chunk::findDecommittedArenaOffset() ArenaHeader * Chunk::fetchNextDecommittedArena() { - JS_ASSERT(info.numArenasFreeCommitted == 0); - JS_ASSERT(info.numArenasFree > 0); + MOZ_ASSERT(info.numArenasFreeCommitted == 0); + MOZ_ASSERT(info.numArenasFree > 0); unsigned offset = findDecommittedArenaOffset(); info.lastDecommittedArenaOffset = offset + 1; @@ -917,15 +917,15 @@ Chunk::fetchNextDecommittedArena() inline void GCRuntime::updateOnFreeArenaAlloc(const ChunkInfo &info) { - JS_ASSERT(info.numArenasFreeCommitted <= numArenasFreeCommitted); + MOZ_ASSERT(info.numArenasFreeCommitted <= numArenasFreeCommitted); --numArenasFreeCommitted; } inline ArenaHeader * Chunk::fetchNextFreeArena(JSRuntime *rt) { - JS_ASSERT(info.numArenasFreeCommitted > 0); - JS_ASSERT(info.numArenasFreeCommitted <= info.numArenasFree); + MOZ_ASSERT(info.numArenasFreeCommitted > 0); + MOZ_ASSERT(info.numArenasFreeCommitted <= info.numArenasFree); ArenaHeader *aheader = info.freeArenasHead; info.freeArenasHead = aheader->next; @@ -939,7 +939,7 @@ Chunk::fetchNextFreeArena(JSRuntime *rt) ArenaHeader * Chunk::allocateArena(Zone *zone, AllocKind thingKind) { - JS_ASSERT(hasAvailableArenas()); + MOZ_ASSERT(hasAvailableArenas()); JSRuntime *rt = zone->runtimeFromAnyThread(); if (!rt->isHeapMinorCollecting() && @@ -983,7 +983,7 @@ GCRuntime::updateOnArenaFree(const ChunkInfo &info) inline void Chunk::addArenaToFreeList(JSRuntime *rt, ArenaHeader *aheader) { - JS_ASSERT(!aheader->allocated()); + MOZ_ASSERT(!aheader->allocated()); aheader->next = info.freeArenasHead; info.freeArenasHead = aheader; ++info.numArenasFreeCommitted; @@ -1002,8 +1002,8 @@ Chunk::recycleArena(ArenaHeader *aheader, SortedArenaList &dest, AllocKind thing void Chunk::releaseArena(ArenaHeader *aheader) { - JS_ASSERT(aheader->allocated()); - JS_ASSERT(!aheader->hasDelayedMarking); + MOZ_ASSERT(aheader->allocated()); + MOZ_ASSERT(!aheader->hasDelayedMarking); Zone *zone = aheader->zone; JSRuntime *rt = zone->runtimeFromAnyThread(); AutoLockGC maybeLock; @@ -1018,13 +1018,13 @@ Chunk::releaseArena(ArenaHeader *aheader) addArenaToFreeList(rt, aheader); if (info.numArenasFree == 1) { - JS_ASSERT(!info.prevp); - JS_ASSERT(!info.next); + MOZ_ASSERT(!info.prevp); + MOZ_ASSERT(!info.next); addToAvailableList(zone); } else if (!unused()) { - JS_ASSERT(info.prevp); + MOZ_ASSERT(info.prevp); } else { - JS_ASSERT(unused()); + MOZ_ASSERT(unused()); removeFromAvailableList(); decommitAllArenas(rt); rt->gc.moveChunkToFreePool(this); @@ -1034,8 +1034,8 @@ Chunk::releaseArena(ArenaHeader *aheader) void GCRuntime::moveChunkToFreePool(Chunk *chunk) { - JS_ASSERT(chunk->unused()); - JS_ASSERT(chunkSet.has(chunk)); + MOZ_ASSERT(chunk->unused()); + MOZ_ASSERT(chunkSet.has(chunk)); chunkSet.remove(chunk); chunkPool.put(chunk); } @@ -1093,11 +1093,11 @@ GCRuntime::pickChunk(Zone *zone, AutoMaybeStartBackgroundAllocation &maybeStartB chunk = Chunk::allocate(rt); if (!chunk) return nullptr; - JS_ASSERT(chunk->info.numArenasFreeCommitted == 0); + MOZ_ASSERT(chunk->info.numArenasFreeCommitted == 0); } - JS_ASSERT(chunk->unused()); - JS_ASSERT(!chunkSet.has(chunk)); + MOZ_ASSERT(chunk->unused()); + MOZ_ASSERT(!chunkSet.has(chunk)); if (wantBackgroundAllocation()) maybeStartBackgroundAllocation.tryToStartBackgroundAllocation(rt); @@ -1109,7 +1109,7 @@ GCRuntime::pickChunk(Zone *zone, AutoMaybeStartBackgroundAllocation &maybeStartB * the table so using ordinary lookupForAdd is suboptimal here. */ GCChunkSet::AddPtr p = chunkSet.lookupForAdd(chunk); - JS_ASSERT(!p); + MOZ_ASSERT(!p); if (!chunkSet.add(p, chunk)) { releaseChunk(chunk); return nullptr; @@ -1319,10 +1319,10 @@ GCRuntime::init(uint32_t maxbytes, uint32_t maxNurseryBytes) return false; if (!nursery.isEnabled()) { - JS_ASSERT(nursery.nurserySize() == 0); + MOZ_ASSERT(nursery.nurserySize() == 0); ++rt->gc.generationalDisabled; } else { - JS_ASSERT(nursery.nurserySize() > 0); + MOZ_ASSERT(nursery.nurserySize() > 0); if (!storeBuffer.enable()) return false; } @@ -1429,9 +1429,9 @@ GCRuntime::setParameter(JSGCParamKey key, uint32_t value) break; case JSGC_MODE: mode = JSGCMode(value); - JS_ASSERT(mode == JSGC_MODE_GLOBAL || - mode == JSGC_MODE_COMPARTMENT || - mode == JSGC_MODE_INCREMENTAL); + MOZ_ASSERT(mode == JSGC_MODE_GLOBAL || + mode == JSGC_MODE_COMPARTMENT || + mode == JSGC_MODE_INCREMENTAL); break; default: tunables.setParameter(key, value); @@ -1452,14 +1452,14 @@ GCSchedulingTunables::setParameter(JSGCParamKey key, uint32_t value) highFrequencyLowLimitBytes_ = value * 1024 * 1024; if (highFrequencyLowLimitBytes_ >= highFrequencyHighLimitBytes_) highFrequencyHighLimitBytes_ = highFrequencyLowLimitBytes_ + 1; - JS_ASSERT(highFrequencyHighLimitBytes_ > highFrequencyLowLimitBytes_); + MOZ_ASSERT(highFrequencyHighLimitBytes_ > highFrequencyLowLimitBytes_); break; case JSGC_HIGH_FREQUENCY_HIGH_LIMIT: MOZ_ASSERT(value > 0); highFrequencyHighLimitBytes_ = value * 1024 * 1024; if (highFrequencyHighLimitBytes_ <= highFrequencyLowLimitBytes_) highFrequencyLowLimitBytes_ = highFrequencyHighLimitBytes_ - 1; - JS_ASSERT(highFrequencyHighLimitBytes_ > highFrequencyLowLimitBytes_); + MOZ_ASSERT(highFrequencyHighLimitBytes_ > highFrequencyLowLimitBytes_); break; case JSGC_HIGH_FREQUENCY_HEAP_GROWTH_MAX: highFrequencyHeapGrowthMax_ = value / 100.0; @@ -1486,13 +1486,13 @@ GCSchedulingTunables::setParameter(JSGCParamKey key, uint32_t value) minEmptyChunkCount_ = value; if (minEmptyChunkCount_ > maxEmptyChunkCount_) maxEmptyChunkCount_ = minEmptyChunkCount_; - JS_ASSERT(maxEmptyChunkCount_ >= minEmptyChunkCount_); + MOZ_ASSERT(maxEmptyChunkCount_ >= minEmptyChunkCount_); break; case JSGC_MAX_EMPTY_CHUNK_COUNT: maxEmptyChunkCount_ = value; if (minEmptyChunkCount_ > maxEmptyChunkCount_) minEmptyChunkCount_ = maxEmptyChunkCount_; - JS_ASSERT(maxEmptyChunkCount_ >= minEmptyChunkCount_); + MOZ_ASSERT(maxEmptyChunkCount_ >= minEmptyChunkCount_); break; default: MOZ_CRASH("Unknown GC parameter."); @@ -1542,7 +1542,7 @@ GCRuntime::getParameter(JSGCParamKey key) case JSGC_MAX_EMPTY_CHUNK_COUNT: return tunables.maxEmptyChunkCount(); default: - JS_ASSERT(key == JSGC_NUMBER); + MOZ_ASSERT(key == JSGC_NUMBER); return uint32_t(number); } } @@ -1550,7 +1550,7 @@ GCRuntime::getParameter(JSGCParamKey key) void GCRuntime::setMarkStackLimit(size_t limit) { - JS_ASSERT(!isHeapBusy()); + MOZ_ASSERT(!isHeapBusy()); AutoStopVerifyingBarriers pauseVerification(rt, false); marker.setMaxCapacity(limit); } @@ -1827,8 +1827,8 @@ ZoneHeapThreshold::computeZoneHeapGrowthFactorForHeapSize(size_t lastBytes, double factor = maxRatio - ((maxRatio - minRatio) * ((lastBytes - lowLimit) / (highLimit - lowLimit))); - JS_ASSERT(factor >= minRatio); - JS_ASSERT(factor <= maxRatio); + MOZ_ASSERT(factor >= minRatio); + MOZ_ASSERT(factor <= maxRatio); return factor; } @@ -1858,8 +1858,8 @@ ZoneHeapThreshold::updateForRemovedArena(const GCSchedulingTunables &tunables) { size_t amount = ArenaSize * gcHeapGrowthFactor_; - JS_ASSERT(amount > 0); - JS_ASSERT(gcTriggerBytes_ >= amount); + MOZ_ASSERT(amount > 0); + MOZ_ASSERT(gcTriggerBytes_ >= amount); if (gcTriggerBytes_ - amount < tunables.gcZoneAllocThresholdBase() * gcHeapGrowthFactor_) return; @@ -1948,7 +1948,7 @@ ArenaLists::allocateFromArenaInline(Zone *zone, AllocKind thingKind, /* See comments before BackgroundFinalizeState definition. */ *bfs = BFS_DONE; } else { - JS_ASSERT(*bfs == BFS_DONE); + MOZ_ASSERT(*bfs == BFS_DONE); } } @@ -1961,7 +1961,7 @@ ArenaLists::allocateFromArenaInline(Zone *zone, AllocKind thingKind, * execution, however, we keep empty arenas in the arena * list to avoid synchronizing on the chunk. */ - JS_ASSERT(!aheader->isEmpty() || InParallelSection()); + MOZ_ASSERT(!aheader->isEmpty() || InParallelSection()); al->moveCursorPast(aheader); @@ -1975,7 +1975,7 @@ ArenaLists::allocateFromArenaInline(Zone *zone, AllocKind thingKind, if (MOZ_UNLIKELY(zone->wasGCStarted())) zone->runtimeFromMainThread()->gc.arenaAllocatedDuringGC(zone, aheader); void *thing = freeLists[thingKind].allocate(Arena::thingSize(thingKind)); - JS_ASSERT(thing); // This allocation is infallible. + MOZ_ASSERT(thing); // This allocation is infallible. return thing; } @@ -1992,7 +1992,7 @@ ArenaLists::allocateFromArenaInline(Zone *zone, AllocKind thingKind, * as full as its single free span is moved to the free lists, and insert * it to the list as a fully allocated arena. */ - JS_ASSERT(al->isCursorAtEnd()); + MOZ_ASSERT(al->isCursorAtEnd()); aheader = chunk->allocateArena(zone, thingKind); if (!aheader) return nullptr; @@ -2006,7 +2006,7 @@ ArenaLists::allocateFromArenaInline(Zone *zone, AllocKind thingKind, * as fully used during the initialization so we have to re-mark it as * empty before allocating. */ - JS_ASSERT(!aheader->hasFreeThings()); + MOZ_ASSERT(!aheader->hasFreeThings()); Arena *arena = aheader->getArena(); size_t thingSize = Arena::thingSize(thingKind); FreeSpan fullSpan; @@ -2025,7 +2025,7 @@ ArenaLists::allocateFromArena(JS::Zone *zone, AllocKind thingKind) void ArenaLists::wipeDuringParallelExecution(JSRuntime *rt) { - JS_ASSERT(InParallelSection()); + MOZ_ASSERT(InParallelSection()); // First, check that we all objects we have allocated are eligible // for background finalization. The idea is that we will free @@ -2080,7 +2080,7 @@ GCRuntime::disableCompactingGC() void GCRuntime::enableCompactingGC() { - JS_ASSERT(compactingDisabled > 0); + MOZ_ASSERT(compactingDisabled > 0); --compactingDisabled; } @@ -2151,7 +2151,7 @@ ArenaList::pickArenasToRelocate() ArenaHeader **arenap = &head_; while (*arenap) { ArenaHeader *arena = *arenap; - JS_ASSERT(arena); + MOZ_ASSERT(arena); if (CanRelocateArena(arena) && ShouldRelocateArena(arena)) { // Remove from arena list if (cursorp_ == &arena->next) @@ -2223,10 +2223,10 @@ RelocateCell(Zone *zone, TenuredCell *src, AllocKind thingKind, size_t thingSize static bool RelocateArena(ArenaHeader *aheader) { - JS_ASSERT(aheader->allocated()); - JS_ASSERT(!aheader->hasDelayedMarking); - JS_ASSERT(!aheader->markOverflow); - JS_ASSERT(!aheader->allocatedDuringIncremental); + MOZ_ASSERT(aheader->allocated()); + MOZ_ASSERT(!aheader->hasDelayedMarking); + MOZ_ASSERT(!aheader->markOverflow); + MOZ_ASSERT(!aheader->allocatedDuringIncremental); Zone *zone = aheader->zone; @@ -2269,7 +2269,7 @@ ArenaList::relocateArenas(ArenaHeader *toRelocate, ArenaHeader *relocated) // the portion of the list that the cursor is pointing to (the // arenas with space available) so that it will be used for future // allocations. - JS_ASSERT(arena->hasFreeThings()); + MOZ_ASSERT(arena->hasFreeThings()); insertAtCursor(arena); } } @@ -2312,8 +2312,8 @@ GCRuntime::relocateArenas() ArenaHeader *relocatedList = nullptr; for (GCZonesIter zone(rt); !zone.done(); zone.next()) { - JS_ASSERT(zone->isGCFinished()); - JS_ASSERT(!zone->isPreservingCode()); + MOZ_ASSERT(zone->isGCFinished()); + MOZ_ASSERT(!zone->isPreservingCode()); // We cannot move atoms as we depend on their addresses being constant. if (!rt->isAtomsZone(zone)) { @@ -2331,10 +2331,10 @@ MovingTracer::Visit(JSTracer *jstrc, void **thingp, JSGCTraceKind kind) TenuredCell *thing = TenuredCell::fromPointer(*thingp); Zone *zone = thing->zoneFromAnyThread(); if (!zone->isGCCompacting()) { - JS_ASSERT(!IsForwarded(thing)); + MOZ_ASSERT(!IsForwarded(thing)); return; } - JS_ASSERT(CurrentThreadCanAccessZone(zone)); + MOZ_ASSERT(CurrentThreadCanAccessZone(zone)); if (IsForwarded(thing)) { Cell *dst = Forwarded(thing); @@ -2356,7 +2356,7 @@ MovingTracer::Sweep(JSTracer *jstrc) if (zone->isCollecting()) { bool oom = false; zone->sweep(fop, false, &oom); - JS_ASSERT(!oom); + MOZ_ASSERT(!oom); for (CompartmentsInZoneIter c(zone); !c.done(); c.next()) { c->sweep(fop, false); @@ -2408,7 +2408,7 @@ UpdateCellPointers(MovingTracer *trc, Cell *cell, JSGCTraceKind traceKind) { void GCRuntime::updatePointersToRelocatedCells() { - JS_ASSERT(rt->currentThreadHasExclusiveAccess()); + MOZ_ASSERT(rt->currentThreadHasExclusiveAccess()); gcstats::AutoPhase ap(stats, gcstats::PHASE_COMPACT_UPDATE); MovingTracer trc(rt); @@ -2474,10 +2474,10 @@ GCRuntime::releaseRelocatedArenas(ArenaHeader *relocatedList) for (ArenaHeader *arena = relocatedList; arena; arena = arena->next) { for (ArenaCellIterUnderFinalize i(arena); !i.done(); i.next()) { TenuredCell *src = i.getCell(); - JS_ASSERT(IsForwarded(src)); + MOZ_ASSERT(IsForwarded(src)); TenuredCell *dest = Forwarded(src); - JS_ASSERT(src->isMarked(BLACK) == dest->isMarked(BLACK)); - JS_ASSERT(src->isMarked(GRAY) == dest->isMarked(GRAY)); + MOZ_ASSERT(src->isMarked(BLACK) == dest->isMarked(BLACK)); + MOZ_ASSERT(src->isMarked(GRAY) == dest->isMarked(GRAY)); } } #endif @@ -2516,14 +2516,14 @@ GCRuntime::releaseRelocatedArenas(ArenaHeader *relocatedList) void ArenaLists::finalizeNow(FreeOp *fop, AllocKind thingKind) { - JS_ASSERT(!IsBackgroundFinalized(thingKind)); + MOZ_ASSERT(!IsBackgroundFinalized(thingKind)); forceFinalizeNow(fop, thingKind); } void ArenaLists::forceFinalizeNow(FreeOp *fop, AllocKind thingKind) { - JS_ASSERT(backgroundFinalizeState[thingKind] == BFS_DONE); + MOZ_ASSERT(backgroundFinalizeState[thingKind] == BFS_DONE); ArenaHeader *arenas = arenaLists[thingKind].head(); if (!arenas) @@ -2535,7 +2535,7 @@ ArenaLists::forceFinalizeNow(FreeOp *fop, AllocKind thingKind) SliceBudget budget; FinalizeArenas(fop, &arenas, finalizedSorted, thingKind, budget); - JS_ASSERT(!arenas); + MOZ_ASSERT(!arenas); arenaLists[thingKind] = finalizedSorted.toArenaList(); } @@ -2543,9 +2543,9 @@ ArenaLists::forceFinalizeNow(FreeOp *fop, AllocKind thingKind) void ArenaLists::queueForForegroundSweep(FreeOp *fop, AllocKind thingKind) { - JS_ASSERT(!IsBackgroundFinalized(thingKind)); - JS_ASSERT(backgroundFinalizeState[thingKind] == BFS_DONE); - JS_ASSERT(!arenaListsToSweep[thingKind]); + MOZ_ASSERT(!IsBackgroundFinalized(thingKind)); + MOZ_ASSERT(backgroundFinalizeState[thingKind] == BFS_DONE); + MOZ_ASSERT(!arenaListsToSweep[thingKind]); arenaListsToSweep[thingKind] = arenaLists[thingKind].head(); arenaLists[thingKind].clear(); @@ -2554,12 +2554,12 @@ ArenaLists::queueForForegroundSweep(FreeOp *fop, AllocKind thingKind) inline void ArenaLists::queueForBackgroundSweep(FreeOp *fop, AllocKind thingKind) { - JS_ASSERT(IsBackgroundFinalized(thingKind)); - JS_ASSERT(!fop->runtime()->gc.isBackgroundSweeping()); + MOZ_ASSERT(IsBackgroundFinalized(thingKind)); + MOZ_ASSERT(!fop->runtime()->gc.isBackgroundSweeping()); ArenaList *al = &arenaLists[thingKind]; if (al->isEmpty()) { - JS_ASSERT(backgroundFinalizeState[thingKind] == BFS_DONE); + MOZ_ASSERT(backgroundFinalizeState[thingKind] == BFS_DONE); return; } @@ -2567,8 +2567,8 @@ ArenaLists::queueForBackgroundSweep(FreeOp *fop, AllocKind thingKind) * The state can be done, or just-finished if we have not allocated any GC * things from the arena list after the previous background finalization. */ - JS_ASSERT(backgroundFinalizeState[thingKind] == BFS_DONE || - backgroundFinalizeState[thingKind] == BFS_JUST_FINISHED); + MOZ_ASSERT(backgroundFinalizeState[thingKind] == BFS_DONE || + backgroundFinalizeState[thingKind] == BFS_JUST_FINISHED); arenaListsToSweep[thingKind] = al->head(); al->clear(); @@ -2578,7 +2578,7 @@ ArenaLists::queueForBackgroundSweep(FreeOp *fop, AllocKind thingKind) /*static*/ void ArenaLists::backgroundFinalize(FreeOp *fop, ArenaHeader *listHead, bool onBackgroundThread) { - JS_ASSERT(listHead); + MOZ_ASSERT(listHead); AllocKind thingKind = listHead->getAllocKind(); Zone *zone = listHead->zone; @@ -2587,7 +2587,7 @@ ArenaLists::backgroundFinalize(FreeOp *fop, ArenaHeader *listHead, bool onBackgr SliceBudget budget; FinalizeArenas(fop, &listHead, finalizedSorted, thingKind, budget); - JS_ASSERT(!listHead); + MOZ_ASSERT(!listHead); // When arenas are queued for background finalization, all arenas are moved // to arenaListsToSweep[], leaving the arenaLists[] empty. However, new @@ -2603,7 +2603,7 @@ ArenaLists::backgroundFinalize(FreeOp *fop, ArenaHeader *listHead, bool onBackgr bool allClear = finalized.isEmpty(); AutoLockGC lock(fop->runtime()); - JS_ASSERT(lists->backgroundFinalizeState[thingKind] == BFS_RUN); + MOZ_ASSERT(lists->backgroundFinalizeState[thingKind] == BFS_RUN); // Join |al| and |finalized| into a single list. *al = finalized.insertListWithCursorAtEnd(*al); @@ -2689,7 +2689,7 @@ RunLastDitchGC(JSContext *cx, JS::Zone *zone, AllocKind thingKind) * In parallel sections, we do not attempt to refill the free list * and hence do not encounter last ditch GC. */ - JS_ASSERT(!InParallelSection()); + MOZ_ASSERT(!InParallelSection()); PrepareZoneForGC(zone); @@ -2715,7 +2715,7 @@ template /* static */ void * ArenaLists::refillFreeList(ThreadSafeContext *cx, AllocKind thingKind) { - JS_ASSERT(cx->allocator()->arenas.freeLists[thingKind].isEmpty()); + MOZ_ASSERT(cx->allocator()->arenas.freeLists[thingKind].isEmpty()); JS_ASSERT_IF(cx->isJSContext(), !cx->asJSContext()->runtime()->isHeapBusy()); Zone *zone = cx->allocator()->zone_; @@ -2788,7 +2788,7 @@ ArenaLists::refillFreeList(ThreadSafeContext *cx, AllocKind thingKind) runGC = true; } - JS_ASSERT(allowGC); + MOZ_ASSERT(allowGC); js_ReportOutOfMemory(cx); return nullptr; } @@ -2807,10 +2807,10 @@ ArenaLists::refillFreeListInGC(Zone *zone, AllocKind thingKind) */ Allocator &allocator = zone->allocator; - JS_ASSERT(allocator.arenas.freeLists[thingKind].isEmpty()); + MOZ_ASSERT(allocator.arenas.freeLists[thingKind].isEmpty()); mozilla::DebugOnly rt = zone->runtimeFromMainThread(); - JS_ASSERT(rt->isHeapMajorCollecting()); - JS_ASSERT(!rt->gc.isBackgroundSweeping()); + MOZ_ASSERT(rt->isHeapMajorCollecting()); + MOZ_ASSERT(!rt->gc.isBackgroundSweeping()); return allocator.arenas.allocateFromArena(zone, thingKind); } @@ -2946,7 +2946,7 @@ GCRuntime::triggerZoneGC(Zone *zone, JS::gcreason::Reason reason) bool GCRuntime::maybeGC(Zone *zone) { - JS_ASSERT(CurrentThreadCanAccessRuntime(rt)); + MOZ_ASSERT(CurrentThreadCanAccessRuntime(rt)); #ifdef JS_GC_ZEAL if (zealMode == ZealAllocValue || zealMode == ZealPokeValue) { @@ -3031,9 +3031,9 @@ GCRuntime::decommitArenasFromAvailableList(Chunk **availableListHeadp) * We also must make sure that the aheader is not accessed again after we * decommit the arena. */ - JS_ASSERT(chunk->info.prevp == availableListHeadp); + MOZ_ASSERT(chunk->info.prevp == availableListHeadp); while (Chunk *next = chunk->info.next) { - JS_ASSERT(next->info.prevp == &chunk->info.next); + MOZ_ASSERT(next->info.prevp == &chunk->info.next); chunk = next; } @@ -3065,8 +3065,8 @@ GCRuntime::decommitArenasFromAvailableList(Chunk **availableListHeadp) } else { chunk->addArenaToFreeList(rt, aheader); } - JS_ASSERT(chunk->hasAvailableArenas()); - JS_ASSERT(!chunk->unused()); + MOZ_ASSERT(chunk->hasAvailableArenas()); + MOZ_ASSERT(!chunk->unused()); if (chunk->info.numArenasFree == 1) { /* * Put the chunk back to the available list either at the @@ -3083,7 +3083,7 @@ GCRuntime::decommitArenasFromAvailableList(Chunk **availableListHeadp) } chunk->insertToAvailableList(insertPoint); } else { - JS_ASSERT(chunk->info.prevp); + MOZ_ASSERT(chunk->info.prevp); } if (chunkAllocationSinceLastGC || !ok) { @@ -3161,11 +3161,11 @@ void GCRuntime::assertBackgroundSweepingFinished() { #ifdef DEBUG - JS_ASSERT(!sweepingZones); + MOZ_ASSERT(!sweepingZones); for (ZonesIter zone(rt, WithAtoms); !zone.done(); zone.next()) { for (unsigned i = 0; i < FINALIZE_LIMIT; ++i) { - JS_ASSERT(!zone->allocator.arenas.arenaListsToSweep[i]); - JS_ASSERT(zone->allocator.arenas.doneBackgroundFinalize(AllocKind(i))); + MOZ_ASSERT(!zone->allocator.arenas.arenaListsToSweep[i]); + MOZ_ASSERT(zone->allocator.arenas.doneBackgroundFinalize(AllocKind(i))); } } #endif @@ -3208,7 +3208,7 @@ void GCHelperState::finish() { if (!rt->gc.lock) { - JS_ASSERT(state_ == IDLE); + MOZ_ASSERT(state_ == IDLE); return; } @@ -3222,21 +3222,21 @@ GCHelperState::finish() GCHelperState::State GCHelperState::state() { - JS_ASSERT(rt->gc.currentThreadOwnsGCLock()); + MOZ_ASSERT(rt->gc.currentThreadOwnsGCLock()); return state_; } void GCHelperState::setState(State state) { - JS_ASSERT(rt->gc.currentThreadOwnsGCLock()); + MOZ_ASSERT(rt->gc.currentThreadOwnsGCLock()); state_ = state; } void GCHelperState::startBackgroundThread(State newState) { - JS_ASSERT(!thread && state() == IDLE && newState != IDLE); + MOZ_ASSERT(!thread && state() == IDLE && newState != IDLE); setState(newState); if (!HelperThreadState().gcHelperWorklist().append(this)) @@ -3247,7 +3247,7 @@ GCHelperState::startBackgroundThread(State newState) void GCHelperState::waitForBackgroundThread() { - JS_ASSERT(CurrentThreadCanAccessRuntime(rt)); + MOZ_ASSERT(CurrentThreadCanAccessRuntime(rt)); rt->gc.lockOwner = nullptr; PR_WaitCondVar(done, PR_INTERVAL_NO_TIMEOUT); @@ -3259,11 +3259,11 @@ GCHelperState::waitForBackgroundThread() void GCHelperState::work() { - JS_ASSERT(CanUseExtraThreads()); + MOZ_ASSERT(CanUseExtraThreads()); AutoLockGC lock(rt); - JS_ASSERT(!thread); + MOZ_ASSERT(!thread); thread = PR_GetCurrentThread(); TraceLogger *logger = TraceLoggerForCurrentThread(); @@ -3277,7 +3277,7 @@ GCHelperState::work() case SWEEPING: { AutoTraceLog logSweeping(logger, TraceLogger::GCSweeping); doSweep(); - JS_ASSERT(state() == SWEEPING); + MOZ_ASSERT(state() == SWEEPING); break; } @@ -3293,11 +3293,11 @@ GCHelperState::work() /* OOM stops the background allocation. */ if (!chunk) break; - JS_ASSERT(chunk->info.numArenasFreeCommitted == 0); + MOZ_ASSERT(chunk->info.numArenasFreeCommitted == 0); rt->gc.chunkPool.put(chunk); } while (state() == ALLOCATING && rt->gc.wantBackgroundAllocation()); - JS_ASSERT(state() == ALLOCATING || state() == CANCEL_ALLOCATION); + MOZ_ASSERT(state() == ALLOCATING || state() == CANCEL_ALLOCATION); break; } @@ -3314,12 +3314,12 @@ GCHelperState::work() void GCHelperState::startBackgroundSweep(bool shouldShrink) { - JS_ASSERT(CanUseExtraThreads()); + MOZ_ASSERT(CanUseExtraThreads()); AutoLockHelperThreadState helperLock; AutoLockGC lock(rt); - JS_ASSERT(state() == IDLE); - JS_ASSERT(!sweepFlag); + MOZ_ASSERT(state() == IDLE); + MOZ_ASSERT(!sweepFlag); sweepFlag = true; shrinkFlag = shouldShrink; startBackgroundThread(SWEEPING); @@ -3329,10 +3329,10 @@ GCHelperState::startBackgroundSweep(bool shouldShrink) void GCHelperState::startBackgroundShrink() { - JS_ASSERT(CanUseExtraThreads()); + MOZ_ASSERT(CanUseExtraThreads()); switch (state()) { case IDLE: - JS_ASSERT(!sweepFlag); + MOZ_ASSERT(!sweepFlag); shrinkFlag = true; startBackgroundThread(SWEEPING); break; @@ -3453,7 +3453,7 @@ Zone::sweepCompartments(FreeOp *fop, bool keepAtleastOne, bool lastGC) bool foundOne = false; while (read < end) { JSCompartment *comp = *read++; - JS_ASSERT(!rt->isAtomsCompartment(comp)); + MOZ_ASSERT(!rt->isAtomsCompartment(comp)); /* * Don't delete the last compartment if all the ones before it were @@ -3484,8 +3484,8 @@ GCRuntime::sweepZones(FreeOp *fop, bool lastGC) Zone **read = zones.begin() + 1; Zone **end = zones.end(); Zone **write = read; - JS_ASSERT(zones.length() >= 1); - JS_ASSERT(rt->isAtomsZone(zones[0])); + MOZ_ASSERT(zones.length() >= 1); + MOZ_ASSERT(rt->isAtomsZone(zones[0])); while (read < end) { Zone *zone = *read++; @@ -3498,7 +3498,7 @@ GCRuntime::sweepZones(FreeOp *fop, bool lastGC) if (callback) callback(zone); zone->sweepCompartments(fop, false, lastGC); - JS_ASSERT(zone->compartments.empty()); + MOZ_ASSERT(zone->compartments.empty()); fop->delete_(zone); continue; } @@ -3594,10 +3594,10 @@ static void CheckCompartment(CompartmentCheckTracer *trc, JSCompartment *thingCompartment, Cell *thing, JSGCTraceKind kind) { - JS_ASSERT(thingCompartment == trc->compartment || - trc->runtime()->isAtomsCompartment(thingCompartment) || - (trc->srcKind == JSTRACE_OBJECT && - InCrossCompartmentMap((JSObject *)trc->src, thing, kind))); + MOZ_ASSERT(thingCompartment == trc->compartment || + trc->runtime()->isAtomsCompartment(thingCompartment) || + (trc->srcKind == JSTRACE_OBJECT && + InCrossCompartmentMap((JSObject *)trc->src, thing, kind))); } static JSCompartment * @@ -3625,8 +3625,8 @@ CheckCompartmentCallback(JSTracer *trcArg, void **thingp, JSGCTraceKind kind) if (comp && trc->compartment) { CheckCompartment(trc, comp, thing, kind); } else { - JS_ASSERT(thing->zone() == trc->zone || - trc->runtime()->isAtomsZone(thing->zone())); + MOZ_ASSERT(thing->zone() == trc->zone || + trc->runtime()->isAtomsZone(thing->zone())); } } @@ -3666,10 +3666,10 @@ GCRuntime::beginMarkPhase(JS::gcreason::Reason reason) for (ZonesIter zone(rt, WithAtoms); !zone.done(); zone.next()) { /* Assert that zone state is as we expect */ - JS_ASSERT(!zone->isCollecting()); - JS_ASSERT(!zone->compartments.empty()); + MOZ_ASSERT(!zone->isCollecting()); + MOZ_ASSERT(!zone->compartments.empty()); for (unsigned i = 0; i < FINALIZE_LIMIT; ++i) - JS_ASSERT(!zone->allocator.arenas.arenaListsToSweep[i]); + MOZ_ASSERT(!zone->allocator.arenas.arenaListsToSweep[i]); /* Set up which zones will be collected. */ if (zone->isGCScheduled()) { @@ -3710,7 +3710,7 @@ GCRuntime::beginMarkPhase(JS::gcreason::Reason reason) if (isFull && !rt->keepAtoms()) { Zone *atomsZone = rt->atomsCompartment()->zone(); if (atomsZone->isGCScheduled()) { - JS_ASSERT(!atomsZone->isCollecting()); + MOZ_ASSERT(!atomsZone->isCollecting()); atomsZone->setGCState(Zone::Mark); any = true; } @@ -3733,8 +3733,8 @@ GCRuntime::beginMarkPhase(JS::gcreason::Reason reason) } marker.start(); - JS_ASSERT(!marker.callback); - JS_ASSERT(IS_GC_MARKING_TRACER(&marker)); + MOZ_ASSERT(!marker.callback); + MOZ_ASSERT(IS_GC_MARKING_TRACER(&marker)); /* For non-incremental GC the following sweep discards the jit code. */ if (isIncremental) { @@ -3851,7 +3851,7 @@ template void GCRuntime::markWeakReferences(gcstats::Phase phase) { - JS_ASSERT(marker.isDrained()); + MOZ_ASSERT(marker.isDrained()); gcstats::AutoPhase ap1(stats, phase); @@ -3869,7 +3869,7 @@ GCRuntime::markWeakReferences(gcstats::Phase phase) SliceBudget budget; marker.drainMarkStack(budget); } - JS_ASSERT(marker.isDrained()); + MOZ_ASSERT(marker.isDrained()); } void @@ -3887,7 +3887,7 @@ GCRuntime::markGrayReferences(gcstats::Phase phase) for (ZoneIterT zone(rt); !zone.done(); zone.next()) marker.markBufferedGrayRoots(zone); } else { - JS_ASSERT(!isIncremental); + MOZ_ASSERT(!isIncremental); if (JSTraceDataOp op = grayRootTracer.op) (*op)(&marker, grayRootTracer.data); } @@ -4004,7 +4004,7 @@ js::gc::MarkingValidator::nonIncrementalMark() js::gc::State state = gc->incrementalState; gc->incrementalState = MARK_ROOTS; - JS_ASSERT(gcmarker->isDrained()); + MOZ_ASSERT(gcmarker->isDrained()); gcmarker->reset(); for (GCChunkSet::Range r(gc->chunkSet.all()); !r.empty(); r.popFront()) @@ -4031,7 +4031,7 @@ js::gc::MarkingValidator::nonIncrementalMark() /* Update zone state for gray marking. */ for (GCZonesIter zone(runtime); !zone.done(); zone.next()) { - JS_ASSERT(zone->isGCMarkingBlack()); + MOZ_ASSERT(zone->isGCMarkingBlack()); zone->setGCState(Zone::MarkGray); } gc->marker.setMarkColorGray(); @@ -4041,10 +4041,10 @@ js::gc::MarkingValidator::nonIncrementalMark() /* Restore zone state. */ for (GCZonesIter zone(runtime); !zone.done(); zone.next()) { - JS_ASSERT(zone->isGCMarkingGray()); + MOZ_ASSERT(zone->isGCMarkingGray()); zone->setGCState(Zone::Mark); } - JS_ASSERT(gc->marker.isDrained()); + MOZ_ASSERT(gc->marker.isDrained()); gc->marker.setMarkColorBlack(); } @@ -4125,7 +4125,7 @@ void GCRuntime::computeNonIncrementalMarkingForValidation() { #ifdef JS_GC_MARKING_VALIDATION - JS_ASSERT(!markingValidator); + MOZ_ASSERT(!markingValidator); if (isIncremental && validate) markingValidator = js_new(this); if (markingValidator) @@ -4158,7 +4158,7 @@ AssertNeedsBarrierFlagsConsistent(JSRuntime *rt) bool anyNeedsBarrier = false; for (ZonesIter zone(rt, WithAtoms); !zone.done(); zone.next()) anyNeedsBarrier |= zone->needsIncrementalBarrier(); - JS_ASSERT(rt->needsIncrementalBarrier() == anyNeedsBarrier); + MOZ_ASSERT(rt->needsIncrementalBarrier() == anyNeedsBarrier); #endif } @@ -4198,7 +4198,7 @@ JSCompartment::findOutgoingEdges(ComponentFinder &finder) { for (js::WrapperMap::Enum e(crossCompartmentWrappers); !e.empty(); e.popFront()) { CrossCompartmentKey::Kind kind = e.front().key().kind; - JS_ASSERT(kind != CrossCompartmentKey::StringWrapper); + MOZ_ASSERT(kind != CrossCompartmentKey::StringWrapper); TenuredCell *other = e.front().key().wrapped->asTenured(); if (kind == CrossCompartmentKey::ObjectWrapper) { /* @@ -4212,10 +4212,10 @@ JSCompartment::findOutgoingEdges(ComponentFinder &finder) finder.addEdgeTo(w); } } else { - JS_ASSERT(kind == CrossCompartmentKey::DebuggerScript || - kind == CrossCompartmentKey::DebuggerSource || - kind == CrossCompartmentKey::DebuggerObject || - kind == CrossCompartmentKey::DebuggerEnvironment); + MOZ_ASSERT(kind == CrossCompartmentKey::DebuggerScript || + kind == CrossCompartmentKey::DebuggerSource || + kind == CrossCompartmentKey::DebuggerObject || + kind == CrossCompartmentKey::DebuggerEnvironment); /* * Add edge for debugger object wrappers, to ensure (in conjuction * with call to Debugger::findCompartmentEdges below) that debugger @@ -4280,7 +4280,7 @@ GCRuntime::findZoneGroups() finder.useOneComponent(); for (GCZonesIter zone(rt); !zone.done(); zone.next()) { - JS_ASSERT(zone->isGCMarking()); + MOZ_ASSERT(zone->isGCMarking()); finder.addNode(zone); } zoneGroups = finder.getResultsList(); @@ -4289,7 +4289,7 @@ GCRuntime::findZoneGroups() for (Zone *head = currentZoneGroup; head; head = head->nextGroup()) { for (Zone *zone = head; zone; zone = zone->nextNodeInGroup()) - JS_ASSERT(zone->isGCMarking()); + MOZ_ASSERT(zone->isGCMarking()); } JS_ASSERT_IF(!isIncremental, !currentZoneGroup->nextGroup()); @@ -4309,16 +4309,16 @@ GCRuntime::getNextZoneGroup() } for (Zone *zone = currentZoneGroup; zone; zone = zone->nextNodeInGroup()) - JS_ASSERT(zone->isGCMarking()); + MOZ_ASSERT(zone->isGCMarking()); if (!isIncremental) ComponentFinder::mergeGroups(currentZoneGroup); if (abortSweepAfterCurrentGroup) { - JS_ASSERT(!isIncremental); + MOZ_ASSERT(!isIncremental); for (GCZoneGroupIter zone(rt); !zone.done(); zone.next()) { - JS_ASSERT(!zone->gcNextGraphComponent); - JS_ASSERT(zone->isGCMarking()); + MOZ_ASSERT(!zone->gcNextGraphComponent); + MOZ_ASSERT(zone->isGCMarking()); zone->setNeedsIncrementalBarrier(false, Zone::UpdateJit); zone->setGCState(Zone::NoGC); zone->gcGrayRoots.clearAndFree(); @@ -4363,14 +4363,14 @@ GCRuntime::getNextZoneGroup() static bool IsGrayListObject(JSObject *obj) { - JS_ASSERT(obj); + MOZ_ASSERT(obj); return obj->is() && !IsDeadProxyObject(obj); } /* static */ unsigned ProxyObject::grayLinkSlot(JSObject *obj) { - JS_ASSERT(IsGrayListObject(obj)); + MOZ_ASSERT(IsGrayListObject(obj)); return ProxyObject::EXTRA_SLOT + 1; } @@ -4386,7 +4386,7 @@ AssertNotOnGrayList(JSObject *obj) static JSObject * CrossCompartmentPointerReferent(JSObject *obj) { - JS_ASSERT(IsGrayListObject(obj)); + MOZ_ASSERT(IsGrayListObject(obj)); return &obj->as().private_().toObject(); } @@ -4406,7 +4406,7 @@ NextIncomingCrossCompartmentPointer(JSObject *prev, bool unlink) void js::DelayCrossCompartmentGrayMarking(JSObject *src) { - JS_ASSERT(IsGrayListObject(src)); + MOZ_ASSERT(IsGrayListObject(src)); /* Called from MarkCrossCompartmentXXX functions. */ unsigned slot = ProxyObject::grayLinkSlot(src); @@ -4417,7 +4417,7 @@ js::DelayCrossCompartmentGrayMarking(JSObject *src) src->setCrossCompartmentSlot(slot, ObjectOrNullValue(comp->gcIncomingGrayPointers)); comp->gcIncomingGrayPointers = src; } else { - JS_ASSERT(src->getReservedSlot(slot).isObjectOrNull()); + MOZ_ASSERT(src->getReservedSlot(slot).isObjectOrNull()); } #ifdef DEBUG @@ -4432,14 +4432,14 @@ js::DelayCrossCompartmentGrayMarking(JSObject *src) found = true; obj = NextIncomingCrossCompartmentPointer(obj, false); } - JS_ASSERT(found); + MOZ_ASSERT(found); #endif } static void MarkIncomingCrossCompartmentPointers(JSRuntime *rt, const uint32_t color) { - JS_ASSERT(color == BLACK || color == GRAY); + MOZ_ASSERT(color == BLACK || color == GRAY); static const gcstats::Phase statsPhases[] = { gcstats::PHASE_SWEEP_MARK_INCOMING_BLACK, @@ -4459,7 +4459,7 @@ MarkIncomingCrossCompartmentPointers(JSRuntime *rt, const uint32_t color) src = NextIncomingCrossCompartmentPointer(src, unlinkList)) { JSObject *dst = CrossCompartmentPointerReferent(src); - JS_ASSERT(dst->compartment() == c); + MOZ_ASSERT(dst->compartment() == c); if (color == GRAY) { if (IsObjectMarked(&src) && src->asTenured()->isMarked(GRAY)) @@ -4583,7 +4583,7 @@ GCRuntime::endMarkingZoneGroup() * MarkCrossCompartmentXXX. */ for (GCZoneGroupIter zone(rt); !zone.done(); zone.next()) { - JS_ASSERT(zone->isGCMarkingBlack()); + MOZ_ASSERT(zone->isGCMarkingBlack()); zone->setGCState(Zone::MarkGray); } marker.setMarkColorGray(); @@ -4597,7 +4597,7 @@ GCRuntime::endMarkingZoneGroup() /* Restore marking state. */ for (GCZoneGroupIter zone(rt); !zone.done(); zone.next()) { - JS_ASSERT(zone->isGCMarkingGray()); + MOZ_ASSERT(zone->isGCMarkingGray()); zone->setGCState(Zone::Mark); } MOZ_ASSERT(marker.isDrained()); @@ -4615,7 +4615,7 @@ GCRuntime::beginSweepingZoneGroup() bool sweepingAtoms = false; for (GCZoneGroupIter zone(rt); !zone.done(); zone.next()) { /* Set the GC state to sweeping. */ - JS_ASSERT(zone->isGCMarking()); + MOZ_ASSERT(zone->isGCMarking()); zone->setGCState(Zone::Sweep); /* Purge the ArenaLists before sweeping. */ @@ -4787,7 +4787,7 @@ GCRuntime::endSweepingZoneGroup() { /* Update the GC state for zones we have swept and unlink the list. */ for (GCZoneGroupIter zone(rt); !zone.done(); zone.next()) { - JS_ASSERT(zone->isGCSweeping()); + MOZ_ASSERT(zone->isGCSweeping()); zone->setGCState(Zone::Finished); } @@ -4809,7 +4809,7 @@ GCRuntime::beginSweepPhase(bool lastGC) * fail, rather than nest badly and leave the unmarked newborn to be swept. */ - JS_ASSERT(!abortSweepAfterCurrentGroup); + MOZ_ASSERT(!abortSweepAfterCurrentGroup); computeNonIncrementalMarkingForValidation(); @@ -4822,7 +4822,7 @@ GCRuntime::beginSweepPhase(bool lastGC) #ifdef DEBUG for (CompartmentsIter c(rt, SkipAtoms); !c.done(); c.next()) { - JS_ASSERT(!c->gcIncomingGrayPointers); + MOZ_ASSERT(!c->gcIncomingGrayPointers); for (JSCompartment::WrapperEnum e(c); !e.empty(); e.popFront()) { if (e.front().key().kind != CrossCompartmentKey::StringWrapper) AssertNotOnGrayList(&e.front().value().get().toObject()); @@ -5020,7 +5020,7 @@ GCRuntime::endSweepPhase(bool lastGC) } /* Set up list of zones for sweeping of background things. */ - JS_ASSERT(!sweepingZones); + MOZ_ASSERT(!sweepingZones); for (GCZonesIter zone(rt); !zone.done(); zone.next()) { zone->gcNextGraphNode = sweepingZones; sweepingZones = zone; @@ -5051,7 +5051,7 @@ GCRuntime::endSweepPhase(bool lastGC) } for (CompartmentsIter c(rt, SkipAtoms); !c.done(); c.next()) { - JS_ASSERT(!c->gcIncomingGrayPointers); + MOZ_ASSERT(!c->gcIncomingGrayPointers); for (JSCompartment::WrapperEnum e(c); !e.empty(); e.popFront()) { if (e.front().key().kind != CrossCompartmentKey::StringWrapper) @@ -5065,8 +5065,8 @@ GCRuntime::endSweepPhase(bool lastGC) void GCRuntime::compactPhase() { - JS_ASSERT(rt->gc.nursery.isEmpty()); - JS_ASSERT(!sweepOnBackgroundThread); + MOZ_ASSERT(rt->gc.nursery.isEmpty()); + MOZ_ASSERT(!sweepOnBackgroundThread); gcstats::AutoPhase ap(stats, gcstats::PHASE_COMPACT); @@ -5087,7 +5087,7 @@ GCRuntime::compactPhase() void GCRuntime::finishCollection() { - JS_ASSERT(marker.isDrained()); + MOZ_ASSERT(marker.isDrained()); marker.stop(); uint64_t currentTime = PRMJ_Now(); @@ -5097,13 +5097,13 @@ GCRuntime::finishCollection() zone->threshold.updateAfterGC(zone->usage.gcBytes(), invocationKind, tunables, schedulingState); if (zone->isCollecting()) { - JS_ASSERT(zone->isGCFinished() || zone->isGCCompacting()); + MOZ_ASSERT(zone->isGCFinished() || zone->isGCCompacting()); zone->setGCState(Zone::NoGC); zone->active = false; } - JS_ASSERT(!zone->isCollecting()); - JS_ASSERT(!zone->wasGCStarted()); + MOZ_ASSERT(!zone->isCollecting()); + MOZ_ASSERT(!zone->wasGCStarted()); } lastGCTime = currentTime; @@ -5115,9 +5115,9 @@ AutoTraceSession::AutoTraceSession(JSRuntime *rt, js::HeapState heapState) runtime(rt), prevState(rt->gc.heapState) { - JS_ASSERT(rt->gc.isAllocAllowed()); - JS_ASSERT(rt->gc.heapState == Idle); - JS_ASSERT(heapState != Idle); + MOZ_ASSERT(rt->gc.isAllocAllowed()); + MOZ_ASSERT(rt->gc.heapState == Idle); + MOZ_ASSERT(heapState != Idle); #ifdef JSGC_GENERATIONAL JS_ASSERT_IF(heapState == MajorCollecting, rt->gc.nursery.isEmpty()); #endif @@ -5126,7 +5126,7 @@ AutoTraceSession::AutoTraceSession(JSRuntime *rt, js::HeapState heapState) // the exclusive access lock. To avoid deadlocking when we try to acquire // this lock during GC and the other thread is waiting, make sure we hold // the exclusive access lock during GC sessions. - JS_ASSERT(rt->currentThreadHasExclusiveAccess()); + MOZ_ASSERT(rt->currentThreadHasExclusiveAccess()); if (rt->exclusiveThreadsPresent()) { // Lock the helper thread state when changing the heap state in the @@ -5140,7 +5140,7 @@ AutoTraceSession::AutoTraceSession(JSRuntime *rt, js::HeapState heapState) AutoTraceSession::~AutoTraceSession() { - JS_ASSERT(runtime->isHeapBusy()); + MOZ_ASSERT(runtime->isHeapBusy()); if (runtime->exclusiveThreadsPresent()) { AutoLockHelperThreadState lock; @@ -5173,7 +5173,7 @@ class AutoCopyFreeListToArenasForGC public: explicit AutoCopyFreeListToArenasForGC(JSRuntime *rt) : runtime(rt) { - JS_ASSERT(rt->currentThreadHasExclusiveAccess()); + MOZ_ASSERT(rt->currentThreadHasExclusiveAccess()); for (ZonesIter zone(rt, WithAtoms); !zone.done(); zone.next()) zone->allocator.arenas.copyFreeListsToArenas(); } @@ -5201,7 +5201,7 @@ GCRuntime::resetIncrementalGC(const char *reason) ResetGrayList(c); for (GCZonesIter zone(rt); !zone.done(); zone.next()) { - JS_ASSERT(zone->isGCMarking()); + MOZ_ASSERT(zone->isGCMarking()); zone->setNeedsIncrementalBarrier(false, Zone::UpdateJit); zone->setGCState(Zone::NoGC); } @@ -5210,7 +5210,7 @@ GCRuntime::resetIncrementalGC(const char *reason) incrementalState = NO_INCREMENTAL; - JS_ASSERT(!marker.shouldCheckCompartments()); + MOZ_ASSERT(!marker.shouldCheckCompartments()); break; } @@ -5239,9 +5239,9 @@ GCRuntime::resetIncrementalGC(const char *reason) #ifdef DEBUG for (ZonesIter zone(rt, WithAtoms); !zone.done(); zone.next()) { - JS_ASSERT(!zone->needsIncrementalBarrier()); + MOZ_ASSERT(!zone->needsIncrementalBarrier()); for (unsigned i = 0; i < FINALIZE_LIMIT; ++i) - JS_ASSERT(!zone->allocator.arenas.arenaListsToSweep[i]); + MOZ_ASSERT(!zone->allocator.arenas.arenaListsToSweep[i]); } #endif } @@ -5279,10 +5279,10 @@ AutoGCSlice::AutoGCSlice(JSRuntime *rt) * we'll update the Ion barriers in ~AutoGCSlice. */ if (zone->isGCMarking()) { - JS_ASSERT(zone->needsIncrementalBarrier()); + MOZ_ASSERT(zone->needsIncrementalBarrier()); zone->setNeedsIncrementalBarrier(false, Zone::DontUpdateJit); } else { - JS_ASSERT(!zone->needsIncrementalBarrier()); + MOZ_ASSERT(!zone->needsIncrementalBarrier()); } } rt->setNeedsIncrementalBarrier(false); @@ -5320,7 +5320,7 @@ void GCRuntime::incrementalCollectSlice(int64_t budget, JS::gcreason::Reason reason) { - JS_ASSERT(rt->currentThreadHasExclusiveAccess()); + MOZ_ASSERT(rt->currentThreadHasExclusiveAccess()); AutoCopyFreeListToArenasForGC copy(rt); AutoGCSlice slice(rt); @@ -5391,7 +5391,7 @@ GCRuntime::incrementalCollectSlice(int64_t budget, if (!finished) break; - JS_ASSERT(marker.isDrained()); + MOZ_ASSERT(marker.isDrained()); if (!lastMarkSlice && isIncremental && ((initialState == MARK && zeal != ZealIncrementalRootsThenFinish) || @@ -5449,14 +5449,14 @@ GCRuntime::incrementalCollectSlice(int64_t budget, } default: - JS_ASSERT(false); + MOZ_ASSERT(false); } } IncrementalSafety gc::IsIncrementalGCSafe(JSRuntime *rt) { - JS_ASSERT(!rt->mainThread.suppressGC); + MOZ_ASSERT(!rt->mainThread.suppressGC); if (rt->keepAtoms()) return IncrementalSafety::Unsafe("keepAtoms set"); @@ -5572,7 +5572,7 @@ GCRuntime::gcCycle(bool incremental, int64_t budget, JSGCInvocationKind gckind, // It's ok if threads other than the main thread have suppressGC set, as // they are operating on zones which will not be collected from here. - JS_ASSERT(!rt->mainThread.suppressGC); + MOZ_ASSERT(!rt->mainThread.suppressGC); // Assert if this is a GC unsafe region. JS::AutoAssertOnGC::VerifyIsSafeToGC(rt); @@ -5877,7 +5877,7 @@ GCRuntime::shrinkBuffers() { AutoLockHelperThreadState helperLock; AutoLockGC lock(rt); - JS_ASSERT(!rt->isHeapBusy()); + MOZ_ASSERT(!rt->isHeapBusy()); if (CanUseExtraThreads()) helperState.startBackgroundShrink(); @@ -5930,7 +5930,7 @@ GCRuntime::disableGenerationalGC() void GCRuntime::enableGenerationalGC() { - JS_ASSERT(generationalDisabled > 0); + MOZ_ASSERT(generationalDisabled > 0); --generationalDisabled; #ifdef JSGC_GENERATIONAL if (generationalDisabled == 0) { @@ -6023,9 +6023,9 @@ gc::MergeCompartments(JSCompartment *source, JSCompartment *target) { // The source compartment must be specifically flagged as mergable. This // also implies that the compartment is not visible to the debugger. - JS_ASSERT(source->options_.mergeable()); + MOZ_ASSERT(source->options_.mergeable()); - JS_ASSERT(source->addonId == target->addonId); + MOZ_ASSERT(source->addonId == target->addonId); JSRuntime *rt = source->runtimeFromMainThread(); @@ -6040,13 +6040,13 @@ gc::MergeCompartments(JSCompartment *source, JSCompartment *target) for (ZoneCellIter iter(source->zone(), FINALIZE_SCRIPT); !iter.done(); iter.next()) { JSScript *script = iter.get(); - JS_ASSERT(script->compartment() == source); + MOZ_ASSERT(script->compartment() == source); script->compartment_ = target; } for (ZoneCellIter iter(source->zone(), FINALIZE_BASE_SHAPE); !iter.done(); iter.next()) { BaseShape *base = iter.get(); - JS_ASSERT(base->compartment() == source); + MOZ_ASSERT(base->compartment() == source); base->compartment_ = target; } @@ -6061,7 +6061,7 @@ gc::MergeCompartments(JSCompartment *source, JSCompartment *target) // The source should be the only compartment in its zone. for (CompartmentsInZoneIter c(source->zone()); !c.done(); c.next()) - JS_ASSERT(c.get() == source); + MOZ_ASSERT(c.get() == source); // Merge the allocator in source's zone into target's zone. target->zone()->allocator.arenas.adoptArenas(rt, &source->zone()->allocator.arenas); @@ -6130,14 +6130,14 @@ GCRuntime::runDebugGC() void GCRuntime::setValidate(bool enabled) { - JS_ASSERT(!isHeapMajorCollecting()); + MOZ_ASSERT(!isHeapMajorCollecting()); validate = enabled; } void GCRuntime::setFullCompartmentChecks(bool enabled) { - JS_ASSERT(!isHeapMajorCollecting()); + MOZ_ASSERT(!isHeapMajorCollecting()); fullCompartmentChecks = enabled; } @@ -6145,7 +6145,7 @@ GCRuntime::setFullCompartmentChecks(bool enabled) bool GCRuntime::selectForMarking(JSObject *object) { - JS_ASSERT(!isHeapMajorCollecting()); + MOZ_ASSERT(!isHeapMajorCollecting()); return selectedForMarking.append(object); } @@ -6158,7 +6158,7 @@ GCRuntime::clearSelectedForMarking() void GCRuntime::setDeterministic(bool enabled) { - JS_ASSERT(!isHeapMajorCollecting()); + MOZ_ASSERT(!isHeapMajorCollecting()); deterministicOnly = enabled; } #endif @@ -6241,7 +6241,7 @@ ArenaLists::normalizeBackgroundFinalizeState(AllocKind thingKind) *bfs = BFS_DONE; break; default: - JS_ASSERT(!"Background finalization in progress, but it should not be."); + MOZ_ASSERT(!"Background finalization in progress, but it should not be."); break; } } @@ -6340,18 +6340,18 @@ AutoDisableProxyCheck::~AutoDisableProxyCheck() JS_FRIEND_API(void) JS::AssertGCThingMustBeTenured(JSObject *obj) { - JS_ASSERT(obj->isTenured() && - (!IsNurseryAllocable(obj->asTenured()->getAllocKind()) || obj->getClass()->finalize)); + MOZ_ASSERT(obj->isTenured() && + (!IsNurseryAllocable(obj->asTenured()->getAllocKind()) || obj->getClass()->finalize)); } JS_FRIEND_API(void) js::gc::AssertGCThingHasType(js::gc::Cell *cell, JSGCTraceKind kind) { - JS_ASSERT(cell); + MOZ_ASSERT(cell); if (IsInsideNursery(cell)) - JS_ASSERT(kind == JSTRACE_OBJECT); + MOZ_ASSERT(kind == JSTRACE_OBJECT); else - JS_ASSERT(MapAllocToTraceKind(cell->asTenured()->getAllocKind()) == kind); + MOZ_ASSERT(MapAllocToTraceKind(cell->asTenured()->getAllocKind()) == kind); } JS_FRIEND_API(size_t) @@ -6419,7 +6419,7 @@ JS::AutoAssertNoAlloc::AutoAssertNoAlloc(JSRuntime *rt) void JS::AutoAssertNoAlloc::disallowAlloc(JSRuntime *rt) { - JS_ASSERT(!gc); + MOZ_ASSERT(!gc); gc = &rt->gc; gc->disallowAlloc(); } diff --git a/js/src/jsgc.h b/js/src/jsgc.h index cc7994e25244..862287985b4c 100644 --- a/js/src/jsgc.h +++ b/js/src/jsgc.h @@ -73,7 +73,7 @@ template <> struct MapTypeToFinalizeKind { static const Alloc static inline bool IsNurseryAllocable(AllocKind kind) { - JS_ASSERT(kind >= 0 && unsigned(kind) < FINALIZE_LIMIT); + MOZ_ASSERT(kind >= 0 && unsigned(kind) < FINALIZE_LIMIT); static const bool map[] = { false, /* FINALIZE_OBJECT0 */ true, /* FINALIZE_OBJECT0_BACKGROUND */ @@ -110,7 +110,7 @@ IsNurseryAllocable(AllocKind kind) static inline bool IsFJNurseryAllocable(AllocKind kind) { - JS_ASSERT(kind >= 0 && unsigned(kind) < FINALIZE_LIMIT); + MOZ_ASSERT(kind >= 0 && unsigned(kind) < FINALIZE_LIMIT); static const bool map[] = { false, /* FINALIZE_OBJECT0 */ true, /* FINALIZE_OBJECT0_BACKGROUND */ @@ -143,7 +143,7 @@ IsFJNurseryAllocable(AllocKind kind) static inline bool IsBackgroundFinalized(AllocKind kind) { - JS_ASSERT(kind >= 0 && unsigned(kind) < FINALIZE_LIMIT); + MOZ_ASSERT(kind >= 0 && unsigned(kind) < FINALIZE_LIMIT); static const bool map[] = { false, /* FINALIZE_OBJECT0 */ true, /* FINALIZE_OBJECT0_BACKGROUND */ @@ -175,7 +175,7 @@ IsBackgroundFinalized(AllocKind kind) static inline bool CanBeFinalizedInBackground(gc::AllocKind kind, const Class *clasp) { - JS_ASSERT(kind <= gc::FINALIZE_OBJECT_LAST); + MOZ_ASSERT(kind <= gc::FINALIZE_OBJECT_LAST); /* If the class has no finalizer or a finalizer that is safe to call on * a different thread, we change the finalize kind. For example, * FINALIZE_OBJECT0 calls the finalizer on the main thread, @@ -223,15 +223,15 @@ GetGCArrayKind(size_t numSlots) static inline AllocKind GetGCObjectFixedSlotsKind(size_t numFixedSlots) { - JS_ASSERT(numFixedSlots < SLOTS_TO_THING_KIND_LIMIT); + MOZ_ASSERT(numFixedSlots < SLOTS_TO_THING_KIND_LIMIT); return slotsToThingKind[numFixedSlots]; } static inline AllocKind GetBackgroundAllocKind(AllocKind kind) { - JS_ASSERT(!IsBackgroundFinalized(kind)); - JS_ASSERT(kind <= FINALIZE_OBJECT_LAST); + MOZ_ASSERT(!IsBackgroundFinalized(kind)); + MOZ_ASSERT(kind <= FINALIZE_OBJECT_LAST); return (AllocKind) (kind + 1); } @@ -271,7 +271,7 @@ GetGCKindSlots(AllocKind thingKind, const Class *clasp) /* An object's private data uses the space taken by its last fixed slot. */ if (clasp->flags & JSCLASS_HAS_PRIVATE) { - JS_ASSERT(nslots > 0); + MOZ_ASSERT(nslots > 0); nslots--; } @@ -311,7 +311,7 @@ struct SortedArenaListSegment // Appends |aheader| to this segment. void append(ArenaHeader *aheader) { - JS_ASSERT(aheader); + MOZ_ASSERT(aheader); JS_ASSERT_IF(head, head->getAllocKind() == aheader->getAllocKind()); *tailp = aheader; tailp = &aheader->next; @@ -468,7 +468,7 @@ class ArenaList { ArenaList &insertListWithCursorAtEnd(const ArenaList &other) { check(); other.check(); - JS_ASSERT(other.isCursorAtEnd()); + MOZ_ASSERT(other.isCursorAtEnd()); if (other.isCursorAtHead()) return *this; // Insert the full arenas of |other| after those of |this|. @@ -519,7 +519,7 @@ class SortedArenaList } void setThingsPerArena(size_t thingsPerArena) { - JS_ASSERT(thingsPerArena && thingsPerArena <= MaxThingsPerArena); + MOZ_ASSERT(thingsPerArena && thingsPerArena <= MaxThingsPerArena); thingsPerArena_ = thingsPerArena; } @@ -533,7 +533,7 @@ class SortedArenaList // Inserts a header, which has room for |nfree| more things, in its segment. void insertAt(ArenaHeader *aheader, size_t nfree) { - JS_ASSERT(nfree <= thingsPerArena_); + MOZ_ASSERT(nfree <= thingsPerArena_); segments[nfree].append(aheader); } @@ -633,7 +633,7 @@ class ArenaLists * We can only call this during the shutdown after the last GC when * the background finalization is disabled. */ - JS_ASSERT(backgroundFinalizeState[i] == BFS_DONE); + MOZ_ASSERT(backgroundFinalizeState[i] == BFS_DONE); ArenaHeader *next; for (ArenaHeader *aheader = arenaLists[i].head(); aheader; aheader = next) { // Copy aheader->next before releasing. @@ -693,8 +693,8 @@ class ArenaLists void unmarkAll() { for (size_t i = 0; i != FINALIZE_LIMIT; ++i) { /* The background finalization must have stopped at this point. */ - JS_ASSERT(backgroundFinalizeState[i] == BFS_DONE || - backgroundFinalizeState[i] == BFS_JUST_FINISHED); + MOZ_ASSERT(backgroundFinalizeState[i] == BFS_DONE || + backgroundFinalizeState[i] == BFS_JUST_FINISHED); for (ArenaHeader *aheader = arenaLists[i].head(); aheader; aheader = aheader->next) aheader->unmarkAll(); } @@ -743,7 +743,7 @@ class ArenaLists FreeList *freeList = &freeLists[thingKind]; if (!freeList->isEmpty()) { ArenaHeader *aheader = freeList->arenaHeader(); - JS_ASSERT(!aheader->hasFreeThings()); + MOZ_ASSERT(!aheader->hasFreeThings()); aheader->setFirstFreeSpan(freeList->getHead()); } } @@ -761,7 +761,7 @@ class ArenaLists FreeList *freeList = &freeLists[kind]; if (!freeList->isEmpty()) { ArenaHeader *aheader = freeList->arenaHeader(); - JS_ASSERT(freeList->isSameNonEmptySpan(aheader->getFirstFreeSpan())); + MOZ_ASSERT(freeList->isSameNonEmptySpan(aheader->getFirstFreeSpan())); aheader->setAsFullyUsed(); } } @@ -780,7 +780,7 @@ class ArenaLists * If the arena has a free list, it must be the same as one in * lists. */ - JS_ASSERT(freeList->isSameNonEmptySpan(aheader->getFirstFreeSpan())); + MOZ_ASSERT(freeList->isSameNonEmptySpan(aheader->getFirstFreeSpan())); return true; } return false; @@ -788,7 +788,7 @@ class ArenaLists /* Check if |aheader|'s arena is in use. */ bool arenaIsInUse(ArenaHeader *aheader, AllocKind kind) const { - JS_ASSERT(aheader); + MOZ_ASSERT(aheader); const FreeList &freeList = freeLists[kind]; if (freeList.isEmpty()) return false; @@ -819,12 +819,12 @@ class ArenaLists void checkEmptyFreeLists() { #ifdef DEBUG for (size_t i = 0; i < mozilla::ArrayLength(freeLists); ++i) - JS_ASSERT(freeLists[i].isEmpty()); + MOZ_ASSERT(freeLists[i].isEmpty()); #endif } void checkEmptyFreeList(AllocKind kind) { - JS_ASSERT(freeLists[kind].isEmpty()); + MOZ_ASSERT(freeLists[kind].isEmpty()); } #ifdef JSGC_COMPACTING @@ -1005,7 +1005,7 @@ class GCHelperState friend class js::gc::ArenaLists; static void freeElementsAndArray(void **array, void **end) { - JS_ASSERT(array <= end); + MOZ_ASSERT(array <= end); for (void **p = array; p != end; ++p) js_free(*p); js_free(array); @@ -1064,7 +1064,7 @@ class GCHelperState } bool shouldShrink() const { - JS_ASSERT(isBackgroundSweeping()); + MOZ_ASSERT(isBackgroundSweeping()); return shrinkFlag; } }; @@ -1077,13 +1077,13 @@ struct GCChunkHasher { * ratio. */ static HashNumber hash(gc::Chunk *chunk) { - JS_ASSERT(!(uintptr_t(chunk) & gc::ChunkMask)); + MOZ_ASSERT(!(uintptr_t(chunk) & gc::ChunkMask)); return HashNumber(uintptr_t(chunk) >> gc::ChunkShift); } static bool match(gc::Chunk *k, gc::Chunk *l) { - JS_ASSERT(!(uintptr_t(k) & gc::ChunkMask)); - JS_ASSERT(!(uintptr_t(l) & gc::ChunkMask)); + MOZ_ASSERT(!(uintptr_t(k) & gc::ChunkMask)); + MOZ_ASSERT(!(uintptr_t(l) & gc::ChunkMask)); return k == l; } }; @@ -1208,7 +1208,7 @@ class RelocationOverlay } Cell *forwardingAddress() const { - JS_ASSERT(isForwarded()); + MOZ_ASSERT(isForwarded()); return newLocation_; } @@ -1247,7 +1247,7 @@ IsForwarded(const JS::Value &value) if (value.isSymbol()) return IsForwarded(value.toSymbol()); - JS_ASSERT(!value.isGCThing()); + MOZ_ASSERT(!value.isGCThing()); return false; } @@ -1270,7 +1270,7 @@ Forwarded(const JS::Value &value) else if (value.isSymbol()) return SymbolValue(Forwarded(value.toSymbol())); - JS_ASSERT(!value.isGCThing()); + MOZ_ASSERT(!value.isGCThing()); return value; } diff --git a/js/src/jsgcinlines.h b/js/src/jsgcinlines.h index d0a3e4e9c8b4..18617ac0ce2a 100644 --- a/js/src/jsgcinlines.h +++ b/js/src/jsgcinlines.h @@ -38,15 +38,15 @@ ThreadSafeContext::isThreadLocal(T thing) const #endif // Global invariant - JS_ASSERT(!IsInsideNursery(thing)); + MOZ_ASSERT(!IsInsideNursery(thing)); // The thing is not in the nursery, but is it in the private tenured area? if (allocator_->arenas.containsArena(runtime_, thing->asTenured()->arenaHeader())) { // GC should be suppressed in preparation for mutating thread local // objects, as we don't want to trip any barriers. - JS_ASSERT(!thing->zoneFromAnyThread()->needsIncrementalBarrier()); - JS_ASSERT(!thing->runtimeFromAnyThread()->needsIncrementalBarrier()); + MOZ_ASSERT(!thing->zoneFromAnyThread()->needsIncrementalBarrier()); + MOZ_ASSERT(!thing->runtimeFromAnyThread()->needsIncrementalBarrier()); return true; } @@ -86,7 +86,7 @@ ShouldFJNurseryAllocate(const ForkJoinNursery &nursery, AllocKind kind, InitialH inline JSGCTraceKind GetGCThingTraceKind(const void *thing) { - JS_ASSERT(thing); + MOZ_ASSERT(thing); const Cell *cell = static_cast(thing); #ifdef JSGC_GENERATIONAL if (IsInsideNursery(cell)) @@ -152,7 +152,7 @@ class ArenaIter } void next() { - JS_ASSERT(!done()); + MOZ_ASSERT(!done()); aheader = aheader->next; if (!aheader) { aheader = unsweptHeader; @@ -179,8 +179,8 @@ class ArenaCellIterImpl // Upon entry, |thing| points to any thing (free or used) and finds the // first used thing, which may be |thing|. void moveForwardIfFree() { - JS_ASSERT(!done()); - JS_ASSERT(thing); + MOZ_ASSERT(!done()); + MOZ_ASSERT(thing); // Note: if |span| is empty, this test will fail, which is what we want // -- |span| being empty means that we're past the end of the last free // thing, all the remaining things in the arena are used, and we'll @@ -212,7 +212,7 @@ class ArenaCellIterImpl void init(ArenaHeader *aheader) { #ifdef DEBUG AllocKind kind = aheader->getAllocKind(); - JS_ASSERT(aheader->zone->allocator.arenas.isSynchronizedFreeList(kind)); + MOZ_ASSERT(aheader->zone->allocator.arenas.isSynchronizedFreeList(kind)); #endif initUnsynchronized(aheader); } @@ -220,7 +220,7 @@ class ArenaCellIterImpl // Use this to move from an Arena of a particular kind to another Arena of // the same kind. void reset(ArenaHeader *aheader) { - JS_ASSERT(isInited); + MOZ_ASSERT(isInited); span = aheader->getFirstFreeSpan(); uintptr_t arenaAddr = aheader->arenaAddress(); thing = arenaAddr + firstThingOffset; @@ -233,12 +233,12 @@ class ArenaCellIterImpl } TenuredCell *getCell() const { - JS_ASSERT(!done()); + MOZ_ASSERT(!done()); return reinterpret_cast(thing); } template T *get() const { - JS_ASSERT(!done()); + MOZ_ASSERT(!done()); return static_cast(getCell()); } @@ -258,7 +258,7 @@ class ArenaCellIterUnderGC : public ArenaCellIterImpl { public: explicit ArenaCellIterUnderGC(ArenaHeader *aheader) { - JS_ASSERT(aheader->zone->runtimeFromAnyThread()->isHeapBusy()); + MOZ_ASSERT(aheader->zone->runtimeFromAnyThread()->isHeapBusy()); init(aheader); } }; @@ -280,7 +280,7 @@ class ZoneCellIterImpl ZoneCellIterImpl() {} void init(JS::Zone *zone, AllocKind kind) { - JS_ASSERT(zone->allocator.arenas.isSynchronizedFreeList(kind)); + MOZ_ASSERT(zone->allocator.arenas.isSynchronizedFreeList(kind)); arenaIter.init(zone, kind); if (!arenaIter.done()) cellIter.init(arenaIter.get()); @@ -292,20 +292,20 @@ class ZoneCellIterImpl } template T *get() const { - JS_ASSERT(!done()); + MOZ_ASSERT(!done()); return cellIter.get(); } Cell *getCell() const { - JS_ASSERT(!done()); + MOZ_ASSERT(!done()); return cellIter.getCell(); } void next() { - JS_ASSERT(!done()); + MOZ_ASSERT(!done()); cellIter.next(); if (cellIter.done()) { - JS_ASSERT(!arenaIter.done()); + MOZ_ASSERT(!arenaIter.done()); arenaIter.next(); if (!arenaIter.done()) cellIter.reset(arenaIter.get()); @@ -318,9 +318,9 @@ class ZoneCellIterUnderGC : public ZoneCellIterImpl public: ZoneCellIterUnderGC(JS::Zone *zone, AllocKind kind) { #ifdef JSGC_GENERATIONAL - JS_ASSERT(zone->runtimeFromAnyThread()->gc.nursery.isEmpty()); + MOZ_ASSERT(zone->runtimeFromAnyThread()->gc.nursery.isEmpty()); #endif - JS_ASSERT(zone->runtimeFromAnyThread()->isHeapBusy()); + MOZ_ASSERT(zone->runtimeFromAnyThread()->isHeapBusy()); init(zone, kind); } }; @@ -357,7 +357,7 @@ class ZoneCellIter : public ZoneCellIterImpl if (lists->isSynchronizedFreeList(kind)) { lists = nullptr; } else { - JS_ASSERT(!zone->runtimeFromMainThread()->isHeapBusy()); + MOZ_ASSERT(!zone->runtimeFromMainThread()->isHeapBusy()); lists->copyFreeListToArena(kind); } @@ -387,14 +387,14 @@ class GCZonesIter bool done() const { return zone.done(); } void next() { - JS_ASSERT(!done()); + MOZ_ASSERT(!done()); do { zone.next(); } while (!zone.done() && !zone->isCollecting()); } JS::Zone *get() const { - JS_ASSERT(!done()); + MOZ_ASSERT(!done()); return zone; } @@ -411,19 +411,19 @@ class GCZoneGroupIter { public: explicit GCZoneGroupIter(JSRuntime *rt) { - JS_ASSERT(rt->isHeapBusy()); + MOZ_ASSERT(rt->isHeapBusy()); current = rt->gc.getCurrentZoneGroup(); } bool done() const { return !current; } void next() { - JS_ASSERT(!done()); + MOZ_ASSERT(!done()); current = current->nextNodeInGroup(); } JS::Zone *get() const { - JS_ASSERT(!done()); + MOZ_ASSERT(!done()); return current; } @@ -442,7 +442,7 @@ template inline JSObject * TryNewNurseryObject(JSContext *cx, size_t thingSize, size_t nDynamicSlots) { - JS_ASSERT(!IsAtomsCompartment(cx->compartment())); + MOZ_ASSERT(!IsAtomsCompartment(cx->compartment())); JSRuntime *rt = cx->runtime(); Nursery &nursery = rt->gc.nursery; JSObject *obj = nursery.allocateObject(cx, thingSize, nDynamicSlots); @@ -454,7 +454,7 @@ TryNewNurseryObject(JSContext *cx, size_t thingSize, size_t nDynamicSlots) /* Exceeding gcMaxBytes while tenuring can disable the Nursery. */ if (nursery.isEnabled()) { JSObject *obj = nursery.allocateObject(cx, thingSize, nDynamicSlots); - JS_ASSERT(obj); + MOZ_ASSERT(obj); return obj; } } @@ -506,8 +506,8 @@ CheckAllocatorState(ThreadSafeContext *cx, AllocKind kind) kind == FINALIZE_FAT_INLINE_STRING || kind == FINALIZE_SYMBOL || kind == FINALIZE_JITCODE); - JS_ASSERT(!rt->isHeapBusy()); - JS_ASSERT(rt->gc.isAllocAllowed()); + MOZ_ASSERT(!rt->isHeapBusy()); + MOZ_ASSERT(rt->gc.isAllocAllowed()); #endif // Crash if we perform a GC action when it is not safe. @@ -563,8 +563,8 @@ AllocateObject(ThreadSafeContext *cx, AllocKind kind, size_t nDynamicSlots, Init { size_t thingSize = Arena::thingSize(kind); - JS_ASSERT(thingSize == Arena::thingSize(kind)); - JS_ASSERT(thingSize >= sizeof(JSObject)); + MOZ_ASSERT(thingSize == Arena::thingSize(kind)); + MOZ_ASSERT(thingSize >= sizeof(JSObject)); static_assert(sizeof(JSObject) >= CellSize, "All allocations must be at least the allocator-imposed minimum size."); @@ -625,7 +625,7 @@ AllocateNonObject(ThreadSafeContext *cx) AllocKind kind = MapTypeToFinalizeKind::kind; size_t thingSize = sizeof(T); - JS_ASSERT(thingSize == Arena::thingSize(kind)); + MOZ_ASSERT(thingSize == Arena::thingSize(kind)); if (!CheckAllocatorState(cx, kind)) return nullptr; @@ -655,7 +655,7 @@ AllocateObjectForCacheHit(JSContext *cx, AllocKind kind, InitialHeap heap) if (ShouldNurseryAllocate(cx->nursery(), kind, heap)) { size_t thingSize = Arena::thingSize(kind); - JS_ASSERT(thingSize == Arena::thingSize(kind)); + MOZ_ASSERT(thingSize == Arena::thingSize(kind)); if (!CheckAllocatorState(cx, kind)) return nullptr; @@ -687,7 +687,7 @@ IsInsideGGCNursery(const js::gc::Cell *cell) addr &= ~js::gc::ChunkMask; addr |= js::gc::ChunkLocationOffset; uint32_t location = *reinterpret_cast(addr); - JS_ASSERT(location != 0); + MOZ_ASSERT(location != 0); return location & js::gc::ChunkLocationBitNursery; #else return false; @@ -700,7 +700,7 @@ template inline JSObject * NewGCObject(js::ThreadSafeContext *cx, js::gc::AllocKind kind, size_t nDynamicSlots, js::gc::InitialHeap heap) { - JS_ASSERT(kind >= js::gc::FINALIZE_OBJECT0 && kind <= js::gc::FINALIZE_OBJECT_LAST); + MOZ_ASSERT(kind >= js::gc::FINALIZE_OBJECT0 && kind <= js::gc::FINALIZE_OBJECT_LAST); return js::gc::AllocateObject(cx, kind, nDynamicSlots, heap); } diff --git a/js/src/jsinfer.cpp b/js/src/jsinfer.cpp index f22f44bbb3ea..f557b4b0bfcc 100644 --- a/js/src/jsinfer.cpp +++ b/js/src/jsinfer.cpp @@ -388,7 +388,7 @@ TypeSet::isSubset(TypeSet *other) return false; if (unknownObject()) { - JS_ASSERT(other->unknownObject()); + MOZ_ASSERT(other->unknownObject()); } else { for (unsigned i = 0; i < getObjectCount(); i++) { TypeObjectKey *obj = getObject(i); @@ -460,14 +460,14 @@ ConstraintTypeSet::addConstraint(JSContext *cx, TypeConstraint *constraint, bool return false; } - JS_ASSERT(cx->compartment()->activeAnalysis); + MOZ_ASSERT(cx->compartment()->activeAnalysis); InferSpew(ISpewOps, "addConstraint: %sT%p%s %sC%p%s %s", InferSpewColor(this), this, InferSpewColorReset(), InferSpewColor(constraint), constraint, InferSpewColorReset(), constraint->kind()); - JS_ASSERT(constraint->next == nullptr); + MOZ_ASSERT(constraint->next == nullptr); constraint->next = constraintList; constraintList = constraint; @@ -492,7 +492,7 @@ TypeSet::addType(Type type, LifoAlloc *alloc) if (type.isUnknown()) { flags |= TYPE_FLAG_BASE_MASK; clearObjects(); - JS_ASSERT(unknown()); + MOZ_ASSERT(unknown()); return; } @@ -533,7 +533,7 @@ TypeSet::addType(Type type, LifoAlloc *alloc) if (type.isTypeObject()) { TypeObject *nobject = type.typeObject(); - JS_ASSERT(!nobject->singleton()); + MOZ_ASSERT(!nobject->singleton()); if (nobject->unknownProperties()) goto unknownObject; @@ -554,7 +554,7 @@ TypeSet::addType(Type type, LifoAlloc *alloc) void ConstraintTypeSet::addType(ExclusiveContext *cxArg, Type type) { - JS_ASSERT(cxArg->compartment()->activeAnalysis); + MOZ_ASSERT(cxArg->compartment()->activeAnalysis); if (hasType(type)) return; @@ -576,7 +576,7 @@ ConstraintTypeSet::addType(ExclusiveContext *cxArg, Type type) constraint = constraint->next; } } else { - JS_ASSERT(!constraintList); + MOZ_ASSERT(!constraintList); } } @@ -651,7 +651,7 @@ TypeSet::readBarrier(const TypeSet *types) bool TypeSet::clone(LifoAlloc *alloc, TemporaryTypeSet *result) const { - JS_ASSERT(result->empty()); + MOZ_ASSERT(result->empty()); unsigned objectCount = baseObjectCount(); unsigned capacity = (objectCount >= 2) ? HashSetCapacity(objectCount) : 0; @@ -1031,7 +1031,7 @@ TypeObjectKey::clasp() TaggedProto TypeObjectKey::proto() { - JS_ASSERT(hasTenuredProto()); + MOZ_ASSERT(hasTenuredProto()); return isTypeObject() ? asTypeObject()->proto() : asSingleObject()->getTaggedProto(); } @@ -1082,7 +1082,7 @@ TypeObjectKey::unknownProperties() HeapTypeSetKey TypeObjectKey::property(jsid id) { - JS_ASSERT(!unknownProperties()); + MOZ_ASSERT(!unknownProperties()); HeapTypeSetKey property; property.object_ = this; @@ -1100,7 +1100,7 @@ TypeObjectKey::ensureTrackedProperty(JSContext *cx, jsid id) // the VM and has not been instantiated yet, instantiate it now if we are // on the main thread and able to do so. if (!JSID_IS_VOID(id) && !JSID_IS_EMPTY(id)) { - JS_ASSERT(CurrentThreadCanAccessRuntime(cx->runtime())); + MOZ_ASSERT(CurrentThreadCanAccessRuntime(cx->runtime())); if (JSObject *obj = singleton()) { if (obj->isNative() && obj->nativeLookupPure(id)) EnsureTrackPropertyTypes(cx, obj, id); @@ -1219,7 +1219,7 @@ types::FinishCompilation(JSContext *cx, HandleScript script, ExecutionMode execu for (size_t i = 0; i < constraints->numFrozenScripts(); i++) { const CompilerConstraintList::FrozenScript &entry = constraints->frozenScript(i); - JS_ASSERT(entry.script->types); + MOZ_ASSERT(entry.script->types); if (!CheckFrozenTypeSet(cx, entry.thisTypes, types::TypeScript::ThisTypes(entry.script))) succeeded = false; @@ -1287,25 +1287,25 @@ types::FinishDefinitePropertiesAnalysis(JSContext *cx, CompilerConstraintList *c for (size_t i = 0; i < constraints->numFrozenScripts(); i++) { const CompilerConstraintList::FrozenScript &entry = constraints->frozenScript(i); JSScript *script = entry.script; - JS_ASSERT(script->types); + MOZ_ASSERT(script->types); - JS_ASSERT(TypeScript::ThisTypes(script)->isSubset(entry.thisTypes)); + MOZ_ASSERT(TypeScript::ThisTypes(script)->isSubset(entry.thisTypes)); unsigned nargs = entry.script->functionNonDelazifying() ? entry.script->functionNonDelazifying()->nargs() : 0; for (size_t j = 0; j < nargs; j++) - JS_ASSERT(TypeScript::ArgTypes(script, j)->isSubset(&entry.argTypes[j])); + MOZ_ASSERT(TypeScript::ArgTypes(script, j)->isSubset(&entry.argTypes[j])); for (size_t j = 0; j < script->nTypeSets(); j++) - JS_ASSERT(script->types->typeArray()[j].isSubset(&entry.bytecodeTypes[j])); + MOZ_ASSERT(script->types->typeArray()[j].isSubset(&entry.bytecodeTypes[j])); } #endif for (size_t i = 0; i < constraints->numFrozenScripts(); i++) { const CompilerConstraintList::FrozenScript &entry = constraints->frozenScript(i); JSScript *script = entry.script; - JS_ASSERT(script->types); + MOZ_ASSERT(script->types); if (!script->types) MOZ_CRASH(); @@ -1518,7 +1518,7 @@ class ConstraintDataFreezeObjectFlags explicit ConstraintDataFreezeObjectFlags(TypeObjectFlags flags) : flags(flags) { - JS_ASSERT(flags); + MOZ_ASSERT(flags); } const char *kind() { return "freezeObjectFlags"; } @@ -1543,7 +1543,7 @@ class ConstraintDataFreezeObjectFlags bool TypeObjectKey::hasFlags(CompilerConstraintList *constraints, TypeObjectFlags flags) { - JS_ASSERT(flags); + MOZ_ASSERT(flags); if (TypeObject *type = maybeType()) { if (type->hasAnyFlags(flags)) @@ -1713,7 +1713,7 @@ ObjectStateChange(ExclusiveContext *cxArg, TypeObject *object, bool markingUnkno constraint = constraint->next; } } else { - JS_ASSERT(!types->constraintList); + MOZ_ASSERT(!types->constraintList); } } } @@ -2022,7 +2022,7 @@ TemporaryTypeSet::forAllClasses(bool (*func)(const Class* clasp)) } } - JS_ASSERT(true_results != false_results); + MOZ_ASSERT(true_results != false_results); return true_results ? ForAllResult::ALL_TRUE : ForAllResult::ALL_FALSE; } @@ -2199,7 +2199,7 @@ TypeCompartment::addAllocationSiteTypeObject(JSContext *cx, AllocationSiteKey ke } AllocationSiteTable::AddPtr p = allocationSiteTable->lookupForAdd(key); - JS_ASSERT(!p); + MOZ_ASSERT(!p); TypeObject *res = nullptr; @@ -2329,7 +2329,7 @@ types::UseNewTypeForInitializer(JSScript *script, jsbytecode *pc, const Class *c static inline bool ClassCanHaveExtraProperties(const Class *clasp) { - JS_ASSERT(clasp->resolve); + MOZ_ASSERT(clasp->resolve); return clasp->resolve != JS_ResolveStub || clasp->ops.lookupGeneric || clasp->ops.getGeneric @@ -2396,7 +2396,7 @@ TypeZone::processPendingRecompiles(FreeOp *fop) Vector *pending = pendingRecompiles; pendingRecompiles = nullptr; - JS_ASSERT(!pending->empty()); + MOZ_ASSERT(!pending->empty()); jit::Invalidate(*this, fop, *pending); @@ -2428,7 +2428,7 @@ TypeZone::addPendingRecompile(JSContext *cx, const RecompileInfo &info) void TypeZone::addPendingRecompile(JSContext *cx, JSScript *script) { - JS_ASSERT(script); + MOZ_ASSERT(script); CancelOffThreadIonCompile(cx->compartment(), script); @@ -2452,10 +2452,10 @@ TypeZone::addPendingRecompile(JSContext *cx, JSScript *script) void TypeCompartment::markSetsUnknown(JSContext *cx, TypeObject *target) { - JS_ASSERT(this == &cx->compartment()->types); - JS_ASSERT(!(target->flags() & OBJECT_FLAG_SETS_MARKED_UNKNOWN)); - JS_ASSERT(!target->singleton()); - JS_ASSERT(target->unknownProperties()); + MOZ_ASSERT(this == &cx->compartment()->types); + MOZ_ASSERT(!(target->flags() & OBJECT_FLAG_SETS_MARKED_UNKNOWN)); + MOZ_ASSERT(!target->singleton()); + MOZ_ASSERT(target->unknownProperties()); AutoEnterAnalysis enter(cx); @@ -2546,7 +2546,7 @@ static inline Type GetValueTypeForTable(const Value &v) { Type type = GetValueType(v); - JS_ASSERT(!type.isSingleObject()); + MOZ_ASSERT(!type.isSingleObject()); return type; } @@ -2584,7 +2584,7 @@ void TypeCompartment::setTypeToHomogenousArray(ExclusiveContext *cx, JSObject *obj, Type elementType) { - JS_ASSERT(cx->compartment()->activeAnalysis); + MOZ_ASSERT(cx->compartment()->activeAnalysis); if (!arrayTypeTable) { arrayTypeTable = cx->new_(); @@ -2625,7 +2625,7 @@ TypeCompartment::fixArrayType(ExclusiveContext *cx, JSObject *obj) * If the array is heterogenous, keep the existing type object, which has * unknown properties. */ - JS_ASSERT(obj->is()); + MOZ_ASSERT(obj->is()); unsigned len = obj->getDenseInitializedLength(); if (len == 0) @@ -2661,7 +2661,7 @@ TypeCompartment::fixRestArgumentsType(ExclusiveContext *cx, JSObject *obj) * Tracking element types for rest argument arrays is not worth it, but we * still want it to be known that it's a dense array. */ - JS_ASSERT(obj->is()); + MOZ_ASSERT(obj->is()); setTypeToHomogenousArray(cx, obj, Type::UnknownType()); } @@ -2757,7 +2757,7 @@ TypeCompartment::fixObjectType(ExclusiveContext *cx, JSObject *obj) * Use the same type object for all singleton/JSON objects with the same * base shape, i.e. the same fields written in the same order. */ - JS_ASSERT(obj->is()); + MOZ_ASSERT(obj->is()); /* * Exclude some objects we can't readily associate common types for based on their @@ -2783,8 +2783,8 @@ TypeCompartment::fixObjectType(ExclusiveContext *cx, JSObject *obj) ObjectTypeTable::AddPtr p = objectTypeTable->lookupForAdd(lookup); if (p) { - JS_ASSERT(obj->getProto() == p->value().object->proto().toObject()); - JS_ASSERT(obj->lastProperty() == p->value().shape); + MOZ_ASSERT(obj->getProto() == p->value().object->proto().toObject()); + MOZ_ASSERT(obj->lastProperty() == p->value().shape); UpdateObjectTableEntryTypes(cx, p->value(), properties.begin(), properties.length()); obj->setType(p->value().object); @@ -2818,7 +2818,7 @@ TypeCompartment::fixObjectType(ExclusiveContext *cx, JSObject *obj) key.properties = ids; key.nproperties = properties.length(); key.nfixed = obj->numFixedSlots(); - JS_ASSERT(ObjectTableKey::match(key, lookup)); + MOZ_ASSERT(ObjectTableKey::match(key, lookup)); ObjectTableEntry entry; entry.object.set(objType); @@ -2879,7 +2879,7 @@ TypeCompartment::newTypedObject(JSContext *cx, IdValuePair *properties, size_t n cx->clearPendingException(); return nullptr; } - JS_ASSERT(obj->getProto() == p->value().object->proto().toObject()); + MOZ_ASSERT(obj->getProto() == p->value().object->proto().toObject()); RootedShape shape(cx, p->value().shape); if (!JSObject::setLastProperty(cx, obj, shape)) { @@ -2903,7 +2903,7 @@ TypeCompartment::newTypedObject(JSContext *cx, IdValuePair *properties, size_t n void TypeObject::setProto(JSContext *cx, TaggedProto proto) { - JS_ASSERT(singleton()); + MOZ_ASSERT(singleton()); if (proto.isObject() && IsInsideNursery(proto.toObject())) addFlags(OBJECT_FLAG_NURSERY_PROTO); @@ -2915,7 +2915,7 @@ static inline void UpdatePropertyType(ExclusiveContext *cx, HeapTypeSet *types, JSObject *obj, Shape *shape, bool indexed) { - JS_ASSERT(obj->hasSingletonType() && !obj->hasLazyType()); + MOZ_ASSERT(obj->hasSingletonType() && !obj->hasLazyType()); if (!shape->writable()) types->setNonWritableProperty(cx); @@ -3059,7 +3059,7 @@ TypeObject::matchDefiniteProperties(HandleObject obj) void types::AddTypePropertyId(ExclusiveContext *cx, TypeObject *obj, jsid id, Type type) { - JS_ASSERT(id == IdToTypeId(id)); + MOZ_ASSERT(id == IdToTypeId(id)); if (obj->unknownProperties()) return; @@ -3160,7 +3160,7 @@ TypeObject::markStateChange(ExclusiveContext *cxArg) constraint = constraint->next; } } else { - JS_ASSERT(!types->constraintList); + MOZ_ASSERT(!types->constraintList); } } } @@ -3196,8 +3196,8 @@ TypeObject::markUnknown(ExclusiveContext *cx) { AutoEnterAnalysis enter(cx); - JS_ASSERT(cx->compartment()->activeAnalysis); - JS_ASSERT(!unknownProperties()); + MOZ_ASSERT(cx->compartment()->activeAnalysis); + MOZ_ASSERT(!unknownProperties()); InferSpew(ISpewOps, "UnknownProperties: %s", TypeObjectString(this)); @@ -3280,7 +3280,7 @@ TypeObject::clearNewScript(ExclusiveContext *cx) newScript->rollbackPartiallyInitializedObjects(cx->asJSContext(), this); } else { // Threads with an ExclusiveContext are not allowed to run scripts. - JS_ASSERT(!cx->perThreadData->activation()); + MOZ_ASSERT(!cx->perThreadData->activation()); } js_delete(newScript); @@ -3527,7 +3527,7 @@ types::FillBytecodeTypeMap(JSScript *script, uint32_t *bytecodeMap) break; } } - JS_ASSERT(added == script->nTypeSets()); + MOZ_ASSERT(added == script->nTypeSets()); } JSObject * @@ -3536,11 +3536,11 @@ types::GetOrFixupCopyOnWriteObject(JSContext *cx, HandleScript script, jsbytecod // Make sure that the template object for script/pc has a type indicating // that the object and its copies have copy on write elements. RootedObject obj(cx, script->getObject(GET_UINT32_INDEX(pc))); - JS_ASSERT(obj->is()); - JS_ASSERT(obj->denseElementsAreCopyOnWrite()); + MOZ_ASSERT(obj->is()); + MOZ_ASSERT(obj->denseElementsAreCopyOnWrite()); if (obj->type()->fromAllocationSite()) { - JS_ASSERT(obj->type()->hasAnyFlags(OBJECT_FLAG_COPY_ON_WRITE)); + MOZ_ASSERT(obj->type()->hasAnyFlags(OBJECT_FLAG_COPY_ON_WRITE)); return obj; } @@ -3551,7 +3551,7 @@ types::GetOrFixupCopyOnWriteObject(JSContext *cx, HandleScript script, jsbytecod type->addFlags(OBJECT_FLAG_COPY_ON_WRITE); // Update type information in the initializer object type. - JS_ASSERT(obj->slotSpan() == 0); + MOZ_ASSERT(obj->slotSpan() == 0); for (size_t i = 0; i < obj->getDenseInitializedLength(); i++) { const Value &v = obj->getDenseElement(i); AddTypePropertyId(cx, type, JSID_VOID, v); @@ -3570,8 +3570,8 @@ types::GetCopyOnWriteObject(JSScript *script, jsbytecode *pc) // where this property doesn't hold. See jsop_newarray_copyonwrite in // IonBuilder. JSObject *obj = script->getObject(GET_UINT32_INDEX(pc)); - JS_ASSERT(obj->is()); - JS_ASSERT(obj->denseElementsAreCopyOnWrite()); + MOZ_ASSERT(obj->is()); + MOZ_ASSERT(obj->denseElementsAreCopyOnWrite()); return obj; } @@ -3660,7 +3660,7 @@ types::UseNewTypeForClone(JSFunction *fun) bool JSScript::makeTypes(JSContext *cx) { - JS_ASSERT(!types); + MOZ_ASSERT(!types); AutoEnterAnalysis enter(cx); @@ -3727,8 +3727,8 @@ JSFunction::setTypeForScriptedFunction(ExclusiveContext *cx, HandleFunction fun, /* static */ void TypeNewScript::make(JSContext *cx, TypeObject *type, JSFunction *fun) { - JS_ASSERT(cx->compartment()->activeAnalysis); - JS_ASSERT(!type->newScript()); + MOZ_ASSERT(cx->compartment()->activeAnalysis); + MOZ_ASSERT(!type->newScript()); if (type->unknownProperties()) return; @@ -3752,17 +3752,17 @@ TypeNewScript::make(JSContext *cx, TypeObject *type, JSFunction *fun) void TypeNewScript::registerNewObject(JSObject *res) { - JS_ASSERT(!analyzed()); + MOZ_ASSERT(!analyzed()); // The preliminary object pointers are weak, and won't be swept properly // during nursery collections, so the preliminary objects need to be // initially tenured. - JS_ASSERT(!IsInsideNursery(res)); + MOZ_ASSERT(!IsInsideNursery(res)); // New script objects must have the maximum number of fixed slots, so that // we can adjust their shape later to match the number of fixed slots used // by the template object we eventually create. - JS_ASSERT(res->numFixedSlots() == JSObject::MAX_FIXED_SLOTS); + MOZ_ASSERT(res->numFixedSlots() == JSObject::MAX_FIXED_SLOTS); for (size_t i = 0; i < PRELIMINARY_OBJECT_COUNT; i++) { if (!preliminaryObjects[i]) { @@ -3777,7 +3777,7 @@ TypeNewScript::registerNewObject(JSObject *res) void TypeNewScript::unregisterNewObject(JSObject *res) { - JS_ASSERT(!analyzed()); + MOZ_ASSERT(!analyzed()); for (size_t i = 0; i < PRELIMINARY_OBJECT_COUNT; i++) { if (preliminaryObjects[i] == res) { @@ -3794,7 +3794,7 @@ TypeNewScript::unregisterNewObject(JSObject *res) static bool OnlyHasDataProperties(Shape *shape) { - JS_ASSERT(!shape->inDictionary()); + MOZ_ASSERT(!shape->inDictionary()); while (!shape->isEmptyShape()) { if (!shape->isDataDescriptor() || @@ -3816,8 +3816,8 @@ OnlyHasDataProperties(Shape *shape) static Shape * CommonPrefix(Shape *first, Shape *second) { - JS_ASSERT(OnlyHasDataProperties(first)); - JS_ASSERT(OnlyHasDataProperties(second)); + MOZ_ASSERT(OnlyHasDataProperties(first)); + MOZ_ASSERT(OnlyHasDataProperties(second)); while (first->slotSpan() > second->slotSpan()) first = first->previous(); @@ -3835,7 +3835,7 @@ CommonPrefix(Shape *first, Shape *second) static bool ChangeObjectFixedSlotCount(JSContext *cx, JSObject *obj, gc::AllocKind allocKind) { - JS_ASSERT(OnlyHasDataProperties(obj->lastProperty())); + MOZ_ASSERT(OnlyHasDataProperties(obj->lastProperty())); // Make a clone of the object, with the new allocation kind. RootedShape oldShape(cx, obj->lastProperty()); @@ -3872,7 +3872,7 @@ TypeNewScript::maybeAnalyze(JSContext *cx, TypeObject *type, bool *regenerate, b { // Perform the new script properties analysis if necessary, returning // whether the new type table was updated and type needs to be refreshed. - JS_ASSERT(this == type->newScript()); + MOZ_ASSERT(this == type->newScript()); if (regenerate) *regenerate = false; @@ -3914,7 +3914,7 @@ TypeNewScript::maybeAnalyze(JSContext *cx, TypeObject *type, bool *regenerate, b maxSlotSpan = Max(maxSlotSpan, obj->slotSpan()); if (prefixShape) { - JS_ASSERT(shape->numFixedSlots() == prefixShape->numFixedSlots()); + MOZ_ASSERT(shape->numFixedSlots() == prefixShape->numFixedSlots()); prefixShape = CommonPrefix(prefixShape, shape); } else { prefixShape = shape; @@ -3946,7 +3946,7 @@ TypeNewScript::maybeAnalyze(JSContext *cx, TypeObject *type, bool *regenerate, b if (!ChangeObjectFixedSlotCount(cx, obj, kind)) return false; if (newPrefixShape) { - JS_ASSERT(CommonPrefix(obj->lastProperty(), newPrefixShape) == newPrefixShape); + MOZ_ASSERT(CommonPrefix(obj->lastProperty(), newPrefixShape) == newPrefixShape); } else { newPrefixShape = obj->lastProperty(); while (newPrefixShape->slotSpan() > prefixShape->slotSpan()) @@ -3970,7 +3970,7 @@ TypeNewScript::maybeAnalyze(JSContext *cx, TypeObject *type, bool *regenerate, b if (!type->newScript()) return true; - JS_ASSERT(OnlyHasDataProperties(templateObject()->lastProperty())); + MOZ_ASSERT(OnlyHasDataProperties(templateObject()->lastProperty())); if (templateObject()->slotSpan() != 0) { // Make sure that all definite properties found are reflected in the @@ -4028,7 +4028,7 @@ TypeNewScript::maybeAnalyze(JSContext *cx, TypeObject *type, bool *regenerate, b // existing type to represent fully initialized objects with all // definite properties in the prefix shape, and make a new type object // to represent partially initialized objects. - JS_ASSERT(prefixShape->slotSpan() > templateObject()->slotSpan()); + MOZ_ASSERT(prefixShape->slotSpan() > templateObject()->slotSpan()); TypeObjectFlags initialFlags = type->flags() & OBJECT_FLAG_UNKNOWN_MASK; @@ -4046,7 +4046,7 @@ TypeNewScript::maybeAnalyze(JSContext *cx, TypeObject *type, bool *regenerate, b TypeObjectWithNewScriptSet &table = cx->compartment()->newTypeObjects; TypeObjectWithNewScriptSet::Lookup lookup(type->clasp(), type->proto(), fun); - JS_ASSERT(table.lookup(lookup)->object == type); + MOZ_ASSERT(table.lookup(lookup)->object == type); table.remove(lookup); table.putNew(lookup, TypeObjectWithNewScriptEntry(initialType, fun)); @@ -4142,7 +4142,7 @@ TypeNewScript::rollbackPartiallyInitializedObjects(JSContext *cx, TypeObject *ty } } } else { - JS_ASSERT(init->kind == Initializer::DONE); + MOZ_ASSERT(init->kind == Initializer::DONE); finished = true; break; } @@ -4203,7 +4203,7 @@ JSObject::shouldSplicePrototype(JSContext *cx) bool JSObject::splicePrototype(JSContext *cx, const Class *clasp, Handle proto) { - JS_ASSERT(cx->compartment() == compartment()); + MOZ_ASSERT(cx->compartment() == compartment()); RootedObject self(cx, this); @@ -4212,7 +4212,7 @@ JSObject::splicePrototype(JSContext *cx, const Class *clasp, Handle * can be rearranged as needed without destroying type information for * the old or new types. */ - JS_ASSERT(self->hasSingletonType()); + MOZ_ASSERT(self->hasSingletonType()); /* Inner objects may not appear on prototype chains. */ JS_ASSERT_IF(proto.isObject(), !proto.toObject()->getClass()->ext.outerObject); @@ -4239,8 +4239,8 @@ JSObject::splicePrototype(JSContext *cx, const Class *clasp, Handle /* static */ TypeObject * JSObject::makeLazyType(JSContext *cx, HandleObject obj) { - JS_ASSERT(obj->hasLazyType()); - JS_ASSERT(cx->compartment() == obj->compartment()); + MOZ_ASSERT(obj->hasLazyType()); + MOZ_ASSERT(cx->compartment() == obj->compartment()); /* De-lazification of functions can GC, so we need to do it up here. */ if (obj->is() && obj->as().isInterpretedLazy()) { @@ -4358,7 +4358,7 @@ class NewTypeObjectsSetRef : public BufferableRef return; TypeObjectWithNewScriptSet::Ptr p = set->lookup(TypeObjectWithNewScriptSet::Lookup(clasp, TaggedProto(prior), TaggedProto(proto), newFunction)); - JS_ASSERT(p); // newTypeObjects set must still contain original entry. + MOZ_ASSERT(p); // newTypeObjects set must still contain original entry. set->rekeyAs(TypeObjectWithNewScriptSet::Lookup(clasp, TaggedProto(prior), TaggedProto(proto), newFunction), TypeObjectWithNewScriptSet::Lookup(clasp, TaggedProto(proto), newFunction), *p); @@ -4375,7 +4375,7 @@ TypeObjectTablePostBarrier(ExclusiveContext *cx, TypeObjectWithNewScriptSet *tab return; if (!cx->isJSContext()) { - JS_ASSERT(!IsInsideNursery(proto.toObject())); + MOZ_ASSERT(!IsInsideNursery(proto.toObject())); return; } @@ -4411,8 +4411,8 @@ ExclusiveContext::getNewType(const Class *clasp, TaggedProto proto, JSFunction * newTypeObjects.lookupForAdd(TypeObjectWithNewScriptSet::Lookup(clasp, proto, fun)); if (p) { TypeObject *type = p->object; - JS_ASSERT(type->clasp() == clasp); - JS_ASSERT(type->proto() == proto); + MOZ_ASSERT(type->clasp() == clasp); + MOZ_ASSERT(type->proto() == proto); return type; } @@ -4495,7 +4495,7 @@ ExclusiveContext::getSingletonType(const Class *clasp, TaggedProto proto) TypeObjectWithNewScriptSet::AddPtr p = table.lookupForAdd(TypeObjectWithNewScriptSet::Lookup(clasp, proto, nullptr)); if (p) { TypeObject *type = p->object; - JS_ASSERT(type->lazy()); + MOZ_ASSERT(type->lazy()); return type; } @@ -4702,7 +4702,7 @@ TypeCompartment::sweep(FreeOp *fop) if (arrayTypeTable) { for (ArrayTypeTable::Enum e(*arrayTypeTable); !e.empty(); e.popFront()) { ArrayTableKey key = e.front().key(); - JS_ASSERT(key.type.isUnknown() || !key.type.isSingleObject()); + MOZ_ASSERT(key.type.isUnknown() || !key.type.isSingleObject()); bool remove = false; if (!key.type.isUnknown() && key.type.isTypeObject()) { @@ -4742,14 +4742,14 @@ TypeCompartment::sweep(FreeOp *fop) JSString *str = JSID_TO_STRING(key.properties[i]); if (IsStringAboutToBeFinalized(&str)) remove = true; - JS_ASSERT(AtomToId((JSAtom *)str) == key.properties[i]); + MOZ_ASSERT(AtomToId((JSAtom *)str) == key.properties[i]); } else if (JSID_IS_SYMBOL(key.properties[i])) { JS::Symbol *sym = JSID_TO_SYMBOL(key.properties[i]); if (IsSymbolAboutToBeFinalized(&sym)) remove = true; } - JS_ASSERT(!entry.types[i].isSingleObject()); + MOZ_ASSERT(!entry.types[i].isSingleObject()); TypeObject *typeObject = nullptr; if (entry.types[i].isTypeObject()) { typeObject = entry.types[i].typeObjectNoBarrier(); @@ -4784,7 +4784,7 @@ TypeCompartment::sweep(FreeOp *fop) void JSCompartment::sweepNewTypeObjectTable(TypeObjectWithNewScriptSet &table) { - JS_ASSERT(zone()->isCollecting()); + MOZ_ASSERT(zone()->isCollecting()); if (table.initialized()) { for (TypeObjectWithNewScriptSet::Enum e(table); !e.empty(); e.popFront()) { TypeObjectWithNewScriptEntry entry = e.front(); @@ -4794,8 +4794,8 @@ JSCompartment::sweepNewTypeObjectTable(TypeObjectWithNewScriptSet &table) e.removeFront(); } else { /* Any rekeying necessary is handled by fixupNewTypeObjectTable() below. */ - JS_ASSERT(entry.object == e.front().object); - JS_ASSERT(entry.newFunction == e.front().newFunction); + MOZ_ASSERT(entry.object == e.front().object); + MOZ_ASSERT(entry.newFunction == e.front().newFunction); } } } @@ -4810,7 +4810,7 @@ JSCompartment::fixupNewTypeObjectTable(TypeObjectWithNewScriptSet &table) * Each entry's hash depends on the object's prototype and we can't tell * whether that has been moved or not in sweepNewTypeObjectTable(). */ - JS_ASSERT(zone()->isCollecting()); + MOZ_ASSERT(zone()->isCollecting()); if (table.initialized()) { for (TypeObjectWithNewScriptSet::Enum e(table); !e.empty(); e.popFront()) { TypeObjectWithNewScriptEntry entry = e.front(); @@ -4895,7 +4895,7 @@ JSCompartment::checkTypeObjectTableAfterMovingGC(TypeObjectWithNewScriptSet &tab TypeObjectWithNewScriptEntry::Lookup lookup(entry.object->clasp(), proto, entry.newFunction); TypeObjectWithNewScriptSet::Ptr ptr = table.lookup(lookup); - JS_ASSERT(ptr.found() && &*ptr == &e.front()); + MOZ_ASSERT(ptr.found() && &*ptr == &e.front()); } } @@ -4912,7 +4912,7 @@ TypeCompartment::~TypeCompartment() TypeScript::Sweep(FreeOp *fop, JSScript *script, bool *oom) { JSCompartment *compartment = script->compartment(); - JS_ASSERT(compartment->zone()->isGCSweepingOrCompacting()); + MOZ_ASSERT(compartment->zone()->isGCSweepingOrCompacting()); unsigned num = NumTypeSets(script); StackTypeSet *typeArray = script->types->typeArray(); @@ -4991,7 +4991,7 @@ TypeZone::~TypeZone() void TypeZone::sweep(FreeOp *fop, bool releaseTypes, bool *oom) { - JS_ASSERT(zone()->isGCSweepingOrCompacting()); + MOZ_ASSERT(zone()->isGCSweepingOrCompacting()); JSRuntime *rt = fop->runtime(); @@ -5039,8 +5039,8 @@ TypeZone::sweep(FreeOp *fop, bool releaseTypes, bool *oom) */ script->clearHasFreezeConstraints(); - JS_ASSERT(!script->hasIonScript()); - JS_ASSERT(!script->hasParallelIonScript()); + MOZ_ASSERT(!script->hasIonScript()); + MOZ_ASSERT(!script->hasParallelIonScript()); } else { /* Update the recompile indexes in any IonScripts still on the script. */ if (script->hasIonScript()) @@ -5072,12 +5072,12 @@ TypeZone::sweep(FreeOp *fop, bool releaseTypes, bool *oom) for (size_t i = 0; i < compilerOutputs->length(); i++) { CompilerOutput output = (*compilerOutputs)[i]; if (output.isValid()) { - JS_ASSERT(sweepIndex == output.sweepIndex()); + MOZ_ASSERT(sweepIndex == output.sweepIndex()); output.invalidateSweepIndex(); (*compilerOutputs)[sweepIndex++] = output; } } - JS_ASSERT(sweepIndex == newCompilerOutputCount); + MOZ_ASSERT(sweepIndex == newCompilerOutputCount); JS_ALWAYS_TRUE(compilerOutputs->resize(newCompilerOutputCount)); } @@ -5103,7 +5103,7 @@ TypeZone::clearAllNewScriptsOnOOM() void TypeScript::printTypes(JSContext *cx, HandleScript script) const { - JS_ASSERT(script->types == this); + MOZ_ASSERT(script->types == this); if (!script->hasBaselineScript()) return; diff --git a/js/src/jsinfer.h b/js/src/jsinfer.h index 92fbfc970fd8..cdea64018277 100644 --- a/js/src/jsinfer.h +++ b/js/src/jsinfer.h @@ -47,11 +47,11 @@ class TaggedProto return uintptr_t(proto) > uintptr_t(TaggedProto::LazyProto); } JSObject *toObject() const { - JS_ASSERT(isObject()); + MOZ_ASSERT(isObject()); return proto; } JSObject *toObjectOrNull() const { - JS_ASSERT(!proto || isObject()); + MOZ_ASSERT(!proto || isObject()); return proto; } JSObject *raw() const { return proto; } @@ -233,12 +233,12 @@ class Type } bool isPrimitive(JSValueType type) const { - JS_ASSERT(type < JSVAL_TYPE_OBJECT); + MOZ_ASSERT(type < JSVAL_TYPE_OBJECT); return (uintptr_t) type == data; } JSValueType primitive() const { - JS_ASSERT(isPrimitive()); + MOZ_ASSERT(isPrimitive()); return (JSValueType) data; } @@ -261,7 +261,7 @@ class Type /* Accessors for types that are either JSObject or TypeObject. */ bool isObject() const { - JS_ASSERT(!isAnyObject() && !isUnknown()); + MOZ_ASSERT(!isAnyObject() && !isUnknown()); return data > JSVAL_TYPE_UNKNOWN; } @@ -304,7 +304,7 @@ class Type static inline Type UnknownType() { return Type(JSVAL_TYPE_UNKNOWN); } static inline Type PrimitiveType(JSValueType type) { - JS_ASSERT(type < JSVAL_TYPE_UNKNOWN); + MOZ_ASSERT(type < JSVAL_TYPE_UNKNOWN); return Type(type); } @@ -552,7 +552,7 @@ class TypeSet bool empty() const { return !baseFlags() && !baseObjectCount(); } bool hasAnyFlag(TypeFlags flags) const { - JS_ASSERT((flags & TYPE_FLAG_BASE_MASK) == flags); + MOZ_ASSERT((flags & TYPE_FLAG_BASE_MASK) == flags); return !!(baseFlags() & flags); } @@ -567,7 +567,7 @@ class TypeSet } bool definiteProperty() const { return flags & TYPE_FLAG_DEFINITE_MASK; } unsigned definiteSlot() const { - JS_ASSERT(definiteProperty()); + MOZ_ASSERT(definiteProperty()); return (flags >> TYPE_FLAG_DEFINITE_SHIFT) - 1; } @@ -603,9 +603,9 @@ class TypeSet return (slot + 1) <= (unsigned(TYPE_FLAG_DEFINITE_MASK) >> TYPE_FLAG_DEFINITE_SHIFT); } void setDefinite(unsigned slot) { - JS_ASSERT(canSetDefinite(slot)); + MOZ_ASSERT(canSetDefinite(slot)); flags |= ((slot + 1) << TYPE_FLAG_DEFINITE_SHIFT); - JS_ASSERT(definiteSlot() == slot); + MOZ_ASSERT(definiteSlot() == slot); } /* Whether any values in this set might have the specified type. */ @@ -945,13 +945,13 @@ class TypeNewScript bool analyzed() const { if (preliminaryObjects) { - JS_ASSERT(!templateObject()); - JS_ASSERT(!initializerList); - JS_ASSERT(!initializedShape()); - JS_ASSERT(!initializedType()); + MOZ_ASSERT(!templateObject()); + MOZ_ASSERT(!initializerList); + MOZ_ASSERT(!initializedShape()); + MOZ_ASSERT(!initializedType()); return false; } - JS_ASSERT(templateObject()); + MOZ_ASSERT(templateObject()); return true; } @@ -1027,7 +1027,7 @@ struct TypeObject : public gc::TenuredCell } void setClasp(const Class *clasp) { - JS_ASSERT(singleton()); + MOZ_ASSERT(singleton()); clasp_ = clasp; } @@ -1137,11 +1137,11 @@ struct TypeObject : public gc::TenuredCell inline TypeObject(const Class *clasp, TaggedProto proto, TypeObjectFlags initialFlags); bool hasAnyFlags(TypeObjectFlags flags) { - JS_ASSERT((flags & OBJECT_FLAG_DYNAMIC_MASK) == flags); + MOZ_ASSERT((flags & OBJECT_FLAG_DYNAMIC_MASK) == flags); return !!(this->flags() & flags); } bool hasAllFlags(TypeObjectFlags flags) { - JS_ASSERT((flags & OBJECT_FLAG_DYNAMIC_MASK) == flags); + MOZ_ASSERT((flags & OBJECT_FLAG_DYNAMIC_MASK) == flags); return (this->flags() & flags) == flags; } @@ -1176,7 +1176,7 @@ struct TypeObject : public gc::TenuredCell } void setShouldPreTenure(ExclusiveContext *cx) { - JS_ASSERT(canPreTenure()); + MOZ_ASSERT(canPreTenure()); setFlags(cx, OBJECT_FLAG_PRE_TENURE); } @@ -1447,11 +1447,11 @@ struct TypeObjectKey static TypeObjectKey *getKey(TypeObjectKey *obj) { return obj; } static TypeObjectKey *get(JSObject *obj) { - JS_ASSERT(obj); + MOZ_ASSERT(obj); return (TypeObjectKey *) (uintptr_t(obj) | 1); } static TypeObjectKey *get(TypeObject *obj) { - JS_ASSERT(obj); + MOZ_ASSERT(obj); return (TypeObjectKey *) obj; } @@ -1587,7 +1587,7 @@ class CompilerOutput sweepIndex_ = INVALID_SWEEP_INDEX; } uint32_t sweepIndex() { - JS_ASSERT(sweepIndex_ != INVALID_SWEEP_INDEX); + MOZ_ASSERT(sweepIndex_ != INVALID_SWEEP_INDEX); return sweepIndex_; } }; diff --git a/js/src/jsinferinlines.h b/js/src/jsinferinlines.h index c719e298dc9a..bbe02023dcc5 100644 --- a/js/src/jsinferinlines.h +++ b/js/src/jsinferinlines.h @@ -39,9 +39,9 @@ CompilerOutput::ion() const // Note: If type constraints are generated before compilation has finished // (i.e. after IonBuilder but before CodeGenerator::link) then a valid // CompilerOutput may not yet have an associated IonScript. - JS_ASSERT(isValid()); + MOZ_ASSERT(isValid()); jit::IonScript *ion = jit::GetIonScript(script(), mode()); - JS_ASSERT(ion != ION_COMPILING_SCRIPT); + MOZ_ASSERT(ion != ION_COMPILING_SCRIPT); return ion; } @@ -78,14 +78,14 @@ RecompileInfo::shouldSweep(TypeZone &types) inline TypeObject * TypeObjectKey::asTypeObjectNoBarrier() { - JS_ASSERT(isTypeObject()); + MOZ_ASSERT(isTypeObject()); return (TypeObject *) this; } inline JSObject * TypeObjectKey::asSingleObjectNoBarrier() { - JS_ASSERT(isSingleObject()); + MOZ_ASSERT(isSingleObject()); return (JSObject *) (uintptr_t(this) & ~1); } @@ -206,7 +206,7 @@ TypeFlagPrimitive(TypeFlags flags) inline jsid IdToTypeId(jsid id) { - JS_ASSERT(!JSID_IS_EMPTY(id)); + MOZ_ASSERT(!JSID_IS_EMPTY(id)); // All properties which can be stored in an object's dense elements must // map to the aggregate property for index types. @@ -414,7 +414,7 @@ EnsureTrackPropertyTypes(JSContext *cx, JSObject *obj, jsid id) } } - JS_ASSERT(obj->type()->unknownProperties() || TrackPropertyTypes(cx, obj, id)); + MOZ_ASSERT(obj->type()->unknownProperties() || TrackPropertyTypes(cx, obj, id)); } inline bool @@ -592,7 +592,7 @@ TypeScript::ThisTypes(JSScript *script) /* static */ inline StackTypeSet * TypeScript::ArgTypes(JSScript *script, unsigned i) { - JS_ASSERT(i < script->functionNonDelazifying()->nargs()); + MOZ_ASSERT(i < script->functionNonDelazifying()->nargs()); return script->types->typeArray() + script->nTypeSets() + 1 + i; } @@ -601,7 +601,7 @@ template TypeScript::BytecodeTypes(JSScript *script, jsbytecode *pc, uint32_t *bytecodeMap, uint32_t *hint, TYPESET *typeArray) { - JS_ASSERT(js_CodeSpec[*pc].format & JOF_TYPESET); + MOZ_ASSERT(js_CodeSpec[*pc].format & JOF_TYPESET); uint32_t offset = script->pcToOffset(pc); // See if this pc is the next typeset opcode after the last one looked up. @@ -631,7 +631,7 @@ TypeScript::BytecodeTypes(JSScript *script, jsbytecode *pc, uint32_t *bytecodeMa // We should have have zeroed in on either the exact offset, unless there // are more JOF_TYPESET opcodes than nTypeSets in the script (as can happen // if the script is very long). - JS_ASSERT(bytecodeMap[mid] == offset || mid == top); + MOZ_ASSERT(bytecodeMap[mid] == offset || mid == top); *hint = mid; return typeArray + *hint; @@ -640,7 +640,7 @@ TypeScript::BytecodeTypes(JSScript *script, jsbytecode *pc, uint32_t *bytecodeMa /* static */ inline StackTypeSet * TypeScript::BytecodeTypes(JSScript *script, jsbytecode *pc) { - JS_ASSERT(CurrentThreadCanAccessRuntime(script->runtimeFromMainThread())); + MOZ_ASSERT(CurrentThreadCanAccessRuntime(script->runtimeFromMainThread())); uint32_t *hint = script->baselineScript()->bytecodeTypeMap() + script->nTypeSets(); return BytecodeTypes(script, pc, script->baselineScript()->bytecodeTypeMap(), hint, script->types->typeArray()); @@ -675,7 +675,7 @@ UseNewTypeForInitializer(JSScript *script, jsbytecode *pc, const Class *clasp); /* static */ inline TypeObject * TypeScript::InitObject(JSContext *cx, JSScript *script, jsbytecode *pc, JSProtoKey kind) { - JS_ASSERT(!UseNewTypeForInitializer(script, pc, kind)); + MOZ_ASSERT(!UseNewTypeForInitializer(script, pc, kind)); uint32_t offset = script->pcToOffset(pc); @@ -702,11 +702,11 @@ static inline bool SetInitializerObjectType(JSContext *cx, HandleScript script, jsbytecode *pc, HandleObject obj, NewObjectKind kind) { JSProtoKey key = JSCLASS_CACHED_PROTO_KEY(obj->getClass()); - JS_ASSERT(key != JSProto_Null); - JS_ASSERT(kind == UseNewTypeForInitializer(script, pc, key)); + MOZ_ASSERT(key != JSProto_Null); + MOZ_ASSERT(kind == UseNewTypeForInitializer(script, pc, key)); if (kind == SingletonObject) { - JS_ASSERT(obj->hasSingletonType()); + MOZ_ASSERT(obj->hasSingletonType()); /* * Inference does not account for types of run-once initializer @@ -836,8 +836,8 @@ const unsigned SET_CAPACITY_OVERFLOW = 1u << 30; static inline unsigned HashSetCapacity(unsigned count) { - JS_ASSERT(count >= 2); - JS_ASSERT(count < SET_CAPACITY_OVERFLOW); + MOZ_ASSERT(count >= 2); + MOZ_ASSERT(count < SET_CAPACITY_OVERFLOW); if (count <= SET_ARRAY_SIZE) return SET_ARRAY_SIZE; @@ -887,7 +887,7 @@ HashSetInsertTry(LifoAlloc &alloc, U **&values, unsigned &count, T key) unsigned newCapacity = HashSetCapacity(count); if (newCapacity == capacity) { - JS_ASSERT(!converting); + MOZ_ASSERT(!converting); return &values[insertpos]; } @@ -922,7 +922,7 @@ static inline U ** HashSetInsert(LifoAlloc &alloc, U **&values, unsigned &count, T key) { if (count == 0) { - JS_ASSERT(values == nullptr); + MOZ_ASSERT(values == nullptr); count++; return (U **) &values; } @@ -993,7 +993,7 @@ HashSetLookup(U **values, unsigned count, T key) inline TypeObjectKey * Type::objectKey() const { - JS_ASSERT(isObject()); + MOZ_ASSERT(isObject()); return (TypeObjectKey *) data; } @@ -1043,7 +1043,7 @@ TypeSet::hasType(Type type) const inline void TypeSet::setBaseObjectCount(uint32_t count) { - JS_ASSERT(count <= TYPE_FLAG_OBJECT_COUNT_LIMIT); + MOZ_ASSERT(count <= TYPE_FLAG_OBJECT_COUNT_LIMIT); flags = (flags & ~TYPE_FLAG_OBJECT_COUNT_MASK) | (count << TYPE_FLAG_OBJECT_COUNT_SHIFT); } @@ -1059,7 +1059,7 @@ HeapTypeSet::newPropertyState(ExclusiveContext *cxArg) constraint = constraint->next; } } else { - JS_ASSERT(!constraintList); + MOZ_ASSERT(!constraintList); } } @@ -1102,7 +1102,7 @@ HeapTypeSet::setNonConstantProperty(ExclusiveContext *cx) inline unsigned TypeSet::getObjectCount() const { - JS_ASSERT(!unknownObject()); + MOZ_ASSERT(!unknownObject()); uint32_t count = baseObjectCount(); if (count > SET_ARRAY_SIZE) return HashSetCapacity(count); @@ -1112,9 +1112,9 @@ TypeSet::getObjectCount() const inline TypeObjectKey * TypeSet::getObject(unsigned i) const { - JS_ASSERT(i < getObjectCount()); + MOZ_ASSERT(i < getObjectCount()); if (baseObjectCount() == 1) { - JS_ASSERT(i == 0); + MOZ_ASSERT(i == 0); return (TypeObjectKey *) objectSet; } return objectSet[i]; @@ -1186,7 +1186,7 @@ inline void TypeObject::setBasePropertyCount(uint32_t count) { // Note: Callers must ensure they are performing threadsafe operations. - JS_ASSERT(count <= OBJECT_FLAG_PROPERTY_COUNT_LIMIT); + MOZ_ASSERT(count <= OBJECT_FLAG_PROPERTY_COUNT_LIMIT); flags_ = (flags() & ~OBJECT_FLAG_PROPERTY_COUNT_MASK) | (count << OBJECT_FLAG_PROPERTY_COUNT_SHIFT); } @@ -1194,11 +1194,11 @@ TypeObject::setBasePropertyCount(uint32_t count) inline HeapTypeSet * TypeObject::getProperty(ExclusiveContext *cx, jsid id) { - JS_ASSERT(cx->compartment()->activeAnalysis); + MOZ_ASSERT(cx->compartment()->activeAnalysis); - JS_ASSERT(JSID_IS_VOID(id) || JSID_IS_EMPTY(id) || JSID_IS_STRING(id) || JSID_IS_SYMBOL(id)); + MOZ_ASSERT(JSID_IS_VOID(id) || JSID_IS_EMPTY(id) || JSID_IS_STRING(id) || JSID_IS_SYMBOL(id)); JS_ASSERT_IF(!JSID_IS_EMPTY(id), id == IdToTypeId(id)); - JS_ASSERT(!unknownProperties()); + MOZ_ASSERT(!unknownProperties()); if (HeapTypeSet *types = maybeGetProperty(id)) return types; @@ -1217,7 +1217,7 @@ TypeObject::getProperty(ExclusiveContext *cx, jsid id) return nullptr; } - JS_ASSERT(!*pprop); + MOZ_ASSERT(!*pprop); setBasePropertyCount(propertyCount); *pprop = base; @@ -1237,9 +1237,9 @@ TypeObject::getProperty(ExclusiveContext *cx, jsid id) inline HeapTypeSet * TypeObject::maybeGetProperty(jsid id) { - JS_ASSERT(JSID_IS_VOID(id) || JSID_IS_EMPTY(id) || JSID_IS_STRING(id) || JSID_IS_SYMBOL(id)); + MOZ_ASSERT(JSID_IS_VOID(id) || JSID_IS_EMPTY(id) || JSID_IS_STRING(id) || JSID_IS_SYMBOL(id)); JS_ASSERT_IF(!JSID_IS_EMPTY(id), id == IdToTypeId(id)); - JS_ASSERT(!unknownProperties()); + MOZ_ASSERT(!unknownProperties()); Property *prop = HashSetLookup (propertySet, basePropertyCount(), id); @@ -1259,9 +1259,9 @@ TypeObject::getPropertyCount() inline Property * TypeObject::getProperty(unsigned i) { - JS_ASSERT(i < getPropertyCount()); + MOZ_ASSERT(i < getPropertyCount()); if (basePropertyCount() == 1) { - JS_ASSERT(i == 0); + MOZ_ASSERT(i == 0); return (Property *) propertySet; } return propertySet[i]; diff --git a/js/src/jsiter.cpp b/js/src/jsiter.cpp index 5d39e9d11a27..df8439c29bb8 100644 --- a/js/src/jsiter.cpp +++ b/js/src/jsiter.cpp @@ -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(); } @@ -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(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()) { @@ -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()); + MOZ_ASSERT(iterator->isNative()); + MOZ_ASSERT(iterator->is()); if (index >= iterator->as().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 static void FinalizeGenerator(FreeOp *fop, JSObject *obj) { - JS_ASSERT(obj->is()); + MOZ_ASSERT(obj->is()); JSGenerator *gen = obj->as().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 static void TraceGenerator(JSTracer *trc, JSObject *obj) { - JS_ASSERT(obj->is()); + MOZ_ASSERT(obj->is()); JSGenerator *gen = obj->as().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 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()); + MOZ_ASSERT(obj->is()); JSGenerator *gen = obj->as().getGenerator(); diff --git a/js/src/jsiter.h b/js/src/jsiter.h index ca47461db620..bec133cfe846 100644 --- a/js/src/jsiter.h +++ b/js/src/jsiter.h @@ -65,7 +65,7 @@ struct NativeIterator return iterObj_; } HeapPtrFlatString *current() const { - JS_ASSERT(props_cursor < props_end); + MOZ_ASSERT(props_cursor < props_end); return props_cursor; } @@ -85,8 +85,8 @@ struct NativeIterator } void link(NativeIterator *other) { /* A NativeIterator cannot appear in the enumerator list twice. */ - JS_ASSERT(!next_ && !prev_); - JS_ASSERT(flags & JSITER_ENUMERATE); + MOZ_ASSERT(!next_ && !prev_); + MOZ_ASSERT(flags & JSITER_ENUMERATE); this->next_ = other; this->prev_ = other->prev_; @@ -94,7 +94,7 @@ struct NativeIterator other->prev_ = this; } void unlink() { - JS_ASSERT(flags & JSITER_ENUMERATE); + MOZ_ASSERT(flags & JSITER_ENUMERATE); next_->prev_ = prev_; prev_->next_ = next_; diff --git a/js/src/jsmath.cpp b/js/src/jsmath.cpp index 42163d1dfbea..05ca2a2e8422 100644 --- a/js/src/jsmath.cpp +++ b/js/src/jsmath.cpp @@ -65,9 +65,9 @@ MathCache::MathCache() { memset(table, 0, sizeof(table)); /* See comments in lookup(). */ - JS_ASSERT(IsNegativeZero(-0.0)); - JS_ASSERT(!IsNegativeZero(+0.0)); - JS_ASSERT(hash(-0.0, MathCache::Sin) != hash(+0.0, MathCache::Sin)); + MOZ_ASSERT(IsNegativeZero(-0.0)); + MOZ_ASSERT(!IsNegativeZero(+0.0)); + MOZ_ASSERT(hash(-0.0, MathCache::Sin) != hash(+0.0, MathCache::Sin)); } size_t diff --git a/js/src/jsnativestack.cpp b/js/src/jsnativestack.cpp index d6f649d18e54..e9ec0796bc9b 100644 --- a/js/src/jsnativestack.cpp +++ b/js/src/jsnativestack.cpp @@ -148,7 +148,7 @@ js::GetNativeStackBaseImpl() # endif if (rc) MOZ_CRASH(); - JS_ASSERT(stackBase); + MOZ_ASSERT(stackBase); pthread_attr_destroy(&sattr); # if JS_STACK_GROWTH_DIRECTION > 0 diff --git a/js/src/jsnativestack.h b/js/src/jsnativestack.h index 654f6454e159..86abcd08ac5c 100644 --- a/js/src/jsnativestack.h +++ b/js/src/jsnativestack.h @@ -18,7 +18,7 @@ inline uintptr_t GetNativeStackBase() { uintptr_t stackBase = reinterpret_cast(GetNativeStackBaseImpl()); - JS_ASSERT(stackBase % sizeof(void *) == 0); + MOZ_ASSERT(stackBase % sizeof(void *) == 0); return stackBase; } diff --git a/js/src/jsnum.cpp b/js/src/jsnum.cpp index 52cc9fce03d3..6bdfefc85ad8 100644 --- a/js/src/jsnum.cpp +++ b/js/src/jsnum.cpp @@ -68,7 +68,7 @@ ComputeAccurateDecimalInteger(ThreadSafeContext *cx, const CharT *start, const C for (size_t i = 0; i < length; i++) { char c = char(start[i]); - JS_ASSERT(('0' <= c && c <= '9') || ('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z')); + MOZ_ASSERT(('0' <= c && c <= '9') || ('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z')); cstr[i] = c; } cstr[length] = 0; @@ -108,7 +108,7 @@ class BinaryDigitReader return -1; int c = *start++; - JS_ASSERT(('0' <= c && c <= '9') || ('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z')); + MOZ_ASSERT(('0' <= c && c <= '9') || ('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z')); if ('0' <= c && c <= '9') digit = c - '0'; else if ('a' <= c && c <= 'z') @@ -147,7 +147,7 @@ ComputeAccurateBinaryBaseInteger(const CharT *start, const CharT *end, int base) bit = bdr.nextDigit(); } while (bit == 0); - JS_ASSERT(bit == 1); // guaranteed by Get{Prefix,Decimal}Integer + MOZ_ASSERT(bit == 1); // guaranteed by Get{Prefix,Decimal}Integer /* Gather the 53 significant bits (including the leading 1). */ double value = 1.0; @@ -206,8 +206,8 @@ bool js::GetPrefixInteger(ThreadSafeContext *cx, const CharT *start, const CharT *end, int base, const CharT **endp, double *dp) { - JS_ASSERT(start <= end); - JS_ASSERT(2 <= base && base <= 36); + MOZ_ASSERT(start <= end); + MOZ_ASSERT(2 <= base && base <= 36); const CharT *s = start; double d = 0.0; @@ -259,13 +259,13 @@ js::GetPrefixInteger(ThreadSafeContext *cx, const Latin1Char *start, const Latin bool js::GetDecimalInteger(ExclusiveContext *cx, const char16_t *start, const char16_t *end, double *dp) { - JS_ASSERT(start <= end); + MOZ_ASSERT(start <= end); const char16_t *s = start; double d = 0.0; for (; s < end; s++) { char16_t c = *s; - JS_ASSERT('0' <= c && c <= '9'); + MOZ_ASSERT('0' <= c && c <= '9'); int digit = c - '0'; d = d * 10 + digit; } @@ -672,7 +672,7 @@ Int32ToCString(ToCStringBuf *cbuf, int32_t i, size_t *len, int base = 10) } while (u != 0); break; default: - JS_ASSERT(base >= 2 && base <= 36); + MOZ_ASSERT(base >= 2 && base <= 36); do { unsigned newu = u / base; *--cp = "0123456789abcdefghijklmnopqrstuvwxyz"[u - newu * base]; @@ -694,7 +694,7 @@ js_NumberToStringWithBase(ThreadSafeContext *cx, double d, int base); MOZ_ALWAYS_INLINE bool num_toString_impl(JSContext *cx, CallArgs args) { - JS_ASSERT(IsNumber(args.thisv())); + MOZ_ASSERT(IsNumber(args.thisv())); double d = Extract(args.thisv()); @@ -731,7 +731,7 @@ js_num_toString(JSContext *cx, unsigned argc, Value *vp) MOZ_ALWAYS_INLINE bool num_toLocaleString_impl(JSContext *cx, CallArgs args) { - JS_ASSERT(IsNumber(args.thisv())); + MOZ_ASSERT(IsNumber(args.thisv())); double d = Extract(args.thisv()); @@ -810,14 +810,14 @@ num_toLocaleString_impl(JSContext *cx, CallArgs args) const char *tmpSrc = num; while (*tmpSrc == '-' || remainder--) { - JS_ASSERT(tmpDest - buf < buflen); + MOZ_ASSERT(tmpDest - buf < buflen); *tmpDest++ = *tmpSrc++; } while (tmpSrc < end) { - JS_ASSERT(tmpDest - buf + ptrdiff_t(thousandsLength) <= buflen); + MOZ_ASSERT(tmpDest - buf + ptrdiff_t(thousandsLength) <= buflen); strcpy(tmpDest, rt->thousandsSeparator); tmpDest += thousandsLength; - JS_ASSERT(tmpDest - buf + *tmpGroup <= buflen); + MOZ_ASSERT(tmpDest - buf + *tmpGroup <= buflen); js_memcpy(tmpDest, tmpSrc, *tmpGroup); tmpDest += *tmpGroup; tmpSrc += *tmpGroup; @@ -826,13 +826,13 @@ num_toLocaleString_impl(JSContext *cx, CallArgs args) } if (*nint == '.') { - JS_ASSERT(tmpDest - buf + ptrdiff_t(decimalLength) <= buflen); + MOZ_ASSERT(tmpDest - buf + ptrdiff_t(decimalLength) <= buflen); strcpy(tmpDest, rt->decimalSeparator); tmpDest += decimalLength; - JS_ASSERT(tmpDest - buf + ptrdiff_t(strlen(nint + 1)) <= buflen); + MOZ_ASSERT(tmpDest - buf + ptrdiff_t(strlen(nint + 1)) <= buflen); strcpy(tmpDest, nint + 1); } else { - JS_ASSERT(tmpDest - buf + ptrdiff_t(strlen(nint)) <= buflen); + MOZ_ASSERT(tmpDest - buf + ptrdiff_t(strlen(nint)) <= buflen); strcpy(tmpDest, nint); } @@ -865,7 +865,7 @@ num_toLocaleString(JSContext *cx, unsigned argc, Value *vp) MOZ_ALWAYS_INLINE bool num_valueOf_impl(JSContext *cx, CallArgs args) { - JS_ASSERT(IsNumber(args.thisv())); + MOZ_ASSERT(IsNumber(args.thisv())); args.rval().setNumber(Extract(args.thisv())); return true; } @@ -920,7 +920,7 @@ DToStrResult(JSContext *cx, double d, JSDToStrMode mode, int precision, CallArgs MOZ_ALWAYS_INLINE bool num_toFixed_impl(JSContext *cx, CallArgs args) { - JS_ASSERT(IsNumber(args.thisv())); + MOZ_ASSERT(IsNumber(args.thisv())); int precision; if (args.length() == 0) { @@ -943,7 +943,7 @@ num_toFixed(JSContext *cx, unsigned argc, Value *vp) MOZ_ALWAYS_INLINE bool num_toExponential_impl(JSContext *cx, CallArgs args) { - JS_ASSERT(IsNumber(args.thisv())); + MOZ_ASSERT(IsNumber(args.thisv())); JSDToStrMode mode; int precision; @@ -969,7 +969,7 @@ num_toExponential(JSContext *cx, unsigned argc, Value *vp) MOZ_ALWAYS_INLINE bool num_toPrecision_impl(JSContext *cx, CallArgs args) { - JS_ASSERT(IsNumber(args.thisv())); + MOZ_ASSERT(IsNumber(args.thisv())); double d = Extract(args.thisv()); @@ -1175,7 +1175,7 @@ js::FinishRuntimeNumberState(JSRuntime *rt) JSObject * js_InitNumberClass(JSContext *cx, HandleObject obj) { - JS_ASSERT(obj->isNative()); + MOZ_ASSERT(obj->isNative()); /* XXX must do at least once per new thread, so do it per JSContext... */ FIX_FPU(); @@ -1234,7 +1234,7 @@ FracNumberToCString(ThreadSafeContext *cx, ToCStringBuf *cbuf, double d, int bas #ifdef DEBUG { int32_t _; - JS_ASSERT(!mozilla::NumberIsInt32(d, &_)); + MOZ_ASSERT(!mozilla::NumberIsInt32(d, &_)); } #endif @@ -1295,7 +1295,7 @@ js_NumberToStringWithBase(ThreadSafeContext *cx, double d, int base) if (i < 10) return cx->staticStrings().getInt(i); char16_t c = 'a' + i - 10; - JS_ASSERT(StaticStrings::hasUnit(c)); + MOZ_ASSERT(StaticStrings::hasUnit(c)); return cx->staticStrings().getUnit(c); } @@ -1306,7 +1306,7 @@ js_NumberToStringWithBase(ThreadSafeContext *cx, double d, int base) size_t len; numStr = Int32ToCString(&cbuf, i, &len, base); - JS_ASSERT(!cbuf.dbuf && numStr >= cbuf.sbuf && numStr < cbuf.sbuf + cbuf.sbufSize); + MOZ_ASSERT(!cbuf.dbuf && numStr >= cbuf.sbuf && numStr < cbuf.sbuf + cbuf.sbufSize); } else { if (comp) { if (JSFlatString *str = comp->dtoaCache.lookup(base, d)) @@ -1361,7 +1361,7 @@ js::NumberToAtom(ExclusiveContext *cx, double d) js_ReportOutOfMemory(cx); return nullptr; } - JS_ASSERT(!cbuf.dbuf && numStr >= cbuf.sbuf && numStr < cbuf.sbuf + cbuf.sbufSize); + MOZ_ASSERT(!cbuf.dbuf && numStr >= cbuf.sbuf && numStr < cbuf.sbuf + cbuf.sbufSize); size_t length = strlen(numStr); JSAtom *atom = Atomize(cx, numStr, length); @@ -1415,7 +1415,7 @@ js::NumberValueToStringBuffer(JSContext *cx, const Value &v, StringBuffer &sb) size_t cstrlen; if (v.isInt32()) { cstr = Int32ToCString(&cbuf, v.toInt32(), &cstrlen); - JS_ASSERT(cstrlen == strlen(cstr)); + MOZ_ASSERT(cstrlen == strlen(cstr)); } else { cstr = NumberToCString(cx, &cbuf, v.toDouble()); if (!cstr) { @@ -1429,7 +1429,7 @@ js::NumberValueToStringBuffer(JSContext *cx, const Value &v, StringBuffer &sb) * Inflate to char16_t string. The input C-string characters are < 127, so * even if char16_t units are UTF-8, all chars should map to one char16_t. */ - JS_ASSERT(!cbuf.dbuf && cstrlen < cbuf.sbufSize); + MOZ_ASSERT(!cbuf.dbuf && cstrlen < cbuf.sbufSize); return sb.append(cstr, cstrlen); } @@ -1509,8 +1509,8 @@ js::StringToNumber(ThreadSafeContext *cx, JSString *str, double *result) bool js::NonObjectToNumberSlow(ThreadSafeContext *cx, Value v, double *out) { - JS_ASSERT(!v.isNumber()); - JS_ASSERT(!v.isObject()); + MOZ_ASSERT(!v.isNumber()); + MOZ_ASSERT(!v.isObject()); if (v.isString()) return StringToNumber(cx, v.toString(), out); @@ -1527,7 +1527,7 @@ js::NonObjectToNumberSlow(ThreadSafeContext *cx, Value v, double *out) return false; } - JS_ASSERT(v.isUndefined()); + MOZ_ASSERT(v.isUndefined()); *out = GenericNaN(); return true; } @@ -1535,7 +1535,7 @@ js::NonObjectToNumberSlow(ThreadSafeContext *cx, Value v, double *out) bool js::ToNumberSlow(ExclusiveContext *cx, Value v, double *out) { - JS_ASSERT(!v.isNumber()); + MOZ_ASSERT(!v.isNumber()); goto skip_int_double; for (;;) { if (v.isNumber()) { @@ -1575,7 +1575,7 @@ js::ToNumberSlow(JSContext *cx, Value v, double *out) JS_PUBLIC_API(bool) js::ToInt64Slow(JSContext *cx, const HandleValue v, int64_t *out) { - JS_ASSERT(!v.isInt32()); + MOZ_ASSERT(!v.isInt32()); double d; if (v.isDouble()) { d = v.toDouble(); @@ -1594,7 +1594,7 @@ js::ToInt64Slow(JSContext *cx, const HandleValue v, int64_t *out) JS_PUBLIC_API(bool) js::ToUint64Slow(JSContext *cx, const HandleValue v, uint64_t *out) { - JS_ASSERT(!v.isInt32()); + MOZ_ASSERT(!v.isInt32()); double d; if (v.isDouble()) { d = v.toDouble(); @@ -1612,7 +1612,7 @@ template self(cx, cx->global()); - JS_ASSERT(!cx->runtime()->isAtomsCompartment(cx->compartment())); - JS_ASSERT(self->isNative()); + MOZ_ASSERT(!cx->runtime()->isAtomsCompartment(cx->compartment())); + MOZ_ASSERT(self->isNative()); /* * Create |Object.prototype| first, mirroring CreateBlankProto but for the @@ -597,7 +597,7 @@ PropDesc::complete() bool js::Throw(JSContext *cx, jsid id, unsigned errorNumber) { - JS_ASSERT(js_ErrorFormatString[errorNumber].argCount == 1); + MOZ_ASSERT(js_ErrorFormatString[errorNumber].argCount == 1); JSString *idstr = IdToString(cx, id); if (!idstr) @@ -618,7 +618,7 @@ js::Throw(JSContext *cx, JSObject *obj, unsigned errorNumber) JSDVG_IGNORE_STACK, val, NullPtr(), nullptr, nullptr); } else { - JS_ASSERT(js_ErrorFormatString[errorNumber].argCount == 0); + MOZ_ASSERT(js_ErrorFormatString[errorNumber].argCount == 0); JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, errorNumber); } return false; @@ -763,11 +763,11 @@ DefinePropertyOnObject(JSContext *cx, HandleObject obj, HandleId id, const PropD /* 8.12.9 step 1. */ RootedShape shape(cx); RootedObject obj2(cx); - JS_ASSERT(!obj->getOps()->lookupGeneric); + MOZ_ASSERT(!obj->getOps()->lookupGeneric); if (!HasOwnProperty(cx, nullptr, obj, id, &obj2, &shape)) return false; - JS_ASSERT(!obj->getOps()->defineProperty); + MOZ_ASSERT(!obj->getOps()->defineProperty); /* 8.12.9 steps 2-4. */ if (!shape) { @@ -780,14 +780,14 @@ DefinePropertyOnObject(JSContext *cx, HandleObject obj, HandleId id, const PropD *rval = true; if (desc.isGenericDescriptor() || desc.isDataDescriptor()) { - JS_ASSERT(!obj->getOps()->defineProperty); + MOZ_ASSERT(!obj->getOps()->defineProperty); RootedValue v(cx, desc.hasValue() ? desc.value() : UndefinedValue()); return baseops::DefineGeneric(cx, obj, id, v, JS_PropertyStub, JS_StrictPropertyStub, desc.attributes()); } - JS_ASSERT(desc.isAccessorDescriptor()); + MOZ_ASSERT(desc.isAccessorDescriptor()); return baseops::DefineGeneric(cx, obj, id, UndefinedHandleValue, desc.getter(), desc.setter(), desc.attributes()); @@ -796,7 +796,7 @@ DefinePropertyOnObject(JSContext *cx, HandleObject obj, HandleId id, const PropD /* 8.12.9 steps 5-6 (note 5 is merely a special case of 6). */ RootedValue v(cx); - JS_ASSERT(obj == obj2); + MOZ_ASSERT(obj == obj2); bool shapeDataDescriptor = true, shapeAccessorDescriptor = false, @@ -911,7 +911,7 @@ DefinePropertyOnObject(JSContext *cx, HandleObject obj, HandleId id, const PropD break; } else { /* The only fields in desc will be handled below. */ - JS_ASSERT(desc.isGenericDescriptor()); + MOZ_ASSERT(desc.isGenericDescriptor()); } } @@ -943,7 +943,7 @@ DefinePropertyOnObject(JSContext *cx, HandleObject obj, HandleId id, const PropD return Reject(cx, JSMSG_CANT_REDEFINE_PROP, throwError, id, rval); } else if (desc.isDataDescriptor()) { /* 8.12.9 step 10. */ - JS_ASSERT(shapeDataDescriptor); + MOZ_ASSERT(shapeDataDescriptor); if (!shapeConfigurable && !shape->writable()) { if (desc.hasWritable() && desc.writable()) return Reject(cx, JSMSG_CANT_REDEFINE_PROP, throwError, id, rval); @@ -959,7 +959,7 @@ DefinePropertyOnObject(JSContext *cx, HandleObject obj, HandleId id, const PropD callDelProperty = !shapeHasDefaultGetter || !shapeHasDefaultSetter; } else { /* 8.12.9 step 11. */ - JS_ASSERT(desc.isAccessorDescriptor() && shape->isAccessorDescriptor()); + MOZ_ASSERT(desc.isAccessorDescriptor() && shape->isAccessorDescriptor()); if (!shape->configurable()) { if (desc.hasSet()) { bool same; @@ -1009,7 +1009,7 @@ DefinePropertyOnObject(JSContext *cx, HandleObject obj, HandleId id, const PropD getter = JS_PropertyStub; setter = JS_StrictPropertyStub; } else { - JS_ASSERT(desc.isAccessorDescriptor()); + MOZ_ASSERT(desc.isAccessorDescriptor()); /* 8.12.9 step 12. */ unsigned changed = 0; @@ -1268,7 +1268,7 @@ JSObject::getSealedOrFrozenAttributes(unsigned attrs, ImmutabilityType it) JSObject::sealOrFreeze(JSContext *cx, HandleObject obj, ImmutabilityType it) { assertSameCompartment(cx, obj); - JS_ASSERT(it == SEAL || it == FREEZE); + MOZ_ASSERT(it == SEAL || it == FREEZE); if (!JSObject::preventExtensions(cx, obj)) return false; @@ -1318,7 +1318,7 @@ JSObject::sealOrFreeze(JSContext *cx, HandleObject obj, ImmutabilityType it) return false; } - JS_ASSERT(obj->lastProperty()->slotSpan() == last->slotSpan()); + MOZ_ASSERT(obj->lastProperty()->slotSpan() == last->slotSpan()); JS_ALWAYS_TRUE(setLastProperty(cx, obj, last)); } else { RootedId id(cx); @@ -1444,7 +1444,7 @@ NewObject(ExclusiveContext *cx, types::TypeObject *type_, JSObject *parent, gc:: { const Class *clasp = type_->clasp(); - JS_ASSERT(clasp != &ArrayObject::class_); + MOZ_ASSERT(clasp != &ArrayObject::class_); JS_ASSERT_IF(clasp == &JSFunction::class_, kind == JSFunction::FinalizeKind || kind == JSFunction::ExtendedFinalizeKind); JS_ASSERT_IF(parent, &parent->global() == cx->global()); @@ -1515,7 +1515,7 @@ NewObjectCache::fillProto(EntryIndex entry, const Class *clasp, js::TaggedProto gc::AllocKind kind, JSObject *obj) { JS_ASSERT_IF(proto.isObject(), !proto.toObject()->is()); - JS_ASSERT(obj->getTaggedProto() == proto); + MOZ_ASSERT(obj->getTaggedProto() == proto); return fill(entry, clasp, proto.raw(), kind, obj); } @@ -1546,7 +1546,7 @@ js::NewObjectWithGivenProto(ExclusiveContext *cxArg, const js::Class *clasp, Rooted proto(cxArg, protoArg); RootedObject parent(cxArg, parentArg); obj = cache.newObjectFromHit(cx, entry, GetInitialHeap(newKind, clasp)); - JS_ASSERT(!obj); + MOZ_ASSERT(!obj); parentArg = parent; protoArg = proto; } @@ -1635,7 +1635,7 @@ js::NewObjectWithClassProtoCommon(ExclusiveContext *cxArg, RootedObject parent(cxArg, parentArg); RootedObject proto(cxArg, protoArg); obj = cache.newObjectFromHit(cx, entry, GetInitialHeap(newKind, clasp)); - JS_ASSERT(!obj); + MOZ_ASSERT(!obj); protoArg = proto; parentArg = parent; } @@ -1675,9 +1675,9 @@ JSObject * js::NewObjectWithType(JSContext *cx, HandleTypeObject type, JSObject *parent, gc::AllocKind allocKind, NewObjectKind newKind) { - JS_ASSERT(parent); + MOZ_ASSERT(parent); - JS_ASSERT(allocKind <= gc::FINALIZE_OBJECT_LAST); + MOZ_ASSERT(allocKind <= gc::FINALIZE_OBJECT_LAST); if (CanBeFinalizedInBackground(allocKind, type->clasp())) allocKind = GetBackgroundAllocKind(allocKind); @@ -1755,7 +1755,7 @@ CreateThisForFunctionWithType(JSContext *cx, HandleTypeObject type, JSObject *pa // type, so get the shape and finalize kind to use from the // TypeNewScript's template. RootedObject templateObject(cx, newScript->templateObject()); - JS_ASSERT(templateObject->type() == type); + MOZ_ASSERT(templateObject->type() == type); RootedObject res(cx, CopyInitializerObject(cx, templateObject, newKind)); if (!res) @@ -1813,7 +1813,7 @@ js::CreateThisForFunctionWithProto(JSContext *cx, HandleObject callee, JSObject // The script was analyzed successfully and may have changed // the new type table, so refetch the type. type = cx->getNewType(&JSObject::class_, TaggedProto(proto), &callee->as()); - JS_ASSERT(type && type->newScript()); + MOZ_ASSERT(type && type->newScript()); } } @@ -1869,7 +1869,7 @@ js::CreateThisForFunction(JSContext *cx, HandleObject callee, NewObjectKind newK static bool Detecting(JSContext *cx, JSScript *script, jsbytecode *pc) { - JS_ASSERT(script->containsPC(pc)); + MOZ_ASSERT(script->containsPC(pc)); /* General case: a branch or equality op follows the access. */ JSOp op = JSOp(*pc); @@ -1982,8 +1982,8 @@ JS_CopyPropertiesFrom(JSContext *cx, HandleObject target, HandleObject obj) static bool CopySlots(JSContext *cx, HandleObject from, HandleObject to) { - JS_ASSERT(!from->isNative() && !to->isNative()); - JS_ASSERT(from->getClass() == to->getClass()); + MOZ_ASSERT(!from->isNative() && !to->isNative()); + MOZ_ASSERT(from->getClass() == to->getClass()); size_t n = 0; if (from->is() && @@ -2027,7 +2027,7 @@ js::CloneObject(JSContext *cx, HandleObject obj, Handle proto, if (obj->hasPrivate()) clone->setPrivate(obj->getPrivate()); } else { - JS_ASSERT(obj->is()); + MOZ_ASSERT(obj->is()); if (!CopySlots(cx, obj, clone)) return nullptr; } @@ -2041,7 +2041,7 @@ js::DeepCloneObjectLiteral(JSContext *cx, HandleObject obj, NewObjectKind newKin /* NB: Keep this in sync with XDRObjectLiteral. */ JS_ASSERT_IF(obj->hasSingletonType(), JS::CompartmentOptionsRef(cx).getSingletonsAsTemplates()); - JS_ASSERT(obj->is() || obj->is()); + MOZ_ASSERT(obj->is() || obj->is()); // Result of the clone function. RootedObject clone(cx); @@ -2054,7 +2054,7 @@ js::DeepCloneObjectLiteral(JSContext *cx, HandleObject obj, NewObjectKind newKin clone = NewDenseUnallocatedArray(cx, obj->as().length(), nullptr, newKind); } else { // Object literals are tenured by default as holded by the JSScript. - JS_ASSERT(obj->isTenured()); + MOZ_ASSERT(obj->isTenured()); AllocKind kind = obj->asTenured()->getAllocKind(); Rooted typeObj(cx, obj->getType(cx)); if (!typeObj) @@ -2088,8 +2088,8 @@ js::DeepCloneObjectLiteral(JSContext *cx, HandleObject obj, NewObjectKind newKin clone->initDenseElement(i, v); } - JS_ASSERT(obj->compartment() == clone->compartment()); - JS_ASSERT(!obj->hasPrivate()); + MOZ_ASSERT(obj->compartment() == clone->compartment()); + MOZ_ASSERT(!obj->hasPrivate()); RootedShape shape(cx, obj->lastProperty()); size_t span = shape->slotSpan(); clone->setLastProperty(cx, clone, shape); @@ -2136,7 +2136,7 @@ js::XDRObjectLiteral(XDRState *xdr, MutableHandleObject obj) uint32_t isArray = 0; { if (mode == XDR_ENCODE) { - JS_ASSERT(obj->is() || obj->is()); + MOZ_ASSERT(obj->is() || obj->is()); isArray = obj->getClass() == &ArrayObject::class_ ? 1 : 0; } @@ -2161,8 +2161,8 @@ js::XDRObjectLiteral(XDRState *xdr, MutableHandleObject obj) AllocKind kind; { if (mode == XDR_ENCODE) { - JS_ASSERT(obj->getClass() == &JSObject::class_); - JS_ASSERT(obj->isTenured()); + MOZ_ASSERT(obj->getClass() == &JSObject::class_); + MOZ_ASSERT(obj->isTenured()); kind = obj->asTenured()->getAllocKind(); } @@ -2216,7 +2216,7 @@ js::XDRObjectLiteral(XDRState *xdr, MutableHandleObject obj) } } - JS_ASSERT(!obj->hasPrivate()); + MOZ_ASSERT(!obj->hasPrivate()); RootedShape shape(cx, obj->lastProperty()); // Code the number of slots in the vector. @@ -2240,11 +2240,11 @@ js::XDRObjectLiteral(XDRState *xdr, MutableHandleObject obj) // If we have reached the native property of the array class, we // exit as the remaining would only be reserved slots. if (!it.front().hasSlot()) { - JS_ASSERT(isArray); + MOZ_ASSERT(isArray); break; } - JS_ASSERT(it.front().hasDefaultGetter()); + MOZ_ASSERT(it.front().hasDefaultGetter()); ids[it.front().slot()].set(it.front().propid()); } } @@ -2279,7 +2279,7 @@ js::XDRObjectLiteral(XDRState *xdr, MutableHandleObject obj) if (mode == XDR_DECODE) id = AtomToId(atom); } else { - JS_ASSERT(idType == JSID_TYPE_INT); + MOZ_ASSERT(idType == JSID_TYPE_INT); uint32_t indexVal; if (mode == XDR_ENCODE) indexVal = uint32_t(JSID_TO_INT(id)); @@ -2374,9 +2374,9 @@ js::CloneObjectLiteral(JSContext *cx, HandleObject parent, HandleObject srcObj) return NewReshapedObject(cx, typeObj, parent, kind, shape); } - JS_ASSERT(srcObj->is()); - JS_ASSERT(srcObj->denseElementsAreCopyOnWrite()); - JS_ASSERT(srcObj->getElementsHeader()->ownerObject() == srcObj); + MOZ_ASSERT(srcObj->is()); + MOZ_ASSERT(srcObj->denseElementsAreCopyOnWrite()); + MOZ_ASSERT(srcObj->getElementsHeader()->ownerObject() == srcObj); size_t length = srcObj->as().length(); RootedObject res(cx, NewDenseFullyAllocatedArray(cx, length, nullptr, MaybeSingletonObject)); @@ -2440,7 +2440,7 @@ JSObject::ReserveForTradeGuts(JSContext *cx, JSObject *aArg, JSObject *bArg, RootedObject a(cx, aArg); RootedObject b(cx, bArg); - JS_ASSERT(a->compartment() == b->compartment()); + MOZ_ASSERT(a->compartment() == b->compartment()); AutoCompartment ac(cx, a); /* @@ -2515,8 +2515,8 @@ JSObject::ReserveForTradeGuts(JSContext *cx, JSObject *aArg, JSObject *bArg, reserved.newafixed--; } - JS_ASSERT(reserved.newafixed >= 0); - JS_ASSERT(reserved.newbfixed >= 0); + MOZ_ASSERT(reserved.newafixed >= 0); + MOZ_ASSERT(reserved.newbfixed >= 0); /* * The newaslots/newbslots arrays hold any dynamic slots for the objects @@ -2546,15 +2546,15 @@ JSObject::ReserveForTradeGuts(JSContext *cx, JSObject *aArg, JSObject *bArg, void JSObject::TradeGuts(JSContext *cx, JSObject *a, JSObject *b, TradeGutsReserved &reserved) { - JS_ASSERT(a->compartment() == b->compartment()); - JS_ASSERT(a->is() == b->is()); + MOZ_ASSERT(a->compartment() == b->compartment()); + MOZ_ASSERT(a->is() == b->is()); /* * Neither object may be in the nursery, but ensure we update any embedded * nursery pointers in either object. */ #ifdef JSGC_GENERATIONAL - JS_ASSERT(!IsInsideNursery(a) && !IsInsideNursery(b)); + MOZ_ASSERT(!IsInsideNursery(a) && !IsInsideNursery(b)); cx->runtime()->gc.storeBuffer.putWholeCellFromMainThread(a); cx->runtime()->gc.storeBuffer.putWholeCellFromMainThread(b); #endif @@ -2576,16 +2576,16 @@ JSObject::TradeGuts(JSContext *cx, JSObject *a, JSObject *b, TradeGutsReserved & * refcounted JIT code blob for them across compartments instead of just * swapping guts. */ - JS_ASSERT(!a->is() && !b->is()); + MOZ_ASSERT(!a->is() && !b->is()); /* Arrays can use their fixed storage for elements. */ - JS_ASSERT(!a->is() && !b->is()); + MOZ_ASSERT(!a->is() && !b->is()); /* * Callers should not try to swap ArrayBuffer objects, * these use a different slot representation from other objects. */ - JS_ASSERT(!a->is() && !b->is()); + MOZ_ASSERT(!a->is() && !b->is()); /* Trade the guts of the objects. */ const size_t size = a->tenuredSizeOfThis(); @@ -2596,7 +2596,7 @@ JSObject::TradeGuts(JSContext *cx, JSObject *a, JSObject *b, TradeGutsReserved & * them over wholesale. */ char tmp[mozilla::tl::Max::value]; - JS_ASSERT(size <= sizeof(tmp)); + MOZ_ASSERT(size <= sizeof(tmp)); js_memcpy(tmp, a, size); js_memcpy(a, b, size); @@ -2685,9 +2685,9 @@ bool JSObject::swap(JSContext *cx, HandleObject a, HandleObject b) { // Ensure swap doesn't cause a finalizer to not be run. - JS_ASSERT(IsBackgroundFinalized(a->asTenured()->getAllocKind()) == - IsBackgroundFinalized(b->asTenured()->getAllocKind())); - JS_ASSERT(a->compartment() == b->compartment()); + MOZ_ASSERT(IsBackgroundFinalized(a->asTenured()->getAllocKind()) == + IsBackgroundFinalized(b->asTenured()->getAllocKind())); + MOZ_ASSERT(a->compartment() == b->compartment()); unsigned r = NotifyGCPreSwap(a, b); @@ -2714,8 +2714,8 @@ DefineStandardSlot(JSContext *cx, HandleObject obj, JSProtoKey key, JSAtom *atom * property is not yet present, force it into a new one bound to a * reserved slot. Otherwise, go through the normal property path. */ - JS_ASSERT(obj->is()); - JS_ASSERT(obj->isNative()); + MOZ_ASSERT(obj->is()); + MOZ_ASSERT(obj->isNative()); if (!obj->nativeLookup(cx, id)) { obj->as().setConstructorPropertySlot(key, v); @@ -2737,7 +2737,7 @@ DefineStandardSlot(JSContext *cx, HandleObject obj, JSProtoKey key, JSAtom *atom static void SetClassObject(JSObject *obj, JSProtoKey key, JSObject *cobj, JSObject *proto) { - JS_ASSERT(!obj->getParent()); + MOZ_ASSERT(!obj->getParent()); if (!obj->is()) return; @@ -2748,7 +2748,7 @@ SetClassObject(JSObject *obj, JSProtoKey key, JSObject *cobj, JSObject *proto) static void ClearClassObject(JSObject *obj, JSProtoKey key) { - JS_ASSERT(!obj->getParent()); + MOZ_ASSERT(!obj->getParent()); if (!obj->is()) return; @@ -2896,13 +2896,13 @@ js_InitClass(JSContext *cx, HandleObject obj, JSObject *protoProto_, RootedObject protoProto(cx, protoProto_); /* Assert mandatory function pointer members. */ - JS_ASSERT(clasp->addProperty); - JS_ASSERT(clasp->delProperty); - JS_ASSERT(clasp->getProperty); - JS_ASSERT(clasp->setProperty); - JS_ASSERT(clasp->enumerate); - JS_ASSERT(clasp->resolve); - JS_ASSERT(clasp->convert); + MOZ_ASSERT(clasp->addProperty); + MOZ_ASSERT(clasp->delProperty); + MOZ_ASSERT(clasp->getProperty); + MOZ_ASSERT(clasp->setProperty); + MOZ_ASSERT(clasp->enumerate); + MOZ_ASSERT(clasp->resolve); + MOZ_ASSERT(clasp->convert); RootedAtom atom(cx, Atomize(cx, clasp->name, strlen(clasp->name))); if (!atom) @@ -2933,8 +2933,8 @@ js_InitClass(JSContext *cx, HandleObject obj, JSObject *protoProto_, JSObject::updateSlotsForSpan(ThreadSafeContext *cx, HandleObject obj, size_t oldSpan, size_t newSpan) { - JS_ASSERT(cx->isThreadLocal(obj)); - JS_ASSERT(oldSpan != newSpan); + MOZ_ASSERT(cx->isThreadLocal(obj)); + MOZ_ASSERT(oldSpan != newSpan); size_t oldCount = dynamicSlotsCount(obj->numFixedSlots(), oldSpan, obj->getClass()); size_t newCount = dynamicSlotsCount(obj->numFixedSlots(), newSpan, obj->getClass()); @@ -2962,11 +2962,11 @@ JSObject::updateSlotsForSpan(ThreadSafeContext *cx, /* static */ bool JSObject::setLastProperty(ThreadSafeContext *cx, HandleObject obj, HandleShape shape) { - JS_ASSERT(cx->isThreadLocal(obj)); - JS_ASSERT(!obj->inDictionaryMode()); - JS_ASSERT(!shape->inDictionary()); - JS_ASSERT(shape->compartment() == obj->compartment()); - JS_ASSERT(shape->numFixedSlots() == obj->numFixedSlots()); + MOZ_ASSERT(cx->isThreadLocal(obj)); + MOZ_ASSERT(!obj->inDictionaryMode()); + MOZ_ASSERT(!shape->inDictionary()); + MOZ_ASSERT(shape->compartment() == obj->compartment()); + MOZ_ASSERT(shape->numFixedSlots() == obj->numFixedSlots()); size_t oldSpan = obj->lastProperty()->slotSpan(); size_t newSpan = shape->slotSpan(); @@ -2986,18 +2986,18 @@ JSObject::setLastProperty(ThreadSafeContext *cx, HandleObject obj, HandleShape s void JSObject::setLastPropertyShrinkFixedSlots(Shape *shape) { - JS_ASSERT(!inDictionaryMode()); - JS_ASSERT(!shape->inDictionary()); - JS_ASSERT(shape->compartment() == compartment()); - JS_ASSERT(lastProperty()->slotSpan() == shape->slotSpan()); + MOZ_ASSERT(!inDictionaryMode()); + MOZ_ASSERT(!shape->inDictionary()); + MOZ_ASSERT(shape->compartment() == compartment()); + MOZ_ASSERT(lastProperty()->slotSpan() == shape->slotSpan()); DebugOnly oldFixed = numFixedSlots(); DebugOnly newFixed = shape->numFixedSlots(); - JS_ASSERT(newFixed < oldFixed); - JS_ASSERT(shape->slotSpan() <= oldFixed); - JS_ASSERT(shape->slotSpan() <= newFixed); - JS_ASSERT(dynamicSlotsCount(oldFixed, shape->slotSpan(), getClass()) == 0); - JS_ASSERT(dynamicSlotsCount(newFixed, shape->slotSpan(), getClass()) == 0); + MOZ_ASSERT(newFixed < oldFixed); + MOZ_ASSERT(shape->slotSpan() <= oldFixed); + MOZ_ASSERT(shape->slotSpan() <= newFixed); + MOZ_ASSERT(dynamicSlotsCount(oldFixed, shape->slotSpan(), getClass()) == 0); + MOZ_ASSERT(dynamicSlotsCount(newFixed, shape->slotSpan(), getClass()) == 0); shape_ = shape; } @@ -3005,8 +3005,8 @@ JSObject::setLastPropertyShrinkFixedSlots(Shape *shape) /* static */ bool JSObject::setSlotSpan(ThreadSafeContext *cx, HandleObject obj, uint32_t span) { - JS_ASSERT(cx->isThreadLocal(obj)); - JS_ASSERT(obj->inDictionaryMode()); + MOZ_ASSERT(cx->isThreadLocal(obj)); + MOZ_ASSERT(obj->inDictionaryMode()); size_t oldSpan = obj->lastProperty()->base()->slotSpan(); if (oldSpan == span) @@ -3061,8 +3061,8 @@ ReallocateSlots(ThreadSafeContext *cx, JSObject *obj, HeapSlot *oldSlots, /* static */ bool JSObject::growSlots(ThreadSafeContext *cx, HandleObject obj, uint32_t oldCount, uint32_t newCount) { - JS_ASSERT(cx->isThreadLocal(obj)); - JS_ASSERT(newCount > oldCount); + MOZ_ASSERT(cx->isThreadLocal(obj)); + MOZ_ASSERT(newCount > oldCount); JS_ASSERT_IF(!obj->is(), newCount >= SLOT_CAPACITY_MIN); /* @@ -3070,7 +3070,7 @@ JSObject::growSlots(ThreadSafeContext *cx, HandleObject obj, uint32_t oldCount, * the limited number of bits to store shape slots, object growth is * throttled well before the slot capacity can overflow. */ - JS_ASSERT(newCount < NELEMENTS_LIMIT); + MOZ_ASSERT(newCount < NELEMENTS_LIMIT); if (!oldCount) { obj->slots = AllocateSlots(cx, obj, newCount); @@ -3109,8 +3109,8 @@ FreeSlots(ThreadSafeContext *cx, HeapSlot *slots) /* static */ void JSObject::shrinkSlots(ThreadSafeContext *cx, HandleObject obj, uint32_t oldCount, uint32_t newCount) { - JS_ASSERT(cx->isThreadLocal(obj)); - JS_ASSERT(newCount < oldCount); + MOZ_ASSERT(cx->isThreadLocal(obj)); + MOZ_ASSERT(newCount < oldCount); if (newCount == 0) { FreeSlots(cx, obj->slots); @@ -3134,7 +3134,7 @@ JSObject::sparsifyDenseElement(ExclusiveContext *cx, HandleObject obj, uint32_t return false; RootedValue value(cx, obj->getDenseElement(index)); - JS_ASSERT(!value.isMagic(JS_ELEMENTS_HOLE)); + MOZ_ASSERT(!value.isMagic(JS_ELEMENTS_HOLE)); JSObject::removeDenseElementForSparseIndex(cx, obj, index); @@ -3144,7 +3144,7 @@ JSObject::sparsifyDenseElement(ExclusiveContext *cx, HandleObject obj, uint32_t return false; } - JS_ASSERT(slot == obj->slotSpan() - 1); + MOZ_ASSERT(slot == obj->slotSpan() - 1); obj->initSlot(slot, value); return true; @@ -3186,11 +3186,11 @@ JSObject::sparsifyDenseElements(js::ExclusiveContext *cx, HandleObject obj) bool JSObject::willBeSparseElements(uint32_t requiredCapacity, uint32_t newElementsHint) { - JS_ASSERT(isNative()); - JS_ASSERT(requiredCapacity > MIN_SPARSE_INDEX); + MOZ_ASSERT(isNative()); + MOZ_ASSERT(requiredCapacity > MIN_SPARSE_INDEX); uint32_t cap = getDenseCapacity(); - JS_ASSERT(requiredCapacity >= cap); + MOZ_ASSERT(requiredCapacity >= cap); if (requiredCapacity >= NELEMENTS_LIMIT) return true; @@ -3456,13 +3456,13 @@ JSObject::goodAllocated(uint32_t reqAllocated, uint32_t length = 0) bool JSObject::growElements(ThreadSafeContext *cx, uint32_t reqCapacity) { - JS_ASSERT(nonProxyIsExtensible()); - JS_ASSERT(canHaveNonEmptyElements()); + MOZ_ASSERT(nonProxyIsExtensible()); + MOZ_ASSERT(canHaveNonEmptyElements()); if (denseElementsAreCopyOnWrite()) MOZ_CRASH(); uint32_t oldCapacity = getDenseCapacity(); - JS_ASSERT(oldCapacity < reqCapacity); + MOZ_ASSERT(oldCapacity < reqCapacity); using mozilla::CheckedInt; @@ -3478,7 +3478,7 @@ JSObject::growElements(ThreadSafeContext *cx, uint32_t reqCapacity) uint32_t newAllocated; if (is() && !as().lengthIsWritable()) { - JS_ASSERT(reqCapacity <= as().length()); + MOZ_ASSERT(reqCapacity <= as().length()); // Preserve the |capacity <= length| invariant for arrays with // non-writable length. See also js::ArraySetLength which initially // enforces this requirement. @@ -3488,7 +3488,7 @@ JSObject::growElements(ThreadSafeContext *cx, uint32_t reqCapacity) } uint32_t newCapacity = newAllocated - ObjectElements::VALUES_PER_HEADER; - JS_ASSERT(newCapacity > oldCapacity && newCapacity >= reqCapacity); + MOZ_ASSERT(newCapacity > oldCapacity && newCapacity >= reqCapacity); // Don't let nelements get close to wrapping around uint32_t. if (newCapacity >= NELEMENTS_LIMIT) @@ -3520,8 +3520,8 @@ JSObject::growElements(ThreadSafeContext *cx, uint32_t reqCapacity) void JSObject::shrinkElements(ThreadSafeContext *cx, uint32_t reqCapacity) { - JS_ASSERT(cx->isThreadLocal(this)); - JS_ASSERT(canHaveNonEmptyElements()); + MOZ_ASSERT(cx->isThreadLocal(this)); + MOZ_ASSERT(canHaveNonEmptyElements()); if (denseElementsAreCopyOnWrite()) MOZ_CRASH(); @@ -3529,7 +3529,7 @@ JSObject::shrinkElements(ThreadSafeContext *cx, uint32_t reqCapacity) return; uint32_t oldCapacity = getDenseCapacity(); - JS_ASSERT(reqCapacity < oldCapacity); + MOZ_ASSERT(reqCapacity < oldCapacity); uint32_t oldAllocated = oldCapacity + ObjectElements::VALUES_PER_HEADER; uint32_t reqAllocated = reqCapacity + ObjectElements::VALUES_PER_HEADER; @@ -3554,10 +3554,10 @@ JSObject::shrinkElements(ThreadSafeContext *cx, uint32_t reqCapacity) /* static */ bool JSObject::CopyElementsForWrite(ThreadSafeContext *cx, JSObject *obj) { - JS_ASSERT(obj->denseElementsAreCopyOnWrite()); + MOZ_ASSERT(obj->denseElementsAreCopyOnWrite()); // The original owner of a COW elements array should never be modified. - JS_ASSERT(obj->getElementsHeader()->ownerObject() != obj); + MOZ_ASSERT(obj->getElementsHeader()->ownerObject() != obj); uint32_t initlen = obj->getDenseInitializedLength(); uint32_t allocated = initlen + ObjectElements::VALUES_PER_HEADER; @@ -3740,7 +3740,7 @@ JSProtoKey JS::IdentifyStandardInstance(JSObject *obj) { // Note: The prototype shares its JSClass with instances. - JS_ASSERT(!obj->is()); + MOZ_ASSERT(!obj->is()); JSProtoKey key = StandardProtoKeyOrNull(obj); if (key != JSProto_Null && !IsStandardPrototype(obj, key)) return key; @@ -3751,7 +3751,7 @@ JSProtoKey JS::IdentifyStandardPrototype(JSObject *obj) { // Note: The prototype shares its JSClass with instances. - JS_ASSERT(!obj->is()); + MOZ_ASSERT(!obj->is()); JSProtoKey key = StandardProtoKeyOrNull(obj); if (key != JSProto_Null && IsStandardPrototype(obj, key)) return key; @@ -3789,8 +3789,8 @@ js::FindClassObject(ExclusiveContext *cx, MutableHandleObject protop, const Clas { JSProtoKey protoKey = ClassProtoKeyOrAnonymousOrNull(clasp); if (protoKey != JSProto_Null) { - JS_ASSERT(JSProto_Null < protoKey); - JS_ASSERT(protoKey < JSProto_LIMIT); + MOZ_ASSERT(JSProto_Null < protoKey); + MOZ_ASSERT(protoKey < JSProto_LIMIT); return GetBuiltinConstructor(cx, protoKey, protop); } @@ -3866,10 +3866,10 @@ JSObject::constructHook() const /* static */ bool JSObject::allocSlot(ThreadSafeContext *cx, HandleObject obj, uint32_t *slotp) { - JS_ASSERT(cx->isThreadLocal(obj)); + MOZ_ASSERT(cx->isThreadLocal(obj)); uint32_t slot = obj->slotSpan(); - JS_ASSERT(slot >= JSSLOT_FREE(obj->getClass())); + MOZ_ASSERT(slot >= JSSLOT_FREE(obj->getClass())); /* * If this object is in dictionary mode, try to pull a free slot from the @@ -3880,7 +3880,7 @@ JSObject::allocSlot(ThreadSafeContext *cx, HandleObject obj, uint32_t *slotp) uint32_t last = table.freelist; if (last != SHAPE_INVALID_SLOT) { #ifdef DEBUG - JS_ASSERT(last < slot); + MOZ_ASSERT(last < slot); uint32_t next = obj->getSlot(last).toPrivateUint32(); JS_ASSERT_IF(next != SHAPE_INVALID_SLOT, next < slot); #endif @@ -3910,7 +3910,7 @@ JSObject::allocSlot(ThreadSafeContext *cx, HandleObject obj, uint32_t *slotp) void JSObject::freeSlot(uint32_t slot) { - JS_ASSERT(slot < slotSpan()); + MOZ_ASSERT(slot < slotSpan()); if (inDictionaryMode()) { uint32_t &last = lastProperty()->table().freelist; @@ -3964,8 +3964,8 @@ PurgeScopeChainHelper(ExclusiveContext *cx, HandleObject objArg, HandleId id) /* Re-root locally so we can re-assign. */ RootedObject obj(cx, objArg); - JS_ASSERT(obj->isNative()); - JS_ASSERT(obj->isDelegate()); + MOZ_ASSERT(obj->isNative()); + MOZ_ASSERT(obj->isDelegate()); /* Lookups on integer ids cannot be cached through prototypes. */ if (JSID_IS_INT(id)) @@ -4015,7 +4015,7 @@ JSObject::defineGeneric(ExclusiveContext *cx, HandleObject obj, HandleId id, HandleValue value, JSPropertyOp getter, JSStrictPropertyOp setter, unsigned attrs) { - JS_ASSERT(!(attrs & JSPROP_NATIVE_ACCESSORS)); + MOZ_ASSERT(!(attrs & JSPROP_NATIVE_ACCESSORS)); js::DefineGenericOp op = obj->getOps()->defineGeneric; if (op) { if (!cx->shouldBeJSContext()) @@ -4069,7 +4069,7 @@ JSObject::defineElement(ExclusiveContext *cx, HandleObject obj, Shape * JSObject::addDataProperty(ExclusiveContext *cx, jsid idArg, uint32_t slot, unsigned attrs) { - JS_ASSERT(!(attrs & (JSPROP_GETTER | JSPROP_SETTER))); + MOZ_ASSERT(!(attrs & (JSPROP_GETTER | JSPROP_SETTER))); RootedObject self(cx, this); RootedId id(cx, idArg); return addProperty(cx, self, id, nullptr, nullptr, slot, attrs, 0); @@ -4079,7 +4079,7 @@ Shape * JSObject::addDataProperty(ExclusiveContext *cx, HandlePropertyName name, uint32_t slot, unsigned attrs) { - JS_ASSERT(!(attrs & (JSPROP_GETTER | JSPROP_SETTER))); + MOZ_ASSERT(!(attrs & (JSPROP_GETTER | JSPROP_SETTER))); RootedObject self(cx, this); RootedId id(cx, NameToId(name)); return addProperty(cx, self, id, nullptr, nullptr, slot, attrs, 0); @@ -4310,7 +4310,7 @@ DefinePropertyOrElement(typename ExecutionModeTraits::ExclusiveContextType if (result == JSObject::ED_FAILED) return false; if (result == JSObject::ED_OK) { - JS_ASSERT(setter == JS_StrictPropertyStub); + MOZ_ASSERT(setter == JS_StrictPropertyStub); return CallAddPropertyHookDense(cx, obj->getClass(), obj, index, value); } } @@ -4336,7 +4336,7 @@ bool js::DefineNativeProperty(ExclusiveContext *cx, HandleObject obj, HandleId id, HandleValue value, PropertyOp getter, StrictPropertyOp setter, unsigned attrs) { - JS_ASSERT(!(attrs & JSPROP_NATIVE_ACCESSORS)); + MOZ_ASSERT(!(attrs & JSPROP_NATIVE_ACCESSORS)); AutoRooterGetterSetter gsRoot(cx, attrs, &getter, &setter); @@ -4526,7 +4526,7 @@ CallResolveOp(JSContext *cx, HandleObject obj, HandleId id, MutableHandleObject if (!obj2->isNative()) { /* Whoops, newresolve handed back a foreign obj2. */ - JS_ASSERT(obj2 != obj); + MOZ_ASSERT(obj2 != obj); return JSObject::lookupGeneric(cx, obj2, id, objp, propp); } @@ -4766,7 +4766,7 @@ js::LookupNameNoGC(JSContext *cx, PropertyName *name, JSObject *scopeChain, { AutoAssertNoException nogc(cx); - JS_ASSERT(!*objp && !*pobjp && !*propp); + MOZ_ASSERT(!*objp && !*pobjp && !*propp); for (JSObject *scope = scopeChain; scope; scope = scope->enclosingScope()) { if (scope->getOps()->lookupGeneric) @@ -4912,7 +4912,7 @@ NativeGetInline(JSContext *cx, typename MaybeRooted::HandleType shape, typename MaybeRooted::MutableHandleType vp) { - JS_ASSERT(pobj->isNative()); + MOZ_ASSERT(pobj->isNative()); if (shape->hasSlot()) { vp.set(pobj->nativeGetSlot(shape->slot())); @@ -4975,8 +4975,8 @@ js::NativeSet(typename ExecutionModeTraits::ContextType cxArg, Handle obj, Handle receiver, HandleShape shape, bool strict, MutableHandleValue vp) { - JS_ASSERT(cxArg->isThreadLocal(obj)); - JS_ASSERT(obj->isNative()); + MOZ_ASSERT(cxArg->isThreadLocal(obj)); + MOZ_ASSERT(obj->isNative()); if (shape->hasSlot()) { /* If shape has a stub setter, just store vp. */ @@ -5223,11 +5223,11 @@ LookupPropertyPureInline(JSObject *obj, jsid id, JSObject **objp, Shape **propp) static MOZ_ALWAYS_INLINE bool NativeGetPureInline(JSObject *pobj, Shape *shape, Value *vp) { - JS_ASSERT(pobj->isNative()); + MOZ_ASSERT(pobj->isNative()); if (shape->hasSlot()) { *vp = pobj->nativeGetSlot(shape->slot()); - JS_ASSERT(!vp->isMagic()); + MOZ_ASSERT(!vp->isMagic()); } else { vp->setUndefined(); } @@ -5427,7 +5427,7 @@ baseops::SetPropertyHelper(typename ExecutionModeTraits::ContextType cxArg HandleObject obj, HandleObject receiver, HandleId id, QualifiedBool qualified, MutableHandleValue vp, bool strict) { - JS_ASSERT(cxArg->isThreadLocal(obj)); + MOZ_ASSERT(cxArg->isThreadLocal(obj)); if (MOZ_UNLIKELY(obj->watched())) { if (mode == ParallelExecution) @@ -5479,7 +5479,7 @@ baseops::SetPropertyHelper(typename ExecutionModeTraits::ContextType cxArg } } else { /* We should never add properties to lexical blocks. */ - JS_ASSERT(!obj->is()); + MOZ_ASSERT(!obj->is()); if (obj->isUnqualifiedVarObj() && !qualified) { if (mode == ParallelExecution) @@ -5514,7 +5514,7 @@ baseops::SetPropertyHelper(typename ExecutionModeTraits::ContextType cxArg return js_ReportGetterOnlyAssignment(cxArg->asJSContext(), id, strict); } } else { - JS_ASSERT(shape->isDataDescriptor()); + MOZ_ASSERT(shape->isDataDescriptor()); if (!shape->writable()) { /* @@ -5892,7 +5892,7 @@ MaybeCallMethod(JSContext *cx, HandleObject obj, HandleId id, MutableHandleValue JS_FRIEND_API(bool) js::DefaultValue(JSContext *cx, HandleObject obj, JSType hint, MutableHandleValue vp) { - JS_ASSERT(hint == JSTYPE_NUMBER || hint == JSTYPE_STRING || hint == JSTYPE_VOID); + MOZ_ASSERT(hint == JSTYPE_NUMBER || hint == JSTYPE_STRING || hint == JSTYPE_VOID); Rooted id(cx); @@ -5977,7 +5977,7 @@ JS_EnumerateState(JSContext *cx, HandleObject obj, JSIterateOp enum_op, const Class *clasp = obj->getClass(); JSEnumerateOp enumerate = clasp->enumerate; if (clasp->flags & JSCLASS_NEW_ENUMERATE) { - JS_ASSERT(enumerate != JS_EnumerateStub); + MOZ_ASSERT(enumerate != JS_EnumerateStub); return ((JSNewEnumerateOp) enumerate)(cx, obj, enum_op, statep, idp); } @@ -5985,7 +5985,7 @@ JS_EnumerateState(JSContext *cx, HandleObject obj, JSIterateOp enum_op, return false; /* Tell InitNativeIterator to treat us like a native object. */ - JS_ASSERT(enum_op == JSENUMERATE_INIT || enum_op == JSENUMERATE_INIT_ALL); + MOZ_ASSERT(enum_op == JSENUMERATE_INIT || enum_op == JSENUMERATE_INIT_ALL); statep.setMagic(JS_NATIVE_ENUMERATE); return true; } @@ -6021,8 +6021,8 @@ js::IsDelegateOfObject(JSContext *cx, HandleObject protoObj, JSObject* obj, bool JSObject * js::GetBuiltinPrototypePure(GlobalObject *global, JSProtoKey protoKey) { - JS_ASSERT(JSProto_Null <= protoKey); - JS_ASSERT(protoKey < JSProto_LIMIT); + MOZ_ASSERT(JSProto_Null <= protoKey); + MOZ_ASSERT(protoKey < JSProto_LIMIT); if (protoKey != JSProto_Null) { const Value &v = global->getPrototype(protoKey); @@ -6079,7 +6079,7 @@ js::PrimitiveToObject(JSContext *cx, const Value &v) return NumberObject::create(cx, v.toNumber()); if (v.isBoolean()) return BooleanObject::create(cx, v.toBoolean()); - JS_ASSERT(v.isSymbol()); + MOZ_ASSERT(v.isSymbol()); return SymbolObject::create(cx, v.toSymbol()); } @@ -6087,8 +6087,8 @@ js::PrimitiveToObject(JSContext *cx, const Value &v) JSObject * js::ToObjectSlow(JSContext *cx, HandleValue val, bool reportScanStack) { - JS_ASSERT(!val.isMagic()); - JS_ASSERT(!val.isObject()); + MOZ_ASSERT(!val.isMagic()); + MOZ_ASSERT(!val.isObject()); if (val.isNullOrUndefined()) { if (reportScanStack) { @@ -6106,7 +6106,7 @@ js::ToObjectSlow(JSContext *cx, HandleValue val, bool reportScanStack) void js_GetObjectSlotName(JSTracer *trc, char *buf, size_t bufsize) { - JS_ASSERT(trc->debugPrinter() == js_GetObjectSlotName); + MOZ_ASSERT(trc->debugPrinter() == js_GetObjectSlotName); JSObject *obj = (JSObject *)trc->debugPrintArg(); uint32_t slot = uint32_t(trc->debugPrintIndex()); diff --git a/js/src/jsobj.h b/js/src/jsobj.h index ae2f2351965c..7df067dd8663 100644 --- a/js/src/jsobj.h +++ b/js/src/jsobj.h @@ -389,7 +389,7 @@ class JSObject : public js::ObjectImpl /* Index into the dynamic slots array to use for a dynamic slot. */ size_t dynamicSlotIndex(size_t slot) { - JS_ASSERT(slot >= numFixedSlots()); + MOZ_ASSERT(slot >= numFixedSlots()); return slot - numFixedSlots(); } @@ -420,8 +420,8 @@ class JSObject : public js::ObjectImpl } void prepareElementRangeForOverwrite(size_t start, size_t end) { - JS_ASSERT(end <= getDenseInitializedLength()); - JS_ASSERT(!denseElementsAreCopyOnWrite()); + MOZ_ASSERT(end <= getDenseInitializedLength()); + MOZ_ASSERT(!denseElementsAreCopyOnWrite()); for (size_t i = start; i < end; i++) elements[i].js::HeapSlot::~HeapSlot(); } @@ -430,8 +430,8 @@ class JSObject : public js::ObjectImpl uint32_t slotSpan); void nativeSetSlot(uint32_t slot, const js::Value &value) { - JS_ASSERT(isNative()); - JS_ASSERT(slot < slotSpan()); + MOZ_ASSERT(isNative()); + MOZ_ASSERT(slot < slotSpan()); return setSlot(slot, value); } @@ -441,27 +441,27 @@ class JSObject : public js::ObjectImpl const js::Value &value, bool overwriting = true); inline const js::Value &getReservedSlot(uint32_t index) const { - JS_ASSERT(index < JSSLOT_FREE(getClass())); + MOZ_ASSERT(index < JSSLOT_FREE(getClass())); return getSlot(index); } const js::HeapSlot &getReservedSlotRef(uint32_t index) const { - JS_ASSERT(index < JSSLOT_FREE(getClass())); + MOZ_ASSERT(index < JSSLOT_FREE(getClass())); return getSlotRef(index); } js::HeapSlot &getReservedSlotRef(uint32_t index) { - JS_ASSERT(index < JSSLOT_FREE(getClass())); + MOZ_ASSERT(index < JSSLOT_FREE(getClass())); return getSlotRef(index); } void initReservedSlot(uint32_t index, const js::Value &v) { - JS_ASSERT(index < JSSLOT_FREE(getClass())); + MOZ_ASSERT(index < JSSLOT_FREE(getClass())); initSlot(index, v); } void setReservedSlot(uint32_t index, const js::Value &v) { - JS_ASSERT(index < JSSLOT_FREE(getClass())); + MOZ_ASSERT(index < JSSLOT_FREE(getClass())); setSlot(index, v); } @@ -494,7 +494,7 @@ class JSObject : public js::ObjectImpl */ bool uninlinedIsProxy() const; JSObject *getProto() const { - JS_ASSERT(!uninlinedIsProxy()); + MOZ_ASSERT(!uninlinedIsProxy()); return getTaggedProto().toObjectOrNull(); } static inline bool getProto(JSContext *cx, js::HandleObject obj, @@ -630,7 +630,7 @@ class JSObject : public js::ObjectImpl /* Accessors for elements. */ bool ensureElements(js::ThreadSafeContext *cx, uint32_t capacity) { - JS_ASSERT(!denseElementsAreCopyOnWrite()); + MOZ_ASSERT(!denseElementsAreCopyOnWrite()); if (capacity > getDenseCapacity()) return growElements(cx, capacity); return true; @@ -640,14 +640,14 @@ class JSObject : public js::ObjectImpl bool growElements(js::ThreadSafeContext *cx, uint32_t newcap); void shrinkElements(js::ThreadSafeContext *cx, uint32_t cap); void setDynamicElements(js::ObjectElements *header) { - JS_ASSERT(!hasDynamicElements()); + MOZ_ASSERT(!hasDynamicElements()); elements = header->elements(); - JS_ASSERT(hasDynamicElements()); + MOZ_ASSERT(hasDynamicElements()); } uint32_t getDenseCapacity() { - JS_ASSERT(isNative()); - JS_ASSERT(getElementsHeader()->capacity >= getElementsHeader()->initializedLength); + MOZ_ASSERT(isNative()); + MOZ_ASSERT(getElementsHeader()->capacity >= getElementsHeader()->initializedLength); return getElementsHeader()->capacity; } @@ -665,9 +665,9 @@ class JSObject : public js::ObjectImpl public: void setDenseInitializedLength(uint32_t length) { - JS_ASSERT(isNative()); - JS_ASSERT(length <= getDenseCapacity()); - JS_ASSERT(!denseElementsAreCopyOnWrite()); + MOZ_ASSERT(isNative()); + MOZ_ASSERT(length <= getDenseCapacity()); + MOZ_ASSERT(!denseElementsAreCopyOnWrite()); prepareElementRangeForOverwrite(length, getElementsHeader()->initializedLength); getElementsHeader()->initializedLength = length; } @@ -677,14 +677,14 @@ class JSObject : public js::ObjectImpl inline void ensureDenseInitializedLengthPreservePackedFlag(js::ThreadSafeContext *cx, uint32_t index, uint32_t extra); void setDenseElement(uint32_t index, const js::Value &val) { - JS_ASSERT(isNative() && index < getDenseInitializedLength()); - JS_ASSERT(!denseElementsAreCopyOnWrite()); + MOZ_ASSERT(isNative() && index < getDenseInitializedLength()); + MOZ_ASSERT(!denseElementsAreCopyOnWrite()); elements[index].set(this, js::HeapSlot::Element, index, val); } void initDenseElement(uint32_t index, const js::Value &val) { - JS_ASSERT(isNative() && index < getDenseInitializedLength()); - JS_ASSERT(!denseElementsAreCopyOnWrite()); + MOZ_ASSERT(isNative() && index < getDenseInitializedLength()); + MOZ_ASSERT(!denseElementsAreCopyOnWrite()); elements[index].init(this, js::HeapSlot::Element, index, val); } @@ -707,8 +707,8 @@ class JSObject : public js::ObjectImpl inline js::Value getDenseOrTypedArrayElement(uint32_t idx); void copyDenseElements(uint32_t dstStart, const js::Value *src, uint32_t count) { - JS_ASSERT(dstStart + count <= getDenseCapacity()); - JS_ASSERT(!denseElementsAreCopyOnWrite()); + MOZ_ASSERT(dstStart + count <= getDenseCapacity()); + MOZ_ASSERT(!denseElementsAreCopyOnWrite()); JSRuntime *rt = runtimeFromMainThread(); if (JS::IsIncrementalBarrierNeeded(rt)) { JS::Zone *zone = this->zone(); @@ -721,8 +721,8 @@ class JSObject : public js::ObjectImpl } void initDenseElements(uint32_t dstStart, const js::Value *src, uint32_t count) { - JS_ASSERT(dstStart + count <= getDenseCapacity()); - JS_ASSERT(!denseElementsAreCopyOnWrite()); + MOZ_ASSERT(dstStart + count <= getDenseCapacity()); + MOZ_ASSERT(!denseElementsAreCopyOnWrite()); memcpy(&elements[dstStart], src, count * sizeof(js::HeapSlot)); DenseRangeWriteBarrierPost(runtimeFromMainThread(), this, dstStart, count); } @@ -730,9 +730,9 @@ class JSObject : public js::ObjectImpl void initDenseElementsUnbarriered(uint32_t dstStart, const js::Value *src, uint32_t count); void moveDenseElements(uint32_t dstStart, uint32_t srcStart, uint32_t count) { - JS_ASSERT(dstStart + count <= getDenseCapacity()); - JS_ASSERT(srcStart + count <= getDenseInitializedLength()); - JS_ASSERT(!denseElementsAreCopyOnWrite()); + MOZ_ASSERT(dstStart + count <= getDenseCapacity()); + MOZ_ASSERT(srcStart + count <= getDenseInitializedLength()); + MOZ_ASSERT(!denseElementsAreCopyOnWrite()); /* * Using memmove here would skip write barriers. Also, we need to consider @@ -767,18 +767,18 @@ class JSObject : public js::ObjectImpl } void moveDenseElementsNoPreBarrier(uint32_t dstStart, uint32_t srcStart, uint32_t count) { - JS_ASSERT(!shadowZone()->needsIncrementalBarrier()); + MOZ_ASSERT(!shadowZone()->needsIncrementalBarrier()); - JS_ASSERT(dstStart + count <= getDenseCapacity()); - JS_ASSERT(srcStart + count <= getDenseCapacity()); - JS_ASSERT(!denseElementsAreCopyOnWrite()); + MOZ_ASSERT(dstStart + count <= getDenseCapacity()); + MOZ_ASSERT(srcStart + count <= getDenseCapacity()); + MOZ_ASSERT(!denseElementsAreCopyOnWrite()); memmove(elements + dstStart, elements + srcStart, count * sizeof(js::Value)); DenseRangeWriteBarrierPost(runtimeFromMainThread(), this, dstStart, count); } bool shouldConvertDoubleElements() { - JS_ASSERT(getClass()->isNative()); + MOZ_ASSERT(getClass()->isNative()); return getElementsHeader()->shouldConvertDoubleElements(); } @@ -786,7 +786,7 @@ class JSObject : public js::ObjectImpl inline void clearShouldConvertDoubleElements(); bool denseElementsAreCopyOnWrite() { - JS_ASSERT(isNative()); + MOZ_ASSERT(isNative()); return getElementsHeader()->isCopyOnWrite(); } @@ -1022,7 +1022,7 @@ class JSObject : public js::ObjectImpl static bool getGeneric(JSContext *cx, js::HandleObject obj, js::HandleObject receiver, js::HandleId id, js::MutableHandleValue vp) { - JS_ASSERT(!!obj->getOps()->getGeneric == !!obj->getOps()->getProperty); + MOZ_ASSERT(!!obj->getOps()->getGeneric == !!obj->getOps()->getProperty); js::GenericIdOp op = obj->getOps()->getGeneric; if (op) { if (!op(cx, obj, receiver, id, vp)) @@ -1171,13 +1171,13 @@ class JSObject : public js::ObjectImpl template T &as() { - JS_ASSERT(this->is()); + MOZ_ASSERT(this->is()); return *static_cast(this); } template const T &as() const { - JS_ASSERT(this->is()); + MOZ_ASSERT(this->is()); return *static_cast(this); } @@ -1210,7 +1210,7 @@ MOZ_ALWAYS_INLINE JS::Handle js::RootedBase::as() const { const JS::Rooted &self = *static_cast*>(this); - JS_ASSERT(self->is()); + MOZ_ASSERT(self->is()); return Handle::fromMarkedLocation(reinterpret_cast(self.address())); } diff --git a/js/src/jsobjinlines.h b/js/src/jsobjinlines.h index 0d44423c22e2..2a61142fa089 100644 --- a/js/src/jsobjinlines.h +++ b/js/src/jsobjinlines.h @@ -83,10 +83,10 @@ JSObject::finalize(js::FreeOp *fop) js::probes::FinalizeObject(this); #ifdef DEBUG - JS_ASSERT(isTenured()); + MOZ_ASSERT(isTenured()); if (!IsBackgroundFinalized(asTenured()->getAllocKind())) { /* Assert we're on the main thread. */ - JS_ASSERT(CurrentThreadCanAccessRuntime(fop->runtime())); + MOZ_ASSERT(CurrentThreadCanAccessRuntime(fop->runtime())); } #endif const js::Class *clasp = getClass(); @@ -99,7 +99,7 @@ JSObject::finalize(js::FreeOp *fop) inline void JSObject::removeLastProperty(js::ExclusiveContext *cx) { - JS_ASSERT(canRemoveLastProperty()); + MOZ_ASSERT(canRemoveLastProperty()); JS::RootedObject self(cx, this); js::RootedShape prev(cx, lastProperty()->previous()); JS_ALWAYS_TRUE(setLastProperty(cx, self, prev)); @@ -115,7 +115,7 @@ JSObject::canRemoveLastProperty() * will induce a change in the object itself, and the object must be * converted to dictionary mode instead. See BaseShape comment in jsscope.h */ - JS_ASSERT(!inDictionaryMode()); + MOZ_ASSERT(!inDictionaryMode()); js::Shape *previous = lastProperty()->previous().get(); return previous->getObjectParent() == lastProperty()->getObjectParent() && previous->getObjectMetadata() == lastProperty()->getObjectMetadata() @@ -125,14 +125,14 @@ JSObject::canRemoveLastProperty() inline void JSObject::setShouldConvertDoubleElements() { - JS_ASSERT(is() && !hasEmptyElements()); + MOZ_ASSERT(is() && !hasEmptyElements()); getElementsHeader()->setShouldConvertDoubleElements(); } inline void JSObject::clearShouldConvertDoubleElements() { - JS_ASSERT(is() && !hasEmptyElements()); + MOZ_ASSERT(is() && !hasEmptyElements()); getElementsHeader()->clearShouldConvertDoubleElements(); } @@ -161,7 +161,7 @@ inline void JSObject::initDenseElementWithType(js::ExclusiveContext *cx, uint32_t index, const js::Value &val) { - JS_ASSERT(!shouldConvertDoubleElements()); + MOZ_ASSERT(!shouldConvertDoubleElements()); js::types::AddTypePropertyId(cx, this, JSID_VOID, val); initDenseElement(index, val); } @@ -193,7 +193,7 @@ JSObject::writeToIndexWouldMarkNotPacked(uint32_t index) inline void JSObject::markDenseElementsNotPacked(js::ExclusiveContext *cx) { - JS_ASSERT(isNative()); + MOZ_ASSERT(isNative()); MarkTypeObjectFlags(cx, this, js::types::OBJECT_FLAG_NON_PACKED); } @@ -201,15 +201,15 @@ inline void JSObject::ensureDenseInitializedLengthNoPackedCheck(js::ThreadSafeContext *cx, uint32_t index, uint32_t extra) { - JS_ASSERT(cx->isThreadLocal(this)); - JS_ASSERT(!denseElementsAreCopyOnWrite()); + MOZ_ASSERT(cx->isThreadLocal(this)); + MOZ_ASSERT(!denseElementsAreCopyOnWrite()); /* * Ensure that the array's contents have been initialized up to index, and * mark the elements through 'index + extra' as initialized in preparation * for a write. */ - JS_ASSERT(index + extra <= getDenseCapacity()); + MOZ_ASSERT(index + extra <= getDenseCapacity()); uint32_t &initlen = getElementsHeader()->initializedLength; if (initlen < index + extra) { @@ -236,7 +236,7 @@ inline void JSObject::ensureDenseInitializedLengthPreservePackedFlag(js::ThreadSafeContext *cx, uint32_t index, uint32_t extra) { - JS_ASSERT(!writeToIndexWouldMarkNotPacked(index)); + MOZ_ASSERT(!writeToIndexWouldMarkNotPacked(index)); ensureDenseInitializedLengthNoPackedCheck(cx, index, extra); } @@ -244,8 +244,8 @@ JSObject::EnsureDenseResult JSObject::extendDenseElements(js::ThreadSafeContext *cx, uint32_t requiredCapacity, uint32_t extra) { - JS_ASSERT(cx->isThreadLocal(this)); - JS_ASSERT(!denseElementsAreCopyOnWrite()); + MOZ_ASSERT(cx->isThreadLocal(this)); + MOZ_ASSERT(!denseElementsAreCopyOnWrite()); /* * Don't grow elements for non-extensible objects or watched objects. Dense @@ -253,7 +253,7 @@ JSObject::extendDenseElements(js::ThreadSafeContext *cx, * long as there is capacity for them. */ if (!nonProxyIsExtensible() || watched()) { - JS_ASSERT(getDenseCapacity() == 0); + MOZ_ASSERT(getDenseCapacity() == 0); return ED_SPARSE; } @@ -283,7 +283,7 @@ JSObject::extendDenseElements(js::ThreadSafeContext *cx, inline JSObject::EnsureDenseResult JSObject::ensureDenseElementsNoPackedCheck(js::ThreadSafeContext *cx, uint32_t index, uint32_t extra) { - JS_ASSERT(isNative()); + MOZ_ASSERT(isNative()); if (!maybeCopyElementsForWrite(cx)) return ED_FAILED; @@ -334,7 +334,7 @@ inline JSObject::EnsureDenseResult JSObject::ensureDenseElementsPreservePackedFlag(js::ThreadSafeContext *cx, uint32_t index, uint32_t extra) { - JS_ASSERT(!writeToIndexWouldMarkNotPacked(index)); + MOZ_ASSERT(!writeToIndexWouldMarkNotPacked(index)); return ensureDenseElementsNoPackedCheck(cx, index, extra); } @@ -354,18 +354,18 @@ JSObject::initDenseElementsUnbarriered(uint32_t dstStart, const js::Value *src, * For use by parallel threads, which since they cannot see nursery * things do not require a barrier. */ - JS_ASSERT(dstStart + count <= getDenseCapacity()); - JS_ASSERT(!denseElementsAreCopyOnWrite()); + MOZ_ASSERT(dstStart + count <= getDenseCapacity()); + MOZ_ASSERT(!denseElementsAreCopyOnWrite()); #if defined(DEBUG) && defined(JSGC_GENERATIONAL) /* * This asserts a global invariant: parallel code does not * observe objects inside the generational GC's nursery. */ - JS_ASSERT(!js::gc::IsInsideGGCNursery(this)); + MOZ_ASSERT(!js::gc::IsInsideGGCNursery(this)); for (uint32_t index = 0; index < count; ++index) { const JS::Value& value = src[index]; if (value.isMarkable()) - JS_ASSERT(!js::gc::IsInsideGGCNursery(static_cast(value.toGCThing()))); + MOZ_ASSERT(!js::gc::IsInsideGGCNursery(static_cast(value.toGCThing()))); } #endif memcpy(&elements[dstStart], src, count * sizeof(js::HeapSlot)); @@ -387,7 +387,7 @@ JSObject::setSingletonType(js::ExclusiveContext *cx, js::HandleObject obj) inline js::types::TypeObject* JSObject::getType(JSContext *cx) { - JS_ASSERT(cx->compartment() == compartment()); + MOZ_ASSERT(cx->compartment() == compartment()); if (hasLazyType()) { JS::RootedObject self(cx, this); if (cx->compartment() != compartment()) @@ -400,8 +400,8 @@ JSObject::getType(JSContext *cx) /* static */ inline bool JSObject::clearType(JSContext *cx, js::HandleObject obj) { - JS_ASSERT(!obj->hasSingletonType()); - JS_ASSERT(cx->compartment() == obj->compartment()); + MOZ_ASSERT(!obj->hasSingletonType()); + MOZ_ASSERT(cx->compartment() == obj->compartment()); js::types::TypeObject *type = cx->getNewType(obj->getClass(), js::TaggedProto(nullptr)); if (!type) @@ -414,8 +414,8 @@ JSObject::clearType(JSContext *cx, js::HandleObject obj) inline void JSObject::setType(js::types::TypeObject *newType) { - JS_ASSERT(newType); - JS_ASSERT(!hasSingletonType()); + MOZ_ASSERT(newType); + MOZ_ASSERT(!hasSingletonType()); type_ = newType; } @@ -423,7 +423,7 @@ JSObject::setType(js::types::TypeObject *newType) JSObject::getProto(JSContext *cx, js::HandleObject obj, js::MutableHandleObject protop) { if (obj->getTaggedProto().isLazy()) { - JS_ASSERT(obj->is()); + MOZ_ASSERT(obj->is()); return js::Proxy::getPrototypeOf(cx, obj, protop); } else { protop.set(obj->getTaggedProto().toObjectOrNull()); @@ -436,7 +436,7 @@ JSObject::setProto(JSContext *cx, JS::HandleObject obj, JS::HandleObject proto, { /* Proxies live in their own little world. */ if (obj->getTaggedProto().isLazy()) { - JS_ASSERT(obj->is()); + MOZ_ASSERT(obj->is()); return js::Proxy::setPrototypeOf(cx, obj, proto, succeeded); } @@ -516,9 +516,9 @@ JSObject::isUnqualifiedVarObj() JSObject::create(js::ExclusiveContext *cx, js::gc::AllocKind kind, js::gc::InitialHeap heap, js::HandleShape shape, js::HandleTypeObject type) { - JS_ASSERT(shape && type); - JS_ASSERT(type->clasp() == shape->getObjectClass()); - JS_ASSERT(type->clasp() != &js::ArrayObject::class_); + MOZ_ASSERT(shape && type); + MOZ_ASSERT(type->clasp() == shape->getObjectClass()); + MOZ_ASSERT(type->clasp() != &js::ArrayObject::class_); JS_ASSERT_IF(!ClassCanHaveFixedData(type->clasp()), js::gc::GetGCKindSlots(kind, type->clasp()) == shape->numFixedSlots()); JS_ASSERT_IF(type->clasp()->flags & JSCLASS_BACKGROUND_FINALIZE, IsBackgroundFinalized(kind)); @@ -586,14 +586,14 @@ JSObject::createArrayInternal(js::ExclusiveContext *cx, js::gc::AllocKind kind, js::HandleShape shape, js::HandleTypeObject type) { // Create a new array and initialize everything except for its elements. - JS_ASSERT(shape && type); - JS_ASSERT(type->clasp() == shape->getObjectClass()); - JS_ASSERT(type->clasp() == &js::ArrayObject::class_); + MOZ_ASSERT(shape && type); + MOZ_ASSERT(type->clasp() == shape->getObjectClass()); + MOZ_ASSERT(type->clasp() == &js::ArrayObject::class_); JS_ASSERT_IF(type->clasp()->finalize, heap == js::gc::TenuredHeap); // Arrays can use their fixed slots to store elements, so can't have shapes // which allow named properties to be stored in the fixed slots. - JS_ASSERT(shape->numFixedSlots() == 0); + MOZ_ASSERT(shape->numFixedSlots() == 0); size_t nDynamicSlots = dynamicSlotsCount(0, shape->slotSpan(), type->clasp()); JSObject *obj = js::NewGCObject(cx, kind, nDynamicSlots, heap); @@ -857,8 +857,8 @@ IsNativeFunction(const js::Value &v, JSNative native) static MOZ_ALWAYS_INLINE bool ClassMethodIsNative(JSContext *cx, JSObject *obj, const Class *clasp, jsid methodid, JSNative native) { - JS_ASSERT(!obj->is()); - JS_ASSERT(obj->getClass() == clasp); + MOZ_ASSERT(!obj->is()); + MOZ_ASSERT(obj->getClass() == clasp); Value v; if (!HasDataProperty(cx, obj, methodid, &v)) { @@ -926,7 +926,7 @@ ToPrimitive(JSContext *cx, MutableHandleValue vp) static MOZ_ALWAYS_INLINE bool ToPrimitive(JSContext *cx, JSType preferredType, MutableHandleValue vp) { - JS_ASSERT(preferredType != JSTYPE_VOID); /* Use the other ToPrimitive! */ + MOZ_ASSERT(preferredType != JSTYPE_VOID); /* Use the other ToPrimitive! */ if (vp.isPrimitive()) return true; RootedObject obj(cx, &vp.toObject()); @@ -992,7 +992,7 @@ FindProto(ExclusiveContext *cx, const js::Class *clasp, MutableHandleObject prot // resolved; the global object's resolve hook is on the // stack. js::FindClassPrototype detects this goofy case and returns // true with proto null. Fall back on Object.prototype. - JS_ASSERT(JSCLASS_CACHED_PROTO_KEY(clasp) == JSProto_Null); + MOZ_ASSERT(JSCLASS_CACHED_PROTO_KEY(clasp) == JSProto_Null); return GetBuiltinPrototype(cx, JSProto_Object, proto); } return true; @@ -1094,8 +1094,8 @@ NewObjectScriptedCall(JSContext *cx, MutableHandleObject obj); static inline JSObject * CopyInitializerObject(JSContext *cx, HandleObject baseobj, NewObjectKind newKind = GenericObject) { - JS_ASSERT(baseobj->getClass() == &JSObject::class_); - JS_ASSERT(!baseobj->inDictionaryMode()); + MOZ_ASSERT(baseobj->getClass() == &JSObject::class_); + MOZ_ASSERT(!baseobj->inDictionaryMode()); gc::AllocKind allocKind = gc::GetGCObjectFixedSlotsKind(baseobj->numFixedSlots()); allocKind = gc::GetBackgroundAllocKind(allocKind); @@ -1208,7 +1208,7 @@ NewObjectMetadata(ExclusiveContext *cxArg, JSObject **pmetadata) // The metadata callback is invoked before each created object, except when // analysis/compilation is active, to avoid recursion. It is also skipped // when we allocate objects during a bailout, to prevent stack iterations. - JS_ASSERT(!*pmetadata); + MOZ_ASSERT(!*pmetadata); if (JSContext *cx = cxArg->maybeJSContext()) { if (MOZ_UNLIKELY((size_t)cx->compartment()->hasObjectMetadataCallback()) && !cx->compartment()->activeAnalysis) diff --git a/js/src/json.cpp b/js/src/json.cpp index 0abc473b1283..9fb3af9fb393 100644 --- a/js/src/json.cpp +++ b/js/src/json.cpp @@ -101,10 +101,10 @@ Quote(StringBuffer &sb, JSLinearString *str) if (!sb.append('\\') || !sb.append(abbrev)) return false; } else { - JS_ASSERT(c < ' '); + MOZ_ASSERT(c < ' '); if (!sb.append("\\u00")) return false; - JS_ASSERT((c >> 4) < 10); + MOZ_ASSERT((c >> 4) < 10); uint8_t x = c >> 4, y = c % 16; if (!sb.append(Latin1Char('0' + x)) || !sb.append(Latin1Char(y < 10 ? '0' + y : 'a' + (y - 10)))) @@ -325,7 +325,7 @@ JO(JSContext *cx, HandleObject obj, StringifyContext *scx) Maybe ids; const AutoIdVector *props; if (scx->replacer && !scx->replacer->isCallable()) { - JS_ASSERT(JS_IsArrayObject(cx, scx->replacer)); + MOZ_ASSERT(JS_IsArrayObject(cx, scx->replacer)); props = &scx->propertyList; } else { JS_ASSERT_IF(scx->replacer, scx->propertyList.length() == 0); @@ -465,7 +465,7 @@ static bool Str(JSContext *cx, const Value &v, StringifyContext *scx) { /* Step 11 must be handled by the caller. */ - JS_ASSERT(!IsFilteredValue(v)); + MOZ_ASSERT(!IsFilteredValue(v)); JS_CHECK_RECURSION(cx, return false); @@ -505,7 +505,7 @@ Str(JSContext *cx, const Value &v, StringifyContext *scx) } /* Step 10. */ - JS_ASSERT(v.isObject()); + MOZ_ASSERT(v.isObject()); RootedObject obj(cx, &v.toObject()); scx->depth++; @@ -658,7 +658,7 @@ js_Stringify(JSContext *cx, MutableHandleValue vp, JSObject *replacer_, Value sp return false; } else { /* Step 8. */ - JS_ASSERT(gap.empty()); + MOZ_ASSERT(gap.empty()); } /* Step 9. */ diff --git a/js/src/jsonparser.cpp b/js/src/jsonparser.cpp index 1fcc25f7f9f9..2a65b511114c 100644 --- a/js/src/jsonparser.cpp +++ b/js/src/jsonparser.cpp @@ -110,8 +110,8 @@ template JSONParserBase::Token JSONParser::readString() { - JS_ASSERT(current < end); - JS_ASSERT(*current == '"'); + MOZ_ASSERT(current < end); + MOZ_ASSERT(*current == '"'); /* * JSONString: @@ -244,8 +244,8 @@ template JSONParserBase::Token JSONParser::readNumber() { - JS_ASSERT(current < end); - JS_ASSERT(JS7_ISDEC(*current) || *current == '-'); + MOZ_ASSERT(current < end); + MOZ_ASSERT(JS7_ISDEC(*current) || *current == '-'); /* * JSONNumber: @@ -290,7 +290,7 @@ JSONParser::readNumber() const CharT *dummy; if (!GetPrefixInteger(cx, digitStart.get(), current.get(), 10, &dummy, &d)) return token(OOM); - JS_ASSERT(current == dummy); + MOZ_ASSERT(current == dummy); return numberToken(negative ? -d : d); } @@ -336,7 +336,7 @@ JSONParser::readNumber() const CharT *finish; if (!js_strtod(cx, digitStart.get(), current.get(), &finish, &d)) return token(OOM); - JS_ASSERT(current == finish); + MOZ_ASSERT(current == finish); return numberToken(negative ? -d : d); } @@ -432,7 +432,7 @@ template JSONParserBase::Token JSONParser::advanceAfterObjectOpen() { - JS_ASSERT(current[-1] == '{'); + MOZ_ASSERT(current[-1] == '{'); while (current < end && IsJSONWhitespace(*current)) current++; @@ -462,23 +462,23 @@ AssertPastValue(const RangedPtr current) * *somewhat* constrained, even if this assertion is pretty broad. Don't * knock it till you tried it: this assertion *did* catch a bug once. */ - JS_ASSERT((current[-1] == 'l' && - current[-2] == 'l' && - current[-3] == 'u' && - current[-4] == 'n') || - (current[-1] == 'e' && - current[-2] == 'u' && - current[-3] == 'r' && - current[-4] == 't') || - (current[-1] == 'e' && - current[-2] == 's' && - current[-3] == 'l' && - current[-4] == 'a' && - current[-5] == 'f') || - current[-1] == '}' || - current[-1] == ']' || - current[-1] == '"' || - JS7_ISDEC(current[-1])); + MOZ_ASSERT((current[-1] == 'l' && + current[-2] == 'l' && + current[-3] == 'u' && + current[-4] == 'n') || + (current[-1] == 'e' && + current[-2] == 'u' && + current[-3] == 'r' && + current[-4] == 't') || + (current[-1] == 'e' && + current[-2] == 's' && + current[-3] == 'l' && + current[-4] == 'a' && + current[-5] == 'f') || + current[-1] == '}' || + current[-1] == ']' || + current[-1] == '"' || + JS7_ISDEC(current[-1])); } template @@ -512,7 +512,7 @@ template JSONParserBase::Token JSONParser::advancePropertyName() { - JS_ASSERT(current[-1] == ','); + MOZ_ASSERT(current[-1] == ','); while (current < end && IsJSONWhitespace(*current)) current++; @@ -532,7 +532,7 @@ template JSONParserBase::Token JSONParser::advancePropertyColon() { - JS_ASSERT(current[-1] == '"'); + MOZ_ASSERT(current[-1] == '"'); while (current < end && IsJSONWhitespace(*current)) current++; @@ -625,7 +625,7 @@ JSONParserBase::createFinishedObject(PropertyVector &properties) inline bool JSONParserBase::finishObject(MutableHandleValue vp, PropertyVector &properties) { - JS_ASSERT(&properties == &stack.back().properties()); + MOZ_ASSERT(&properties == &stack.back().properties()); JSObject *obj = createFinishedObject(properties); if (!obj) @@ -641,7 +641,7 @@ JSONParserBase::finishObject(MutableHandleValue vp, PropertyVector &properties) inline bool JSONParserBase::finishArray(MutableHandleValue vp, ElementVector &elements) { - JS_ASSERT(&elements == &stack.back().elements()); + MOZ_ASSERT(&elements == &stack.back().elements()); JSObject *obj = NewDenseCopiedArray(cx, elements.length(), elements.begin()); if (!obj) @@ -662,7 +662,7 @@ bool JSONParser::parse(MutableHandleValue vp) { RootedValue value(cx); - JS_ASSERT(stack.empty()); + MOZ_ASSERT(stack.empty()); vp.setUndefined(); @@ -699,7 +699,7 @@ JSONParser::parse(MutableHandleValue vp) return false; token = advancePropertyColon(); if (token != Colon) { - JS_ASSERT(token == Error); + MOZ_ASSERT(token == Error); return errorReturn(); } goto JSONValue; @@ -722,7 +722,7 @@ JSONParser::parse(MutableHandleValue vp) return false; break; } - JS_ASSERT(token == Error); + MOZ_ASSERT(token == Error); return errorReturn(); } @@ -822,8 +822,8 @@ JSONParser::parse(MutableHandleValue vp) } } - JS_ASSERT(end == current); - JS_ASSERT(stack.empty()); + MOZ_ASSERT(end == current); + MOZ_ASSERT(stack.empty()); vp.set(value); return true; diff --git a/js/src/jsonparser.h b/js/src/jsonparser.h index 584e12e0fdcd..24c4b7d02a00 100644 --- a/js/src/jsonparser.h +++ b/js/src/jsonparser.h @@ -70,12 +70,12 @@ class MOZ_STACK_CLASS JSONParserBase : private JS::AutoGCRooter // Stack element for an in progress array or object. struct StackEntry { ElementVector &elements() { - JS_ASSERT(state == FinishArrayElement); + MOZ_ASSERT(state == FinishArrayElement); return * static_cast(vector); } PropertyVector &properties() { - JS_ASSERT(state == FinishObjectMember); + MOZ_ASSERT(state == FinishObjectMember); return * static_cast(vector); } @@ -121,14 +121,14 @@ class MOZ_STACK_CLASS JSONParserBase : private JS::AutoGCRooter ~JSONParserBase(); Value numberValue() const { - JS_ASSERT(lastToken == Number); - JS_ASSERT(v.isNumber()); + MOZ_ASSERT(lastToken == Number); + MOZ_ASSERT(v.isNumber()); return v; } Value stringValue() const { - JS_ASSERT(lastToken == String); - JS_ASSERT(v.isString()); + MOZ_ASSERT(lastToken == String); + MOZ_ASSERT(v.isString()); return v; } @@ -138,8 +138,8 @@ class MOZ_STACK_CLASS JSONParserBase : private JS::AutoGCRooter } Token token(Token t) { - JS_ASSERT(t != String); - JS_ASSERT(t != Number); + MOZ_ASSERT(t != String); + MOZ_ASSERT(t != Number); #ifdef DEBUG lastToken = t; #endif @@ -199,7 +199,7 @@ class MOZ_STACK_CLASS JSONParser : public JSONParserBase begin(current), end(data.end()) { - JS_ASSERT(current <= end); + MOZ_ASSERT(current <= end); } /* diff --git a/js/src/jsopcode.cpp b/js/src/jsopcode.cpp index e5a8f721f37a..6170e1e993c9 100644 --- a/js/src/jsopcode.cpp +++ b/js/src/jsopcode.cpp @@ -91,7 +91,7 @@ size_t js_GetVariableBytecodeLength(jsbytecode *pc) { JSOp op = JSOp(*pc); - JS_ASSERT(js_CodeSpec[op].length == -1); + MOZ_ASSERT(js_CodeSpec[op].length == -1); switch (op) { case JSOP_TABLESWITCH: { /* Structure: default-jump case-low case-high case1-jump ... */ @@ -115,14 +115,14 @@ js::StackUses(JSScript *script, jsbytecode *pc) if (cs.nuses >= 0) return cs.nuses; - JS_ASSERT(js_CodeSpec[op].nuses == -1); + MOZ_ASSERT(js_CodeSpec[op].nuses == -1); switch (op) { case JSOP_POPN: return GET_UINT16(pc); default: /* stack: fun, this, [argc arguments] */ - JS_ASSERT(op == JSOP_NEW || op == JSOP_CALL || op == JSOP_EVAL || - op == JSOP_FUNCALL || op == JSOP_FUNAPPLY); + MOZ_ASSERT(op == JSOP_NEW || op == JSOP_CALL || op == JSOP_EVAL || + op == JSOP_FUNCALL || op == JSOP_FUNAPPLY); return 2 + GET_ARGC(pc); } } @@ -132,7 +132,7 @@ js::StackDefs(JSScript *script, jsbytecode *pc) { JSOp op = (JSOp) *pc; const JSCodeSpec &cs = js_CodeSpec[op]; - JS_ASSERT (cs.ndefs >= 0); + MOZ_ASSERT(cs.ndefs >= 0); return cs.ndefs; } @@ -198,7 +198,7 @@ JS_STATIC_ASSERT(JS_ARRAY_LENGTH(countBaseNames) + /* static */ const char * PCCounts::countName(JSOp op, size_t which) { - JS_ASSERT(which < numCounts(op)); + MOZ_ASSERT(which < numCounts(op)); if (which < BASE_LIMIT) return countBaseNames[which]; @@ -238,7 +238,7 @@ js::DumpIonScriptCounts(Sprinter *sp, jit::IonScriptCounts *ionCounts) void js_DumpPCCounts(JSContext *cx, HandleScript script, js::Sprinter *sp) { - JS_ASSERT(script->hasScriptCounts()); + MOZ_ASSERT(script->hasScriptCounts()); #ifdef DEBUG jsbytecode *pc = script->code(); @@ -368,7 +368,7 @@ class BytecodeParser // -- for that you would have to iterate to a fixed point -- but there // shouldn't be operands on the stack at a loop back-edge anyway. void mergeOffsetStack(const uint32_t *stack, uint32_t depth) { - JS_ASSERT(depth == stackDepth); + MOZ_ASSERT(depth == stackDepth); for (uint32_t n = 0; n < stackDepth; n++) if (offsetStack[n] != stack[n]) offsetStack[n] = UINT32_MAX; @@ -407,9 +407,9 @@ class BytecodeParser Bytecode &code = getCode(offset); if (operand < 0) { operand += code.stackDepth; - JS_ASSERT(operand >= 0); + MOZ_ASSERT(operand >= 0); } - JS_ASSERT(uint32_t(operand) < code.stackDepth); + MOZ_ASSERT(uint32_t(operand) < code.stackDepth); return code.offsetStack[operand]; } jsbytecode *pcForStackOperand(jsbytecode *pc, int operand) { @@ -439,14 +439,14 @@ class BytecodeParser } Bytecode& getCode(uint32_t offset) { - JS_ASSERT(offset < script_->length()); - JS_ASSERT(codeArray_[offset]); + MOZ_ASSERT(offset < script_->length()); + MOZ_ASSERT(codeArray_[offset]); return *codeArray_[offset]; } Bytecode& getCode(const jsbytecode *pc) { return getCode(script_->pcToOffset(pc)); } Bytecode* maybeCode(uint32_t offset) { - JS_ASSERT(offset < script_->length()); + MOZ_ASSERT(offset < script_->length()); return codeArray_[offset]; } Bytecode* maybeCode(const jsbytecode *pc) { return maybeCode(script_->pcToOffset(pc)); } @@ -465,9 +465,9 @@ BytecodeParser::simulateOp(JSOp op, uint32_t offset, uint32_t *offsetStack, uint uint32_t nuses = GetUseCount(script_, offset); uint32_t ndefs = GetDefCount(script_, offset); - JS_ASSERT(stackDepth >= nuses); + MOZ_ASSERT(stackDepth >= nuses); stackDepth -= nuses; - JS_ASSERT(stackDepth + ndefs <= maximumStackDepth()); + MOZ_ASSERT(stackDepth + ndefs <= maximumStackDepth()); // Mark the current offset as defining its values on the offset stack, // unless it just reshuffles the stack. In that case we want to preserve @@ -480,17 +480,17 @@ BytecodeParser::simulateOp(JSOp op, uint32_t offset, uint32_t *offsetStack, uint case JSOP_CASE: /* Keep the switch value. */ - JS_ASSERT(ndefs == 1); + MOZ_ASSERT(ndefs == 1); break; case JSOP_DUP: - JS_ASSERT(ndefs == 2); + MOZ_ASSERT(ndefs == 2); if (offsetStack) offsetStack[stackDepth + 1] = offsetStack[stackDepth]; break; case JSOP_DUP2: - JS_ASSERT(ndefs == 4); + MOZ_ASSERT(ndefs == 4); if (offsetStack) { offsetStack[stackDepth + 2] = offsetStack[stackDepth]; offsetStack[stackDepth + 3] = offsetStack[stackDepth + 1]; @@ -498,17 +498,17 @@ BytecodeParser::simulateOp(JSOp op, uint32_t offset, uint32_t *offsetStack, uint break; case JSOP_DUPAT: { - JS_ASSERT(ndefs == 1); + MOZ_ASSERT(ndefs == 1); jsbytecode *pc = script_->offsetToPC(offset); unsigned n = GET_UINT24(pc); - JS_ASSERT(n < stackDepth); + MOZ_ASSERT(n < stackDepth); if (offsetStack) offsetStack[stackDepth] = offsetStack[stackDepth - 1 - n]; break; } case JSOP_SWAP: - JS_ASSERT(ndefs == 2); + MOZ_ASSERT(ndefs == 2); if (offsetStack) { uint32_t tmp = offsetStack[stackDepth + 1]; offsetStack[stackDepth + 1] = offsetStack[stackDepth]; @@ -524,7 +524,7 @@ bool BytecodeParser::addJump(uint32_t offset, uint32_t *currentOffset, uint32_t stackDepth, const uint32_t *offsetStack) { - JS_ASSERT(offset < script_->length()); + MOZ_ASSERT(offset < script_->length()); Bytecode *&code = codeArray_[offset]; if (!code) { @@ -552,7 +552,7 @@ BytecodeParser::addJump(uint32_t offset, uint32_t *currentOffset, bool BytecodeParser::parse() { - JS_ASSERT(!codeArray_); + MOZ_ASSERT(!codeArray_); uint32_t length = script_->length(); codeArray_ = alloc().newArray(length); @@ -589,7 +589,7 @@ BytecodeParser::parse() jsbytecode *pc = script_->offsetToPC(offset); JSOp op = (JSOp)*pc; - JS_ASSERT(op < JSOP_LIMIT); + MOZ_ASSERT(op < JSOP_LIMIT); // Immediate successor of this bytecode. uint32_t successorOffset = offset + GetBytecodeLength(pc); @@ -673,7 +673,7 @@ BytecodeParser::parse() // Handle any fallthrough from this opcode. if (BytecodeFallsThrough(op)) { - JS_ASSERT(successorOffset < script_->length()); + MOZ_ASSERT(successorOffset < script_->length()); Bytecode *&nextcode = codeArray_[successorOffset]; @@ -766,7 +766,7 @@ js_DisassembleAtPC(JSContext *cx, JSScript *scriptArg, bool lines, if (showAll) { jssrcnote *sn = js_GetSrcNote(cx, script, next); if (sn) { - JS_ASSERT(!SN_IS_TERMINATOR(sn)); + MOZ_ASSERT(!SN_IS_TERMINATOR(sn)); jssrcnote *next = SN_NEXT(sn); while (!SN_IS_TERMINATOR(next) && SN_DELTA(next) == 0) { Sprint(sp, "%02u\n ", SN_TYPE(sn)); @@ -1063,8 +1063,8 @@ js_Disassemble1(JSContext *cx, HandleScript script, jsbytecode *pc, goto print_int; case JOF_UINT24: - JS_ASSERT(op == JSOP_UINT24 || op == JSOP_NEWARRAY || op == JSOP_INITELEM_ARRAY || - op == JSOP_DUPAT); + MOZ_ASSERT(op == JSOP_UINT24 || op == JSOP_NEWARRAY || op == JSOP_INITELEM_ARRAY || + op == JSOP_DUPAT); i = (int)GET_UINT24(pc); goto print_int; @@ -1077,7 +1077,7 @@ js_Disassemble1(JSContext *cx, HandleScript script, jsbytecode *pc, goto print_int; case JOF_INT32: - JS_ASSERT(op == JSOP_INT32); + MOZ_ASSERT(op == JSOP_INT32); i = GET_INT32(pc); print_int: Sprint(sp, " %d", i); @@ -1105,7 +1105,7 @@ const size_t Sprinter::DefaultSize = 64; bool Sprinter::realloc_(size_t newSize) { - JS_ASSERT(newSize > (size_t) offset); + MOZ_ASSERT(newSize > (size_t) offset); char *newBuf = (char *) js_realloc(base, newSize); if (!newBuf) { reportOutOfMemory(); @@ -1137,7 +1137,7 @@ Sprinter::~Sprinter() bool Sprinter::init() { - JS_ASSERT(!initialized); + MOZ_ASSERT(!initialized); base = (char *) js_malloc(DefaultSize); if (!base) { reportOutOfMemory(); @@ -1155,9 +1155,9 @@ Sprinter::init() void Sprinter::checkInvariants() const { - JS_ASSERT(initialized); - JS_ASSERT((size_t) offset < size); - JS_ASSERT(base[size - 1] == 0); + MOZ_ASSERT(initialized); + MOZ_ASSERT((size_t) offset < size); + MOZ_ASSERT(base[size - 1] == 0); } const char * @@ -1175,14 +1175,14 @@ Sprinter::stringEnd() const char * Sprinter::stringAt(ptrdiff_t off) const { - JS_ASSERT(off >= 0 && (size_t) off < size); + MOZ_ASSERT(off >= 0 && (size_t) off < size); return base + off; } char & Sprinter::operator[](size_t off) { - JS_ASSERT(off < size); + MOZ_ASSERT(off < size); return *(base + off); } @@ -1503,7 +1503,7 @@ ExpressionDecompiler::decompilePCForStackOperand(jsbytecode *pc, int i) bool ExpressionDecompiler::decompilePC(jsbytecode *pc) { - JS_ASSERT(script->containsPC(pc)); + MOZ_ASSERT(script->containsPC(pc)); JSOp op = (JSOp)*pc; @@ -1550,7 +1550,7 @@ ExpressionDecompiler::decompilePC(jsbytecode *pc) } case JSOP_GETALIASEDVAR: { JSAtom *atom = ScopeCoordinateName(cx->runtime()->scopeCoordinateNameCache, script, pc); - JS_ASSERT(atom); + MOZ_ASSERT(atom); return write(atom); } case JSOP_LENGTH: @@ -1674,19 +1674,19 @@ ExpressionDecompiler::loadAtom(jsbytecode *pc) JSAtom * ExpressionDecompiler::getArg(unsigned slot) { - JS_ASSERT(fun); - JS_ASSERT(slot < script->bindings.count()); + MOZ_ASSERT(fun); + MOZ_ASSERT(slot < script->bindings.count()); return (*localNames)[slot].name(); } JSAtom * ExpressionDecompiler::getLocal(uint32_t local, jsbytecode *pc) { - JS_ASSERT(local < script->nfixed()); + MOZ_ASSERT(local < script->nfixed()); if (local < script->nbodyfixed()) { - JS_ASSERT(fun); + MOZ_ASSERT(fun); uint32_t slot = local + fun->nargs(); - JS_ASSERT(slot < script->bindings.count()); + MOZ_ASSERT(slot < script->bindings.count()); return (*localNames)[slot].name(); } for (NestedScopeObject *chain = script->getStaticScope(pc); @@ -1751,7 +1751,7 @@ FindStartPC(JSContext *cx, const FrameIter &iter, int spindex, int skipStackHits if (spindex == JSDVG_SEARCH_STACK) { size_t index = iter.numFrameSlots(); - JS_ASSERT(index >= size_t(parser.stackDepthAtPC(current))); + MOZ_ASSERT(index >= size_t(parser.stackDepthAtPC(current))); // We search from fp->sp to base to find the most recently calculated // value matching v under assumption that it is the value that caused @@ -1781,9 +1781,9 @@ FindStartPC(JSContext *cx, const FrameIter &iter, int spindex, int skipStackHits static bool DecompileExpressionFromStack(JSContext *cx, int spindex, int skipStackHits, HandleValue v, char **res) { - JS_ASSERT(spindex < 0 || - spindex == JSDVG_IGNORE_STACK || - spindex == JSDVG_SEARCH_STACK); + MOZ_ASSERT(spindex < 0 || + spindex == JSDVG_IGNORE_STACK || + spindex == JSDVG_SEARCH_STACK); *res = nullptr; @@ -1808,7 +1808,7 @@ DecompileExpressionFromStack(JSContext *cx, int spindex, int skipStackHits, Hand ? frameIter.callee() : nullptr); - JS_ASSERT(script->containsPC(valuepc)); + MOZ_ASSERT(script->containsPC(valuepc)); // Give up if in prologue. if (valuepc < script->main()) @@ -1857,7 +1857,7 @@ js::DecompileValueGenerator(JSContext *cx, int spindex, HandleValue v, static bool DecompileArgumentFromStack(JSContext *cx, int formalIndex, char **res) { - JS_ASSERT(formalIndex >= 0); + MOZ_ASSERT(formalIndex >= 0); *res = nullptr; @@ -1871,7 +1871,7 @@ DecompileArgumentFromStack(JSContext *cx, int formalIndex, char **res) * called the intrinsic. */ FrameIter frameIter(cx); - JS_ASSERT(!frameIter.done()); + MOZ_ASSERT(!frameIter.done()); /* * Get the second-to-top frame, the caller of the builtin that called the @@ -1888,7 +1888,7 @@ DecompileArgumentFromStack(JSContext *cx, int formalIndex, char **res) ? frameIter.callee() : nullptr); - JS_ASSERT(script->containsPC(current)); + MOZ_ASSERT(script->containsPC(current)); if (current < script->main()) return true; @@ -1902,7 +1902,7 @@ DecompileArgumentFromStack(JSContext *cx, int formalIndex, char **res) return false; int formalStackIndex = parser.stackDepthAtPC(current) - GET_ARGC(current) + formalIndex; - JS_ASSERT(formalStackIndex >= 0); + MOZ_ASSERT(formalStackIndex >= 0); if (uint32_t(formalStackIndex) >= parser.stackDepthAtPC(current)) return true; @@ -2006,7 +2006,7 @@ static void ReleaseScriptCounts(FreeOp *fop) { JSRuntime *rt = fop->runtime(); - JS_ASSERT(rt->scriptAndCountsVector); + MOZ_ASSERT(rt->scriptAndCountsVector); ScriptAndCountsVector &vec = *rt->scriptAndCountsVector; @@ -2040,7 +2040,7 @@ js::StopPCCountProfiling(JSContext *cx) if (!rt->profilingScripts) return; - JS_ASSERT(!rt->scriptAndCountsVector); + MOZ_ASSERT(!rt->scriptAndCountsVector); ReleaseAllJITCode(rt->defaultFreeOp()); @@ -2072,7 +2072,7 @@ js::PurgePCCounts(JSContext *cx) if (!rt->scriptAndCountsVector) return; - JS_ASSERT(!rt->profilingScripts); + MOZ_ASSERT(!rt->profilingScripts); ReleaseScriptCounts(rt->defaultFreeOp()); } diff --git a/js/src/jsopcode.h b/js/src/jsopcode.h index c35d752cf7e6..67915dd6d558 100644 --- a/js/src/jsopcode.h +++ b/js/src/jsopcode.h @@ -211,13 +211,13 @@ SET_UINT32_INDEX(jsbytecode *pc, uint32_t index) static inline unsigned LoopEntryDepthHint(jsbytecode *pc) { - JS_ASSERT(*pc == JSOP_LOOPENTRY); + MOZ_ASSERT(*pc == JSOP_LOOPENTRY); return GET_UINT8(pc) & 0x7f; } static inline bool LoopEntryCanIonOsr(jsbytecode *pc) { - JS_ASSERT(*pc == JSOP_LOOPENTRY); + MOZ_ASSERT(*pc == JSOP_LOOPENTRY); return GET_UINT8(pc) & 0x80; } static inline uint8_t @@ -539,7 +539,7 @@ GetDecomposeLength(jsbytecode *pc, size_t len) * The last byte of a DECOMPOSE op stores the decomposed length. This is a * constant: perhaps we should just hardcode values instead? */ - JS_ASSERT(size_t(js_CodeSpec[*pc].length) == len); + MOZ_ASSERT(size_t(js_CodeSpec[*pc].length) == len); return (unsigned) pc[len - 1]; } @@ -547,7 +547,7 @@ static inline unsigned GetBytecodeLength(jsbytecode *pc) { JSOp op = (JSOp)*pc; - JS_ASSERT(op < JSOP_LIMIT); + MOZ_ASSERT(op < JSOP_LIMIT); if (js_CodeSpec[op].length != -1) return js_CodeSpec[op].length; @@ -798,7 +798,7 @@ class PCCounts double *rawCounts() const { return counts; } double& get(size_t which) { - JS_ASSERT(which < capacity); + MOZ_ASSERT(which < capacity); return counts[which]; } diff --git a/js/src/jsprf.cpp b/js/src/jsprf.cpp index 1b69bc0c7d92..72bab4220619 100644 --- a/js/src/jsprf.cpp +++ b/js/src/jsprf.cpp @@ -315,7 +315,7 @@ static int cvt_f(SprintfState *ss, double d, const char *fmt0, const char *fmt1) char fout[300]; int amount = fmt1 - fmt0; - JS_ASSERT((amount > 0) && (amount < (int)sizeof(fin))); + MOZ_ASSERT((amount > 0) && (amount < (int)sizeof(fin))); if (amount >= (int)sizeof(fin)) { // Totally bogus % command to sprintf. Just ignore it return 0; @@ -328,7 +328,7 @@ static int cvt_f(SprintfState *ss, double d, const char *fmt0, const char *fmt1) { const char *p = fin; while (*p) { - JS_ASSERT(*p != 'L'); + MOZ_ASSERT(*p != 'L'); p++; } } @@ -338,7 +338,7 @@ static int cvt_f(SprintfState *ss, double d, const char *fmt0, const char *fmt1) // This assert will catch overflow's of fout, when building with // debugging on. At least this way we can track down the evil piece // of calling code and fix it! - JS_ASSERT(strlen(fout) < sizeof(fout)); + MOZ_ASSERT(strlen(fout) < sizeof(fout)); return (*ss->stuff)(ss, fout, strlen(fout)); } @@ -528,7 +528,7 @@ BuildArgArray(const char *fmt, va_list ap, NumArgStateVector& nas) case 'E': case 'G': // XXX not supported I suppose - JS_ASSERT(0); + MOZ_ASSERT(0); nas[cn].type = TYPE_UNKNOWN; break; @@ -541,7 +541,7 @@ BuildArgArray(const char *fmt, va_list ap, NumArgStateVector& nas) break; default: - JS_ASSERT(0); + MOZ_ASSERT(0); nas[cn].type = TYPE_UNKNOWN; break; } @@ -620,7 +620,7 @@ dosprintf(SprintfState *ss, const char *fmt, va_list ap) NumArgStateVector nas; if (!BuildArgArray(fmt, ap, nas)) { // the fmt contains error Numbered Argument format, jliu@netscape.com - JS_ASSERT(0); + MOZ_ASSERT(0); return rv; } @@ -866,7 +866,7 @@ dosprintf(SprintfState *ss, const char *fmt, va_list ap) } else if (sizeof(void *) == sizeof(int)) { type = TYPE_UINTN; } else { - JS_ASSERT(0); + MOZ_ASSERT(0); break; } radix = 16; @@ -878,7 +878,7 @@ dosprintf(SprintfState *ss, const char *fmt, va_list ap) case 'E': case 'G': // XXX not supported I suppose - JS_ASSERT(0); + MOZ_ASSERT(0); break; #endif @@ -905,7 +905,7 @@ dosprintf(SprintfState *ss, const char *fmt, va_list ap) default: // Not a % token after all... skip it #if 0 - JS_ASSERT(0); + MOZ_ASSERT(0); #endif rv = (*ss->stuff)(ss, "%", 1); if (rv < 0) { @@ -1029,7 +1029,7 @@ JS_snprintf(char *out, uint32_t outlen, const char *fmt, ...) va_list ap; int rv; - JS_ASSERT(int32_t(outlen) > 0); + MOZ_ASSERT(int32_t(outlen) > 0); if (int32_t(outlen) <= 0) return 0; @@ -1045,7 +1045,7 @@ JS_vsnprintf(char *out, uint32_t outlen, const char *fmt, va_list ap) SprintfState ss; uint32_t n; - JS_ASSERT(int32_t(outlen) > 0); + MOZ_ASSERT(int32_t(outlen) > 0); if (int32_t(outlen) <= 0) { return 0; } diff --git a/js/src/jspropertytree.cpp b/js/src/jspropertytree.cpp index 633e79f29699..cd0eed70a3a1 100644 --- a/js/src/jspropertytree.cpp +++ b/js/src/jspropertytree.cpp @@ -57,11 +57,11 @@ HashChildren(Shape *kid1, Shape *kid2) bool PropertyTree::insertChild(ExclusiveContext *cx, Shape *parent, Shape *child) { - JS_ASSERT(!parent->inDictionary()); - JS_ASSERT(!child->parent); - JS_ASSERT(!child->inDictionary()); - JS_ASSERT(child->compartment() == parent->compartment()); - JS_ASSERT(cx->isInsideCurrentCompartment(this)); + MOZ_ASSERT(!parent->inDictionary()); + MOZ_ASSERT(!child->parent); + MOZ_ASSERT(!child->inDictionary()); + MOZ_ASSERT(child->compartment() == parent->compartment()); + MOZ_ASSERT(cx->isInsideCurrentCompartment(this)); KidsPointer *kidp = &parent->kids; @@ -73,8 +73,8 @@ PropertyTree::insertChild(ExclusiveContext *cx, Shape *parent, Shape *child) if (kidp->isShape()) { Shape *shape = kidp->toShape(); - JS_ASSERT(shape != child); - JS_ASSERT(!shape->matches(child)); + MOZ_ASSERT(shape != child); + MOZ_ASSERT(!shape->matches(child)); KidsHash *hash = HashChildren(shape, child); if (!hash) { @@ -98,20 +98,20 @@ PropertyTree::insertChild(ExclusiveContext *cx, Shape *parent, Shape *child) void Shape::removeChild(Shape *child) { - JS_ASSERT(!child->inDictionary()); - JS_ASSERT(child->parent == this); + MOZ_ASSERT(!child->inDictionary()); + MOZ_ASSERT(child->parent == this); KidsPointer *kidp = &kids; if (kidp->isShape()) { - JS_ASSERT(kidp->toShape() == child); + MOZ_ASSERT(kidp->toShape() == child); kidp->setNull(); child->parent = nullptr; return; } KidsHash *hash = kidp->toHash(); - JS_ASSERT(hash->count() >= 2); /* otherwise kidp->isShape() should be true */ + MOZ_ASSERT(hash->count() >= 2); /* otherwise kidp->isShape() should be true */ hash->remove(StackShape(child)); child->parent = nullptr; @@ -120,7 +120,7 @@ Shape::removeChild(Shape *child) /* Convert from HASH form back to SHAPE form. */ KidsHash::Range r = hash->all(); Shape *otherChild = r.front(); - JS_ASSERT((r.popFront(), r.empty())); /* No more elements! */ + MOZ_ASSERT((r.popFront(), r.empty())); /* No more elements! */ kidp->setShape(otherChild); js_delete(hash); } @@ -130,7 +130,7 @@ Shape * PropertyTree::getChild(ExclusiveContext *cx, Shape *parentArg, StackShape &unrootedChild) { RootedShape parent(cx, parentArg); - JS_ASSERT(parent); + MOZ_ASSERT(parent); Shape *existingShape = nullptr; @@ -164,7 +164,7 @@ PropertyTree::getChild(ExclusiveContext *cx, Shape *parentArg, StackShape &unroo */ Shape *tmp = existingShape; MarkShapeUnbarriered(zone->barrierTracer(), &tmp, "read barrier"); - JS_ASSERT(tmp == existingShape); + MOZ_ASSERT(tmp == existingShape); } else if (zone->isGCSweeping() && !existingShape->isMarked() && !existingShape->arenaHeader()->allocatedDuringIncremental) { @@ -172,7 +172,7 @@ PropertyTree::getChild(ExclusiveContext *cx, Shape *parentArg, StackShape &unroo * The shape we've found is unreachable and due to be finalized, so * remove our weak reference to it and don't use it. */ - JS_ASSERT(parent->isMarked()); + MOZ_ASSERT(parent->isMarked()); parent->removeChild(existingShape); existingShape = nullptr; } else if (existingShape->isMarked(gc::GRAY)) { @@ -204,7 +204,7 @@ PropertyTree::lookupChild(ThreadSafeContext *cx, Shape *parent, const StackShape /* Keep this in sync with the logic of getChild above. */ Shape *shape = nullptr; - JS_ASSERT(parent); + MOZ_ASSERT(parent); KidsPointer *kidp = &parent->kids; if (kidp->isShape()) { @@ -221,9 +221,9 @@ PropertyTree::lookupChild(ThreadSafeContext *cx, Shape *parent, const StackShape #if defined(JSGC_INCREMENTAL) && defined(DEBUG) if (shape) { JS::Zone *zone = shape->arenaHeader()->zone; - JS_ASSERT(!zone->needsIncrementalBarrier()); - JS_ASSERT(!(zone->isGCSweeping() && !shape->isMarked() && - !shape->arenaHeader()->allocatedDuringIncremental)); + MOZ_ASSERT(!zone->needsIncrementalBarrier()); + MOZ_ASSERT(!(zone->isGCSweeping() && !shape->isMarked() && + !shape->arenaHeader()->allocatedDuringIncremental)); } #endif @@ -285,9 +285,9 @@ Shape::fixupDictionaryShapeAfterMovingGC() return; } - JS_ASSERT(!IsInsideNursery(reinterpret_cast(listp))); + MOZ_ASSERT(!IsInsideNursery(reinterpret_cast(listp))); AllocKind kind = TenuredCell::fromPointer(listp)->getAllocKind(); - JS_ASSERT(kind == FINALIZE_SHAPE || kind <= FINALIZE_OBJECT_LAST); + MOZ_ASSERT(kind == FINALIZE_SHAPE || kind <= FINALIZE_OBJECT_LAST); if (kind == FINALIZE_SHAPE) { // listp points to the parent field of the next shape. Shape *next = reinterpret_cast(uintptr_t(listp) - @@ -313,7 +313,7 @@ Shape::fixupShapeTreeAfterMovingGC() return; } - JS_ASSERT(kids.isHash()); + MOZ_ASSERT(kids.isHash()); KidsHash *kh = kids.toHash(); for (KidsHash::Enum e(*kh); !e.empty(); e.popFront()) { Shape *key = e.front(); @@ -353,12 +353,12 @@ void KidsPointer::checkConsistency(Shape *aKid) const { if (isShape()) { - JS_ASSERT(toShape() == aKid); + MOZ_ASSERT(toShape() == aKid); } else { - JS_ASSERT(isHash()); + MOZ_ASSERT(isHash()); KidsHash *hash = toHash(); KidsHash::Ptr ptr = hash->lookup(StackShape(aKid)); - JS_ASSERT(*ptr == aKid); + MOZ_ASSERT(*ptr == aKid); } } @@ -370,7 +370,7 @@ Shape::dump(JSContext *cx, FILE *fp) const jsid propid = this->propid(); - JS_ASSERT(!JSID_IS_VOID(propid)); + MOZ_ASSERT(!JSID_IS_VOID(propid)); if (JSID_IS_INT(propid)) { fprintf(fp, "[%ld]", (long) JSID_TO_INT(propid)); @@ -380,7 +380,7 @@ Shape::dump(JSContext *cx, FILE *fp) const else fputs("", fp); } else { - JS_ASSERT(JSID_IS_SYMBOL(propid)); + MOZ_ASSERT(JSID_IS_SYMBOL(propid)); JSID_TO_SYMBOL(propid)->dump(fp); } @@ -418,8 +418,8 @@ void Shape::dumpSubtree(JSContext *cx, int level, FILE *fp) const { if (!parent) { - JS_ASSERT(level == 0); - JS_ASSERT(JSID_IS_EMPTY(propid_)); + MOZ_ASSERT(level == 0); + MOZ_ASSERT(JSID_IS_EMPTY(propid_)); fprintf(fp, "class %s emptyShape\n", getObjectClass()->name); } else { fprintf(fp, "%*sid ", level, ""); @@ -430,14 +430,14 @@ Shape::dumpSubtree(JSContext *cx, int level, FILE *fp) const ++level; if (kids.isShape()) { Shape *kid = kids.toShape(); - JS_ASSERT(kid->parent == this); + MOZ_ASSERT(kid->parent == this); kid->dumpSubtree(cx, level, fp); } else { const KidsHash &hash = *kids.toHash(); for (KidsHash::Range range = hash.all(); !range.empty(); range.popFront()) { Shape *kid = range.front(); - JS_ASSERT(kid->parent == this); + MOZ_ASSERT(kid->parent == this); kid->dumpSubtree(cx, level, fp); } } diff --git a/js/src/jspropertytree.h b/js/src/jspropertytree.h index f0c526cdc832..7d875de4e18c 100644 --- a/js/src/jspropertytree.h +++ b/js/src/jspropertytree.h @@ -43,23 +43,23 @@ class KidsPointer { bool isShape() const { return (w & TAG) == SHAPE && !isNull(); } Shape *toShape() const { - JS_ASSERT(isShape()); + MOZ_ASSERT(isShape()); return reinterpret_cast(w & ~uintptr_t(TAG)); } void setShape(Shape *shape) { - JS_ASSERT(shape); - JS_ASSERT((reinterpret_cast(static_cast(shape)) & TAG) == 0); + MOZ_ASSERT(shape); + MOZ_ASSERT((reinterpret_cast(static_cast(shape)) & TAG) == 0); w = reinterpret_cast(static_cast(shape)) | SHAPE; } bool isHash() const { return (w & TAG) == HASH; } KidsHash *toHash() const { - JS_ASSERT(isHash()); + MOZ_ASSERT(isHash()); return reinterpret_cast(w & ~uintptr_t(TAG)); } void setHash(KidsHash *hash) { - JS_ASSERT(hash); - JS_ASSERT((reinterpret_cast(hash) & TAG) == 0); + MOZ_ASSERT(hash); + MOZ_ASSERT((reinterpret_cast(hash) & TAG) == 0); w = reinterpret_cast(hash) | HASH; } diff --git a/js/src/jsproxy.h b/js/src/jsproxy.h index 58ef6364b860..fcca74fb2377 100644 --- a/js/src/jsproxy.h +++ b/js/src/jsproxy.h @@ -339,43 +339,43 @@ const uint32_t PROXY_MINIMUM_SLOTS = 4; inline const BaseProxyHandler * GetProxyHandler(JSObject *obj) { - JS_ASSERT(IsProxy(obj)); + MOZ_ASSERT(IsProxy(obj)); return (const BaseProxyHandler *) GetReservedSlot(obj, PROXY_HANDLER_SLOT).toPrivate(); } inline const Value & GetProxyPrivate(JSObject *obj) { - JS_ASSERT(IsProxy(obj)); + MOZ_ASSERT(IsProxy(obj)); return GetReservedSlot(obj, PROXY_PRIVATE_SLOT); } inline JSObject * GetProxyTargetObject(JSObject *obj) { - JS_ASSERT(IsProxy(obj)); + MOZ_ASSERT(IsProxy(obj)); return GetProxyPrivate(obj).toObjectOrNull(); } inline const Value & GetProxyExtra(JSObject *obj, size_t n) { - JS_ASSERT(IsProxy(obj)); + MOZ_ASSERT(IsProxy(obj)); return GetReservedSlot(obj, PROXY_EXTRA_SLOT + n); } inline void SetProxyHandler(JSObject *obj, BaseProxyHandler *handler) { - JS_ASSERT(IsProxy(obj)); + MOZ_ASSERT(IsProxy(obj)); SetReservedSlot(obj, PROXY_HANDLER_SLOT, PrivateValue(handler)); } inline void SetProxyExtra(JSObject *obj, size_t n, const Value &extra) { - JS_ASSERT(IsProxy(obj)); - JS_ASSERT(n <= 1); + MOZ_ASSERT(IsProxy(obj)); + MOZ_ASSERT(n <= 1); SetReservedSlot(obj, PROXY_EXTRA_SLOT + n, extra); } @@ -448,7 +448,7 @@ class JS_FRIEND_API(AutoEnterPolicy) virtual ~AutoEnterPolicy() { recordLeave(); } inline bool allowed() { return allow; } - inline bool returnValue() { JS_ASSERT(!allowed()); return rv; } + inline bool returnValue() { MOZ_ASSERT(!allowed()); return rv; } protected: // no-op constructor for subclass diff --git a/js/src/jsreflect.cpp b/js/src/jsreflect.cpp index 89a845ac3c5f..ca19f28875d7 100644 --- a/js/src/jsreflect.cpp +++ b/js/src/jsreflect.cpp @@ -109,7 +109,7 @@ typedef AutoValueVector NodeVector; */ #define LOCAL_ASSERT(expr) \ JS_BEGIN_MACRO \ - JS_ASSERT(expr); \ + MOZ_ASSERT(expr); \ if (!(expr)) { \ JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_BAD_PARSE_NODE); \ return false; \ @@ -513,7 +513,7 @@ class NodeBuilder bool setNodeLoc(HandleObject node, TokenPos *pos); bool setResult(HandleObject obj, MutableHandleValue dst) { - JS_ASSERT(obj); + MOZ_ASSERT(obj); dst.setObject(*obj); return true; } @@ -701,7 +701,7 @@ class NodeBuilder bool NodeBuilder::newNode(ASTType type, TokenPos *pos, MutableHandleObject dst) { - JS_ASSERT(type > AST_ERROR && type < AST_LIMIT); + MOZ_ASSERT(type > AST_ERROR && type < AST_LIMIT); RootedValue tv(cx); RootedObject node(cx, NewBuiltinClassInstance(cx, &JSObject::class_)); @@ -1058,7 +1058,7 @@ bool NodeBuilder::binaryExpression(BinaryOperator op, HandleValue left, HandleValue right, TokenPos *pos, MutableHandleValue dst) { - JS_ASSERT(op > BINOP_ERR && op < BINOP_LIMIT); + MOZ_ASSERT(op > BINOP_ERR && op < BINOP_LIMIT); RootedValue opName(cx); if (!atomValue(binopNames[op], &opName)) @@ -1079,7 +1079,7 @@ bool NodeBuilder::unaryExpression(UnaryOperator unop, HandleValue expr, TokenPos *pos, MutableHandleValue dst) { - JS_ASSERT(unop > UNOP_ERR && unop < UNOP_LIMIT); + MOZ_ASSERT(unop > UNOP_ERR && unop < UNOP_LIMIT); RootedValue opName(cx); if (!atomValue(unopNames[unop], &opName)) @@ -1101,7 +1101,7 @@ bool NodeBuilder::assignmentExpression(AssignmentOperator aop, HandleValue lhs, HandleValue rhs, TokenPos *pos, MutableHandleValue dst) { - JS_ASSERT(aop > AOP_ERR && aop < AOP_LIMIT); + MOZ_ASSERT(aop > AOP_ERR && aop < AOP_LIMIT); RootedValue opName(cx); if (!atomValue(aopNames[aop], &opName)) @@ -1562,7 +1562,7 @@ bool NodeBuilder::variableDeclaration(NodeVector &elts, VarDeclKind kind, TokenPos *pos, MutableHandleValue dst) { - JS_ASSERT(kind > VARDECL_ERR && kind < VARDECL_LIMIT); + MOZ_ASSERT(kind > VARDECL_ERR && kind < VARDECL_LIMIT); RootedValue array(cx), kindName(cx); if (!newArray(elts, &array) || @@ -1923,14 +1923,14 @@ ASTSerializer::binop(ParseNodeKind kind, JSOp op) bool ASTSerializer::statements(ParseNode *pn, NodeVector &elts) { - JS_ASSERT(pn->isKind(PNK_STATEMENTLIST)); - JS_ASSERT(pn->isArity(PN_LIST)); + MOZ_ASSERT(pn->isKind(PNK_STATEMENTLIST)); + MOZ_ASSERT(pn->isArity(PN_LIST)); if (!elts.reserve(pn->pn_count)) return false; for (ParseNode *next = pn->pn_head; next; next = next->pn_next) { - JS_ASSERT(pn->pn_pos.encloses(next->pn_pos)); + MOZ_ASSERT(pn->pn_pos.encloses(next->pn_pos)); RootedValue elt(cx); if (!sourceElement(next, &elt)) @@ -1948,7 +1948,7 @@ ASTSerializer::expressions(ParseNode *pn, NodeVector &elts) return false; for (ParseNode *next = pn->pn_head; next; next = next->pn_next) { - JS_ASSERT(pn->pn_pos.encloses(next->pn_pos)); + MOZ_ASSERT(pn->pn_pos.encloses(next->pn_pos)); RootedValue elt(cx); if (!expression(next, &elt)) @@ -1962,7 +1962,7 @@ ASTSerializer::expressions(ParseNode *pn, NodeVector &elts) bool ASTSerializer::blockStatement(ParseNode *pn, MutableHandleValue dst) { - JS_ASSERT(pn->isKind(PNK_STATEMENTLIST)); + MOZ_ASSERT(pn->isKind(PNK_STATEMENTLIST)); NodeVector stmts(cx); return statements(pn, stmts) && @@ -1972,7 +1972,7 @@ ASTSerializer::blockStatement(ParseNode *pn, MutableHandleValue dst) bool ASTSerializer::program(ParseNode *pn, MutableHandleValue dst) { - JS_ASSERT(parser->tokenStream.srcCoords.lineNum(pn->pn_pos.begin) == lineno); + MOZ_ASSERT(parser->tokenStream.srcCoords.lineNum(pn->pn_pos.begin) == lineno); NodeVector stmts(cx); return statements(pn, stmts) && @@ -1989,10 +1989,10 @@ ASTSerializer::sourceElement(ParseNode *pn, MutableHandleValue dst) bool ASTSerializer::declaration(ParseNode *pn, MutableHandleValue dst) { - JS_ASSERT(pn->isKind(PNK_FUNCTION) || - pn->isKind(PNK_VAR) || - pn->isKind(PNK_LET) || - pn->isKind(PNK_CONST)); + MOZ_ASSERT(pn->isKind(PNK_FUNCTION) || + pn->isKind(PNK_VAR) || + pn->isKind(PNK_LET) || + pn->isKind(PNK_CONST)); switch (pn->getKind()) { case PNK_FUNCTION: @@ -2003,7 +2003,7 @@ ASTSerializer::declaration(ParseNode *pn, MutableHandleValue dst) return variableDeclaration(pn, false, dst); default: - JS_ASSERT(pn->isKind(PNK_LET)); + MOZ_ASSERT(pn->isKind(PNK_LET)); return variableDeclaration(pn, true, dst); } } @@ -2011,7 +2011,7 @@ ASTSerializer::declaration(ParseNode *pn, MutableHandleValue dst) bool ASTSerializer::variableDeclaration(ParseNode *pn, bool let, MutableHandleValue dst) { - JS_ASSERT(let ? pn->isKind(PNK_LET) : (pn->isKind(PNK_VAR) || pn->isKind(PNK_CONST))); + MOZ_ASSERT(let ? pn->isKind(PNK_LET) : (pn->isKind(PNK_VAR) || pn->isKind(PNK_CONST))); /* Later updated to VARDECL_CONST if we find a PND_CONST declarator. */ VarDeclKind kind = let ? VARDECL_LET : VARDECL_VAR; @@ -2041,8 +2041,8 @@ ASTSerializer::variableDeclarator(ParseNode *pn, VarDeclKind *pkind, MutableHand } else if (pn->isKind(PNK_ASSIGN)) { pnleft = pn->pn_left; pnright = pn->pn_right; - JS_ASSERT(pn->pn_pos.encloses(pnleft->pn_pos)); - JS_ASSERT(pn->pn_pos.encloses(pnright->pn_pos)); + MOZ_ASSERT(pn->pn_pos.encloses(pnleft->pn_pos)); + MOZ_ASSERT(pn->pn_pos.encloses(pnright->pn_pos)); } else { /* This happens for a destructuring declarator in a for-in/of loop. */ pnleft = pn; @@ -2058,8 +2058,8 @@ ASTSerializer::variableDeclarator(ParseNode *pn, VarDeclKind *pkind, MutableHand bool ASTSerializer::let(ParseNode *pn, bool expr, MutableHandleValue dst) { - JS_ASSERT(pn->pn_pos.encloses(pn->pn_left->pn_pos)); - JS_ASSERT(pn->pn_pos.encloses(pn->pn_right->pn_pos)); + MOZ_ASSERT(pn->pn_pos.encloses(pn->pn_left->pn_pos)); + MOZ_ASSERT(pn->pn_pos.encloses(pn->pn_right->pn_pos)); ParseNode *letHead = pn->pn_left; LOCAL_ASSERT(letHead->isArity(PN_LIST)); @@ -2095,9 +2095,9 @@ ASTSerializer::let(ParseNode *pn, bool expr, MutableHandleValue dst) bool ASTSerializer::importDeclaration(ParseNode *pn, MutableHandleValue dst) { - JS_ASSERT(pn->isKind(PNK_IMPORT)); - JS_ASSERT(pn->pn_left->isKind(PNK_IMPORT_SPEC_LIST)); - JS_ASSERT(pn->pn_right->isKind(PNK_STRING)); + MOZ_ASSERT(pn->isKind(PNK_IMPORT)); + MOZ_ASSERT(pn->pn_left->isKind(PNK_IMPORT_SPEC_LIST)); + MOZ_ASSERT(pn->pn_right->isKind(PNK_STRING)); NodeVector elts(cx); if (!elts.reserve(pn->pn_count)) @@ -2118,7 +2118,7 @@ ASTSerializer::importDeclaration(ParseNode *pn, MutableHandleValue dst) bool ASTSerializer::importSpecifier(ParseNode *pn, MutableHandleValue dst) { - JS_ASSERT(pn->isKind(PNK_IMPORT_SPEC)); + MOZ_ASSERT(pn->isKind(PNK_IMPORT_SPEC)); RootedValue importName(cx); RootedValue bindingName(cx); @@ -2130,7 +2130,7 @@ ASTSerializer::importSpecifier(ParseNode *pn, MutableHandleValue dst) bool ASTSerializer::exportDeclaration(ParseNode *pn, MutableHandleValue dst) { - JS_ASSERT(pn->isKind(PNK_EXPORT) || pn->isKind(PNK_EXPORT_FROM)); + MOZ_ASSERT(pn->isKind(PNK_EXPORT) || pn->isKind(PNK_EXPORT_FROM)); JS_ASSERT_IF(pn->isKind(PNK_EXPORT_FROM), pn->pn_right->isKind(PNK_STRING)); RootedValue decl(cx, NullValue()); @@ -2181,7 +2181,7 @@ ASTSerializer::exportDeclaration(ParseNode *pn, MutableHandleValue dst) bool ASTSerializer::exportSpecifier(ParseNode *pn, MutableHandleValue dst) { - JS_ASSERT(pn->isKind(PNK_EXPORT_SPEC)); + MOZ_ASSERT(pn->isKind(PNK_EXPORT_SPEC)); RootedValue bindingName(cx); RootedValue exportName(cx); @@ -2194,7 +2194,7 @@ bool ASTSerializer::switchCase(ParseNode *pn, MutableHandleValue dst) { JS_ASSERT_IF(pn->pn_left, pn->pn_pos.encloses(pn->pn_left->pn_pos)); - JS_ASSERT(pn->pn_pos.encloses(pn->pn_right->pn_pos)); + MOZ_ASSERT(pn->pn_pos.encloses(pn->pn_right->pn_pos)); NodeVector stmts(cx); @@ -2208,8 +2208,8 @@ ASTSerializer::switchCase(ParseNode *pn, MutableHandleValue dst) bool ASTSerializer::switchStatement(ParseNode *pn, MutableHandleValue dst) { - JS_ASSERT(pn->pn_pos.encloses(pn->pn_left->pn_pos)); - JS_ASSERT(pn->pn_pos.encloses(pn->pn_right->pn_pos)); + MOZ_ASSERT(pn->pn_pos.encloses(pn->pn_left->pn_pos)); + MOZ_ASSERT(pn->pn_pos.encloses(pn->pn_right->pn_pos)); RootedValue disc(cx); @@ -2244,9 +2244,9 @@ ASTSerializer::switchStatement(ParseNode *pn, MutableHandleValue dst) bool ASTSerializer::catchClause(ParseNode *pn, bool *isGuarded, MutableHandleValue dst) { - JS_ASSERT(pn->pn_pos.encloses(pn->pn_kid1->pn_pos)); + MOZ_ASSERT(pn->pn_pos.encloses(pn->pn_kid1->pn_pos)); JS_ASSERT_IF(pn->pn_kid2, pn->pn_pos.encloses(pn->pn_kid2->pn_pos)); - JS_ASSERT(pn->pn_pos.encloses(pn->pn_kid3->pn_pos)); + MOZ_ASSERT(pn->pn_pos.encloses(pn->pn_kid3->pn_pos)); RootedValue var(cx), guard(cx), body(cx); @@ -2264,7 +2264,7 @@ ASTSerializer::catchClause(ParseNode *pn, bool *isGuarded, MutableHandleValue ds bool ASTSerializer::tryStatement(ParseNode *pn, MutableHandleValue dst) { - JS_ASSERT(pn->pn_pos.encloses(pn->pn_kid1->pn_pos)); + MOZ_ASSERT(pn->pn_pos.encloses(pn->pn_kid1->pn_pos)); JS_ASSERT_IF(pn->pn_kid2, pn->pn_pos.encloses(pn->pn_kid2->pn_pos)); JS_ASSERT_IF(pn->pn_kid3, pn->pn_pos.encloses(pn->pn_kid3->pn_pos)); @@ -2375,8 +2375,8 @@ ASTSerializer::statement(ParseNode *pn, MutableHandleValue dst) case PNK_IF: { - JS_ASSERT(pn->pn_pos.encloses(pn->pn_kid1->pn_pos)); - JS_ASSERT(pn->pn_pos.encloses(pn->pn_kid2->pn_pos)); + MOZ_ASSERT(pn->pn_pos.encloses(pn->pn_kid1->pn_pos)); + MOZ_ASSERT(pn->pn_pos.encloses(pn->pn_kid2->pn_pos)); JS_ASSERT_IF(pn->pn_kid3, pn->pn_pos.encloses(pn->pn_kid3->pn_pos)); RootedValue test(cx), cons(cx), alt(cx); @@ -2396,8 +2396,8 @@ ASTSerializer::statement(ParseNode *pn, MutableHandleValue dst) case PNK_WITH: case PNK_WHILE: { - JS_ASSERT(pn->pn_pos.encloses(pn->pn_left->pn_pos)); - JS_ASSERT(pn->pn_pos.encloses(pn->pn_right->pn_pos)); + MOZ_ASSERT(pn->pn_pos.encloses(pn->pn_left->pn_pos)); + MOZ_ASSERT(pn->pn_pos.encloses(pn->pn_right->pn_pos)); RootedValue expr(cx), stmt(cx); @@ -2410,8 +2410,8 @@ ASTSerializer::statement(ParseNode *pn, MutableHandleValue dst) case PNK_DOWHILE: { - JS_ASSERT(pn->pn_pos.encloses(pn->pn_left->pn_pos)); - JS_ASSERT(pn->pn_pos.encloses(pn->pn_right->pn_pos)); + MOZ_ASSERT(pn->pn_pos.encloses(pn->pn_left->pn_pos)); + MOZ_ASSERT(pn->pn_pos.encloses(pn->pn_right->pn_pos)); RootedValue stmt(cx), test(cx); @@ -2422,8 +2422,8 @@ ASTSerializer::statement(ParseNode *pn, MutableHandleValue dst) case PNK_FOR: { - JS_ASSERT(pn->pn_pos.encloses(pn->pn_left->pn_pos)); - JS_ASSERT(pn->pn_pos.encloses(pn->pn_right->pn_pos)); + MOZ_ASSERT(pn->pn_pos.encloses(pn->pn_left->pn_pos)); + MOZ_ASSERT(pn->pn_pos.encloses(pn->pn_right->pn_pos)); ParseNode *head = pn->pn_left; @@ -2478,7 +2478,7 @@ ASTSerializer::statement(ParseNode *pn, MutableHandleValue dst) return false; ParseNode *head = loop->pn_left; - JS_ASSERT(head->isKind(PNK_FORIN)); + MOZ_ASSERT(head->isKind(PNK_FORIN)); RootedValue stmt(cx); @@ -2498,7 +2498,7 @@ ASTSerializer::statement(ParseNode *pn, MutableHandleValue dst) case PNK_LABEL: { - JS_ASSERT(pn->pn_pos.encloses(pn->pn_expr->pn_pos)); + MOZ_ASSERT(pn->pn_pos.encloses(pn->pn_expr->pn_pos)); RootedValue label(cx), stmt(cx); RootedAtom pnAtom(cx, pn->as().label()); @@ -2534,8 +2534,8 @@ ASTSerializer::statement(ParseNode *pn, MutableHandleValue dst) bool ASTSerializer::leftAssociate(ParseNode *pn, MutableHandleValue dst) { - JS_ASSERT(pn->isArity(PN_LIST)); - JS_ASSERT(pn->pn_count >= 1); + MOZ_ASSERT(pn->isArity(PN_LIST)); + MOZ_ASSERT(pn->pn_count >= 1); ParseNodeKind kind = pn->getKind(); bool lor = kind == PNK_OR; @@ -2674,9 +2674,9 @@ ASTSerializer::expression(ParseNode *pn, MutableHandleValue dst) case PNK_CONDITIONAL: { - JS_ASSERT(pn->pn_pos.encloses(pn->pn_kid1->pn_pos)); - JS_ASSERT(pn->pn_pos.encloses(pn->pn_kid2->pn_pos)); - JS_ASSERT(pn->pn_pos.encloses(pn->pn_kid3->pn_pos)); + MOZ_ASSERT(pn->pn_pos.encloses(pn->pn_kid1->pn_pos)); + MOZ_ASSERT(pn->pn_pos.encloses(pn->pn_kid2->pn_pos)); + MOZ_ASSERT(pn->pn_pos.encloses(pn->pn_kid3->pn_pos)); RootedValue test(cx), cons(cx), alt(cx); @@ -2690,8 +2690,8 @@ ASTSerializer::expression(ParseNode *pn, MutableHandleValue dst) case PNK_AND: { if (pn->isArity(PN_BINARY)) { - JS_ASSERT(pn->pn_pos.encloses(pn->pn_left->pn_pos)); - JS_ASSERT(pn->pn_pos.encloses(pn->pn_right->pn_pos)); + MOZ_ASSERT(pn->pn_pos.encloses(pn->pn_left->pn_pos)); + MOZ_ASSERT(pn->pn_pos.encloses(pn->pn_right->pn_pos)); RootedValue left(cx), right(cx); return expression(pn->pn_left, &left) && @@ -2704,7 +2704,7 @@ ASTSerializer::expression(ParseNode *pn, MutableHandleValue dst) case PNK_PREINCREMENT: case PNK_PREDECREMENT: { - JS_ASSERT(pn->pn_pos.encloses(pn->pn_kid->pn_pos)); + MOZ_ASSERT(pn->pn_pos.encloses(pn->pn_kid->pn_pos)); bool inc = pn->isKind(PNK_PREINCREMENT); RootedValue expr(cx); @@ -2715,7 +2715,7 @@ ASTSerializer::expression(ParseNode *pn, MutableHandleValue dst) case PNK_POSTINCREMENT: case PNK_POSTDECREMENT: { - JS_ASSERT(pn->pn_pos.encloses(pn->pn_kid->pn_pos)); + MOZ_ASSERT(pn->pn_pos.encloses(pn->pn_kid->pn_pos)); bool inc = pn->isKind(PNK_POSTINCREMENT); RootedValue expr(cx); @@ -2736,8 +2736,8 @@ ASTSerializer::expression(ParseNode *pn, MutableHandleValue dst) case PNK_DIVASSIGN: case PNK_MODASSIGN: { - JS_ASSERT(pn->pn_pos.encloses(pn->pn_left->pn_pos)); - JS_ASSERT(pn->pn_pos.encloses(pn->pn_right->pn_pos)); + MOZ_ASSERT(pn->pn_pos.encloses(pn->pn_left->pn_pos)); + MOZ_ASSERT(pn->pn_pos.encloses(pn->pn_right->pn_pos)); AssignmentOperator op = aop(pn->getOp()); LOCAL_ASSERT(op > AOP_ERR && op < AOP_LIMIT); @@ -2770,8 +2770,8 @@ ASTSerializer::expression(ParseNode *pn, MutableHandleValue dst) case PNK_IN: case PNK_INSTANCEOF: if (pn->isArity(PN_BINARY)) { - JS_ASSERT(pn->pn_pos.encloses(pn->pn_left->pn_pos)); - JS_ASSERT(pn->pn_pos.encloses(pn->pn_right->pn_pos)); + MOZ_ASSERT(pn->pn_pos.encloses(pn->pn_left->pn_pos)); + MOZ_ASSERT(pn->pn_pos.encloses(pn->pn_right->pn_pos)); BinaryOperator op = binop(pn->getKind(), pn->getOp()); LOCAL_ASSERT(op > BINOP_ERR && op < BINOP_LIMIT); @@ -2790,7 +2790,7 @@ ASTSerializer::expression(ParseNode *pn, MutableHandleValue dst) case PNK_BITNOT: case PNK_POS: case PNK_NEG: { - JS_ASSERT(pn->pn_pos.encloses(pn->pn_kid->pn_pos)); + MOZ_ASSERT(pn->pn_pos.encloses(pn->pn_kid->pn_pos)); UnaryOperator op = unop(pn->getKind(), pn->getOp()); LOCAL_ASSERT(op > UNOP_ERR && op < UNOP_LIMIT); @@ -2810,7 +2810,7 @@ ASTSerializer::expression(ParseNode *pn, MutableHandleValue dst) case PNK_CALL: { ParseNode *next = pn->pn_head; - JS_ASSERT(pn->pn_pos.encloses(next->pn_pos)); + MOZ_ASSERT(pn->pn_pos.encloses(next->pn_pos)); RootedValue callee(cx); if (!expression(next, &callee)) @@ -2821,7 +2821,7 @@ ASTSerializer::expression(ParseNode *pn, MutableHandleValue dst) return false; for (next = next->pn_next; next; next = next->pn_next) { - JS_ASSERT(pn->pn_pos.encloses(next->pn_pos)); + MOZ_ASSERT(pn->pn_pos.encloses(next->pn_pos)); RootedValue arg(cx); if (!expression(next, &arg)) @@ -2840,7 +2840,7 @@ ASTSerializer::expression(ParseNode *pn, MutableHandleValue dst) case PNK_DOT: { - JS_ASSERT(pn->pn_pos.encloses(pn->pn_expr->pn_pos)); + MOZ_ASSERT(pn->pn_pos.encloses(pn->pn_expr->pn_pos)); RootedValue expr(cx), id(cx); RootedAtom pnAtom(cx, pn->pn_atom); @@ -2851,8 +2851,8 @@ ASTSerializer::expression(ParseNode *pn, MutableHandleValue dst) case PNK_ELEM: { - JS_ASSERT(pn->pn_pos.encloses(pn->pn_left->pn_pos)); - JS_ASSERT(pn->pn_pos.encloses(pn->pn_right->pn_pos)); + MOZ_ASSERT(pn->pn_pos.encloses(pn->pn_left->pn_pos)); + MOZ_ASSERT(pn->pn_pos.encloses(pn->pn_right->pn_pos)); RootedValue left(cx), right(cx); return expression(pn->pn_left, &left) && @@ -2866,7 +2866,7 @@ ASTSerializer::expression(ParseNode *pn, MutableHandleValue dst) if (!raw.reserve(pn->pn_head->pn_count)) return false; for (ParseNode *next = pn->pn_head->pn_head; next; next = next->pn_next) { - JS_ASSERT(pn->pn_pos.encloses(next->pn_pos)); + MOZ_ASSERT(pn->pn_pos.encloses(next->pn_pos)); RootedValue expr(cx); expr.setString(next->pn_atom); @@ -2878,7 +2878,7 @@ ASTSerializer::expression(ParseNode *pn, MutableHandleValue dst) return false; for (ParseNode *next = pn->pn_head->pn_next; next; next = next->pn_next) { - JS_ASSERT(pn->pn_pos.encloses(next->pn_pos)); + MOZ_ASSERT(pn->pn_pos.encloses(next->pn_pos)); RootedValue expr(cx); expr.setString(next->pn_atom); @@ -2895,7 +2895,7 @@ ASTSerializer::expression(ParseNode *pn, MutableHandleValue dst) return false; for (ParseNode *next = pn->pn_head; next; next = next->pn_next) { - JS_ASSERT(pn->pn_pos.encloses(next->pn_pos)); + MOZ_ASSERT(pn->pn_pos.encloses(next->pn_pos)); if (next->isKind(PNK_ELISION)) { elts.infallibleAppend(NullValue()); @@ -2931,7 +2931,7 @@ ASTSerializer::expression(ParseNode *pn, MutableHandleValue dst) return false; for (ParseNode *next = pn->pn_head; next; next = next->pn_next) { - JS_ASSERT(pn->pn_pos.encloses(next->pn_pos)); + MOZ_ASSERT(pn->pn_pos.encloses(next->pn_pos)); RootedValue prop(cx); if (!property(next, &prop)) @@ -2955,7 +2955,7 @@ ASTSerializer::expression(ParseNode *pn, MutableHandleValue dst) return false; for (ParseNode *next = pn->pn_head; next; next = next->pn_next) { - JS_ASSERT(pn->pn_pos.encloses(next->pn_pos)); + MOZ_ASSERT(pn->pn_pos.encloses(next->pn_pos)); RootedValue expr(cx); if (!expression(next, &expr)) @@ -2977,7 +2977,7 @@ ASTSerializer::expression(ParseNode *pn, MutableHandleValue dst) case PNK_YIELD_STAR: { - JS_ASSERT(pn->pn_pos.encloses(pn->pn_kid->pn_pos)); + MOZ_ASSERT(pn->pn_pos.encloses(pn->pn_kid->pn_pos)); RootedValue arg(cx); return expression(pn->pn_kid, &arg) && @@ -2994,7 +2994,7 @@ ASTSerializer::expression(ParseNode *pn, MutableHandleValue dst) } case PNK_ARRAYCOMP: - JS_ASSERT(pn->pn_pos.encloses(pn->pn_head->pn_pos)); + MOZ_ASSERT(pn->pn_pos.encloses(pn->pn_head->pn_pos)); /* NB: it's no longer the case that pn_count could be 2. */ LOCAL_ASSERT(pn->pn_count == 1); @@ -3107,7 +3107,7 @@ ASTSerializer::literal(ParseNode *pn, MutableHandleValue dst) bool ASTSerializer::arrayPattern(ParseNode *pn, VarDeclKind *pkind, MutableHandleValue dst) { - JS_ASSERT(pn->isKind(PNK_ARRAY)); + MOZ_ASSERT(pn->isKind(PNK_ARRAY)); NodeVector elts(cx); if (!elts.reserve(pn->pn_count)) @@ -3340,7 +3340,7 @@ ASTSerializer::functionArgs(ParseNode *pn, ParseNode *pnargs, ParseNode *pndestr * index in the formals list, so we rely on the ability to * ask destructuring args their index above. */ - JS_ASSERT(arg->isKind(PNK_NAME) || arg->isKind(PNK_ASSIGN)); + MOZ_ASSERT(arg->isKind(PNK_NAME) || arg->isKind(PNK_ASSIGN)); ParseNode *argName = arg->isKind(PNK_NAME) ? arg : arg->pn_left; if (!identifier(argName, &node)) return false; @@ -3360,7 +3360,7 @@ ASTSerializer::functionArgs(ParseNode *pn, ParseNode *pnargs, ParseNode *pndestr } ++i; } - JS_ASSERT(!rest.isUndefined()); + MOZ_ASSERT(!rest.isUndefined()); return true; } diff --git a/js/src/jsscript.cpp b/js/src/jsscript.cpp index ffe511a8f890..388ff5abefad 100644 --- a/js/src/jsscript.cpp +++ b/js/src/jsscript.cpp @@ -80,18 +80,18 @@ Bindings::initWithTemporaryStorage(ExclusiveContext *cx, InternalBindingsHandle uint32_t numBodyLevelLexicals, uint32_t numBlockScoped, Binding *bindingArray) { - JS_ASSERT(!self->callObjShape_); - JS_ASSERT(self->bindingArrayAndFlag_ == TEMPORARY_STORAGE_BIT); - JS_ASSERT(!(uintptr_t(bindingArray) & TEMPORARY_STORAGE_BIT)); - JS_ASSERT(numArgs <= ARGC_LIMIT); - JS_ASSERT(numVars <= LOCALNO_LIMIT); - JS_ASSERT(numBlockScoped <= LOCALNO_LIMIT); - JS_ASSERT(numBodyLevelLexicals <= LOCALNO_LIMIT); + 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); - JS_ASSERT(totalSlots <= LOCALNO_LIMIT); - JS_ASSERT(UINT32_MAX - numArgs >= totalSlots); + MOZ_ASSERT(totalSlots <= LOCALNO_LIMIT); + MOZ_ASSERT(UINT32_MAX - numArgs >= totalSlots); self->bindingArrayAndFlag_ = uintptr_t(bindingArray) | TEMPORARY_STORAGE_BIT; self->numArgs_ = numArgs; @@ -157,7 +157,7 @@ Bindings::initWithTemporaryStorage(ExclusiveContext *cx, InternalBindingsHandle #ifdef DEBUG // The caller ensures no duplicate aliased names. - JS_ASSERT(!added.has(bi->name())); + MOZ_ASSERT(!added.has(bi->name())); if (!added.put(bi->name())) return false; #endif @@ -178,12 +178,12 @@ Bindings::initWithTemporaryStorage(ExclusiveContext *cx, InternalBindingsHandle if (!shape) return false; - JS_ASSERT(slot < nslots); + MOZ_ASSERT(slot < nslots); slot++; } - JS_ASSERT(slot == nslots); + MOZ_ASSERT(slot == nslots); - JS_ASSERT(!shape->inDictionary()); + MOZ_ASSERT(!shape->inDictionary()); self->callObjShape_.init(shape); return true; } @@ -191,8 +191,8 @@ Bindings::initWithTemporaryStorage(ExclusiveContext *cx, InternalBindingsHandle uint8_t * Bindings::switchToScriptStorage(Binding *newBindingArray) { - JS_ASSERT(bindingArrayUsingTemporaryStorage()); - JS_ASSERT(!(uintptr_t(newBindingArray) & TEMPORARY_STORAGE_BIT)); + MOZ_ASSERT(bindingArrayUsingTemporaryStorage()); + MOZ_ASSERT(!(uintptr_t(newBindingArray) & TEMPORARY_STORAGE_BIT)); if (count() > 0) PodCopy(newBindingArray, bindingArray(), count()); @@ -207,8 +207,8 @@ Bindings::clone(JSContext *cx, InternalBindingsHandle self, /* The clone has the same bindingArray_ offset as 'src'. */ Bindings &src = srcScript->bindings; ptrdiff_t off = (uint8_t *)src.bindingArray() - srcScript->data; - JS_ASSERT(off >= 0); - JS_ASSERT(size_t(off) <= srcScript->dataSize()); + MOZ_ASSERT(off >= 0); + MOZ_ASSERT(size_t(off) <= srcScript->dataSize()); Binding *dstPackedBindings = (Binding *)(dstScriptData + off); /* @@ -294,7 +294,7 @@ XDRScriptBindings(XDRState *xdr, LifoAllocScope &las, uint16_t numArgs, ui bool Bindings::bindingIsAliased(uint32_t bindingIndex) { - JS_ASSERT(bindingIndex < count()); + MOZ_ASSERT(bindingIndex < count()); return bindingArray()[bindingIndex].aliased(); } @@ -371,7 +371,7 @@ js::XDRScriptConst(XDRState *xdr, MutableHandleValue vp) } else if (vp.isMagic(JS_ELEMENTS_HOLE)) { tag = SCRIPT_HOLE; } else { - JS_ASSERT(vp.isUndefined()); + MOZ_ASSERT(vp.isUndefined()); tag = SCRIPT_VOID; } } @@ -625,7 +625,7 @@ js::XDRScript(XDRState *xdr, HandleObject enclosingScope, HandleScript enc if (mode == XDR_ENCODE) { prologLength = script->mainOffset(); - JS_ASSERT(script->getVersion() != JSVERSION_UNKNOWN); + MOZ_ASSERT(script->getVersion() != JSVERSION_UNKNOWN); version = script->getVersion(); lineno = script->lineno(); column = script->column(); @@ -718,7 +718,7 @@ js::XDRScript(XDRState *xdr, HandleObject enclosingScope, HandleScript enc if (mode == XDR_DECODE) { JSVersion version_ = JSVersion(version); - JS_ASSERT((version_ & VersionFlags::MASK) == unsigned(version_)); + MOZ_ASSERT((version_ & VersionFlags::MASK) == unsigned(version_)); // staticLevel is set below. CompileOptions options(cx); @@ -745,11 +745,11 @@ js::XDRScript(XDRState *xdr, HandleObject enclosingScope, HandleScript enc !ScriptSourceObject::initFromOptions(cx, sourceObject, options)) return false; } else { - JS_ASSERT(enclosingScript); + MOZ_ASSERT(enclosingScript); // When decoding, all the scripts and the script source object // are in the same compartment, so the script's source object // should never be a cross-compartment wrapper. - JS_ASSERT(enclosingScript->sourceObject()->is()); + MOZ_ASSERT(enclosingScript->sourceObject()->is()); sourceObject = &enclosingScript->sourceObject()->as(); } script = JSScript::Create(cx, enclosingScope, !!(scriptBits & (1 << SavedCallerFun)), @@ -770,7 +770,7 @@ js::XDRScript(XDRState *xdr, HandleObject enclosingScope, HandleScript enc return false; } - JS_ASSERT(!script->mainOffset()); + MOZ_ASSERT(!script->mainOffset()); script->mainOffset_ = prologLength; script->setLength(length); script->funLength_ = funLength; @@ -803,7 +803,7 @@ js::XDRScript(XDRState *xdr, HandleObject enclosingScope, HandleScript enc script->treatAsRunOnce_ = true; if (scriptBits & (1 << IsLegacyGenerator)) { - JS_ASSERT(!(scriptBits & (1 << IsStarGenerator))); + MOZ_ASSERT(!(scriptBits & (1 << IsStarGenerator))); script->setGeneratorKind(LegacyGenerator); } else if (scriptBits & (1 << IsStarGenerator)) script->setGeneratorKind(StarGenerator); @@ -929,7 +929,7 @@ js::XDRScript(XDRState *xdr, HandleObject enclosingScope, HandleScript enc Rooted enclosingStaticScope(cx); if (mode == XDR_DECODE) { if (enclosingStaticScopeIndex != UINT32_MAX) { - JS_ASSERT(enclosingStaticScopeIndex < i); + MOZ_ASSERT(enclosingStaticScopeIndex < i); enclosingStaticScope = script->objects()->vector[enclosingStaticScopeIndex]; } else { enclosingStaticScope = fun; @@ -964,14 +964,14 @@ js::XDRScript(XDRState *xdr, HandleObject enclosingScope, HandleScript enc StaticScopeIter ssi(funEnclosingScope); if (ssi.done() || ssi.type() == StaticScopeIter::FUNCTION) { - JS_ASSERT(ssi.done() == !fun); + MOZ_ASSERT(ssi.done() == !fun); funEnclosingScopeIndex = UINT32_MAX; } else if (ssi.type() == StaticScopeIter::BLOCK) { funEnclosingScopeIndex = FindScopeObjectIndex(script, ssi.block()); - JS_ASSERT(funEnclosingScopeIndex < i); + MOZ_ASSERT(funEnclosingScopeIndex < i); } else { funEnclosingScopeIndex = FindScopeObjectIndex(script, ssi.staticWith()); - JS_ASSERT(funEnclosingScopeIndex < i); + MOZ_ASSERT(funEnclosingScopeIndex < i); } } @@ -982,7 +982,7 @@ js::XDRScript(XDRState *xdr, HandleObject enclosingScope, HandleScript enc if (funEnclosingScopeIndex == UINT32_MAX) { funEnclosingScope = fun; } else { - JS_ASSERT(funEnclosingScopeIndex < i); + MOZ_ASSERT(funEnclosingScopeIndex < i); funEnclosingScope = script->objects()->vector[funEnclosingScopeIndex]; } } @@ -1018,7 +1018,7 @@ js::XDRScript(XDRState *xdr, HandleObject enclosingScope, HandleScript enc if (ntrynotes != 0) { JSTryNote *tnfirst = script->trynotes()->vector; - JS_ASSERT(script->trynotes()->length == ntrynotes); + MOZ_ASSERT(script->trynotes()->length == ntrynotes); JSTryNote *tn = tnfirst + ntrynotes; do { --tn; @@ -1133,7 +1133,7 @@ js::XDRLazyScript(XDRState *xdr, HandleObject enclosingScope, HandleScript } if (mode == XDR_DECODE) { - JS_ASSERT(!lazy->sourceObject()); + MOZ_ASSERT(!lazy->sourceObject()); ScriptSourceObject *sourceObject = &enclosingScript->scriptSourceUnwrap(); // Set the enclosing scope of the lazy function, this would later be @@ -1155,7 +1155,7 @@ js::XDRLazyScript(XDRState *, HandleObject, HandleScript, void JSScript::setSourceObject(JSObject *object) { - JS_ASSERT(compartment() == object->compartment()); + MOZ_ASSERT(compartment() == object->compartment()); sourceObject_ = object; } @@ -1172,7 +1172,7 @@ JSScript::scriptSource() const { bool JSScript::initScriptCounts(JSContext *cx) { - JS_ASSERT(!hasScriptCounts()); + MOZ_ASSERT(!hasScriptCounts()); size_t n = 0; @@ -1203,7 +1203,7 @@ JSScript::initScriptCounts(JSContext *cx) cursor += length() * sizeof(PCCounts); for (jsbytecode *pc = code(); pc < codeEnd(); pc += GetBytecodeLength(pc)) { - JS_ASSERT(uintptr_t(cursor) % sizeof(double) == 0); + MOZ_ASSERT(uintptr_t(cursor) % sizeof(double) == 0); scriptCounts.pcCountsVector[pcToOffset(pc)].counts = (double *) cursor; size_t capacity = PCCounts::numCounts(JSOp(*pc)); #ifdef DEBUG @@ -1218,7 +1218,7 @@ JSScript::initScriptCounts(JSContext *cx) } hasScriptCounts_ = true; // safe to set this; we can't fail after this point - JS_ASSERT(size_t(cursor - base) == nbytes); + MOZ_ASSERT(size_t(cursor - base) == nbytes); /* Enable interrupts in any interpreter frames running on this script. */ for (ActivationIterator iter(cx->runtime()); !iter.done(); ++iter) { @@ -1231,16 +1231,16 @@ JSScript::initScriptCounts(JSContext *cx) static inline ScriptCountsMap::Ptr GetScriptCountsMapEntry(JSScript *script) { - JS_ASSERT(script->hasScriptCounts()); + MOZ_ASSERT(script->hasScriptCounts()); ScriptCountsMap *map = script->compartment()->scriptCountsMap; ScriptCountsMap::Ptr p = map->lookup(script); - JS_ASSERT(p); + MOZ_ASSERT(p); return p; } js::PCCounts JSScript::getPCCounts(jsbytecode *pc) { - JS_ASSERT(containsPC(pc)); + MOZ_ASSERT(containsPC(pc)); ScriptCountsMap::Ptr p = GetScriptCountsMapEntry(this); return p->value().pcCountsVector[pcToOffset(pc)]; } @@ -1383,7 +1383,7 @@ ScriptSourceObject::initFromOptions(JSContext *cx, HandleScriptSource source, /* static */ bool JSScript::loadSource(JSContext *cx, ScriptSource *ss, bool *worked) { - JS_ASSERT(!ss->hasSourceData()); + MOZ_ASSERT(!ss->hasSourceData()); *worked = false; if (!cx->runtime()->sourceHook || !ss->sourceRetrievable()) return true; @@ -1401,7 +1401,7 @@ JSScript::loadSource(JSContext *cx, ScriptSource *ss, bool *worked) JSFlatString * JSScript::sourceData(JSContext *cx) { - JS_ASSERT(scriptSource()->hasSourceData()); + MOZ_ASSERT(scriptSource()->hasSourceData()); return scriptSource()->substring(cx, sourceStart(), sourceEnd()); } @@ -1415,7 +1415,7 @@ UncompressedSourceCache::AutoHoldEntry::holdEntry(UncompressedSourceCache *cache { // Initialise the holder for a specific cache and script source. This will // hold on to the cached source chars in the event that the cache is purged. - JS_ASSERT(!cache_ && !source_ && !charsToFree_); + MOZ_ASSERT(!cache_ && !source_ && !charsToFree_); cache_ = cache; source_ = source; } @@ -1425,7 +1425,7 @@ UncompressedSourceCache::AutoHoldEntry::deferDelete(const char16_t *chars) { // Take ownership of source chars now the cache is being purged. Remove our // reference to the ScriptSource which might soon be destroyed. - JS_ASSERT(cache_ && source_ && !charsToFree_); + MOZ_ASSERT(cache_ && source_ && !charsToFree_); cache_ = nullptr; source_ = nullptr; charsToFree_ = chars; @@ -1436,10 +1436,10 @@ UncompressedSourceCache::AutoHoldEntry::~AutoHoldEntry() // The holder is going out of scope. If it has taken ownership of cached // chars then delete them, otherwise unregister ourself with the cache. if (charsToFree_) { - JS_ASSERT(!cache_ && !source_); + MOZ_ASSERT(!cache_ && !source_); js_free(const_cast(charsToFree_)); } else if (cache_) { - JS_ASSERT(source_); + MOZ_ASSERT(source_); cache_->releaseEntry(*this); } } @@ -1447,7 +1447,7 @@ UncompressedSourceCache::AutoHoldEntry::~AutoHoldEntry() void UncompressedSourceCache::holdEntry(AutoHoldEntry &holder, ScriptSource *ss) { - JS_ASSERT(!holder_); + MOZ_ASSERT(!holder_); holder.holdEntry(this, ss); holder_ = &holder; } @@ -1455,14 +1455,14 @@ UncompressedSourceCache::holdEntry(AutoHoldEntry &holder, ScriptSource *ss) void UncompressedSourceCache::releaseEntry(AutoHoldEntry &holder) { - JS_ASSERT(holder_ == &holder); + MOZ_ASSERT(holder_ == &holder); holder_ = nullptr; } const char16_t * UncompressedSourceCache::lookup(ScriptSource *ss, AutoHoldEntry &holder) { - JS_ASSERT(!holder_); + MOZ_ASSERT(!holder_); if (!map_) return nullptr; if (Map::Ptr p = map_->lookup(ss)) { @@ -1475,7 +1475,7 @@ UncompressedSourceCache::lookup(ScriptSource *ss, AutoHoldEntry &holder) bool UncompressedSourceCache::put(ScriptSource *ss, const char16_t *str, AutoHoldEntry &holder) { - JS_ASSERT(!holder_); + MOZ_ASSERT(!holder_); if (!map_) { map_ = js_new(); @@ -1575,7 +1575,7 @@ ScriptSource::chars(JSContext *cx, UncompressedSourceCache::AutoHoldEntry &holde JSFlatString * ScriptSource::substring(JSContext *cx, uint32_t start, uint32_t stop) { - JS_ASSERT(start <= stop); + MOZ_ASSERT(start <= stop); UncompressedSourceCache::AutoHoldEntry holder; const char16_t *chars = this->chars(cx, holder); if (!chars) @@ -1586,7 +1586,7 @@ ScriptSource::substring(JSContext *cx, uint32_t start, uint32_t stop) JSFlatString * ScriptSource::substringDontDeflate(JSContext *cx, uint32_t start, uint32_t stop) { - JS_ASSERT(start <= stop); + MOZ_ASSERT(start <= stop); UncompressedSourceCache::AutoHoldEntry holder; const char16_t *chars = this->chars(cx, holder); if (!chars) @@ -1597,7 +1597,7 @@ ScriptSource::substringDontDeflate(JSContext *cx, uint32_t start, uint32_t stop) void ScriptSource::setSource(const char16_t *chars, size_t length, bool ownsChars /* = true */) { - JS_ASSERT(dataType == DataMissing); + MOZ_ASSERT(dataType == DataMissing); dataType = DataUncompressed; data.uncompressed.chars = chars; @@ -1609,7 +1609,7 @@ ScriptSource::setSource(const char16_t *chars, size_t length, bool ownsChars /* void ScriptSource::setCompressedSource(JSRuntime *maybert, void *raw, size_t nbytes, HashNumber hash) { - JS_ASSERT(dataType == DataMissing || dataType == DataUncompressed); + MOZ_ASSERT(dataType == DataMissing || dataType == DataUncompressed); if (dataType == DataUncompressed && ownsUncompressedChars()) js_free(const_cast(uncompressedChars())); @@ -1625,8 +1625,8 @@ ScriptSource::setCompressedSource(JSRuntime *maybert, void *raw, size_t nbytes, void ScriptSource::updateCompressedSourceSet(JSRuntime *rt) { - JS_ASSERT(dataType == DataCompressed); - JS_ASSERT(!inCompressedSourceSet); + MOZ_ASSERT(dataType == DataCompressed); + MOZ_ASSERT(!inCompressedSourceSet); CompressedSourceSet::AddPtr p = rt->compressedSourceSet.lookupForAdd(this); if (p) { @@ -1648,7 +1648,7 @@ ScriptSource::updateCompressedSourceSet(JSRuntime *rt) bool ScriptSource::ensureOwnsSource(ExclusiveContext *cx) { - JS_ASSERT(dataType == DataUncompressed); + MOZ_ASSERT(dataType == DataUncompressed); if (ownsUncompressedChars()) return true; @@ -1666,7 +1666,7 @@ bool ScriptSource::setSourceCopy(ExclusiveContext *cx, SourceBufferHolder &srcBuf, bool argumentsNotIncluded, SourceCompressionTask *task) { - JS_ASSERT(!hasSourceData()); + MOZ_ASSERT(!hasSourceData()); argumentsNotIncluded_ = argumentsNotIncluded; bool owns = srcBuf.ownsChars(); @@ -1979,7 +1979,7 @@ FormatIntroducedFilename(ExclusiveContext *cx, const char *filename, unsigned li return nullptr; mozilla::DebugOnly checkLen = JS_snprintf(formatted, len, "%s line %s > %s", filename, linenoBuf, introducer); - JS_ASSERT(checkLen == len - 1); + MOZ_ASSERT(checkLen == len - 1); return formatted; } @@ -1987,8 +1987,8 @@ FormatIntroducedFilename(ExclusiveContext *cx, const char *filename, unsigned li bool ScriptSource::initFromOptions(ExclusiveContext *cx, const ReadOnlyCompileOptions &options) { - JS_ASSERT(!filename_); - JS_ASSERT(!introducerFilename_); + MOZ_ASSERT(!filename_); + MOZ_ASSERT(!introducerFilename_); mutedErrors_ = options.mutedErrors(); @@ -1996,7 +1996,7 @@ ScriptSource::initFromOptions(ExclusiveContext *cx, const ReadOnlyCompileOptions setIntroductionOffset(options.introductionOffset); if (options.hasIntroductionInfo) { - JS_ASSERT(options.introductionType != nullptr); + MOZ_ASSERT(options.introductionType != nullptr); const char *filename = options.filename() ? options.filename() : ""; char *formatted = FormatIntroducedFilename(cx, filename, options.introductionLineno, options.introductionType); @@ -2020,7 +2020,7 @@ ScriptSource::initFromOptions(ExclusiveContext *cx, const ReadOnlyCompileOptions bool ScriptSource::setFilename(ExclusiveContext *cx, const char *filename) { - JS_ASSERT(!filename_); + MOZ_ASSERT(!filename_); filename_ = DuplicateString(cx, filename); return filename_ != nullptr; } @@ -2028,7 +2028,7 @@ ScriptSource::setFilename(ExclusiveContext *cx, const char *filename) bool ScriptSource::setDisplayURL(ExclusiveContext *cx, const char16_t *displayURL) { - JS_ASSERT(displayURL); + MOZ_ASSERT(displayURL); if (hasDisplayURL()) { if (cx->isJSContext() && !JS_ReportErrorFlagsAndNumber(cx->asJSContext(), JSREPORT_WARNING, @@ -2050,7 +2050,7 @@ ScriptSource::setDisplayURL(ExclusiveContext *cx, const char16_t *displayURL) bool ScriptSource::setSourceMapURL(ExclusiveContext *cx, const char16_t *sourceMapURL) { - JS_ASSERT(sourceMapURL); + MOZ_ASSERT(sourceMapURL); if (hasSourceMapURL()) { // Warn about the replacement, but use the new one. if (cx->isJSContext()) { @@ -2115,7 +2115,7 @@ js::SharedScriptData::new_(ExclusiveContext *cx, uint32_t codeLength, * HeapPtrAtom array via atoms(). */ HeapPtrAtom *atoms = entry->atoms(); - JS_ASSERT(reinterpret_cast(atoms) % sizeof(JSAtom *) == 0); + MOZ_ASSERT(reinterpret_cast(atoms) % sizeof(JSAtom *) == 0); for (unsigned i = 0; i < natoms; ++i) new (&atoms[i]) HeapPtrAtom(); @@ -2132,8 +2132,8 @@ static bool SaveSharedScriptData(ExclusiveContext *cx, Handle script, SharedScriptData *ssd, uint32_t nsrcnotes) { - JS_ASSERT(script != nullptr); - JS_ASSERT(ssd != nullptr); + MOZ_ASSERT(script != nullptr); + MOZ_ASSERT(ssd != nullptr); AutoLockForExclusiveAccess lock(cx); @@ -2187,7 +2187,7 @@ MarkScriptData(JSRuntime *rt, const jsbytecode *bytecode) void js::UnmarkScriptData(JSRuntime *rt) { - JS_ASSERT(rt->gc.isFullGc()); + MOZ_ASSERT(rt->gc.isFullGc()); ScriptDataTable &table = rt->scriptDataTable(); for (ScriptDataTable::Enum e(table); !e.empty(); e.popFront()) { SharedScriptData *entry = e.front(); @@ -2198,7 +2198,7 @@ js::UnmarkScriptData(JSRuntime *rt) void js::SweepScriptData(JSRuntime *rt) { - JS_ASSERT(rt->gc.isFullGc()); + MOZ_ASSERT(rt->gc.isFullGc()); ScriptDataTable &table = rt->scriptDataTable(); if (rt->keepAtoms()) @@ -2357,7 +2357,7 @@ JSScript::Create(ExclusiveContext *cx, HandleObject enclosingScope, bool savedCa const ReadOnlyCompileOptions &options, unsigned staticLevel, HandleObject sourceObject, uint32_t bufStart, uint32_t bufEnd) { - JS_ASSERT(bufStart <= bufEnd); + MOZ_ASSERT(bufStart <= bufEnd); RootedScript script(cx, js_NewGCScript(cx)); if (!script) @@ -2375,7 +2375,7 @@ JSScript::Create(ExclusiveContext *cx, HandleObject enclosingScope, bool savedCa script->noScriptRval_ = options.noScriptRval; script->version = options.version; - JS_ASSERT(script->getVersion() == options.version); // assert that no overflow occurred + MOZ_ASSERT(script->getVersion() == options.version); // assert that no overflow occurred // This is an unsigned-to-uint16_t conversion, test for too-high values. // In practice, recursion in Parser and/or BytecodeEmitter will blow the @@ -2406,7 +2406,7 @@ AllocScriptData(JS::Zone *zone, size_t size) uint8_t *data = zone->pod_calloc(JS_ROUNDUP(size, sizeof(Value))); if (!data) return nullptr; - JS_ASSERT(size_t(data) % sizeof(Value) == 0); + MOZ_ASSERT(size_t(data) % sizeof(Value) == 0); return data; } @@ -2422,7 +2422,7 @@ JSScript::partiallyInit(ExclusiveContext *cx, HandleScript script, uint32_t ncon return false; script->dataSize_ = size; - JS_ASSERT(nTypeSets <= UINT16_MAX); + MOZ_ASSERT(nTypeSets <= UINT16_MAX); script->nTypeSets_ = uint16_t(nTypeSets); uint8_t *cursor = script->data; @@ -2448,7 +2448,7 @@ JSScript::partiallyInit(ExclusiveContext *cx, HandleScript script, uint32_t ncon } if (nconsts != 0) { - JS_ASSERT(reinterpret_cast(cursor) % sizeof(jsval) == 0); + MOZ_ASSERT(reinterpret_cast(cursor) % sizeof(jsval) == 0); script->consts()->length = nconsts; script->consts()->vector = (HeapValue *)cursor; cursor += nconsts * sizeof(script->consts()->vector[0]); @@ -2493,7 +2493,7 @@ JSScript::partiallyInit(ExclusiveContext *cx, HandleScript script, uint32_t ncon } cursor = script->bindings.switchToScriptStorage(reinterpret_cast(cursor)); - JS_ASSERT(cursor == script->data + size); + MOZ_ASSERT(cursor == script->data + size); return true; } @@ -2517,9 +2517,9 @@ JSScript::fullyInitTrivial(ExclusiveContext *cx, Handle script) JSScript::fullyInitFromEmitter(ExclusiveContext *cx, HandleScript script, BytecodeEmitter *bce) { /* The counts of indexed things must be checked during code generation. */ - JS_ASSERT(bce->atomIndices->count() <= INDEX_LIMIT); - JS_ASSERT(bce->objectList.length <= INDEX_LIMIT); - JS_ASSERT(bce->regexpList.length <= INDEX_LIMIT); + MOZ_ASSERT(bce->atomIndices->count() <= INDEX_LIMIT); + MOZ_ASSERT(bce->objectList.length <= INDEX_LIMIT); + MOZ_ASSERT(bce->regexpList.length <= INDEX_LIMIT); uint32_t mainLength = bce->offset(); uint32_t prologLength = bce->prologOffset(); @@ -2534,7 +2534,7 @@ JSScript::fullyInitFromEmitter(ExclusiveContext *cx, HandleScript script, Byteco return false; } - JS_ASSERT(script->mainOffset() == 0); + MOZ_ASSERT(script->mainOffset() == 0); script->mainOffset_ = prologLength; script->lineno_ = bce->firstLine; @@ -2580,7 +2580,7 @@ JSScript::fullyInitFromEmitter(ExclusiveContext *cx, HandleScript script, Byteco if (funbox->definitelyNeedsArgsObj()) script->setNeedsArgsObj(true); } else { - JS_ASSERT(!funbox->definitelyNeedsArgsObj()); + MOZ_ASSERT(!funbox->definitelyNeedsArgsObj()); } script->funLength_ = funbox->length; @@ -2588,7 +2588,7 @@ JSScript::fullyInitFromEmitter(ExclusiveContext *cx, HandleScript script, Byteco RootedFunction fun(cx, nullptr); if (funbox) { - JS_ASSERT(!bce->script->noScriptRval()); + MOZ_ASSERT(!bce->script->noScriptRval()); script->isGeneratorExp_ = funbox->inGenexpLambda; script->setGeneratorKind(funbox->generatorKind()); script->setFunction(funbox->function()); @@ -2693,7 +2693,7 @@ js::GetSrcNote(GSNCache &cache, JSScript *script, jsbytecode *pc) return nullptr; if (cache.code == script->code()) { - JS_ASSERT(cache.map.initialized()); + MOZ_ASSERT(cache.map.initialized()); GSNCache::Map::Ptr p = cache.map.lookup(pc); return p ? p->value() : nullptr; } @@ -2720,7 +2720,7 @@ js::GetSrcNote(GSNCache &cache, JSScript *script, jsbytecode *pc) ++nsrcnotes; } if (cache.code) { - JS_ASSERT(cache.map.initialized()); + MOZ_ASSERT(cache.map.initialized()); cache.map.finish(); cache.code = nullptr; } @@ -2780,7 +2780,7 @@ js::PCToLineNumber(unsigned startLine, jssrcnote *notes, jsbytecode *code, jsbyt if (colspan >= SN_COLSPAN_DOMAIN / 2) colspan -= SN_COLSPAN_DOMAIN; - JS_ASSERT(ptrdiff_t(column) + colspan >= 0); + MOZ_ASSERT(ptrdiff_t(column) + colspan >= 0); column += colspan; } } @@ -2864,9 +2864,9 @@ js::DescribeScriptedCallerForCompilation(JSContext *cx, MutableHandleScript mayb if (opt == CALLED_FROM_JSOP_EVAL) { jsbytecode *pc = nullptr; maybeScript.set(cx->currentScript(&pc)); - JS_ASSERT(JSOp(*pc) == JSOP_EVAL || JSOp(*pc) == JSOP_SPREADEVAL); - JS_ASSERT(*(pc + (JSOp(*pc) == JSOP_EVAL ? JSOP_EVAL_LENGTH - : JSOP_SPREADEVAL_LENGTH)) == JSOP_LINENO); + MOZ_ASSERT(JSOp(*pc) == JSOP_EVAL || JSOp(*pc) == JSOP_SPREADEVAL); + MOZ_ASSERT(*(pc + (JSOp(*pc) == JSOP_EVAL ? JSOP_EVAL_LENGTH + : JSOP_SPREADEVAL_LENGTH)) == JSOP_LINENO); *file = maybeScript->filename(); *linenop = GET_UINT16(pc + (JSOp(*pc) == JSOP_EVAL ? JSOP_EVAL_LENGTH : JSOP_SPREADEVAL_LENGTH)); @@ -2916,7 +2916,7 @@ js::CloneScript(JSContext *cx, HandleObject enclosingScope, HandleFunction fun, /* NB: Keep this in sync with XDRScript. */ /* Some embeddings are not careful to use ExposeObjectToActiveJS as needed. */ - JS_ASSERT(!src->sourceObject()->asTenured()->isMarked(gc::GRAY)); + MOZ_ASSERT(!src->sourceObject()->asTenured()->isMarked(gc::GRAY)); uint32_t nconsts = src->hasConsts() ? src->consts()->length : 0; uint32_t nobjects = src->hasObjects() ? src->objects()->length : 0; @@ -3116,11 +3116,11 @@ bool js::CloneFunctionScript(JSContext *cx, HandleFunction original, HandleFunction clone, NewObjectKind newKind /* = GenericObject */) { - JS_ASSERT(clone->isInterpreted()); + MOZ_ASSERT(clone->isInterpreted()); RootedScript script(cx, clone->nonLazyScript()); - JS_ASSERT(script); - JS_ASSERT(script->compartment() == original->compartment()); + MOZ_ASSERT(script); + MOZ_ASSERT(script->compartment() == original->compartment()); JS_ASSERT_IF(script->compartment() != cx->compartment(), !script->enclosingStaticScope()); @@ -3145,22 +3145,22 @@ js::CloneFunctionScript(JSContext *cx, HandleFunction original, HandleFunction c DebugScript * JSScript::debugScript() { - JS_ASSERT(hasDebugScript_); + MOZ_ASSERT(hasDebugScript_); DebugScriptMap *map = compartment()->debugScriptMap; - JS_ASSERT(map); + MOZ_ASSERT(map); DebugScriptMap::Ptr p = map->lookup(this); - JS_ASSERT(p); + MOZ_ASSERT(p); return p->value(); } DebugScript * JSScript::releaseDebugScript() { - JS_ASSERT(hasDebugScript_); + MOZ_ASSERT(hasDebugScript_); DebugScriptMap *map = compartment()->debugScriptMap; - JS_ASSERT(map); + MOZ_ASSERT(map); DebugScriptMap::Ptr p = map->lookup(this); - JS_ASSERT(p); + MOZ_ASSERT(p); DebugScript *debug = p->value(); map->remove(p); hasDebugScript_ = false; @@ -3175,8 +3175,8 @@ JSScript::destroyDebugScript(FreeOp *fop) for (jsbytecode *pc = code(); pc < codeEnd(); pc++) { if (BreakpointSite *site = getBreakpointSite(pc)) { /* Breakpoints are swept before finalization. */ - JS_ASSERT(site->firstBreakpoint() == nullptr); - JS_ASSERT(getBreakpointSite(pc) == nullptr); + MOZ_ASSERT(site->firstBreakpoint() == nullptr); + MOZ_ASSERT(getBreakpointSite(pc) == nullptr); } } #endif @@ -3262,7 +3262,7 @@ JSScript::decrementStepModeCount(FreeOp *fop) { DebugScript *debug = debugScript(); uint32_t count = debug->stepMode; - JS_ASSERT(count > 0); + MOZ_ASSERT(count > 0); setNewStepMode(fop, count - 1); } @@ -3292,7 +3292,7 @@ JSScript::destroyBreakpointSite(FreeOp *fop, jsbytecode *pc) { DebugScript *debug = debugScript(); BreakpointSite *&site = debug->breakpoints[pcToOffset(pc)]; - JS_ASSERT(site); + MOZ_ASSERT(site); fop->delete_(site); site = nullptr; @@ -3363,7 +3363,7 @@ JSScript::markChildren(JSTracer *trc) } if (sourceObject()) { - JS_ASSERT(MaybeForwarded(sourceObject())->compartment() == compartment()); + MOZ_ASSERT(MaybeForwarded(sourceObject())->compartment() == compartment()); MarkObject(trc, &sourceObject_, "sourceObject"); } @@ -3425,7 +3425,7 @@ LazyScript::finalize(FreeOp *fop) NestedScopeObject * JSScript::getStaticScope(jsbytecode *pc) { - JS_ASSERT(containsPC(pc)); + MOZ_ASSERT(containsPC(pc)); if (!hasBlockScopes()) return nullptr; @@ -3454,7 +3454,7 @@ JSScript::getStaticScope(jsbytecode *pc) size_t check = mid; while (check >= bottom) { const BlockScopeNote *checkNote = &scopes->vector[check]; - JS_ASSERT(checkNote->start <= offset); + MOZ_ASSERT(checkNote->start <= offset); if (offset < checkNote->start + checkNote->length) { // We found a matching block chain but there may be inner ones // at a higher block chain index than mid. Continue the binary search. @@ -3513,7 +3513,7 @@ js::SetFrameArgumentsObject(JSContext *cx, AbstractFramePtr frame, while (*pc != JSOP_ARGUMENTS) pc += GetBytecodeLength(pc); pc += JSOP_ARGUMENTS_LENGTH; - JS_ASSERT(*pc == JSOP_SETALIASEDVAR); + MOZ_ASSERT(*pc == JSOP_SETALIASEDVAR); // Note that here and below, it is insufficient to only check for // JS_OPTIMIZED_ARGUMENTS, as Ion could have optimized out the @@ -3529,9 +3529,9 @@ js::SetFrameArgumentsObject(JSContext *cx, AbstractFramePtr frame, /* static */ bool JSScript::argumentsOptimizationFailed(JSContext *cx, HandleScript script) { - JS_ASSERT(script->functionNonDelazifying()); - JS_ASSERT(script->analyzedArgsUsage()); - JS_ASSERT(script->argumentsHasVarBinding()); + MOZ_ASSERT(script->functionNonDelazifying()); + MOZ_ASSERT(script->analyzedArgsUsage()); + MOZ_ASSERT(script->argumentsHasVarBinding()); /* * It is possible that the arguments optimization has already failed, @@ -3543,7 +3543,7 @@ JSScript::argumentsOptimizationFailed(JSContext *cx, HandleScript script) if (script->needsArgsObj()) return true; - JS_ASSERT(!script->isGenerator()); + MOZ_ASSERT(!script->isGenerator()); script->needsArgsObj_ = true; @@ -3634,29 +3634,29 @@ LazyScript::LazyScript(JSFunction *fun, void *table, uint64_t packedFields, uint lineno_(lineno), column_(column) { - JS_ASSERT(begin <= end); + MOZ_ASSERT(begin <= end); } void LazyScript::initScript(JSScript *script) { - JS_ASSERT(script && !script_); + MOZ_ASSERT(script && !script_); script_ = script; } void LazyScript::resetScript() { - JS_ASSERT(script_); + MOZ_ASSERT(script_); script_ = nullptr; } void LazyScript::setParent(JSObject *enclosingScope, ScriptSourceObject *sourceObject) { - JS_ASSERT(!sourceObject_ && !enclosingScope_); + MOZ_ASSERT(!sourceObject_ && !enclosingScope_); JS_ASSERT_IF(enclosingScope, function_->compartment() == enclosingScope->compartment()); - JS_ASSERT(function_->compartment() == sourceObject->compartment()); + MOZ_ASSERT(function_->compartment() == sourceObject->compartment()); enclosingScope_ = enclosingScope; sourceObject_ = sourceObject; diff --git a/js/src/jsscript.h b/js/src/jsscript.h index f393b5280c24..0a9e6bb44d19 100644 --- a/js/src/jsscript.h +++ b/js/src/jsscript.h @@ -147,8 +147,8 @@ class Binding Binding(PropertyName *name, Kind kind, bool aliased) { JS_STATIC_ASSERT(CONSTANT <= KIND_MASK); - JS_ASSERT((uintptr_t(name) & ~NAME_MASK) == 0); - JS_ASSERT((uintptr_t(kind) & ~KIND_MASK) == 0); + MOZ_ASSERT((uintptr_t(name) & ~NAME_MASK) == 0); + MOZ_ASSERT((uintptr_t(kind) & ~KIND_MASK) == 0); bits_ = uintptr_t(name) | uintptr_t(kind) | (aliased ? ALIASED_BIT : 0); } @@ -236,10 +236,10 @@ class Bindings // helper updates the number of block scoped variables in a script as it is // being parsed. void updateNumBlockScoped(unsigned numBlockScoped) { - JS_ASSERT(!callObjShape_); - JS_ASSERT(numVars_ == 0); - JS_ASSERT(numBlockScoped < LOCALNO_LIMIT); - JS_ASSERT(numBlockScoped >= numBlockScoped_); + MOZ_ASSERT(!callObjShape_); + MOZ_ASSERT(numVars_ == 0); + MOZ_ASSERT(numBlockScoped < LOCALNO_LIMIT); + MOZ_ASSERT(numBlockScoped >= numBlockScoped_); numBlockScoped_ = numBlockScoped; } @@ -500,7 +500,7 @@ class ScriptSource ~ScriptSource(); void incref() { refs++; } void decref() { - JS_ASSERT(refs != 0); + MOZ_ASSERT(refs != 0); if (--refs == 0) js_delete(this); } @@ -514,11 +514,11 @@ class ScriptSource bool hasSourceData() const { return dataType != DataMissing; } bool hasCompressedSource() const { return dataType == DataCompressed; } size_t length() const { - JS_ASSERT(hasSourceData()); + MOZ_ASSERT(hasSourceData()); return length_; } bool argumentsNotIncluded() const { - JS_ASSERT(hasSourceData()); + MOZ_ASSERT(hasSourceData()); return argumentsNotIncluded_; } const char16_t *chars(JSContext *cx, UncompressedSourceCache::AutoHoldEntry &asp); @@ -528,32 +528,32 @@ class ScriptSource JS::ScriptSourceInfo *info) const; const char16_t *uncompressedChars() const { - JS_ASSERT(dataType == DataUncompressed); + MOZ_ASSERT(dataType == DataUncompressed); return data.uncompressed.chars; } bool ownsUncompressedChars() const { - JS_ASSERT(dataType == DataUncompressed); + MOZ_ASSERT(dataType == DataUncompressed); return data.uncompressed.ownsChars; } void *compressedData() const { - JS_ASSERT(dataType == DataCompressed); + MOZ_ASSERT(dataType == DataCompressed); return data.compressed.raw; } size_t compressedBytes() const { - JS_ASSERT(dataType == DataCompressed); + MOZ_ASSERT(dataType == DataCompressed); return data.compressed.nbytes; } HashNumber compressedHash() const { - JS_ASSERT(dataType == DataCompressed); + MOZ_ASSERT(dataType == DataCompressed); return data.compressed.hash; } ScriptSource *parent() const { - JS_ASSERT(dataType == DataParent); + MOZ_ASSERT(dataType == DataParent); return data.parent; } @@ -574,7 +574,7 @@ class ScriptSource return introductionType_; } const char *introductionType() const { - JS_ASSERT(hasIntroductionType()); + MOZ_ASSERT(hasIntroductionType()); return introductionType_; } const char *filename() const { @@ -601,12 +601,12 @@ class ScriptSource bool hasIntroductionOffset() const { return hasIntroductionOffset_; } uint32_t introductionOffset() const { - JS_ASSERT(hasIntroductionOffset()); + MOZ_ASSERT(hasIntroductionOffset()); return introductionOffset_; } void setIntroductionOffset(uint32_t offset) { - JS_ASSERT(!hasIntroductionOffset()); - JS_ASSERT(offset <= (uint32_t)INT32_MAX); + MOZ_ASSERT(!hasIntroductionOffset()); + MOZ_ASSERT(offset <= (uint32_t)INT32_MAX); introductionOffset_ = offset; hasIntroductionOffset_ = true; } @@ -700,7 +700,7 @@ GeneratorKindAsBits(GeneratorKind generatorKind) { static inline GeneratorKind GeneratorKindFromBits(unsigned val) { - JS_ASSERT(val <= StarGenerator); + MOZ_ASSERT(val <= StarGenerator); return static_cast(val); } @@ -1020,12 +1020,12 @@ class JSScript : public js::gc::TenuredCell } size_t pcToOffset(const jsbytecode *pc) const { - JS_ASSERT(containsPC(pc)); + MOZ_ASSERT(containsPC(pc)); return size_t(pc - code()); } jsbytecode *offsetToPC(size_t offset) const { - JS_ASSERT(offset < length()); + MOZ_ASSERT(offset < length()); return code() + offset; } @@ -1139,13 +1139,13 @@ class JSScript : public js::gc::TenuredCell bool directlyInsideEval() const { return directlyInsideEval_; } void cacheForEval() { - JS_ASSERT(isActiveEval() && !isCachedEval()); + MOZ_ASSERT(isActiveEval() && !isCachedEval()); isActiveEval_ = false; isCachedEval_ = true; } void uncacheForEval() { - JS_ASSERT(isCachedEval() && !isActiveEval()); + MOZ_ASSERT(isCachedEval() && !isActiveEval()); isCachedEval_ = false; isActiveEval_ = true; } @@ -1208,7 +1208,7 @@ class JSScript : public js::gc::TenuredCell bool argumentsHasVarBinding() const { return argsHasVarBinding_; } - jsbytecode *argumentsBytecode() const { JS_ASSERT(code()[0] == JSOP_ARGUMENTS); return code(); } + jsbytecode *argumentsBytecode() const { MOZ_ASSERT(code()[0] == JSOP_ARGUMENTS); return code(); } void setArgumentsHasVarBinding(); bool argumentsAliasesFormals() const { return argumentsHasVarBinding() && !strict(); @@ -1223,7 +1223,7 @@ class JSScript : public js::gc::TenuredCell void setGeneratorKind(js::GeneratorKind kind) { // A script only gets its generator kind set as part of initialization, // so it can only transition from not being a generator. - JS_ASSERT(!isGenerator()); + MOZ_ASSERT(!isGenerator()); generatorKindBits_ = GeneratorKindAsBits(kind); } @@ -1240,7 +1240,7 @@ class JSScript : public js::gc::TenuredCell bool analyzedArgsUsage() const { return !needsArgsAnalysis_; } inline bool ensureHasAnalyzedArgsUsage(JSContext *cx); bool needsArgsObj() const { - JS_ASSERT(analyzedArgsUsage()); + MOZ_ASSERT(analyzedArgsUsage()); return needsArgsObj_; } void setNeedsArgsObj(bool needsArgsObj); @@ -1277,7 +1277,7 @@ class JSScript : public js::gc::TenuredCell } js::jit::IonScript *ionScript() const { - JS_ASSERT(hasIonScript()); + MOZ_ASSERT(hasIonScript()); return ion; } js::jit::IonScript *maybeIonScript() const { @@ -1303,7 +1303,7 @@ class JSScript : public js::gc::TenuredCell return baseline != BASELINE_DISABLED_SCRIPT; } js::jit::BaselineScript *baselineScript() const { - JS_ASSERT(hasBaselineScript()); + MOZ_ASSERT(hasBaselineScript()); return baseline; } inline void setBaselineScript(JSContext *maybecx, js::jit::BaselineScript *baselineScript); @@ -1311,12 +1311,12 @@ class JSScript : public js::gc::TenuredCell void updateBaselineOrIonRaw(JSContext *maybecx); void setPendingIonBuilder(JSContext *maybecx, js::jit::IonBuilder *builder) { - JS_ASSERT(!builder || !ion->pendingBuilder()); + MOZ_ASSERT(!builder || !ion->pendingBuilder()); ion->setPendingBuilderPrivate(builder); updateBaselineOrIonRaw(maybecx); } js::jit::IonBuilder *pendingIonBuilder() { - JS_ASSERT(hasIonScript()); + MOZ_ASSERT(hasIonScript()); return ion->pendingBuilder(); } @@ -1333,7 +1333,7 @@ class JSScript : public js::gc::TenuredCell } js::jit::IonScript *parallelIonScript() const { - JS_ASSERT(hasParallelIonScript()); + MOZ_ASSERT(hasParallelIonScript()); return parallelIon; } js::jit::IonScript *maybeParallelIonScript() const { @@ -1498,27 +1498,27 @@ class JSScript : public js::gc::TenuredCell size_t dataSize() const { return dataSize_; } js::ConstArray *consts() { - JS_ASSERT(hasConsts()); + MOZ_ASSERT(hasConsts()); return reinterpret_cast(data + constsOffset()); } js::ObjectArray *objects() { - JS_ASSERT(hasObjects()); + MOZ_ASSERT(hasObjects()); return reinterpret_cast(data + objectsOffset()); } js::ObjectArray *regexps() { - JS_ASSERT(hasRegexps()); + MOZ_ASSERT(hasRegexps()); return reinterpret_cast(data + regexpsOffset()); } js::TryNoteArray *trynotes() { - JS_ASSERT(hasTrynotes()); + MOZ_ASSERT(hasTrynotes()); return reinterpret_cast(data + trynotesOffset()); } js::BlockScopeArray *blockScopes() { - JS_ASSERT(hasBlockScopes()); + MOZ_ASSERT(hasBlockScopes()); return reinterpret_cast(data + blockScopesOffset()); } @@ -1527,12 +1527,12 @@ class JSScript : public js::gc::TenuredCell size_t natoms() const { return natoms_; } js::HeapPtrAtom &getAtom(size_t index) const { - JS_ASSERT(index < natoms()); + MOZ_ASSERT(index < natoms()); return atoms[index]; } js::HeapPtrAtom &getAtom(jsbytecode *pc) const { - JS_ASSERT(containsPC(pc) && containsPC(pc + sizeof(uint32_t))); + MOZ_ASSERT(containsPC(pc) && containsPC(pc + sizeof(uint32_t))); return getAtom(GET_UINT32_INDEX(pc)); } @@ -1541,13 +1541,13 @@ class JSScript : public js::gc::TenuredCell } js::PropertyName *getName(jsbytecode *pc) const { - JS_ASSERT(containsPC(pc) && containsPC(pc + sizeof(uint32_t))); + MOZ_ASSERT(containsPC(pc) && containsPC(pc + sizeof(uint32_t))); return getAtom(GET_UINT32_INDEX(pc))->asPropertyName(); } JSObject *getObject(size_t index) { js::ObjectArray *arr = objects(); - JS_ASSERT(index < arr->length); + MOZ_ASSERT(index < arr->length); return arr->vector[index]; } @@ -1557,7 +1557,7 @@ class JSScript : public js::gc::TenuredCell } JSObject *getObject(jsbytecode *pc) { - JS_ASSERT(containsPC(pc) && containsPC(pc + sizeof(uint32_t))); + MOZ_ASSERT(containsPC(pc) && containsPC(pc + sizeof(uint32_t))); return getObject(GET_UINT32_INDEX(pc)); } @@ -1574,7 +1574,7 @@ class JSScript : public js::gc::TenuredCell const js::Value &getConst(size_t index) { js::ConstArray *arr = consts(); - JS_ASSERT(index < arr->length); + MOZ_ASSERT(index < arr->length); return arr->vector[index]; } @@ -1671,16 +1671,16 @@ class BindingIter bool done() const { return i_ == bindings_->count(); } operator bool() const { return !done(); } - void operator++(int) { JS_ASSERT(!done()); i_++; } + void operator++(int) { MOZ_ASSERT(!done()); i_++; } BindingIter &operator++() { (*this)++; return *this; } uint32_t frameIndex() const { - JS_ASSERT(!done()); + MOZ_ASSERT(!done()); return i_ < bindings_->numArgs() ? i_ : i_ - bindings_->numArgs(); } - const Binding &operator*() const { JS_ASSERT(!done()); return bindings_->bindingArray()[i_]; } - const Binding *operator->() const { JS_ASSERT(!done()); return &bindings_->bindingArray()[i_]; } + const Binding &operator*() const { MOZ_ASSERT(!done()); return bindings_->bindingArray()[i_]; } + const Binding *operator->() const { MOZ_ASSERT(!done()); return &bindings_->bindingArray()[i_]; } }; /* @@ -1713,12 +1713,12 @@ class AliasedFormalIter bool done() const { return p_ == end_; } operator bool() const { return !done(); } - void operator++(int) { JS_ASSERT(!done()); p_++; slot_++; settle(); } + void operator++(int) { MOZ_ASSERT(!done()); p_++; slot_++; settle(); } - const Binding &operator*() const { JS_ASSERT(!done()); return *p_; } - const Binding *operator->() const { JS_ASSERT(!done()); return p_; } - unsigned frameIndex() const { JS_ASSERT(!done()); return p_ - begin_; } - unsigned scopeSlot() const { JS_ASSERT(!done()); return slot_; } + const Binding &operator*() const { MOZ_ASSERT(!done()); return *p_; } + const Binding *operator->() const { MOZ_ASSERT(!done()); return p_; } + unsigned frameIndex() const { MOZ_ASSERT(!done()); return p_ - begin_; } + unsigned scopeSlot() const { MOZ_ASSERT(!done()); return slot_; } }; // Information about a script which may be (or has been) lazily compiled to @@ -1887,9 +1887,9 @@ class LazyScript : public gc::TenuredCell void setGeneratorKind(GeneratorKind kind) { // A script only gets its generator kind set as part of initialization, // so it can only transition from NotGenerator. - JS_ASSERT(!isGenerator()); + MOZ_ASSERT(!isGenerator()); // Legacy generators cannot currently be lazy. - JS_ASSERT(kind != LegacyGenerator); + MOZ_ASSERT(kind != LegacyGenerator); p_.generatorKindBits = GeneratorKindAsBits(kind); } diff --git a/js/src/jsscriptinlines.h b/js/src/jsscriptinlines.h index 0183b7c24320..811ea03eda87 100644 --- a/js/src/jsscriptinlines.h +++ b/js/src/jsscriptinlines.h @@ -73,7 +73,7 @@ JSScript::functionDelazifying() const inline void JSScript::setFunction(JSFunction *fun) { - JS_ASSERT(fun->isTenured()); + MOZ_ASSERT(fun->isTenured()); function_ = fun; } @@ -96,7 +96,7 @@ JSScript::getFunction(size_t index) inline JSFunction * JSScript::getCallerFunction() { - JS_ASSERT(savedCallerFun()); + MOZ_ASSERT(savedCallerFun()); return getFunction(0); } @@ -114,16 +114,16 @@ inline js::RegExpObject * JSScript::getRegExp(size_t index) { js::ObjectArray *arr = regexps(); - JS_ASSERT(uint32_t(index) < arr->length); + MOZ_ASSERT(uint32_t(index) < arr->length); JSObject *obj = arr->vector[index]; - JS_ASSERT(obj->is()); + MOZ_ASSERT(obj->is()); return (js::RegExpObject *) obj; } inline js::RegExpObject * JSScript::getRegExp(jsbytecode *pc) { - JS_ASSERT(containsPC(pc) && containsPC(pc + sizeof(uint32_t))); + MOZ_ASSERT(containsPC(pc) && containsPC(pc + sizeof(uint32_t))); return getRegExp(GET_UINT32_INDEX(pc)); } @@ -154,11 +154,11 @@ JSScript::donorFunction() const inline void JSScript::setIsCallsiteClone(JSObject *fun) { - JS_ASSERT(shouldCloneAtCallsite()); + MOZ_ASSERT(shouldCloneAtCallsite()); shouldCloneAtCallsite_ = false; isCallsiteClone_ = true; - JS_ASSERT(isCallsiteClone()); - JS_ASSERT(fun->is()); + MOZ_ASSERT(isCallsiteClone()); + MOZ_ASSERT(fun->is()); enclosingScopeOrOriginalFunction_ = fun; } diff --git a/js/src/jsstr.cpp b/js/src/jsstr.cpp index 0680516a1f35..d2c8569ab39a 100644 --- a/js/src/jsstr.cpp +++ b/js/src/jsstr.cpp @@ -163,7 +163,7 @@ Escape(JSContext *cx, const CharT *chars, uint32_t length, uint32_t *newLengthOu newChars[ni++] = digits[ch & 0xF]; } } - JS_ASSERT(ni == newLength); + MOZ_ASSERT(ni == newLength); newChars[newLength] = 0; *newLengthOut = newLength; @@ -502,7 +502,7 @@ str_quote(JSContext *cx, unsigned argc, Value *vp) MOZ_ALWAYS_INLINE bool str_toSource_impl(JSContext *cx, CallArgs args) { - JS_ASSERT(IsString(args.thisv())); + MOZ_ASSERT(IsString(args.thisv())); Rooted str(cx, ToString(cx, args.thisv())); if (!str) @@ -535,7 +535,7 @@ str_toSource(JSContext *cx, unsigned argc, Value *vp) MOZ_ALWAYS_INLINE bool str_toString_impl(JSContext *cx, CallArgs args) { - JS_ASSERT(IsString(args.thisv())); + MOZ_ASSERT(IsString(args.thisv())); args.rval().setString(args.thisv().isString() ? args.thisv().toString() @@ -606,7 +606,7 @@ DoSubstr(JSContext *cx, JSString *str, size_t begin, size_t len) * Requested substring is partly in the left and partly in right child. * Create a rope of substrings for both childs. */ - JS_ASSERT (begin < rope->leftChild()->length() && + MOZ_ASSERT(begin < rope->leftChild()->length() && begin + len > rope->leftChild()->length()); size_t lhsLength = rope->leftChild()->length() - begin; @@ -1149,7 +1149,7 @@ template static int BoyerMooreHorspool(const TextChar *text, uint32_t textLen, const PatChar *pat, uint32_t patLen) { - JS_ASSERT(0 < patLen && patLen <= sBMHPatLenMax); + MOZ_ASSERT(0 < patLen && patLen <= sBMHPatLenMax); uint8_t skip[sBMHCharSetSize]; for (uint32_t i = 0; i < sBMHCharSetSize; i++) @@ -1264,7 +1264,7 @@ FirstCharMatcher16bit(const char16_t *text, uint32_t n, const char16_t pat) const char *text8 = (const char *) text; const char *pat8 = reinterpret_cast(&pat); - JS_ASSERT(n < UINT32_MAX/2); + MOZ_ASSERT(n < UINT32_MAX/2); n *= 2; uint32_t i = 0; @@ -1451,7 +1451,7 @@ class StringSegmentRange {} MOZ_WARN_UNUSED_RESULT bool init(JSString *str) { - JS_ASSERT(stack.empty()); + MOZ_ASSERT(stack.empty()); return settle(str); } @@ -1460,12 +1460,12 @@ class StringSegmentRange } JSLinearString *front() const { - JS_ASSERT(!cur->isRope()); + MOZ_ASSERT(!cur->isRope()); return cur; } MOZ_WARN_UNUSED_RESULT bool popFront() { - JS_ASSERT(!empty()); + MOZ_ASSERT(!empty()); if (stack.empty()) { cur = nullptr; return true; @@ -2169,7 +2169,7 @@ class MOZ_STACK_CLASS StringRegExpGuard bool init(JSContext *cx, JSObject *regexp) { obj_ = regexp; - JS_ASSERT(ObjectClassIs(obj_, ESClass_RegExp, cx)); + MOZ_ASSERT(ObjectClassIs(obj_, ESClass_RegExp, cx)); if (!RegExpToShared(cx, obj_, &re_)) return false; @@ -2246,7 +2246,7 @@ class MOZ_STACK_CLASS StringRegExpGuard } else { pat = fm.pat_; } - JS_ASSERT(pat); + MOZ_ASSERT(pat); return cx->compartment()->regExps.get(cx, pat, opt, &re_); } @@ -2271,7 +2271,7 @@ class MOZ_STACK_CLASS StringRegExpGuard bool regExpIsObject() { return obj_ != nullptr; } HandleObject regExpObject() { - JS_ASSERT(regExpIsObject()); + MOZ_ASSERT(regExpIsObject()); return obj_; } @@ -2569,7 +2569,7 @@ struct ReplaceData {} inline void setReplacementString(JSLinearString *string) { - JS_ASSERT(string); + MOZ_ASSERT(string); lambda = nullptr; elembase = nullptr; repstr = string; @@ -2581,7 +2581,7 @@ struct ReplaceData } inline void setReplacementFunction(JSObject *func) { - JS_ASSERT(func); + MOZ_ASSERT(func); lambda = func; elembase = nullptr; repstr = nullptr; @@ -2658,7 +2658,7 @@ static bool InterpretDollar(RegExpStatics *res, const CharT *bp, const CharT *dp, const CharT *ep, ReplaceData &rdata, JSSubString *out, size_t *skip) { - JS_ASSERT(*dp == '$'); + MOZ_ASSERT(*dp == '$'); /* If there is only a dollar, bail now */ if (dp + 1 >= ep) @@ -2685,7 +2685,7 @@ InterpretDollar(RegExpStatics *res, const CharT *bp, const CharT *dp, const Char *skip = cp - dp; - JS_ASSERT(num <= res->getMatches().parenCount()); + MOZ_ASSERT(num <= res->getMatches().parenCount()); /* * Note: we index to get the paren with the (1-indexed) pair @@ -2765,9 +2765,9 @@ FindReplaceLength(JSContext *cx, RegExpStatics *res, ReplaceData &rdata, size_t * in the course of the replace unless we end up making a scripted call due * to accessing a scripted getter or a value with a scripted toString. */ - JS_ASSERT(rdata.lambda); - JS_ASSERT(!rdata.elembase->getOps()->lookupProperty); - JS_ASSERT(!rdata.elembase->getOps()->getProperty); + MOZ_ASSERT(rdata.lambda); + MOZ_ASSERT(!rdata.elembase->getOps()->lookupProperty); + MOZ_ASSERT(!rdata.elembase->getOps()->getProperty); RootedValue match(cx); if (!res->createLastMatch(cx, &match)) @@ -2894,8 +2894,8 @@ ReplaceRegExp(JSContext *cx, RegExpStatics *res, ReplaceData &rdata) { const MatchPair &match = res->getMatches()[0]; - JS_ASSERT(!match.isUndefined()); - JS_ASSERT(match.limit >= match.start && match.limit >= 0); + MOZ_ASSERT(!match.isUndefined()); + MOZ_ASSERT(match.limit >= match.start && match.limit >= 0); rdata.calledBack = true; size_t leftoff = rdata.leftIndex; @@ -3021,7 +3021,7 @@ AppendDollarReplacement(StringBuffer &newReplaceChars, size_t firstDollarIndex, const FlatMatch &fm, JSLinearString *text, const CharT *repChars, size_t repLength) { - JS_ASSERT(firstDollarIndex < repLength); + MOZ_ASSERT(firstDollarIndex < repLength); size_t matchStart = fm.match(); size_t matchLimit = matchStart + fm.patternLength(); @@ -3118,7 +3118,7 @@ BuildDollarReplacement(JSContext *cx, JSString *textstrArg, JSLinearString *reps if (!newReplace) return false; - JS_ASSERT(textstr->length() >= matchLimit); + MOZ_ASSERT(textstr->length() >= matchLimit); RootedString rightSide(cx, NewDependentString(cx, textstr, matchLimit, textstr->length() - matchLimit)); if (!rightSide) @@ -3178,7 +3178,7 @@ static JSString * AppendSubstrings(JSContext *cx, Handle flatStr, const StringRange *ranges, size_t rangesLen) { - JS_ASSERT(rangesLen); + MOZ_ASSERT(rangesLen); /* For single substrings, construct a dependent string. */ if (rangesLen == 1) @@ -3333,7 +3333,7 @@ StrReplaceRegExp(JSContext *cx, ReplaceData &rdata, MutableHandleValue rval) /* Optimize removal. */ if (rdata.repstr && rdata.repstr->length() == 0) { - JS_ASSERT(!rdata.lambda && !rdata.elembase && rdata.dollarIndex == UINT32_MAX); + MOZ_ASSERT(!rdata.lambda && !rdata.elembase && rdata.dollarIndex == UINT32_MAX); return StrReplaceRegexpRemove(cx, rdata.str, re, rval); } @@ -3629,11 +3629,11 @@ class SplitMatchResult { return endIndex_ == SIZE_MAX; } size_t endIndex() const { - JS_ASSERT(!isFailure()); + MOZ_ASSERT(!isFailure()); return endIndex_; } size_t length() const { - JS_ASSERT(!isFailure()); + MOZ_ASSERT(!isFailure()); return length_; } void setResult(size_t length, size_t endIndex) { @@ -3717,9 +3717,9 @@ SplitHelper(JSContext *cx, HandleLinearString str, uint32_t limit, const Matcher } /* Step 13(c)(iii). */ - JS_ASSERT(lastEndIndex < endIndex); - JS_ASSERT(sepLength <= strLength); - JS_ASSERT(lastEndIndex + sepLength <= endIndex); + MOZ_ASSERT(lastEndIndex < endIndex); + MOZ_ASSERT(sepLength <= strLength); + MOZ_ASSERT(lastEndIndex + sepLength <= endIndex); /* Steps 13(c)(iii)(1-3). */ size_t subLength = size_t(endIndex - sepLength - lastEndIndex); @@ -3856,7 +3856,7 @@ class SplitStringMatcher bool operator()(JSContext *cx, JSLinearString *str, size_t index, SplitMatchResult *res) const { - JS_ASSERT(index == 0 || index < str->length()); + MOZ_ASSERT(index == 0 || index < str->length()); int match = StringMatch(str, sep, index); if (match == -1) res->setFailure(); @@ -4239,7 +4239,7 @@ js::str_fromCharCode(JSContext *cx, unsigned argc, Value *vp) { CallArgs args = CallArgsFromVp(argc, vp); - JS_ASSERT(args.length() <= ARGS_LENGTH_MAX); + MOZ_ASSERT(args.length() <= ARGS_LENGTH_MAX); if (args.length() == 1) return str_fromCharCode_one_arg(cx, args[0], args.rval()); @@ -4303,7 +4303,7 @@ static const JSFunctionSpec string_static_methods[] = { /* static */ Shape * StringObject::assignInitialShape(ExclusiveContext *cx, Handle obj) { - JS_ASSERT(obj->nativeEmpty()); + MOZ_ASSERT(obj->nativeEmpty()); return obj->addDataProperty(cx, cx->names().length, LENGTH_SLOT, JSPROP_PERMANENT | JSPROP_READONLY); @@ -4312,7 +4312,7 @@ StringObject::assignInitialShape(ExclusiveContext *cx, Handle obj JSObject * js_InitStringClass(JSContext *cx, HandleObject obj) { - JS_ASSERT(obj->isNative()); + MOZ_ASSERT(obj->isNative()); Rooted global(cx, &obj->as()); @@ -4371,7 +4371,7 @@ JSString * js::ToStringSlow(ExclusiveContext *cx, typename MaybeRooted::HandleType arg) { /* As with ToObjectSlow, callers must verify that |arg| isn't a string. */ - JS_ASSERT(!arg.isString()); + MOZ_ASSERT(!arg.isString()); Value v = arg; if (!v.isPrimitive()) { @@ -4577,8 +4577,8 @@ js::CompareChars(const char16_t *s1, size_t len1, JSLinearString *s2) bool js::CompareStrings(JSContext *cx, JSString *str1, JSString *str2, int32_t *result) { - JS_ASSERT(str1); - JS_ASSERT(str2); + MOZ_ASSERT(str1); + MOZ_ASSERT(str2); if (str1 == str2) { *result = 0; @@ -4609,7 +4609,7 @@ js::StringEqualsAscii(JSLinearString *str, const char *asciiBytes) size_t length = strlen(asciiBytes); #ifdef DEBUG for (size_t i = 0; i != length; ++i) - JS_ASSERT(unsigned(asciiBytes[i]) <= 127); + MOZ_ASSERT(unsigned(asciiBytes[i]) <= 127); #endif if (length != str->length()) return false; @@ -5139,7 +5139,7 @@ js_OneUcs4ToUtf8Char(uint8_t *utf8Buffer, uint32_t ucs4Char) { int utf8Length = 1; - JS_ASSERT(ucs4Char <= 0x10FFFF); + MOZ_ASSERT(ucs4Char <= 0x10FFFF); if (ucs4Char < 0x80) { *utf8Buffer = (uint8_t)ucs4Char; } else { @@ -5180,7 +5180,7 @@ js::PutEscapedStringImpl(char *buffer, size_t bufferSize, FILE *fp, const CharT STOP, FIRST_QUOTE, LAST_QUOTE, CHARS, ESCAPE_START, ESCAPE_MORE } state; - JS_ASSERT(quote == 0 || quote == '\'' || quote == '"'); + MOZ_ASSERT(quote == 0 || quote == '\'' || quote == '"'); JS_ASSERT_IF(!buffer, bufferSize == 0); JS_ASSERT_IF(fp, !buffer); @@ -5249,7 +5249,7 @@ js::PutEscapedStringImpl(char *buffer, size_t bufferSize, FILE *fp, const CharT state = ESCAPE_START; break; case ESCAPE_START: - JS_ASSERT(' ' <= u && u < 127); + MOZ_ASSERT(' ' <= u && u < 127); c = (char)u; state = ESCAPE_MORE; break; @@ -5264,7 +5264,7 @@ js::PutEscapedStringImpl(char *buffer, size_t bufferSize, FILE *fp, const CharT break; } if (buffer) { - JS_ASSERT(n <= bufferSize); + MOZ_ASSERT(n <= bufferSize); if (n != bufferSize) { buffer[n] = c; } else { diff --git a/js/src/jsstr.h b/js/src/jsstr.h index 8da2775ca2ca..5231ab133698 100644 --- a/js/src/jsstr.h +++ b/js/src/jsstr.h @@ -39,7 +39,7 @@ template static inline const CharT * SkipSpace(const CharT *s, const CharT *end) { - JS_ASSERT(s <= end); + MOZ_ASSERT(s <= end); while (s < end && unicode::IsSpace(*s)) s++; @@ -369,7 +369,7 @@ PutEscapedString(char *buffer, size_t size, JSLinearString *str, uint32_t quote) size_t n = PutEscapedStringImpl(buffer, size, nullptr, str, quote); /* PutEscapedStringImpl can only fail with a file. */ - JS_ASSERT(n != size_t(-1)); + MOZ_ASSERT(n != size_t(-1)); return n; } @@ -380,7 +380,7 @@ PutEscapedString(char *buffer, size_t bufferSize, const CharT *chars, size_t len size_t n = PutEscapedStringImpl(buffer, bufferSize, nullptr, chars, length, quote); /* PutEscapedStringImpl can only fail with a file. */ - JS_ASSERT(n != size_t(-1)); + MOZ_ASSERT(n != size_t(-1)); return n; } diff --git a/js/src/jsutil.cpp b/js/src/jsutil.cpp index 94b6f6a0cc83..c6eda2c4812b 100644 --- a/js/src/jsutil.cpp +++ b/js/src/jsutil.cpp @@ -105,13 +105,13 @@ AllTheNonBasicVanillaNewAllocations() static uint32_t BinToVal(unsigned logscale, unsigned bin) { - JS_ASSERT(bin <= 10); + MOZ_ASSERT(bin <= 10); if (bin <= 1 || logscale == 0) return bin; --bin; if (logscale == 2) return JS_BIT(bin); - JS_ASSERT(logscale == 10); + MOZ_ASSERT(logscale == 10); return uint32_t(pow(10.0, (double) bin)); } diff --git a/js/src/jsutil.h b/js/src/jsutil.h index 5b5231cd2672..a5e9a38ea1dd 100644 --- a/js/src/jsutil.h +++ b/js/src/jsutil.h @@ -61,7 +61,7 @@ class AlignedPtrAndFlag public: AlignedPtrAndFlag(T *t, bool aFlag) { - JS_ASSERT((uintptr_t(t) & 1) == 0); + MOZ_ASSERT((uintptr_t(t) & 1) == 0); bits = uintptr_t(t) | uintptr_t(aFlag); } @@ -74,7 +74,7 @@ class AlignedPtrAndFlag } void setPtr(T *t) { - JS_ASSERT((uintptr_t(t) & 1) == 0); + MOZ_ASSERT((uintptr_t(t) & 1) == 0); bits = uintptr_t(t) | uintptr_t(flag()); } @@ -87,7 +87,7 @@ class AlignedPtrAndFlag } void set(T *t, bool aFlag) { - JS_ASSERT((uintptr_t(t) & 1) == 0); + MOZ_ASSERT((uintptr_t(t) & 1) == 0); bits = uintptr_t(t) | aFlag; } }; @@ -193,7 +193,7 @@ template static inline U ComputeByteAlignment(T bytes, U alignment) { - JS_ASSERT(IsPowerOfTwo(alignment)); + MOZ_ASSERT(IsPowerOfTwo(alignment)); return (alignment - (bytes % alignment)) % alignment; } @@ -226,7 +226,7 @@ static inline unsigned BitArrayIndexToWordIndex(size_t length, size_t bitIndex) { unsigned wordIndex = bitIndex / BitArrayElementBits; - JS_ASSERT(wordIndex < length); + MOZ_ASSERT(wordIndex < length); return wordIndex; } diff --git a/js/src/jswatchpoint.cpp b/js/src/jswatchpoint.cpp index ab7fb6bf1a11..40a589e6dc77 100644 --- a/js/src/jswatchpoint.cpp +++ b/js/src/jswatchpoint.cpp @@ -37,7 +37,7 @@ class AutoEntryHolder { AutoEntryHolder(JSContext *cx, Map &map, Map::Ptr p) : map(map), p(p), gen(map.generation()), obj(cx, p->key().object), id(cx, p->key().id) { - JS_ASSERT(!p->value().held); + MOZ_ASSERT(!p->value().held); p->value().held = true; } @@ -61,7 +61,7 @@ bool WatchpointMap::watch(JSContext *cx, HandleObject obj, HandleId id, JSWatchPointHandler handler, HandleObject closure) { - JS_ASSERT(JSID_IS_STRING(id) || JSID_IS_INT(id) || JSID_IS_SYMBOL(id)); + MOZ_ASSERT(JSID_IS_STRING(id) || JSID_IS_INT(id) || JSID_IS_SYMBOL(id)); if (!obj->setWatched(cx)) return false; @@ -168,9 +168,9 @@ WatchpointMap::markIteratively(JSTracer *trc) marked = true; } - JS_ASSERT(JSID_IS_STRING(priorKeyId) || - JSID_IS_INT(priorKeyId) || - JSID_IS_SYMBOL(priorKeyId)); + MOZ_ASSERT(JSID_IS_STRING(priorKeyId) || + JSID_IS_INT(priorKeyId) || + JSID_IS_SYMBOL(priorKeyId)); MarkId(trc, const_cast(&entry.key().id), "WatchKey::id"); if (entry.value().closure && !IsObjectMarked(&entry.value().closure)) { @@ -193,7 +193,7 @@ WatchpointMap::markAll(JSTracer *trc) Map::Entry &entry = e.front(); WatchKey key = entry.key(); WatchKey prior = key; - JS_ASSERT(JSID_IS_STRING(prior.id) || JSID_IS_INT(prior.id) || JSID_IS_SYMBOL(prior.id)); + MOZ_ASSERT(JSID_IS_STRING(prior.id) || JSID_IS_INT(prior.id) || JSID_IS_SYMBOL(prior.id)); MarkObject(trc, const_cast(&key.object), "held Watchpoint object"); @@ -221,7 +221,7 @@ WatchpointMap::sweep() Map::Entry &entry = e.front(); JSObject *obj(entry.key().object); if (IsObjectAboutToBeFinalized(&obj)) { - JS_ASSERT(!entry.value().held); + MOZ_ASSERT(!entry.value().held); e.removeFront(); } else if (obj != entry.key().object) { e.rekeyFront(WatchKey(obj, entry.key().id)); diff --git a/js/src/jsweakcache.h b/js/src/jsweakcache.h index 08637d3edec9..2bc3816aac11 100644 --- a/js/src/jsweakcache.h +++ b/js/src/jsweakcache.h @@ -59,11 +59,11 @@ class WeakCache : public HashMap { for (Range r = Base::all(); !r.empty(); r.popFront()) { Key k(r.front().key); - JS_ASSERT(!gc::IsAboutToBeFinalized(&k)); - JS_ASSERT(!gc::IsAboutToBeFinalized(r.front().value)); + MOZ_ASSERT(!gc::IsAboutToBeFinalized(&k)); + MOZ_ASSERT(!gc::IsAboutToBeFinalized(r.front().value)); // Assert that IsMarked() did not perform relocation. - JS_ASSERT(k == r.front().key); + MOZ_ASSERT(k == r.front().key); } #endif } @@ -97,7 +97,7 @@ class WeakValueCache : public HashMap // Once we've swept, all remaining edges should stay within the // known-live part of the graph. for (Range r = Base::all(); !r.empty(); r.popFront()) - JS_ASSERT(!gc::IsAboutToBeFinalized(r.front().value())); + MOZ_ASSERT(!gc::IsAboutToBeFinalized(r.front().value())); #endif } }; diff --git a/js/src/jsweakmap.cpp b/js/src/jsweakmap.cpp index 444d0bef392b..2a9ac817d763 100644 --- a/js/src/jsweakmap.cpp +++ b/js/src/jsweakmap.cpp @@ -33,19 +33,19 @@ WeakMapBase::WeakMapBase(JSObject *memOf, JSCompartment *c) WeakMapBase::~WeakMapBase() { - JS_ASSERT(!isInList()); + MOZ_ASSERT(!isInList()); } void WeakMapBase::trace(JSTracer *tracer) { - JS_ASSERT(isInList()); + MOZ_ASSERT(isInList()); if (IS_GC_MARKING_TRACER(tracer)) { // We don't trace any of the WeakMap entries at this time, just record // record the fact that the WeakMap has been marked. Enties are marked // in the iterative marking phase by markAllIteratively(), which happens // when many keys as possible have been marked already. - JS_ASSERT(tracer->eagerlyTraceWeakMaps() == DoNotTraceWeakMaps); + MOZ_ASSERT(tracer->eagerlyTraceWeakMaps() == DoNotTraceWeakMaps); marked = true; } else { // If we're not actually doing garbage collection, the keys won't be marked @@ -71,7 +71,7 @@ WeakMapBase::unmarkCompartment(JSCompartment *c) void WeakMapBase::markAll(JSCompartment *c, JSTracer *tracer) { - JS_ASSERT(tracer->eagerlyTraceWeakMaps() != DoNotTraceWeakMaps); + MOZ_ASSERT(tracer->eagerlyTraceWeakMaps() != DoNotTraceWeakMaps); for (WeakMapBase *m = c->gcWeakMapList; m; m = m->next) { m->trace(tracer); if (m->memberOf) @@ -120,7 +120,7 @@ WeakMapBase::sweepCompartment(JSCompartment *c) #ifdef DEBUG for (WeakMapBase *m = c->gcWeakMapList; m; m = m->next) - JS_ASSERT(m->isInList() && m->marked); + MOZ_ASSERT(m->isInList() && m->marked); #endif } @@ -149,8 +149,8 @@ WeakMapBase::restoreCompartmentMarkedWeakMaps(WeakMapSet &markedWeakMaps) { for (WeakMapSet::Range r = markedWeakMaps.all(); !r.empty(); r.popFront()) { WeakMapBase *map = r.front(); - JS_ASSERT(map->compartment->zone()->isGCMarking()); - JS_ASSERT(!map->marked); + MOZ_ASSERT(map->compartment->zone()->isGCMarking()); + MOZ_ASSERT(!map->marked); map->marked = true; } } @@ -216,7 +216,7 @@ IsWeakMap(HandleValue v) MOZ_ALWAYS_INLINE bool WeakMap_has_impl(JSContext *cx, CallArgs args) { - JS_ASSERT(IsWeakMap(args.thisv())); + MOZ_ASSERT(IsWeakMap(args.thisv())); if (args.length() < 1) { JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_MORE_ARGS_NEEDED, @@ -248,7 +248,7 @@ js::WeakMap_has(JSContext *cx, unsigned argc, Value *vp) MOZ_ALWAYS_INLINE bool WeakMap_clear_impl(JSContext *cx, CallArgs args) { - JS_ASSERT(IsWeakMap(args.thisv())); + MOZ_ASSERT(IsWeakMap(args.thisv())); // We can't js_delete the weakmap because the data gathered during GC is // used by the Cycle Collector. @@ -269,7 +269,7 @@ js::WeakMap_clear(JSContext *cx, unsigned argc, Value *vp) MOZ_ALWAYS_INLINE bool WeakMap_get_impl(JSContext *cx, CallArgs args) { - JS_ASSERT(IsWeakMap(args.thisv())); + MOZ_ASSERT(IsWeakMap(args.thisv())); if (args.length() < 1) { JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_MORE_ARGS_NEEDED, @@ -301,7 +301,7 @@ js::WeakMap_get(JSContext *cx, unsigned argc, Value *vp) MOZ_ALWAYS_INLINE bool WeakMap_delete_impl(JSContext *cx, CallArgs args) { - JS_ASSERT(IsWeakMap(args.thisv())); + MOZ_ASSERT(IsWeakMap(args.thisv())); if (args.length() < 1) { JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_MORE_ARGS_NEEDED, @@ -339,7 +339,7 @@ TryPreserveReflector(JSContext *cx, HandleObject obj) (obj->is() && obj->as().handler()->family() == GetDOMProxyHandlerFamily())) { - JS_ASSERT(cx->runtime()->preserveWrapperCallback); + MOZ_ASSERT(cx->runtime()->preserveWrapperCallback); if (!cx->runtime()->preserveWrapperCallback(cx, obj)) { JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_BAD_WEAKMAP_KEY); return false; @@ -399,7 +399,7 @@ SetWeakMapEntryInternal(JSContext *cx, Handle mapObj, return false; } - JS_ASSERT(key->compartment() == mapObj->compartment()); + MOZ_ASSERT(key->compartment() == mapObj->compartment()); JS_ASSERT_IF(value.isObject(), value.toObject().compartment() == mapObj->compartment()); if (!map->put(key, value)) { JS_ReportOutOfMemory(cx); @@ -412,7 +412,7 @@ SetWeakMapEntryInternal(JSContext *cx, Handle mapObj, MOZ_ALWAYS_INLINE bool WeakMap_set_impl(JSContext *cx, CallArgs args) { - JS_ASSERT(IsWeakMap(args.thisv())); + MOZ_ASSERT(IsWeakMap(args.thisv())); if (args.length() < 1) { JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_MORE_ARGS_NEEDED, @@ -573,7 +573,7 @@ static const JSFunctionSpec weak_map_methods[] = { static JSObject * InitWeakMapClass(JSContext *cx, HandleObject obj, bool defineMembers) { - JS_ASSERT(obj->isNative()); + MOZ_ASSERT(obj->isNative()); Rooted global(cx, &obj->as()); diff --git a/js/src/jsweakmap.h b/js/src/jsweakmap.h index 2670516bcc2b..0c90e29b1af0 100644 --- a/js/src/jsweakmap.h +++ b/js/src/jsweakmap.h @@ -161,7 +161,7 @@ class WeakMap : public HashMap, publ if (gc::IsMarked(x)) return false; gc::Mark(trc, x, "WeakMap entry value"); - JS_ASSERT(gc::IsMarked(x)); + MOZ_ASSERT(gc::IsMarked(x)); return true; } @@ -271,9 +271,9 @@ protected: #if DEBUG for (Range r = Base::all(); !r.empty(); r.popFront()) { Key k(r.front().key()); - JS_ASSERT(!gc::IsAboutToBeFinalized(&k)); - JS_ASSERT(!gc::IsAboutToBeFinalized(&r.front().value())); - JS_ASSERT(k == r.front().key()); + MOZ_ASSERT(!gc::IsAboutToBeFinalized(&k)); + MOZ_ASSERT(!gc::IsAboutToBeFinalized(&r.front().value())); + MOZ_ASSERT(k == r.front().key()); } #endif } diff --git a/js/src/jswrapper.h b/js/src/jswrapper.h index e1ca14569fe0..250a829f067a 100644 --- a/js/src/jswrapper.h +++ b/js/src/jswrapper.h @@ -35,7 +35,7 @@ class MOZ_STACK_CLASS WrapperOptions : public ProxyOptions { inline JSObject *proto() const; WrapperOptions &setProto(JSObject *protoArg) { - JS_ASSERT(proto_); + MOZ_ASSERT(proto_); *proto_ = protoArg; return *this; } diff --git a/js/src/perf/pm_linux.cpp b/js/src/perf/pm_linux.cpp index 2780bd2a1b3c..48d4226810d8 100644 --- a/js/src/perf/pm_linux.cpp +++ b/js/src/perf/pm_linux.cpp @@ -134,7 +134,7 @@ Impl::~Impl() EventMask Impl::init(EventMask toMeasure) { - JS_ASSERT(group_leader == -1); + MOZ_ASSERT(group_leader == -1); if (!toMeasure) return EventMask(0); diff --git a/js/src/proxy/BaseProxyHandler.cpp b/js/src/proxy/BaseProxyHandler.cpp index 72a64b115031..757ba8b23f81 100644 --- a/js/src/proxy/BaseProxyHandler.cpp +++ b/js/src/proxy/BaseProxyHandler.cpp @@ -104,7 +104,7 @@ js::SetPropertyIgnoringNamedGetter(JSContext *cx, const BaseProxyHandler *handle { /* The control-flow here differs from ::get() because of the fall-through case below. */ if (descIsOwn) { - JS_ASSERT(desc.object()); + MOZ_ASSERT(desc.object()); // Check for read-only properties. if (desc.isReadonly()) @@ -168,7 +168,7 @@ bool BaseProxyHandler::keys(JSContext *cx, HandleObject proxy, AutoIdVector &props) const { assertEnteredPolicy(cx, proxy, JSID_VOID, ENUMERATE); - JS_ASSERT(props.length() == 0); + MOZ_ASSERT(props.length() == 0); if (!getOwnPropertyNames(cx, proxy, props)) return false; @@ -177,7 +177,7 @@ BaseProxyHandler::keys(JSContext *cx, HandleObject proxy, AutoIdVector &props) c RootedId id(cx); size_t i = 0; for (size_t j = 0, len = props.length(); j < len; j++) { - JS_ASSERT(i <= j); + MOZ_ASSERT(i <= j); id = props[j]; if (JSID_IS_SYMBOL(id)) continue; @@ -190,7 +190,7 @@ BaseProxyHandler::keys(JSContext *cx, HandleObject proxy, AutoIdVector &props) c props[i++].set(id); } - JS_ASSERT(i <= props.length()); + MOZ_ASSERT(i <= props.length()); props.resize(i); return true; diff --git a/js/src/proxy/CrossCompartmentWrapper.cpp b/js/src/proxy/CrossCompartmentWrapper.cpp index 8144aa942a96..1712a2893001 100644 --- a/js/src/proxy/CrossCompartmentWrapper.cpp +++ b/js/src/proxy/CrossCompartmentWrapper.cpp @@ -293,8 +293,8 @@ CrossCompartmentWrapper::nativeCall(JSContext *cx, IsAcceptableThis test, Native CallArgs srcArgs) const { RootedObject wrapper(cx, &srcArgs.thisv().toObject()); - JS_ASSERT(srcArgs.thisv().isMagic(JS_IS_CONSTRUCTING) || - !UncheckedUnwrap(wrapper)->is()); + MOZ_ASSERT(srcArgs.thisv().isMagic(JS_IS_CONSTRUCTING) || + !UncheckedUnwrap(wrapper)->is()); RootedObject wrapped(cx, wrappedObject(wrapper)); { @@ -323,7 +323,7 @@ CrossCompartmentWrapper::nativeCall(JSContext *cx, IsAcceptableThis test, Native if (thisObj->is() && Wrapper::wrapperHandler(thisObj)->hasSecurityPolicy()) { - JS_ASSERT(!thisObj->is()); + MOZ_ASSERT(!thisObj->is()); *dst = ObjectValue(*Wrapper::wrappedObject(thisObj)); } } @@ -442,13 +442,13 @@ js::IsCrossCompartmentWrapper(JSObject *obj) void js::NukeCrossCompartmentWrapper(JSContext *cx, JSObject *wrapper) { - JS_ASSERT(wrapper->is()); + MOZ_ASSERT(wrapper->is()); NotifyGCNukeWrapper(wrapper); wrapper->as().nuke(&DeadObjectProxy::singleton); - JS_ASSERT(IsDeadProxyObject(wrapper)); + MOZ_ASSERT(IsDeadProxyObject(wrapper)); } /* @@ -509,10 +509,10 @@ js::RemapWrapper(JSContext *cx, JSObject *wobjArg, JSObject *newTargetArg) { RootedObject wobj(cx, wobjArg); RootedObject newTarget(cx, newTargetArg); - JS_ASSERT(wobj->is()); - JS_ASSERT(!newTarget->is()); + MOZ_ASSERT(wobj->is()); + MOZ_ASSERT(!newTarget->is()); JSObject *origTarget = Wrapper::wrappedObject(wobj); - JS_ASSERT(origTarget); + MOZ_ASSERT(origTarget); Value origv = ObjectValue(*origTarget); JSCompartment *wcompartment = wobj->compartment(); @@ -527,7 +527,7 @@ js::RemapWrapper(JSContext *cx, JSObject *wobjArg, JSObject *newTargetArg) // The old value should still be in the cross-compartment wrapper map, and // the lookup should return wobj. WrapperMap::Ptr p = wcompartment->lookupWrapper(origv); - JS_ASSERT(&p->value().unsafeGet()->toObject() == wobj); + MOZ_ASSERT(&p->value().unsafeGet()->toObject() == wobj); wcompartment->removeWrapper(p); // When we remove origv from the wrapper map, its wrapper, wobj, must @@ -556,11 +556,11 @@ js::RemapWrapper(JSContext *cx, JSObject *wobjArg, JSObject *newTargetArg) // Before swapping, this wrapper came out of wrap(), which enforces the // invariant that the wrapper in the map points directly to the key. - JS_ASSERT(Wrapper::wrappedObject(wobj) == newTarget); + MOZ_ASSERT(Wrapper::wrappedObject(wobj) == newTarget); // Update the entry in the compartment's wrapper map to point to the old // wrapper, which has now been updated (via reuse or swap). - JS_ASSERT(wobj->is()); + MOZ_ASSERT(wobj->is()); wcompartment->putWrapper(cx, CrossCompartmentKey(newTarget), ObjectValue(*wobj)); return true; } diff --git a/js/src/proxy/DirectProxyHandler.cpp b/js/src/proxy/DirectProxyHandler.cpp index ebb445866f63..c530f2c776f6 100644 --- a/js/src/proxy/DirectProxyHandler.cpp +++ b/js/src/proxy/DirectProxyHandler.cpp @@ -18,7 +18,7 @@ DirectProxyHandler::getPropertyDescriptor(JSContext *cx, HandleObject proxy, Han MutableHandle desc) const { assertEnteredPolicy(cx, proxy, id, GET | SET | GET_PROPERTY_DESCRIPTOR); - JS_ASSERT(!hasPrototype()); // Should never be called if there's a prototype. + MOZ_ASSERT(!hasPrototype()); // Should never be called if there's a prototype. RootedObject target(cx, proxy->as().target()); return JS_GetPropertyDescriptorById(cx, target, id, desc); } @@ -65,7 +65,7 @@ DirectProxyHandler::enumerate(JSContext *cx, HandleObject proxy, AutoIdVector &props) const { assertEnteredPolicy(cx, proxy, JSID_VOID, ENUMERATE); - JS_ASSERT(!hasPrototype()); // Should never be called if there's a prototype. + MOZ_ASSERT(!hasPrototype()); // Should never be called if there's a prototype. RootedObject target(cx, proxy->as().target()); return GetPropertyNames(cx, target, 0, &props); } @@ -176,7 +176,7 @@ bool DirectProxyHandler::has(JSContext *cx, HandleObject proxy, HandleId id, bool *bp) const { assertEnteredPolicy(cx, proxy, id, GET); - JS_ASSERT(!hasPrototype()); // Should never be called if there's a prototype. + MOZ_ASSERT(!hasPrototype()); // Should never be called if there's a prototype. bool found; RootedObject target(cx, proxy->as().target()); if (!JS_HasPropertyById(cx, target, id, &found)) @@ -230,7 +230,7 @@ DirectProxyHandler::iterate(JSContext *cx, HandleObject proxy, unsigned flags, MutableHandleValue vp) const { assertEnteredPolicy(cx, proxy, JSID_VOID, ENUMERATE); - JS_ASSERT(!hasPrototype()); // Should never be called if there's a prototype. + MOZ_ASSERT(!hasPrototype()); // Should never be called if there's a prototype. RootedObject target(cx, proxy->as().target()); return GetIterator(cx, target, flags, vp); } diff --git a/js/src/proxy/Proxy.cpp b/js/src/proxy/Proxy.cpp index 59b54eeb6c20..0ffe48b4cb2c 100644 --- a/js/src/proxy/Proxy.cpp +++ b/js/src/proxy/Proxy.cpp @@ -67,7 +67,7 @@ void js::AutoEnterPolicy::recordLeave() { if (enteredProxy) { - JS_ASSERT(context->runtime()->enteredPolicy == this); + MOZ_ASSERT(context->runtime()->enteredPolicy == this); context->runtime()->enteredPolicy = prev; } } @@ -520,7 +520,7 @@ JSObject * const TaggedProto::LazyProto = reinterpret_cast(0x1); bool Proxy::getPrototypeOf(JSContext *cx, HandleObject proxy, MutableHandleObject proto) { - JS_ASSERT(proxy->getTaggedProto().isLazy()); + MOZ_ASSERT(proxy->getTaggedProto().isLazy()); JS_CHECK_RECURSION(cx, return false); return proxy->as().handler()->getPrototypeOf(cx, proxy, proto); } @@ -528,7 +528,7 @@ Proxy::getPrototypeOf(JSContext *cx, HandleObject proxy, MutableHandleObject pro bool Proxy::setPrototypeOf(JSContext *cx, HandleObject proxy, HandleObject proto, bool *bp) { - JS_ASSERT(proxy->getTaggedProto().isLazy()); + MOZ_ASSERT(proxy->getTaggedProto().isLazy()); JS_CHECK_RECURSION(cx, return false); return proxy->as().handler()->setPrototypeOf(cx, proxy, proto, bp); } @@ -557,7 +557,7 @@ Proxy::slice(JSContext *cx, HandleObject proxy, uint32_t begin, uint32_t end, /* mayThrow = */ true); if (!policy.allowed()) { if (policy.returnValue()) { - JS_ASSERT(!cx->isExceptionPending()); + MOZ_ASSERT(!cx->isExceptionPending()); return js::SliceSlowly(cx, proxy, proxy, begin, end, result); } return false; @@ -722,7 +722,7 @@ js::proxy_DeleteGeneric(JSContext *cx, HandleObject obj, HandleId id, bool *succ void js::proxy_Trace(JSTracer *trc, JSObject *obj) { - JS_ASSERT(obj->is()); + MOZ_ASSERT(obj->is()); ProxyObject::trace(trc, obj); } @@ -741,8 +741,8 @@ ProxyObject::trace(JSTracer *trc, JSObject *obj) */ Value key = ObjectValue(*referent); WrapperMap::Ptr p = proxy->compartment()->lookupWrapper(key); - JS_ASSERT(p); - JS_ASSERT(*p->value().unsafeGet() == ObjectValue(*proxy)); + MOZ_ASSERT(p); + MOZ_ASSERT(*p->value().unsafeGet() == ObjectValue(*proxy)); } } #endif @@ -771,28 +771,28 @@ ProxyObject::trace(JSTracer *trc, JSObject *obj) JSObject * js::proxy_WeakmapKeyDelegate(JSObject *obj) { - JS_ASSERT(obj->is()); + MOZ_ASSERT(obj->is()); return obj->as().handler()->weakmapKeyDelegate(obj); } bool js::proxy_Convert(JSContext *cx, HandleObject proxy, JSType hint, MutableHandleValue vp) { - JS_ASSERT(proxy->is()); + MOZ_ASSERT(proxy->is()); return Proxy::defaultValue(cx, proxy, hint, vp); } void js::proxy_Finalize(FreeOp *fop, JSObject *obj) { - JS_ASSERT(obj->is()); + MOZ_ASSERT(obj->is()); obj->as().handler()->finalize(fop, obj); } void js::proxy_ObjectMoved(JSObject *obj, const JSObject *old) { - JS_ASSERT(obj->is()); + MOZ_ASSERT(obj->is()); obj->as().handler()->objectMoved(obj, old); } @@ -811,7 +811,7 @@ js::proxy_Call(JSContext *cx, unsigned argc, Value *vp) { CallArgs args = CallArgsFromVp(argc, vp); RootedObject proxy(cx, &args.callee()); - JS_ASSERT(proxy->is()); + MOZ_ASSERT(proxy->is()); return Proxy::call(cx, proxy, args); } @@ -820,7 +820,7 @@ js::proxy_Construct(JSContext *cx, unsigned argc, Value *vp) { CallArgs args = CallArgsFromVp(argc, vp); RootedObject proxy(cx, &args.callee()); - JS_ASSERT(proxy->is()); + MOZ_ASSERT(proxy->is()); return Proxy::construct(cx, proxy, args); } @@ -862,10 +862,10 @@ void ProxyObject::renew(JSContext *cx, const BaseProxyHandler *handler, Value priv) { JS_ASSERT_IF(IsCrossCompartmentWrapper(this), IsDeadProxyObject(this)); - JS_ASSERT(getParent() == cx->global()); - JS_ASSERT(getClass() == &ProxyObject::class_); - JS_ASSERT(!getClass()->ext.innerObject); - JS_ASSERT(getTaggedProto().isLazy()); + MOZ_ASSERT(getParent() == cx->global()); + MOZ_ASSERT(getClass() == &ProxyObject::class_); + MOZ_ASSERT(!getClass()->ext.innerObject); + MOZ_ASSERT(getTaggedProto().isLazy()); setHandler(handler); setCrossCompartmentSlot(PRIVATE_SLOT, priv); diff --git a/js/src/proxy/ScriptedDirectProxyHandler.cpp b/js/src/proxy/ScriptedDirectProxyHandler.cpp index 33bfa3960502..bd07795249a8 100644 --- a/js/src/proxy/ScriptedDirectProxyHandler.cpp +++ b/js/src/proxy/ScriptedDirectProxyHandler.cpp @@ -98,7 +98,7 @@ ValidatePropertyDescriptor(JSContext *cx, bool extensible, Handle desc // step 8 if (IsDataDescriptor(current)) { - JS_ASSERT(desc.isDataDescriptor()); // by step 7a + MOZ_ASSERT(desc.isDataDescriptor()); // by step 7a if (current.isPermanent() && current.isReadonly()) { if (desc.hasWritable() && desc.writable()) { *bp = false; @@ -121,8 +121,8 @@ ValidatePropertyDescriptor(JSContext *cx, bool extensible, Handle desc } // step 9 - JS_ASSERT(IsAccessorDescriptor(current)); // by step 8 - JS_ASSERT(desc.isAccessorDescriptor()); // by step 7a + MOZ_ASSERT(IsAccessorDescriptor(current)); // by step 8 + MOZ_ASSERT(desc.isAccessorDescriptor()); // by step 7a *bp = (!current.isPermanent() || ((!desc.hasSet() || desc.setter() == current.setter()) && (!desc.hasGet() || desc.getter() == current.getter()))); @@ -157,7 +157,7 @@ HasOwn(JSContext *cx, HandleObject obj, HandleId id, bool *bp) static JSObject * GetDirectProxyHandlerObject(JSObject *proxy) { - JS_ASSERT(proxy->as().handler() == &ScriptedDirectProxyHandler::singleton); + MOZ_ASSERT(proxy->as().handler() == &ScriptedDirectProxyHandler::singleton); return proxy->as().extra(ScriptedDirectProxyHandler::HANDLER_EXTRA).toObjectOrNull(); } @@ -177,7 +177,7 @@ static bool ArrayToIdVector(JSContext *cx, HandleObject proxy, HandleObject target, HandleValue v, AutoIdVector &props, unsigned flags, JSAtom *trapName_) { - JS_ASSERT(v.isObject()); + MOZ_ASSERT(v.isObject()); RootedObject array(cx, &v.toObject()); RootedAtom trapName(cx, trapName_); @@ -343,7 +343,7 @@ ScriptedDirectProxyHandler::getPropertyDescriptor(JSContext *cx, HandleObject pr if (!JSObject::getProto(cx, proxy, &proto)) return false; if (!proto) { - JS_ASSERT(!desc.object()); + MOZ_ASSERT(!desc.object()); return true; } return JS_GetPropertyDescriptorById(cx, proto, id, desc); diff --git a/js/src/proxy/ScriptedIndirectProxyHandler.cpp b/js/src/proxy/ScriptedIndirectProxyHandler.cpp index 060abae367ac..8693e0a871d0 100644 --- a/js/src/proxy/ScriptedIndirectProxyHandler.cpp +++ b/js/src/proxy/ScriptedIndirectProxyHandler.cpp @@ -27,12 +27,12 @@ static bool GetDerivedTrap(JSContext *cx, HandleObject handler, HandlePropertyName name, MutableHandleValue fvalp) { - JS_ASSERT(name == cx->names().has || - name == cx->names().hasOwn || - name == cx->names().get || - name == cx->names().set || - name == cx->names().keys || - name == cx->names().iterate); + MOZ_ASSERT(name == cx->names().has || + name == cx->names().hasOwn || + name == cx->names().get || + name == cx->names().set || + name == cx->names().keys || + name == cx->names().iterate); return JSObject::getProperty(cx, handler, handler, name, fvalp); } @@ -82,7 +82,7 @@ ValueToBool(HandleValue v, bool *bp) static bool ArrayToIdVector(JSContext *cx, const Value &array, AutoIdVector &props) { - JS_ASSERT(props.length() == 0); + MOZ_ASSERT(props.length() == 0); if (array.isPrimitive()) return true; @@ -357,9 +357,9 @@ CallableScriptedIndirectProxyHandler::call(JSContext *cx, HandleObject proxy, co { assertEnteredPolicy(cx, proxy, JSID_VOID, CALL); RootedObject ccHolder(cx, &proxy->as().extra(0).toObject()); - JS_ASSERT(ccHolder->getClass() == &CallConstructHolder); + MOZ_ASSERT(ccHolder->getClass() == &CallConstructHolder); RootedValue call(cx, ccHolder->getReservedSlot(0)); - JS_ASSERT(call.isObject() && call.toObject().isCallable()); + MOZ_ASSERT(call.isObject() && call.toObject().isCallable()); return Invoke(cx, args.thisv(), call, args.length(), args.array(), args.rval()); } @@ -368,9 +368,9 @@ CallableScriptedIndirectProxyHandler::construct(JSContext *cx, HandleObject prox { assertEnteredPolicy(cx, proxy, JSID_VOID, CALL); RootedObject ccHolder(cx, &proxy->as().extra(0).toObject()); - JS_ASSERT(ccHolder->getClass() == &CallConstructHolder); + MOZ_ASSERT(ccHolder->getClass() == &CallConstructHolder); RootedValue construct(cx, ccHolder->getReservedSlot(1)); - JS_ASSERT(construct.isObject() && construct.toObject().isCallable()); + MOZ_ASSERT(construct.isObject() && construct.toObject().isCallable()); return InvokeConstructor(cx, construct, args.length(), args.array(), args.rval()); } @@ -393,7 +393,7 @@ js::proxy_create(JSContext *cx, unsigned argc, Value *vp) proto = &args[1].toObject(); parent = proto->getParent(); } else { - JS_ASSERT(IsFunctionObject(&args.callee())); + MOZ_ASSERT(IsFunctionObject(&args.callee())); proto = nullptr; } if (!parent) diff --git a/js/src/proxy/Wrapper.cpp b/js/src/proxy/Wrapper.cpp index 6ec2f4c40183..5d12f19cff58 100644 --- a/js/src/proxy/Wrapper.cpp +++ b/js/src/proxy/Wrapper.cpp @@ -36,7 +36,7 @@ JSObject * Wrapper::New(JSContext *cx, JSObject *obj, JSObject *parent, const Wrapper *handler, const WrapperOptions &options) { - JS_ASSERT(parent); + MOZ_ASSERT(parent); RootedValue priv(cx, ObjectValue(*obj)); return NewProxyObject(cx, handler, priv, options.proto(), parent, options); @@ -52,14 +52,14 @@ Wrapper::Renew(JSContext *cx, JSObject *existing, JSObject *obj, const Wrapper * const Wrapper * Wrapper::wrapperHandler(JSObject *wrapper) { - JS_ASSERT(wrapper->is()); + MOZ_ASSERT(wrapper->is()); return static_cast(wrapper->as().handler()); } JSObject * Wrapper::wrappedObject(JSObject *wrapper) { - JS_ASSERT(wrapper->is()); + MOZ_ASSERT(wrapper->is()); return wrapper->as().target(); } @@ -131,7 +131,7 @@ js::TransparentObjectWrapper(JSContext *cx, HandleObject existing, HandleObject HandleObject parent) { // Allow wrapping outer window proxies. - JS_ASSERT(!obj->is() || obj->getClass()->ext.innerObject); + MOZ_ASSERT(!obj->is() || obj->getClass()->ext.innerObject); return Wrapper::New(cx, obj, parent, &CrossCompartmentWrapper::singleton); } diff --git a/js/src/shell/js.cpp b/js/src/shell/js.cpp index 4666209e62d4..7cdd24d10ba1 100644 --- a/js/src/shell/js.cpp +++ b/js/src/shell/js.cpp @@ -350,7 +350,7 @@ GetContextData(JSContext *cx) { JSShellContextData *data = (JSShellContextData *) JS_GetContextPrivate(cx); - JS_ASSERT(data); + MOZ_ASSERT(data); return data; } @@ -963,7 +963,7 @@ class AutoNewContext AutoNewContext() : oldcx(nullptr), newcx(nullptr) {} bool enter(JSContext *cx) { - JS_ASSERT(!JS_IsExceptionPending(cx)); + MOZ_ASSERT(!JS_IsExceptionPending(cx)); oldcx = cx; newcx = NewContext(JS_GetRuntime(cx)); if (!newcx) @@ -1041,7 +1041,7 @@ CacheEntry_isCacheEntry(JSObject *cache) static JSString * CacheEntry_getSource(HandleObject cache) { - JS_ASSERT(CacheEntry_isCacheEntry(cache)); + MOZ_ASSERT(CacheEntry_isCacheEntry(cache)); Value v = JS_GetReservedSlot(cache, CacheEntry_SOURCE); if (!v.isString()) return nullptr; @@ -1052,7 +1052,7 @@ CacheEntry_getSource(HandleObject cache) static uint8_t * CacheEntry_getBytecode(HandleObject cache, uint32_t *length) { - JS_ASSERT(CacheEntry_isCacheEntry(cache)); + MOZ_ASSERT(CacheEntry_isCacheEntry(cache)); Value v = JS_GetReservedSlot(cache, CacheEntry_BYTECODE); if (!v.isObject() || !v.toObject().is()) return nullptr; @@ -1065,7 +1065,7 @@ CacheEntry_getBytecode(HandleObject cache, uint32_t *length) static bool CacheEntry_setBytecode(JSContext *cx, HandleObject cache, uint8_t *buffer, uint32_t length) { - JS_ASSERT(CacheEntry_isCacheEntry(cache)); + MOZ_ASSERT(CacheEntry_isCacheEntry(cache)); ArrayBufferObject::BufferContents contents = ArrayBufferObject::BufferContents::create(buffer); Rooted arrayBuffer(cx, ArrayBufferObject::create(cx, length, contents)); @@ -1838,7 +1838,7 @@ UpdateSwitchTableBounds(JSContext *cx, HandleScript script, unsigned offset, default: /* [condswitch] switch does not have any jump or lookup tables. */ - JS_ASSERT(op == JSOP_CONDSWITCH); + MOZ_ASSERT(op == JSOP_CONDSWITCH); return; } @@ -1915,7 +1915,7 @@ SrcNotes(JSContext *cx, HandleScript script, Sprinter *sp) case SRC_TABLESWITCH: { JSOp op = JSOp(script->code()[offset]); - JS_ASSERT(op == JSOP_TABLESWITCH); + MOZ_ASSERT(op == JSOP_TABLESWITCH); Sprint(sp, " length %u", unsigned(js_GetSrcNoteOffset(sn, 0))); UpdateSwitchTableBounds(cx, script, offset, &switchTableStart, &switchTableEnd); @@ -1923,7 +1923,7 @@ SrcNotes(JSContext *cx, HandleScript script, Sprinter *sp) } case SRC_CONDSWITCH: { JSOp op = JSOp(script->code()[offset]); - JS_ASSERT(op == JSOP_CONDSWITCH); + MOZ_ASSERT(op == JSOP_CONDSWITCH); Sprint(sp, " length %u", unsigned(js_GetSrcNoteOffset(sn, 0))); unsigned caseOff = (unsigned) js_GetSrcNoteOffset(sn, 1); if (caseOff) @@ -1934,12 +1934,12 @@ SrcNotes(JSContext *cx, HandleScript script, Sprinter *sp) } case SRC_TRY: - JS_ASSERT(JSOp(script->code()[offset]) == JSOP_TRY); + MOZ_ASSERT(JSOp(script->code()[offset]) == JSOP_TRY); Sprint(sp, " offset to jump %u", unsigned(js_GetSrcNoteOffset(sn, 0))); break; default: - JS_ASSERT(0); + MOZ_ASSERT(0); break; } Sprint(sp, "\n"); @@ -1987,7 +1987,7 @@ TryNotes(JSContext *cx, HandleScript script, Sprinter *sp) tnlimit = tn + script->trynotes()->length; Sprint(sp, "\nException table:\nkind stack start end\n"); do { - JS_ASSERT(tn->kind < ArrayLength(TryNoteNames)); + MOZ_ASSERT(tn->kind < ArrayLength(TryNoteNames)); Sprint(sp, " %-7s %6u %8u %8u\n", TryNoteNames[tn->kind], tn->stackDepth, tn->start, tn->start + tn->length); @@ -2974,7 +2974,7 @@ Sleep_fn(JSContext *cx, unsigned argc, Value *vp) static bool InitWatchdog(JSRuntime *rt) { - JS_ASSERT(!gWatchdogThread); + MOZ_ASSERT(!gWatchdogThread); gWatchdogLock = PR_NewLock(); if (gWatchdogLock) { gWatchdogWakeup = PR_NewCondVar(gWatchdogLock); @@ -3048,7 +3048,7 @@ WatchdogMain(void *arg) sleepDuration = PR_TicksPerSecond() / 10; mozilla::DebugOnly status = PR_WaitCondVar(gWatchdogWakeup, sleepDuration); - JS_ASSERT(status == PR_SUCCESS); + MOZ_ASSERT(status == PR_SUCCESS); } } PR_Unlock(gWatchdogLock); @@ -3068,7 +3068,7 @@ ScheduleWatchdog(JSRuntime *rt, double t) int64_t timeout = PRMJ_Now() + interval; PR_Lock(gWatchdogLock); if (!gWatchdogThread) { - JS_ASSERT(!gWatchdogHasTimeout); + MOZ_ASSERT(!gWatchdogHasTimeout); gWatchdogThread = PR_CreateThread(PR_USER_THREAD, WatchdogMain, rt, @@ -3411,7 +3411,7 @@ SyntaxParse(JSContext *cx, unsigned argc, jsval *vp) if (!succeeded && !parser.hadAbortedSyntaxParse()) { // If no exception is posted, either there was an OOM or a language // feature unhandled by the syntax parser was encountered. - JS_ASSERT(cx->runtime()->hadOutOfMemory); + MOZ_ASSERT(cx->runtime()->hadOutOfMemory); return false; } @@ -3435,7 +3435,7 @@ class OffThreadState { if (state != IDLE) return false; - JS_ASSERT(!token); + MOZ_ASSERT(!token); source = newSource.forget(); @@ -3445,9 +3445,9 @@ class OffThreadState { void abandon(JSContext *cx) { AutoLockMonitor alm(monitor); - JS_ASSERT(state == COMPILING); - JS_ASSERT(!token); - JS_ASSERT(source); + MOZ_ASSERT(state == COMPILING); + MOZ_ASSERT(!token); + MOZ_ASSERT(source); js_free(source); source = nullptr; @@ -3457,10 +3457,10 @@ class OffThreadState { void markDone(void *newToken) { AutoLockMonitor alm(monitor); - JS_ASSERT(state == COMPILING); - JS_ASSERT(!token); - JS_ASSERT(source); - JS_ASSERT(newToken); + MOZ_ASSERT(state == COMPILING); + MOZ_ASSERT(!token); + MOZ_ASSERT(source); + MOZ_ASSERT(newToken); token = newToken; state = DONE; @@ -3477,11 +3477,11 @@ class OffThreadState { alm.wait(); } - JS_ASSERT(source); + MOZ_ASSERT(source); js_free(source); source = nullptr; - JS_ASSERT(token); + MOZ_ASSERT(token); void *holdToken = token; token = nullptr; state = IDLE; @@ -3625,7 +3625,7 @@ struct FreeOnReturn } void init(const char *ptr) { - JS_ASSERT(!this->ptr); + MOZ_ASSERT(!this->ptr); this->ptr = ptr; } @@ -3838,7 +3838,7 @@ EscapeForShell(AutoCStringVector &argv) } *dst++ = '\"'; *dst++ = '\0'; - JS_ASSERT(escaped + newLen == dst); + MOZ_ASSERT(escaped + newLen == dst); argv.replace(i, escaped); } @@ -4263,8 +4263,8 @@ SingleStepCallback(void *arg, jit::Simulator *sim, void *pc) DebugOnly lastStackAddress = nullptr; StackChars stack; for (JS::ProfilingFrameIterator i(rt, state); !i.done(); ++i) { - JS_ASSERT(i.stackAddress() != nullptr); - JS_ASSERT(lastStackAddress <= i.stackAddress()); + MOZ_ASSERT(i.stackAddress() != nullptr); + MOZ_ASSERT(lastStackAddress <= i.stackAddress()); lastStackAddress = i.stackAddress(); const char *label = i.label(); stack.append(label, strlen(label)); @@ -4979,8 +4979,8 @@ static const JSClass *GetDomClass(); static bool dom_get_x(JSContext* cx, HandleObject obj, void *self, JSJitGetterCallArgs args) { - JS_ASSERT(JS_GetClass(obj) == GetDomClass()); - JS_ASSERT(self == (void *)0x1234); + MOZ_ASSERT(JS_GetClass(obj) == GetDomClass()); + MOZ_ASSERT(self == (void *)0x1234); args.rval().set(JS_NumberValue(double(3.14))); return true; } @@ -4988,16 +4988,16 @@ dom_get_x(JSContext* cx, HandleObject obj, void *self, JSJitGetterCallArgs args) static bool dom_set_x(JSContext* cx, HandleObject obj, void *self, JSJitSetterCallArgs args) { - JS_ASSERT(JS_GetClass(obj) == GetDomClass()); - JS_ASSERT(self == (void *)0x1234); + MOZ_ASSERT(JS_GetClass(obj) == GetDomClass()); + MOZ_ASSERT(self == (void *)0x1234); return true; } static bool dom_doFoo(JSContext* cx, HandleObject obj, void *self, const JSJitMethodCallArgs& args) { - JS_ASSERT(JS_GetClass(obj) == GetDomClass()); - JS_ASSERT(self == (void *)0x1234); + MOZ_ASSERT(JS_GetClass(obj) == GetDomClass()); + MOZ_ASSERT(self == (void *)0x1234); /* Just return args.length(). */ args.rval().setInt32(args.length()); @@ -5115,7 +5115,7 @@ dom_genericSetter(JSContext* cx, unsigned argc, JS::Value* vp) if (!obj) return false; - JS_ASSERT(args.length() == 1); + MOZ_ASSERT(args.length() == 1); if (JS_GetClass(obj) != &dom_class) { args.rval().set(UndefinedValue()); @@ -5213,7 +5213,7 @@ class ScopedFileDesc ~ScopedFileDesc() { if (fd_ == -1) return; - JS_ASSERT(jsCacheOpened == true); + MOZ_ASSERT(jsCacheOpened == true); jsCacheOpened = false; close(fd_); } @@ -5299,7 +5299,7 @@ ShellCloseAsmJSCacheEntryForRead(size_t serializedSize, const uint8_t *memory, i munmap(const_cast(memory), serializedSize); #endif - JS_ASSERT(jsCacheOpened == true); + MOZ_ASSERT(jsCacheOpened == true); jsCacheOpened = false; close(handle); } @@ -5367,7 +5367,7 @@ ShellOpenAsmJSCacheEntryForWrite(HandleObject global, bool installed, // The embedding added the cookie so strip it off of the buffer returned to // the JS engine. The asmJSCacheCookie will be written on close, below. - JS_ASSERT(*(uint32_t *)memory == 0); + MOZ_ASSERT(*(uint32_t *)memory == 0); *memoryOut = (uint8_t *)memory + sizeof(uint32_t); *handleOut = fd.forget(); return true; @@ -5388,7 +5388,7 @@ ShellCloseAsmJSCacheEntryForWrite(size_t serializedSize, uint8_t *memory, intptr msync(memory, serializedSize, MS_SYNC); #endif - JS_ASSERT(*(uint32_t *)memory == 0); + MOZ_ASSERT(*(uint32_t *)memory == 0); *(uint32_t *)memory = asmJSCacheCookie; // Free the memory mapping and file. @@ -5398,7 +5398,7 @@ ShellCloseAsmJSCacheEntryForWrite(size_t serializedSize, uint8_t *memory, intptr munmap(memory, serializedSize); #endif - JS_ASSERT(jsCacheOpened == true); + MOZ_ASSERT(jsCacheOpened == true); jsCacheOpened = false; close(handle); } diff --git a/js/src/shell/jsheaptools.cpp b/js/src/shell/jsheaptools.cpp index f172b1710e05..665195c8b343 100644 --- a/js/src/shell/jsheaptools.cpp +++ b/js/src/shell/jsheaptools.cpp @@ -428,7 +428,7 @@ ReferenceFinder::visit(void *cell, Path *path) return addReferrer(JSVAL_NULL, path); HeapReverser::Map::Ptr p = reverser.map.lookup(cell); - JS_ASSERT(p); + MOZ_ASSERT(p); HeapReverser::Node *node = &p->value(); /* Is |cell| a representable cell, reached via a non-empty path? */ @@ -487,7 +487,7 @@ ReferenceFinder::Path::computeName(JSContext *cx) next += 2; } } - JS_ASSERT(next + 1 == path + size); + MOZ_ASSERT(next + 1 == path + size); return path; } @@ -520,7 +520,7 @@ ReferenceFinder::addReferrer(jsval referrerArg, Path *path) /* The property's value had better be an array. */ RootedObject array(context, &v.toObject()); - JS_ASSERT(JS_IsArrayObject(context, array)); + MOZ_ASSERT(JS_IsArrayObject(context, array)); /* Append our referrer to this array. */ uint32_t length; diff --git a/js/src/shell/jsoptparse.cpp b/js/src/shell/jsoptparse.cpp index afacb6f33f43..9277092d0e40 100644 --- a/js/src/shell/jsoptparse.cpp +++ b/js/src/shell/jsoptparse.cpp @@ -26,7 +26,7 @@ const char OptionParser::prognameMeta[] = "{progname}"; __cls##Option * \ Option::as##__cls##Option() \ { \ - JS_ASSERT(is##__cls##Option()); \ + MOZ_ASSERT(is##__cls##Option()); \ return static_cast<__cls##Option *>(this); \ } \ const __cls##Option * \ @@ -38,7 +38,7 @@ const char OptionParser::prognameMeta[] = "{progname}"; ValuedOption * Option::asValued() { - JS_ASSERT(isValued()); + MOZ_ASSERT(isValued()); return static_cast(this); } @@ -90,7 +90,7 @@ PrintParagraph(const char *text, unsigned startColno, const unsigned limitColno, printf("%*s", startColno, ""); while (*it != '\0') { - JS_ASSERT(!isspace(*it)); + MOZ_ASSERT(!isspace(*it)); /* Delimit the current token. */ const char *limit = it; @@ -101,9 +101,9 @@ PrintParagraph(const char *text, unsigned startColno, const unsigned limitColno, * If the current token is longer than the available number of columns, * then make a line break before printing the token. */ - JS_ASSERT(limit - it > 0); + MOZ_ASSERT(limit - it > 0); size_t tokLen = limit - it; - JS_ASSERT(tokLen); + MOZ_ASSERT(tokLen); if (tokLen + colno >= limitColno) { printf("\n%*s%.*s", startColno, "", int(tokLen), it); colno = startColno + tokLen; @@ -249,7 +249,7 @@ OptionParser::printHelp(const char *progname) OptionParser::Result OptionParser::extractValue(size_t argc, char **argv, size_t *i, char **value) { - JS_ASSERT(*i < argc); + MOZ_ASSERT(*i < argc); char *eq = strchr(argv[*i], '='); if (eq) { *value = eq + 1; @@ -343,7 +343,7 @@ OptionParser::handleArg(size_t argc, char **argv, size_t *i, bool *optionsAllowe OptionParser::Result OptionParser::parseArgs(int inputArgc, char **argv) { - JS_ASSERT(inputArgc >= 0); + MOZ_ASSERT(inputArgc >= 0); size_t argc = inputArgc; /* Permit a "no more options" capability, like |--| offers in many shell interfaces. */ bool optionsAllowed = true; diff --git a/js/src/shell/jsoptparse.h b/js/src/shell/jsoptparse.h index 5c263544644e..04ef5ae265de 100644 --- a/js/src/shell/jsoptparse.h +++ b/js/src/shell/jsoptparse.h @@ -166,13 +166,13 @@ class MultiStringRange public: explicit MultiStringRange(const StringArg *cur, const StringArg *end) : cur(cur), end(end) { - JS_ASSERT(end - cur >= 0); + MOZ_ASSERT(end - cur >= 0); } bool empty() const { return cur == end; } - void popFront() { JS_ASSERT(!empty()); ++cur; } - char *front() const { JS_ASSERT(!empty()); return cur->value; } - size_t argno() const { JS_ASSERT(!empty()); return cur->argno; } + void popFront() { MOZ_ASSERT(!empty()); ++cur; } + char *front() const { MOZ_ASSERT(!empty()); return cur->value; } + size_t argno() const { MOZ_ASSERT(!empty()); return cur->argno; } }; /* diff --git a/js/src/vm/ArgumentsObject-inl.h b/js/src/vm/ArgumentsObject-inl.h index a71084ecc66a..2e4916d0eb51 100644 --- a/js/src/vm/ArgumentsObject-inl.h +++ b/js/src/vm/ArgumentsObject-inl.h @@ -20,7 +20,7 @@ namespace js { inline const Value & ArgumentsObject::element(uint32_t i) const { - JS_ASSERT(!isElementDeleted(i)); + MOZ_ASSERT(!isElementDeleted(i)); const Value &v = data()->args[i]; if (v.isMagic()) { CallObject &callobj = getFixedSlot(MAYBE_CALL_SLOT).toObject().as(); @@ -32,7 +32,7 @@ ArgumentsObject::element(uint32_t i) const inline void ArgumentsObject::setElement(JSContext *cx, uint32_t i, const Value &v) { - JS_ASSERT(!isElementDeleted(i)); + MOZ_ASSERT(!isElementDeleted(i)); HeapValue &lhs = data()->args[i]; if (lhs.isMagic()) { uint32_t slot = lhs.magicUint32(); @@ -51,7 +51,7 @@ ArgumentsObject::setElement(JSContext *cx, uint32_t i, const Value &v) inline bool ArgumentsObject::maybeGetElements(uint32_t start, uint32_t count, Value *vp) { - JS_ASSERT(start + count >= start); + MOZ_ASSERT(start + count >= start); uint32_t length = initialLength(); if (start > length || start + count > length || isAnyElementDeleted()) diff --git a/js/src/vm/ArgumentsObject.cpp b/js/src/vm/ArgumentsObject.cpp index 401f35857ac1..1a96198c9009 100644 --- a/js/src/vm/ArgumentsObject.cpp +++ b/js/src/vm/ArgumentsObject.cpp @@ -24,7 +24,7 @@ CopyStackFrameArguments(const AbstractFramePtr frame, HeapValue *dst, unsigned t { JS_ASSERT_IF(frame.isInterpreterFrame(), !frame.asInterpreterFrame()->runningInJit()); - JS_ASSERT(Max(frame.numActualArgs(), frame.numFormalArgs()) == totalArgs); + MOZ_ASSERT(Max(frame.numActualArgs(), frame.numFormalArgs()) == totalArgs); /* Copy arguments. */ Value *src = frame.argv(); @@ -52,7 +52,7 @@ ArgumentsObject::MaybeForwardToCallObject(jit::IonJSFrameLayout *frame, HandleOb JSFunction *callee = jit::CalleeTokenToFunction(frame->calleeToken()); JSScript *script = callee->nonLazyScript(); if (callee->isHeavyweight() && script->argsObjAliasesFormals()) { - JS_ASSERT(callObj && callObj->is()); + MOZ_ASSERT(callObj && callObj->is()); obj->initFixedSlot(MAYBE_CALL_SLOT, ObjectValue(*callObj.get())); for (AliasedFormalIter fi(script); fi; fi++) data->args[fi.frameIndex()] = JS::MagicValueUint32(fi.scopeSlot()); @@ -92,9 +92,9 @@ struct CopyIonJSFrameArgs void copyArgs(JSContext *, HeapValue *dstBase, unsigned totalArgs) const { unsigned numActuals = frame_->numActualArgs(); unsigned numFormals = jit::CalleeTokenToFunction(frame_->calleeToken())->nargs(); - JS_ASSERT(numActuals <= totalArgs); - JS_ASSERT(numFormals <= totalArgs); - JS_ASSERT(Max(numActuals, numFormals) == totalArgs); + MOZ_ASSERT(numActuals <= totalArgs); + MOZ_ASSERT(numFormals <= totalArgs); + MOZ_ASSERT(Max(numActuals, numFormals) == totalArgs); /* Copy all arguments. */ Value *src = frame_->argv() + 1; /* +1 to skip this. */ @@ -134,9 +134,9 @@ struct CopyScriptFrameIterArgs /* Define formals which are not part of the actuals. */ unsigned numActuals = iter_.numActualArgs(); unsigned numFormals = iter_.callee()->nargs(); - JS_ASSERT(numActuals <= totalArgs); - JS_ASSERT(numFormals <= totalArgs); - JS_ASSERT(Max(numActuals, numFormals) == totalArgs); + MOZ_ASSERT(numActuals <= totalArgs); + MOZ_ASSERT(numFormals <= totalArgs); + MOZ_ASSERT(Max(numActuals, numFormals) == totalArgs); if (numActuals < numFormals) { HeapValue *dst = dstBase + numActuals, *dstEnd = dstBase + totalArgs; @@ -223,15 +223,15 @@ ArgumentsObject::create(JSContext *cx, HandleScript script, HandleFunction calle copy.maybeForwardToCallObject(obj, data); ArgumentsObject &argsobj = obj->as(); - JS_ASSERT(argsobj.initialLength() == numActuals); - JS_ASSERT(!argsobj.hasOverriddenLength()); + MOZ_ASSERT(argsobj.initialLength() == numActuals); + MOZ_ASSERT(!argsobj.hasOverriddenLength()); return &argsobj; } ArgumentsObject * ArgumentsObject::createExpected(JSContext *cx, AbstractFramePtr frame) { - JS_ASSERT(frame.script()->needsArgsObj()); + MOZ_ASSERT(frame.script()->needsArgsObj()); RootedScript script(cx, frame.script()); RootedFunction callee(cx, frame.callee()); CopyFrameArgs copy(frame); @@ -265,7 +265,7 @@ ArgumentsObject * ArgumentsObject::createForIon(JSContext *cx, jit::IonJSFrameLayout *frame, HandleObject scopeChain) { jit::CalleeToken token = frame->calleeToken(); - JS_ASSERT(jit::CalleeTokenIsFunction(token)); + MOZ_ASSERT(jit::CalleeTokenIsFunction(token)); RootedScript script(cx, jit::ScriptFromCalleeToken(token)); RootedFunction callee(cx, jit::CalleeTokenToFunction(token)); RootedObject callObj(cx, scopeChain->is() ? scopeChain.get() : nullptr); @@ -309,7 +309,7 @@ ArgGetter(JSContext *cx, HandleObject obj, HandleId id, MutableHandleValue vp) if (!argsobj.hasOverriddenLength()) vp.setInt32(argsobj.initialLength()); } else { - JS_ASSERT(JSID_IS_ATOM(id, cx->names().callee)); + MOZ_ASSERT(JSID_IS_ATOM(id, cx->names().callee)); if (!argsobj.callee().isMagic(JS_OVERWRITTEN_CALLEE)) vp.set(argsobj.callee()); } @@ -325,7 +325,7 @@ ArgSetter(JSContext *cx, HandleObject obj, HandleId id, bool strict, MutableHand unsigned attrs; if (!baseops::GetAttributes(cx, obj, id, &attrs)) return false; - JS_ASSERT(!(attrs & JSPROP_READONLY)); + MOZ_ASSERT(!(attrs & JSPROP_READONLY)); attrs &= (JSPROP_ENUMERATE | JSPROP_PERMANENT); /* only valid attributes */ NormalArgumentsObject &argsobj = obj->as(); @@ -340,7 +340,7 @@ ArgSetter(JSContext *cx, HandleObject obj, HandleId id, bool strict, MutableHand return true; } } else { - JS_ASSERT(JSID_IS_ATOM(id, cx->names().length) || JSID_IS_ATOM(id, cx->names().callee)); + MOZ_ASSERT(JSID_IS_ATOM(id, cx->names().length) || JSID_IS_ATOM(id, cx->names().callee)); } /* @@ -431,7 +431,7 @@ StrictArgGetter(JSContext *cx, HandleObject obj, HandleId id, MutableHandleValue if (arg < argsobj.initialLength() && !argsobj.isElementDeleted(arg)) vp.set(argsobj.element(arg)); } else { - JS_ASSERT(JSID_IS_ATOM(id, cx->names().length)); + MOZ_ASSERT(JSID_IS_ATOM(id, cx->names().length)); if (!argsobj.hasOverriddenLength()) vp.setInt32(argsobj.initialLength()); } @@ -447,7 +447,7 @@ StrictArgSetter(JSContext *cx, HandleObject obj, HandleId id, bool strict, Mutab unsigned attrs; if (!baseops::GetAttributes(cx, obj, id, &attrs)) return false; - JS_ASSERT(!(attrs & JSPROP_READONLY)); + MOZ_ASSERT(!(attrs & JSPROP_READONLY)); attrs &= (JSPROP_ENUMERATE | JSPROP_PERMANENT); /* only valid attributes */ Rooted argsobj(cx, &obj->as()); @@ -459,7 +459,7 @@ StrictArgSetter(JSContext *cx, HandleObject obj, HandleId id, bool strict, Mutab return true; } } else { - JS_ASSERT(JSID_IS_ATOM(id, cx->names().length)); + MOZ_ASSERT(JSID_IS_ATOM(id, cx->names().length)); } /* diff --git a/js/src/vm/ArgumentsObject.h b/js/src/vm/ArgumentsObject.h index 616d95305254..8c7d22ccaa93 100644 --- a/js/src/vm/ArgumentsObject.h +++ b/js/src/vm/ArgumentsObject.h @@ -152,7 +152,7 @@ class ArgumentsObject : public JSObject */ uint32_t initialLength() const { uint32_t argc = uint32_t(getFixedSlot(INITIAL_LENGTH_SLOT).toInt32()) >> PACKED_BITS_COUNT; - JS_ASSERT(argc <= ARGS_LENGTH_MAX); + MOZ_ASSERT(argc <= ARGS_LENGTH_MAX); return argc; } @@ -187,7 +187,7 @@ class ArgumentsObject : public JSObject * ArgumentsData::slots. */ bool isElementDeleted(uint32_t i) const { - JS_ASSERT(i < data()->numArgs); + MOZ_ASSERT(i < data()->numArgs); if (i >= initialLength()) return false; return IsBitArrayElementSet(data()->deletedBits, initialLength(), i); @@ -221,16 +221,16 @@ class ArgumentsObject : public JSObject inline void setElement(JSContext *cx, uint32_t i, const Value &v); const Value &arg(unsigned i) const { - JS_ASSERT(i < data()->numArgs); + MOZ_ASSERT(i < data()->numArgs); const Value &v = data()->args[i]; - JS_ASSERT(!v.isMagic()); + MOZ_ASSERT(!v.isMagic()); return v; } void setArg(unsigned i, const Value &v) { - JS_ASSERT(i < data()->numArgs); + MOZ_ASSERT(i < data()->numArgs); HeapValue &lhs = data()->args[i]; - JS_ASSERT(!lhs.isMagic()); + MOZ_ASSERT(!lhs.isMagic()); lhs = v; } diff --git a/js/src/vm/ArrayBufferObject.cpp b/js/src/vm/ArrayBufferObject.cpp index d5ab9394edc8..635ba70f94b4 100644 --- a/js/src/vm/ArrayBufferObject.cpp +++ b/js/src/vm/ArrayBufferObject.cpp @@ -162,21 +162,21 @@ js::IsArrayBuffer(JSObject *obj) ArrayBufferObject & js::AsArrayBuffer(HandleObject obj) { - JS_ASSERT(IsArrayBuffer(obj)); + MOZ_ASSERT(IsArrayBuffer(obj)); return obj->as(); } ArrayBufferObject & js::AsArrayBuffer(JSObject *obj) { - JS_ASSERT(IsArrayBuffer(obj)); + MOZ_ASSERT(IsArrayBuffer(obj)); return obj->as(); } MOZ_ALWAYS_INLINE bool ArrayBufferObject::byteLengthGetterImpl(JSContext *cx, CallArgs args) { - JS_ASSERT(IsArrayBuffer(args.thisv())); + MOZ_ASSERT(IsArrayBuffer(args.thisv())); args.rval().setInt32(args.thisv().toObject().as().byteLength()); return true; } @@ -191,7 +191,7 @@ ArrayBufferObject::byteLengthGetter(JSContext *cx, unsigned argc, Value *vp) bool ArrayBufferObject::fun_slice_impl(JSContext *cx, CallArgs args) { - JS_ASSERT(IsArrayBuffer(args.thisv())); + MOZ_ASSERT(IsArrayBuffer(args.thisv())); Rooted thisObj(cx, &args.thisv().toObject().as()); @@ -301,7 +301,7 @@ ArrayBufferObject::neuterView(JSContext *cx, ArrayBufferViewObject *view, ArrayBufferObject::neuter(JSContext *cx, Handle buffer, BufferContents newContents) { - JS_ASSERT(buffer->canNeuter(cx)); + MOZ_ASSERT(buffer->canNeuter(cx)); // Neuter all views on the buffer, clear out the list of views and the // buffer's data. @@ -325,10 +325,10 @@ ArrayBufferObject::neuter(JSContext *cx, Handle buffer, void ArrayBufferObject::setNewOwnedData(FreeOp* fop, BufferContents newContents) { - JS_ASSERT(!isAsmJSArrayBuffer()); + MOZ_ASSERT(!isAsmJSArrayBuffer()); if (ownsData()) { - JS_ASSERT(newContents.data() != dataPointer()); + MOZ_ASSERT(newContents.data() != dataPointer()); releaseData(fop); } @@ -344,7 +344,7 @@ ArrayBufferObject::changeViewContents(JSContext *cx, ArrayBufferViewObject *view // with the correct pointer). uint8_t *viewDataPointer = view->dataPointer(); if (viewDataPointer) { - JS_ASSERT(newContents); + MOZ_ASSERT(newContents); ptrdiff_t offset = viewDataPointer - oldDataPointer; viewDataPointer = static_cast(newContents.data()) + offset; view->setPrivate(viewDataPointer); @@ -386,7 +386,7 @@ ArrayBufferObject::prepareForAsmJSNoSignals(JSContext *cx, Handlefree_(dataPointer()); } @@ -415,7 +415,7 @@ ArrayBufferObject::prepareForAsmJS(JSContext *cx, Handle buf # endif // Enable access to the valid region. - JS_ASSERT(buffer->byteLength() % AsmJSPageSize == 0); + MOZ_ASSERT(buffer->byteLength() % AsmJSPageSize == 0); # ifdef XP_WIN if (!VirtualAlloc(data, buffer->byteLength(), MEM_COMMIT, PAGE_READWRITE)) { VirtualFree(data, 0, MEM_RELEASE); @@ -441,7 +441,7 @@ ArrayBufferObject::prepareForAsmJS(JSContext *cx, Handle buf // ArrayBufferObject so we don't do this again. BufferContents newContents = BufferContents::create(data); buffer->changeContents(cx, newContents); - JS_ASSERT(data == buffer->dataPointer()); + MOZ_ASSERT(data == buffer->dataPointer()); return true; } @@ -456,7 +456,7 @@ ArrayBufferObject::releaseAsmJSArray(FreeOp *fop) void *data = dataPointer(); - JS_ASSERT(uintptr_t(data) % AsmJSPageSize == 0); + MOZ_ASSERT(uintptr_t(data) % AsmJSPageSize == 0); # ifdef XP_WIN VirtualFree(data, 0, MEM_RELEASE); # else @@ -477,7 +477,7 @@ ArrayBufferObject::prepareForAsmJS(JSContext *cx, Handle buf { // Platforms other than x64 don't use signalling for bounds checking, so // just use the variant with no signals. - JS_ASSERT(!usesSignalHandlers); + MOZ_ASSERT(!usesSignalHandlers); return prepareForAsmJSNoSignals(cx, buffer); } @@ -534,7 +534,7 @@ ArrayBufferObject::dataPointer() const void ArrayBufferObject::releaseData(FreeOp *fop) { - JS_ASSERT(ownsData()); + MOZ_ASSERT(ownsData()); BufferKind bufkind = bufferKind(); if (bufkind & ASMJS_BUFFER) @@ -601,7 +601,7 @@ ArrayBufferObject::create(JSContext *cx, uint32_t nbytes, BufferContents content size_t usableSlots = JSObject::MAX_FIXED_SLOTS - reservedSlots; if (nbytes <= usableSlots * sizeof(Value)) { int newSlots = (nbytes - 1) / sizeof(Value) + 1; - JS_ASSERT(int(nbytes) <= newSlots * int(sizeof(Value))); + MOZ_ASSERT(int(nbytes) <= newSlots * int(sizeof(Value))); nslots = reservedSlots + newSlots; contents = BufferContents::createUnowned(nullptr); } else { @@ -612,7 +612,7 @@ ArrayBufferObject::create(JSContext *cx, uint32_t nbytes, BufferContents content } } - JS_ASSERT(!(class_.flags & JSCLASS_HAS_PRIVATE)); + MOZ_ASSERT(!(class_.flags & JSCLASS_HAS_PRIVATE)); gc::AllocKind allocKind = GetGCObjectKind(nslots); Rooted obj(cx, NewBuiltinClassInstance(cx, allocKind, newKind)); @@ -622,8 +622,8 @@ ArrayBufferObject::create(JSContext *cx, uint32_t nbytes, BufferContents content return nullptr; } - JS_ASSERT(obj->getClass() == &class_); - JS_ASSERT(!gc::IsInsideNursery(obj)); + MOZ_ASSERT(obj->getClass() == &class_); + MOZ_ASSERT(!gc::IsInsideNursery(obj)); if (!contents) { void *data = obj->inlineDataPointer(); @@ -668,14 +668,14 @@ ArrayBufferObject::createSlice(JSContext *cx, Handle arrayBu bool ArrayBufferObject::createDataViewForThisImpl(JSContext *cx, CallArgs args) { - JS_ASSERT(IsArrayBuffer(args.thisv())); + MOZ_ASSERT(IsArrayBuffer(args.thisv())); /* * This method is only called for |DataView(alienBuf, ...)| which calls * this as |createDataViewForThis.call(alienBuf, ..., DataView.prototype)|, * ergo there must be at least two arguments. */ - JS_ASSERT(args.length() >= 2); + MOZ_ASSERT(args.length() >= 2); Rooted proto(cx, &args[args.length() - 1].toObject()); @@ -816,19 +816,19 @@ bool InnerViewTable::addView(JSContext *cx, ArrayBufferObject *obj, ArrayBufferViewObject *view) { // ArrayBufferObject entries are only added when there are multiple views. - JS_ASSERT(obj->firstView()); + MOZ_ASSERT(obj->firstView()); if (!map.initialized() && !map.init()) return false; Map::AddPtr p = map.lookupForAdd(obj); - JS_ASSERT(!gc::IsInsideNursery(obj)); + MOZ_ASSERT(!gc::IsInsideNursery(obj)); bool addToNursery = nurseryKeysValid && gc::IsInsideNursery(view); if (p) { ViewVector &views = p->value(); - JS_ASSERT(!views.empty()); + MOZ_ASSERT(!views.empty()); if (addToNursery) { // Only add the entry to |nurseryKeys| if it isn't already there. @@ -874,7 +874,7 @@ void InnerViewTable::removeViews(ArrayBufferObject *obj) { Map::Ptr p = map.lookup(obj); - JS_ASSERT(p); + MOZ_ASSERT(p); map.remove(p); } @@ -885,7 +885,7 @@ InnerViewTable::sweepEntry(JSObject **pkey, ViewVector &views) if (IsObjectAboutToBeFinalized(pkey)) return true; - JS_ASSERT(!views.empty()); + MOZ_ASSERT(!views.empty()); for (size_t i = 0; i < views.length(); i++) { if (IsObjectAboutToBeFinalized(&views[i])) { views[i--] = views.back(); @@ -899,7 +899,7 @@ InnerViewTable::sweepEntry(JSObject **pkey, ViewVector &views) void InnerViewTable::sweep(JSRuntime *rt) { - JS_ASSERT(nurseryKeys.empty()); + MOZ_ASSERT(nurseryKeys.empty()); if (!map.initialized()) return; @@ -916,7 +916,7 @@ InnerViewTable::sweep(JSRuntime *rt) void InnerViewTable::sweepAfterMinorGC(JSRuntime *rt) { - JS_ASSERT(!nurseryKeys.empty()); + MOZ_ASSERT(!nurseryKeys.empty()); if (nurseryKeysValid) { for (size_t i = 0; i < nurseryKeys.length(); i++) { @@ -1113,14 +1113,14 @@ JS_IsNeuteredArrayBufferObject(JSObject *obj) JS_FRIEND_API(JSObject *) JS_NewArrayBuffer(JSContext *cx, uint32_t nbytes) { - JS_ASSERT(nbytes <= INT32_MAX); + MOZ_ASSERT(nbytes <= INT32_MAX); return ArrayBufferObject::create(cx, nbytes); } JS_PUBLIC_API(JSObject *) JS_NewArrayBufferWithContents(JSContext *cx, size_t nbytes, void *data) { - JS_ASSERT(data); + MOZ_ASSERT(data); ArrayBufferObject::BufferContents contents = ArrayBufferObject::BufferContents::create(data); return ArrayBufferObject::create(cx, nbytes, contents, TenuredObject); @@ -1166,7 +1166,7 @@ JS_StealArrayBufferContents(JSContext *cx, HandleObject objArg) JS_PUBLIC_API(JSObject *) JS_NewMappedArrayBufferWithContents(JSContext *cx, size_t nbytes, void *data) { - JS_ASSERT(data); + MOZ_ASSERT(data); ArrayBufferObject::BufferContents contents = ArrayBufferObject::BufferContents::create(data); return ArrayBufferObject::create(cx, nbytes, contents, TenuredObject); diff --git a/js/src/vm/ArrayBufferObject.h b/js/src/vm/ArrayBufferObject.h index 2d884ac980ed..d4acf3691893 100644 --- a/js/src/vm/ArrayBufferObject.h +++ b/js/src/vm/ArrayBufferObject.h @@ -347,7 +347,7 @@ inline void PostBarrierTypedArrayObject(JSObject *obj) { #ifdef JSGC_GENERATIONAL - JS_ASSERT(obj); + MOZ_ASSERT(obj); JSRuntime *rt = obj->runtimeFromMainThread(); if (!rt->isHeapBusy() && !IsInsideNursery(JS::AsCell(obj))) rt->gc.storeBuffer.putWholeCellFromMainThread(obj); diff --git a/js/src/vm/ArrayObject-inl.h b/js/src/vm/ArrayObject-inl.h index 6a00170feefc..c1a9f9c006bb 100644 --- a/js/src/vm/ArrayObject-inl.h +++ b/js/src/vm/ArrayObject-inl.h @@ -18,7 +18,7 @@ namespace js { inline void ArrayObject::setLength(ExclusiveContext *cx, uint32_t length) { - JS_ASSERT(lengthIsWritable()); + MOZ_ASSERT(lengthIsWritable()); if (length > INT32_MAX) { /* Track objects with overflowing lengths in type information. */ diff --git a/js/src/vm/ArrayObject.h b/js/src/vm/ArrayObject.h index ad4dd7dab449..b96e6c2bf0fc 100644 --- a/js/src/vm/ArrayObject.h +++ b/js/src/vm/ArrayObject.h @@ -33,8 +33,8 @@ class ArrayObject : public JSObject // Variant of setLength for use on arrays where the length cannot overflow int32_t. void setLengthInt32(uint32_t length) { - JS_ASSERT(lengthIsWritable()); - JS_ASSERT(length <= INT32_MAX); + MOZ_ASSERT(lengthIsWritable()); + MOZ_ASSERT(length <= INT32_MAX); getElementsHeader()->length = length; } }; diff --git a/js/src/vm/CallNonGenericMethod.cpp b/js/src/vm/CallNonGenericMethod.cpp index a387ca60555e..705420090b64 100644 --- a/js/src/vm/CallNonGenericMethod.cpp +++ b/js/src/vm/CallNonGenericMethod.cpp @@ -19,7 +19,7 @@ JS::detail::CallMethodIfWrapped(JSContext *cx, IsAcceptableThis test, NativeImpl CallArgs args) { HandleValue thisv = args.thisv(); - JS_ASSERT(!test(thisv)); + MOZ_ASSERT(!test(thisv)); if (thisv.isObject()) { JSObject &thisObj = args.thisv().toObject(); diff --git a/js/src/vm/CharacterEncoding.cpp b/js/src/vm/CharacterEncoding.cpp index 4440e68675bd..70382f8706e4 100644 --- a/js/src/vm/CharacterEncoding.cpp +++ b/js/src/vm/CharacterEncoding.cpp @@ -17,7 +17,7 @@ Latin1CharsZ JS::LossyTwoByteCharsToNewLatin1CharsZ(js::ThreadSafeContext *cx, const mozilla::Range tbchars) { - JS_ASSERT(cx); + MOZ_ASSERT(cx); size_t len = tbchars.length(); unsigned char *latin1 = cx->pod_malloc(len + 1); if (!latin1) @@ -136,7 +136,7 @@ template UTF8CharsZ JS::CharsToNewUTF8CharsZ(js::ThreadSafeContext *cx, const mozilla::Range chars) { - JS_ASSERT(cx); + MOZ_ASSERT(cx); /* Get required buffer size. */ const CharT *str = chars.start().get(); @@ -170,22 +170,22 @@ static const uint32_t INVALID_UTF8 = UINT32_MAX; uint32_t JS::Utf8ToOneUcs4Char(const uint8_t *utf8Buffer, int utf8Length) { - JS_ASSERT(1 <= utf8Length && utf8Length <= 4); + MOZ_ASSERT(1 <= utf8Length && utf8Length <= 4); if (utf8Length == 1) { - JS_ASSERT(!(*utf8Buffer & 0x80)); + MOZ_ASSERT(!(*utf8Buffer & 0x80)); return *utf8Buffer; } /* from Unicode 3.1, non-shortest form is illegal */ static const uint32_t minucs4Table[] = { 0x80, 0x800, 0x10000 }; - JS_ASSERT((*utf8Buffer & (0x100 - (1 << (7 - utf8Length)))) == - (0x100 - (1 << (8 - utf8Length)))); + MOZ_ASSERT((*utf8Buffer & (0x100 - (1 << (7 - utf8Length)))) == + (0x100 - (1 << (8 - utf8Length)))); uint32_t ucs4Char = *utf8Buffer++ & ((1 << (7 - utf8Length)) - 1); uint32_t minucs4Char = minucs4Table[utf8Length - 2]; while (--utf8Length) { - JS_ASSERT((*utf8Buffer & 0xC0) == 0x80); + MOZ_ASSERT((*utf8Buffer & 0xC0) == 0x80); ucs4Char = (ucs4Char << 6) | (*utf8Buffer++ & 0x3F); } @@ -263,7 +263,7 @@ InflateUTF8StringToBuffer(JSContext *cx, const UTF8Chars src, char16_t *dst, siz if (action == Copy) \ dst[j] = char16_t(REPLACE_UTF8); \ else \ - JS_ASSERT(action == CountAndIgnoreInvalids); \ + MOZ_ASSERT(action == CountAndIgnoreInvalids); \ n = n2; \ goto invalidMultiByteCodeUnit; \ } \ @@ -345,7 +345,7 @@ InflateUTF8StringHelper(JSContext *cx, const UTF8Chars src, CountAction countAct if (isAscii) { size_t srclen = src.length(); - JS_ASSERT(*outlen == srclen); + MOZ_ASSERT(*outlen == srclen); for (uint32_t i = 0; i < srclen; i++) dst[i] = char16_t(src[i]); diff --git a/js/src/vm/Compression.cpp b/js/src/vm/Compression.cpp index 0c4e592bb2c9..6d20098347c2 100644 --- a/js/src/vm/Compression.cpp +++ b/js/src/vm/Compression.cpp @@ -28,7 +28,7 @@ Compressor::Compressor(const unsigned char *inp, size_t inplen) outbytes(0), initialized(false) { - JS_ASSERT(inplen > 0); + MOZ_ASSERT(inplen > 0); zs.opaque = nullptr; zs.next_in = (Bytef *)inp; zs.avail_in = 0; @@ -45,8 +45,8 @@ Compressor::~Compressor() int ret = deflateEnd(&zs); if (ret != Z_OK) { // If we finished early, we can get a Z_DATA_ERROR. - JS_ASSERT(ret == Z_DATA_ERROR); - JS_ASSERT(uInt(zs.next_in - inp) < inplen || !zs.avail_out); + MOZ_ASSERT(ret == Z_DATA_ERROR); + MOZ_ASSERT(uInt(zs.next_in - inp) < inplen || !zs.avail_out); } } } @@ -61,7 +61,7 @@ Compressor::init() // Function.toString() int ret = deflateInit(&zs, Z_BEST_SPEED); if (ret != Z_OK) { - JS_ASSERT(ret == Z_MEM_ERROR); + MOZ_ASSERT(ret == Z_MEM_ERROR); return false; } initialized = true; @@ -71,7 +71,7 @@ Compressor::init() void Compressor::setOutput(unsigned char *out, size_t outlen) { - JS_ASSERT(outlen > outbytes); + MOZ_ASSERT(outlen > outbytes); zs.next_out = out + outbytes; zs.avail_out = outlen - outbytes; } @@ -79,7 +79,7 @@ Compressor::setOutput(unsigned char *out, size_t outlen) Compressor::Status Compressor::compressMore() { - JS_ASSERT(zs.next_out); + MOZ_ASSERT(zs.next_out); uInt left = inplen - (zs.next_in - inp); bool done = left <= CHUNKSIZE; if (done) @@ -94,7 +94,7 @@ Compressor::compressMore() return OOM; } if (ret == Z_BUF_ERROR || (done && ret == Z_OK)) { - JS_ASSERT(zs.avail_out == 0); + MOZ_ASSERT(zs.avail_out == 0); return MOREOUTPUT; } JS_ASSERT_IF(!done, ret == Z_OK); @@ -105,7 +105,7 @@ Compressor::compressMore() bool js::DecompressString(const unsigned char *inp, size_t inplen, unsigned char *out, size_t outlen) { - JS_ASSERT(inplen <= UINT32_MAX); + MOZ_ASSERT(inplen <= UINT32_MAX); // Mark the memory we pass to zlib as initialized for MSan. #ifdef MOZ_MSAN @@ -119,16 +119,16 @@ js::DecompressString(const unsigned char *inp, size_t inplen, unsigned char *out zs.next_in = (Bytef *)inp; zs.avail_in = inplen; zs.next_out = out; - JS_ASSERT(outlen); + MOZ_ASSERT(outlen); zs.avail_out = outlen; int ret = inflateInit(&zs); if (ret != Z_OK) { - JS_ASSERT(ret == Z_MEM_ERROR); + MOZ_ASSERT(ret == Z_MEM_ERROR); return false; } ret = inflate(&zs, Z_FINISH); - JS_ASSERT(ret == Z_STREAM_END); + MOZ_ASSERT(ret == Z_STREAM_END); ret = inflateEnd(&zs); - JS_ASSERT(ret == Z_OK); + MOZ_ASSERT(ret == Z_OK); return true; } diff --git a/js/src/vm/Debugger-inl.h b/js/src/vm/Debugger-inl.h index 48743f43bb29..0b1434ab51e6 100644 --- a/js/src/vm/Debugger-inl.h +++ b/js/src/vm/Debugger-inl.h @@ -25,7 +25,7 @@ js::Debugger::onLeaveFrame(JSContext *cx, AbstractFramePtr frame, bool ok) /* static */ inline js::Debugger * js::Debugger::fromJSObject(JSObject *obj) { - JS_ASSERT(js::GetObjectClass(obj) == &jsclass); + MOZ_ASSERT(js::GetObjectClass(obj) == &jsclass); return (Debugger *) obj->getPrivate(); } diff --git a/js/src/vm/Debugger.cpp b/js/src/vm/Debugger.cpp index ed59db54a0e2..62b506aa17b1 100644 --- a/js/src/vm/Debugger.cpp +++ b/js/src/vm/Debugger.cpp @@ -181,7 +181,7 @@ class Debugger::FrameRange global = &frame.script()->global(); /* The frame and global must match. */ - JS_ASSERT(&frame.script()->global() == global); + MOZ_ASSERT(&frame.script()->global() == global); /* Find the list of debuggers we'll iterate over. There may be none. */ debuggers = global->getDebuggers(); @@ -198,12 +198,12 @@ class Debugger::FrameRange } JSObject *frontFrame() const { - JS_ASSERT(!empty()); + MOZ_ASSERT(!empty()); return entry->value(); } Debugger *frontDebugger() const { - JS_ASSERT(!empty()); + MOZ_ASSERT(!empty()); return (*debuggers)[nextDebugger]; } @@ -212,12 +212,12 @@ class Debugger::FrameRange * the range's front is invalid until popFront is called. */ void removeFrontFrame() const { - JS_ASSERT(!empty()); + MOZ_ASSERT(!empty()); frontDebugger()->frames.remove(entry); } void popFront() { - JS_ASSERT(!empty()); + MOZ_ASSERT(!empty()); nextDebugger++; findNext(); } @@ -243,7 +243,7 @@ class Debugger::FrameRange BreakpointSite::BreakpointSite(JSScript *script, jsbytecode *pc) : script(script), pc(pc), enabledCount(0) { - JS_ASSERT(!script->hasBreakpointsAt(pc)); + MOZ_ASSERT(!script->hasBreakpointsAt(pc)); JS_INIT_CLIST(&breakpoints); } @@ -265,7 +265,7 @@ BreakpointSite::inc(FreeOp *fop) void BreakpointSite::dec(FreeOp *fop) { - JS_ASSERT(enabledCount > 0); + MOZ_ASSERT(enabledCount > 0); enabledCount--; if (enabledCount == 0) recompile(fop); @@ -298,7 +298,7 @@ BreakpointSite::hasBreakpoint(Breakpoint *bp) Breakpoint::Breakpoint(Debugger *debugger, BreakpointSite *site, JSObject *handler) : debugger(debugger), site(site), handler(handler) { - JS_ASSERT(handler->compartment() == debugger->object->compartment()); + MOZ_ASSERT(handler->compartment() == debugger->object->compartment()); JS_APPEND_LINK(&debuggerLinks, &debugger->breakpoints); JS_APPEND_LINK(&siteLinks, &site->breakpoints); } @@ -400,11 +400,11 @@ JS_STATIC_ASSERT(unsigned(JSSLOT_DEBUGFRAME_OWNER) == unsigned(JSSLOT_DEBUGENV_O Debugger * Debugger::fromChildJSObject(JSObject *obj) { - JS_ASSERT(obj->getClass() == &DebuggerFrame_class || - obj->getClass() == &DebuggerScript_class || - obj->getClass() == &DebuggerSource_class || - obj->getClass() == &DebuggerObject_class || - obj->getClass() == &DebuggerEnv_class); + MOZ_ASSERT(obj->getClass() == &DebuggerFrame_class || + obj->getClass() == &DebuggerScript_class || + obj->getClass() == &DebuggerSource_class || + obj->getClass() == &DebuggerObject_class || + obj->getClass() == &DebuggerEnv_class); JSObject *dbgobj = &obj->getReservedSlot(JSSLOT_DEBUGOBJECT_OWNER).toObject(); return fromJSObject(dbgobj); } @@ -418,7 +418,7 @@ Debugger::hasMemory() const DebuggerMemory & Debugger::memory() const { - JS_ASSERT(hasMemory()); + MOZ_ASSERT(hasMemory()); return object->getReservedSlot(JSSLOT_DEBUG_MEMORY_INSTANCE).toObject().as(); } @@ -462,7 +462,7 @@ Debugger::getScriptFrameWithIter(JSContext *cx, AbstractFramePtr frame, JSObject * Debugger::getHook(Hook hook) const { - JS_ASSERT(hook >= 0 && hook < HookCount); + MOZ_ASSERT(hook >= 0 && hook < HookCount); const Value &v = object->getReservedSlot(JSSLOT_DEBUG_HOOK_START + hook); return v.isUndefined() ? nullptr : &v.toObject(); } @@ -588,8 +588,8 @@ Debugger::slowPathOnLeaveFrame(JSContext *cx, AbstractFramePtr frame, bool frame * At this point, we are back in the debuggee compartment, and any error has * been wrapped up as a completion value. */ - JS_ASSERT(cx->compartment() == global->compartment()); - JS_ASSERT(!cx->isExceptionPending()); + MOZ_ASSERT(cx->compartment() == global->compartment()); + MOZ_ASSERT(!cx->isExceptionPending()); /* JSTRAP_CONTINUE means "make no change". */ if (nextStatus != JSTRAP_CONTINUE) { @@ -607,7 +607,7 @@ Debugger::slowPathOnLeaveFrame(JSContext *cx, AbstractFramePtr frame, bool frame for (FrameRange r(frame, global); !r.empty(); r.popFront()) { RootedObject frameobj(cx, r.frontFrame()); Debugger *dbg = r.frontDebugger(); - JS_ASSERT(dbg == Debugger::fromChildJSObject(frameobj)); + MOZ_ASSERT(dbg == Debugger::fromChildJSObject(frameobj)); FreeOp *fop = cx->runtime()->defaultFreeOp(); DebuggerFrame_freeScriptFrameIterData(fop, frameobj); @@ -636,7 +636,7 @@ Debugger::slowPathOnLeaveFrame(JSContext *cx, AbstractFramePtr frame, bool frame return false; case JSTRAP_ERROR: - JS_ASSERT(!cx->isExceptionPending()); + MOZ_ASSERT(!cx->isExceptionPending()); return false; default: @@ -656,7 +656,7 @@ Debugger::wrapEnvironment(JSContext *cx, Handle env, MutableHandleValue rv * DebuggerEnv should only wrap a debug scope chain obtained (transitively) * from GetDebugScopeFor(Frame|Function). */ - JS_ASSERT(!env->is()); + MOZ_ASSERT(!env->is()); JSObject *envobj; DependentAddPtr p(cx, environments, env); @@ -1031,8 +1031,8 @@ JSTrapStatus Debugger::fireDebuggerStatement(JSContext *cx, MutableHandleValue vp) { RootedObject hook(cx, getHook(OnDebuggerStatement)); - JS_ASSERT(hook); - JS_ASSERT(hook->isCallable()); + MOZ_ASSERT(hook); + MOZ_ASSERT(hook->isCallable()); Maybe ac; ac.emplace(cx, object); @@ -1052,8 +1052,8 @@ JSTrapStatus Debugger::fireExceptionUnwind(JSContext *cx, MutableHandleValue vp) { RootedObject hook(cx, getHook(OnExceptionUnwind)); - JS_ASSERT(hook); - JS_ASSERT(hook->isCallable()); + MOZ_ASSERT(hook); + MOZ_ASSERT(hook->isCallable()); RootedValue exc(cx); if (!cx->getPendingException(&exc)) @@ -1083,8 +1083,8 @@ JSTrapStatus Debugger::fireEnterFrame(JSContext *cx, AbstractFramePtr frame, MutableHandleValue vp) { RootedObject hook(cx, getHook(OnEnterFrame)); - JS_ASSERT(hook); - JS_ASSERT(hook->isCallable()); + MOZ_ASSERT(hook); + MOZ_ASSERT(hook->isCallable()); Maybe ac; ac.emplace(cx, object); @@ -1102,8 +1102,8 @@ void Debugger::fireNewScript(JSContext *cx, HandleScript script) { RootedObject hook(cx, getHook(OnNewScript)); - JS_ASSERT(hook); - JS_ASSERT(hook->isCallable()); + MOZ_ASSERT(hook); + MOZ_ASSERT(hook->isCallable()); Maybe ac; ac.emplace(cx, object); @@ -1123,7 +1123,7 @@ Debugger::fireNewScript(JSContext *cx, HandleScript script) JSTrapStatus Debugger::dispatchHook(JSContext *cx, MutableHandleValue vp, Hook which) { - JS_ASSERT(which == OnDebuggerStatement || which == OnExceptionUnwind); + MOZ_ASSERT(which == OnDebuggerStatement || which == OnExceptionUnwind); /* * Determine which debuggers will receive this event, and in what order. @@ -1185,7 +1185,7 @@ Debugger::slowPathOnNewScript(JSContext *cx, HandleScript script, GlobalObject * { Rooted compileAndGoGlobal(cx, compileAndGoGlobal_); - JS_ASSERT(script->compileAndGo() == !!compileAndGoGlobal); + MOZ_ASSERT(script->compileAndGo() == !!compileAndGoGlobal); /* * Build the list of recipients based on the debuggers observing the @@ -1343,9 +1343,9 @@ Debugger::onSingleStep(JSContext *cx, MutableHandleValue vp) } } if (trappingScript->compileAndGo()) - JS_ASSERT(stepperCount == trappingScript->stepModeCount()); + MOZ_ASSERT(stepperCount == trappingScript->stepModeCount()); else - JS_ASSERT(stepperCount <= trappingScript->stepModeCount()); + MOZ_ASSERT(stepperCount <= trappingScript->stepModeCount()); } #endif @@ -1375,8 +1375,8 @@ JSTrapStatus Debugger::fireNewGlobalObject(JSContext *cx, Handle global, MutableHandleValue vp) { RootedObject hook(cx, getHook(OnNewGlobalObject)); - JS_ASSERT(hook); - JS_ASSERT(hook->isCallable()); + MOZ_ASSERT(hook); + MOZ_ASSERT(hook->isCallable()); Maybe ac; ac.emplace(cx, object); @@ -1405,14 +1405,14 @@ Debugger::fireNewGlobalObject(JSContext *cx, Handle global, Muta // rest of the onNewGlobalObject hooks or not. JSTrapStatus status = ok ? JSTRAP_CONTINUE : handleUncaughtException(ac, vp, true); - JS_ASSERT(!cx->isExceptionPending()); + MOZ_ASSERT(!cx->isExceptionPending()); return status; } void Debugger::slowPathOnNewGlobalObject(JSContext *cx, Handle global) { - JS_ASSERT(!JS_CLIST_IS_EMPTY(&cx->runtime()->onNewGlobalObjectWatchers)); + MOZ_ASSERT(!JS_CLIST_IS_EMPTY(&cx->runtime()->onNewGlobalObjectWatchers)); if (global->compartment()->options().invisibleToDebugger()) return; @@ -1427,7 +1427,7 @@ Debugger::slowPathOnNewGlobalObject(JSContext *cx, Handle global link = JS_NEXT_LINK(link)) { Debugger *dbg = fromOnNewGlobalObjectWatchersLink(link); - JS_ASSERT(dbg->observesNewGlobalObject()); + MOZ_ASSERT(dbg->observesNewGlobalObject()); JSObject *obj = dbg->object; JS::ExposeObjectToActiveJS(obj); if (!watchers.append(obj)) @@ -1454,20 +1454,20 @@ Debugger::slowPathOnNewGlobalObject(JSContext *cx, Handle global break; } } - JS_ASSERT(!cx->isExceptionPending()); + MOZ_ASSERT(!cx->isExceptionPending()); } /* static */ bool Debugger::slowPathOnLogAllocationSite(JSContext *cx, HandleSavedFrame frame, GlobalObject::DebuggerVector &dbgs) { - JS_ASSERT(!dbgs.empty()); + MOZ_ASSERT(!dbgs.empty()); mozilla::DebugOnly begin = dbgs.begin(); for (Debugger **dbgp = dbgs.begin(); dbgp < dbgs.end(); dbgp++) { // The set of debuggers had better not change while we're iterating, // such that the vector gets reallocated. - JS_ASSERT(dbgs.begin() == begin); + MOZ_ASSERT(dbgs.begin() == begin); if ((*dbgp)->trackingAllocationSites && (*dbgp)->enabled && @@ -1597,7 +1597,7 @@ Debugger::markAllIteratively(GCMarker *trc) * getDebuggers can't return nullptr. */ const GlobalObject::DebuggerVector *debuggers = global->getDebuggers(); - JS_ASSERT(debuggers); + MOZ_ASSERT(debuggers); for (Debugger * const *p = debuggers->begin(); p != debuggers->end(); p++) { Debugger *dbg = *p; @@ -1700,7 +1700,7 @@ Debugger::trace(JSTracer *trc) */ for (FrameMap::Range r = frames.all(); !r.empty(); r.popFront()) { RelocatablePtrObject &frameobj = r.front().value(); - JS_ASSERT(MaybeForwarded(frameobj.get())->getPrivate()); + MOZ_ASSERT(MaybeForwarded(frameobj.get())->getPrivate()); MarkObject(trc, &frameobj, "live Debugger.Frame"); } @@ -1751,7 +1751,7 @@ void Debugger::detachAllDebuggersFromGlobal(FreeOp *fop, GlobalObject *global) { const GlobalObject::DebuggerVector *debuggers = global->getDebuggers(); - JS_ASSERT(!debuggers->empty()); + MOZ_ASSERT(!debuggers->empty()); while (!debuggers->empty()) debuggers->back()->removeDebuggeeGlobalUnderGC(fop, global, nullptr); } @@ -1868,12 +1868,12 @@ Debugger::setEnabled(JSContext *cx, unsigned argc, Value *vp) if (dbg->getHook(OnNewGlobalObject)) { if (enabled) { /* If we were not enabled, the link should be a singleton list. */ - JS_ASSERT(JS_CLIST_IS_EMPTY(&dbg->onNewGlobalObjectWatchersLink)); + MOZ_ASSERT(JS_CLIST_IS_EMPTY(&dbg->onNewGlobalObjectWatchersLink)); JS_APPEND_LINK(&dbg->onNewGlobalObjectWatchersLink, &cx->runtime()->onNewGlobalObjectWatchers); } else { /* If we were enabled, the link should be inserted in the list. */ - JS_ASSERT(!JS_CLIST_IS_EMPTY(&dbg->onNewGlobalObjectWatchersLink)); + MOZ_ASSERT(!JS_CLIST_IS_EMPTY(&dbg->onNewGlobalObjectWatchersLink)); JS_REMOVE_AND_INIT_LINK(&dbg->onNewGlobalObjectWatchersLink); } } @@ -1887,7 +1887,7 @@ Debugger::setEnabled(JSContext *cx, unsigned argc, Value *vp) bool Debugger::getHookImpl(JSContext *cx, unsigned argc, Value *vp, Hook which) { - JS_ASSERT(which >= 0 && which < HookCount); + MOZ_ASSERT(which >= 0 && which < HookCount); THIS_DEBUGGER(cx, argc, vp, "getHook", args, dbg); args.rval().set(dbg->object->getReservedSlot(JSSLOT_DEBUG_HOOK_START + which)); return true; @@ -1896,7 +1896,7 @@ Debugger::getHookImpl(JSContext *cx, unsigned argc, Value *vp, Hook which) bool Debugger::setHookImpl(JSContext *cx, unsigned argc, Value *vp, Hook which) { - JS_ASSERT(which >= 0 && which < HookCount); + MOZ_ASSERT(which >= 0 && which < HookCount); THIS_DEBUGGER(cx, argc, vp, "setHook", args, dbg); if (!args.requireAtLeast(cx, "Debugger.setHook", 1)) return false; @@ -1983,12 +1983,12 @@ Debugger::setOnNewGlobalObject(JSContext *cx, unsigned argc, Value *vp) JSObject *newHook = dbg->getHook(OnNewGlobalObject); if (!oldHook && newHook) { /* If we didn't have a hook, the link should be a singleton list. */ - JS_ASSERT(JS_CLIST_IS_EMPTY(&dbg->onNewGlobalObjectWatchersLink)); + MOZ_ASSERT(JS_CLIST_IS_EMPTY(&dbg->onNewGlobalObjectWatchersLink)); JS_APPEND_LINK(&dbg->onNewGlobalObjectWatchersLink, &cx->runtime()->onNewGlobalObjectWatchers); } else if (oldHook && !newHook) { /* If we did have a hook, the link should be inserted in the list. */ - JS_ASSERT(!JS_CLIST_IS_EMPTY(&dbg->onNewGlobalObjectWatchersLink)); + MOZ_ASSERT(!JS_CLIST_IS_EMPTY(&dbg->onNewGlobalObjectWatchersLink)); JS_REMOVE_AND_INIT_LINK(&dbg->onNewGlobalObjectWatchersLink); } } @@ -2245,7 +2245,7 @@ Debugger::construct(JSContext *cx, unsigned argc, Value *vp) if (!JSObject::getProperty(cx, callee, callee, cx->names().prototype, &v)) return false; RootedObject proto(cx, &v.toObject()); - JS_ASSERT(proto->getClass() == &Debugger::jsclass); + MOZ_ASSERT(proto->getClass() == &Debugger::jsclass); /* * Make the new Debugger object. Each one has a reference to * Debugger.{Frame,Object,Script,Memory}.prototype in reserved slots. The @@ -2371,7 +2371,7 @@ Debugger::addDebuggeeGlobal(JSContext *cx, /* Maintain consistency on error. */ debuggees.remove(global); } - JS_ASSERT(v->back() == this); + MOZ_ASSERT(v->back() == this); v->popBack(); } @@ -2391,7 +2391,7 @@ Debugger::cleanupDebuggeeGlobalBeforeRemoval(FreeOp *fop, GlobalObject *global, * so, use HashSet::Enum::removeFront rather than HashSet::remove below, * to avoid invalidating the live enumerator. */ - JS_ASSERT(debuggees.has(global)); + MOZ_ASSERT(debuggees.has(global)); JS_ASSERT_IF(debugEnum, debugEnum->front() == global); /* @@ -2419,7 +2419,7 @@ Debugger::cleanupDebuggeeGlobalBeforeRemoval(FreeOp *fop, GlobalObject *global, if (*p == this) break; } - JS_ASSERT(p != v->end()); + MOZ_ASSERT(p != v->end()); /* * The relation must be removed from up to three places: *v and debuggees @@ -2753,7 +2753,7 @@ class MOZ_STACK_CLASS Debugger::ScriptQuery /* Arrange for this ScriptQuery to match only scripts that run in |global|. */ bool matchSingleGlobal(GlobalObject *global) { - JS_ASSERT(compartments.count() == 0); + MOZ_ASSERT(compartments.count() == 0); if (!addCompartment(global->compartment())) { js_ReportOutOfMemory(cx); return false; @@ -2766,7 +2766,7 @@ class MOZ_STACK_CLASS Debugger::ScriptQuery * globals. */ bool matchAllDebuggeeGlobals() { - JS_ASSERT(compartments.count() == 0); + MOZ_ASSERT(compartments.count() == 0); /* Build our compartment set from the debugger's set of debuggee globals. */ for (GlobalObjectSet::Range r = debugger->debuggees.all(); !r.empty(); r.popFront()) { if (!addCompartment(r.front()->compartment())) { @@ -3016,7 +3016,7 @@ const JSFunctionSpec Debugger::methods[] = { static inline JSScript * GetScriptReferent(JSObject *obj) { - JS_ASSERT(obj->getClass() == &DebuggerScript_class); + MOZ_ASSERT(obj->getClass() == &DebuggerScript_class); return static_cast(obj->getPrivate()); } @@ -3048,7 +3048,7 @@ Debugger::newDebuggerScript(JSContext *cx, HandleScript script) assertSameCompartment(cx, object.get()); JSObject *proto = &object->getReservedSlot(JSSLOT_DEBUG_SCRIPT_PROTO).toObject(); - JS_ASSERT(proto); + MOZ_ASSERT(proto); JSObject *scriptobj = NewObjectWithGivenProto(cx, &DebuggerScript_class, proto, nullptr, TenuredObject); if (!scriptobj) return nullptr; @@ -3062,7 +3062,7 @@ JSObject * Debugger::wrapScript(JSContext *cx, HandleScript script) { assertSameCompartment(cx, object.get()); - JS_ASSERT(cx->compartment() != script->compartment()); + MOZ_ASSERT(cx->compartment() != script->compartment()); DependentAddPtr p(cx, scripts, script); if (!p) { JSObject *scriptobj = newDebuggerScript(cx, script); @@ -3082,7 +3082,7 @@ Debugger::wrapScript(JSContext *cx, HandleScript script) } } - JS_ASSERT(GetScriptReferent(p->value()) == script); + MOZ_ASSERT(GetScriptReferent(p->value()) == script); return p->value(); } @@ -3105,7 +3105,7 @@ DebuggerScript_check(JSContext *cx, const Value &v, const char *clsname, const c * but whose script is null. */ if (!GetScriptReferent(thisobj)) { - JS_ASSERT(!GetScriptReferent(thisobj)); + MOZ_ASSERT(!GetScriptReferent(thisobj)); JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_INCOMPATIBLE_PROTO, clsname, fnname, "prototype object"); return nullptr; @@ -3210,7 +3210,7 @@ DebuggerScript_getSourceMapUrl(JSContext *cx, unsigned argc, Value *vp) THIS_DEBUGSCRIPT_SCRIPT(cx, argc, vp, "(get sourceMapURL)", args, obj, script); ScriptSource *source = script->scriptSource(); - JS_ASSERT(source); + MOZ_ASSERT(source); if (source->hasSourceMapURL()) { JSString *str = JS_NewUCStringCopyZ(cx, source->sourceMapURL()); @@ -3353,7 +3353,7 @@ class BytecodeRangeWithPosition : private BytecodeRange if (colspan >= SN_COLSPAN_DOMAIN / 2) colspan -= SN_COLSPAN_DOMAIN; - JS_ASSERT(ptrdiff_t(column) + colspan >= 0); + MOZ_ASSERT(ptrdiff_t(column) + colspan >= 0); column += colspan; } if (type == SRC_SETLINE) { lineno = size_t(js_GetSrcNoteOffset(sn, 0)); @@ -3580,7 +3580,7 @@ DebuggerScript_getAllOffsets(JSContext *cx, unsigned argc, Value *vp) if (offsetsv.isObject()) { offsets = &offsetsv.toObject(); } else { - JS_ASSERT(offsetsv.isUndefined()); + MOZ_ASSERT(offsetsv.isUndefined()); /* * Create an empty offsets array for this line. @@ -3741,7 +3741,7 @@ Debugger::replaceFrameGuts(JSContext *cx, AbstractFramePtr from, AbstractFramePt for (Debugger::FrameRange r(from); !r.empty(); r.popFront()) { RootedObject frameobj(cx, r.frontFrame()); Debugger *dbg = r.frontDebugger(); - JS_ASSERT(dbg == Debugger::fromChildJSObject(frameobj)); + MOZ_ASSERT(dbg == Debugger::fromChildJSObject(frameobj)); // Update frame object's ScriptFrameIter::data pointer. DebuggerFrame_freeScriptFrameIterData(cx->runtime()->defaultFreeOp(), frameobj); @@ -3767,7 +3767,7 @@ Debugger::replaceFrameGuts(JSContext *cx, AbstractFramePtr from, AbstractFramePt Debugger::handleBaselineOsr(JSContext *cx, InterpreterFrame *from, jit::BaselineFrame *to) { ScriptFrameIter iter(cx); - JS_ASSERT(iter.abstractFramePtr() == to); + MOZ_ASSERT(iter.abstractFramePtr() == to); return replaceFrameGuts(cx, from, to, iter); } @@ -3979,7 +3979,7 @@ static const JSFunctionSpec DebuggerScript_methods[] = { static inline ScriptSourceObject * GetSourceReferent(JSObject *obj) { - JS_ASSERT(obj->getClass() == &DebuggerSource_class); + MOZ_ASSERT(obj->getClass() == &DebuggerSource_class); return static_cast(obj->getPrivate()); } @@ -4014,7 +4014,7 @@ Debugger::newDebuggerSource(JSContext *cx, HandleScriptSource source) assertSameCompartment(cx, object.get()); JSObject *proto = &object->getReservedSlot(JSSLOT_DEBUG_SOURCE_PROTO).toObject(); - JS_ASSERT(proto); + MOZ_ASSERT(proto); JSObject *sourceobj = NewObjectWithGivenProto(cx, &DebuggerSource_class, proto, nullptr, TenuredObject); if (!sourceobj) return nullptr; @@ -4028,7 +4028,7 @@ JSObject * Debugger::wrapSource(JSContext *cx, HandleScriptSource source) { assertSameCompartment(cx, object.get()); - JS_ASSERT(cx->compartment() != source->compartment()); + MOZ_ASSERT(cx->compartment() != source->compartment()); DependentAddPtr p(cx, sources, source); if (!p) { JSObject *sourceobj = newDebuggerSource(cx, source); @@ -4048,7 +4048,7 @@ Debugger::wrapSource(JSContext *cx, HandleScriptSource source) } } - JS_ASSERT(GetSourceReferent(p->value()) == source); + MOZ_ASSERT(GetSourceReferent(p->value()) == source); return p->value(); } @@ -4135,7 +4135,7 @@ DebuggerSource_getDisplayURL(JSContext *cx, unsigned argc, Value *vp) THIS_DEBUGSOURCE_REFERENT(cx, argc, vp, "(get url)", args, obj, sourceObject); ScriptSource *ss = sourceObject->source(); - JS_ASSERT(ss); + MOZ_ASSERT(ss); if (ss->hasDisplayURL()) { JSString *str = JS_NewUCStringCopyZ(cx, ss->displayURL()); @@ -4555,7 +4555,7 @@ DebuggerArguments_getArg(JSContext *cx, unsigned argc, Value *vp) * Since getters can be extracted and applied to other objects, * there is no guarantee this object has an ith argument. */ - JS_ASSERT(i >= 0); + MOZ_ASSERT(i >= 0); RootedValue arg(cx); RootedScript script(cx); if (unsigned(i) < frame.numActualArgs()) { @@ -4588,7 +4588,7 @@ DebuggerFrame_getArguments(JSContext *cx, unsigned argc, Value *vp) THIS_FRAME(cx, argc, vp, "get arguments", args, thisobj, frame); Value argumentsv = thisobj->getReservedSlot(JSSLOT_DEBUGFRAME_ARGUMENTS); if (!argumentsv.isUndefined()) { - JS_ASSERT(argumentsv.isObjectOrNull()); + MOZ_ASSERT(argumentsv.isObjectOrNull()); args.rval().set(argumentsv); return true; } @@ -4605,7 +4605,7 @@ DebuggerFrame_getArguments(JSContext *cx, unsigned argc, Value *vp) return false; SetReservedSlot(argsobj, JSSLOT_DEBUGARGUMENTS_FRAME, ObjectValue(*thisobj)); - JS_ASSERT(frame.numActualArgs() <= 0x7fffffff); + MOZ_ASSERT(frame.numActualArgs() <= 0x7fffffff); unsigned fargc = frame.numActualArgs(); RootedValue fargcVal(cx, Int32Value(fargc)); if (!DefineNativeProperty(cx, argsobj, cx->names().length, @@ -4706,7 +4706,7 @@ DebuggerFrame_getOnStep(JSContext *cx, unsigned argc, Value *vp) THIS_FRAME(cx, argc, vp, "get onStep", args, thisobj, frame); (void) frame; // Silence GCC warning RootedValue handler(cx, thisobj->getReservedSlot(JSSLOT_DEBUGFRAME_ONSTEP_HANDLER)); - JS_ASSERT(IsValidHook(handler)); + MOZ_ASSERT(IsValidHook(handler)); args.rval().set(handler); return true; } @@ -4745,7 +4745,7 @@ DebuggerFrame_getOnPop(JSContext *cx, unsigned argc, Value *vp) THIS_FRAME(cx, argc, vp, "get onPop", args, thisobj, frame); (void) frame; // Silence GCC warning RootedValue handler(cx, thisobj->getReservedSlot(JSSLOT_DEBUGFRAME_ONPOP_HANDLER)); - JS_ASSERT(IsValidHook(handler)); + MOZ_ASSERT(IsValidHook(handler)); args.rval().set(handler); return true; } @@ -4785,7 +4785,7 @@ js::EvaluateInEnv(JSContext *cx, Handle env, HandleValue thisv, AbstractFr assertSameCompartment(cx, env, frame); JS_ASSERT_IF(frame, thisv.get() == frame.thisValue()); - JS_ASSERT(!IsPoisonedPtr(chars.start().get())); + MOZ_ASSERT(!IsPoisonedPtr(chars.start().get())); /* * NB: This function breaks the assumption that the compiler can see all @@ -5069,16 +5069,16 @@ DebuggerObject_checkThis(JSContext *cx, const CallArgs &args, const char *fnname if (!obj) \ return false; \ obj = (JSObject *) obj->getPrivate(); \ - JS_ASSERT(obj) + MOZ_ASSERT(obj) #define THIS_DEBUGOBJECT_OWNER_REFERENT(cx, argc, vp, fnname, args, dbg, obj) \ CallArgs args = CallArgsFromVp(argc, vp); \ - RootedObject obj(cx, DebuggerObject_checkThis(cx, args, fnname)); \ - if (!obj) \ - return false; \ - Debugger *dbg = Debugger::fromChildJSObject(obj); \ - obj = (JSObject *) obj->getPrivate(); \ - JS_ASSERT(obj) + RootedObject obj(cx, DebuggerObject_checkThis(cx, args, fnname)); \ + if (!obj) \ + return false; \ + Debugger *dbg = Debugger::fromChildJSObject(obj); \ + obj = (JSObject *) obj->getPrivate(); \ + MOZ_ASSERT(obj) static bool DebuggerObject_construct(JSContext *cx, unsigned argc, Value *vp) @@ -5200,7 +5200,7 @@ DebuggerObject_getParameterNames(JSContext *cx, unsigned argc, Value *vp) if (!script) return false; - JS_ASSERT(fun->nargs() == script->bindings.numArgs()); + MOZ_ASSERT(fun->nargs() == script->bindings.numArgs()); if (fun->nargs() > 0) { BindingVector bindings(cx); @@ -5576,7 +5576,7 @@ DebuggerObject_sealHelper(JSContext *cx, unsigned argc, Value *vp, SealHelperOp } else if (op == Freeze) { ok = JSObject::freeze(cx, obj); } else { - JS_ASSERT(op == PreventExtensions); + MOZ_ASSERT(op == PreventExtensions); ok = JSObject::preventExtensions(cx, obj); } if (!ok) @@ -5853,7 +5853,7 @@ DebuggerObject_unsafeDereference(JSContext *cx, unsigned argc, Value *vp) return false; // Wrapping should outerize inner objects. - JS_ASSERT(!IsInnerObject(&args.rval().toObject())); + MOZ_ASSERT(!IsInnerObject(&args.rval().toObject())); return true; } @@ -5974,11 +5974,11 @@ DebuggerEnv_checkThis(JSContext *cx, const CallArgs &args, const char *fnname, if (!envobj) \ return false; \ Rooted env(cx, static_cast(envobj->getPrivate())); \ - JS_ASSERT(env); \ - JS_ASSERT(!env->is()) - -#define THIS_DEBUGENV_OWNER(cx, argc, vp, fnname, args, envobj, env, dbg) \ - THIS_DEBUGENV(cx, argc, vp, fnname, args, envobj, env); \ + MOZ_ASSERT(env); \ + MOZ_ASSERT(!env->is()) + + #define THIS_DEBUGENV_OWNER(cx, argc, vp, fnname, args, envobj, env, dbg) \ + THIS_DEBUGENV(cx, argc, vp, fnname, args, envobj, env); \ Debugger *dbg = Debugger::fromChildJSObject(envobj) static bool @@ -6052,7 +6052,7 @@ DebuggerEnv_getObject(JSContext *cx, unsigned argc, Value *vp) obj = &env->as().scope().as().object(); } else { obj = env; - JS_ASSERT(!obj->is()); + MOZ_ASSERT(!obj->is()); } args.rval().setObject(*obj); @@ -6093,8 +6093,8 @@ DebuggerEnv_getInspectable(JSContext *cx, unsigned argc, Value *vp) if (!envobj) return false; Rooted env(cx, static_cast(envobj->getPrivate())); - JS_ASSERT(env); - JS_ASSERT(!env->is()); + MOZ_ASSERT(env); + MOZ_ASSERT(!env->is()); Debugger *dbg = Debugger::fromChildJSObject(envobj); diff --git a/js/src/vm/Debugger.h b/js/src/vm/Debugger.h index cc9682523b63..654a467a5485 100644 --- a/js/src/vm/Debugger.h +++ b/js/src/vm/Debugger.h @@ -84,10 +84,10 @@ class DebuggerWeakMap : private WeakMap > template bool relookupOrAdd(AddPtr &p, const KeyInput &k, const ValueInput &v) { - JS_ASSERT(v->compartment() == Base::compartment); - JS_ASSERT(!k->compartment()->options_.mergeable()); + MOZ_ASSERT(v->compartment() == Base::compartment); + MOZ_ASSERT(!k->compartment()->options_.mergeable()); JS_ASSERT_IF(!InvisibleKeysOk, !k->compartment()->options_.invisibleToDebugger()); - JS_ASSERT(!Base::has(k)); + MOZ_ASSERT(!Base::has(k)); if (!incZoneCount(k->zone())) return false; bool ok = Base::relookupOrAdd(p, k, v); @@ -97,7 +97,7 @@ class DebuggerWeakMap : private WeakMap > } void remove(const Lookup &l) { - JS_ASSERT(Base::has(l)); + MOZ_ASSERT(Base::has(l)); Base::remove(l); decZoneCount(l->zone()); } @@ -129,7 +129,7 @@ class DebuggerWeakMap : private WeakMap > decZoneCount(k->zone()); } else { // markKeys() should have done any necessary relocation. - JS_ASSERT(k == e.front().key()); + MOZ_ASSERT(k == e.front().key()); } } Base::assertEntriesNotAboutToBeFinalized(); @@ -145,8 +145,8 @@ class DebuggerWeakMap : private WeakMap > void decZoneCount(JS::Zone *zone) { CountMap::Ptr p = zoneCounts.lookup(zone); - JS_ASSERT(p); - JS_ASSERT(p->value() > 0); + MOZ_ASSERT(p); + MOZ_ASSERT(p->value() > 0); --p->value(); if (p->value() == 0) zoneCounts.remove(zone); @@ -698,14 +698,14 @@ Debugger::fromOnNewGlobalObjectWatchersLink(JSCList *link) { const js::HeapPtrObject & Debugger::toJSObject() const { - JS_ASSERT(object); + MOZ_ASSERT(object); return object; } js::HeapPtrObject & Debugger::toJSObjectRef() { - JS_ASSERT(object); + MOZ_ASSERT(object); return object; } @@ -775,7 +775,7 @@ Debugger::onNewScript(JSContext *cx, HandleScript script, GlobalObject *compileA void Debugger::onNewGlobalObject(JSContext *cx, Handle global) { - JS_ASSERT(!global->compartment()->firedOnNewGlobalObject); + MOZ_ASSERT(!global->compartment()->firedOnNewGlobalObject); #ifdef DEBUG global->compartment()->firedOnNewGlobalObject = true; #endif diff --git a/js/src/vm/ForkJoin.cpp b/js/src/vm/ForkJoin.cpp index bbdc8dd51701..16107c4d173b 100644 --- a/js/src/vm/ForkJoin.cpp +++ b/js/src/vm/ForkJoin.cpp @@ -359,8 +359,8 @@ ForkJoinActivation::ForkJoinActivation(JSContext *cx) cx->runtime()->gc.waitBackgroundSweepEnd(); - JS_ASSERT(!cx->runtime()->needsIncrementalBarrier()); - JS_ASSERT(!cx->zone()->needsIncrementalBarrier()); + MOZ_ASSERT(!cx->runtime()->needsIncrementalBarrier()); + MOZ_ASSERT(!cx->zone()->needsIncrementalBarrier()); } ForkJoinActivation::~ForkJoinActivation() @@ -380,14 +380,14 @@ static const char *ForkJoinModeString(ForkJoinMode mode); bool js::ForkJoin(JSContext *cx, CallArgs &args) { - JS_ASSERT(args.length() == 5); // else the self-hosted code is wrong - JS_ASSERT(args[0].isObject()); - JS_ASSERT(args[0].toObject().is()); - JS_ASSERT(args[1].isInt32()); - JS_ASSERT(args[2].isInt32()); - JS_ASSERT(args[3].isInt32()); - JS_ASSERT(args[3].toInt32() < NumForkJoinModes); - JS_ASSERT(args[4].isObjectOrNull()); + MOZ_ASSERT(args.length() == 5); // else the self-hosted code is wrong + MOZ_ASSERT(args[0].isObject()); + MOZ_ASSERT(args[0].toObject().is()); + MOZ_ASSERT(args[1].isInt32()); + MOZ_ASSERT(args[2].isInt32()); + MOZ_ASSERT(args[3].isInt32()); + MOZ_ASSERT(args[3].toInt32() < NumForkJoinModes); + MOZ_ASSERT(args[4].isObjectOrNull()); if (!CanUseExtraThreads()) return ForkJoinSequentially(cx, args); @@ -551,7 +551,7 @@ ForkJoinOperation::apply() if (compileForParallelExecution(&status) == RedLight) return SpewEndOp(status); - JS_ASSERT(worklist_.length() == 0); + MOZ_ASSERT(worklist_.length() == 0); if (parallelExecution(&status) == RedLight) return SpewEndOp(status); @@ -712,7 +712,7 @@ ForkJoinOperation::compileForParallelExecution(ExecutionStatus *status) Spew(SpewCompile, "Script %p:%s:%d compiled", script.get(), script->filename(), script->lineno()); - JS_ASSERT(script->hasParallelIonScript()); + MOZ_ASSERT(script->hasParallelIonScript()); if (isInitialScript(script)) { JitCompartment *jitComp = cx_->compartment()->jitCompartment(); @@ -731,7 +731,7 @@ ForkJoinOperation::compileForParallelExecution(ExecutionStatus *status) // call target" flag is set and add the targets to our // worklist if so. Clear the flag after that, since we // will be compiling the call targets. - JS_ASSERT(script->hasParallelIonScript()); + MOZ_ASSERT(script->hasParallelIonScript()); if (appendCallTargetsToWorklist(i, status) == RedLight) return RedLight; } @@ -788,10 +788,10 @@ ForkJoinOperation::compileForParallelExecution(ExecutionStatus *status) // worklist. for (uint32_t i = 0; i < worklist_.length(); i++) { if (worklist_[i]->hasParallelIonScript()) { - JS_ASSERT(worklistData_[i].calleesEnqueued); + MOZ_ASSERT(worklistData_[i].calleesEnqueued); worklist_[i]->parallelIonScript()->clearHasUncompiledCallTarget(); } else { - JS_ASSERT(worklistData_[i].stallCount >= stallThreshold); + MOZ_ASSERT(worklistData_[i].stallCount >= stallThreshold); } } worklist_.clear(); @@ -805,7 +805,7 @@ ForkJoinOperation::appendCallTargetsToWorklist(uint32_t index, ExecutionStatus * // GreenLight: call targets appended // RedLight: fatal error or completed work via warmups or fallback - JS_ASSERT(worklist_[index]->hasParallelIonScript()); + MOZ_ASSERT(worklist_[index]->hasParallelIonScript()); // Check whether we have already enqueued the targets for // this entry and avoid doing it again if so. @@ -834,7 +834,7 @@ ForkJoinOperation::appendCallTargetToWorklist(HandleScript script, ExecutionStat // GreenLight: call target appended if necessary // RedLight: fatal error or completed work via warmups or fallback - JS_ASSERT(script); + MOZ_ASSERT(script); // Fallback to sequential if disabled. if (!script->canParallelIonCompile()) { @@ -1249,7 +1249,7 @@ ForkJoinOperation::parallelExecution(ExecutionStatus *status) // Recursive use of the ThreadPool is not supported. Right now we // cannot get here because parallel code cannot invoke native // functions such as ForkJoin(). - JS_ASSERT(ForkJoinContext::current() == nullptr); + MOZ_ASSERT(ForkJoinContext::current() == nullptr); if (sliceStart_ == sliceEnd_) { Spew(SpewOps, "Warmup execution finished all the work."); @@ -1340,7 +1340,7 @@ class ParallelIonInvoke : argc_(argc), args(argv_ + 2) { - JS_ASSERT(argc <= maxArgc + 2); + MOZ_ASSERT(argc <= maxArgc + 2); // Set 'callee' and 'this'. argv_[0] = ObjectValue(*callee); @@ -1590,7 +1590,7 @@ ForkJoinShared::executePortion(PerThreadData *perThread, ThreadPoolWorker *worke CompileCompartment::get(cx_->compartment()), nullptr); - JS_ASSERT(!cx.bailoutRecord->bailedOut()); + MOZ_ASSERT(!cx.bailoutRecord->bailedOut()); if (!fun_->nonLazyScript()->hasParallelIonScript()) { // Sometimes, particularly with GCZeal, the parallel ion @@ -1608,7 +1608,7 @@ ForkJoinShared::executePortion(PerThreadData *perThread, ThreadPoolWorker *worke fii.args[2] = Int32Value(sliceEnd_); bool ok = fii.invoke(&cx); - JS_ASSERT(ok == !cx.bailoutRecord->bailedOut()); + MOZ_ASSERT(ok == !cx.bailoutRecord->bailedOut()); if (!ok) { setAbortFlagAndRequestInterrupt(false); #ifdef JSGC_FJGENERATIONAL @@ -1647,11 +1647,11 @@ ForkJoinShared::executePortion(PerThreadData *perThread, ThreadPoolWorker *worke void ForkJoinShared::setAbortFlagDueToInterrupt(ForkJoinContext &cx) { - JS_ASSERT(cx_->runtime()->interruptPar); + MOZ_ASSERT(cx_->runtime()->interruptPar); // The GC Needed flag should not be set during parallel // execution. Instead, one of the requestGC() or // requestZoneGC() methods should be invoked. - JS_ASSERT(!cx_->runtime()->gc.isGcNeeded()); + MOZ_ASSERT(!cx_->runtime()->gc.isGcNeeded()); if (!abort_) { cx.bailoutRecord->joinCause(ParallelBailoutInterrupt); @@ -1804,7 +1804,7 @@ JSContext * ForkJoinContext::acquireJSContext() { JSContext *cx = shared_->acquireJSContext(); - JS_ASSERT(!acquiredJSContext_); + MOZ_ASSERT(!acquiredJSContext_); acquiredJSContext_ = true; return cx; } @@ -1812,7 +1812,7 @@ ForkJoinContext::acquireJSContext() void ForkJoinContext::releaseJSContext() { - JS_ASSERT(acquiredJSContext_); + MOZ_ASSERT(acquiredJSContext_); acquiredJSContext_ = false; return shared_->releaseJSContext(); } @@ -2117,7 +2117,7 @@ class ParallelSpewer if (!active[SpewOps]) return; - JS_ASSERT(depth > 0); + MOZ_ASSERT(depth > 0); depth--; const char *statusColor; @@ -2168,7 +2168,7 @@ class ParallelSpewer if (!active[SpewCompile]) return; - JS_ASSERT(depth > 0); + MOZ_ASSERT(depth > 0); depth--; const char *statusColor; @@ -2320,10 +2320,10 @@ intrinsic_SetForkJoinTargetRegionPar(ForkJoinContext *cx, unsigned argc, Value * // the region nor encompassing it. CallArgs args = CallArgsFromVp(argc, vp); - JS_ASSERT(argc == 3); - JS_ASSERT(args[0].isObject() && args[0].toObject().is()); - JS_ASSERT(args[1].isInt32()); - JS_ASSERT(args[2].isInt32()); + MOZ_ASSERT(argc == 3); + MOZ_ASSERT(args[0].isObject() && args[0].toObject().is()); + MOZ_ASSERT(args[1].isInt32()); + MOZ_ASSERT(args[2].isInt32()); uint8_t *mem = args[0].toObject().as().typedMem(); int32_t start = args[1].toInt32(); diff --git a/js/src/vm/GlobalObject.cpp b/js/src/vm/GlobalObject.cpp index e2b20ad84559..874d133d2666 100644 --- a/js/src/vm/GlobalObject.cpp +++ b/js/src/vm/GlobalObject.cpp @@ -78,7 +78,7 @@ TypedObjectModuleObject& js::GlobalObject::getTypedObjectModule() const { Value v = getConstructor(JSProto_TypedObject); // only gets called from contexts where TypedObject must be initialized - JS_ASSERT(v.isObject()); + MOZ_ASSERT(v.isObject()); return v.toObject().as(); } @@ -207,13 +207,13 @@ GlobalObject::resolveConstructor(JSContext *cx, Handle global, JS GlobalObject::initBuiltinConstructor(JSContext *cx, Handle global, JSProtoKey key, HandleObject ctor, HandleObject proto) { - JS_ASSERT(!global->nativeEmpty()); // reserved slots already allocated - JS_ASSERT(key != JSProto_Null); - JS_ASSERT(ctor); - JS_ASSERT(proto); + MOZ_ASSERT(!global->nativeEmpty()); // reserved slots already allocated + MOZ_ASSERT(key != JSProto_Null); + MOZ_ASSERT(ctor); + MOZ_ASSERT(proto); RootedId id(cx, NameToId(ClassName(key, cx))); - JS_ASSERT(!global->nativeLookup(cx, id)); + MOZ_ASSERT(!global->nativeLookup(cx, id)); if (!global->addDataProperty(cx, id, constructorPropertySlot(key), 0)) return false; @@ -229,8 +229,8 @@ GlobalObject::initBuiltinConstructor(JSContext *cx, Handle global GlobalObject * GlobalObject::create(JSContext *cx, const Class *clasp) { - JS_ASSERT(clasp->flags & JSCLASS_IS_GLOBAL); - JS_ASSERT(clasp->trace == JS_GlobalObjectTraceHook); + MOZ_ASSERT(clasp->flags & JSCLASS_IS_GLOBAL); + MOZ_ASSERT(clasp->trace == JS_GlobalObjectTraceHook); JSObject *obj = NewObjectWithGivenProto(cx, clasp, nullptr, nullptr, SingletonObject); if (!obj) @@ -379,7 +379,7 @@ GlobalObject::createConstructor(JSContext *cx, Native ctor, JSAtom *nameArg, uns static JSObject * CreateBlankProto(JSContext *cx, const Class *clasp, JSObject &proto, GlobalObject &global) { - JS_ASSERT(clasp != &JSFunction::class_); + MOZ_ASSERT(clasp != &JSFunction::class_); RootedObject blankProto(cx, NewObjectWithGivenProto(cx, clasp, &proto, &global, SingletonObject)); if (!blankProto || !blankProto->setDelegate(cx)) @@ -450,7 +450,7 @@ GlobalObject::getDebuggers() Value debuggers = getReservedSlot(DEBUGGERS); if (debuggers.isUndefined()) return nullptr; - JS_ASSERT(debuggers.toObject().getClass() == &GlobalDebuggees_class); + MOZ_ASSERT(debuggers.toObject().getClass() == &GlobalDebuggees_class); return (DebuggerVector *) debuggers.toObject().getPrivate(); } diff --git a/js/src/vm/GlobalObject.h b/js/src/vm/GlobalObject.h index d8244f3102d1..38409819ff30 100644 --- a/js/src/vm/GlobalObject.h +++ b/js/src/vm/GlobalObject.h @@ -128,22 +128,22 @@ class GlobalObject : public JSObject public: void setThrowTypeError(JSFunction *fun) { - JS_ASSERT(getSlotRef(THROWTYPEERROR).isUndefined()); + MOZ_ASSERT(getSlotRef(THROWTYPEERROR).isUndefined()); setSlot(THROWTYPEERROR, ObjectValue(*fun)); } void setOriginalEval(JSObject *evalobj) { - JS_ASSERT(getSlotRef(EVAL).isUndefined()); + MOZ_ASSERT(getSlotRef(EVAL).isUndefined()); setSlot(EVAL, ObjectValue(*evalobj)); } void setIntrinsicsHolder(JSObject *obj) { - JS_ASSERT(getSlotRef(INTRINSICS).isUndefined()); + MOZ_ASSERT(getSlotRef(INTRINSICS).isUndefined()); setSlot(INTRINSICS, ObjectValue(*obj)); } Value getConstructor(JSProtoKey key) const { - JS_ASSERT(key <= JSProto_LIMIT); + MOZ_ASSERT(key <= JSProto_LIMIT); return getSlot(APPLICATION_SLOTS + key); } static bool ensureConstructor(JSContext *cx, Handle global, JSProtoKey key); @@ -152,22 +152,22 @@ class GlobalObject : public JSObject JSProtoKey key, HandleObject ctor, HandleObject proto); void setConstructor(JSProtoKey key, const Value &v) { - JS_ASSERT(key <= JSProto_LIMIT); + MOZ_ASSERT(key <= JSProto_LIMIT); setSlot(APPLICATION_SLOTS + key, v); } Value getPrototype(JSProtoKey key) const { - JS_ASSERT(key <= JSProto_LIMIT); + MOZ_ASSERT(key <= JSProto_LIMIT); return getSlot(APPLICATION_SLOTS + JSProto_LIMIT + key); } void setPrototype(JSProtoKey key, const Value &value) { - JS_ASSERT(key <= JSProto_LIMIT); + MOZ_ASSERT(key <= JSProto_LIMIT); setSlot(APPLICATION_SLOTS + JSProto_LIMIT + key, value); } static uint32_t constructorPropertySlot(JSProtoKey key) { - JS_ASSERT(key <= JSProto_LIMIT); + MOZ_ASSERT(key <= JSProto_LIMIT); return APPLICATION_SLOTS + JSProto_LIMIT * 2 + key; } @@ -181,13 +181,13 @@ class GlobalObject : public JSObject bool classIsInitialized(JSProtoKey key) const { bool inited = !getConstructor(key).isUndefined(); - JS_ASSERT(inited == !getPrototype(key).isUndefined()); + MOZ_ASSERT(inited == !getPrototype(key).isUndefined()); return inited; } bool functionObjectClassesInitialized() const { bool inited = classIsInitialized(JSProto_Function); - JS_ASSERT(inited == classIsInitialized(JSProto_Object)); + MOZ_ASSERT(inited == classIsInitialized(JSProto_Object)); return inited; } @@ -239,20 +239,20 @@ class GlobalObject : public JSObject } Value createArrayFromBufferHelper(uint32_t slot) const { - JS_ASSERT(FROM_BUFFER_UINT8 <= slot && slot <= FROM_BUFFER_UINT8CLAMPED); - JS_ASSERT(!getSlot(slot).isUndefined()); + MOZ_ASSERT(FROM_BUFFER_UINT8 <= slot && slot <= FROM_BUFFER_UINT8CLAMPED); + MOZ_ASSERT(!getSlot(slot).isUndefined()); return getSlot(slot); } void setCreateArrayFromBufferHelper(uint32_t slot, Handle fun) { - JS_ASSERT(getSlotRef(slot).isUndefined()); + MOZ_ASSERT(getSlotRef(slot).isUndefined()); setSlot(slot, ObjectValue(*fun)); } public: /* XXX Privatize me! */ void setCreateDataViewForThis(Handle fun) { - JS_ASSERT(getSlotRef(CREATE_DATAVIEW_FOR_THIS).isUndefined()); + MOZ_ASSERT(getSlotRef(CREATE_DATAVIEW_FOR_THIS).isUndefined()); setSlot(CREATE_DATAVIEW_FOR_THIS, ObjectValue(*fun)); } @@ -383,22 +383,22 @@ class GlobalObject : public JSObject } void setFloat32x4TypeDescr(JSObject &obj) { - JS_ASSERT(getSlotRef(FLOAT32X4_TYPE_DESCR).isUndefined()); + MOZ_ASSERT(getSlotRef(FLOAT32X4_TYPE_DESCR).isUndefined()); setSlot(FLOAT32X4_TYPE_DESCR, ObjectValue(obj)); } JSObject &float32x4TypeDescr() { - JS_ASSERT(getSlotRef(FLOAT32X4_TYPE_DESCR).isObject()); + MOZ_ASSERT(getSlotRef(FLOAT32X4_TYPE_DESCR).isObject()); return getSlotRef(FLOAT32X4_TYPE_DESCR).toObject(); } void setInt32x4TypeDescr(JSObject &obj) { - JS_ASSERT(getSlotRef(INT32X4_TYPE_DESCR).isUndefined()); + MOZ_ASSERT(getSlotRef(INT32X4_TYPE_DESCR).isUndefined()); setSlot(INT32X4_TYPE_DESCR, ObjectValue(obj)); } JSObject &int32x4TypeDescr() { - JS_ASSERT(getSlotRef(INT32X4_TYPE_DESCR).isObject()); + MOZ_ASSERT(getSlotRef(INT32X4_TYPE_DESCR).isObject()); return getSlotRef(INT32X4_TYPE_DESCR).toObject(); } @@ -524,7 +524,7 @@ class GlobalObject : public JSObject } JSObject *intrinsicsHolder() { - JS_ASSERT(!getSlot(INTRINSICS).isUndefined()); + MOZ_ASSERT(!getSlot(INTRINSICS).isUndefined()); return &getSlot(INTRINSICS).toObject(); } @@ -557,7 +557,7 @@ class GlobalObject : public JSObject bool setIntrinsicValue(JSContext *cx, PropertyName *name, HandleValue value) { #ifdef DEBUG RootedObject self(cx, this); - JS_ASSERT(cx->runtime()->isSelfHostingGlobal(self)); + MOZ_ASSERT(cx->runtime()->isSelfHostingGlobal(self)); #endif RootedObject holder(cx, intrinsicsHolder()); RootedValue valCopy(cx, value); @@ -579,7 +579,7 @@ class GlobalObject : public JSObject } Value createDataViewForThis() const { - JS_ASSERT(dataViewClassInitialized()); + MOZ_ASSERT(dataViewClassInitialized()); return getSlot(CREATE_DATAVIEW_FOR_THIS); } diff --git a/js/src/vm/HelperThreads.cpp b/js/src/vm/HelperThreads.cpp index d642f443ab4f..dc88fff44848 100644 --- a/js/src/vm/HelperThreads.cpp +++ b/js/src/vm/HelperThreads.cpp @@ -56,7 +56,7 @@ void js::SetFakeCPUCount(size_t count) { // This must be called before the threads have been initialized. - JS_ASSERT(!HelperThreadState().threads); + MOZ_ASSERT(!HelperThreadState().threads); HelperThreadState().cpuCount = count; HelperThreadState().threadCount = ThreadCountForCPUCount(count); @@ -66,8 +66,8 @@ bool js::StartOffThreadAsmJSCompile(ExclusiveContext *cx, AsmJSParallelTask *asmData) { // Threads already initialized by the AsmJS compiler. - JS_ASSERT(asmData->mir); - JS_ASSERT(asmData->lir == nullptr); + MOZ_ASSERT(asmData->mir); + MOZ_ASSERT(asmData->lir == nullptr); AutoLockHelperThreadState lock; @@ -381,7 +381,7 @@ js::StartOffThreadParseScript(JSContext *cx, const ReadOnlyCompileOptions &optio void js::EnqueuePendingParseTasksAfterGC(JSRuntime *rt) { - JS_ASSERT(!OffThreadParsingMustWaitForGC(rt)); + MOZ_ASSERT(!OffThreadParsingMustWaitForGC(rt)); GlobalHelperThreadState::ParseTaskVector newTasks; { @@ -420,9 +420,9 @@ static const uint32_t HELPER_STACK_QUOTA = 450 * 1024; void GlobalHelperThreadState::ensureInitialized() { - JS_ASSERT(CanUseExtraThreads()); + MOZ_ASSERT(CanUseExtraThreads()); - JS_ASSERT(this == &HelperThreadState()); + MOZ_ASSERT(this == &HelperThreadState()); AutoLockHelperThreadState lock; if (threads) @@ -492,7 +492,7 @@ GlobalHelperThreadState::finish() void GlobalHelperThreadState::lock() { - JS_ASSERT(!isLocked()); + MOZ_ASSERT(!isLocked()); AssertCurrentThreadCanLock(HelperThreadStateLock); PR_Lock(helperLock); #ifdef DEBUG @@ -503,7 +503,7 @@ GlobalHelperThreadState::lock() void GlobalHelperThreadState::unlock() { - JS_ASSERT(isLocked()); + MOZ_ASSERT(isLocked()); #ifdef DEBUG lockOwner = nullptr; #endif @@ -521,14 +521,14 @@ GlobalHelperThreadState::isLocked() void GlobalHelperThreadState::wait(CondVar which, uint32_t millis) { - JS_ASSERT(isLocked()); + MOZ_ASSERT(isLocked()); #ifdef DEBUG lockOwner = nullptr; #endif DebugOnly status = PR_WaitCondVar(whichWakeup(which), millis ? PR_MillisecondsToInterval(millis) : PR_INTERVAL_NO_TIMEOUT); - JS_ASSERT(status == PR_SUCCESS); + MOZ_ASSERT(status == PR_SUCCESS); #ifdef DEBUG lockOwner = PR_GetCurrentThread(); #endif @@ -537,14 +537,14 @@ GlobalHelperThreadState::wait(CondVar which, uint32_t millis) void GlobalHelperThreadState::notifyAll(CondVar which) { - JS_ASSERT(isLocked()); + MOZ_ASSERT(isLocked()); PR_NotifyAllCondVar(whichWakeup(which)); } void GlobalHelperThreadState::notifyOne(CondVar which) { - JS_ASSERT(isLocked()); + MOZ_ASSERT(isLocked()); PR_NotifyCondVar(whichWakeup(which)); } @@ -552,7 +552,7 @@ bool GlobalHelperThreadState::canStartAsmJSCompile() { // Don't execute an AsmJS job if an earlier one failed. - JS_ASSERT(isLocked()); + MOZ_ASSERT(isLocked()); if (asmJSWorklist().empty() || numAsmJSFailedJobs) return false; @@ -597,10 +597,10 @@ GlobalHelperThreadState::canStartIonCompile() jit::IonBuilder * GlobalHelperThreadState::highestPriorityPendingIonCompile(bool remove /* = false */) { - JS_ASSERT(isLocked()); + MOZ_ASSERT(isLocked()); if (ionWorklist().empty()) { - JS_ASSERT(!remove); + MOZ_ASSERT(!remove); return nullptr; } @@ -619,7 +619,7 @@ GlobalHelperThreadState::highestPriorityPendingIonCompile(bool remove /* = false HelperThread * GlobalHelperThreadState::lowestPriorityUnpausedIonCompileAtThreshold() { - JS_ASSERT(isLocked()); + MOZ_ASSERT(isLocked()); // Get the lowest priority IonBuilder which has started compilation and // isn't paused, unless there are still fewer than the aximum number of @@ -641,7 +641,7 @@ GlobalHelperThreadState::lowestPriorityUnpausedIonCompileAtThreshold() HelperThread * GlobalHelperThreadState::highestPriorityPausedIonCompile() { - JS_ASSERT(isLocked()); + MOZ_ASSERT(isLocked()); // Get the highest priority IonBuilder which has started compilation but // which was subsequently paused. @@ -649,7 +649,7 @@ GlobalHelperThreadState::highestPriorityPausedIonCompile() for (size_t i = 0; i < threadCount; i++) { if (threads[i].pause) { // Currently, only threads with IonBuilders can be paused. - JS_ASSERT(threads[i].ionBuilder); + MOZ_ASSERT(threads[i].ionBuilder); if (!thread || IonBuilderHasHigherPriority(threads[i].ionBuilder, thread->ionBuilder)) thread = &threads[i]; } @@ -660,7 +660,7 @@ GlobalHelperThreadState::highestPriorityPausedIonCompile() bool GlobalHelperThreadState::pendingIonCompileHasSufficientPriority() { - JS_ASSERT(isLocked()); + MOZ_ASSERT(isLocked()); // Can't compile anything if there are no scripts to compile. if (!canStartIonCompile()) @@ -692,7 +692,7 @@ GlobalHelperThreadState::canStartParseTask() // atoms table. Note that asm.js compilation depends on this to avoid // stalling the helper thread, as off thread parse tasks can trigger and // block on other off thread asm.js compilation tasks. - JS_ASSERT(isLocked()); + MOZ_ASSERT(isLocked()); if (parseWorklist().empty()) return false; for (size_t i = 0; i < threadCount; i++) { @@ -741,7 +741,7 @@ GlobalHelperThreadState::finishParseTask(JSContext *maybecx, JSRuntime *rt, void } } } - JS_ASSERT(parseTask); + MOZ_ASSERT(parseTask); if (!maybecx) { LeaveParseTaskZone(rt, parseTask); @@ -749,7 +749,7 @@ GlobalHelperThreadState::finishParseTask(JSContext *maybecx, JSRuntime *rt, void } JSContext *cx = maybecx; - JS_ASSERT(cx->compartment()); + MOZ_ASSERT(cx->compartment()); // Make sure we have all the constructors we need for the prototype // remapping below, since we can't GC while that's happening. @@ -782,12 +782,12 @@ GlobalHelperThreadState::finishParseTask(JSContext *maybecx, JSRuntime *rt, void JSProtoKey key = JS::IdentifyStandardPrototype(proto.toObject()); if (key == JSProto_Null) continue; - JS_ASSERT(key == JSProto_Object || key == JSProto_Array || - key == JSProto_Function || key == JSProto_RegExp || - key == JSProto_Iterator); + MOZ_ASSERT(key == JSProto_Object || key == JSProto_Array || + key == JSProto_Function || key == JSProto_RegExp || + key == JSProto_Iterator); JSObject *newProto = GetBuiltinPrototypePure(global, key); - JS_ASSERT(newProto); + MOZ_ASSERT(newProto); object->setProtoUnchecked(TaggedProto(newProto)); } @@ -856,7 +856,7 @@ HelperThread::ThreadMain(void *arg) #ifdef MOZ_NUWA_PROCESS if (IsNuwaProcess()) { - JS_ASSERT(NuwaMarkCurrentThread != nullptr); + MOZ_ASSERT(NuwaMarkCurrentThread != nullptr); NuwaMarkCurrentThread(nullptr, nullptr); } #endif @@ -867,9 +867,9 @@ HelperThread::ThreadMain(void *arg) void HelperThread::handleAsmJSWorkload() { - JS_ASSERT(HelperThreadState().isLocked()); - JS_ASSERT(HelperThreadState().canStartAsmJSCompile()); - JS_ASSERT(idle()); + MOZ_ASSERT(HelperThreadState().isLocked()); + MOZ_ASSERT(HelperThreadState().canStartAsmJSCompile()); + MOZ_ASSERT(idle()); asmData = HelperThreadState().asmJSWorklist().popCopy(); bool success = false; @@ -916,9 +916,9 @@ HelperThread::handleAsmJSWorkload() void HelperThread::handleIonWorkload() { - JS_ASSERT(HelperThreadState().isLocked()); - JS_ASSERT(HelperThreadState().canStartIonCompile()); - JS_ASSERT(idle()); + MOZ_ASSERT(HelperThreadState().isLocked()); + MOZ_ASSERT(HelperThreadState().canStartIonCompile()); + MOZ_ASSERT(idle()); // Find the IonBuilder in the worklist with the highest priority, and // remove it from the worklist. @@ -931,7 +931,7 @@ HelperThread::handleIonWorkload() // was called, the builder we are pausing may actually be higher priority // than the one we are about to start. Oh well. if (HelperThread *other = HelperThreadState().lowestPriorityUnpausedIonCompileAtThreshold()) { - JS_ASSERT(other->ionBuilder && !other->pause); + MOZ_ASSERT(other->ionBuilder && !other->pause); other->pause = true; } @@ -975,7 +975,7 @@ HelperThread::handleIonWorkload() // many there are, since each thread we unpause will eventually finish and // end up back here. if (HelperThread *other = HelperThreadState().highestPriorityPausedIonCompile()) { - JS_ASSERT(other->ionBuilder && other->pause); + MOZ_ASSERT(other->ionBuilder && other->pause); // Only unpause the other thread if there isn't a higher priority // builder which this thread or another can start on. @@ -1001,7 +1001,7 @@ CurrentHelperThread() break; } } - JS_ASSERT(thread); + MOZ_ASSERT(thread); return thread; } @@ -1046,9 +1046,9 @@ ExclusiveContext::addPendingOverRecursed() void HelperThread::handleParseWorkload() { - JS_ASSERT(HelperThreadState().isLocked()); - JS_ASSERT(HelperThreadState().canStartParseTask()); - JS_ASSERT(idle()); + MOZ_ASSERT(HelperThreadState().isLocked()); + MOZ_ASSERT(HelperThreadState().canStartParseTask()); + MOZ_ASSERT(idle()); parseTask = HelperThreadState().parseWorklist().popCopy(); parseTask->cx->setHelperThread(this); @@ -1081,9 +1081,9 @@ HelperThread::handleParseWorkload() void HelperThread::handleCompressionWorkload() { - JS_ASSERT(HelperThreadState().isLocked()); - JS_ASSERT(HelperThreadState().canStartCompressionTask()); - JS_ASSERT(idle()); + MOZ_ASSERT(HelperThreadState().isLocked()); + MOZ_ASSERT(HelperThreadState().canStartCompressionTask()); + MOZ_ASSERT(idle()); compressionTask = HelperThreadState().compressionWorklist().popCopy(); compressionTask->helperThread = this; @@ -1120,7 +1120,7 @@ js::StartOffThreadCompression(ExclusiveContext *cx, SourceCompressionTask *task) bool GlobalHelperThreadState::compressionInProgress(SourceCompressionTask *task) { - JS_ASSERT(isLocked()); + MOZ_ASSERT(isLocked()); for (size_t i = 0; i < compressionWorklist().length(); i++) { if (compressionWorklist()[i] == task) return true; @@ -1136,7 +1136,7 @@ bool SourceCompressionTask::complete() { if (!active()) { - JS_ASSERT(!compressed); + MOZ_ASSERT(!compressed); return true; } @@ -1163,7 +1163,7 @@ SourceCompressionTask::complete() ss = nullptr; compressed = nullptr; - JS_ASSERT(!active()); + MOZ_ASSERT(!active()); return result != OOM; } @@ -1171,7 +1171,7 @@ SourceCompressionTask::complete() SourceCompressionTask * GlobalHelperThreadState::compressionTaskForSource(ScriptSource *ss) { - JS_ASSERT(isLocked()); + MOZ_ASSERT(isLocked()); for (size_t i = 0; i < compressionWorklist().length(); i++) { SourceCompressionTask *task = compressionWorklist()[i]; if (task->source() == ss) @@ -1188,11 +1188,11 @@ GlobalHelperThreadState::compressionTaskForSource(ScriptSource *ss) void HelperThread::handleGCHelperWorkload() { - JS_ASSERT(HelperThreadState().isLocked()); - JS_ASSERT(HelperThreadState().canStartGCHelperTask()); - JS_ASSERT(idle()); + MOZ_ASSERT(HelperThreadState().isLocked()); + MOZ_ASSERT(HelperThreadState().canStartGCHelperTask()); + MOZ_ASSERT(idle()); - JS_ASSERT(!gcHelperState); + MOZ_ASSERT(!gcHelperState); gcHelperState = HelperThreadState().gcHelperWorklist().popCopy(); { @@ -1206,7 +1206,7 @@ HelperThread::handleGCHelperWorkload() void HelperThread::threadLoop() { - JS_ASSERT(CanUseExtraThreads()); + MOZ_ASSERT(CanUseExtraThreads()); JS::AutoSuppressGCAnalysis nogc; AutoLockHelperThreadState lock; @@ -1224,7 +1224,7 @@ HelperThread::threadLoop() threadData->nativeStackLimit[i] = stackLimit; while (true) { - JS_ASSERT(idle()); + MOZ_ASSERT(idle()); // Block until a task is available. Save the value of whether we are // going to do an Ion compile, in case the value returned by the method diff --git a/js/src/vm/HelperThreads.h b/js/src/vm/HelperThreads.h index b8563a808f67..738375335dc6 100644 --- a/js/src/vm/HelperThreads.h +++ b/js/src/vm/HelperThreads.h @@ -134,47 +134,47 @@ class GlobalHelperThreadState } IonBuilderVector &ionWorklist() { - JS_ASSERT(isLocked()); + MOZ_ASSERT(isLocked()); return ionWorklist_; } IonBuilderVector &ionFinishedList() { - JS_ASSERT(isLocked()); + MOZ_ASSERT(isLocked()); return ionFinishedList_; } IonBuilderList &ionLazyLinkList() { - JS_ASSERT(isLocked()); + MOZ_ASSERT(isLocked()); return ionLazyLinkList_; } AsmJSParallelTaskVector &asmJSWorklist() { - JS_ASSERT(isLocked()); + MOZ_ASSERT(isLocked()); return asmJSWorklist_; } AsmJSParallelTaskVector &asmJSFinishedList() { - JS_ASSERT(isLocked()); + MOZ_ASSERT(isLocked()); return asmJSFinishedList_; } ParseTaskVector &parseWorklist() { - JS_ASSERT(isLocked()); + MOZ_ASSERT(isLocked()); return parseWorklist_; } ParseTaskVector &parseFinishedList() { - JS_ASSERT(isLocked()); + MOZ_ASSERT(isLocked()); return parseFinishedList_; } ParseTaskVector &parseWaitingOnGC() { - JS_ASSERT(isLocked()); + MOZ_ASSERT(isLocked()); return parseWaitingOnGC_; } SourceCompressionTaskVector &compressionWorklist() { - JS_ASSERT(isLocked()); + MOZ_ASSERT(isLocked()); return compressionWorklist_; } GCHelperStateVector &gcHelperWorklist() { - JS_ASSERT(isLocked()); + MOZ_ASSERT(isLocked()); return gcHelperWorklist_; } @@ -193,14 +193,14 @@ class GlobalHelperThreadState HelperThread *highestPriorityPausedIonCompile(); uint32_t harvestFailedAsmJSJobs() { - JS_ASSERT(isLocked()); + MOZ_ASSERT(isLocked()); uint32_t n = numAsmJSFailedJobs; numAsmJSFailedJobs = 0; return n; } void noteAsmJSFailure(void *func) { // Be mindful to signal the main thread after calling this function. - JS_ASSERT(isLocked()); + MOZ_ASSERT(isLocked()); if (!asmJSFailedFunction) asmJSFailedFunction = func; numAsmJSFailedJobs++; diff --git a/js/src/vm/Interpreter-inl.h b/js/src/vm/Interpreter-inl.h index a4823501aad9..7ad670a6776d 100644 --- a/js/src/vm/Interpreter-inl.h +++ b/js/src/vm/Interpreter-inl.h @@ -188,7 +188,7 @@ ValuePropertyBearer(JSContext *cx, InterpreterFrame *fp, HandleValue v, int spin if (v.isBoolean()) return GlobalObject::getOrCreateBooleanPrototype(cx, global); - JS_ASSERT(v.isNull() || v.isUndefined()); + MOZ_ASSERT(v.isNull() || v.isUndefined()); js_ReportIsNullOrUndefined(cx, spindex, v, NullPtr()); return nullptr; } @@ -212,7 +212,7 @@ GetLengthProperty(const Value &lval, MutableHandleValue vp) ArgumentsObject *argsobj = &obj->as(); if (!argsobj->hasOverriddenLength()) { uint32_t length = argsobj->initialLength(); - JS_ASSERT(length < INT32_MAX); + MOZ_ASSERT(length < INT32_MAX); vp.setInt32(int32_t(length)); return true; } @@ -248,7 +248,7 @@ FetchName(JSContext *cx, HandleObject obj, HandleObject obj2, HandlePropertyName normalized = &normalized->as().object(); if (shape->isDataDescriptor() && shape->hasDefaultGetter()) { /* Fast path for Object instance properties. */ - JS_ASSERT(shape->hasSlot()); + MOZ_ASSERT(shape->hasSlot()); vp.set(obj2->nativeGetSlot(shape->slot())); } else if (!NativeGet(cx, normalized, obj2, shape, vp)) { return false; @@ -304,7 +304,7 @@ inline bool SetNameOperation(JSContext *cx, JSScript *script, jsbytecode *pc, HandleObject scope, HandleValue val) { - JS_ASSERT(*pc == JSOP_SETNAME || *pc == JSOP_SETGNAME); + MOZ_ASSERT(*pc == JSOP_SETNAME || *pc == JSOP_SETGNAME); JS_ASSERT_IF(*pc == JSOP_SETGNAME, scope == cx->global()); bool strict = script->strict(); @@ -317,7 +317,7 @@ SetNameOperation(JSContext *cx, JSScript *script, jsbytecode *pc, HandleObject s * directly and pass Unqualified. */ if (scope->isUnqualifiedVarObj()) { - JS_ASSERT(!scope->getOps()->setProperty); + MOZ_ASSERT(!scope->getOps()->setProperty); RootedId id(cx, NameToId(name)); return baseops::SetPropertyHelper(cx, scope, scope, id, baseops::Unqualified, &valCopy, @@ -330,7 +330,7 @@ SetNameOperation(JSContext *cx, JSScript *script, jsbytecode *pc, HandleObject s inline bool DefVarOrConstOperation(JSContext *cx, HandleObject varobj, HandlePropertyName dn, unsigned attrs) { - JS_ASSERT(varobj->isQualifiedVarObj()); + MOZ_ASSERT(varobj->isQualifiedVarObj()); RootedShape prop(cx); RootedObject obj2(cx); @@ -416,7 +416,7 @@ static MOZ_ALWAYS_INLINE bool GetObjectElementOperation(JSContext *cx, JSOp op, JSObject *objArg, bool wasObject, HandleValue rref, MutableHandleValue res) { - JS_ASSERT(op == JSOP_GETELEM || op == JSOP_CALLELEM); + MOZ_ASSERT(op == JSOP_GETELEM || op == JSOP_CALLELEM); do { uint32_t index; @@ -485,7 +485,7 @@ static MOZ_ALWAYS_INLINE bool GetElemOptimizedArguments(JSContext *cx, AbstractFramePtr frame, MutableHandleValue lref, HandleValue rref, MutableHandleValue res, bool *done) { - JS_ASSERT(!*done); + MOZ_ASSERT(!*done); if (IsOptimizedArguments(frame, lref)) { if (rref.isInt32()) { @@ -511,7 +511,7 @@ static MOZ_ALWAYS_INLINE bool GetElementOperation(JSContext *cx, JSOp op, MutableHandleValue lref, HandleValue rref, MutableHandleValue res) { - JS_ASSERT(op == JSOP_GETELEM || op == JSOP_CALLELEM); + MOZ_ASSERT(op == JSOP_GETELEM || op == JSOP_CALLELEM); uint32_t index; if (lref.isString() && IsDefinitelyIndex(rref, &index)) { @@ -549,7 +549,7 @@ TypeOfObjectOperation(JSObject *obj, JSRuntime *rt) static MOZ_ALWAYS_INLINE bool InitElemOperation(JSContext *cx, HandleObject obj, HandleValue idval, HandleValue val) { - JS_ASSERT(!val.isMagic(JS_ELEMENTS_HOLE)); + MOZ_ASSERT(!val.isMagic(JS_ELEMENTS_HOLE)); RootedId id(cx); if (!ValueToId(cx, idval, &id)) @@ -562,9 +562,9 @@ static MOZ_ALWAYS_INLINE bool InitArrayElemOperation(JSContext *cx, jsbytecode *pc, HandleObject obj, uint32_t index, HandleValue val) { JSOp op = JSOp(*pc); - JS_ASSERT(op == JSOP_INITELEM_ARRAY || op == JSOP_INITELEM_INC); + MOZ_ASSERT(op == JSOP_INITELEM_ARRAY || op == JSOP_INITELEM_INC); - JS_ASSERT(obj->is()); + MOZ_ASSERT(obj->is()); /* * If val is a hole, do not call JSObject::defineElement. In this case, @@ -771,7 +771,7 @@ class FastInvokeGuard , script_(cx) , useIon_(jit::IsIonEnabled(cx)) { - JS_ASSERT(!InParallelSection()); + MOZ_ASSERT(!InParallelSection()); initFunction(fval); } @@ -794,7 +794,7 @@ class FastInvokeGuard if (!script_) return false; } - JS_ASSERT(fun_->nonLazyScript() == script_); + MOZ_ASSERT(fun_->nonLazyScript() == script_); jit::MethodStatus status = jit::CanEnterUsingFastInvoke(cx, script_, args_.length()); if (status == jit::Method_Error) @@ -804,11 +804,11 @@ class FastInvokeGuard if (IsErrorStatus(result)) return false; - JS_ASSERT(result == jit::IonExec_Ok); + MOZ_ASSERT(result == jit::IonExec_Ok); return true; } - JS_ASSERT(status == jit::Method_Skipped); + MOZ_ASSERT(status == jit::Method_Skipped); if (script_->canIonCompile()) { // This script is not yet hot. Since calling into Ion is much diff --git a/js/src/vm/Interpreter.cpp b/js/src/vm/Interpreter.cpp index 924eb390bbc9..c931dcc1e95e 100644 --- a/js/src/vm/Interpreter.cpp +++ b/js/src/vm/Interpreter.cpp @@ -82,7 +82,7 @@ js::BoxNonStrictThis(JSContext *cx, HandleValue thisv) * Check for SynthesizeFrame poisoning and fast constructors which * didn't check their callee properly. */ - JS_ASSERT(!thisv.isMagic()); + MOZ_ASSERT(!thisv.isMagic()); if (thisv.isNullOrUndefined()) { Rooted global(cx, cx->global()); @@ -117,7 +117,7 @@ js::BoxNonStrictThis(JSContext *cx, const CallReceiver &call) * Check for SynthesizeFrame poisoning and fast constructors which * didn't check their callee properly. */ - JS_ASSERT(!call.thisv().isMagic()); + MOZ_ASSERT(!call.thisv().isMagic()); #ifdef DEBUG JSFunction *fun = call.callee().is() ? &call.callee().as() : nullptr; @@ -186,10 +186,10 @@ NoSuchMethod(JSContext *cx, unsigned argc, Value *vp) if (!args.init(2)) return false; - JS_ASSERT(vp[0].isObject()); - JS_ASSERT(vp[1].isObject()); + MOZ_ASSERT(vp[0].isObject()); + MOZ_ASSERT(vp[1].isObject()); JSObject *obj = &vp[0].toObject(); - JS_ASSERT(obj->getClass() == &js_NoSuchMethodClass); + MOZ_ASSERT(obj->getClass() == &js_NoSuchMethodClass); args.setCallee(obj->getReservedSlot(JSSLOT_FOUND_FUNCTION)); args.setThis(vp[1]); @@ -307,7 +307,7 @@ static inline bool SetPropertyOperation(JSContext *cx, HandleScript script, jsbytecode *pc, HandleValue lval, HandleValue rval) { - JS_ASSERT(*pc == JSOP_SETPROP); + MOZ_ASSERT(*pc == JSOP_SETPROP); RootedObject obj(cx, ToObjectFromStack(cx, lval)); if (!obj) @@ -442,8 +442,8 @@ struct AutoGCIfNeeded bool js::Invoke(JSContext *cx, CallArgs args, MaybeConstruct construct) { - JS_ASSERT(args.length() <= ARGS_LENGTH_MAX); - JS_ASSERT(!cx->compartment()->activeAnalysis); + MOZ_ASSERT(args.length() <= ARGS_LENGTH_MAX); + MOZ_ASSERT(!cx->compartment()->activeAnalysis); /* Perform GC if necessary on exit from the function. */ AutoGCIfNeeded gcIfNeeded(cx); @@ -539,7 +539,7 @@ js::Invoke(JSContext *cx, const Value &thisv, const Value &fval, unsigned argc, bool js::InvokeConstructor(JSContext *cx, CallArgs args) { - JS_ASSERT(!JSFunction::class_.construct); + MOZ_ASSERT(!JSFunction::class_.construct); args.setThis(MagicValue(JS_IS_CONSTRUCTING)); @@ -562,7 +562,7 @@ js::InvokeConstructor(JSContext *cx, CallArgs args) if (!Invoke(cx, args, CONSTRUCT)) return false; - JS_ASSERT(args.rval().isObject()); + MOZ_ASSERT(args.rval().isObject()); return true; } @@ -615,7 +615,7 @@ js::ExecuteKernel(JSContext *cx, HandleScript script, JSObject &scopeChainArg, c if (thisv.isObject()) { RootedObject thisObj(cx, &thisv.toObject()); AutoSuppressGC nogc(cx); - JS_ASSERT(GetOuterObject(cx, thisObj) == thisObj); + MOZ_ASSERT(GetOuterObject(cx, thisObj) == thisObj); } #endif @@ -822,7 +822,7 @@ js::TypeOfValue(const Value &v) return TypeOfObject(&v.toObject()); if (v.isBoolean()) return JSTYPE_BOOLEAN; - JS_ASSERT(v.isSymbol()); + MOZ_ASSERT(v.isSymbol()); return JSTYPE_SYMBOL; } @@ -834,7 +834,7 @@ bool js::EnterWithOperation(JSContext *cx, AbstractFramePtr frame, HandleValue val, HandleObject staticWith) { - JS_ASSERT(staticWith->is()); + MOZ_ASSERT(staticWith->is()); RootedObject obj(cx); if (val.isObject()) { obj = &val.toObject(); @@ -1011,7 +1011,7 @@ enum HandleErrorContinuation static HandleErrorContinuation HandleError(JSContext *cx, InterpreterRegs ®s) { - JS_ASSERT(regs.fp()->script()->containsPC(regs.pc)); + MOZ_ASSERT(regs.fp()->script()->containsPC(regs.pc)); ScopeIter si(regs.fp(), regs.pc, cx); bool ok = false; @@ -1067,7 +1067,7 @@ HandleError(JSContext *cx, InterpreterRegs ®s) case JSTRY_ITER: { /* This is similar to JSOP_ENDITER in the interpreter loop. */ - JS_ASSERT(JSOp(*regs.pc) == JSOP_ENDITER); + MOZ_ASSERT(JSOp(*regs.pc) == JSOP_ENDITER); RootedObject obj(cx, ®s.sp[-1].toObject()); bool ok = UnwindIteratorForException(cx, obj); regs.sp -= 1; @@ -1437,7 +1437,7 @@ Interpret(JSContext *cx, RunState &state) JS_END_MACRO gc::MaybeVerifyBarriers(cx, true); - JS_ASSERT(!cx->compartment()->activeAnalysis); + MOZ_ASSERT(!cx->compartment()->activeAnalysis); InterpreterFrame *entryFrame = state.pushInterpreterFrame(cx); if (!entryFrame) @@ -1473,8 +1473,8 @@ Interpret(JSContext *cx, RunState &state) DebugOnly blockDepth; if (MOZ_UNLIKELY(REGS.fp()->isGeneratorFrame())) { - JS_ASSERT(script->containsPC(REGS.pc)); - JS_ASSERT(REGS.stackDepth() <= script->nslots()); + MOZ_ASSERT(script->containsPC(REGS.pc)); + MOZ_ASSERT(REGS.stackDepth() <= script->nslots()); /* * To support generator_throw and to catch ignored exceptions, @@ -1581,12 +1581,12 @@ CASE(EnableInterruptsPseudoOpcode) default: break; } - JS_ASSERT(status == JSTRAP_CONTINUE); - JS_ASSERT(rval.isInt32() && rval.toInt32() == op); + MOZ_ASSERT(status == JSTRAP_CONTINUE); + MOZ_ASSERT(rval.isInt32() && rval.toInt32() == op); } } - JS_ASSERT(activation.opMask() == EnableInterruptsPseudoOpcode); + MOZ_ASSERT(activation.opMask() == EnableInterruptsPseudoOpcode); if (!moreInterrupts) activation.clearInterruptsMask(); @@ -1673,7 +1673,7 @@ CASE(JSOP_UNUSED223) CASE(JSOP_CONDSWITCH) CASE(JSOP_TRY) { - JS_ASSERT(js_CodeSpec[*REGS.pc].length == 1); + MOZ_ASSERT(js_CodeSpec[*REGS.pc].length == 1); ADVANCE_AND_DISPATCH(1); } @@ -1723,13 +1723,13 @@ CASE(JSOP_POP) END_CASE(JSOP_POP) CASE(JSOP_POPN) - JS_ASSERT(GET_UINT16(REGS.pc) <= REGS.stackDepth()); + MOZ_ASSERT(GET_UINT16(REGS.pc) <= REGS.stackDepth()); REGS.sp -= GET_UINT16(REGS.pc); END_CASE(JSOP_POPN) CASE(JSOP_DUPAT) { - JS_ASSERT(GET_UINT24(REGS.pc) < REGS.stackDepth()); + MOZ_ASSERT(GET_UINT24(REGS.pc) < REGS.stackDepth()); unsigned i = GET_UINT24(REGS.pc); const Value &rref = REGS.sp[-int(i + 1)]; PUSH_COPY(rref); @@ -1797,7 +1797,7 @@ CASE(JSOP_RETRVAL) jit_return: - JS_ASSERT(js_CodeSpec[*REGS.pc].format & JOF_INVOKE); + MOZ_ASSERT(js_CodeSpec[*REGS.pc].format & JOF_INVOKE); /* Resume execution in the calling frame. */ if (MOZ_LIKELY(interpReturnOK)) { @@ -1810,7 +1810,7 @@ CASE(JSOP_RETRVAL) REGS.pc += JSOP_CALL_LENGTH; goto error; } else { - JS_ASSERT(REGS.stackDepth() == 0); + MOZ_ASSERT(REGS.stackDepth() == 0); } goto exit; } @@ -1865,7 +1865,7 @@ END_CASE(JSOP_AND) #define TRY_BRANCH_AFTER_COND(cond,spdec) \ JS_BEGIN_MACRO \ - JS_ASSERT(js_CodeSpec[*REGS.pc].length == 1); \ + MOZ_ASSERT(js_CodeSpec[*REGS.pc].length == 1); \ unsigned diff_ = (unsigned) GET_UINT8(REGS.pc) - (unsigned) JSOP_IFEQ; \ if (diff_ <= 1) { \ REGS.sp -= (spdec); \ @@ -1902,19 +1902,19 @@ END_CASE(JSOP_IN) CASE(JSOP_ITER) { - JS_ASSERT(REGS.stackDepth() >= 1); + MOZ_ASSERT(REGS.stackDepth() >= 1); uint8_t flags = GET_UINT8(REGS.pc); MutableHandleValue res = REGS.stackHandleAt(-1); if (!ValueToIterator(cx, flags, res)) goto error; - JS_ASSERT(res.isObject()); + MOZ_ASSERT(res.isObject()); } END_CASE(JSOP_ITER) CASE(JSOP_MOREITER) { - JS_ASSERT(REGS.stackDepth() >= 1); - JS_ASSERT(REGS.sp[-1].isObject()); + MOZ_ASSERT(REGS.stackDepth() >= 1); + MOZ_ASSERT(REGS.sp[-1].isObject()); PUSH_NULL(); RootedObject &obj = rootObject0; obj = ®S.sp[-2].toObject(); @@ -1932,7 +1932,7 @@ END_CASE(JSOP_ISNOITER) CASE(JSOP_ENDITER) { - JS_ASSERT(REGS.stackDepth() >= 1); + MOZ_ASSERT(REGS.stackDepth() >= 1); RootedObject &obj = rootObject0; obj = ®S.sp[-1].toObject(); bool ok = CloseIterator(cx, obj); @@ -1944,7 +1944,7 @@ END_CASE(JSOP_ENDITER) CASE(JSOP_DUP) { - JS_ASSERT(REGS.stackDepth() >= 1); + MOZ_ASSERT(REGS.stackDepth() >= 1); const Value &rref = REGS.sp[-1]; PUSH_COPY(rref); } @@ -1952,7 +1952,7 @@ END_CASE(JSOP_DUP) CASE(JSOP_DUP2) { - JS_ASSERT(REGS.stackDepth() >= 2); + MOZ_ASSERT(REGS.stackDepth() >= 2); const Value &lref = REGS.sp[-2]; const Value &rref = REGS.sp[-1]; PUSH_COPY(lref); @@ -1962,7 +1962,7 @@ END_CASE(JSOP_DUP2) CASE(JSOP_SWAP) { - JS_ASSERT(REGS.stackDepth() >= 2); + MOZ_ASSERT(REGS.stackDepth() >= 2); Value &lref = REGS.sp[-2]; Value &rref = REGS.sp[-1]; lref.swap(rref); @@ -1972,7 +1972,7 @@ END_CASE(JSOP_SWAP) CASE(JSOP_PICK) { unsigned i = GET_UINT8(REGS.pc); - JS_ASSERT(REGS.stackDepth() >= i + 1); + MOZ_ASSERT(REGS.stackDepth() >= i + 1); Value lval = REGS.sp[-int(i + 1)]; memmove(REGS.sp - (i + 1), REGS.sp - i, sizeof(Value) * i); REGS.sp[-1] = lval; @@ -2276,7 +2276,7 @@ END_CASE(JSOP_POS) CASE(JSOP_DELNAME) { /* Strict mode code should never contain JSOP_DELNAME opcodes. */ - JS_ASSERT(!script->strict()); + MOZ_ASSERT(!script->strict()); RootedPropertyName &name = rootName0; name = script->getName(REGS.pc); @@ -2484,7 +2484,7 @@ CASE(JSOP_SPREADCALL) CASE(JSOP_SPREADEVAL) { - JS_ASSERT(REGS.stackDepth() >= 3); + MOZ_ASSERT(REGS.stackDepth() >= 3); HandleValue callee = REGS.stackHandleAt(-3); HandleValue thisv = REGS.stackHandleAt(-2); @@ -2511,7 +2511,7 @@ CASE(JSOP_FUNCALL) { if (REGS.fp()->hasPushedSPSFrame()) cx->runtime()->spsProfiler.updatePC(script, REGS.pc); - JS_ASSERT(REGS.stackDepth() >= 2 + GET_ARGC(REGS.pc)); + MOZ_ASSERT(REGS.stackDepth() >= 2 + GET_ARGC(REGS.pc)); CallArgs args = CallArgsFromSp(GET_ARGC(REGS.pc), REGS.sp); bool construct = (*REGS.pc == JSOP_NEW); @@ -2816,7 +2816,7 @@ CASE(JSOP_TABLESWITCH) } CASE(JSOP_ARGUMENTS) - JS_ASSERT(!REGS.fp()->fun()->hasRest()); + MOZ_ASSERT(!REGS.fp()->fun()->hasRest()); if (!script->ensureHasAnalyzedArgsUsage(cx)) goto error; if (script->needsArgsObj()) { @@ -2996,7 +2996,7 @@ CASE(JSOP_LAMBDA) JSObject *obj = Lambda(cx, fun, REGS.fp()->scopeChain()); if (!obj) goto error; - JS_ASSERT(obj->getProto()); + MOZ_ASSERT(obj->getProto()); PUSH_OBJECT(*obj); } END_CASE(JSOP_LAMBDA) @@ -3011,13 +3011,13 @@ CASE(JSOP_LAMBDA_ARROW) JSObject *obj = LambdaArrow(cx, fun, REGS.fp()->scopeChain(), thisv); if (!obj) goto error; - JS_ASSERT(obj->getProto()); + MOZ_ASSERT(obj->getProto()); REGS.sp[-1].setObject(*obj); } END_CASE(JSOP_LAMBDA_ARROW) CASE(JSOP_CALLEE) - JS_ASSERT(REGS.fp()->isNonEvalFunctionFrame()); + MOZ_ASSERT(REGS.fp()->isNonEvalFunctionFrame()); PUSH_COPY(REGS.fp()->calleev()); END_CASE(JSOP_CALLEE) @@ -3028,7 +3028,7 @@ CASE(JSOP_INITPROP_SETTER) RootedPropertyName &name = rootName0; RootedObject &val = rootObject1; - JS_ASSERT(REGS.stackDepth() >= 2); + MOZ_ASSERT(REGS.stackDepth() >= 2); obj = ®S.sp[-2].toObject(); name = script->getName(REGS.pc); val = ®S.sp[-1].toObject(); @@ -3047,7 +3047,7 @@ CASE(JSOP_INITELEM_SETTER) RootedValue &idval = rootValue0; RootedObject &val = rootObject1; - JS_ASSERT(REGS.stackDepth() >= 3); + MOZ_ASSERT(REGS.stackDepth() >= 3); obj = ®S.sp[-3].toObject(); idval = REGS.sp[-2]; val = ®S.sp[-1].toObject(); @@ -3066,7 +3066,7 @@ END_CASE(JSOP_HOLE) CASE(JSOP_NEWINIT) { uint8_t i = GET_UINT8(REGS.pc); - JS_ASSERT(i == JSProto_Array || i == JSProto_Object); + MOZ_ASSERT(i == JSProto_Array || i == JSProto_Object); RootedObject &obj = rootObject0; NewObjectKind newKind; @@ -3132,8 +3132,8 @@ END_CASE(JSOP_NEWOBJECT) CASE(JSOP_ENDINIT) { /* FIXME remove JSOP_ENDINIT bug 588522 */ - JS_ASSERT(REGS.stackDepth() >= 1); - JS_ASSERT(REGS.sp[-1].isObject() || REGS.sp[-1].isUndefined()); + MOZ_ASSERT(REGS.stackDepth() >= 1); + MOZ_ASSERT(REGS.sp[-1].isObject() || REGS.sp[-1].isUndefined()); } END_CASE(JSOP_ENDINIT) @@ -3162,14 +3162,14 @@ END_CASE(JSOP_MUTATEPROTO) CASE(JSOP_INITPROP) { /* Load the property's initial value into rval. */ - JS_ASSERT(REGS.stackDepth() >= 2); + MOZ_ASSERT(REGS.stackDepth() >= 2); RootedValue &rval = rootValue0; rval = REGS.sp[-1]; /* Load the object being initialized into lval/obj. */ RootedObject &obj = rootObject0; obj = ®S.sp[-2].toObject(); - JS_ASSERT(obj->is()); + MOZ_ASSERT(obj->is()); PropertyName *name = script->getName(REGS.pc); @@ -3185,7 +3185,7 @@ END_CASE(JSOP_INITPROP) CASE(JSOP_INITELEM) { - JS_ASSERT(REGS.stackDepth() >= 3); + MOZ_ASSERT(REGS.stackDepth() >= 3); HandleValue val = REGS.stackHandleAt(-1); HandleValue id = REGS.stackHandleAt(-2); @@ -3201,13 +3201,13 @@ END_CASE(JSOP_INITELEM) CASE(JSOP_INITELEM_ARRAY) { - JS_ASSERT(REGS.stackDepth() >= 2); + MOZ_ASSERT(REGS.stackDepth() >= 2); HandleValue val = REGS.stackHandleAt(-1); RootedObject &obj = rootObject0; obj = ®S.sp[-2].toObject(); - JS_ASSERT(obj->is()); + MOZ_ASSERT(obj->is()); uint32_t index = GET_UINT24(REGS.pc); if (!InitArrayElemOperation(cx, REGS.pc, obj, index, val)) @@ -3219,7 +3219,7 @@ END_CASE(JSOP_INITELEM_ARRAY) CASE(JSOP_INITELEM_INC) { - JS_ASSERT(REGS.stackDepth() >= 3); + MOZ_ASSERT(REGS.stackDepth() >= 3); HandleValue val = REGS.stackHandleAt(-1); RootedObject &obj = rootObject0; @@ -3249,7 +3249,7 @@ CASE(JSOP_RETSUB) Value rval, lval; POP_COPY_TO(rval); POP_COPY_TO(lval); - JS_ASSERT(lval.isBoolean()); + MOZ_ASSERT(lval.isBoolean()); if (lval.toBoolean()) { /* * Exception was pending during finally, throw it *before* we adjust @@ -3260,7 +3260,7 @@ CASE(JSOP_RETSUB) cx->setPendingException(rval); goto error; } - JS_ASSERT(rval.isInt32()); + MOZ_ASSERT(rval.isInt32()); /* Increment the PC by this much. */ int32_t len = rval.toInt32() - int32_t(script->pcToOffset(REGS.pc)); @@ -3340,7 +3340,7 @@ CASE(JSOP_PUSHBLOCKSCOPE) { StaticBlockObject &blockObj = script->getObject(REGS.pc)->as(); - JS_ASSERT(blockObj.needsClone()); + MOZ_ASSERT(blockObj.needsClone()); // Clone block and push on scope chain. if (!REGS.fp()->pushBlock(cx, blockObj)) goto error; @@ -3351,11 +3351,11 @@ CASE(JSOP_POPBLOCKSCOPE) { #ifdef DEBUG // Pop block from scope chain. - JS_ASSERT(*(REGS.pc - JSOP_DEBUGLEAVEBLOCK_LENGTH) == JSOP_DEBUGLEAVEBLOCK); + MOZ_ASSERT(*(REGS.pc - JSOP_DEBUGLEAVEBLOCK_LENGTH) == JSOP_DEBUGLEAVEBLOCK); NestedScopeObject *scope = script->getStaticScope(REGS.pc - JSOP_DEBUGLEAVEBLOCK_LENGTH); - JS_ASSERT(scope && scope->is()); + MOZ_ASSERT(scope && scope->is()); StaticBlockObject &blockObj = scope->as(); - JS_ASSERT(blockObj.needsClone()); + MOZ_ASSERT(blockObj.needsClone()); #endif // Pop block from scope chain. @@ -3365,8 +3365,8 @@ END_CASE(JSOP_POPBLOCKSCOPE) CASE(JSOP_DEBUGLEAVEBLOCK) { - JS_ASSERT(script->getStaticScope(REGS.pc)); - JS_ASSERT(script->getStaticScope(REGS.pc)->is()); + MOZ_ASSERT(script->getStaticScope(REGS.pc)); + MOZ_ASSERT(script->getStaticScope(REGS.pc)->is()); // FIXME: This opcode should not be necessary. The debugger shouldn't need // help from bytecode to do its job. See bug 927782. @@ -3378,7 +3378,7 @@ END_CASE(JSOP_DEBUGLEAVEBLOCK) CASE(JSOP_GENERATOR) { - JS_ASSERT(!cx->isExceptionPending()); + MOZ_ASSERT(!cx->isExceptionPending()); REGS.fp()->initGeneratorFrame(); REGS.pc += JSOP_GENERATOR_LENGTH; JSObject *obj = js_NewGenerator(cx, REGS); @@ -3393,8 +3393,8 @@ CASE(JSOP_GENERATOR) } CASE(JSOP_YIELD) - JS_ASSERT(!cx->isExceptionPending()); - JS_ASSERT(REGS.fp()->isNonEvalFunctionFrame()); + MOZ_ASSERT(!cx->isExceptionPending()); + MOZ_ASSERT(REGS.fp()->isNonEvalFunctionFrame()); if (cx->innermostGenerator()->state == JSGEN_CLOSING) { RootedValue &val = rootValue0; val.setObject(REGS.fp()->callee()); @@ -3489,7 +3489,7 @@ DEFAULT() bool js::Throw(JSContext *cx, HandleValue v) { - JS_ASSERT(!cx->isExceptionPending()); + MOZ_ASSERT(!cx->isExceptionPending()); cx->setPendingException(v); return false; } @@ -3633,8 +3633,8 @@ js::DefFunOperation(JSContext *cx, HandleScript script, HandleObject scopeChain, if (!fun) return false; } else { - JS_ASSERT(script->compileAndGo()); - JS_ASSERT(!script->functionNonDelazifying()); + MOZ_ASSERT(script->compileAndGo()); + MOZ_ASSERT(!script->functionNonDelazifying()); } /* @@ -3671,7 +3671,7 @@ js::DefFunOperation(JSContext *cx, HandleScript script, HandleObject scopeChain, } /* Step 5e. */ - JS_ASSERT(parent->isNative()); + MOZ_ASSERT(parent->isNative()); if (parent->is()) { if (shape->configurable()) { return JSObject::defineProperty(cx, parent, name, rval, JS_PropertyStub, @@ -3802,7 +3802,7 @@ bool js::SetObjectElement(JSContext *cx, HandleObject obj, HandleValue index, HandleValue value, bool strict, HandleScript script, jsbytecode *pc) { - JS_ASSERT(pc); + MOZ_ASSERT(pc); RootedId id(cx); if (!ValueToId(cx, index, &id)) return false; @@ -3895,7 +3895,7 @@ js::ImplicitThisOperation(JSContext *cx, HandleObject scopeObj, HandlePropertyNa bool js::RunOnceScriptPrologue(JSContext *cx, HandleScript script) { - JS_ASSERT(script->treatAsRunOnce()); + MOZ_ASSERT(script->treatAsRunOnce()); if (!script->hasRunOnce()) { script->setHasRunOnce(); @@ -3916,7 +3916,7 @@ bool js::InitGetterSetterOperation(JSContext *cx, jsbytecode *pc, HandleObject obj, HandleId id, HandleObject val) { - JS_ASSERT(val->isCallable()); + MOZ_ASSERT(val->isCallable()); PropertyOp getter; StrictPropertyOp setter; unsigned attrs = JSPROP_ENUMERATE | JSPROP_SHARED; @@ -3928,7 +3928,7 @@ js::InitGetterSetterOperation(JSContext *cx, jsbytecode *pc, HandleObject obj, H setter = JS_StrictPropertyStub; attrs |= JSPROP_GETTER; } else { - JS_ASSERT(op == JSOP_INITPROP_SETTER || op == JSOP_INITELEM_SETTER); + MOZ_ASSERT(op == JSOP_INITPROP_SETTER || op == JSOP_INITELEM_SETTER); getter = JS_PropertyStub; setter = CastAsStrictPropertyOp(val); attrs |= JSPROP_SETTER; @@ -3975,10 +3975,10 @@ js::SpreadCallOperation(JSContext *cx, HandleScript script, jsbytecode *pc, Hand #ifdef DEBUG // The object must be an array with dense elements and no holes. Baseline's // optimized spread call stubs rely on this. - JS_ASSERT(aobj->getDenseInitializedLength() == length); - JS_ASSERT(!aobj->isIndexed()); + MOZ_ASSERT(aobj->getDenseInitializedLength() == length); + MOZ_ASSERT(!aobj->isIndexed()); for (uint32_t i = 0; i < length; i++) - JS_ASSERT(!aobj->getDenseElement(i).isMagic()); + MOZ_ASSERT(!aobj->getDenseElement(i).isMagic()); #endif InvokeArgs args(cx); diff --git a/js/src/vm/Interpreter.h b/js/src/vm/Interpreter.h index 6f80c53ea620..62b85f11c075 100644 --- a/js/src/vm/Interpreter.h +++ b/js/src/vm/Interpreter.h @@ -192,15 +192,15 @@ class RunState bool isGenerator() const { return kind_ == Generator; } ExecuteState *asExecute() const { - JS_ASSERT(isExecute()); + MOZ_ASSERT(isExecute()); return (ExecuteState *)this; } InvokeState *asInvoke() const { - JS_ASSERT(isInvoke()); + MOZ_ASSERT(isInvoke()); return (InvokeState *)this; } GeneratorState *asGenerator() const { - JS_ASSERT(isGenerator()); + MOZ_ASSERT(isGenerator()); return (GeneratorState *)this; } diff --git a/js/src/vm/MatchPairs.h b/js/src/vm/MatchPairs.h index 47eb03bdd52a..09005c4e8c63 100644 --- a/js/src/vm/MatchPairs.h +++ b/js/src/vm/MatchPairs.h @@ -35,7 +35,7 @@ struct MatchPair : start(start), limit(limit) { } - size_t length() const { JS_ASSERT(!isUndefined()); return limit - start; } + size_t length() const { MOZ_ASSERT(!isUndefined()); return limit - start; } bool isEmpty() const { return length() == 0; } bool isUndefined() const { return start < 0; } @@ -45,7 +45,7 @@ struct MatchPair } inline bool check() const { - JS_ASSERT(limit >= start); + MOZ_ASSERT(limit >= start); JS_ASSERT_IF(start < 0, start == -1); JS_ASSERT_IF(limit < 0, limit == -1); return true; @@ -85,10 +85,10 @@ class MatchPairs #ifdef DEBUG for (size_t i = 0; i < pairCount_; i++) { const MatchPair &p = (*this)[i]; - JS_ASSERT(p.check()); + MOZ_ASSERT(p.check()); if (p.isUndefined()) continue; - JS_ASSERT(size_t(p.limit) <= inputLength); + MOZ_ASSERT(size_t(p.limit) <= inputLength); } #endif } @@ -96,7 +96,7 @@ class MatchPairs public: /* Querying functions in the style of RegExpStatics. */ bool empty() const { return pairCount_ == 0; } - size_t pairCount() const { JS_ASSERT(pairCount_ > 0); return pairCount_; } + size_t pairCount() const { MOZ_ASSERT(pairCount_ > 0); return pairCount_; } size_t parenCount() const { return pairCount_ - 1; } static size_t offsetOfPairs() { return offsetof(MatchPairs, pairs_); } @@ -108,11 +108,11 @@ class MatchPairs size_t length() const { return pairCount_; } const MatchPair &operator[](size_t i) const { - JS_ASSERT(i < pairCount_); + MOZ_ASSERT(i < pairCount_); return pairs_[i]; } MatchPair &operator[](size_t i) { - JS_ASSERT(i < pairCount_); + MOZ_ASSERT(i < pairCount_); return pairs_[i]; } }; diff --git a/js/src/vm/MemoryMetrics.cpp b/js/src/vm/MemoryMetrics.cpp index 2cf86fbe56d5..f85253fd01f3 100644 --- a/js/src/vm/MemoryMetrics.cpp +++ b/js/src/vm/MemoryMetrics.cpp @@ -291,7 +291,7 @@ DecommittedArenasChunkCallback(JSRuntime *rt, void *data, gc::Chunk *chunk) if (chunk->decommittedArenas.get(i)) n += gc::ArenaSize; } - JS_ASSERT(n > 0); + MOZ_ASSERT(n > 0); *static_cast(data) += n; } @@ -764,7 +764,7 @@ JS::CollectRuntimeStats(JSRuntime *rt, RuntimeStats *rtStats, ObjectPrivateVisit size_t totalArenaSize = rtStats->zTotals.gcHeapArenaAdmin + rtStats->zTotals.unusedGCThings + rtStats->gcHeapGCThings; - JS_ASSERT(totalArenaSize % gc::ArenaSize == 0); + MOZ_ASSERT(totalArenaSize % gc::ArenaSize == 0); #endif for (CompartmentsIter comp(rt, WithAtoms); !comp.done(); comp.next()) @@ -857,7 +857,7 @@ AddSizeOfTab(JSRuntime *rt, HandleObject obj, MallocSizeOf mallocSizeOf, ObjectP StatsCompartmentCallback, StatsArenaCallback, StatsCellCallback); - JS_ASSERT(rtStats.zoneStatsVector.length() == 1); + MOZ_ASSERT(rtStats.zoneStatsVector.length() == 1); rtStats.zTotals.addSizes(rtStats.zoneStatsVector[0]); for (size_t i = 0; i < rtStats.compartmentStatsVector.length(); i++) diff --git a/js/src/vm/ObjectImpl-inl.h b/js/src/vm/ObjectImpl-inl.h index 775e03eb8e52..03ccaf41d65f 100644 --- a/js/src/vm/ObjectImpl-inl.h +++ b/js/src/vm/ObjectImpl-inl.h @@ -49,8 +49,8 @@ ClassCanHaveFixedData(const Class *clasp) inline uint8_t * ObjectImpl::fixedData(size_t nslots) const { - JS_ASSERT(ClassCanHaveFixedData(getClass())); - JS_ASSERT(nslots == numFixedSlots() + (hasPrivate() ? 1 : 0)); + MOZ_ASSERT(ClassCanHaveFixedData(getClass())); + MOZ_ASSERT(nslots == numFixedSlots() + (hasPrivate() ? 1 : 0)); return reinterpret_cast(&fixedSlots()[nslots]); } diff --git a/js/src/vm/ObjectImpl.cpp b/js/src/vm/ObjectImpl.cpp index 72f486b14a3b..296df68e30ca 100644 --- a/js/src/vm/ObjectImpl.cpp +++ b/js/src/vm/ObjectImpl.cpp @@ -93,10 +93,10 @@ ObjectElements::ConvertElementsToDoubles(JSContext *cx, uintptr_t elementsPtr) * elements converted to doubles, and arrays never have empty elements. */ HeapSlot *elementsHeapPtr = (HeapSlot *) elementsPtr; - JS_ASSERT(elementsHeapPtr != emptyObjectElements); + MOZ_ASSERT(elementsHeapPtr != emptyObjectElements); ObjectElements *header = ObjectElements::fromElements(elementsHeapPtr); - JS_ASSERT(!header->shouldConvertDoubleElements()); + MOZ_ASSERT(!header->shouldConvertDoubleElements()); // Note: the elements can be mutated in place even for copy on write // arrays. See comment on ObjectElements. @@ -123,7 +123,7 @@ ObjectElements::MakeElementsCopyOnWrite(ExclusiveContext *cx, JSObject *obj) // Note: this method doesn't update type information to indicate that the // elements might be copy on write. Handling this is left to the caller. - JS_ASSERT(!header->isCopyOnWrite()); + MOZ_ASSERT(!header->isCopyOnWrite()); header->flags |= COPY_ON_WRITE; header->ownerObject().init(obj); diff --git a/js/src/vm/ObjectImpl.h b/js/src/vm/ObjectImpl.h index 78675d24c8c8..9d534ed96c75 100644 --- a/js/src/vm/ObjectImpl.h +++ b/js/src/vm/ObjectImpl.h @@ -224,21 +224,21 @@ class ObjectElements flags |= CONVERT_DOUBLE_ELEMENTS; } void clearShouldConvertDoubleElements() { - JS_ASSERT(!isCopyOnWrite()); + MOZ_ASSERT(!isCopyOnWrite()); flags &= ~CONVERT_DOUBLE_ELEMENTS; } bool hasNonwritableArrayLength() const { return flags & NONWRITABLE_ARRAY_LENGTH; } void setNonwritableArrayLength() { - JS_ASSERT(!isCopyOnWrite()); + MOZ_ASSERT(!isCopyOnWrite()); flags |= NONWRITABLE_ARRAY_LENGTH; } bool isCopyOnWrite() const { return flags & COPY_ON_WRITE; } void clearCopyOnWrite() { - JS_ASSERT(isCopyOnWrite()); + MOZ_ASSERT(isCopyOnWrite()); flags &= ~COPY_ON_WRITE; } @@ -258,7 +258,7 @@ class ObjectElements } HeapPtrObject &ownerObject() const { - JS_ASSERT(isCopyOnWrite()); + MOZ_ASSERT(isCopyOnWrite()); return *(HeapPtrObject *)(&elements()[initializedLength]); } @@ -431,29 +431,29 @@ class ObjectImpl : public gc::Cell preventExtensions(JSContext *cx, Handle obj); HeapSlotArray getDenseElements() { - JS_ASSERT(isNative()); + MOZ_ASSERT(isNative()); return HeapSlotArray(elements, !getElementsHeader()->isCopyOnWrite()); } HeapSlotArray getDenseElementsAllowCopyOnWrite() { // Backdoor allowing direct access to copy on write elements. - JS_ASSERT(isNative()); + MOZ_ASSERT(isNative()); return HeapSlotArray(elements, true); } const Value &getDenseElement(uint32_t idx) { - JS_ASSERT(isNative()); + MOZ_ASSERT(isNative()); MOZ_ASSERT(idx < getDenseInitializedLength()); return elements[idx]; } bool containsDenseElement(uint32_t idx) { - JS_ASSERT(isNative()); + MOZ_ASSERT(isNative()); return idx < getDenseInitializedLength() && !elements[idx].isMagic(JS_ELEMENTS_HOLE); } uint32_t getDenseInitializedLength() { - JS_ASSERT(getClass()->isNative()); + MOZ_ASSERT(getClass()->isNative()); return getElementsHeader()->initializedLength; } uint32_t getDenseCapacity() { - JS_ASSERT(getClass()->isNative()); + MOZ_ASSERT(getClass()->isNative()); return getElementsHeader()->capacity; } @@ -755,11 +755,11 @@ class ObjectImpl : public gc::Cell } HeapSlot &nativeGetSlotRef(uint32_t slot) { - JS_ASSERT(isNative() && slot < slotSpan()); + MOZ_ASSERT(isNative() && slot < slotSpan()); return getSlotRef(slot); } const Value &nativeGetSlot(uint32_t slot) const { - JS_ASSERT(isNative() && slot < slotSpan()); + MOZ_ASSERT(isNative() && slot < slotSpan()); return getSlot(slot); } @@ -845,7 +845,7 @@ class ObjectImpl : public gc::Cell #endif void setFixedElements() { - JS_ASSERT(canHaveNonEmptyElements()); + MOZ_ASSERT(canHaveNonEmptyElements()); this->elements = fixedElements(); } @@ -883,8 +883,8 @@ class ObjectImpl : public gc::Cell void privateWriteBarrierPost(void **pprivate) { #ifdef JSGC_GENERATIONAL js::gc::Cell **cellp = reinterpret_cast(pprivate); - JS_ASSERT(cellp); - JS_ASSERT(*cellp); + MOZ_ASSERT(cellp); + MOZ_ASSERT(*cellp); js::gc::StoreBuffer *storeBuffer = (*cellp)->storeBuffer(); if (storeBuffer) storeBuffer->putCellFromAnyThread(cellp); @@ -997,11 +997,11 @@ ObjectImpl::writeBarrierPre(ObjectImpl *obj) /* static */ MOZ_ALWAYS_INLINE void ObjectImpl::writeBarrierPost(ObjectImpl *obj, void *cellp) { - JS_ASSERT(cellp); + MOZ_ASSERT(cellp); #ifdef JSGC_GENERATIONAL if (IsNullTaggedPointer(obj)) return; - JS_ASSERT(obj == *static_cast(cellp)); + MOZ_ASSERT(obj == *static_cast(cellp)); gc::StoreBuffer *storeBuffer = obj->storeBuffer(); if (storeBuffer) storeBuffer->putCellFromAnyThread(static_cast(cellp)); @@ -1011,9 +1011,9 @@ ObjectImpl::writeBarrierPost(ObjectImpl *obj, void *cellp) /* static */ MOZ_ALWAYS_INLINE void ObjectImpl::writeBarrierPostRelocate(ObjectImpl *obj, void *cellp) { - JS_ASSERT(cellp); - JS_ASSERT(obj); - JS_ASSERT(obj == *static_cast(cellp)); + MOZ_ASSERT(cellp); + MOZ_ASSERT(obj); + MOZ_ASSERT(obj == *static_cast(cellp)); #ifdef JSGC_GENERATIONAL gc::StoreBuffer *storeBuffer = obj->storeBuffer(); if (storeBuffer) @@ -1024,9 +1024,9 @@ ObjectImpl::writeBarrierPostRelocate(ObjectImpl *obj, void *cellp) /* static */ MOZ_ALWAYS_INLINE void ObjectImpl::writeBarrierPostRemove(ObjectImpl *obj, void *cellp) { - JS_ASSERT(cellp); - JS_ASSERT(obj); - JS_ASSERT(obj == *static_cast(cellp)); + MOZ_ASSERT(cellp); + MOZ_ASSERT(obj); + MOZ_ASSERT(obj == *static_cast(cellp)); #ifdef JSGC_GENERATIONAL obj->shadowRuntimeFromAnyThread()->gcStoreBufferPtr()->removeRelocatableCellFromAnyThread( static_cast(cellp)); diff --git a/js/src/vm/OldDebugAPI.cpp b/js/src/vm/OldDebugAPI.cpp index ed9741d3f206..6cd295098362 100644 --- a/js/src/vm/OldDebugAPI.cpp +++ b/js/src/vm/OldDebugAPI.cpp @@ -77,7 +77,7 @@ js::ScriptDebugEpilogue(JSContext *cx, AbstractFramePtr frame, jsbytecode *pc, b JSTrapStatus js::DebugExceptionUnwind(JSContext *cx, AbstractFramePtr frame, jsbytecode *pc) { - JS_ASSERT(cx->compartment()->debugMode()); + MOZ_ASSERT(cx->compartment()->debugMode()); /* Call debugger throw hook if set. */ RootedValue rval(cx); @@ -136,7 +136,7 @@ JS_PUBLIC_API(const char16_t *) JS_GetScriptSourceMap(JSContext *cx, JSScript *script) { ScriptSource *source = script->scriptSource(); - JS_ASSERT(source); + MOZ_ASSERT(source); return source->hasSourceMapURL() ? source->sourceMapURL() : nullptr; } diff --git a/js/src/vm/PIC.cpp b/js/src/vm/PIC.cpp index 455b7c40311e..18b2057ceb43 100644 --- a/js/src/vm/PIC.cpp +++ b/js/src/vm/PIC.cpp @@ -21,7 +21,7 @@ using namespace js::gc; bool js::ForOfPIC::Chain::initialize(JSContext *cx) { - JS_ASSERT(!initialized_); + MOZ_ASSERT(!initialized_); // Get the canonical Array.prototype RootedObject arrayProto(cx, GlobalObject::getOrCreateArrayPrototype(cx, cx->global())); @@ -101,8 +101,8 @@ js::ForOfPIC::Chain::isArrayOptimized(ArrayObject *obj) bool js::ForOfPIC::Chain::tryOptimizeArray(JSContext *cx, HandleObject array, bool *optimized) { - JS_ASSERT(array->is()); - JS_ASSERT(optimized); + MOZ_ASSERT(array->is()); + MOZ_ASSERT(optimized); *optimized = false; @@ -118,14 +118,14 @@ js::ForOfPIC::Chain::tryOptimizeArray(JSContext *cx, HandleObject array, bool *o if (!initialize(cx)) return false; } - JS_ASSERT(initialized_); + MOZ_ASSERT(initialized_); // If PIC is disabled, don't bother trying to optimize. if (disabled_) return true; // By the time we get here, we should have a sane array state to work with. - JS_ASSERT(isArrayStateStillSane()); + MOZ_ASSERT(isArrayStateStillSane()); // Check if stub already exists. ForOfPIC::Stub *stub = isArrayOptimized(&array->as()); @@ -180,7 +180,7 @@ js::ForOfPIC::Chain::getMatchingStub(JSObject *obj) bool js::ForOfPIC::Chain::isOptimizableArray(JSObject *obj) { - JS_ASSERT(obj->is()); + MOZ_ASSERT(obj->is()); // Ensure object's prototype is the actual Array.prototype if (!obj->getTaggedProto().isObject()) @@ -211,7 +211,7 @@ void js::ForOfPIC::Chain::reset(JSContext *cx) { // Should never reset a disabled_ stub. - JS_ASSERT(!disabled_); + MOZ_ASSERT(!disabled_); // Erase the chain. eraseChain(); @@ -234,7 +234,7 @@ void js::ForOfPIC::Chain::eraseChain() { // Should never need to clear the chain of a disabled stub. - JS_ASSERT(!disabled_); + MOZ_ASSERT(!disabled_); // Free all stubs. Stub *stub = stubs_; @@ -321,7 +321,7 @@ js::ForOfPIC::createForOfPICObject(JSContext *cx, Handle global) /* static */ js::ForOfPIC::Chain * js::ForOfPIC::create(JSContext *cx) { - JS_ASSERT(!cx->global()->getForOfPICObject()); + MOZ_ASSERT(!cx->global()->getForOfPICObject()); Rooted global(cx, cx->global()); JSObject *obj = GlobalObject::getOrCreateForOfPICObject(cx, global); if (!obj) diff --git a/js/src/vm/PIC.h b/js/src/vm/PIC.h index 8aa04f7706b2..63d8e466d747 100644 --- a/js/src/vm/PIC.h +++ b/js/src/vm/PIC.h @@ -41,7 +41,7 @@ class PICStub PICStub() : next_(nullptr) {} explicit PICStub(const CatStub *next) : next_(next) { - JS_ASSERT(next_); + MOZ_ASSERT(next_); } explicit PICStub(const CatStub &other) : next_(other.next_) {} @@ -52,8 +52,8 @@ class PICStub protected: void append(CatStub *stub) { - JS_ASSERT(!next_); - JS_ASSERT(!stub->next_); + MOZ_ASSERT(!next_); + MOZ_ASSERT(!stub->next_); next_ = stub; } }; @@ -81,8 +81,8 @@ class PICChain } void addStub(CatStub *stub) { - JS_ASSERT(stub); - JS_ASSERT(!stub->next()); + MOZ_ASSERT(stub); + MOZ_ASSERT(!stub->next()); if (!stubs_) { stubs_ = stub; return; @@ -103,10 +103,10 @@ class PICChain void removeStub(CatStub *stub, CatStub *previous) { if (previous) { - JS_ASSERT(previous->next() == stub); + MOZ_ASSERT(previous->next() == stub); previous->next_ = stub->next(); } else { - JS_ASSERT(stub == stubs_); + MOZ_ASSERT(stub == stubs_); stubs_ = stub->next(); } js_delete(stub); @@ -143,7 +143,7 @@ struct ForOfPIC : BaseStub(), shape_(shape) { - JS_ASSERT(shape_); + MOZ_ASSERT(shape_); } Shape *shape() { @@ -258,7 +258,7 @@ struct ForOfPIC static JSObject *createForOfPICObject(JSContext *cx, Handle global); static inline Chain *fromJSObject(JSObject *obj) { - JS_ASSERT(js::GetObjectClass(obj) == &ForOfPIC::jsclass); + MOZ_ASSERT(js::GetObjectClass(obj) == &ForOfPIC::jsclass); return (ForOfPIC::Chain *) obj->getPrivate(); } static inline Chain *getOrCreate(JSContext *cx) { diff --git a/js/src/vm/PosixNSPR.cpp b/js/src/vm/PosixNSPR.cpp index 8d7582b50136..695acae41a8d 100644 --- a/js/src/vm/PosixNSPR.cpp +++ b/js/src/vm/PosixNSPR.cpp @@ -78,8 +78,8 @@ PR_CreateThread(PRThreadType type, PRThreadState state, uint32_t stackSize) { - JS_ASSERT(type == PR_USER_THREAD); - JS_ASSERT(priority == PR_PRIORITY_NORMAL); + MOZ_ASSERT(type == PR_USER_THREAD); + MOZ_ASSERT(priority == PR_PRIORITY_NORMAL); if (!gInitialized) { /* @@ -174,13 +174,13 @@ PR_NewThreadPrivateIndex(unsigned *newIndex, PRThreadPrivateDTOR destructor) * We only call PR_NewThreadPrivateIndex from the main thread, so there's no * need to lock the table of TLS keys. */ - JS_ASSERT(PR_GetCurrentThread() == &gMainThread); + MOZ_ASSERT(PR_GetCurrentThread() == &gMainThread); pthread_key_t key; if (pthread_key_create(&key, destructor)) return PR_FAILURE; - JS_ASSERT(gTLSKeyCount + 1 < MaxTLSKeyCount); + MOZ_ASSERT(gTLSKeyCount + 1 < MaxTLSKeyCount); gTLSKeys[gTLSKeyCount] = key; *newIndex = gTLSKeyCount; diff --git a/js/src/vm/ProxyObject.cpp b/js/src/vm/ProxyObject.cpp index 2c6a29334da7..a13db112c6e7 100644 --- a/js/src/vm/ProxyObject.cpp +++ b/js/src/vm/ProxyObject.cpp @@ -22,7 +22,7 @@ ProxyObject::New(JSContext *cx, const BaseProxyHandler *handler, HandleValue pri const Class *clasp = options.clasp(); - JS_ASSERT(isValidProxyClass(clasp)); + MOZ_ASSERT(isValidProxyClass(clasp)); JS_ASSERT_IF(proto.isObject(), cx->compartment() == proto.toObject()->compartment()); JS_ASSERT_IF(parent, cx->compartment() == parent->compartment()); diff --git a/js/src/vm/ProxyObject.h b/js/src/vm/ProxyObject.h index 437f5e3c2426..1720fe4efeda 100644 --- a/js/src/vm/ProxyObject.h +++ b/js/src/vm/ProxyObject.h @@ -58,24 +58,24 @@ class ProxyObject : public JSObject } const Value &extra(size_t n) const { - JS_ASSERT(n == 0 || n == 1); + MOZ_ASSERT(n == 0 || n == 1); return GetReservedSlot(const_cast(this), EXTRA_SLOT + n); } void setExtra(size_t n, const Value &extra) { - JS_ASSERT(n == 0 || n == 1); + MOZ_ASSERT(n == 0 || n == 1); SetReservedSlot(this, EXTRA_SLOT + n, extra); } private: HeapSlot *slotOfExtra(size_t n) { - JS_ASSERT(n == 0 || n == 1); + MOZ_ASSERT(n == 0 || n == 1); return &getReservedSlotRef(EXTRA_SLOT + n); } HeapSlot *slotOfClassSpecific(size_t n) { - JS_ASSERT(n >= PROXY_MINIMUM_SLOTS); - JS_ASSERT(n < JSCLASS_RESERVED_SLOTS(getClass())); + MOZ_ASSERT(n >= PROXY_MINIMUM_SLOTS); + MOZ_ASSERT(n < JSCLASS_RESERVED_SLOTS(getClass())); return &getReservedSlotRef(n); } diff --git a/js/src/vm/RegExpObject.cpp b/js/src/vm/RegExpObject.cpp index 57afd176f7d4..abfe28751224 100644 --- a/js/src/vm/RegExpObject.cpp +++ b/js/src/vm/RegExpObject.cpp @@ -64,8 +64,8 @@ RegExpObjectBuilder::getOrCreate() bool RegExpObjectBuilder::getOrCreateClone(HandleTypeObject type) { - JS_ASSERT(!reobj_); - JS_ASSERT(type->clasp() == &RegExpObject::class_); + MOZ_ASSERT(!reobj_); + MOZ_ASSERT(type->clasp() == &RegExpObject::class_); JSObject *parent = type->proto().toObject()->getParent(); @@ -139,7 +139,7 @@ RegExpObjectBuilder::clone(Handle other) bool MatchPairs::initArray(size_t pairCount) { - JS_ASSERT(pairCount > 0); + MOZ_ASSERT(pairCount > 0); /* Guarantee adequate space in buffer. */ if (!allocOrExpandArray(pairCount)) @@ -157,7 +157,7 @@ MatchPairs::initArray(size_t pairCount) bool MatchPairs::initArrayFrom(MatchPairs ©From) { - JS_ASSERT(copyFrom.pairCount() > 0); + MOZ_ASSERT(copyFrom.pairCount() > 0); if (!allocOrExpandArray(copyFrom.pairCount())) return false; @@ -174,7 +174,7 @@ MatchPairs::displace(size_t disp) return; for (size_t i = 0; i < pairCount_; i++) { - JS_ASSERT(pairs_[i].check()); + MOZ_ASSERT(pairs_[i].check()); pairs_[i].start += (pairs_[i].start < 0) ? 0 : disp; pairs_[i].limit += (pairs_[i].limit < 0) ? 0 : disp; } @@ -185,12 +185,12 @@ ScopedMatchPairs::allocOrExpandArray(size_t pairCount) { /* Array expansion is forbidden, but array reuse is acceptable. */ if (pairCount_) { - JS_ASSERT(pairs_); - JS_ASSERT(pairCount_ == pairCount); + MOZ_ASSERT(pairs_); + MOZ_ASSERT(pairCount_ == pairCount); return true; } - JS_ASSERT(!pairs_); + MOZ_ASSERT(!pairs_); pairs_ = (MatchPair *)lifoScope_.alloc().alloc(sizeof(MatchPair) * pairCount); if (!pairs_) return false; @@ -324,7 +324,7 @@ RegExpObject::createShared(JSContext *cx, RegExpGuard *g) { Rooted self(cx, this); - JS_ASSERT(!maybeShared()); + MOZ_ASSERT(!maybeShared()); if (!cx->compartment()->regExps.get(cx, getSource(), getFlags(), g)) return false; @@ -335,7 +335,7 @@ RegExpObject::createShared(JSContext *cx, RegExpGuard *g) Shape * RegExpObject::assignInitialShape(ExclusiveContext *cx, Handle self) { - JS_ASSERT(self->nativeEmpty()); + MOZ_ASSERT(self->nativeEmpty()); JS_STATIC_ASSERT(LAST_INDEX_SLOT == 0); JS_STATIC_ASSERT(SOURCE_SLOT == LAST_INDEX_SLOT + 1); @@ -369,18 +369,18 @@ RegExpObject::init(ExclusiveContext *cx, HandleAtom source, RegExpFlag flags) if (!EmptyShape::ensureInitialCustomShape(cx, self)) return false; - JS_ASSERT(self->nativeLookup(cx, NameToId(cx->names().lastIndex))->slot() == - LAST_INDEX_SLOT); - JS_ASSERT(self->nativeLookup(cx, NameToId(cx->names().source))->slot() == - SOURCE_SLOT); - JS_ASSERT(self->nativeLookup(cx, NameToId(cx->names().global))->slot() == - GLOBAL_FLAG_SLOT); - JS_ASSERT(self->nativeLookup(cx, NameToId(cx->names().ignoreCase))->slot() == - IGNORE_CASE_FLAG_SLOT); - JS_ASSERT(self->nativeLookup(cx, NameToId(cx->names().multiline))->slot() == - MULTILINE_FLAG_SLOT); - JS_ASSERT(self->nativeLookup(cx, NameToId(cx->names().sticky))->slot() == - STICKY_FLAG_SLOT); + MOZ_ASSERT(self->nativeLookup(cx, NameToId(cx->names().lastIndex))->slot() == + LAST_INDEX_SLOT); + MOZ_ASSERT(self->nativeLookup(cx, NameToId(cx->names().source))->slot() == + SOURCE_SLOT); + MOZ_ASSERT(self->nativeLookup(cx, NameToId(cx->names().global))->slot() == + GLOBAL_FLAG_SLOT); + MOZ_ASSERT(self->nativeLookup(cx, NameToId(cx->names().ignoreCase))->slot() == + IGNORE_CASE_FLAG_SLOT); + MOZ_ASSERT(self->nativeLookup(cx, NameToId(cx->names().multiline))->slot() == + MULTILINE_FLAG_SLOT); + MOZ_ASSERT(self->nativeLookup(cx, NameToId(cx->names().sticky))->slot() == + STICKY_FLAG_SLOT); /* * If this is a re-initialization with an existing RegExpShared, 'flags' @@ -520,7 +520,7 @@ RegExpShared::compile(JSContext *cx, HandleAtom pattern, HandleLinearString inpu if (code.empty()) return false; - JS_ASSERT(!code.jitCode || !code.byteCode); + MOZ_ASSERT(!code.jitCode || !code.byteCode); RegExpCompilation &compilation = this->compilation(mode, input->hasLatin1Chars()); compilation.jitCode = code.jitCode; @@ -576,7 +576,7 @@ RegExpShared::execute(JSContext *cx, HandleLinearString input, size_t start, irregexp::RegExpStackScope stackScope(cx->runtime()); if (canStringMatch) { - JS_ASSERT(pairCount() == 1); + MOZ_ASSERT(pairCount() == 1); int res = StringFindPattern(input, source, start + charsOffset); if (res == -1) return RegExpRunStatus_Success_NotFound; @@ -651,7 +651,7 @@ RegExpShared::execute(JSContext *cx, HandleLinearString input, size_t start, if (result == RegExpRunStatus_Success_NotFound) return RegExpRunStatus_Success_NotFound; - JS_ASSERT(result == RegExpRunStatus_Success); + MOZ_ASSERT(result == RegExpRunStatus_Success); break; } @@ -701,7 +701,7 @@ RegExpCompartment::~RegExpCompartment() JSObject * RegExpCompartment::createMatchResultTemplateObject(JSContext *cx) { - JS_ASSERT(!matchResultTemplateObject_); + MOZ_ASSERT(!matchResultTemplateObject_); /* Create template array object */ RootedObject templateObject(cx, NewDenseUnallocatedArray(cx, 0, nullptr, TenuredObject)); @@ -728,10 +728,10 @@ RegExpCompartment::createMatchResultTemplateObject(JSContext *cx) // Make sure that the properties are in the right slots. DebugOnly shape = templateObject->lastProperty(); - JS_ASSERT(shape->previous()->slot() == 0 && - shape->previous()->propidRef() == NameToId(cx->names().index)); - JS_ASSERT(shape->slot() == 1 && - shape->propidRef() == NameToId(cx->names().input)); + MOZ_ASSERT(shape->previous()->slot() == 0 && + shape->previous()->propidRef() == NameToId(cx->names().index)); + MOZ_ASSERT(shape->slot() == 1 && + shape->propidRef() == NameToId(cx->names().input)); // Make sure type information reflects the indexed properties which might // be added. @@ -940,7 +940,7 @@ js::XDRScriptRegExpObject(XDRState *xdr, HeapPtrObject *objp) uint32_t flagsword = 0; if (mode == XDR_ENCODE) { - JS_ASSERT(objp); + MOZ_ASSERT(objp); RegExpObject &reobj = (*objp)->as(); source = reobj.getSource(); flagsword = reobj.getFlags(); diff --git a/js/src/vm/RegExpObject.h b/js/src/vm/RegExpObject.h index 7e5fd4121b65..38b0651cb729 100644 --- a/js/src/vm/RegExpObject.h +++ b/js/src/vm/RegExpObject.h @@ -174,7 +174,7 @@ class RegExpShared /* Accessors */ size_t getParenCount() const { - JS_ASSERT(isCompiled() || canStringMatch); + MOZ_ASSERT(isCompiled() || canStringMatch); return parenCount; } @@ -232,7 +232,7 @@ class RegExpGuard : public JS::CustomAutoRooter public: void init(RegExpShared &re) { - JS_ASSERT(!initialized()); + MOZ_ASSERT(!initialized()); re_ = &re; } @@ -246,7 +246,7 @@ class RegExpGuard : public JS::CustomAutoRooter } bool initialized() const { return !!re_; } - RegExpShared *re() const { JS_ASSERT(initialized()); return re_; } + RegExpShared *re() const { MOZ_ASSERT(initialized()); return re_; } RegExpShared *operator->() { return re(); } RegExpShared &operator*() { return *re(); } }; @@ -406,7 +406,7 @@ class RegExpObject : public JSObject bool getShared(JSContext *cx, RegExpGuard *g); void setShared(RegExpShared &shared) { - JS_ASSERT(!maybeShared()); + MOZ_ASSERT(!maybeShared()); JSObject::setPrivate(&shared); } diff --git a/js/src/vm/RegExpStatics.cpp b/js/src/vm/RegExpStatics.cpp index 949659b6b117..125b44e3b1db 100644 --- a/js/src/vm/RegExpStatics.cpp +++ b/js/src/vm/RegExpStatics.cpp @@ -30,7 +30,7 @@ static void resc_trace(JSTracer *trc, JSObject *obj) { void *pdata = obj->getPrivate(); - JS_ASSERT(pdata); + MOZ_ASSERT(pdata); RegExpStatics *res = static_cast(pdata); res->mark(trc); } @@ -85,9 +85,9 @@ RegExpStatics::executeLazy(JSContext *cx) if (!pendingLazyEvaluation) return true; - JS_ASSERT(lazySource); - JS_ASSERT(matchesInput); - JS_ASSERT(lazyIndex != size_t(-1)); + MOZ_ASSERT(lazySource); + MOZ_ASSERT(matchesInput); + MOZ_ASSERT(lazyIndex != size_t(-1)); /* Retrieve or create the RegExpShared in this compartment. */ RegExpGuard g(cx); @@ -109,7 +109,7 @@ RegExpStatics::executeLazy(JSContext *cx) * RegExpStatics are only updated on successful (matching) execution. * Re-running the same expression must therefore produce a matching result. */ - JS_ASSERT(status == RegExpRunStatus_Success); + MOZ_ASSERT(status == RegExpRunStatus_Success); /* Unset lazy state and remove rooted values that now have no use. */ pendingLazyEvaluation = false; diff --git a/js/src/vm/RegExpStatics.h b/js/src/vm/RegExpStatics.h index 889a4dc597c8..9b7ec4fff694 100644 --- a/js/src/vm/RegExpStatics.h +++ b/js/src/vm/RegExpStatics.h @@ -57,7 +57,7 @@ class RegExpStatics inline void restore(); bool save(JSContext *cx, RegExpStatics *buffer) { - JS_ASSERT(!buffer->copied && !buffer->bufferLink); + MOZ_ASSERT(!buffer->copied && !buffer->bufferLink); buffer->bufferLink = bufferLink; bufferLink = buffer; if (!buffer->matches.allocOrExpandArray(matches.length())) { @@ -117,7 +117,7 @@ class RegExpStatics /* Default match accessor. */ const MatchPairs &getMatches() const { /* Safe: only used by String methods, which do not set lazy mode. */ - JS_ASSERT(!pendingLazyEvaluation); + MOZ_ASSERT(!pendingLazyEvaluation); return matches; } @@ -211,10 +211,10 @@ inline bool RegExpStatics::createDependent(JSContext *cx, size_t start, size_t end, MutableHandleValue out) { /* Private function: caller must perform lazy evaluation. */ - JS_ASSERT(!pendingLazyEvaluation); + MOZ_ASSERT(!pendingLazyEvaluation); - JS_ASSERT(start <= end); - JS_ASSERT(end <= matchesInput->length()); + MOZ_ASSERT(start <= end); + MOZ_ASSERT(end <= matchesInput->length()); JSString *str = NewDependentString(cx, matchesInput, start, end - start); if (!str) return false; @@ -234,7 +234,7 @@ inline bool RegExpStatics::makeMatch(JSContext *cx, size_t pairNum, MutableHandleValue out) { /* Private function: caller must perform lazy evaluation. */ - JS_ASSERT(!pendingLazyEvaluation); + MOZ_ASSERT(!pendingLazyEvaluation); if (matches.empty() || pairNum >= matches.pairCount() || matches[pairNum].isUndefined()) { out.setUndefined(); @@ -268,15 +268,15 @@ RegExpStatics::createLastParen(JSContext *cx, MutableHandleValue out) out.setString(cx->runtime()->emptyString); return true; } - JS_ASSERT(pair.start >= 0 && pair.limit >= 0); - JS_ASSERT(pair.limit >= pair.start); + MOZ_ASSERT(pair.start >= 0 && pair.limit >= 0); + MOZ_ASSERT(pair.limit >= pair.start); return createDependent(cx, pair.start, pair.limit, out); } inline bool RegExpStatics::createParen(JSContext *cx, size_t pairNum, MutableHandleValue out) { - JS_ASSERT(pairNum >= 1); + MOZ_ASSERT(pairNum >= 1); if (!executeLazy(cx)) return false; @@ -324,9 +324,9 @@ RegExpStatics::createRightContext(JSContext *cx, MutableHandleValue out) inline void RegExpStatics::getParen(size_t pairNum, JSSubString *out) const { - JS_ASSERT(!pendingLazyEvaluation); + MOZ_ASSERT(!pendingLazyEvaluation); - JS_ASSERT(pairNum >= 1 && pairNum < matches.pairCount()); + MOZ_ASSERT(pairNum >= 1 && pairNum < matches.pairCount()); const MatchPair &pair = matches[pairNum]; if (pair.isUndefined()) { out->initEmpty(matchesInput); @@ -338,21 +338,21 @@ RegExpStatics::getParen(size_t pairNum, JSSubString *out) const inline void RegExpStatics::getLastMatch(JSSubString *out) const { - JS_ASSERT(!pendingLazyEvaluation); + MOZ_ASSERT(!pendingLazyEvaluation); if (matches.empty()) { out->initEmpty(matchesInput); return; } - JS_ASSERT(matchesInput); - JS_ASSERT(matches[0].limit >= matches[0].start); + MOZ_ASSERT(matchesInput); + MOZ_ASSERT(matches[0].limit >= matches[0].start); out->init(matchesInput, matches[0].start, matches[0].length()); } inline void RegExpStatics::getLastParen(JSSubString *out) const { - JS_ASSERT(!pendingLazyEvaluation); + MOZ_ASSERT(!pendingLazyEvaluation); /* Note: the first pair is the whole match. */ if (matches.empty() || matches.pairCount() == 1) { @@ -365,7 +365,7 @@ RegExpStatics::getLastParen(JSSubString *out) const inline void RegExpStatics::getLeftContext(JSSubString *out) const { - JS_ASSERT(!pendingLazyEvaluation); + MOZ_ASSERT(!pendingLazyEvaluation); if (matches.empty()) { out->initEmpty(matchesInput); @@ -377,13 +377,13 @@ RegExpStatics::getLeftContext(JSSubString *out) const inline void RegExpStatics::getRightContext(JSSubString *out) const { - JS_ASSERT(!pendingLazyEvaluation); + MOZ_ASSERT(!pendingLazyEvaluation); if (matches.empty()) { out->initEmpty(matchesInput); return; } - JS_ASSERT(matches[0].limit <= int(matchesInput->length())); + MOZ_ASSERT(matches[0].limit <= int(matchesInput->length())); size_t length = matchesInput->length() - matches[0].limit; out->init(matchesInput, matches[0].limit, length); } @@ -428,7 +428,7 @@ inline void RegExpStatics::updateLazily(JSContext *cx, JSLinearString *input, RegExpShared *shared, size_t lastIndex) { - JS_ASSERT(input && shared); + MOZ_ASSERT(input && shared); aboutToWrite(); BarrieredSetPair(cx->zone(), @@ -444,7 +444,7 @@ RegExpStatics::updateLazily(JSContext *cx, JSLinearString *input, inline bool RegExpStatics::updateFromMatchPairs(JSContext *cx, JSLinearString *input, MatchPairs &newPairs) { - JS_ASSERT(input); + MOZ_ASSERT(input); aboutToWrite(); /* Unset all lazy state. */ @@ -491,31 +491,31 @@ RegExpStatics::checkInvariants() { #ifdef DEBUG if (pendingLazyEvaluation) { - JS_ASSERT(lazySource); - JS_ASSERT(matchesInput); - JS_ASSERT(lazyIndex != size_t(-1)); + MOZ_ASSERT(lazySource); + MOZ_ASSERT(matchesInput); + MOZ_ASSERT(lazyIndex != size_t(-1)); return; } if (matches.empty()) { - JS_ASSERT(!matchesInput); + MOZ_ASSERT(!matchesInput); return; } /* Pair count is non-zero, so there must be match pairs input. */ - JS_ASSERT(matchesInput); + MOZ_ASSERT(matchesInput); size_t mpiLen = matchesInput->length(); /* Both members of the first pair must be non-negative. */ - JS_ASSERT(!matches[0].isUndefined()); - JS_ASSERT(matches[0].limit >= 0); + MOZ_ASSERT(!matches[0].isUndefined()); + MOZ_ASSERT(matches[0].limit >= 0); /* Present pairs must be valid. */ for (size_t i = 0; i < matches.pairCount(); i++) { if (matches[i].isUndefined()) continue; const MatchPair &pair = matches[i]; - JS_ASSERT(mpiLen >= size_t(pair.limit) && pair.limit >= pair.start && pair.start >= 0); + MOZ_ASSERT(mpiLen >= size_t(pair.limit) && pair.limit >= pair.start && pair.start >= 0); } #endif /* DEBUG */ } diff --git a/js/src/vm/Runtime-inl.h b/js/src/vm/Runtime-inl.h index b5c4ce30ef13..4e887579020f 100644 --- a/js/src/vm/Runtime-inl.h +++ b/js/src/vm/Runtime-inl.h @@ -20,7 +20,7 @@ namespace js { inline bool NewObjectCache::lookupProto(const Class *clasp, JSObject *proto, gc::AllocKind kind, EntryIndex *pentry) { - JS_ASSERT(!proto->is()); + MOZ_ASSERT(!proto->is()); return lookup(clasp, proto, kind, pentry); } @@ -33,7 +33,7 @@ NewObjectCache::lookupGlobal(const Class *clasp, js::GlobalObject *global, gc::A inline void NewObjectCache::fillGlobal(EntryIndex entry, const Class *clasp, js::GlobalObject *global, gc::AllocKind kind, JSObject *obj) { - //JS_ASSERT(global == obj->getGlobal()); + //MOZ_ASSERT(global == obj->getGlobal()); return fill(entry, clasp, global, kind, obj); } @@ -42,9 +42,9 @@ inline JSObject * NewObjectCache::newObjectFromHit(JSContext *cx, EntryIndex entry_, js::gc::InitialHeap heap) { // The new object cache does not account for metadata attached via callbacks. - JS_ASSERT(!cx->compartment()->hasObjectMetadataCallback()); + MOZ_ASSERT(!cx->compartment()->hasObjectMetadataCallback()); - JS_ASSERT(unsigned(entry_) < mozilla::ArrayLength(entries)); + MOZ_ASSERT(unsigned(entry_) < mozilla::ArrayLength(entries)); Entry *entry = &entries[entry_]; JSObject *templateObj = reinterpret_cast(&entry->templateObject); @@ -64,11 +64,11 @@ NewObjectCache::newObjectFromHit(JSContext *cx, EntryIndex entry_, js::gc::Initi if (allowGC) { mozilla::DebugOnly obj = js::gc::AllocateObjectForCacheHit(cx, entry->kind, heap); - JS_ASSERT(!obj); + MOZ_ASSERT(!obj); return nullptr; } - JS_ASSERT(allowGC == NoGC); + MOZ_ASSERT(allowGC == NoGC); JSObject *obj = js::gc::AllocateObjectForCacheHit(cx, entry->kind, heap); if (obj) { copyCachedToObject(obj, templateObj, entry->kind); diff --git a/js/src/vm/Runtime.cpp b/js/src/vm/Runtime.cpp index d5c0fe5ab0fc..d9cc948365ea 100644 --- a/js/src/vm/Runtime.cpp +++ b/js/src/vm/Runtime.cpp @@ -336,7 +336,7 @@ JSRuntime::init(uint32_t maxbytes, uint32_t maxNurseryBytes) JSRuntime::~JSRuntime() { - JS_ASSERT(!isHeapBusy()); + MOZ_ASSERT(!isHeapBusy()); if (gcInitialized) { /* Free source hook early, as its destructor may want to delete roots. */ @@ -380,15 +380,15 @@ JSRuntime::~JSRuntime() */ finishSelfHosting(); - JS_ASSERT(!exclusiveAccessOwner); + MOZ_ASSERT(!exclusiveAccessOwner); if (exclusiveAccessLock) PR_DestroyLock(exclusiveAccessLock); // Avoid bogus asserts during teardown. - JS_ASSERT(!numExclusiveThreads); + MOZ_ASSERT(!numExclusiveThreads); mainThreadHasExclusiveAccess = true; - JS_ASSERT(!interruptLockOwner); + MOZ_ASSERT(!interruptLockOwner); if (interruptLock) PR_DestroyLock(interruptLock); @@ -438,7 +438,7 @@ JSRuntime::~JSRuntime() #endif DebugOnly oldCount = liveRuntimesCount--; - JS_ASSERT(oldCount > 0); + MOZ_ASSERT(oldCount > 0); js::TlsPerThreadData.set(nullptr); } @@ -555,8 +555,8 @@ JSRuntime::requestInterrupt(InterruptMode mode) jit::ExecutableAllocator * JSRuntime::createExecutableAllocator(JSContext *cx) { - JS_ASSERT(!execAlloc_); - JS_ASSERT(cx->runtime() == this); + MOZ_ASSERT(!execAlloc_); + MOZ_ASSERT(cx->runtime() == this); execAlloc_ = js_new(); if (!execAlloc_) @@ -567,8 +567,8 @@ JSRuntime::createExecutableAllocator(JSContext *cx) MathCache * JSRuntime::createMathCache(JSContext *cx) { - JS_ASSERT(!mathCache_); - JS_ASSERT(cx->runtime() == this); + MOZ_ASSERT(!mathCache_); + MOZ_ASSERT(cx->runtime() == this); MathCache *newMathCache = js_new(); if (!newMathCache) { @@ -710,7 +710,7 @@ JSRuntime::activeGCInAtomsZone() void JSRuntime::setUsedByExclusiveThread(Zone *zone) { - JS_ASSERT(!zone->usedByExclusiveThread); + MOZ_ASSERT(!zone->usedByExclusiveThread); zone->usedByExclusiveThread = true; numExclusiveThreads++; } @@ -718,7 +718,7 @@ JSRuntime::setUsedByExclusiveThread(Zone *zone) void JSRuntime::clearUsedByExclusiveThread(Zone *zone) { - JS_ASSERT(zone->usedByExclusiveThread); + MOZ_ASSERT(zone->usedByExclusiveThread); zone->usedByExclusiveThread = false; numExclusiveThreads--; } @@ -736,7 +736,7 @@ js::CurrentThreadCanAccessZone(Zone *zone) return true; if (InParallelSection()) { DebugOnly pt = js::TlsPerThreadData.get(); - JS_ASSERT(pt && pt->associatedWith(zone->runtime_)); + MOZ_ASSERT(pt && pt->associatedWith(zone->runtime_)); return true; } @@ -756,11 +756,11 @@ JSRuntime::assertCanLock(RuntimeLock which) // it must be done in the order below. switch (which) { case ExclusiveAccessLock: - JS_ASSERT(exclusiveAccessOwner != PR_GetCurrentThread()); + MOZ_ASSERT(exclusiveAccessOwner != PR_GetCurrentThread()); case HelperThreadStateLock: - JS_ASSERT(!HelperThreadState().isLocked()); + MOZ_ASSERT(!HelperThreadState().isLocked()); case InterruptLock: - JS_ASSERT(!currentThreadOwnsInterruptLock()); + MOZ_ASSERT(!currentThreadOwnsInterruptLock()); case GCLock: gc.assertCanLock(); break; diff --git a/js/src/vm/Runtime.h b/js/src/vm/Runtime.h index c2ea7b78c0a8..b184e8a4993e 100644 --- a/js/src/vm/Runtime.h +++ b/js/src/vm/Runtime.h @@ -307,7 +307,7 @@ class NewObjectCache void fillType(EntryIndex entry, js::types::TypeObject *type, gc::AllocKind kind, JSObject *obj) { - JS_ASSERT(obj->type() == type); + MOZ_ASSERT(obj->type() == type); return fill(entry, type->clasp(), type, kind, obj); } @@ -330,11 +330,11 @@ class NewObjectCache void fill(EntryIndex entry_, const Class *clasp, gc::Cell *key, gc::AllocKind kind, JSObject *obj) { - JS_ASSERT(unsigned(entry_) < mozilla::ArrayLength(entries)); - JS_ASSERT(entry_ == makeIndex(clasp, key, kind)); + MOZ_ASSERT(unsigned(entry_) < mozilla::ArrayLength(entries)); + MOZ_ASSERT(entry_ == makeIndex(clasp, key, kind)); Entry *entry = &entries[entry_]; - JS_ASSERT(!obj->hasDynamicSlots() && !obj->hasDynamicElements()); + MOZ_ASSERT(!obj->hasDynamicSlots() && !obj->hasDynamicElements()); entry->clasp = clasp; entry->key = key; @@ -636,14 +636,14 @@ class PerThreadData : public PerThreadDataFriendFields AutoEnterRuntime(PerThreadData *pt, JSRuntime *rt) : pt(pt) { - JS_ASSERT(!pt->runtime_); + MOZ_ASSERT(!pt->runtime_); pt->runtime_ = rt; #if defined(JS_ARM_SIMULATOR) || defined(JS_MIPS_SIMULATOR) // The simulator has a pointer to its SimulatorRuntime, but helper threads // don't have a simulator as they don't run JIT code so this pointer need not // be updated. All the paths that the helper threads use access the // SimulatorRuntime via the PerThreadData. - JS_ASSERT(!pt->simulator_); + MOZ_ASSERT(!pt->simulator_); #endif } @@ -651,7 +651,7 @@ class PerThreadData : public PerThreadDataFriendFields pt->runtime_ = nullptr; #if defined(JS_ARM_SIMULATOR) || defined(JS_MIPS_SIMULATOR) // Check that helper threads have not run JIT code and/or added a simulator. - JS_ASSERT(!pt->simulator_); + MOZ_ASSERT(!pt->simulator_); #endif } }; @@ -737,7 +737,7 @@ struct JSRuntime : public JS::shadow::Runtime, rt->interruptLockOwner = PR_GetCurrentThread(); } ~AutoLockForInterrupt() { - JS_ASSERT(rt->currentThreadOwnsInterruptLock()); + MOZ_ASSERT(rt->currentThreadOwnsInterruptLock()); rt->interruptLockOwner = nullptr; PR_Unlock(rt->interruptLock); } @@ -835,7 +835,7 @@ struct JSRuntime : public JS::shadow::Runtime, return execAlloc_ ? execAlloc_ : createExecutableAllocator(cx); } js::jit::ExecutableAllocator &execAlloc() { - JS_ASSERT(execAlloc_); + MOZ_ASSERT(execAlloc_); return *execAlloc_; } js::jit::ExecutableAllocator *maybeExecAlloc() { @@ -1126,18 +1126,18 @@ struct JSRuntime : public JS::shadow::Runtime, unsigned activeCompilations_; public: js::frontend::ParseMapPool &parseMapPool() { - JS_ASSERT(currentThreadHasExclusiveAccess()); + MOZ_ASSERT(currentThreadHasExclusiveAccess()); return parseMapPool_; } bool hasActiveCompilations() { return activeCompilations_ != 0; } void addActiveCompilation() { - JS_ASSERT(currentThreadHasExclusiveAccess()); + MOZ_ASSERT(currentThreadHasExclusiveAccess()); activeCompilations_++; } void removeActiveCompilation() { - JS_ASSERT(currentThreadHasExclusiveAccess()); + MOZ_ASSERT(currentThreadHasExclusiveAccess()); activeCompilations_--; } @@ -1155,7 +1155,7 @@ struct JSRuntime : public JS::shadow::Runtime, friend class js::AutoKeepAtoms; public: bool keepAtoms() { - JS_ASSERT(CurrentThreadCanAccessRuntime(this)); + MOZ_ASSERT(CurrentThreadCanAccessRuntime(this)); return keepAtoms_ != 0 || exclusiveThreadsPresent(); } @@ -1197,11 +1197,11 @@ struct JSRuntime : public JS::shadow::Runtime, void sweepAtoms(); js::AtomSet &atoms() { - JS_ASSERT(currentThreadHasExclusiveAccess()); + MOZ_ASSERT(currentThreadHasExclusiveAccess()); return *atoms_; } JSCompartment *atomsCompartment() { - JS_ASSERT(currentThreadHasExclusiveAccess()); + MOZ_ASSERT(currentThreadHasExclusiveAccess()); return atomsCompartment_; } @@ -1215,7 +1215,7 @@ struct JSRuntime : public JS::shadow::Runtime, bool activeGCInAtomsZone(); js::SymbolRegistry &symbolRegistry() { - JS_ASSERT(currentThreadHasExclusiveAccess()); + MOZ_ASSERT(currentThreadHasExclusiveAccess()); return symbolRegistry_; } @@ -1249,7 +1249,7 @@ struct JSRuntime : public JS::shadow::Runtime, js::ScriptDataTable scriptDataTable_; public: js::ScriptDataTable &scriptDataTable() { - JS_ASSERT(currentThreadHasExclusiveAccess()); + MOZ_ASSERT(currentThreadHasExclusiveAccess()); return scriptDataTable_; } @@ -1426,7 +1426,7 @@ static inline JSContext * GetJSContextFromJitCode() { JSContext *cx = TlsPerThreadData.get()->jitJSContext; - JS_ASSERT(cx); + MOZ_ASSERT(cx); return cx; } @@ -1483,7 +1483,7 @@ FreeOp::freeLater(void *p) { // FreeOps other than the defaultFreeOp() are constructed on the stack, // and won't hold onto the pointers to free indefinitely. - JS_ASSERT(this != runtime()->defaultFreeOp()); + MOZ_ASSERT(this != runtime()->defaultFreeOp()); if (!freeLaterList.append(p)) CrashAtUnhandlableOOM("FreeOp::freeLater"); @@ -1513,8 +1513,8 @@ class AutoLockGC } void lock(JSRuntime *rt) { - JS_ASSERT(rt); - JS_ASSERT(!runtime); + MOZ_ASSERT(rt); + MOZ_ASSERT(!runtime); runtime = rt; rt->lockGC(); } @@ -1557,12 +1557,12 @@ class MOZ_STACK_CLASS AutoKeepAtoms } else { // This should be a thread with an exclusive context, which will // always inhibit collection of atoms. - JS_ASSERT(pt->exclusiveThreadsPresent()); + MOZ_ASSERT(pt->exclusiveThreadsPresent()); } } ~AutoKeepAtoms() { if (JSRuntime *rt = pt->runtimeIfOnOwnerThread()) { - JS_ASSERT(rt->keepAtoms_); + MOZ_ASSERT(rt->keepAtoms_); rt->keepAtoms_--; } } @@ -1571,14 +1571,14 @@ class MOZ_STACK_CLASS AutoKeepAtoms inline void PerThreadData::setJitStackLimit(uintptr_t limit) { - JS_ASSERT(runtime_->currentThreadOwnsInterruptLock()); + MOZ_ASSERT(runtime_->currentThreadOwnsInterruptLock()); jitStackLimit = limit; } inline JSRuntime * PerThreadData::runtimeFromMainThread() { - JS_ASSERT(CurrentThreadCanAccessRuntime(runtime_)); + MOZ_ASSERT(CurrentThreadCanAccessRuntime(runtime_)); return runtime_; } @@ -1604,7 +1604,7 @@ PerThreadData::addActiveCompilation() inline void PerThreadData::removeActiveCompilation() { - JS_ASSERT(activeCompilations); + MOZ_ASSERT(activeCompilations); activeCompilations--; runtime_->removeActiveCompilation(); } @@ -1723,7 +1723,7 @@ class AutoEnterIonCompilation #ifdef DEBUG PerThreadData *pt = js::TlsPerThreadData.get(); - JS_ASSERT(!pt->ionCompiling); + MOZ_ASSERT(!pt->ionCompiling); pt->ionCompiling = true; #endif } @@ -1731,7 +1731,7 @@ class AutoEnterIonCompilation ~AutoEnterIonCompilation() { #ifdef DEBUG PerThreadData *pt = js::TlsPerThreadData.get(); - JS_ASSERT(pt->ionCompiling); + MOZ_ASSERT(pt->ionCompiling); pt->ionCompiling = false; #endif } diff --git a/js/src/vm/SPSProfiler.cpp b/js/src/vm/SPSProfiler.cpp index fa2d69b09e5d..90cd530b4253 100644 --- a/js/src/vm/SPSProfiler.cpp +++ b/js/src/vm/SPSProfiler.cpp @@ -29,7 +29,7 @@ SPSProfiler::SPSProfiler(JSRuntime *rt) lock_(nullptr), eventMarker_(nullptr) { - JS_ASSERT(rt != nullptr); + MOZ_ASSERT(rt != nullptr); } bool @@ -73,7 +73,7 @@ SPSProfiler::setEventMarker(void (*fn)(const char *)) void SPSProfiler::enable(bool enabled) { - JS_ASSERT(installed()); + MOZ_ASSERT(installed()); if (enabled_ == enabled) return; @@ -99,7 +99,7 @@ const char* SPSProfiler::profileString(JSScript *script, JSFunction *maybeFun) { AutoSPSLock lock(lock_); - JS_ASSERT(strings.initialized()); + MOZ_ASSERT(strings.initialized()); ProfileStringMap::AddPtr s = strings.lookupForAdd(script); if (s) return s->value(); @@ -136,7 +136,7 @@ SPSProfiler::onScriptFinalized(JSScript *script) void SPSProfiler::markEvent(const char *event) { - JS_ASSERT(enabled()); + MOZ_ASSERT(enabled()); if (eventMarker_) { JS::AutoSuppressGCAnalysis nogc; eventMarker_(event); @@ -175,7 +175,7 @@ SPSProfiler::exit(JSScript *script, JSFunction *maybeFun) if (*size_ < max_) { const char *str = profileString(script, maybeFun); /* Can't fail lookup because we should already be in the set */ - JS_ASSERT(str != nullptr); + MOZ_ASSERT(str != nullptr); // Bug 822041 if (!stack_[*size_].isJs()) { @@ -189,9 +189,9 @@ SPSProfiler::exit(JSScript *script, JSFunction *maybeFun) } } - JS_ASSERT(stack_[*size_].isJs()); - JS_ASSERT(stack_[*size_].script() == script); - JS_ASSERT(strcmp((const char*) stack_[*size_].label(), str) == 0); + MOZ_ASSERT(stack_[*size_].isJs()); + MOZ_ASSERT(stack_[*size_].script() == script); + MOZ_ASSERT(strcmp((const char*) stack_[*size_].label(), str) == 0); stack_[*size_].setLabel(nullptr); stack_[*size_].setPC(nullptr); } @@ -206,7 +206,7 @@ SPSProfiler::enterAsmJS(const char *string, void *sp) volatile uint32_t *size = size_; uint32_t current = *size; - JS_ASSERT(enabled()); + MOZ_ASSERT(enabled()); if (current < max_) { stack[current].setLabel(string); stack[current].setCppFrame(sp, 0); @@ -226,18 +226,18 @@ SPSProfiler::push(const char *string, void *sp, JSScript *script, jsbytecode *pc volatile uint32_t *size = size_; uint32_t current = *size; - JS_ASSERT(installed()); + MOZ_ASSERT(installed()); if (current < max_) { volatile ProfileEntry &entry = stack[current]; entry.setLabel(string); if (sp != nullptr) { entry.setCppFrame(sp, 0); - JS_ASSERT(entry.flags() == js::ProfileEntry::IS_CPP_ENTRY); + MOZ_ASSERT(entry.flags() == js::ProfileEntry::IS_CPP_ENTRY); } else { entry.setJsFrame(script, pc); - JS_ASSERT(entry.flags() == 0); + MOZ_ASSERT(entry.flags() == 0); } // Track if mLabel needs a copy. @@ -252,9 +252,9 @@ SPSProfiler::push(const char *string, void *sp, JSScript *script, jsbytecode *pc void SPSProfiler::pop() { - JS_ASSERT(installed()); + MOZ_ASSERT(installed()); (*size_)--; - JS_ASSERT(*(int*)size_ >= 0); + MOZ_ASSERT(*(int*)size_ >= 0); } /* @@ -332,7 +332,7 @@ SPSEntryMarker::~SPSEntryMarker() if (profiler != nullptr) { profiler->pop(); profiler->pop(); - JS_ASSERT(size_before == *profiler->size_); + MOZ_ASSERT(size_before == *profiler->size_); } } @@ -365,7 +365,7 @@ js::EnableRuntimeProfilingStack(JSRuntime *rt, bool enabled) JS_FRIEND_API(void) js::RegisterRuntimeProfilingEventMarker(JSRuntime *rt, void (*fn)(const char *)) { - JS_ASSERT(rt->spsProfiler.enabled()); + MOZ_ASSERT(rt->spsProfiler.enabled()); rt->spsProfiler.setEventMarker(fn); } diff --git a/js/src/vm/SPSProfiler.h b/js/src/vm/SPSProfiler.h index 68955174b008..281f9f0525d6 100644 --- a/js/src/vm/SPSProfiler.h +++ b/js/src/vm/SPSProfiler.h @@ -173,8 +173,8 @@ class SPSProfiler void exit(JSScript *script, JSFunction *maybeFun); void updatePC(JSScript *script, jsbytecode *pc) { if (enabled() && *size_ - 1 < max_) { - JS_ASSERT(*size_ > 0); - JS_ASSERT(stack_[*size_ - 1].script() == script); + MOZ_ASSERT(*size_ > 0); + MOZ_ASSERT(stack_[*size_ - 1].script() == script); stack_[*size_ - 1].setPC(pc); } } @@ -320,17 +320,17 @@ class SPSInstrumentation /* Small proxies around SPSProfiler */ bool enabled() { return profiler_ && profiler_->enabled(); } - SPSProfiler *profiler() { JS_ASSERT(enabled()); return profiler_; } + SPSProfiler *profiler() { MOZ_ASSERT(enabled()); return profiler_; } void disable() { profiler_ = nullptr; } /* Signals an inline function returned, reverting to the previous state */ void leaveInlineFrame() { if (!enabled()) return; - JS_ASSERT(frame->left == 0); - JS_ASSERT(frame->script != nullptr); + MOZ_ASSERT(frame->left == 0); + MOZ_ASSERT(frame->script != nullptr); frames.shrinkBy(1); - JS_ASSERT(frames.length() > 0); + MOZ_ASSERT(frames.length() > 0); frame = &frames[frames.length() - 1]; } @@ -343,7 +343,7 @@ class SPSInstrumentation JS_ASSERT_IF(frame != nullptr, frame->script != nullptr); JS_ASSERT_IF(frame != nullptr, frame->left == 1); if (!frames.empty()) { - JS_ASSERT(frame == &frames[frames.length() - 1]); + MOZ_ASSERT(frame == &frames[frames.length() - 1]); frame->pc = callerPC; } if (!frames.growBy(1)) @@ -363,7 +363,7 @@ class SPSInstrumentation bool prepareForOOL() { if (!enabled()) return true; - JS_ASSERT(!frames.empty()); + MOZ_ASSERT(!frames.empty()); if (frames.length() >= 2) { frames.shrinkBy(frames.length() - 2); @@ -379,7 +379,7 @@ class SPSInstrumentation void finishOOL() { if (!enabled()) return; - JS_ASSERT(!frames.empty()); + MOZ_ASSERT(!frames.empty()); frames.shrinkBy(frames.length() - 1); } @@ -400,8 +400,8 @@ class SPSInstrumentation /* If we've left the frame, the reenter will be skipped anyway */ if (!enabled() || frame->left != 0) return; - JS_ASSERT(frame->script); - JS_ASSERT(!frame->skipNext); + MOZ_ASSERT(frame->script); + MOZ_ASSERT(!frame->skipNext); frame->skipNext = true; } @@ -413,7 +413,7 @@ class SPSInstrumentation void setPushed(JSScript *script) { if (!enabled()) return; - JS_ASSERT(frame->left == 0); + MOZ_ASSERT(frame->left == 0); frame->script = script; } @@ -472,7 +472,7 @@ class SPSInstrumentation // We may be leaving an inlined frame for entry into a C++ frame. // Use the top script's pc offset instead of the innermost script's. if (inliningDepth() > 0) { - JS_ASSERT(frames[0].pc); + MOZ_ASSERT(frames[0].pc); updatePC = frames[0].pc; script = frames[0].script; } @@ -505,8 +505,8 @@ class SPSInstrumentation */ void pop(Assembler &masm, Register scratch, bool inlinedFunction = false) { if (enabled()) { - JS_ASSERT(frame->left == 0); - JS_ASSERT(frame->script); + MOZ_ASSERT(frame->left == 0); + MOZ_ASSERT(frame->script); if (!inlinedFunction) masm.spsPopFrame(profiler_, scratch); } diff --git a/js/src/vm/SavedStacks.cpp b/js/src/vm/SavedStacks.cpp index c8d185e5c87c..77b4214b5659 100644 --- a/js/src/vm/SavedStacks.cpp +++ b/js/src/vm/SavedStacks.cpp @@ -42,7 +42,7 @@ struct SavedFrame::Lookup { parent(parent), principals(principals) { - JS_ASSERT(source); + MOZ_ASSERT(source); } JSAtom *source; @@ -212,8 +212,8 @@ SavedFrame::getPrincipals() void SavedFrame::initFromLookup(SavedFrame::HandleLookup lookup) { - JS_ASSERT(lookup->source); - JS_ASSERT(getReservedSlot(JSSLOT_SOURCE).isUndefined()); + MOZ_ASSERT(lookup->source); + MOZ_ASSERT(getReservedSlot(JSSLOT_SOURCE).isUndefined()); setReservedSlot(JSSLOT_SOURCE, StringValue(lookup->source)); setReservedSlot(JSSLOT_LINE, NumberValue(lookup->line)); @@ -225,7 +225,7 @@ SavedFrame::initFromLookup(SavedFrame::HandleLookup lookup) setReservedSlot(JSSLOT_PARENT, ObjectOrNullValue(lookup->parent)); setReservedSlot(JSSLOT_PRIVATE_PARENT, PrivateValue(lookup->parent)); - JS_ASSERT(getReservedSlot(JSSLOT_PRINCIPALS).isUndefined()); + MOZ_ASSERT(getReservedSlot(JSSLOT_PRINCIPALS).isUndefined()); if (lookup->principals) JS_HoldPrincipals(lookup->principals); setReservedSlot(JSSLOT_PRINCIPALS, PrivateValue(lookup->principals)); @@ -418,7 +418,7 @@ SavedStacks::init() bool SavedStacks::saveCurrentStack(JSContext *cx, MutableHandleSavedFrame frame, unsigned maxFrameCount) { - JS_ASSERT(initialized()); + MOZ_ASSERT(initialized()); assertSameCompartment(cx, this); FrameIter iter(cx, FrameIter::ALL_CONTEXTS, FrameIter::GO_THROUGH_SAVED); @@ -479,7 +479,7 @@ SavedStacks::trace(JSTracer *trc) uint32_t SavedStacks::count() { - JS_ASSERT(initialized()); + MOZ_ASSERT(initialized()); return frames.count(); } @@ -719,7 +719,7 @@ SavedStacks::chooseSamplingProbability(JSContext *cx) for (Debugger **dbgp = dbgs->begin(); dbgp < dbgs->end(); dbgp++) { // The set of debuggers had better not change while we're iterating, // such that the vector gets reallocated. - JS_ASSERT(dbgs->begin() == begin); + MOZ_ASSERT(dbgs->begin() == begin); if ((*dbgp)->trackingAllocationSites && (*dbgp)->enabled) allocationTrackingDbg = *dbgp; diff --git a/js/src/vm/ScopeObject-inl.h b/js/src/vm/ScopeObject-inl.h index e6d5e993b681..64e3b4c7e4b8 100644 --- a/js/src/vm/ScopeObject-inl.h +++ b/js/src/vm/ScopeObject-inl.h @@ -16,14 +16,14 @@ namespace js { inline void ScopeObject::setAliasedVar(JSContext *cx, ScopeCoordinate sc, PropertyName *name, const Value &v) { - JS_ASSERT(is() || is()); + MOZ_ASSERT(is() || is()); JS_STATIC_ASSERT(CallObject::RESERVED_SLOTS == BlockObject::RESERVED_SLOTS); // name may be null if we don't need to track side effects on the object. JS_ASSERT_IF(hasSingletonType(), name); if (hasSingletonType()) { - JS_ASSERT(name); + MOZ_ASSERT(name); types::AddTypePropertyId(cx, this, NameToId(name), v); // Keep track of properties which have ever been overwritten. @@ -39,7 +39,7 @@ ScopeObject::setAliasedVar(JSContext *cx, ScopeCoordinate sc, PropertyName *name inline void CallObject::setAliasedVar(JSContext *cx, AliasedFormalIter fi, PropertyName *name, const Value &v) { - JS_ASSERT(name == fi->name()); + MOZ_ASSERT(name == fi->name()); setSlot(fi.scopeSlot(), v); if (hasSingletonType()) types::AddTypePropertyId(cx, this, NameToId(name), v); @@ -99,8 +99,8 @@ template inline Shape * StaticScopeIter::scopeShape() const { - JS_ASSERT(hasDynamicScopeObject()); - JS_ASSERT(type() != NAMED_LAMBDA); + MOZ_ASSERT(hasDynamicScopeObject()); + MOZ_ASSERT(type() != NAMED_LAMBDA); if (type() == BLOCK) return block().lastProperty(); return funScript()->callObjShape(); @@ -121,7 +121,7 @@ template inline StaticBlockObject & StaticScopeIter::block() const { - JS_ASSERT(type() == BLOCK); + MOZ_ASSERT(type() == BLOCK); return obj->template as(); } @@ -129,7 +129,7 @@ template inline StaticWithObject & StaticScopeIter::staticWith() const { - JS_ASSERT(type() == WITH); + MOZ_ASSERT(type() == WITH); return obj->template as(); } @@ -137,7 +137,7 @@ template inline JSScript * StaticScopeIter::funScript() const { - JS_ASSERT(type() == FUNCTION); + MOZ_ASSERT(type() == FUNCTION); return obj->template as().nonLazyScript(); } @@ -145,7 +145,7 @@ template inline JSFunction & StaticScopeIter::fun() const { - JS_ASSERT(type() == FUNCTION); + MOZ_ASSERT(type() == FUNCTION); return obj->template as(); } diff --git a/js/src/vm/ScopeObject.cpp b/js/src/vm/ScopeObject.cpp index 07fbdf4ec45b..58aa532c690a 100644 --- a/js/src/vm/ScopeObject.cpp +++ b/js/src/vm/ScopeObject.cpp @@ -37,8 +37,8 @@ typedef MutableHandle MutableHandleArgumentsObject; static JSObject * InnermostStaticScope(JSScript *script, jsbytecode *pc) { - JS_ASSERT(script->containsPC(pc)); - JS_ASSERT(JOF_OPTYPE(*pc) == JOF_SCOPECOORD); + MOZ_ASSERT(script->containsPC(pc)); + MOZ_ASSERT(JOF_OPTYPE(*pc) == JOF_SCOPECOORD); NestedScopeObject *scope = script->getStaticScope(pc); if (scope) @@ -52,7 +52,7 @@ js::ScopeCoordinateToStaticScopeShape(JSScript *script, jsbytecode *pc) StaticScopeIter ssi(InnermostStaticScope(script, pc)); uint32_t hops = ScopeCoordinate(pc).hops(); while (true) { - JS_ASSERT(!ssi.done()); + MOZ_ASSERT(!ssi.done()); if (ssi.hasDynamicScopeObject()) { if (!hops) break; @@ -184,14 +184,14 @@ CallObject * CallObject::createTemplateObject(JSContext *cx, HandleScript script, gc::InitialHeap heap) { RootedShape shape(cx, script->bindings.callObjShape()); - JS_ASSERT(shape->getObjectClass() == &class_); + MOZ_ASSERT(shape->getObjectClass() == &class_); RootedTypeObject type(cx, cx->getNewType(&class_, TaggedProto(nullptr))); if (!type) return nullptr; gc::AllocKind kind = gc::GetGCObjectKind(shape->numFixedSlots()); - JS_ASSERT(CanBeFinalizedInBackground(kind, &class_)); + MOZ_ASSERT(CanBeFinalizedInBackground(kind, &class_)); kind = gc::GetBackgroundAllocKind(kind); JSObject *obj = JSObject::create(cx, kind, heap, shape, type); @@ -233,7 +233,7 @@ CallObject * CallObject::createForFunction(JSContext *cx, HandleObject enclosing, HandleFunction callee) { RootedObject scopeChain(cx, enclosing); - JS_ASSERT(scopeChain); + MOZ_ASSERT(scopeChain); /* * For a named function expression Call's parent points to an environment @@ -252,7 +252,7 @@ CallObject::createForFunction(JSContext *cx, HandleObject enclosing, HandleFunct CallObject * CallObject::createForFunction(JSContext *cx, AbstractFramePtr frame) { - JS_ASSERT(frame.isNonEvalFunctionFrame()); + MOZ_ASSERT(frame.isNonEvalFunctionFrame()); assertSameCompartment(cx, frame); RootedObject scopeChain(cx, frame.scopeChain()); @@ -274,7 +274,7 @@ CallObject::createForFunction(JSContext *cx, AbstractFramePtr frame) CallObject * CallObject::createForStrictEval(JSContext *cx, AbstractFramePtr frame) { - JS_ASSERT(frame.isStrictEvalFrame()); + MOZ_ASSERT(frame.isStrictEvalFrame()); JS_ASSERT_IF(frame.isInterpreterFrame(), cx->interpreterFrame() == frame.asInterpreterFrame()); JS_ASSERT_IF(frame.isInterpreterFrame(), cx->interpreterRegs().pc == frame.script()->code()); @@ -317,7 +317,7 @@ const Class DeclEnvObject::class_ = { DeclEnvObject * DeclEnvObject::createTemplateObject(JSContext *cx, HandleFunction fun, gc::InitialHeap heap) { - JS_ASSERT(IsNurseryAllocable(FINALIZE_KIND)); + MOZ_ASSERT(IsNurseryAllocable(FINALIZE_KIND)); RootedTypeObject type(cx, cx->getNewType(&class_, TaggedProto(nullptr))); if (!type) @@ -343,7 +343,7 @@ DeclEnvObject::createTemplateObject(JSContext *cx, HandleFunction fun, gc::Initi return nullptr; } - JS_ASSERT(!obj->hasDynamicSlots()); + MOZ_ASSERT(!obj->hasDynamicSlots()); return &obj->as(); } @@ -420,7 +420,7 @@ DynamicWithObject * DynamicWithObject::create(JSContext *cx, HandleObject object, HandleObject enclosing, HandleObject staticWith) { - JS_ASSERT(staticWith->is()); + MOZ_ASSERT(staticWith->is()); RootedTypeObject type(cx, cx->getNewType(&class_, TaggedProto(staticWith.get()))); if (!type) return nullptr; @@ -610,7 +610,7 @@ ClonedBlockObject * ClonedBlockObject::create(JSContext *cx, Handle block, AbstractFramePtr frame) { assertSameCompartment(cx, frame); - JS_ASSERT(block->getClass() == &BlockObject::class_); + MOZ_ASSERT(block->getClass() == &BlockObject::class_); RootedTypeObject type(cx, cx->getNewType(&BlockObject::class_, TaggedProto(block.get()))); if (!type) @@ -624,14 +624,14 @@ ClonedBlockObject::create(JSContext *cx, Handle block, Abst /* Set the parent if necessary, as for call objects. */ if (&frame.scopeChain()->global() != obj->getParent()) { - JS_ASSERT(obj->getParent() == nullptr); + MOZ_ASSERT(obj->getParent() == nullptr); Rooted global(cx, &frame.scopeChain()->global()); if (!JSObject::setParent(cx, obj, global)) return nullptr; } - JS_ASSERT(!obj->inDictionaryMode()); - JS_ASSERT(obj->slotSpan() >= block->numVariables() + RESERVED_SLOTS); + MOZ_ASSERT(!obj->inDictionaryMode()); + MOZ_ASSERT(obj->slotSpan() >= block->numVariables() + RESERVED_SLOTS); obj->setReservedSlot(SCOPE_CHAIN_SLOT, ObjectValue(*frame.scopeChain())); @@ -647,7 +647,7 @@ ClonedBlockObject::create(JSContext *cx, Handle block, Abst } } - JS_ASSERT(obj->isDelegate()); + MOZ_ASSERT(obj->isDelegate()); return &obj->as(); } @@ -688,8 +688,8 @@ StaticBlockObject::create(ExclusiveContext *cx) StaticBlockObject::addVar(ExclusiveContext *cx, Handle block, HandleId id, unsigned index, bool *redeclared) { - JS_ASSERT(JSID_IS_ATOM(id)); - JS_ASSERT(index < LOCAL_INDEX_LIMIT); + MOZ_ASSERT(JSID_IS_ATOM(id)); + MOZ_ASSERT(index < LOCAL_INDEX_LIMIT); *redeclared = false; @@ -779,7 +779,7 @@ js::XDRStaticBlockObject(XDRState *xdr, HandleObject enclosingScope, bool redeclared; if (!StaticBlockObject::addVar(cx, obj, id, i, &redeclared)) { - JS_ASSERT(!redeclared); + MOZ_ASSERT(!redeclared); return false; } @@ -787,7 +787,7 @@ js::XDRStaticBlockObject(XDRState *xdr, HandleObject enclosingScope, if (!xdr->codeUint32(&aliased)) return false; - JS_ASSERT(aliased == 0 || aliased == 1); + MOZ_ASSERT(aliased == 0 || aliased == 1); obj->setAliased(i, !!aliased); } } else { @@ -803,11 +803,11 @@ js::XDRStaticBlockObject(XDRState *xdr, HandleObject enclosingScope, RootedAtom atom(cx); for (unsigned i = 0; i < count; i++) { shape = shapes[i]; - JS_ASSERT(shape->hasDefaultGetter()); - JS_ASSERT(obj->shapeToIndex(*shape) == i); + MOZ_ASSERT(shape->hasDefaultGetter()); + MOZ_ASSERT(obj->shapeToIndex(*shape) == i); propid = shape->propid(); - JS_ASSERT(JSID_IS_ATOM(propid) || JSID_IS_INT(propid)); + MOZ_ASSERT(JSID_IS_ATOM(propid) || JSID_IS_INT(propid)); atom = JSID_IS_ATOM(propid) ? JSID_TO_ATOM(propid) @@ -855,7 +855,7 @@ CloneStaticBlockObject(JSContext *cx, HandleObject enclosingScope, Handleas(); } ScopeIter & ScopeIter::operator++() { - JS_ASSERT(!done()); + MOZ_ASSERT(!done()); switch (type_) { case Call: if (hasScopeObject_) { @@ -1128,15 +1128,15 @@ ScopeIter::operator++() frame_ = NullFramePtr(); break; case Block: - JS_ASSERT(staticScope_ && staticScope_->is()); + MOZ_ASSERT(staticScope_ && staticScope_->is()); staticScope_ = staticScope_->as().enclosingNestedScope(); if (hasScopeObject_) cur_ = &cur_->as().enclosingScope(); settle(); break; case With: - JS_ASSERT(staticScope_ && staticScope_->is()); - JS_ASSERT(hasScopeObject_); + MOZ_ASSERT(staticScope_ && staticScope_->is()); + MOZ_ASSERT(hasScopeObject_); staticScope_ = staticScope_->as().enclosingNestedScope(); cur_ = &cur_->as().enclosingScope(); settle(); @@ -1180,7 +1180,7 @@ ScopeIter::settle() if (staticScope_) { // If staticScope_ were a StaticWithObject, the function would be // heavyweight. - JS_ASSERT(staticScope_->is()); + MOZ_ASSERT(staticScope_->is()); type_ = Block; hasScopeObject_ = staticScope_->as().needsClone(); } else { @@ -1189,23 +1189,23 @@ ScopeIter::settle() } } else if (frame_.isNonStrictDirectEvalFrame() && cur_ == frame_.evalPrevScopeChain(cx)) { if (staticScope_) { - JS_ASSERT(staticScope_->is()); - JS_ASSERT(!staticScope_->as().needsClone()); + MOZ_ASSERT(staticScope_->is()); + MOZ_ASSERT(!staticScope_->as().needsClone()); type_ = Block; hasScopeObject_ = false; } else { frame_ = NullFramePtr(); } } else if (frame_.isNonEvalFunctionFrame() && !frame_.hasCallObj()) { - JS_ASSERT(cur_ == frame_.fun()->environment()); + MOZ_ASSERT(cur_ == frame_.fun()->environment()); frame_ = NullFramePtr(); } else if (frame_.isStrictEvalFrame() && !frame_.hasCallObj()) { - JS_ASSERT(cur_ == frame_.evalPrevScopeChain(cx)); + MOZ_ASSERT(cur_ == frame_.evalPrevScopeChain(cx)); frame_ = NullFramePtr(); } else if (staticScope_) { if (staticScope_->is()) { - JS_ASSERT(cur_); - JS_ASSERT(cur_->as().staticScope() == staticScope_); + MOZ_ASSERT(cur_); + MOZ_ASSERT(cur_->as().staticScope() == staticScope_); type_ = With; hasScopeObject_ = true; } else { @@ -1220,8 +1220,8 @@ ScopeIter::settle() hasScopeObject_ = true; JS_ASSERT_IF(type_ == Call, callobj.callee().nonLazyScript() == frame_.script()); } else { - JS_ASSERT(!cur_->is()); - JS_ASSERT(frame_.isGlobalFrame() || frame_.isDebuggerFrame()); + MOZ_ASSERT(!cur_->is()); + MOZ_ASSERT(frame_.isGlobalFrame() || frame_.isDebuggerFrame()); frame_ = NullFramePtr(); } } @@ -1327,7 +1327,7 @@ class DebugScopeProxy : public BaseProxyHandler Handle scope, jsid id, Action action, MutableHandleValue vp, AccessResult *accessResult) const { - JS_ASSERT(&debugScope->scope() == scope); + MOZ_ASSERT(&debugScope->scope() == scope); *accessResult = ACCESS_GENERIC; ScopeIterVal *maybeLiveScope = DebugScopes::hasLiveScope(*scope); @@ -1369,7 +1369,7 @@ class DebugScopeProxy : public BaseProxyHandler } } } else { - JS_ASSERT(bi->kind() == Binding::ARGUMENT); + MOZ_ASSERT(bi->kind() == Binding::ARGUMENT); unsigned i = bi.frameIndex(); if (script->formalIsAliased(i)) return true; @@ -1422,7 +1422,7 @@ class DebugScopeProxy : public BaseProxyHandler if (maybeLiveScope) { AbstractFramePtr frame = maybeLiveScope->frame(); uint32_t local = block->staticBlock().blockIndexToLocalIndex(i); - JS_ASSERT(local < frame.script()->nfixed()); + MOZ_ASSERT(local < frame.script()->nfixed()); if (action == GET) vp.set(frame.unaliasedLocal(local)); else @@ -1439,8 +1439,8 @@ class DebugScopeProxy : public BaseProxyHandler } /* The rest of the internal scopes do not have unaliased vars. */ - JS_ASSERT(scope->is() || scope->is() || - scope->as().isForEval()); + MOZ_ASSERT(scope->is() || scope->is() || + scope->as().isForEval()); return true; } @@ -1772,14 +1772,14 @@ const DebugScopeProxy DebugScopeProxy::singleton; /* static */ DebugScopeObject * DebugScopeObject::create(JSContext *cx, ScopeObject &scope, HandleObject enclosing) { - JS_ASSERT(scope.compartment() == cx->compartment()); + MOZ_ASSERT(scope.compartment() == cx->compartment()); RootedValue priv(cx, ObjectValue(scope)); JSObject *obj = NewProxyObject(cx, &DebugScopeProxy::singleton, priv, nullptr /* proto */, &scope.global()); if (!obj) return nullptr; - JS_ASSERT(!enclosing->is()); + MOZ_ASSERT(!enclosing->is()); DebugScopeObject *debugScope = &obj->as(); debugScope->setExtra(ENCLOSING_EXTRA, ObjectValue(*enclosing)); @@ -1803,14 +1803,14 @@ DebugScopeObject::enclosingScope() const JSObject * DebugScopeObject::maybeSnapshot() const { - JS_ASSERT(!scope().as().isForEval()); + MOZ_ASSERT(!scope().as().isForEval()); return extra(SNAPSHOT_EXTRA).toObjectOrNull(); } void DebugScopeObject::initSnapshot(JSObject &o) { - JS_ASSERT(maybeSnapshot() == nullptr); + MOZ_ASSERT(maybeSnapshot() == nullptr); setExtra(SNAPSHOT_EXTRA, ObjectValue(o)); } @@ -1831,7 +1831,7 @@ DebugScopeObject::getMaybeSentinelValue(JSContext *cx, HandleId id, MutableHandl bool js_IsDebugScopeSlow(ProxyObject *proxy) { - JS_ASSERT(proxy->hasClass(&ProxyObject::class_)); + MOZ_ASSERT(proxy->hasClass(&ProxyObject::class_)); return proxy->handler() == &DebugScopeProxy::singleton; } @@ -1917,7 +1917,7 @@ DebugScopes::DebugScopes(JSContext *cx) DebugScopes::~DebugScopes() { - JS_ASSERT(missingScopes.empty()); + MOZ_ASSERT(missingScopes.empty()); WeakMapBase::removeWeakMapFromList(&proxiedScopes); } @@ -2065,7 +2065,7 @@ DebugScopes::hasDebugScope(JSContext *cx, ScopeObject &scope) return nullptr; if (ObjectWeakMap::Ptr p = scopes->proxiedScopes.lookup(&scope)) { - JS_ASSERT(CanUseDebugScopeMaps(cx)); + MOZ_ASSERT(CanUseDebugScopeMaps(cx)); return &p->value()->as(); } @@ -2075,8 +2075,8 @@ DebugScopes::hasDebugScope(JSContext *cx, ScopeObject &scope) bool DebugScopes::addDebugScope(JSContext *cx, ScopeObject &scope, DebugScopeObject &debugScope) { - JS_ASSERT(cx->compartment() == scope.compartment()); - JS_ASSERT(cx->compartment() == debugScope.compartment()); + MOZ_ASSERT(cx->compartment() == scope.compartment()); + MOZ_ASSERT(cx->compartment() == debugScope.compartment()); if (!CanUseDebugScopeMaps(cx)) return true; @@ -2085,7 +2085,7 @@ DebugScopes::addDebugScope(JSContext *cx, ScopeObject &scope, DebugScopeObject & if (!scopes) return false; - JS_ASSERT(!scopes->proxiedScopes.has(&scope)); + MOZ_ASSERT(!scopes->proxiedScopes.has(&scope)); if (!scopes->proxiedScopes.put(&scope, &debugScope)) { js_ReportOutOfMemory(cx); return false; @@ -2098,14 +2098,14 @@ DebugScopes::addDebugScope(JSContext *cx, ScopeObject &scope, DebugScopeObject & DebugScopeObject * DebugScopes::hasDebugScope(JSContext *cx, const ScopeIter &si) { - JS_ASSERT(!si.hasScopeObject()); + MOZ_ASSERT(!si.hasScopeObject()); DebugScopes *scopes = cx->compartment()->debugScopes; if (!scopes) return nullptr; if (MissingScopeMap::Ptr p = scopes->missingScopes.lookup(ScopeIterKey(si))) { - JS_ASSERT(CanUseDebugScopeMaps(cx)); + MOZ_ASSERT(CanUseDebugScopeMaps(cx)); return p->value(); } return nullptr; @@ -2114,8 +2114,8 @@ DebugScopes::hasDebugScope(JSContext *cx, const ScopeIter &si) bool DebugScopes::addDebugScope(JSContext *cx, const ScopeIter &si, DebugScopeObject &debugScope) { - JS_ASSERT(!si.hasScopeObject()); - JS_ASSERT(cx->compartment() == debugScope.compartment()); + MOZ_ASSERT(!si.hasScopeObject()); + MOZ_ASSERT(cx->compartment() == debugScope.compartment()); JS_ASSERT_IF(si.frame().isFunctionFrame(), !si.frame().callee()->isGenerator()); if (!CanUseDebugScopeMaps(cx)) @@ -2125,14 +2125,14 @@ DebugScopes::addDebugScope(JSContext *cx, const ScopeIter &si, DebugScopeObject if (!scopes) return false; - JS_ASSERT(!scopes->missingScopes.has(ScopeIterKey(si))); + MOZ_ASSERT(!scopes->missingScopes.has(ScopeIterKey(si))); if (!scopes->missingScopes.put(ScopeIterKey(si), ReadBarriered(&debugScope))) { js_ReportOutOfMemory(cx); return false; } missingScopesPostWriteBarrier(cx->runtime(), &scopes->missingScopes, ScopeIterKey(si)); - JS_ASSERT(!scopes->liveScopes.has(&debugScope.scope())); + MOZ_ASSERT(!scopes->liveScopes.has(&debugScope.scope())); if (!scopes->liveScopes.put(&debugScope.scope(), ScopeIterVal(si))) { js_ReportOutOfMemory(cx); return false; @@ -2145,7 +2145,7 @@ DebugScopes::addDebugScope(JSContext *cx, const ScopeIter &si, DebugScopeObject void DebugScopes::onPopCall(AbstractFramePtr frame, JSContext *cx) { - JS_ASSERT(!frame.isYielding()); + MOZ_ASSERT(!frame.isYielding()); assertSameCompartment(cx, frame); DebugScopes *scopes = cx->compartment()->debugScopes; @@ -2241,7 +2241,7 @@ DebugScopes::onPopBlock(JSContext *cx, const ScopeIter &si) if (!scopes) return; - JS_ASSERT(si.type() == ScopeIter::Block); + MOZ_ASSERT(si.type() == ScopeIter::Block); if (si.staticBlock().needsClone()) { ClonedBlockObject &clone = si.scope().as(); @@ -2320,7 +2320,7 @@ DebugScopes::updateLiveScopes(JSContext *cx) for (ScopeIter si(frame, i.pc(), cx); !si.done(); ++si) { if (si.hasScopeObject()) { - JS_ASSERT(si.scope().compartment() == cx->compartment()); + MOZ_ASSERT(si.scope().compartment() == cx->compartment()); DebugScopes *scopes = ensureCompartmentData(cx); if (!scopes) return false; @@ -2332,7 +2332,7 @@ DebugScopes::updateLiveScopes(JSContext *cx) if (frame.prevUpToDate()) return true; - JS_ASSERT(frame.scopeChain()->compartment()->debugMode()); + MOZ_ASSERT(frame.scopeChain()->compartment()->debugMode()); frame.setPrevUpToDate(); } @@ -2369,7 +2369,7 @@ GetDebugScopeForScope(JSContext *cx, Handle scope, const ScopeIter JSObject &maybeDecl = scope->enclosingScope(); if (maybeDecl.is()) { - JS_ASSERT(CallObjectLambdaName(scope->as().callee())); + MOZ_ASSERT(CallObjectLambdaName(scope->as().callee())); enclosingDebug = DebugScopeObject::create(cx, maybeDecl.as(), enclosingDebug); if (!enclosingDebug) return nullptr; @@ -2411,13 +2411,13 @@ GetDebugScopeForMissing(JSContext *cx, const ScopeIter &si) switch (si.type()) { case ScopeIter::Call: { // Generators should always reify their scopes. - JS_ASSERT(!si.frame().callee()->isGenerator()); + MOZ_ASSERT(!si.frame().callee()->isGenerator()); Rooted callobj(cx, CallObject::createForFunction(cx, si.frame())); if (!callobj) return nullptr; if (callobj->enclosingScope().is()) { - JS_ASSERT(CallObjectLambdaName(callobj->callee())); + MOZ_ASSERT(CallObjectLambdaName(callobj->callee())); DeclEnvObject &declenv = callobj->enclosingScope().as(); enclosingDebug = DebugScopeObject::create(cx, declenv, enclosingDebug); if (!enclosingDebug) @@ -2464,7 +2464,7 @@ GetDebugScope(JSContext *cx, JSObject &obj) #ifdef DEBUG JSObject *o = &obj; while ((o = o->enclosingScope())) - JS_ASSERT(!o->is()); + MOZ_ASSERT(!o->is()); #endif return &obj; } @@ -2499,7 +2499,7 @@ JSObject * js::GetDebugScopeForFunction(JSContext *cx, HandleFunction fun) { assertSameCompartment(cx, fun); - JS_ASSERT(cx->compartment()->debugMode()); + MOZ_ASSERT(cx->compartment()->debugMode()); if (!DebugScopes::updateLiveScopes(cx)) return nullptr; return GetDebugScope(cx, *fun->environment()); diff --git a/js/src/vm/ScopeObject.h b/js/src/vm/ScopeObject.h index 3de85da9f4e4..c69566aebd66 100644 --- a/js/src/vm/ScopeObject.h +++ b/js/src/vm/ScopeObject.h @@ -120,16 +120,16 @@ class ScopeCoordinate explicit inline ScopeCoordinate(jsbytecode *pc) : hops_(GET_SCOPECOORD_HOPS(pc)), slot_(GET_SCOPECOORD_SLOT(pc + SCOPECOORD_HOPS_LEN)) { - JS_ASSERT(JOF_OPTYPE(*pc) == JOF_SCOPECOORD); + MOZ_ASSERT(JOF_OPTYPE(*pc) == JOF_SCOPECOORD); } inline ScopeCoordinate() {} - void setHops(uint32_t hops) { JS_ASSERT(hops < SCOPECOORD_HOPS_LIMIT); hops_ = hops; } - void setSlot(uint32_t slot) { JS_ASSERT(slot < SCOPECOORD_SLOT_LIMIT); slot_ = slot; } + void setHops(uint32_t hops) { MOZ_ASSERT(hops < SCOPECOORD_HOPS_LIMIT); hops_ = hops; } + void setSlot(uint32_t slot) { MOZ_ASSERT(slot < SCOPECOORD_SLOT_LIMIT); slot_ = slot; } - uint32_t hops() const { JS_ASSERT(hops_ < SCOPECOORD_HOPS_LIMIT); return hops_; } - uint32_t slot() const { JS_ASSERT(slot_ < SCOPECOORD_SLOT_LIMIT); return slot_; } + uint32_t hops() const { MOZ_ASSERT(hops_ < SCOPECOORD_HOPS_LIMIT); return hops_; } + uint32_t slot() const { MOZ_ASSERT(slot_ < SCOPECOORD_SLOT_LIMIT); return slot_; } bool operator==(const ScopeCoordinate &rhs) const { return hops() == rhs.hops() && slot() == rhs.slot(); @@ -270,7 +270,7 @@ class CallObject : public ScopeObject /* True if this is for a strict mode eval frame. */ bool isForEval() const { - JS_ASSERT(getFixedSlot(CALLEE_SLOT).isObjectOrNull()); + MOZ_ASSERT(getFixedSlot(CALLEE_SLOT).isObjectOrNull()); JS_ASSERT_IF(getFixedSlot(CALLEE_SLOT).isObject(), getFixedSlot(CALLEE_SLOT).toObject().is()); return getFixedSlot(CALLEE_SLOT).isNull(); @@ -350,7 +350,7 @@ class NestedScopeObject : public ScopeObject // Return the static scope corresponding to this scope chain object. inline NestedScopeObject* staticScope() { - JS_ASSERT(!isStatic()); + MOZ_ASSERT(!isStatic()); return &getProto()->as(); } @@ -360,7 +360,7 @@ class NestedScopeObject : public ScopeObject } void initEnclosingNestedScope(JSObject *obj) { - JS_ASSERT(getReservedSlot(SCOPE_CHAIN_SLOT).isUndefined()); + MOZ_ASSERT(getReservedSlot(SCOPE_CHAIN_SLOT).isUndefined()); setReservedSlot(SCOPE_CHAIN_SLOT, ObjectOrNullValue(obj)); } @@ -481,7 +481,7 @@ class StaticBlockObject : public BlockObject */ uint32_t shapeToIndex(const Shape &shape) { uint32_t slot = shape.slot(); - JS_ASSERT(slot - RESERVED_SLOTS < numVariables()); + MOZ_ASSERT(slot - RESERVED_SLOTS < numVariables()); return slot - RESERVED_SLOTS; } @@ -498,7 +498,7 @@ class StaticBlockObject : public BlockObject // Return the local corresponding to the 'var'th binding where 'var' is in the // range [0, numVariables()). uint32_t blockIndexToLocalIndex(uint32_t index) { - JS_ASSERT(index < numVariables()); + MOZ_ASSERT(index < numVariables()); return getReservedSlot(LOCAL_OFFSET_SLOT).toPrivateUint32() + index; } @@ -506,9 +506,9 @@ class StaticBlockObject : public BlockObject // in the range [localOffset(), localOffset() + numVariables()). The result is // in the range [RESERVED_SLOTS, RESERVED_SLOTS + numVariables()). uint32_t localIndexToSlot(uint32_t local) { - JS_ASSERT(local >= localOffset()); + MOZ_ASSERT(local >= localOffset()); local -= localOffset(); - JS_ASSERT(local < numVariables()); + MOZ_ASSERT(local < numVariables()); return RESERVED_SLOTS + local; } @@ -536,12 +536,12 @@ class StaticBlockObject : public BlockObject setSlotValue(i, BooleanValue(aliased)); if (aliased && !needsClone()) { setSlotValue(0, MagicValue(JS_BLOCK_NEEDS_CLONE)); - JS_ASSERT(needsClone()); + MOZ_ASSERT(needsClone()); } } void setLocalOffset(uint32_t offset) { - JS_ASSERT(getReservedSlot(LOCAL_OFFSET_SLOT).isUndefined()); + MOZ_ASSERT(getReservedSlot(LOCAL_OFFSET_SLOT).isUndefined()); initReservedSlot(LOCAL_OFFSET_SLOT, PrivateUint32Value(offset)); } @@ -550,7 +550,7 @@ class StaticBlockObject : public BlockObject * a let var to its associated Definition parse node. */ void setDefinitionParseNode(unsigned i, frontend::Definition *def) { - JS_ASSERT(slotValue(i).isUndefined()); + MOZ_ASSERT(slotValue(i).isUndefined()); setSlotValue(i, PrivateValue(def)); } @@ -702,20 +702,20 @@ class ScopeIter /* If done(): */ - JSObject &enclosingScope() const { JS_ASSERT(done()); return *cur_; } + JSObject &enclosingScope() const { MOZ_ASSERT(done()); return *cur_; } /* If !done(): */ ScopeIter &operator++(); - AbstractFramePtr frame() const { JS_ASSERT(!done()); return frame_; } - Type type() const { JS_ASSERT(!done()); return type_; } - bool hasScopeObject() const { JS_ASSERT(!done()); return hasScopeObject_; } + AbstractFramePtr frame() const { MOZ_ASSERT(!done()); return frame_; } + Type type() const { MOZ_ASSERT(!done()); return type_; } + bool hasScopeObject() const { MOZ_ASSERT(!done()); return hasScopeObject_; } ScopeObject &scope() const; NestedScopeObject* staticScope() const { return staticScope_; } StaticBlockObject &staticBlock() const { - JS_ASSERT(type() == Block); + MOZ_ASSERT(type() == Block); return staticScope_->as(); } @@ -981,7 +981,7 @@ namespace js { inline const Value & ScopeObject::aliasedVar(ScopeCoordinate sc) { - JS_ASSERT(is() || is()); + MOZ_ASSERT(is() || is()); return getSlot(sc.slot()); } diff --git a/js/src/vm/SelfHosting.cpp b/js/src/vm/SelfHosting.cpp index 264287e3d51a..954d1baf9875 100644 --- a/js/src/vm/SelfHosting.cpp +++ b/js/src/vm/SelfHosting.cpp @@ -129,12 +129,12 @@ bool js::intrinsic_ThrowError(JSContext *cx, unsigned argc, Value *vp) { CallArgs args = CallArgsFromVp(argc, vp); - JS_ASSERT(args.length() >= 1); + MOZ_ASSERT(args.length() >= 1); uint32_t errorNumber = args[0].toInt32(); #ifdef DEBUG const JSErrorFormatString *efs = js_GetErrorMessage(nullptr, errorNumber); - JS_ASSERT(efs->argCount == args.length() - 1); + MOZ_ASSERT(efs->argCount == args.length() - 1); #endif JSAutoByteString errorArgs[3]; @@ -178,7 +178,7 @@ intrinsic_AssertionFailed(JSContext *cx, unsigned argc, Value *vp) } } #endif - JS_ASSERT(false); + MOZ_ASSERT(false); return false; } @@ -186,10 +186,10 @@ static bool intrinsic_MakeConstructible(JSContext *cx, unsigned argc, Value *vp) { CallArgs args = CallArgsFromVp(argc, vp); - JS_ASSERT(args.length() == 2); - JS_ASSERT(args[0].isObject()); - JS_ASSERT(args[0].toObject().is()); - JS_ASSERT(args[1].isObject()); + MOZ_ASSERT(args.length() == 2); + MOZ_ASSERT(args[0].isObject()); + MOZ_ASSERT(args[0].toObject().is()); + MOZ_ASSERT(args[1].isObject()); // Normal .prototype properties aren't enumerable. But for this to clone // correctly, it must be enumerable. @@ -218,7 +218,7 @@ static bool intrinsic_DecompileArg(JSContext *cx, unsigned argc, Value *vp) { CallArgs args = CallArgsFromVp(argc, vp); - JS_ASSERT(args.length() == 2); + MOZ_ASSERT(args.length() == 2); RootedValue value(cx, args[1]); ScopedJSFreePtr str(DecompileArgument(cx, args[0].toInt32(), value)); @@ -250,9 +250,9 @@ static bool intrinsic_SetScriptHints(JSContext *cx, unsigned argc, Value *vp) { CallArgs args = CallArgsFromVp(argc, vp); - JS_ASSERT(args.length() >= 2); - JS_ASSERT(args[0].isObject() && args[0].toObject().is()); - JS_ASSERT(args[1].isObject()); + MOZ_ASSERT(args.length() >= 2); + MOZ_ASSERT(args[0].isObject() && args[0].toObject().is()); + MOZ_ASSERT(args[1].isObject()); RootedFunction fun(cx, &args[0].toObject().as()); RootedScript funScript(cx, fun->getOrCreateScript(cx)); @@ -303,8 +303,8 @@ bool intrinsic_ParallelSpew(ThreadSafeContext *cx, unsigned argc, Value *vp) { CallArgs args = CallArgsFromVp(argc, vp); - JS_ASSERT(args.length() == 1); - JS_ASSERT(args[0].isString()); + MOZ_ASSERT(args.length() == 1); + MOZ_ASSERT(args[0].isString()); AutoCheckCannotGC nogc; ScopedThreadSafeStringInspector inspector(args[0].toString()); @@ -428,7 +428,7 @@ js::intrinsic_NewDenseArray(JSContext *cx, unsigned argc, Value *vp) return true; case JSObject::ED_SPARSE: // shouldn't happen! - JS_ASSERT(!"%EnsureDenseArrayElements() would yield sparse array"); + MOZ_ASSERT(!"%EnsureDenseArrayElements() would yield sparse array"); JS_ReportError(cx, "%EnsureDenseArrayElements() would yield sparse array"); break; @@ -465,9 +465,9 @@ js::intrinsic_UnsafePutElements(JSContext *cx, unsigned argc, Value *vp) uint32_t idxi = base+1; uint32_t elemi = base+2; - JS_ASSERT(args[arri].isObject()); - JS_ASSERT(args[arri].toObject().isNative() || IsTypedObjectArray(args[arri].toObject())); - JS_ASSERT(args[idxi].isInt32()); + MOZ_ASSERT(args[arri].isObject()); + MOZ_ASSERT(args[arri].toObject().isNative() || IsTypedObjectArray(args[arri].toObject())); + MOZ_ASSERT(args[idxi].isInt32()); RootedObject arrobj(cx, &args[arri].toObject()); uint32_t idx = args[idxi].toInt32(); @@ -480,7 +480,7 @@ js::intrinsic_UnsafePutElements(JSContext *cx, unsigned argc, Value *vp) if (!JSObject::setElement(cx, arrobj, arrobj, idx, &tmp, false)) return false; } else { - JS_ASSERT(idx < arrobj->getDenseInitializedLength()); + MOZ_ASSERT(idx < arrobj->getDenseInitializedLength()); arrobj->setDenseElementWithType(cx, idx, args[elemi]); } } @@ -533,9 +533,9 @@ bool js::intrinsic_UnsafeSetReservedSlot(JSContext *cx, unsigned argc, Value *vp) { CallArgs args = CallArgsFromVp(argc, vp); - JS_ASSERT(args.length() == 3); - JS_ASSERT(args[0].isObject()); - JS_ASSERT(args[1].isInt32()); + MOZ_ASSERT(args.length() == 3); + MOZ_ASSERT(args[0].isObject()); + MOZ_ASSERT(args[1].isInt32()); args[0].toObject().setReservedSlot(args[1].toPrivateUint32(), args[2]); args.rval().setUndefined(); @@ -546,9 +546,9 @@ bool js::intrinsic_UnsafeGetReservedSlot(JSContext *cx, unsigned argc, Value *vp) { CallArgs args = CallArgsFromVp(argc, vp); - JS_ASSERT(args.length() == 2); - JS_ASSERT(args[0].isObject()); - JS_ASSERT(args[1].isInt32()); + MOZ_ASSERT(args.length() == 2); + MOZ_ASSERT(args[0].isObject()); + MOZ_ASSERT(args[1].isInt32()); args.rval().set(args[0].toObject().getReservedSlot(args[1].toPrivateUint32())); return true; @@ -558,9 +558,9 @@ bool js::intrinsic_HaveSameClass(JSContext *cx, unsigned argc, Value *vp) { CallArgs args = CallArgsFromVp(argc, vp); - JS_ASSERT(args.length() == 2); - JS_ASSERT(args[0].isObject()); - JS_ASSERT(args[1].isObject()); + MOZ_ASSERT(args.length() == 2); + MOZ_ASSERT(args[0].isObject()); + MOZ_ASSERT(args[1].isObject()); args.rval().setBoolean(args[0].toObject().getClass() == args[1].toObject().getClass()); return true; @@ -570,8 +570,8 @@ bool js::intrinsic_IsPackedArray(JSContext *cx, unsigned argc, Value *vp) { CallArgs args = CallArgsFromVp(argc, vp); - JS_ASSERT(args.length() == 1); - JS_ASSERT(args[0].isObject()); + MOZ_ASSERT(args.length() == 1); + MOZ_ASSERT(args[0].isObject()); JSObject *obj = &args[0].toObject(); bool isPacked = obj->is() && !obj->hasLazyType() && @@ -586,7 +586,7 @@ static bool intrinsic_GetIteratorPrototype(JSContext *cx, unsigned argc, Value *vp) { CallArgs args = CallArgsFromVp(argc, vp); - JS_ASSERT(args.length() == 0); + MOZ_ASSERT(args.length() == 0); JSObject *obj = GlobalObject::getOrCreateIteratorPrototype(cx, cx->global()); if (!obj) @@ -600,7 +600,7 @@ static bool intrinsic_NewArrayIterator(JSContext *cx, unsigned argc, Value *vp) { CallArgs args = CallArgsFromVp(argc, vp); - JS_ASSERT(args.length() == 0); + MOZ_ASSERT(args.length() == 0); RootedObject proto(cx, GlobalObject::getOrCreateArrayIteratorPrototype(cx, cx->global())); if (!proto) @@ -618,8 +618,8 @@ static bool intrinsic_IsArrayIterator(JSContext *cx, unsigned argc, Value *vp) { CallArgs args = CallArgsFromVp(argc, vp); - JS_ASSERT(args.length() == 1); - JS_ASSERT(args[0].isObject()); + MOZ_ASSERT(args.length() == 1); + MOZ_ASSERT(args[0].isObject()); args.rval().setBoolean(args[0].toObject().is()); return true; @@ -629,7 +629,7 @@ static bool intrinsic_NewStringIterator(JSContext *cx, unsigned argc, Value *vp) { CallArgs args = CallArgsFromVp(argc, vp); - JS_ASSERT(args.length() == 0); + MOZ_ASSERT(args.length() == 0); RootedObject proto(cx, GlobalObject::getOrCreateStringIteratorPrototype(cx, cx->global())); if (!proto) @@ -647,8 +647,8 @@ static bool intrinsic_IsStringIterator(JSContext *cx, unsigned argc, Value *vp) { CallArgs args = CallArgsFromVp(argc, vp); - JS_ASSERT(args.length() == 1); - JS_ASSERT(args[0].isObject()); + MOZ_ASSERT(args.length() == 1); + MOZ_ASSERT(args[0].isObject()); args.rval().setBoolean(args[0].toObject().is()); return true; @@ -658,8 +658,8 @@ static bool intrinsic_IsWeakSet(JSContext *cx, unsigned argc, Value *vp) { CallArgs args = CallArgsFromVp(argc, vp); - JS_ASSERT(args.length() == 1); - JS_ASSERT(args[0].isObject()); + MOZ_ASSERT(args.length() == 1); + MOZ_ASSERT(args[0].isObject()); args.rval().setBoolean(args[0].toObject().is()); return true; @@ -1057,7 +1057,7 @@ js::FillSelfHostingCompileOptions(CompileOptions &options) bool JSRuntime::initSelfHosting(JSContext *cx) { - JS_ASSERT(!selfHostingGlobal_); + MOZ_ASSERT(!selfHostingGlobal_); if (cx->runtime()->parentRuntime) { selfHostingGlobal_ = cx->runtime()->parentRuntime->selfHostingGlobal_; @@ -1163,7 +1163,7 @@ GetUnclonedValue(JSContext *cx, HandleObject selfHostedObject, HandleId id, Muta // see such atoms when code is looking for properties on the self // hosted global which aren't present. if (JSID_IS_STRING(id) && !JSID_TO_STRING(id)->isPermanentAtom()) { - JS_ASSERT(selfHostedObject->is()); + MOZ_ASSERT(selfHostedObject->is()); RootedValue value(cx, IdToValue(id)); return js_ReportValueErrorFlags(cx, JSREPORT_ERROR, JSMSG_NO_SUCH_SELF_HOSTED_PROP, JSDVG_IGNORE_STACK, value, NullPtr(), nullptr, nullptr); @@ -1176,7 +1176,7 @@ GetUnclonedValue(JSContext *cx, HandleObject selfHostedObject, HandleId id, Muta JSDVG_IGNORE_STACK, value, NullPtr(), nullptr, nullptr); } - JS_ASSERT(shape->hasSlot() && shape->hasDefaultGetter()); + MOZ_ASSERT(shape->hasSlot() && shape->hasDefaultGetter()); vp.set(selfHostedObject->getSlot(shape->slot())); return true; } @@ -1256,7 +1256,7 @@ CloneObject(JSContext *cx, HandleObject selfHostedObject) RootedFunction selfHostedFunction(cx, &selfHostedObject->as()); bool hasName = selfHostedFunction->atom() != nullptr; // Arrow functions use the first extended slot for their lexical |this| value. - JS_ASSERT(!selfHostedFunction->isArrow()); + MOZ_ASSERT(!selfHostedFunction->isArrow()); js::gc::AllocKind kind = hasName ? JSFunction::ExtendedFinalizeKind : selfHostedFunction->getAllocKind(); @@ -1268,7 +1268,7 @@ CloneObject(JSContext *cx, HandleObject selfHostedObject) } else if (selfHostedObject->is()) { RegExpObject &reobj = selfHostedObject->as(); RootedAtom source(cx, reobj.getSource()); - JS_ASSERT(source->isPermanentAtom()); + MOZ_ASSERT(source->isPermanentAtom()); clone = RegExpObject::createNoStatics(cx, source, reobj.getFlags(), nullptr, cx->tempLifoAlloc()); } else if (selfHostedObject->is()) { clone = JS_NewDateObjectMsec(cx, selfHostedObject->as().UTCTime().toNumber()); @@ -1287,7 +1287,7 @@ CloneObject(JSContext *cx, HandleObject selfHostedObject) } else if (selfHostedObject->is()) { clone = NewDenseEmptyArray(cx, nullptr, TenuredObject); } else { - JS_ASSERT(selfHostedObject->isNative()); + MOZ_ASSERT(selfHostedObject->isNative()); clone = NewObjectWithGivenProto(cx, selfHostedObject->getClass(), TaggedProto(nullptr), cx->global(), selfHostedObject->asTenured()->getAllocKind(), SingletonObject); @@ -1337,22 +1337,22 @@ JSRuntime::cloneSelfHostedFunctionScript(JSContext *cx, HandlePropertyName name, RootedFunction sourceFun(cx, &funVal.toObject().as()); // JSFunction::generatorKind can't handle lazy self-hosted functions, so we make sure there // aren't any. - JS_ASSERT(!sourceFun->isGenerator()); + MOZ_ASSERT(!sourceFun->isGenerator()); RootedScript sourceScript(cx, sourceFun->getOrCreateScript(cx)); if (!sourceScript) return false; - JS_ASSERT(!sourceScript->enclosingStaticScope()); + MOZ_ASSERT(!sourceScript->enclosingStaticScope()); JSScript *cscript = CloneScript(cx, NullPtr(), targetFun, sourceScript); if (!cscript) return false; cscript->setFunction(targetFun); - JS_ASSERT(sourceFun->nargs() == targetFun->nargs()); + MOZ_ASSERT(sourceFun->nargs() == targetFun->nargs()); // The target function might have been relazified after it's flags changed. targetFun->setFlags((targetFun->flags() & ~JSFunction::INTERPRETED_LAZY) | sourceFun->flags() | JSFunction::EXTENDED); targetFun->setScript(cscript); - JS_ASSERT(targetFun->isExtended()); + MOZ_ASSERT(targetFun->isExtended()); return true; } @@ -1384,8 +1384,8 @@ js::SelfHostedFunction(JSContext *cx, HandlePropertyName propName) if (!GlobalObject::getIntrinsicValue(cx, cx->global(), propName, &func)) return nullptr; - JS_ASSERT(func.isObject()); - JS_ASSERT(func.toObject().is()); + MOZ_ASSERT(func.isObject()); + MOZ_ASSERT(func.toObject().is()); return &func.toObject().as(); } diff --git a/js/src/vm/Shape-inl.h b/js/src/vm/Shape-inl.h index ff8f3541d0aa..e58b0813271a 100644 --- a/js/src/vm/Shape-inl.h +++ b/js/src/vm/Shape-inl.h @@ -39,7 +39,7 @@ inline bool Shape::get(JSContext* cx, HandleObject receiver, JSObject* obj, JSObject *pobj, MutableHandleValue vp) { - JS_ASSERT(!hasDefaultGetter()); + MOZ_ASSERT(!hasDefaultGetter()); if (hasGetterValue()) { Value fval = getterValue(); @@ -140,7 +140,7 @@ Shape::search(ExclusiveContext *cx, Shape *start, jsid id, Shape ***pspp, bool a * No table built -- there weren't enough entries, or OOM occurred. * Don't increment numLinearSearches, to keep hasTable() false. */ - JS_ASSERT(!start->hasTable()); + MOZ_ASSERT(!start->hasTable()); } else { start->incrementNumLinearSearches(); } @@ -209,7 +209,7 @@ AutoRooterGetterSetter::AutoRooterGetterSetter(ThreadSafeContext *cx, uint8_t at static inline uint8_t GetShapeAttributes(JSObject *obj, Shape *shape) { - JS_ASSERT(obj->isNative()); + MOZ_ASSERT(obj->isNative()); if (IsImplicitDenseOrTypedArrayElement(shape)) { if (IsAnyTypedArray(obj)) diff --git a/js/src/vm/Shape.cpp b/js/src/vm/Shape.cpp index b33d7654cc4a..013572fb03fb 100644 --- a/js/src/vm/Shape.cpp +++ b/js/src/vm/Shape.cpp @@ -55,7 +55,7 @@ ShapeTable::init(ThreadSafeContext *cx, Shape *lastProp) hashShift = HASH_BITS - sizeLog2; for (Shape::Range r(lastProp); !r.empty(); r.popFront()) { Shape &shape = r.front(); - JS_ASSERT(cx->isThreadLocal(&shape)); + MOZ_ASSERT(cx->isThreadLocal(&shape)); Shape **spp = search(shape.propid(), true); /* @@ -71,12 +71,12 @@ ShapeTable::init(ThreadSafeContext *cx, Shape *lastProp) void Shape::removeFromDictionary(ObjectImpl *obj) { - JS_ASSERT(inDictionary()); - JS_ASSERT(obj->inDictionaryMode()); - JS_ASSERT(listp); + MOZ_ASSERT(inDictionary()); + MOZ_ASSERT(obj->inDictionaryMode()); + MOZ_ASSERT(listp); - JS_ASSERT(obj->shape_->inDictionary()); - JS_ASSERT(obj->shape_->listp == &obj->shape_); + MOZ_ASSERT(obj->shape_->inDictionary()); + MOZ_ASSERT(obj->shape_->listp == &obj->shape_); if (parent) parent->listp = listp; @@ -89,8 +89,8 @@ Shape::insertIntoDictionary(HeapPtrShape *dictp) { // Don't assert inDictionaryMode() here because we may be called from // JSObject::toDictionaryMode via JSObject::newDictionaryShape. - JS_ASSERT(inDictionary()); - JS_ASSERT(!listp); + MOZ_ASSERT(inDictionary()); + MOZ_ASSERT(!listp); JS_ASSERT_IF(*dictp, (*dictp)->inDictionary()); JS_ASSERT_IF(*dictp, (*dictp)->listp == dictp); @@ -106,8 +106,8 @@ Shape::insertIntoDictionary(HeapPtrShape *dictp) bool Shape::makeOwnBaseShape(ThreadSafeContext *cx) { - JS_ASSERT(!base()->isOwned()); - JS_ASSERT(cx->isThreadLocal(this)); + MOZ_ASSERT(!base()->isOwned()); + MOZ_ASSERT(cx->isThreadLocal(this)); assertSameCompartmentDebugOnly(cx, compartment()); BaseShape *nbase = js_NewGCBaseShape(cx); @@ -125,12 +125,12 @@ Shape::makeOwnBaseShape(ThreadSafeContext *cx) void Shape::handoffTableTo(Shape *shape) { - JS_ASSERT(inDictionary() && shape->inDictionary()); + MOZ_ASSERT(inDictionary() && shape->inDictionary()); if (this == shape) return; - JS_ASSERT(base()->isOwned() && !shape->base()->isOwned()); + MOZ_ASSERT(base()->isOwned() && !shape->base()->isOwned()); BaseShape *nbase = base(); @@ -145,7 +145,7 @@ Shape::handoffTableTo(Shape *shape) /* static */ bool Shape::hashify(ThreadSafeContext *cx, Shape *shape) { - JS_ASSERT(!shape->hasTable()); + MOZ_ASSERT(!shape->hasTable()); if (!shape->ensureOwnBaseShape(cx)) return false; @@ -178,8 +178,8 @@ ShapeTable::search(jsid id, bool adding) Shape *stored, *shape, **spp, **firstRemoved; uint32_t sizeMask; - JS_ASSERT(entries); - JS_ASSERT(!JSID_IS_EMPTY(id)); + MOZ_ASSERT(entries); + MOZ_ASSERT(!JSID_IS_EMPTY(id)); /* Compute the primary hash address. */ hash0 = HashId(id); @@ -228,7 +228,7 @@ ShapeTable::search(jsid id, bool adding) shape = SHAPE_CLEAR_COLLISION(stored); if (shape && shape->propidRaw() == id) { - JS_ASSERT(collision_flag); + MOZ_ASSERT(collision_flag); return spp; } @@ -265,7 +265,7 @@ ShapeTable::fixupAfterMovingGC() bool ShapeTable::change(int log2Delta, ThreadSafeContext *cx) { - JS_ASSERT(entries); + MOZ_ASSERT(entries); /* * Grow, shrink, or compress by changing this->entries. @@ -287,10 +287,10 @@ ShapeTable::change(int log2Delta, ThreadSafeContext *cx) /* Copy only live entries, leaving removed and free ones behind. */ for (Shape **oldspp = oldTable; oldsize != 0; oldspp++) { Shape *shape = SHAPE_FETCH(oldspp); - JS_ASSERT(cx->isThreadLocal(shape)); + MOZ_ASSERT(cx->isThreadLocal(shape)); if (shape) { Shape **spp = search(shape->propid(), true); - JS_ASSERT(SHAPE_IS_FREE(*spp)); + MOZ_ASSERT(SHAPE_IS_FREE(*spp)); *spp = shape; } oldsize--; @@ -304,7 +304,7 @@ ShapeTable::change(int log2Delta, ThreadSafeContext *cx) bool ShapeTable::grow(ThreadSafeContext *cx) { - JS_ASSERT(needsToGrow()); + MOZ_ASSERT(needsToGrow()); uint32_t size = capacity(); int delta = removedCount < size >> 2; @@ -320,7 +320,7 @@ ShapeTable::grow(ThreadSafeContext *cx) Shape::replaceLastProperty(ExclusiveContext *cx, StackBaseShape &base, TaggedProto proto, HandleShape shape) { - JS_ASSERT(!shape->inDictionary()); + MOZ_ASSERT(!shape->inDictionary()); if (!shape->parent) { /* Treat as resetting the initial property of the shape hierarchy. */ @@ -372,18 +372,18 @@ JSObject::getChildPropertyOnDictionary(ThreadSafeContext *cx, JS::HandleObject o * when the object uses some -- but not all -- of its reserved * slots to store properties. */ - JS_ASSERT(obj->inDictionaryMode() || - parent->hasMissingSlot() || - child.slot() == parent->maybeSlot() + 1 || - (parent->maybeSlot() + 1 < JSSLOT_FREE(obj->getClass()) && - child.slot() == JSSLOT_FREE(obj->getClass()))); + MOZ_ASSERT(obj->inDictionaryMode() || + parent->hasMissingSlot() || + child.slot() == parent->maybeSlot() + 1 || + (parent->maybeSlot() + 1 < JSSLOT_FREE(obj->getClass()) && + child.slot() == JSSLOT_FREE(obj->getClass()))); } } RootedShape shape(cx); if (obj->inDictionaryMode()) { - JS_ASSERT(parent == obj->lastProperty()); + MOZ_ASSERT(parent == obj->lastProperty()); RootedGeneric childRoot(cx, &child); shape = js_NewGCShape(cx); if (!shape) @@ -409,7 +409,7 @@ JSObject::getChildProperty(ExclusiveContext *cx, shape = cx->compartment()->propertyTree.getChild(cx, parent, *child); if (!shape) return nullptr; - //JS_ASSERT(shape->parent == parent); + //MOZ_ASSERT(shape->parent == parent); //JS_ASSERT_IF(parent != lastProperty(), parent == lastProperty()->parent); if (!JSObject::setLastProperty(cx, obj, shape)) return nullptr; @@ -423,7 +423,7 @@ JSObject::lookupChildProperty(ThreadSafeContext *cx, HandleObject obj, HandleShape parent, StackShape &unrootedChild) { RootedGeneric child(cx, &unrootedChild); - JS_ASSERT(cx->isThreadLocal(obj)); + MOZ_ASSERT(cx->isThreadLocal(obj)); RootedShape shape(cx, getChildPropertyOnDictionary(cx, obj, parent, *child)); @@ -441,7 +441,7 @@ JSObject::lookupChildProperty(ThreadSafeContext *cx, bool js::ObjectImpl::toDictionaryMode(ThreadSafeContext *cx) { - JS_ASSERT(!inDictionaryMode()); + MOZ_ASSERT(!inDictionaryMode()); #ifdef JSGC_COMPACTING // TODO: This crashes if we run a compacting GC here. @@ -449,14 +449,14 @@ js::ObjectImpl::toDictionaryMode(ThreadSafeContext *cx) #endif /* We allocate the shapes from cx->compartment(), so make sure it's right. */ - JS_ASSERT(cx->isInsideCurrentCompartment(this)); + MOZ_ASSERT(cx->isInsideCurrentCompartment(this)); /* * This function is thread safe as long as the object is thread local. It * does not modify the shared shapes, and only allocates newly allocated * (and thus also thread local) shapes. */ - JS_ASSERT(cx->isThreadLocal(this)); + MOZ_ASSERT(cx->isThreadLocal(this)); uint32_t span = slotSpan(); @@ -473,7 +473,7 @@ js::ObjectImpl::toDictionaryMode(ThreadSafeContext *cx) RootedShape shape(cx, lastProperty()); while (shape) { - JS_ASSERT(!shape->inDictionary()); + MOZ_ASSERT(!shape->inDictionary()); Shape *dprop = js_NewGCShape(cx); if (!dprop) { @@ -488,7 +488,7 @@ js::ObjectImpl::toDictionaryMode(ThreadSafeContext *cx) StackShape child(shape); dprop->initDictionaryShape(child, self->numFixedSlots(), listp); - JS_ASSERT(!dprop->hasTable()); + MOZ_ASSERT(!dprop->hasTable()); dictionaryShape = dprop; shape = shape->previous(); } @@ -498,11 +498,11 @@ js::ObjectImpl::toDictionaryMode(ThreadSafeContext *cx) return false; } - JS_ASSERT((Shape **) root->listp == root.address()); + MOZ_ASSERT((Shape **) root->listp == root.address()); root->listp = &self->shape_; self->shape_ = root; - JS_ASSERT(self->inDictionaryMode()); + MOZ_ASSERT(self->inDictionaryMode()); root->base()->setSlotSpan(span); return true; @@ -519,11 +519,11 @@ NormalizeGetterAndSetter(JSObject *obj, StrictPropertyOp &setter) { if (setter == JS_StrictPropertyStub) { - JS_ASSERT(!(attrs & JSPROP_SETTER)); + MOZ_ASSERT(!(attrs & JSPROP_SETTER)); setter = nullptr; } if (getter == JS_PropertyStub) { - JS_ASSERT(!(attrs & JSPROP_GETTER)); + MOZ_ASSERT(!(attrs & JSPROP_GETTER)); getter = nullptr; } @@ -536,7 +536,7 @@ JSObject::addProperty(ExclusiveContext *cx, HandleObject obj, HandleId id, uint32_t slot, unsigned attrs, unsigned flags, bool allowDictionary) { - JS_ASSERT(!JSID_IS_VOID(id)); + MOZ_ASSERT(!JSID_IS_VOID(id)); bool extensible; if (!JSObject::isExtensible(cx, obj, &extensible)) @@ -588,7 +588,7 @@ JSObject::addPropertyInternal(typename ExecutionModeTraits::ExclusiveConte unsigned flags, Shape **spp, bool allowDictionary) { - JS_ASSERT(cx->isThreadLocal(obj)); + MOZ_ASSERT(cx->isThreadLocal(obj)); JS_ASSERT_IF(!allowDictionary, !obj->inDictionaryMode()); AutoRooterGetterSetter gsRoot(cx, attrs, &getter, &setter); @@ -619,11 +619,11 @@ JSObject::addPropertyInternal(typename ExecutionModeTraits::ExclusiveConte if (!table->grow(cx)) return nullptr; spp = table->search(id, true); - JS_ASSERT(!SHAPE_FETCH(spp)); + MOZ_ASSERT(!SHAPE_FETCH(spp)); } } - JS_ASSERT(!!table == !!spp); + MOZ_ASSERT(!!table == !!spp); /* Find or create a property tree node labeled by our arguments. */ RootedShape shape(cx); @@ -651,7 +651,7 @@ JSObject::addPropertyInternal(typename ExecutionModeTraits::ExclusiveConte } if (shape) { - JS_ASSERT(shape == obj->lastProperty()); + MOZ_ASSERT(shape == obj->lastProperty()); if (table) { /* Store the tree node pointer in the table entry for id. */ @@ -659,7 +659,7 @@ JSObject::addPropertyInternal(typename ExecutionModeTraits::ExclusiveConte ++table->entryCount; /* Pass the table along to the new last property, namely shape. */ - JS_ASSERT(&shape->parent->table() == table); + MOZ_ASSERT(&shape->parent->table() == table); shape->parent->handoffTableTo(shape); } @@ -716,7 +716,7 @@ js::NewReshapedObject(JSContext *cx, HandleTypeObject type, JSObject *parent, RootedShape newShape(cx, res->lastProperty()); for (unsigned i = 0; i < ids.length(); i++) { id = ids[i]; - JS_ASSERT(!res->nativeContains(cx, id)); + MOZ_ASSERT(!res->nativeContains(cx, id)); uint32_t index; bool indexed = js_IdIsIndex(id, &index); @@ -774,15 +774,15 @@ JSObject::putProperty(typename ExecutionModeTraits::ExclusiveContextType c PropertyOp getter, StrictPropertyOp setter, uint32_t slot, unsigned attrs, unsigned flags) { - JS_ASSERT(cx->isThreadLocal(obj)); - JS_ASSERT(!JSID_IS_VOID(id)); + MOZ_ASSERT(cx->isThreadLocal(obj)); + MOZ_ASSERT(!JSID_IS_VOID(id)); #ifdef DEBUG if (obj->is()) { ArrayObject *arr = &obj->as(); uint32_t index; if (js_IdIsIndex(id, &index)) - JS_ASSERT(index < arr->length() || arr->lengthIsWritable()); + MOZ_ASSERT(index < arr->length() || arr->lengthIsWritable()); } #endif @@ -924,7 +924,7 @@ JSObject::putProperty(typename ExecutionModeTraits::ExclusiveContextType c if (!nbase) return nullptr; - JS_ASSERT(shape == obj->lastProperty()); + MOZ_ASSERT(shape == obj->lastProperty()); /* Find or create a property tree node labeled by our arguments. */ StackShape child(nbase, id, slot, attrs, flags); @@ -977,15 +977,15 @@ JSObject::changeProperty(typename ExecutionModeTraits::ExclusiveContextTyp HandleObject obj, HandleShape shape, unsigned attrs, unsigned mask, PropertyOp getter, StrictPropertyOp setter) { - JS_ASSERT(cx->isThreadLocal(obj)); - JS_ASSERT(obj->nativeContainsPure(shape)); + MOZ_ASSERT(cx->isThreadLocal(obj)); + MOZ_ASSERT(obj->nativeContainsPure(shape)); attrs |= shape->attrs & mask; JS_ASSERT_IF(attrs & (JSPROP_GETTER | JSPROP_SETTER), attrs & JSPROP_SHARED); /* Allow only shared (slotless) => unshared (slotful) transition. */ - JS_ASSERT(!((attrs ^ shape->attrs) & JSPROP_SHARED) || - !(attrs & JSPROP_SHARED)); + MOZ_ASSERT(!((attrs ^ shape->attrs) & JSPROP_SHARED) || + !(attrs & JSPROP_SHARED)); if (mode == ParallelExecution) { if (!types::IsTypePropertyIdMarkedNonData(obj, shape->propid())) @@ -1140,7 +1140,7 @@ JSObject::removeProperty(ExclusiveContext *cx, jsid id_) * lazily make via a later hashify the exact table for the new property * lineage. */ - JS_ASSERT(shape == self->lastProperty()); + MOZ_ASSERT(shape == self->lastProperty()); self->removeLastProperty(cx); } @@ -1152,13 +1152,13 @@ JSObject::removeProperty(ExclusiveContext *cx, jsid id_) JSObject::clear(JSContext *cx, HandleObject obj) { RootedShape shape(cx, obj->lastProperty()); - JS_ASSERT(obj->inDictionaryMode() == shape->inDictionary()); + MOZ_ASSERT(obj->inDictionaryMode() == shape->inDictionary()); while (shape->parent) { shape = shape->parent; - JS_ASSERT(obj->inDictionaryMode() == shape->inDictionary()); + MOZ_ASSERT(obj->inDictionaryMode() == shape->inDictionary()); } - JS_ASSERT(shape->isEmptyShape()); + MOZ_ASSERT(shape->isEmptyShape()); if (obj->inDictionaryMode()) shape->listp = &obj->shape_; @@ -1177,16 +1177,16 @@ JSObject::rollbackProperties(ExclusiveContext *cx, HandleObject obj, uint32_t sl * The object cannot have escaped in a way which would prevent safe * removal of the last properties. */ - JS_ASSERT(!obj->inDictionaryMode() && slotSpan <= obj->slotSpan()); + MOZ_ASSERT(!obj->inDictionaryMode() && slotSpan <= obj->slotSpan()); while (true) { if (obj->lastProperty()->isEmptyShape()) { - JS_ASSERT(slotSpan == 0); + MOZ_ASSERT(slotSpan == 0); break; } else { uint32_t slot = obj->lastProperty()->slot(); if (slot < slotSpan) break; - JS_ASSERT(obj->getSlot(slot).isUndefined()); + MOZ_ASSERT(obj->getSlot(slot).isUndefined()); } if (!obj->removeProperty(cx, obj->lastProperty()->propid())) return false; @@ -1198,9 +1198,9 @@ JSObject::rollbackProperties(ExclusiveContext *cx, HandleObject obj, uint32_t sl Shape * ObjectImpl::replaceWithNewEquivalentShape(ThreadSafeContext *cx, Shape *oldShape, Shape *newShape) { - JS_ASSERT(cx->isThreadLocal(this)); - JS_ASSERT(cx->isThreadLocal(oldShape)); - JS_ASSERT(cx->isInsideCurrentCompartment(oldShape)); + MOZ_ASSERT(cx->isThreadLocal(this)); + MOZ_ASSERT(cx->isThreadLocal(oldShape)); + MOZ_ASSERT(cx->isInsideCurrentCompartment(oldShape)); JS_ASSERT_IF(oldShape != lastProperty(), inDictionaryMode() && ((cx->isExclusiveContext() @@ -1242,7 +1242,7 @@ ObjectImpl::replaceWithNewEquivalentShape(ThreadSafeContext *cx, Shape *oldShape StackShape nshape(oldShape); newShape->initDictionaryShape(nshape, self->numFixedSlots(), oldShape->listp); - JS_ASSERT(newShape->parent == oldShape); + MOZ_ASSERT(newShape->parent == oldShape); oldShape->removeFromDictionary(self); if (newShape == self->lastProperty()) @@ -1407,8 +1407,8 @@ js::ObjectImpl::setFlag(ExclusiveContext *cx, /*BaseShape::Flag*/ uint32_t flag_ bool js::ObjectImpl::clearFlag(ExclusiveContext *cx, /*BaseShape::Flag*/ uint32_t flag) { - JS_ASSERT(inDictionaryMode()); - JS_ASSERT(lastProperty()->getObjectFlags() & flag); + MOZ_ASSERT(inDictionaryMode()); + MOZ_ASSERT(lastProperty()->getObjectFlags() & flag); RootedObject self(cx, this->asObjectPtr()); @@ -1525,13 +1525,13 @@ BaseShape::assertConsistency() #ifdef DEBUG if (isOwned()) { UnownedBaseShape *unowned = baseUnowned(); - JS_ASSERT(hasGetterObject() == unowned->hasGetterObject()); - JS_ASSERT(hasSetterObject() == unowned->hasSetterObject()); + MOZ_ASSERT(hasGetterObject() == unowned->hasGetterObject()); + MOZ_ASSERT(hasSetterObject() == unowned->hasSetterObject()); JS_ASSERT_IF(hasGetterObject(), getterObject() == unowned->getterObject()); JS_ASSERT_IF(hasSetterObject(), setterObject() == unowned->setterObject()); - JS_ASSERT(getObjectParent() == unowned->getObjectParent()); - JS_ASSERT(getObjectMetadata() == unowned->getObjectMetadata()); - JS_ASSERT(getObjectFlags() == unowned->getObjectFlags()); + MOZ_ASSERT(getObjectParent() == unowned->getObjectParent()); + MOZ_ASSERT(getObjectMetadata() == unowned->getObjectMetadata()); + MOZ_ASSERT(getObjectFlags() == unowned->getObjectFlags()); } #endif } @@ -1656,7 +1656,7 @@ class InitialShapeSetRef : public BufferableRef priorMetadata, metadata, nfixed, objectFlags); InitialShapeSet::Ptr p = set->lookup(lookup); - JS_ASSERT(p); + MOZ_ASSERT(p); /* Update the entry's possibly-moved proto, and ensure lookup will still match. */ InitialShapeEntry &entry = const_cast(*p); @@ -1704,7 +1704,7 @@ JSCompartment::checkInitialShapesTableAfterMovingGC() shape->numFixedSlots(), shape->getObjectFlags()); InitialShapeSet::Ptr ptr = initialShapes.lookup(lookup); - JS_ASSERT(ptr.found() && &*ptr == &e.front()); + MOZ_ASSERT(ptr.found() && &*ptr == &e.front()); } } @@ -1800,7 +1800,7 @@ EmptyShape::insertInitialShape(ExclusiveContext *cx, HandleShape shape, HandleOb shape->numFixedSlots(), shape->getObjectFlags()); InitialShapeSet::Ptr p = cx->compartment()->initialShapes.lookup(lookup); - JS_ASSERT(p); + MOZ_ASSERT(p); InitialShapeEntry &entry = const_cast(*p); @@ -1809,7 +1809,7 @@ EmptyShape::insertInitialShape(ExclusiveContext *cx, HandleShape shape, HandleOb Shape *nshape = shape; while (!nshape->isEmptyShape()) nshape = nshape->previous(); - JS_ASSERT(nshape == entry.shape); + MOZ_ASSERT(nshape == entry.shape); #endif entry.shape = ReadBarrieredShape(shape); @@ -1845,8 +1845,8 @@ JSCompartment::sweepInitialShapeTable() } else { #ifdef DEBUG DebugOnly parent = shape->getObjectParent(); - JS_ASSERT(!parent || !IsObjectAboutToBeFinalized(&parent)); - JS_ASSERT(parent == shape->getObjectParent()); + MOZ_ASSERT(!parent || !IsObjectAboutToBeFinalized(&parent)); + MOZ_ASSERT(parent == shape->getObjectParent()); #endif if (shape != entry.shape.unbarrieredGet() || proto != entry.proto.raw()) { ReadBarrieredShape readBarrieredShape(shape); diff --git a/js/src/vm/Shape.h b/js/src/vm/Shape.h index 08e3d110dfcf..25d42540d1d6 100644 --- a/js/src/vm/Shape.h +++ b/js/src/vm/Shape.h @@ -264,8 +264,8 @@ static inline void GetterSetterWriteBarrierPost(JSRuntime *rt, JSObject **objp) { #ifdef JSGC_GENERATIONAL - JS_ASSERT(objp); - JS_ASSERT(*objp); + MOZ_ASSERT(objp); + MOZ_ASSERT(*objp); gc::Cell **cellp = reinterpret_cast(objp); gc::StoreBuffer *storeBuffer = (*cellp)->storeBuffer(); if (storeBuffer) @@ -368,7 +368,7 @@ class BaseShape : public gc::TenuredCell BaseShape(JSCompartment *comp, const Class *clasp, JSObject *parent, JSObject *metadata, uint32_t objectFlags) { - JS_ASSERT(!(objectFlags & ~OBJECT_FLAG_MASK)); + MOZ_ASSERT(!(objectFlags & ~OBJECT_FLAG_MASK)); mozilla::PodZero(this); this->clasp_ = clasp; this->parent = parent; @@ -381,7 +381,7 @@ class BaseShape : public gc::TenuredCell uint32_t objectFlags, uint8_t attrs, PropertyOp rawGetter, StrictPropertyOp rawSetter) { - JS_ASSERT(!(objectFlags & ~OBJECT_FLAG_MASK)); + MOZ_ASSERT(!(objectFlags & ~OBJECT_FLAG_MASK)); mozilla::PodZero(this); this->clasp_ = clasp; this->parent = parent; @@ -451,17 +451,17 @@ class BaseShape : public gc::TenuredCell uint32_t getObjectFlags() const { return flags & OBJECT_FLAG_MASK; } bool hasGetterObject() const { return !!(flags & HAS_GETTER_OBJECT); } - JSObject *getterObject() const { JS_ASSERT(hasGetterObject()); return getterObj; } + JSObject *getterObject() const { MOZ_ASSERT(hasGetterObject()); return getterObj; } bool hasSetterObject() const { return !!(flags & HAS_SETTER_OBJECT); } - JSObject *setterObject() const { JS_ASSERT(hasSetterObject()); return setterObj; } + JSObject *setterObject() const { MOZ_ASSERT(hasSetterObject()); return setterObj; } bool hasTable() const { JS_ASSERT_IF(table_, isOwned()); return table_ != nullptr; } - ShapeTable &table() const { JS_ASSERT(table_ && isOwned()); return *table_; } - void setTable(ShapeTable *table) { JS_ASSERT(isOwned()); table_ = table; } + ShapeTable &table() const { MOZ_ASSERT(table_ && isOwned()); return *table_; } + void setTable(ShapeTable *table) { MOZ_ASSERT(isOwned()); table_ = table; } - uint32_t slotSpan() const { JS_ASSERT(isOwned()); return slotSpan_; } - void setSlotSpan(uint32_t slotSpan) { JS_ASSERT(isOwned()); slotSpan_ = slotSpan; } + uint32_t slotSpan() const { MOZ_ASSERT(isOwned()); return slotSpan_; } + void setSlotSpan(uint32_t slotSpan) { MOZ_ASSERT(isOwned()); slotSpan_ = slotSpan; } JSCompartment *compartment() const { return compartment_; } @@ -529,7 +529,7 @@ BaseShape::adoptUnowned(UnownedBaseShape *other) { // This is a base shape owned by a dictionary object, update it to reflect the // unowned base shape of a new last property. - JS_ASSERT(isOwned()); + MOZ_ASSERT(isOwned()); uint32_t span = slotSpan(); ShapeTable *table = &this->table(); @@ -551,13 +551,13 @@ BaseShape::unowned() UnownedBaseShape * BaseShape::toUnowned() { - JS_ASSERT(!isOwned() && !unowned_); return static_cast(this); + MOZ_ASSERT(!isOwned() && !unowned_); return static_cast(this); } UnownedBaseShape* BaseShape::baseUnowned() { - JS_ASSERT(isOwned() && unowned_); return unowned_; + MOZ_ASSERT(isOwned() && unowned_); return unowned_; } /* Entries for the per-compartment baseShapes set of unowned base shapes. */ @@ -590,11 +590,11 @@ struct StackBaseShape : public DefaultHasher void updateGetterSetter(uint8_t attrs, PropertyOp rawGetter, StrictPropertyOp rawSetter) { flags &= ~(BaseShape::HAS_GETTER_OBJECT | BaseShape::HAS_SETTER_OBJECT); if ((attrs & JSPROP_GETTER) && rawGetter) { - JS_ASSERT(!IsPoisonedPtr(rawGetter)); + MOZ_ASSERT(!IsPoisonedPtr(rawGetter)); flags |= BaseShape::HAS_GETTER_OBJECT; } if ((attrs & JSPROP_SETTER) && rawSetter) { - JS_ASSERT(!IsPoisonedPtr(rawSetter)); + MOZ_ASSERT(!IsPoisonedPtr(rawSetter)); flags |= BaseShape::HAS_SETTER_OBJECT; } @@ -754,7 +754,7 @@ class Shape : public gc::TenuredCell } bool isNative() const { - JS_ASSERT(!(flags & NON_NATIVE) == getObjectClass()->isNative()); + MOZ_ASSERT(!(flags & NON_NATIVE) == getObjectClass()->isNative()); return !(flags & NON_NATIVE); } @@ -782,12 +782,12 @@ class Shape : public gc::TenuredCell } Shape &front() const { - JS_ASSERT(!empty()); + MOZ_ASSERT(!empty()); return *cursor; } void popFront() { - JS_ASSERT(!empty()); + MOZ_ASSERT(!empty()); cursor = cursor->parent; } }; @@ -807,7 +807,7 @@ class Shape : public gc::TenuredCell uint32_t getObjectFlags() const { return base()->getObjectFlags(); } bool hasObjectFlag(BaseShape::Flag flag) const { - JS_ASSERT(!(flag & ~BaseShape::OBJECT_FLAG_MASK)); + MOZ_ASSERT(!(flag & ~BaseShape::OBJECT_FLAG_MASK)); return !!(base()->flags & flag); } @@ -857,12 +857,12 @@ class Shape : public gc::TenuredCell PropertyOp getter() const { return base()->rawGetter; } bool hasDefaultGetter() const {return !base()->rawGetter; } - PropertyOp getterOp() const { JS_ASSERT(!hasGetterValue()); return base()->rawGetter; } - JSObject *getterObject() const { JS_ASSERT(hasGetterValue()); return base()->getterObj; } + PropertyOp getterOp() const { MOZ_ASSERT(!hasGetterValue()); return base()->rawGetter; } + JSObject *getterObject() const { MOZ_ASSERT(hasGetterValue()); return base()->getterObj; } // Per ES5, decode null getterObj as the undefined value, which encodes as null. Value getterValue() const { - JS_ASSERT(hasGetterValue()); + MOZ_ASSERT(hasGetterValue()); return base()->getterObj ? ObjectValue(*base()->getterObj) : UndefinedValue(); } @@ -874,12 +874,12 @@ class Shape : public gc::TenuredCell StrictPropertyOp setter() const { return base()->rawSetter; } bool hasDefaultSetter() const { return !base()->rawSetter; } - StrictPropertyOp setterOp() const { JS_ASSERT(!hasSetterValue()); return base()->rawSetter; } - JSObject *setterObject() const { JS_ASSERT(hasSetterValue()); return base()->setterObj; } + StrictPropertyOp setterOp() const { MOZ_ASSERT(!hasSetterValue()); return base()->rawSetter; } + JSObject *setterObject() const { MOZ_ASSERT(hasSetterValue()); return base()->setterObj; } // Per ES5, decode null setterObj as the undefined value, which encodes as null. Value setterValue() const { - JS_ASSERT(hasSetterValue()); + MOZ_ASSERT(hasSetterValue()); return base()->setterObj ? ObjectValue(*base()->setterObj) : UndefinedValue(); } @@ -920,7 +920,7 @@ class Shape : public gc::TenuredCell bool hasSlot() const { return (attrs & JSPROP_SHARED) == 0; } - uint32_t slot() const { JS_ASSERT(hasSlot() && !hasMissingSlot()); return maybeSlot(); } + uint32_t slot() const { MOZ_ASSERT(hasSlot() && !hasMissingSlot()); return maybeSlot(); } uint32_t maybeSlot() const { return slotInfo & SLOT_MASK; } @@ -931,7 +931,7 @@ class Shape : public gc::TenuredCell } uint32_t slotSpan(const Class *clasp) const { - JS_ASSERT(!inDictionary()); + MOZ_ASSERT(!inDictionary()); uint32_t free = JSSLOT_FREE(clasp); return hasMissingSlot() ? free : Max(free, maybeSlot() + 1); } @@ -941,7 +941,7 @@ class Shape : public gc::TenuredCell } void setSlot(uint32_t slot) { - JS_ASSERT(slot <= SHAPE_INVALID_SLOT); + MOZ_ASSERT(slot <= SHAPE_INVALID_SLOT); slotInfo = slotInfo & ~Shape::SLOT_MASK; slotInfo = slotInfo | slot; } @@ -951,7 +951,7 @@ class Shape : public gc::TenuredCell } void setNumFixedSlots(uint32_t nfixed) { - JS_ASSERT(nfixed < FIXED_SLOTS_MAX); + MOZ_ASSERT(nfixed < FIXED_SLOTS_MAX); slotInfo = slotInfo & ~FIXED_SLOTS_MASK; slotInfo = slotInfo | (nfixed << FIXED_SLOTS_SHIFT); } @@ -962,17 +962,17 @@ class Shape : public gc::TenuredCell void incrementNumLinearSearches() { uint32_t count = numLinearSearches(); - JS_ASSERT(count < LINEAR_SEARCHES_MAX); + MOZ_ASSERT(count < LINEAR_SEARCHES_MAX); slotInfo = slotInfo & ~LINEAR_SEARCHES_MASK; slotInfo = slotInfo | ((count + 1) << LINEAR_SEARCHES_SHIFT); } const PreBarrieredId &propid() const { - JS_ASSERT(!isEmptyShape()); - JS_ASSERT(!JSID_IS_VOID(propid_)); + MOZ_ASSERT(!isEmptyShape()); + MOZ_ASSERT(!JSID_IS_VOID(propid_)); return propid_; } - PreBarrieredId &propidRef() { JS_ASSERT(!JSID_IS_VOID(propid_)); return propid_; } + PreBarrieredId &propidRef() { MOZ_ASSERT(!JSID_IS_VOID(propid_)); return propid_; } jsid propidRaw() const { // Return the actual jsid, not an internal reference. return propid(); @@ -1025,7 +1025,7 @@ class Shape : public gc::TenuredCell } bool isBigEnoughForAShapeTable() { - JS_ASSERT(!hasTable()); + MOZ_ASSERT(!hasTable()); Shape *shape = this; uint32_t count = 0; for (Shape::Range r(shape); !r.empty(); r.popFront()) { @@ -1245,9 +1245,9 @@ struct StackShape attrs(uint8_t(attrs)), flags(uint8_t(flags)) { - JS_ASSERT(base); - JS_ASSERT(!JSID_IS_VOID(propid)); - JS_ASSERT(slot <= SHAPE_INVALID_SLOT); + MOZ_ASSERT(base); + MOZ_ASSERT(!JSID_IS_VOID(propid)); + MOZ_ASSERT(slot <= SHAPE_INVALID_SLOT); JS_ASSERT_IF(attrs & (JSPROP_GETTER | JSPROP_SETTER), attrs & JSPROP_SHARED); } @@ -1262,7 +1262,7 @@ struct StackShape bool hasSlot() const { return (attrs & JSPROP_SHARED) == 0; } bool hasMissingSlot() const { return maybeSlot() == SHAPE_INVALID_SLOT; } - uint32_t slot() const { JS_ASSERT(hasSlot() && !hasMissingSlot()); return slot_; } + uint32_t slot() const { MOZ_ASSERT(hasSlot() && !hasMissingSlot()); return slot_; } uint32_t maybeSlot() const { return slot_; } uint32_t slotSpan() const { @@ -1271,7 +1271,7 @@ struct StackShape } void setSlot(uint32_t slot) { - JS_ASSERT(slot <= SHAPE_INVALID_SLOT); + MOZ_ASSERT(slot <= SHAPE_INVALID_SLOT); slot_ = slot; } @@ -1370,7 +1370,7 @@ Shape::Shape(UnownedBaseShape *base, uint32_t nfixed) flags(0), parent(nullptr) { - JS_ASSERT(base); + MOZ_ASSERT(base); kids.setNull(); } @@ -1383,7 +1383,7 @@ Shape::searchLinear(jsid id) * their table without racing. This function can be called from any thread * on any non-dictionary shape. */ - JS_ASSERT(!inDictionary()); + MOZ_ASSERT(!inDictionary()); for (Shape *shape = this; shape; ) { if (shape->propidRef() == id) diff --git a/js/src/vm/SharedArrayObject.cpp b/js/src/vm/SharedArrayObject.cpp index 4c973d75a093..aae016e6e807 100644 --- a/js/src/vm/SharedArrayObject.cpp +++ b/js/src/vm/SharedArrayObject.cpp @@ -81,10 +81,10 @@ SharedArrayRawBuffer::New(uint32_t length) { // The value (uint32_t)-1 is used as a signal in various places, // so guard against it on principle. - JS_ASSERT(length != (uint32_t)-1); + MOZ_ASSERT(length != (uint32_t)-1); // Enforced by SharedArrayBufferObject::New(cx, length). - JS_ASSERT(IsValidAsmJSHeapLength(length)); + MOZ_ASSERT(IsValidAsmJSHeapLength(length)); #ifdef JS_CODEGEN_X64 // Get the entire reserved region (with all pages inaccessible) @@ -119,7 +119,7 @@ SharedArrayRawBuffer::New(uint32_t length) void SharedArrayRawBuffer::addReference() { - JS_ASSERT(this->refcount > 0); + MOZ_ASSERT(this->refcount > 0); ++this->refcount; // Atomic. } @@ -132,7 +132,7 @@ SharedArrayRawBuffer::dropReference() // If this was the final reference, release the buffer. if (refcount == 0) { uint8_t *p = this->dataPointer() - AsmJSPageSize; - JS_ASSERT(uintptr_t(p) % AsmJSPageSize == 0); + MOZ_ASSERT(uintptr_t(p) % AsmJSPageSize == 0); #ifdef JS_CODEGEN_X64 UnmapMemory(p, SharedArrayMappedSize); # if defined(MOZ_VALGRIND) \ @@ -160,7 +160,7 @@ const JSFunctionSpec SharedArrayBufferObject::jsstaticfuncs[] = { MOZ_ALWAYS_INLINE bool SharedArrayBufferObject::byteLengthGetterImpl(JSContext *cx, CallArgs args) { - JS_ASSERT(IsSharedArrayBuffer(args.thisv())); + MOZ_ASSERT(IsSharedArrayBuffer(args.thisv())); args.rval().setInt32(args.thisv().toObject().as().byteLength()); return true; } @@ -240,7 +240,7 @@ SharedArrayBufferObject::New(JSContext *cx, SharedArrayRawBuffer *buffer) if (!obj) return nullptr; - JS_ASSERT(obj->getClass() == &class_); + MOZ_ASSERT(obj->getClass() == &class_); obj->acceptRawBuffer(buffer); @@ -263,7 +263,7 @@ SharedArrayRawBuffer * SharedArrayBufferObject::rawBufferObject() const { Value v = getReservedSlot(RAWBUF_SLOT); - JS_ASSERT(!v.isUndefined()); + MOZ_ASSERT(!v.isUndefined()); return reinterpret_cast(v.toPrivate()); } @@ -324,7 +324,7 @@ const Class SharedArrayBufferObject::class_ = { JSObject * js_InitSharedArrayBufferClass(JSContext *cx, HandleObject obj) { - JS_ASSERT(obj->isNative()); + MOZ_ASSERT(obj->isNative()); Rooted global(cx, &obj->as()); RootedObject proto(cx, global->createBlankPrototype(cx, &SharedArrayBufferObject::protoClass)); if (!proto) @@ -376,7 +376,7 @@ js::IsSharedArrayBuffer(HandleObject o) SharedArrayBufferObject & js::AsSharedArrayBuffer(HandleObject obj) { - JS_ASSERT(IsSharedArrayBuffer(obj)); + MOZ_ASSERT(IsSharedArrayBuffer(obj)); return obj->as(); } diff --git a/js/src/vm/SharedArrayObject.h b/js/src/vm/SharedArrayObject.h index 50ec4ed6b0ac..ecb30cb54d01 100644 --- a/js/src/vm/SharedArrayObject.h +++ b/js/src/vm/SharedArrayObject.h @@ -49,7 +49,7 @@ class SharedArrayRawBuffer SharedArrayRawBuffer(uint8_t *buffer, uint32_t length) : refcount(1), length(length) { - JS_ASSERT(buffer == dataPointer()); + MOZ_ASSERT(buffer == dataPointer()); } public: diff --git a/js/src/vm/SharedTypedArrayObject.cpp b/js/src/vm/SharedTypedArrayObject.cpp index 8099b3f7c383..c39de5b18434 100644 --- a/js/src/vm/SharedTypedArrayObject.cpp +++ b/js/src/vm/SharedTypedArrayObject.cpp @@ -128,7 +128,7 @@ class SharedTypedArrayObjectTemplate : public SharedTypedArrayObject static SharedTypedArrayObject * makeProtoInstance(JSContext *cx, HandleObject proto, AllocKind allocKind) { - JS_ASSERT(proto); + MOZ_ASSERT(proto); RootedObject obj(cx, NewBuiltinClassInstance(cx, instanceClass(), allocKind)); if (!obj) @@ -145,7 +145,7 @@ class SharedTypedArrayObjectTemplate : public SharedTypedArrayObject static SharedTypedArrayObject * makeTypedInstance(JSContext *cx, uint32_t len, AllocKind allocKind) { - JS_ASSERT(len <= MAX_LENGTH / sizeof(NativeType)); + MOZ_ASSERT(len <= MAX_LENGTH / sizeof(NativeType)); // Multiplication is safe due to preconditions for makeInstance(). if (len * sizeof(NativeType) >= SharedTypedArrayObject::SINGLETON_TYPE_BYTE_LENGTH) { @@ -174,9 +174,9 @@ class SharedTypedArrayObjectTemplate : public SharedTypedArrayObject makeInstance(JSContext *cx, Handle buffer, uint32_t byteOffset, uint32_t len, HandleObject proto) { - JS_ASSERT(buffer); - JS_ASSERT(byteOffset <= MAX_BYTEOFFSET); - JS_ASSERT(len <= MAX_LENGTH / sizeof(NativeType)); + MOZ_ASSERT(buffer); + MOZ_ASSERT(byteOffset <= MAX_BYTEOFFSET); + MOZ_ASSERT(len <= MAX_LENGTH / sizeof(NativeType)); gc::AllocKind allocKind = GetGCObjectKind(instanceClass()); @@ -200,12 +200,12 @@ class SharedTypedArrayObjectTemplate : public SharedTypedArrayObject uint32_t arrayByteLength = obj->byteLength(); uint32_t arrayByteOffset = obj->byteOffset(); uint32_t bufferByteLength = buffer->byteLength(); - JS_ASSERT(bufferByteLength - arrayByteOffset >= arrayByteLength); - JS_ASSERT(arrayByteOffset <= bufferByteLength); + MOZ_ASSERT(bufferByteLength - arrayByteOffset >= arrayByteLength); + MOZ_ASSERT(arrayByteOffset <= bufferByteLength); } // Verify that the private slot is at the expected place - JS_ASSERT(obj->numFixedSlots() == DATA_SLOT); + MOZ_ASSERT(obj->numFixedSlots() == DATA_SLOT); #endif return obj; @@ -310,7 +310,7 @@ class SharedTypedArrayObjectTemplate : public SharedTypedArrayObject static bool GetterImpl(JSContext *cx, CallArgs args) { - JS_ASSERT(is(args.thisv())); + MOZ_ASSERT(is(args.thisv())); args.rval().set(ValueGetter(&args.thisv().toObject().as())); return true; } @@ -329,7 +329,7 @@ class SharedTypedArrayObjectTemplate : public SharedTypedArrayObject static bool BufferGetterImpl(JSContext *cx, CallArgs args) { - JS_ASSERT(is(args.thisv())); + MOZ_ASSERT(is(args.thisv())); Rooted tarray(cx, &args.thisv().toObject().as()); args.rval().set(bufferValue(tarray)); return true; @@ -379,7 +379,7 @@ class SharedTypedArrayObjectTemplate : public SharedTypedArrayObject if (ArrayTypeIsFloatingPoint()) { setIndex(tarray, index, NativeType(d)); } else if (ArrayTypeIsUnsigned()) { - JS_ASSERT(sizeof(NativeType) <= 4); + MOZ_ASSERT(sizeof(NativeType) <= 4); uint32_t n = ToUint32(d); setIndex(tarray, index, NativeType(n)); } else if (ArrayTypeID() == Scalar::Uint8Clamped) { @@ -387,7 +387,7 @@ class SharedTypedArrayObjectTemplate : public SharedTypedArrayObject // for doubles. setIndex(tarray, index, NativeType(d)); } else { - JS_ASSERT(sizeof(NativeType) <= 4); + MOZ_ASSERT(sizeof(NativeType) <= 4); int32_t n = ToInt32(d); setIndex(tarray, index, NativeType(n)); } diff --git a/js/src/vm/SharedTypedArrayObject.h b/js/src/vm/SharedTypedArrayObject.h index c2efb592fa16..8de7e957f1df 100644 --- a/js/src/vm/SharedTypedArrayObject.h +++ b/js/src/vm/SharedTypedArrayObject.h @@ -126,7 +126,7 @@ IsSharedTypedArrayConstructor(HandleValue v, uint32_t type); inline Scalar::Type SharedTypedArrayObject::type() const { - JS_ASSERT(IsSharedTypedArrayClass(getClass())); + MOZ_ASSERT(IsSharedTypedArrayClass(getClass())); return static_cast(getClass() - &classes[0]); } diff --git a/js/src/vm/Stack-inl.h b/js/src/vm/Stack-inl.h index 21e1216b0aea..8eac4b5c352c 100644 --- a/js/src/vm/Stack-inl.h +++ b/js/src/vm/Stack-inl.h @@ -66,7 +66,7 @@ InterpreterFrame::varObj() inline JSCompartment * InterpreterFrame::compartment() const { - JS_ASSERT(scopeChain()->compartment() == script()->compartment()); + MOZ_ASSERT(scopeChain()->compartment() == script()->compartment()); return scopeChain()->compartment(); } @@ -75,8 +75,8 @@ InterpreterFrame::initCallFrame(JSContext *cx, InterpreterFrame *prev, jsbytecod Value *prevsp, JSFunction &callee, JSScript *script, Value *argv, uint32_t nactual, InterpreterFrame::Flags flagsArg) { - JS_ASSERT((flagsArg & ~CONSTRUCTING) == 0); - JS_ASSERT(callee.nonLazyScript() == script); + MOZ_ASSERT((flagsArg & ~CONSTRUCTING) == 0); + MOZ_ASSERT(callee.nonLazyScript() == script); /* Initialize stack frame members. */ flags_ = FUNCTION | HAS_SCOPECHAIN | flagsArg; @@ -112,14 +112,14 @@ inline Value & InterpreterFrame::unaliasedVar(uint32_t i, MaybeCheckAliasing checkAliasing) { JS_ASSERT_IF(checkAliasing, !script()->varIsAliased(i)); - JS_ASSERT(i < script()->nfixedvars()); + MOZ_ASSERT(i < script()->nfixedvars()); return slots()[i]; } inline Value & InterpreterFrame::unaliasedLocal(uint32_t i, MaybeCheckAliasing checkAliasing) { - JS_ASSERT(i < script()->nfixed()); + MOZ_ASSERT(i < script()->nfixed()); #ifdef DEBUG CheckLocalUnaliased(checkAliasing, script(), i); #endif @@ -129,7 +129,7 @@ InterpreterFrame::unaliasedLocal(uint32_t i, MaybeCheckAliasing checkAliasing) inline Value & InterpreterFrame::unaliasedFormal(unsigned i, MaybeCheckAliasing checkAliasing) { - JS_ASSERT(i < numFormalArgs()); + MOZ_ASSERT(i < numFormalArgs()); JS_ASSERT_IF(checkAliasing, !script()->argsObjAliasesFormals()); JS_ASSERT_IF(checkAliasing, !script()->formalIsAliased(i)); return argv()[i]; @@ -138,7 +138,7 @@ InterpreterFrame::unaliasedFormal(unsigned i, MaybeCheckAliasing checkAliasing) inline Value & InterpreterFrame::unaliasedActual(unsigned i, MaybeCheckAliasing checkAliasing) { - JS_ASSERT(i < numActualArgs()); + MOZ_ASSERT(i < numActualArgs()); JS_ASSERT_IF(checkAliasing, !script()->argsObjAliasesFormals()); JS_ASSERT_IF(checkAliasing && i < numFormalArgs(), !script()->formalIsAliased(i)); return argv()[i]; @@ -174,15 +174,15 @@ struct CopyToHeap inline ArgumentsObject & InterpreterFrame::argsObj() const { - JS_ASSERT(script()->needsArgsObj()); - JS_ASSERT(flags_ & HAS_ARGS_OBJ); + MOZ_ASSERT(script()->needsArgsObj()); + MOZ_ASSERT(flags_ & HAS_ARGS_OBJ); return *argsObj_; } inline void InterpreterFrame::initArgsObj(ArgumentsObject &argsobj) { - JS_ASSERT(script()->needsArgsObj()); + MOZ_ASSERT(script()->needsArgsObj()); flags_ |= HAS_ARGS_OBJ; argsObj_ = &argsobj; } @@ -199,8 +199,8 @@ InterpreterFrame::aliasedVarScope(ScopeCoordinate sc) const inline void InterpreterFrame::pushOnScopeChain(ScopeObject &scope) { - JS_ASSERT(*scopeChain() == scope.enclosingScope() || - *scopeChain() == scope.as().enclosingScope().as().enclosingScope()); + MOZ_ASSERT(*scopeChain() == scope.enclosingScope() || + *scopeChain() == scope.as().enclosingScope().as().enclosingScope()); scopeChain_ = &scope; flags_ |= HAS_SCOPECHAIN; } @@ -208,21 +208,21 @@ InterpreterFrame::pushOnScopeChain(ScopeObject &scope) inline void InterpreterFrame::popOffScopeChain() { - JS_ASSERT(flags_ & HAS_SCOPECHAIN); + MOZ_ASSERT(flags_ & HAS_SCOPECHAIN); scopeChain_ = &scopeChain_->as().enclosingScope(); } bool InterpreterFrame::hasCallObj() const { - JS_ASSERT(isStrictEvalFrame() || fun()->isHeavyweight()); + MOZ_ASSERT(isStrictEvalFrame() || fun()->isHeavyweight()); return flags_ & HAS_CALL_OBJ; } inline CallObject & InterpreterFrame::callObj() const { - JS_ASSERT(fun()->isHeavyweight()); + MOZ_ASSERT(fun()->isHeavyweight()); JSObject *pobj = scopeChain(); while (MOZ_UNLIKELY(!pobj->is())) @@ -266,7 +266,7 @@ InterpreterStack::getCallFrame(JSContext *cx, const CallArgs &args, HandleScript { JSFunction *fun = &args.callee().as(); - JS_ASSERT(fun->nonLazyScript() == script); + MOZ_ASSERT(fun->nonLazyScript() == script); unsigned nformal = fun->nargs(); unsigned nvals = script->nslots(); @@ -277,7 +277,7 @@ InterpreterStack::getCallFrame(JSContext *cx, const CallArgs &args, HandleScript } // Pad any missing arguments with |undefined|. - JS_ASSERT(args.length() < nformal); + MOZ_ASSERT(args.length() < nformal); nvals += nformal + 2; // Include callee, |this|. uint8_t *buffer = allocateFrame(cx, sizeof(InterpreterFrame) + nvals * sizeof(Value)); @@ -299,15 +299,15 @@ InterpreterStack::pushInlineFrame(JSContext *cx, InterpreterRegs ®s, const Ca HandleScript script, InitialFrameFlags initial) { RootedFunction callee(cx, &args.callee().as()); - JS_ASSERT(regs.sp == args.end()); - JS_ASSERT(callee->nonLazyScript() == script); + MOZ_ASSERT(regs.sp == args.end()); + MOZ_ASSERT(callee->nonLazyScript() == script); script->ensureNonLazyCanonicalFunction(cx); InterpreterFrame *prev = regs.fp(); jsbytecode *prevpc = regs.pc; Value *prevsp = regs.sp; - JS_ASSERT(prev); + MOZ_ASSERT(prev); LifoAlloc::Mark mark = allocator_.mark(); @@ -333,7 +333,7 @@ InterpreterStack::popInlineFrame(InterpreterRegs ®s) regs.popInlineFrame(); regs.sp[-1] = fp->returnValue(); releaseFrame(fp); - JS_ASSERT(regs.fp()); + MOZ_ASSERT(regs.fp()); } template @@ -352,7 +352,7 @@ FrameIter::unaliasedForEachActual(JSContext *cx, Op op) jit::MaybeReadFallback recover(cx, activation()->asJit(), &data_.jitFrames_); ionInlineFrames_.unaliasedForEachActual(cx, op, jit::ReadFrame_Actuals, recover); } else { - JS_ASSERT(data_.jitFrames_.isBaselineJS()); + MOZ_ASSERT(data_.jitFrames_.isBaselineJS()); data_.jitFrames_.unaliasedForEachActual(op, jit::ReadFrame_Actuals); } return; @@ -761,8 +761,8 @@ Activation::Activation(ThreadSafeContext *cx, Kind kind) Activation::~Activation() { JS_ASSERT_IF(isProfiling(), this != cx_->perThreadData->profilingActivation_); - JS_ASSERT(cx_->perThreadData->activation_ == this); - JS_ASSERT(hideScriptedCallerCount_ == 0); + MOZ_ASSERT(cx_->perThreadData->activation_ == this); + MOZ_ASSERT(hideScriptedCallerCount_ == 0); cx_->perThreadData->activation_ = prev_; } @@ -778,7 +778,7 @@ Activation::isProfiling() const if (isForkJoin()) return asForkJoin()->isProfiling(); - JS_ASSERT(isAsmJS()); + MOZ_ASSERT(isAsmJS()); return asAsmJS()->isProfiling(); } @@ -802,7 +802,7 @@ InterpreterActivation::InterpreterActivation(RunState &state, JSContext *cx, { if (!state.isGenerator()) { regs_.prepareToRun(*entryFrame, state.script()); - JS_ASSERT(regs_.pc == state.script()->code()); + MOZ_ASSERT(regs_.pc == state.script()->code()); } else { regs_ = state.asGenerator()->gen()->regs; } @@ -817,7 +817,7 @@ InterpreterActivation::~InterpreterActivation() popInlineFrame(regs_.fp()); JSContext *cx = cx_->asJSContext(); - JS_ASSERT(oldFrameCount_ == cx->runtime()->interpreterStack().frameCount_); + MOZ_ASSERT(oldFrameCount_ == cx->runtime()->interpreterStack().frameCount_); JS_ASSERT_IF(oldFrameCount_ == 0, cx->runtime()->interpreterStack().allocator_.used() == 0); if (state_.isGenerator()) { @@ -838,7 +838,7 @@ InterpreterActivation::pushInlineFrame(const CallArgs &args, HandleScript script JSContext *cx = cx_->asJSContext(); if (!cx->runtime()->interpreterStack().pushInlineFrame(cx, regs_, args, script, initial)) return false; - JS_ASSERT(regs_.fp()->script()->compartment() == compartment()); + MOZ_ASSERT(regs_.fp()->script()->compartment() == compartment()); return true; } @@ -846,8 +846,8 @@ inline void InterpreterActivation::popInlineFrame(InterpreterFrame *frame) { (void)frame; // Quell compiler warning. - JS_ASSERT(regs_.fp() == frame); - JS_ASSERT(regs_.fp() != entryFrame_); + MOZ_ASSERT(regs_.fp() == frame); + MOZ_ASSERT(regs_.fp() != entryFrame_); cx_->asJSContext()->runtime()->interpreterStack().popInlineFrame(regs_); } diff --git a/js/src/vm/Stack.cpp b/js/src/vm/Stack.cpp index 8f3a433e1216..a1a58c24c402 100644 --- a/js/src/vm/Stack.cpp +++ b/js/src/vm/Stack.cpp @@ -43,7 +43,7 @@ InterpreterFrame::initExecuteFrame(JSContext *cx, JSScript *script, AbstractFram JSObject *callee = nullptr; if (!(flags_ & (GLOBAL))) { if (evalInFramePrev) { - JS_ASSERT(evalInFramePrev.isFunctionFrame() || evalInFramePrev.isGlobalFrame()); + MOZ_ASSERT(evalInFramePrev.isFunctionFrame() || evalInFramePrev.isGlobalFrame()); if (evalInFramePrev.isFunctionFrame()) { callee = evalInFramePrev.callee(); flags_ |= FUNCTION; @@ -52,8 +52,8 @@ InterpreterFrame::initExecuteFrame(JSContext *cx, JSScript *script, AbstractFram } } else { FrameIter iter(cx); - JS_ASSERT(iter.isFunctionFrame() || iter.isGlobalFrame()); - JS_ASSERT(!iter.isAsmJS()); + MOZ_ASSERT(iter.isFunctionFrame() || iter.isGlobalFrame()); + MOZ_ASSERT(!iter.isAsmJS()); if (iter.isFunctionFrame()) { callee = iter.callee(); flags_ |= FUNCTION; @@ -71,7 +71,7 @@ InterpreterFrame::initExecuteFrame(JSContext *cx, JSScript *script, AbstractFram exec.fun = &callee->as(); u.evalScript = script; } else { - JS_ASSERT(isGlobalFrame()); + MOZ_ASSERT(isGlobalFrame()); dstvp[0] = NullValue(); exec.script = script; #ifdef DEBUG @@ -97,9 +97,9 @@ void InterpreterFrame::copyFrameAndValues(JSContext *cx, Value *vp, InterpreterFrame *otherfp, const Value *othervp, Value *othersp) { - JS_ASSERT(othervp == otherfp->generatorArgsSnapshotBegin()); - JS_ASSERT(othersp >= otherfp->slots()); - JS_ASSERT(othersp <= otherfp->generatorSlotsSnapshotBegin() + otherfp->script()->nslots()); + MOZ_ASSERT(othervp == otherfp->generatorArgsSnapshotBegin()); + MOZ_ASSERT(othersp >= otherfp->slots()); + MOZ_ASSERT(othersp <= otherfp->generatorSlotsSnapshotBegin() + otherfp->script()->nslots()); /* Copy args, InterpreterFrame, and slots. */ const Value *srcend = otherfp->generatorArgsSnapshotEnd(); @@ -165,7 +165,7 @@ InterpreterFrame::copyRawFrameSlots(AutoValueVector *vec) JSObject * InterpreterFrame::createRestParameter(JSContext *cx) { - JS_ASSERT(fun()->hasRest()); + MOZ_ASSERT(fun()->hasRest()); unsigned nformal = fun()->nargs() - 1, nactual = numActualArgs(); unsigned nrest = (nactual > nformal) ? nactual - nformal : 0; Value *restvp = argv() + nformal; @@ -185,15 +185,15 @@ AssertDynamicScopeMatchesStaticScope(JSContext *cx, JSScript *script, JSObject * if (i.hasDynamicScopeObject()) { switch (i.type()) { case StaticScopeIter::BLOCK: - JS_ASSERT(&i.block() == scope->as().staticScope()); + MOZ_ASSERT(&i.block() == scope->as().staticScope()); scope = &scope->as().enclosingScope(); break; case StaticScopeIter::WITH: - JS_ASSERT(&i.staticWith() == scope->as().staticScope()); + MOZ_ASSERT(&i.staticWith() == scope->as().staticScope()); scope = &scope->as().enclosingScope(); break; case StaticScopeIter::FUNCTION: - JS_ASSERT(scope->as().callee().nonLazyScript() == i.funScript()); + MOZ_ASSERT(scope->as().callee().nonLazyScript() == i.funScript()); scope = &scope->as().enclosingScope(); break; case StaticScopeIter::NAMED_LAMBDA: @@ -204,7 +204,7 @@ AssertDynamicScopeMatchesStaticScope(JSContext *cx, JSScript *script, JSObject * } /* - * Ideally, we'd JS_ASSERT(!scope->is()) but the enclosing + * Ideally, we'd MOZ_ASSERT(!scope->is()) but the enclosing * lexical scope chain stops at eval() boundaries. See StaticScopeIter * comment. */ @@ -227,8 +227,8 @@ InterpreterFrame::prologue(JSContext *cx) { RootedScript script(cx, this->script()); - JS_ASSERT(!isGeneratorFrame()); - JS_ASSERT(cx->interpreterRegs().pc == script->code()); + MOZ_ASSERT(!isGeneratorFrame()); + MOZ_ASSERT(cx->interpreterRegs().pc == script->code()); if (isEvalFrame()) { if (script->strict()) { @@ -244,7 +244,7 @@ InterpreterFrame::prologue(JSContext *cx) if (isGlobalFrame()) return probes::EnterScript(cx, script, nullptr, this); - JS_ASSERT(isNonEvalFunctionFrame()); + MOZ_ASSERT(isNonEvalFunctionFrame()); AssertDynamicScopeMatchesStaticScope(cx, script, scopeChain()); if (fun()->isHeavyweight() && !initFunctionScopeObjects(cx)) @@ -265,7 +265,7 @@ InterpreterFrame::prologue(JSContext *cx) void InterpreterFrame::epilogue(JSContext *cx) { - JS_ASSERT(!isYielding()); + MOZ_ASSERT(!isYielding()); RootedScript script(cx, this->script()); probes::ExitScript(cx, script, script->functionNonDelazifying(), hasPushedSPSFrame()); @@ -277,7 +277,7 @@ InterpreterFrame::epilogue(JSContext *cx) DebugScopes::onPopStrictEvalScope(this); } else if (isDirectEvalFrame()) { if (isDebuggerFrame()) - JS_ASSERT(!scopeChain()->is()); + MOZ_ASSERT(!scopeChain()->is()); } else { /* * Debugger.Object.prototype.evalInGlobal creates indirect eval @@ -287,21 +287,21 @@ InterpreterFrame::epilogue(JSContext *cx) * bindings. */ if (isDebuggerFrame()) { - JS_ASSERT(scopeChain()->is() || - scopeChain()->enclosingScope()->is()); + MOZ_ASSERT(scopeChain()->is() || + scopeChain()->enclosingScope()->is()); } else { - JS_ASSERT(scopeChain()->is()); + MOZ_ASSERT(scopeChain()->is()); } } return; } if (isGlobalFrame()) { - JS_ASSERT(!scopeChain()->is()); + MOZ_ASSERT(!scopeChain()->is()); return; } - JS_ASSERT(isNonEvalFunctionFrame()); + MOZ_ASSERT(isNonEvalFunctionFrame()); if (fun()->isHeavyweight()) JS_ASSERT_IF(hasCallObj(), @@ -319,7 +319,7 @@ InterpreterFrame::epilogue(JSContext *cx) bool InterpreterFrame::pushBlock(JSContext *cx, StaticBlockObject &block) { - JS_ASSERT (block.needsClone()); + MOZ_ASSERT(block.needsClone()); Rooted blockHandle(cx, &block); ClonedBlockObject *clone = ClonedBlockObject::create(cx, blockHandle, this); @@ -334,7 +334,7 @@ InterpreterFrame::pushBlock(JSContext *cx, StaticBlockObject &block) void InterpreterFrame::popBlock(JSContext *cx) { - JS_ASSERT(scopeChain_->is()); + MOZ_ASSERT(scopeChain_->is()); popOffScopeChain(); } @@ -344,7 +344,7 @@ InterpreterFrame::popWith(JSContext *cx) if (MOZ_UNLIKELY(cx->compartment()->debugMode())) DebugScopes::onPopWith(this); - JS_ASSERT(scopeChain()->is()); + MOZ_ASSERT(scopeChain()->is()); popOffScopeChain(); } @@ -383,7 +383,7 @@ InterpreterFrame::markValues(JSTracer *trc, unsigned start, unsigned end) void InterpreterFrame::markValues(JSTracer *trc, Value *sp, jsbytecode *pc) { - JS_ASSERT(sp >= slots()); + MOZ_ASSERT(sp >= slots()); NestedScopeObject *staticScope; @@ -456,7 +456,7 @@ InterpreterRegs::setToEndOfScript() JSScript *script = fp()->script(); sp = fp()->base(); pc = script->codeEnd() - JSOP_RETRVAL_LENGTH; - JS_ASSERT(*pc == JSOP_RETRVAL); + MOZ_ASSERT(*pc == JSOP_RETRVAL); } /*****************************************************************************/ @@ -512,7 +512,7 @@ FrameIter::popActivation() void FrameIter::popInterpreterFrame() { - JS_ASSERT(data_.state_ == INTERP); + MOZ_ASSERT(data_.state_ == INTERP); ++data_.interpFrames_; @@ -541,8 +541,8 @@ FrameIter::settleOnActivation() } // Skip activations from another context if needed. - JS_ASSERT(activation->cx()); - JS_ASSERT(data_.cx_); + MOZ_ASSERT(activation->cx()); + MOZ_ASSERT(data_.cx_); if (data_.contextOption_ == CURRENT_CONTEXT && activation->cx() != data_.cx_) { ++data_.activations_; continue; @@ -597,7 +597,7 @@ FrameIter::settleOnActivation() continue; } - JS_ASSERT(activation->isInterpreter()); + MOZ_ASSERT(activation->isInterpreter()); InterpreterActivation *interpAct = activation->asInterpreter(); data_.interpFrames_ = InterpreterFrameIterator(interpAct); @@ -612,7 +612,7 @@ FrameIter::settleOnActivation() } } - JS_ASSERT(!data_.interpFrames_.frame()->runningInJit()); + MOZ_ASSERT(!data_.interpFrames_.frame()->runningInJit()); data_.pc_ = data_.interpFrames_.pc(); data_.state_ = INTERP; return; @@ -687,7 +687,7 @@ FrameIter::FrameIter(const Data &data) : data_(data), ionInlineFrames_(data.cx_, data_.jitFrames_.isIonJS() ? &data_.jitFrames_ : nullptr) { - JS_ASSERT(data.cx_); + MOZ_ASSERT(data.cx_); if (data_.jitFrames_.isIonJS()) { while (ionInlineFrames_.frameNo() != data.ionInlineFrameNo_) @@ -702,7 +702,7 @@ FrameIter::nextJitFrame() ionInlineFrames_.resetOn(&data_.jitFrames_); data_.pc_ = ionInlineFrames_.pc(); } else { - JS_ASSERT(data_.jitFrames_.isBaselineJS()); + MOZ_ASSERT(data_.jitFrames_.isBaselineJS()); data_.jitFrames_.baselineScriptAndPc(nullptr, &data_.pc_); } } @@ -710,7 +710,7 @@ FrameIter::nextJitFrame() void FrameIter::popJitFrame() { - JS_ASSERT(data_.state_ == JIT); + MOZ_ASSERT(data_.state_ == JIT); if (data_.jitFrames_.isIonJS() && ionInlineFrames_.more()) { ++ionInlineFrames_; @@ -733,7 +733,7 @@ FrameIter::popJitFrame() void FrameIter::popAsmJSFrame() { - JS_ASSERT(data_.state_ == ASMJS); + MOZ_ASSERT(data_.state_ == ASMJS); ++data_.asmJSFrames_; if (data_.asmJSFrames_.done()) @@ -788,7 +788,7 @@ FrameIter::Data * FrameIter::copyData() const { Data *data = data_.cx_->new_(data_); - JS_ASSERT(data_.state_ != ASMJS); + MOZ_ASSERT(data_.state_ != ASMJS); if (data && data_.jitFrames_.isIonJS()) data->ionInlineFrameNo_ = ionInlineFrames_.frameNo(); return data; @@ -826,7 +826,7 @@ FrameIter::isFunctionFrame() const case INTERP: return interpFrame()->isFunctionFrame(); case JIT: - JS_ASSERT(data_.jitFrames_.isScripted()); + MOZ_ASSERT(data_.jitFrames_.isScripted()); if (data_.jitFrames_.isBaselineJS()) return data_.jitFrames_.isFunctionFrame(); return ionInlineFrames_.isFunctionFrame(); @@ -847,7 +847,7 @@ FrameIter::isGlobalFrame() const case JIT: if (data_.jitFrames_.isBaselineJS()) return data_.jitFrames_.baselineFrame()->isGlobalFrame(); - JS_ASSERT(!script()->isForEval()); + MOZ_ASSERT(!script()->isForEval()); return !script()->functionNonDelazifying(); case ASMJS: return false; @@ -866,7 +866,7 @@ FrameIter::isEvalFrame() const case JIT: if (data_.jitFrames_.isBaselineJS()) return data_.jitFrames_.baselineFrame()->isEvalFrame(); - JS_ASSERT(!script()->isForEval()); + MOZ_ASSERT(!script()->isForEval()); return false; case ASMJS: return false; @@ -877,7 +877,7 @@ FrameIter::isEvalFrame() const bool FrameIter::isNonEvalFunctionFrame() const { - JS_ASSERT(!done()); + MOZ_ASSERT(!done()); switch (data_.state_) { case DONE: break; @@ -910,7 +910,7 @@ FrameIter::isGeneratorFrame() const JSAtom * FrameIter::functionDisplayAtom() const { - JS_ASSERT(isNonEvalFunctionFrame()); + MOZ_ASSERT(isNonEvalFunctionFrame()); switch (data_.state_) { case DONE: @@ -999,7 +999,7 @@ FrameIter::isConstructing() const case JIT: if (data_.jitFrames_.isIonJS()) return ionInlineFrames_.isConstructing(); - JS_ASSERT(data_.jitFrames_.isBaselineJS()); + MOZ_ASSERT(data_.jitFrames_.isBaselineJS()); return data_.jitFrames_.isConstructing(); case INTERP: return interpFrame()->isConstructing(); @@ -1054,7 +1054,7 @@ FrameIter::abstractFramePtr() const break; } case INTERP: - JS_ASSERT(interpFrame()); + MOZ_ASSERT(interpFrame()); return AbstractFramePtr(interpFrame()); } MOZ_CRASH("Unexpected state"); @@ -1077,7 +1077,7 @@ FrameIter::updatePcQuadratic() ++data_.interpFrames_; // Update the pc. - JS_ASSERT(data_.interpFrames_.frame() == frame); + MOZ_ASSERT(data_.interpFrames_.frame() == frame); data_.pc_ = data_.interpFrames_.pc(); return; } @@ -1098,7 +1098,7 @@ FrameIter::updatePcQuadratic() ++data_.jitFrames_; // Update the pc. - JS_ASSERT(data_.jitFrames_.baselineFrame() == frame); + MOZ_ASSERT(data_.jitFrames_.baselineFrame() == frame); data_.jitFrames_.baselineScriptAndPc(nullptr, &data_.pc_); return; } @@ -1115,12 +1115,12 @@ FrameIter::callee() const case ASMJS: break; case INTERP: - JS_ASSERT(isFunctionFrame()); + MOZ_ASSERT(isFunctionFrame()); return &interpFrame()->callee(); case JIT: if (data_.jitFrames_.isBaselineJS()) return data_.jitFrames_.callee(); - JS_ASSERT(data_.jitFrames_.isIonJS()); + MOZ_ASSERT(data_.jitFrames_.isIonJS()); return ionInlineFrames_.callee(); } MOZ_CRASH("Unexpected state"); @@ -1134,7 +1134,7 @@ FrameIter::calleev() const case ASMJS: break; case INTERP: - JS_ASSERT(isFunctionFrame()); + MOZ_ASSERT(isFunctionFrame()); return interpFrame()->calleev(); case JIT: return ObjectValue(*callee()); @@ -1150,13 +1150,13 @@ FrameIter::numActualArgs() const case ASMJS: break; case INTERP: - JS_ASSERT(isFunctionFrame()); + MOZ_ASSERT(isFunctionFrame()); return interpFrame()->numActualArgs(); case JIT: if (data_.jitFrames_.isIonJS()) return ionInlineFrames_.numActualArgs(); - JS_ASSERT(data_.jitFrames_.isBaselineJS()); + MOZ_ASSERT(data_.jitFrames_.isBaselineJS()); return data_.jitFrames_.numActualArgs(); } MOZ_CRASH("Unexpected state"); @@ -1194,7 +1194,7 @@ FrameIter::scopeChain() const CallObject & FrameIter::callObj() const { - JS_ASSERT(callee()->isHeavyweight()); + MOZ_ASSERT(callee()->isHeavyweight()); JSObject *pobj = scopeChain(); while (!pobj->is()) @@ -1218,7 +1218,7 @@ FrameIter::argsObj() const bool FrameIter::computeThis(JSContext *cx) const { - JS_ASSERT(!done() && !isAsmJS()); + MOZ_ASSERT(!done() && !isAsmJS()); assertSameCompartment(cx, scopeChain()); return ComputeThis(cx, abstractFramePtr()); } @@ -1301,7 +1301,7 @@ FrameIter::numFrameSlots() const return frame->numValueSlots() - data_.jitFrames_.script()->nfixed(); } case INTERP: - JS_ASSERT(data_.interpFrames_.sp() >= interpFrame()->base()); + MOZ_ASSERT(data_.interpFrames_.sp() >= interpFrame()->base()); return data_.interpFrames_.sp() - interpFrame()->base(); } MOZ_CRASH("Unexpected state"); @@ -1390,9 +1390,9 @@ js::CheckLocalUnaliased(MaybeCheckAliasing checkAliasing, JSScript *script, uint if (!checkAliasing) return; - JS_ASSERT(i < script->nfixed()); + MOZ_ASSERT(i < script->nfixed()); if (i < script->bindings.numVars()) { - JS_ASSERT(!script->varIsAliased(i)); + MOZ_ASSERT(!script->varIsAliased(i)); } else { // FIXME: The callers of this function do not easily have the PC of the // current frame, and so they do not know the block scope. @@ -1448,8 +1448,8 @@ jit::JitActivation::setActive(JSContext *cx, bool active) { // Only allowed to deactivate/activate if activation is top. // (Not tested and will probably fail in other situations.) - JS_ASSERT(cx->mainThread().activation_ == this); - JS_ASSERT(active != active_); + MOZ_ASSERT(cx->mainThread().activation_ == this); + MOZ_ASSERT(active != active_); active_ = active; if (active) { @@ -1636,13 +1636,13 @@ AsmJSActivation::~AsmJSActivation() if (profiler_) profiler_->exitAsmJS(); - JS_ASSERT(fp_ == nullptr); + MOZ_ASSERT(fp_ == nullptr); - JS_ASSERT(module_.activation() == this); + MOZ_ASSERT(module_.activation() == this); module_.activation() = prevAsmJSForModule_; JSContext *cx = cx_->asJSContext(); - JS_ASSERT(cx->mainThread().asmJSActivationStack_ == this); + MOZ_ASSERT(cx->mainThread().asmJSActivationStack_ == this); JSRuntime::AutoLockForInterrupt lock(cx->runtime()); cx->mainThread().asmJSActivationStack_ = prevAsmJS_; @@ -1651,7 +1651,7 @@ AsmJSActivation::~AsmJSActivation() InterpreterFrameIterator & InterpreterFrameIterator::operator++() { - JS_ASSERT(!done()); + MOZ_ASSERT(!done()); if (fp_ != activation_->entryFrame_) { pc_ = fp_->prevpc(); sp_ = fp_->prevsp(); @@ -1667,7 +1667,7 @@ InterpreterFrameIterator::operator++() void Activation::registerProfiling() { - JS_ASSERT(isProfiling()); + MOZ_ASSERT(isProfiling()); JSRuntime::AutoLockForInterrupt lock(cx_->asJSContext()->runtime()); cx_->perThreadData->profilingActivation_ = this; } @@ -1675,9 +1675,9 @@ Activation::registerProfiling() void Activation::unregisterProfiling() { - JS_ASSERT(isProfiling()); + MOZ_ASSERT(isProfiling()); JSRuntime::AutoLockForInterrupt lock(cx_->asJSContext()->runtime()); - JS_ASSERT(cx_->perThreadData->profilingActivation_ == this); + MOZ_ASSERT(cx_->perThreadData->profilingActivation_ == this); cx_->perThreadData->profilingActivation_ = prevProfiling_; } @@ -1698,7 +1698,7 @@ ActivationIterator::ActivationIterator(PerThreadData *perThreadData) ActivationIterator & ActivationIterator::operator++() { - JS_ASSERT(activation_); + MOZ_ASSERT(activation_); if (activation_->isJit() && activation_->asJit()->isActive()) jitTop_ = activation_->asJit()->prevJitTop(); activation_ = activation_->prev(); @@ -1721,7 +1721,7 @@ JS::ProfilingFrameIterator::ProfilingFrameIterator(JSRuntime *rt, const Register if (!activation_) return; - JS_ASSERT(activation_->isProfiling()); + MOZ_ASSERT(activation_->isProfiling()); static_assert(sizeof(AsmJSProfilingFrameIterator) <= StorageSpace, "Need to increase storage"); @@ -1732,7 +1732,7 @@ JS::ProfilingFrameIterator::ProfilingFrameIterator(JSRuntime *rt, const Register JS::ProfilingFrameIterator::~ProfilingFrameIterator() { if (!done()) { - JS_ASSERT(activation_->isProfiling()); + MOZ_ASSERT(activation_->isProfiling()); iteratorDestroy(); } } @@ -1740,9 +1740,9 @@ JS::ProfilingFrameIterator::~ProfilingFrameIterator() void JS::ProfilingFrameIterator::operator++() { - JS_ASSERT(!done()); + MOZ_ASSERT(!done()); - JS_ASSERT(activation_->isAsmJS()); + MOZ_ASSERT(activation_->isAsmJS()); ++asmJSIter(); settle(); } @@ -1762,53 +1762,53 @@ JS::ProfilingFrameIterator::settle() void JS::ProfilingFrameIterator::iteratorConstruct(const RegisterState &state) { - JS_ASSERT(!done()); + MOZ_ASSERT(!done()); - JS_ASSERT(activation_->isAsmJS()); + MOZ_ASSERT(activation_->isAsmJS()); new (storage_.addr()) AsmJSProfilingFrameIterator(*activation_->asAsmJS(), state); } void JS::ProfilingFrameIterator::iteratorConstruct() { - JS_ASSERT(!done()); + MOZ_ASSERT(!done()); - JS_ASSERT(activation_->isAsmJS()); + MOZ_ASSERT(activation_->isAsmJS()); new (storage_.addr()) AsmJSProfilingFrameIterator(*activation_->asAsmJS()); } void JS::ProfilingFrameIterator::iteratorDestroy() { - JS_ASSERT(!done()); + MOZ_ASSERT(!done()); - JS_ASSERT(activation_->isAsmJS()); + MOZ_ASSERT(activation_->isAsmJS()); asmJSIter().~AsmJSProfilingFrameIterator(); } bool JS::ProfilingFrameIterator::iteratorDone() { - JS_ASSERT(!done()); + MOZ_ASSERT(!done()); - JS_ASSERT(activation_->isAsmJS()); + MOZ_ASSERT(activation_->isAsmJS()); return asmJSIter().done(); } void * JS::ProfilingFrameIterator::stackAddress() const { - JS_ASSERT(!done()); + MOZ_ASSERT(!done()); - JS_ASSERT(activation_->isAsmJS()); + MOZ_ASSERT(activation_->isAsmJS()); return asmJSIter().stackAddress(); } const char * JS::ProfilingFrameIterator::label() const { - JS_ASSERT(!done()); + MOZ_ASSERT(!done()); - JS_ASSERT(activation_->isAsmJS()); + MOZ_ASSERT(activation_->isAsmJS()); return asmJSIter().label(); } diff --git a/js/src/vm/Stack.h b/js/src/vm/Stack.h index 9b5d0e598ebf..51ef46a2d056 100644 --- a/js/src/vm/Stack.h +++ b/js/src/vm/Stack.h @@ -149,27 +149,27 @@ class AbstractFramePtr return (ptr_ & TagMask) == Tag_InterpreterFrame; } InterpreterFrame *asInterpreterFrame() const { - JS_ASSERT(isInterpreterFrame()); + MOZ_ASSERT(isInterpreterFrame()); InterpreterFrame *res = (InterpreterFrame *)(ptr_ & ~TagMask); - JS_ASSERT(res); + MOZ_ASSERT(res); return res; } bool isBaselineFrame() const { return (ptr_ & TagMask) == Tag_BaselineFrame; } jit::BaselineFrame *asBaselineFrame() const { - JS_ASSERT(isBaselineFrame()); + MOZ_ASSERT(isBaselineFrame()); jit::BaselineFrame *res = (jit::BaselineFrame *)(ptr_ & ~TagMask); - JS_ASSERT(res); + MOZ_ASSERT(res); return res; } bool isRematerializedFrame() const { return (ptr_ & TagMask) == Tag_RematerializedFrame; } jit::RematerializedFrame *asRematerializedFrame() const { - JS_ASSERT(isRematerializedFrame()); + MOZ_ASSERT(isRematerializedFrame()); jit::RematerializedFrame *res = (jit::RematerializedFrame *)(ptr_ & ~TagMask); - JS_ASSERT(res); + MOZ_ASSERT(res); return res; } @@ -507,7 +507,7 @@ class InterpreterFrame } AbstractFramePtr evalInFramePrev() const { - JS_ASSERT(isEvalFrame()); + MOZ_ASSERT(isEvalFrame()); return evalInFramePrev_; } @@ -539,8 +539,8 @@ class InterpreterFrame bool copyRawFrameSlots(AutoValueVector *v); - unsigned numFormalArgs() const { JS_ASSERT(hasArgs()); return fun()->nargs(); } - unsigned numActualArgs() const { JS_ASSERT(hasArgs()); return u.nactual; } + unsigned numFormalArgs() const { MOZ_ASSERT(hasArgs()); return fun()->nargs(); } + unsigned numActualArgs() const { MOZ_ASSERT(hasArgs()); return u.nactual; } /* Watch out, this exposes a pointer to the unaliased formal arg array. */ Value *argv() const { return argv_; } @@ -632,13 +632,13 @@ class InterpreterFrame /* Return the previous frame's pc. */ jsbytecode *prevpc() { - JS_ASSERT(prev_); + MOZ_ASSERT(prev_); return prevpc_; } /* Return the previous frame's sp. */ Value *prevsp() { - JS_ASSERT(prev_); + MOZ_ASSERT(prev_); return prevsp_; } @@ -652,7 +652,7 @@ class InterpreterFrame */ JSFunction* fun() const { - JS_ASSERT(isFunctionFrame()); + MOZ_ASSERT(isFunctionFrame()); return exec.fun; } @@ -674,14 +674,14 @@ class InterpreterFrame */ Value &functionThis() const { - JS_ASSERT(isFunctionFrame()); + MOZ_ASSERT(isFunctionFrame()); if (isEvalFrame()) return ((Value *)this)[-1]; return argv()[-1]; } JSObject &constructorThis() const { - JS_ASSERT(hasArgs()); + MOZ_ASSERT(hasArgs()); return argv()[-1].toObject(); } @@ -701,12 +701,12 @@ class InterpreterFrame */ JSFunction &callee() const { - JS_ASSERT(isFunctionFrame()); + MOZ_ASSERT(isFunctionFrame()); return calleev().toObject().as(); } const Value &calleev() const { - JS_ASSERT(isFunctionFrame()); + MOZ_ASSERT(isFunctionFrame()); return mutableCalleev(); } @@ -714,12 +714,12 @@ class InterpreterFrame Value &calleev = flags_ & (EVAL | GLOBAL) ? ((Value *)this)[-2] : argv()[-2]; - JS_ASSERT(calleev.isObjectOrNull()); + MOZ_ASSERT(calleev.isObjectOrNull()); return calleev; } Value &mutableCalleev() const { - JS_ASSERT(isFunctionFrame()); + MOZ_ASSERT(isFunctionFrame()); if (isEvalFrame()) return ((Value *)this)[-2]; return argv()[-2]; @@ -797,23 +797,23 @@ class InterpreterFrame } void initGeneratorFrame() const { - JS_ASSERT(!isGeneratorFrame()); - JS_ASSERT(isNonEvalFunctionFrame()); + MOZ_ASSERT(!isGeneratorFrame()); + MOZ_ASSERT(isNonEvalFunctionFrame()); flags_ |= GENERATOR; } Value *generatorArgsSnapshotBegin() const { - JS_ASSERT(isGeneratorFrame()); + MOZ_ASSERT(isGeneratorFrame()); return argv() - 2; } Value *generatorArgsSnapshotEnd() const { - JS_ASSERT(isGeneratorFrame()); + MOZ_ASSERT(isGeneratorFrame()); return argv() + js::Max(numActualArgs(), numFormalArgs()); } Value *generatorSlotsSnapshotBegin() const { - JS_ASSERT(isGeneratorFrame()); + MOZ_ASSERT(isGeneratorFrame()); return (Value *)(this + 1); } @@ -833,7 +833,7 @@ class InterpreterFrame JS_STATIC_ASSERT((int)INITIAL_NONE == 0); JS_STATIC_ASSERT((int)INITIAL_CONSTRUCT == (int)CONSTRUCTING); uint32_t mask = CONSTRUCTING; - JS_ASSERT((flags_ & mask) != mask); + MOZ_ASSERT((flags_ & mask) != mask); return InitialFrameFlags(flags_ & mask); } @@ -860,16 +860,16 @@ class InterpreterFrame } bool hasArgsObj() const { - JS_ASSERT(script()->needsArgsObj()); + MOZ_ASSERT(script()->needsArgsObj()); return flags_ & HAS_ARGS_OBJ; } void setUseNewType() { - JS_ASSERT(isConstructing()); + MOZ_ASSERT(isConstructing()); flags_ |= USE_NEW_TYPE; } bool useNewType() const { - JS_ASSERT(isConstructing()); + MOZ_ASSERT(isConstructing()); return flags_ & USE_NEW_TYPE; } @@ -898,17 +898,17 @@ class InterpreterFrame } bool isSuspended() const { - JS_ASSERT(isGeneratorFrame()); + MOZ_ASSERT(isGeneratorFrame()); return flags_ & SUSPENDED; } void setSuspended() { - JS_ASSERT(isGeneratorFrame()); + MOZ_ASSERT(isGeneratorFrame()); flags_ |= SUSPENDED; } void clearSuspended() { - JS_ASSERT(isGeneratorFrame()); + MOZ_ASSERT(isGeneratorFrame()); flags_ &= ~SUSPENDED; } @@ -962,12 +962,12 @@ class InterpreterRegs InterpreterFrame *fp() const { return fp_; } unsigned stackDepth() const { - JS_ASSERT(sp >= fp_->base()); + MOZ_ASSERT(sp >= fp_->base()); return sp - fp_->base(); } Value *spForStackDepth(unsigned depth) const { - JS_ASSERT(fp_->script()->nfixed() + depth <= fp_->script()->nslots()); + MOZ_ASSERT(fp_->script()->nfixed() + depth <= fp_->script()->nslots()); return fp_->base() + depth; } @@ -976,14 +976,14 @@ class InterpreterRegs fp_ = &to; sp = to.slots() + (from.sp - from.fp_->slots()); pc = from.pc; - JS_ASSERT(fp_); + MOZ_ASSERT(fp_); } void popInlineFrame() { pc = fp_->prevpc(); sp = fp_->prevsp() - fp_->numActualArgs() - 1; fp_ = fp_->prev(); - JS_ASSERT(fp_); + MOZ_ASSERT(fp_); } void prepareToRun(InterpreterFrame &fp, JSScript *script) { pc = script->code(); @@ -1034,7 +1034,7 @@ class InterpreterStack { } ~InterpreterStack() { - JS_ASSERT(frameCount_ == 0); + MOZ_ASSERT(frameCount_ == 0); } // For execution of eval or global code. @@ -1160,19 +1160,19 @@ class Activation void unregisterProfiling(); InterpreterActivation *asInterpreter() const { - JS_ASSERT(isInterpreter()); + MOZ_ASSERT(isInterpreter()); return (InterpreterActivation *)this; } jit::JitActivation *asJit() const { - JS_ASSERT(isJit()); + MOZ_ASSERT(isJit()); return (jit::JitActivation *)this; } ForkJoinActivation *asForkJoin() const { - JS_ASSERT(isForkJoin()); + MOZ_ASSERT(isForkJoin()); return (ForkJoinActivation *)this; } AsmJSActivation *asAsmJS() const { - JS_ASSERT(isAsmJS()); + MOZ_ASSERT(isAsmJS()); return (AsmJSActivation *)this; } @@ -1180,7 +1180,7 @@ class Activation savedFrameChain_++; } void restoreFrameChain() { - JS_ASSERT(savedFrameChain_ > 0); + MOZ_ASSERT(savedFrameChain_ > 0); savedFrameChain_--; } bool hasSavedFrameChain() const { @@ -1191,7 +1191,7 @@ class Activation hideScriptedCallerCount_++; } void unhideScriptedCaller() { - JS_ASSERT(hideScriptedCallerCount_ > 0); + MOZ_ASSERT(hideScriptedCallerCount_ > 0); hideScriptedCallerCount_--; } bool scriptedCallerIsHidden() const { @@ -1292,7 +1292,7 @@ class ActivationIterator return activation_; } uint8_t *jitTop() const { - JS_ASSERT(activation_->isJit()); + MOZ_ASSERT(activation_->isJit()); return jitTop_; } bool done() const { @@ -1362,7 +1362,7 @@ class JitActivation : public Activation return offsetof(JitActivation, prevJitJSContext_); } static size_t offsetOfActiveUint8() { - JS_ASSERT(sizeof(bool) == 1); + MOZ_ASSERT(sizeof(bool) == 1); return offsetof(JitActivation, active_); } @@ -1474,15 +1474,15 @@ class InterpreterFrameIterator } InterpreterFrame *frame() const { - JS_ASSERT(!done()); + MOZ_ASSERT(!done()); return fp_; } jsbytecode *pc() const { - JS_ASSERT(!done()); + MOZ_ASSERT(!done()); return pc_; } Value *sp() const { - JS_ASSERT(!done()); + MOZ_ASSERT(!done()); return sp_; } @@ -1617,9 +1617,9 @@ class FrameIter JSCompartment *compartment() const; Activation *activation() const { return data_.activations_.activation(); } - bool isInterp() const { JS_ASSERT(!done()); return data_.state_ == INTERP; } - bool isJit() const { JS_ASSERT(!done()); return data_.state_ == JIT; } - bool isAsmJS() const { JS_ASSERT(!done()); return data_.state_ == ASMJS; } + bool isInterp() const { MOZ_ASSERT(!done()); return data_.state_ == INTERP; } + bool isJit() const { MOZ_ASSERT(!done()); return data_.state_ == JIT; } + bool isAsmJS() const { MOZ_ASSERT(!done()); return data_.state_ == ASMJS; } inline bool isIon() const; inline bool isBaseline() const; @@ -1649,7 +1649,7 @@ class FrameIter inline JSScript *script() const; bool isConstructing() const; - jsbytecode *pc() const { JS_ASSERT(!done()); return data_.pc_; } + jsbytecode *pc() const { MOZ_ASSERT(!done()); return data_.pc_; } void updatePcQuadratic(); JSFunction *callee() const; Value calleev() const; @@ -1871,10 +1871,10 @@ class AllFramesIter : public ScriptFrameIter inline JSScript * FrameIter::script() const { - JS_ASSERT(!done()); + MOZ_ASSERT(!done()); if (data_.state_ == INTERP) return interpFrame()->script(); - JS_ASSERT(data_.state_ == JIT); + MOZ_ASSERT(data_.state_ == JIT); if (data_.jitFrames_.isIonJS()) return ionInlineFrames_.script(); return data_.jitFrames_.script(); @@ -1895,7 +1895,7 @@ FrameIter::isBaseline() const inline InterpreterFrame * FrameIter::interpFrame() const { - JS_ASSERT(data_.state_ == INTERP); + MOZ_ASSERT(data_.state_ == INTERP); return data_.interpFrames_.frame(); } diff --git a/js/src/vm/String-inl.h b/js/src/vm/String-inl.h index 0afa1cfcf197..2812f4c6a59e 100644 --- a/js/src/vm/String-inl.h +++ b/js/src/vm/String-inl.h @@ -202,7 +202,7 @@ JSDependentString::new_(js::ExclusiveContext *cx, JSLinearString *baseArg, size_ inline void JSString::markBase(JSTracer *trc) { - JS_ASSERT(hasBase()); + MOZ_ASSERT(hasBase()); js::gc::MarkStringUnbarriered(trc, &d.s.u3.base, "base"); } @@ -226,7 +226,7 @@ template MOZ_ALWAYS_INLINE JSFlatString * JSFlatString::new_(js::ThreadSafeContext *cx, const CharT *chars, size_t length) { - JS_ASSERT(chars[length] == CharT(0)); + MOZ_ASSERT(chars[length] == CharT(0)); if (!validateLength(cx, length)) return nullptr; @@ -244,7 +244,7 @@ JSFlatString::toPropertyName(JSContext *cx) { #ifdef DEBUG uint32_t dummy; - JS_ASSERT(!isIndex(&dummy)); + MOZ_ASSERT(!isIndex(&dummy)); #endif if (isAtom()) return asAtom().asPropertyName(); @@ -264,7 +264,7 @@ JSInlineString::new_(js::ThreadSafeContext *cx) MOZ_ALWAYS_INLINE char16_t * JSInlineString::initTwoByte(size_t length) { - JS_ASSERT(twoByteLengthFits(length)); + MOZ_ASSERT(twoByteLengthFits(length)); d.u1.length = length; d.u1.flags = INIT_INLINE_FLAGS; return d.inlineStorageTwoByte; @@ -273,7 +273,7 @@ JSInlineString::initTwoByte(size_t length) MOZ_ALWAYS_INLINE JS::Latin1Char * JSInlineString::initLatin1(size_t length) { - JS_ASSERT(latin1LengthFits(length)); + MOZ_ASSERT(latin1LengthFits(length)); d.u1.length = length; d.u1.flags = INIT_INLINE_FLAGS | LATIN1_CHARS_BIT; return d.inlineStorageLatin1; @@ -282,7 +282,7 @@ JSInlineString::initLatin1(size_t length) MOZ_ALWAYS_INLINE char16_t * JSFatInlineString::initTwoByte(size_t length) { - JS_ASSERT(twoByteLengthFits(length)); + MOZ_ASSERT(twoByteLengthFits(length)); d.u1.length = length; d.u1.flags = INIT_FAT_INLINE_FLAGS; return d.inlineStorageTwoByte; @@ -291,7 +291,7 @@ JSFatInlineString::initTwoByte(size_t length) MOZ_ALWAYS_INLINE JS::Latin1Char * JSFatInlineString::initLatin1(size_t length) { - JS_ASSERT(latin1LengthFits(length)); + MOZ_ASSERT(latin1LengthFits(length)); d.u1.length = length; d.u1.flags = INIT_FAT_INLINE_FLAGS | LATIN1_CHARS_BIT; return d.inlineStorageLatin1; @@ -335,8 +335,8 @@ JSFatInlineString::new_(js::ThreadSafeContext *cx) MOZ_ALWAYS_INLINE void JSExternalString::init(const char16_t *chars, size_t length, const JSStringFinalizer *fin) { - JS_ASSERT(fin); - JS_ASSERT(fin->finalize); + MOZ_ASSERT(fin); + MOZ_ASSERT(fin->finalize); d.u1.length = length; d.u1.flags = EXTERNAL_FLAGS; d.s.u2.nonInlineCharsTwoByte = chars; @@ -347,7 +347,7 @@ MOZ_ALWAYS_INLINE JSExternalString * JSExternalString::new_(JSContext *cx, const char16_t *chars, size_t length, const JSStringFinalizer *fin) { - JS_ASSERT(chars[length] == 0); + MOZ_ASSERT(chars[length] == 0); if (!validateLength(cx, length)) return nullptr; @@ -362,7 +362,7 @@ JSExternalString::new_(JSContext *cx, const char16_t *chars, size_t length, inline JSLinearString * js::StaticStrings::getUnitStringForElement(JSContext *cx, JSString *str, size_t index) { - JS_ASSERT(index < str->length()); + MOZ_ASSERT(index < str->length()); char16_t c; if (!str->getChar(cx, index, &c)) @@ -375,8 +375,8 @@ js::StaticStrings::getUnitStringForElement(JSContext *cx, JSString *str, size_t inline JSAtom * js::StaticStrings::getLength2(char16_t c1, char16_t c2) { - JS_ASSERT(fitsInSmallChar(c1)); - JS_ASSERT(fitsInSmallChar(c2)); + MOZ_ASSERT(fitsInSmallChar(c1)); + MOZ_ASSERT(fitsInSmallChar(c2)); size_t index = (((size_t)toSmallChar[c1]) << 6) + toSmallChar[c2]; return length2StaticTable[index]; } @@ -385,18 +385,18 @@ MOZ_ALWAYS_INLINE void JSString::finalize(js::FreeOp *fop) { /* FatInline strings are in a different arena. */ - JS_ASSERT(getAllocKind() != js::gc::FINALIZE_FAT_INLINE_STRING); + MOZ_ASSERT(getAllocKind() != js::gc::FINALIZE_FAT_INLINE_STRING); if (isFlat()) asFlat().finalize(fop); else - JS_ASSERT(isDependent() || isRope()); + MOZ_ASSERT(isDependent() || isRope()); } inline void JSFlatString::finalize(js::FreeOp *fop) { - JS_ASSERT(getAllocKind() != js::gc::FINALIZE_FAT_INLINE_STRING); + MOZ_ASSERT(getAllocKind() != js::gc::FINALIZE_FAT_INLINE_STRING); if (!isInline()) fop->free_(nonInlineCharsRaw()); @@ -405,7 +405,7 @@ JSFlatString::finalize(js::FreeOp *fop) inline void JSFatInlineString::finalize(js::FreeOp *fop) { - JS_ASSERT(getAllocKind() == js::gc::FINALIZE_FAT_INLINE_STRING); + MOZ_ASSERT(getAllocKind() == js::gc::FINALIZE_FAT_INLINE_STRING); if (!isInline()) fop->free_(nonInlineCharsRaw()); @@ -414,8 +414,8 @@ JSFatInlineString::finalize(js::FreeOp *fop) inline void JSAtom::finalize(js::FreeOp *fop) { - JS_ASSERT(JSString::isAtom()); - JS_ASSERT(JSString::isFlat()); + MOZ_ASSERT(JSString::isAtom()); + MOZ_ASSERT(JSString::isFlat()); if (!isInline()) fop->free_(nonInlineCharsRaw()); diff --git a/js/src/vm/String.cpp b/js/src/vm/String.cpp index d8b4f2e4adf9..6672e91f5d13 100644 --- a/js/src/vm/String.cpp +++ b/js/src/vm/String.cpp @@ -33,13 +33,13 @@ JSString::sizeOfExcludingThis(mozilla::MallocSizeOf mallocSizeOf) if (isRope()) return 0; - JS_ASSERT(isLinear()); + MOZ_ASSERT(isLinear()); // JSDependentString: do nothing, we'll count the chars when we hit the base string. if (isDependent()) return 0; - JS_ASSERT(isFlat()); + MOZ_ASSERT(isFlat()); // JSExtensibleString: count the full capacity, not just the used space. if (isExtensible()) { @@ -237,7 +237,7 @@ JSRope::copyCharsInternal(ThreadSafeContext *cx, ScopedJSFreePtr &out, } } - JS_ASSERT(pos == out + n); + MOZ_ASSERT(pos == out + n); if (nullTerminate) out[n] = 0; @@ -349,14 +349,14 @@ JSRope::flattenInternal(ExclusiveContext *maybecx) * Simulate a left-most traversal from the root to leftMost->leftChild() * via first_visit_node */ - JS_ASSERT(str->isRope()); + MOZ_ASSERT(str->isRope()); while (str != leftMostRope) { if (b == WithIncrementalBarrier) { JSString::writeBarrierPre(str->d.s.u2.left); JSString::writeBarrierPre(str->d.s.u3.right); } JSString *child = str->d.s.u2.left; - JS_ASSERT(child->isRope()); + MOZ_ASSERT(child->isRope()); str->setNonInlineChars(left.nonInlineChars(nogc)); child->d.u1.flattenData = uintptr_t(str) | Tag_VisitRightChild; str = child; @@ -413,7 +413,7 @@ JSRope::flattenInternal(ExclusiveContext *maybecx) } finish_node: { if (str == this) { - JS_ASSERT(pos == wholeChars + wholeLength); + MOZ_ASSERT(pos == wholeChars + wholeLength); *pos = '\0'; str->d.u1.length = wholeLength; if (IsSame::value) @@ -437,7 +437,7 @@ JSRope::flattenInternal(ExclusiveContext *maybecx) str = (JSString *)(flattenData & ~Tag_Mask); if ((flattenData & Tag_Mask) == Tag_VisitRightChild) goto visit_right_child; - JS_ASSERT((flattenData & Tag_Mask) == Tag_FinishNode); + MOZ_ASSERT((flattenData & Tag_Mask) == Tag_FinishNode); goto finish_node; } } @@ -563,7 +563,7 @@ JSDependentString::undependInternal(ExclusiveContext *cx) JSFlatString * JSDependentString::undepend(ExclusiveContext *cx) { - JS_ASSERT(JSString::isDependent()); + MOZ_ASSERT(JSString::isDependent()); return hasLatin1Chars() ? undependInternal(cx) : undependInternal(cx); diff --git a/js/src/vm/String.h b/js/src/vm/String.h index 1d0c12485ec2..a740037a45af 100644 --- a/js/src/vm/String.h +++ b/js/src/vm/String.h @@ -351,7 +351,7 @@ class JSString : public js::gc::TenuredCell MOZ_ALWAYS_INLINE JSRope &asRope() const { - JS_ASSERT(isRope()); + MOZ_ASSERT(isRope()); return *(JSRope *)this; } @@ -362,7 +362,7 @@ class JSString : public js::gc::TenuredCell MOZ_ALWAYS_INLINE JSLinearString &asLinear() const { - JS_ASSERT(JSString::isLinear()); + MOZ_ASSERT(JSString::isLinear()); return *(JSLinearString *)this; } @@ -373,7 +373,7 @@ class JSString : public js::gc::TenuredCell MOZ_ALWAYS_INLINE JSDependentString &asDependent() const { - JS_ASSERT(isDependent()); + MOZ_ASSERT(isDependent()); return *(JSDependentString *)this; } @@ -384,7 +384,7 @@ class JSString : public js::gc::TenuredCell MOZ_ALWAYS_INLINE JSFlatString &asFlat() const { - JS_ASSERT(isFlat()); + MOZ_ASSERT(isFlat()); return *(JSFlatString *)this; } @@ -395,7 +395,7 @@ class JSString : public js::gc::TenuredCell MOZ_ALWAYS_INLINE JSExtensibleString &asExtensible() const { - JS_ASSERT(isExtensible()); + MOZ_ASSERT(isExtensible()); return *(JSExtensibleString *)this; } @@ -406,7 +406,7 @@ class JSString : public js::gc::TenuredCell MOZ_ALWAYS_INLINE JSInlineString &asInline() const { - JS_ASSERT(isInline()); + MOZ_ASSERT(isInline()); return *(JSInlineString *)this; } @@ -422,7 +422,7 @@ class JSString : public js::gc::TenuredCell MOZ_ALWAYS_INLINE JSExternalString &asExternal() const { - JS_ASSERT(isExternal()); + MOZ_ASSERT(isExternal()); return *(JSExternalString *)this; } @@ -443,7 +443,7 @@ class JSString : public js::gc::TenuredCell MOZ_ALWAYS_INLINE JSAtom &asAtom() const { - JS_ASSERT(isAtom()); + MOZ_ASSERT(isAtom()); return *(JSAtom *)this; } @@ -552,12 +552,12 @@ class JSRope : public JSString bool copyChars(js::ThreadSafeContext *cx, js::ScopedJSFreePtr &out) const; inline JSString *leftChild() const { - JS_ASSERT(isRope()); + MOZ_ASSERT(isRope()); return d.s.u2.left; } inline JSString *rightChild() const { - JS_ASSERT(isRope()); + MOZ_ASSERT(isRope()); return d.s.u3.right; } @@ -587,7 +587,7 @@ class JSLinearString : public JSString /* Returns void pointer to latin1/twoByte chars, for finalizers. */ MOZ_ALWAYS_INLINE void *nonInlineCharsRaw() const { - JS_ASSERT(!isInline()); + MOZ_ASSERT(!isInline()); static_assert(offsetof(JSLinearString, d.s.u2.nonInlineCharsTwoByte) == offsetof(JSLinearString, d.s.u2.nonInlineCharsLatin1), "nonInlineCharsTwoByte and nonInlineCharsLatin1 must have same offset"); @@ -604,15 +604,15 @@ class JSLinearString : public JSString MOZ_ALWAYS_INLINE const JS::Latin1Char *nonInlineLatin1Chars(const JS::AutoCheckCannotGC &nogc) const { - JS_ASSERT(!isInline()); - JS_ASSERT(hasLatin1Chars()); + MOZ_ASSERT(!isInline()); + MOZ_ASSERT(hasLatin1Chars()); return d.s.u2.nonInlineCharsLatin1; } MOZ_ALWAYS_INLINE const char16_t *nonInlineTwoByteChars(const JS::AutoCheckCannotGC &nogc) const { - JS_ASSERT(!isInline()); - JS_ASSERT(hasTwoByteChars()); + MOZ_ASSERT(!isInline()); + MOZ_ASSERT(hasTwoByteChars()); return d.s.u2.nonInlineCharsTwoByte; } @@ -631,12 +631,12 @@ class JSLinearString : public JSString } mozilla::Range latin1Range(const JS::AutoCheckCannotGC &nogc) const { - JS_ASSERT(JSString::isLinear()); + MOZ_ASSERT(JSString::isLinear()); return mozilla::Range(latin1Chars(nogc), length()); } mozilla::Range twoByteRange(const JS::AutoCheckCannotGC &nogc) const { - JS_ASSERT(JSString::isLinear()); + MOZ_ASSERT(JSString::isLinear()); return mozilla::Range(twoByteChars(nogc), length()); } @@ -711,7 +711,7 @@ class JSFlatString : public JSLinearString * string equal to this string.) */ inline bool isIndex(uint32_t *indexp) const { - JS_ASSERT(JSString::isFlat()); + MOZ_ASSERT(JSString::isFlat()); JS::AutoCheckCannotGC nogc; if (hasLatin1Chars()) { const JS::Latin1Char *s = latin1Chars(nogc); @@ -755,7 +755,7 @@ class JSExtensibleString : public JSFlatString public: MOZ_ALWAYS_INLINE size_t capacity() const { - JS_ASSERT(JSString::isExtensible()); + MOZ_ASSERT(JSString::isExtensible()); return d.s.u3.capacity; } }; @@ -786,15 +786,15 @@ class JSInlineString : public JSFlatString MOZ_ALWAYS_INLINE const JS::Latin1Char *latin1Chars(const JS::AutoCheckCannotGC &nogc) const { - JS_ASSERT(JSString::isInline()); - JS_ASSERT(hasLatin1Chars()); + MOZ_ASSERT(JSString::isInline()); + MOZ_ASSERT(hasLatin1Chars()); return d.inlineStorageLatin1; } MOZ_ALWAYS_INLINE const char16_t *twoByteChars(const JS::AutoCheckCannotGC &nogc) const { - JS_ASSERT(JSString::isInline()); - JS_ASSERT(hasTwoByteChars()); + MOZ_ASSERT(JSString::isInline()); + MOZ_ASSERT(hasTwoByteChars()); return d.inlineStorageTwoByte; } @@ -897,7 +897,7 @@ class JSExternalString : public JSFlatString const JSStringFinalizer *fin); const JSStringFinalizer *externalFinalizer() const { - JS_ASSERT(JSString::isExternal()); + MOZ_ASSERT(JSString::isExternal()); return d.s.u3.externalFinalizer; } @@ -1039,7 +1039,7 @@ class StaticStrings static bool hasUint(uint32_t u) { return u < INT_STATIC_LIMIT; } JSAtom *getUint(uint32_t u) { - JS_ASSERT(hasUint(u)); + MOZ_ASSERT(hasUint(u)); return intStaticTable[u]; } @@ -1048,14 +1048,14 @@ class StaticStrings } JSAtom *getInt(int32_t i) { - JS_ASSERT(hasInt(i)); + MOZ_ASSERT(hasInt(i)); return getUint(uint32_t(i)); } static bool hasUnit(char16_t c) { return c < UNIT_STATIC_LIMIT; } JSAtom *getUnit(char16_t c) { - JS_ASSERT(hasUnit(c)); + MOZ_ASSERT(hasUnit(c)); return unitStaticTable[c]; } @@ -1116,7 +1116,7 @@ class StaticStrings JSAtom *getLength2(char16_t c1, char16_t c2); JSAtom *getLength2(uint32_t u) { - JS_ASSERT(u < 100); + MOZ_ASSERT(u < 100); return getLength2('0' + u / 10, '0' + u % 10); } }; @@ -1224,7 +1224,7 @@ class JSAddonId : public JSAtom MOZ_ALWAYS_INLINE bool JSString::getChar(js::ExclusiveContext *cx, size_t index, char16_t *code) { - JS_ASSERT(index < length()); + MOZ_ASSERT(index < length()); /* * Optimization for one level deep ropes. @@ -1276,8 +1276,8 @@ JSString::ensureFlat(js::ExclusiveContext *cx) inline JSLinearString * JSString::base() const { - JS_ASSERT(hasBase()); - JS_ASSERT(!d.s.u3.base->isInline()); + MOZ_ASSERT(hasBase()); + MOZ_ASSERT(!d.s.u3.base->isInline()); return d.s.u3.base; } @@ -1369,16 +1369,16 @@ JSString::setNonInlineChars(const JS::Latin1Char *chars) MOZ_ALWAYS_INLINE const JS::Latin1Char * JSLinearString::rawLatin1Chars() const { - JS_ASSERT(JSString::isLinear()); - JS_ASSERT(hasLatin1Chars()); + MOZ_ASSERT(JSString::isLinear()); + MOZ_ASSERT(hasLatin1Chars()); return isInline() ? d.inlineStorageLatin1 : d.s.u2.nonInlineCharsLatin1; } MOZ_ALWAYS_INLINE const char16_t * JSLinearString::rawTwoByteChars() const { - JS_ASSERT(JSString::isLinear()); - JS_ASSERT(hasTwoByteChars()); + MOZ_ASSERT(JSString::isLinear()); + MOZ_ASSERT(hasTwoByteChars()); return isInline() ? d.inlineStorageTwoByte : d.s.u2.nonInlineCharsTwoByte; } @@ -1387,7 +1387,7 @@ JSAtom::asPropertyName() { #ifdef DEBUG uint32_t dummy; - JS_ASSERT(!isIndex(&dummy)); + MOZ_ASSERT(!isIndex(&dummy)); #endif return static_cast(this); } diff --git a/js/src/vm/StringBuffer.cpp b/js/src/vm/StringBuffer.cpp index 53821406ea8e..cf68bb9e5fc3 100644 --- a/js/src/vm/StringBuffer.cpp +++ b/js/src/vm/StringBuffer.cpp @@ -26,7 +26,7 @@ ExtractWellSized(ExclusiveContext *cx, Buffer &cb) return nullptr; /* For medium/big buffers, avoid wasting more than 1/4 of the memory. */ - JS_ASSERT(capacity >= length); + MOZ_ASSERT(capacity >= length); if (length > Buffer::sMaxInlineStorage && capacity - length > length / 4) { CharT *tmp = cx->zone()->pod_realloc(buf, capacity, length + 1); if (!tmp) { @@ -164,6 +164,6 @@ js::ValueToStringBufferSlow(JSContext *cx, const Value &arg, StringBuffer &sb) JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_SYMBOL_TO_STRING); return false; } - JS_ASSERT(v.isUndefined()); + MOZ_ASSERT(v.isUndefined()); return sb.append(cx->names().undefined); } diff --git a/js/src/vm/StringObject-inl.h b/js/src/vm/StringObject-inl.h index fbde14b07f12..baa1a7ef4a96 100644 --- a/js/src/vm/StringObject-inl.h +++ b/js/src/vm/StringObject-inl.h @@ -18,14 +18,14 @@ namespace js { inline bool StringObject::init(JSContext *cx, HandleString str) { - JS_ASSERT(numFixedSlots() == 2); + MOZ_ASSERT(numFixedSlots() == 2); Rooted self(cx, this); if (!EmptyShape::ensureInitialCustomShape(cx, self)) return false; - JS_ASSERT(self->nativeLookup(cx, NameToId(cx->names().length))->slot() == LENGTH_SLOT); + MOZ_ASSERT(self->nativeLookup(cx, NameToId(cx->names().length))->slot() == LENGTH_SLOT); self->setStringThis(str); diff --git a/js/src/vm/StringObject.h b/js/src/vm/StringObject.h index a6121dfdfdf6..2932a001757d 100644 --- a/js/src/vm/StringObject.h +++ b/js/src/vm/StringObject.h @@ -50,7 +50,7 @@ class StringObject : public JSObject inline bool init(JSContext *cx, HandleString str); void setStringThis(JSString *str) { - JS_ASSERT(getReservedSlot(PRIMITIVE_VALUE_SLOT).isUndefined()); + MOZ_ASSERT(getReservedSlot(PRIMITIVE_VALUE_SLOT).isUndefined()); setFixedSlot(PRIMITIVE_VALUE_SLOT, StringValue(str)); setFixedSlot(LENGTH_SLOT, Int32Value(int32_t(str->length()))); } diff --git a/js/src/vm/StructuredClone.cpp b/js/src/vm/StructuredClone.cpp index cf9d7b014569..3475f1e9a9be 100644 --- a/js/src/vm/StructuredClone.cpp +++ b/js/src/vm/StructuredClone.cpp @@ -342,7 +342,7 @@ struct JSStructuredCloneWriter { JS_FRIEND_API(uint64_t) js_GetSCOffset(JSStructuredCloneWriter* writer) { - JS_ASSERT(writer); + MOZ_ASSERT(writer); return writer->output().count() * sizeof(uint64_t); } @@ -383,7 +383,7 @@ ReadStructuredClone(JSContext *cx, uint64_t *data, size_t nbytes, MutableHandleV static void Discard(uint64_t *buffer, size_t nbytes, const JSStructuredCloneCallbacks *cb, void *cbClosure) { - JS_ASSERT(nbytes % sizeof(uint64_t) == 0); + MOZ_ASSERT(nbytes % sizeof(uint64_t) == 0); if (nbytes < sizeof(uint64_t)) return; // Empty buffer @@ -403,7 +403,7 @@ Discard(uint64_t *buffer, size_t nbytes, const JSStructuredCloneCallbacks *cb, v while (numTransferables--) { uint32_t ownership; SCInput::getPair(point++, &tag, &ownership); - JS_ASSERT(tag >= SCTAG_TRANSFER_MAP_PENDING_ENTRY); + MOZ_ASSERT(tag >= SCTAG_TRANSFER_MAP_PENDING_ENTRY); void *content; SCInput::getPtr(point++, &content); @@ -459,8 +459,8 @@ SCInput::SCInput(JSContext *cx, uint64_t *data, size_t nbytes) { // On 32-bit, we sometimes construct an SCInput from an SCOutput buffer, // which is not guaranteed to be 8-byte aligned - JS_ASSERT((uintptr_t(data) & (sizeof(int) - 1)) == 0); - JS_ASSERT((nbytes & 7) == 0); + MOZ_ASSERT((uintptr_t(data) & (sizeof(int) - 1)) == 0); + MOZ_ASSERT((nbytes & 7) == 0); } bool @@ -589,7 +589,7 @@ SCInput::readChars(Latin1Char *p, size_t nchars) bool SCInput::readChars(char16_t *p, size_t nchars) { - JS_ASSERT(sizeof(char16_t) == sizeof(uint16_t)); + MOZ_ASSERT(sizeof(char16_t) == sizeof(uint16_t)); return readArray((uint16_t *) p, nchars); } @@ -687,8 +687,8 @@ template bool SCOutput::writeArray(const T *p, size_t nelems) { - JS_ASSERT(8 % sizeof(T) == 0); - JS_ASSERT(sizeof(uint64_t) % sizeof(T) == 0); + MOZ_ASSERT(8 % sizeof(T) == 0); + MOZ_ASSERT(sizeof(uint64_t) % sizeof(T) == 0); if (nelems == 0) return true; @@ -718,7 +718,7 @@ SCOutput::writeBytes(const void *p, size_t nbytes) bool SCOutput::writeChars(const char16_t *p, size_t nchars) { - JS_ASSERT(sizeof(char16_t) == sizeof(uint16_t)); + MOZ_ASSERT(sizeof(char16_t) == sizeof(uint16_t)); return writeArray((const uint16_t *) p, nchars); } @@ -834,20 +834,20 @@ JSStructuredCloneWriter::checkStack() const size_t MAX = 10; size_t limit = Min(counts.length(), MAX); - JS_ASSERT(objs.length() == counts.length()); + MOZ_ASSERT(objs.length() == counts.length()); size_t total = 0; for (size_t i = 0; i < limit; i++) { - JS_ASSERT(total + counts[i] >= total); + MOZ_ASSERT(total + counts[i] >= total); total += counts[i]; } if (counts.length() <= MAX) - JS_ASSERT(total == entries.length()); + MOZ_ASSERT(total == entries.length()); else - JS_ASSERT(total <= entries.length()); + MOZ_ASSERT(total <= entries.length()); size_t j = objs.length(); for (size_t i = 0; i < limit; i++) - JS_ASSERT(memory.has(&objs[--j].toObject())); + MOZ_ASSERT(memory.has(&objs[--j].toObject())); #endif } @@ -1145,9 +1145,9 @@ JSStructuredCloneWriter::transferOwnership() // grabbing out pointers from the transferables and stuffing them into the // transfer map. uint64_t *point = out.rawBuffer(); - JS_ASSERT(uint32_t(LittleEndian::readUint64(point) >> 32) == SCTAG_TRANSFER_MAP_HEADER); + MOZ_ASSERT(uint32_t(LittleEndian::readUint64(point) >> 32) == SCTAG_TRANSFER_MAP_HEADER); point++; - JS_ASSERT(LittleEndian::readUint64(point) == transferableObjects.length()); + MOZ_ASSERT(LittleEndian::readUint64(point) == transferableObjects.length()); point++; for (JS::AutoObjectVector::Range tr = transferableObjects.all(); !tr.empty(); tr.popFront()) { @@ -1197,7 +1197,7 @@ JSStructuredCloneWriter::transferOwnership() return reportErrorTransferable(); if (!callbacks->writeTransfer(context(), obj, closure, &tag, &ownership, &content, &extraData)) return false; - JS_ASSERT(tag > SCTAG_TRANSFER_MAP_PENDING_ENTRY); + MOZ_ASSERT(tag > SCTAG_TRANSFER_MAP_PENDING_ENTRY); } LittleEndian::writeUint64(point++, PairToUInt64(tag, ownership)); @@ -1205,7 +1205,7 @@ JSStructuredCloneWriter::transferOwnership() LittleEndian::writeUint64(point++, extraData); } - JS_ASSERT(point <= out.rawBuffer() + out.count()); + MOZ_ASSERT(point <= out.rawBuffer() + out.count()); JS_ASSERT_IF(point < out.rawBuffer() + out.count(), uint32_t(LittleEndian::readUint64(point) >> 32) < SCTAG_TRANSFER_MAP_HEADER); @@ -1298,7 +1298,7 @@ class Chars { ~Chars() { js_free(p); } bool allocate(size_t len) { - JS_ASSERT(!p); + MOZ_ASSERT(!p); // We're going to null-terminate! p = cx->pod_malloc(len + 1); if (p) { @@ -1342,7 +1342,7 @@ JSStructuredCloneReader::readString(uint32_t data) static uint32_t TagToV1ArrayType(uint32_t tag) { - JS_ASSERT(tag >= SCTAG_TYPED_ARRAY_V1_MIN && tag <= SCTAG_TYPED_ARRAY_V1_MAX); + MOZ_ASSERT(tag >= SCTAG_TYPED_ARRAY_V1_MIN && tag <= SCTAG_TYPED_ARRAY_V1_MAX); return tag - SCTAG_TYPED_ARRAY_V1_MIN; } @@ -1497,7 +1497,7 @@ JSStructuredCloneReader::readArrayBuffer(uint32_t nbytes, MutableHandleValue vp) return false; vp.setObject(*obj); ArrayBufferObject &buffer = obj->as(); - JS_ASSERT(buffer.byteLength() == nbytes); + MOZ_ASSERT(buffer.byteLength() == nbytes); return in.readArray(buffer.dataPointer(), nbytes); } @@ -1509,7 +1509,7 @@ bool JSStructuredCloneReader::readV1ArrayBuffer(uint32_t arrayType, uint32_t nelems, MutableHandleValue vp) { - JS_ASSERT(arrayType <= Scalar::Uint8Clamped); + MOZ_ASSERT(arrayType <= Scalar::Uint8Clamped); uint32_t nbytes = nelems << TypedArrayShift(static_cast(arrayType)); JSObject *obj = ArrayBufferObject::create(context(), nbytes); @@ -1517,7 +1517,7 @@ JSStructuredCloneReader::readV1ArrayBuffer(uint32_t arrayType, uint32_t nelems, return false; vp.setObject(*obj); ArrayBufferObject &buffer = obj->as(); - JS_ASSERT(buffer.byteLength() == nbytes); + MOZ_ASSERT(buffer.byteLength() == nbytes); switch (arrayType) { case Scalar::Int8: @@ -1764,7 +1764,7 @@ JSStructuredCloneReader::readTransferMap() if (!in.readPair(&tag, &data)) return false; - JS_ASSERT(tag != SCTAG_TRANSFER_MAP_PENDING_ENTRY); + MOZ_ASSERT(tag != SCTAG_TRANSFER_MAP_PENDING_ENTRY); RootedObject obj(cx); void *content; @@ -1777,14 +1777,14 @@ JSStructuredCloneReader::readTransferMap() if (tag == SCTAG_TRANSFER_MAP_ARRAY_BUFFER) { size_t nbytes = extraData; - JS_ASSERT(data == JS::SCTAG_TMO_ALLOC_DATA || - data == JS::SCTAG_TMO_MAPPED_DATA); + MOZ_ASSERT(data == JS::SCTAG_TMO_ALLOC_DATA || + data == JS::SCTAG_TMO_MAPPED_DATA); if (data == JS::SCTAG_TMO_ALLOC_DATA) obj = JS_NewArrayBufferWithContents(cx, nbytes, content); else if (data == JS::SCTAG_TMO_MAPPED_DATA) obj = JS_NewMappedArrayBufferWithContents(cx, nbytes, content); } else if (tag == SCTAG_TRANSFER_MAP_SHARED_BUFFER) { - JS_ASSERT(data == JS::SCTAG_TMO_SHARED_BUFFER); + MOZ_ASSERT(data == JS::SCTAG_TMO_SHARED_BUFFER); obj = SharedArrayBufferObject::New(context(), (SharedArrayRawBuffer *)content); } else { if (!callbacks || !callbacks->readTransfer) { @@ -1993,7 +1993,7 @@ JSAutoStructuredCloneBuffer::JSAutoStructuredCloneBuffer(JSAutoStructuredCloneBu JSAutoStructuredCloneBuffer& JSAutoStructuredCloneBuffer::operator=(JSAutoStructuredCloneBuffer &&other) { - JS_ASSERT(&other != this); + MOZ_ASSERT(&other != this); clear(); other.steal(&data_, &nbytes_, &version_); return *this; @@ -2059,8 +2059,8 @@ JSAutoStructuredCloneBuffer::read(JSContext *cx, MutableHandleValue vp, const JSStructuredCloneCallbacks *optionalCallbacks, void *closure) { - JS_ASSERT(cx); - JS_ASSERT(data_); + MOZ_ASSERT(cx); + MOZ_ASSERT(data_); return !!JS_ReadStructuredClone(cx, data_, nbytes_, version_, vp, optionalCallbacks, closure); } @@ -2145,7 +2145,7 @@ JS_WriteBytes(JSStructuredCloneWriter *w, const void *p, size_t len) JS_PUBLIC_API(bool) JS_WriteTypedArray(JSStructuredCloneWriter *w, HandleValue v) { - JS_ASSERT(v.isObject()); + MOZ_ASSERT(v.isObject()); assertSameCompartment(w->context(), v); RootedObject obj(w->context(), &v.toObject()); return w->writeTypedArray(obj); diff --git a/js/src/vm/ThreadPool.cpp b/js/src/vm/ThreadPool.cpp index b7a9e7564fa3..e954403fb946 100644 --- a/js/src/vm/ThreadPool.cpp +++ b/js/src/vm/ThreadPool.cpp @@ -162,7 +162,7 @@ ThreadPoolWorker::HelperThreadMain(void *arg) #ifdef MOZ_NUWA_PROCESS if (IsNuwaProcess()) { - JS_ASSERT(NuwaMarkCurrentThread != nullptr); + MOZ_ASSERT(NuwaMarkCurrentThread != nullptr); NuwaMarkCurrentThread(nullptr, nullptr); } #endif diff --git a/js/src/vm/TraceLogging.cpp b/js/src/vm/TraceLogging.cpp index 1e07f36f11d3..e6c954c05055 100644 --- a/js/src/vm/TraceLogging.cpp +++ b/js/src/vm/TraceLogging.cpp @@ -204,30 +204,30 @@ TraceLogger::enable(JSContext *cx) JitFrameIterator it(rt->mainThread.jitTop, SequentialExecution); - JS_ASSERT(it.type() == JitFrame_Exit); + MOZ_ASSERT(it.type() == JitFrame_Exit); ++it; if (it.type() == JitFrame_Rectifier || it.type() == JitFrame_Unwound_Rectifier) { ++it; - JS_ASSERT(it.type() == JitFrame_BaselineStub || - it.type() == JitFrame_BaselineJS || - it.type() == JitFrame_IonJS); + MOZ_ASSERT(it.type() == JitFrame_BaselineStub || + it.type() == JitFrame_BaselineJS || + it.type() == JitFrame_IonJS); } if (it.type() == JitFrame_BaselineStub || it.type() == JitFrame_Unwound_BaselineStub) { ++it; - JS_ASSERT(it.type() == JitFrame_BaselineJS); + MOZ_ASSERT(it.type() == JitFrame_BaselineJS); } script = it.script(); engine = it.isIonJS() ? IonMonkey : Baseline; } else { - JS_ASSERT(act->isInterpreter()); + MOZ_ASSERT(act->isInterpreter()); InterpreterFrame *fp = act->asInterpreter()->current(); - JS_ASSERT(!fp->runningInJit()); + MOZ_ASSERT(!fp->runningInJit()); script = fp->script(); engine = Interpreter; @@ -259,7 +259,7 @@ TraceLogger::disable() return true; } - JS_ASSERT(enabled == 1); + MOZ_ASSERT(enabled == 1); while (stack.size() > 1) stopEvent(); diff --git a/js/src/vm/TypedArrayObject.cpp b/js/src/vm/TypedArrayObject.cpp index aca6e239edcf..c800f59bb20b 100644 --- a/js/src/vm/TypedArrayObject.cpp +++ b/js/src/vm/TypedArrayObject.cpp @@ -128,7 +128,7 @@ TypedArrayObject::ObjectMoved(JSObject *obj, const JSObject *old) { const TypedArrayObject &src = old->as(); if (!src.hasBuffer()) { - JS_ASSERT(old->getPrivate() == old->fixedData(FIXED_DATA_START)); + MOZ_ASSERT(old->getPrivate() == old->fixedData(FIXED_DATA_START)); obj->setPrivate(obj->fixedData(FIXED_DATA_START)); } } @@ -271,7 +271,7 @@ class TypedArrayObjectTemplate : public TypedArrayObject if (ArrayTypeIsFloatingPoint()) { setIndex(tarray, index, NativeType(d)); } else if (ArrayTypeIsUnsigned()) { - JS_ASSERT(sizeof(NativeType) <= 4); + MOZ_ASSERT(sizeof(NativeType) <= 4); uint32_t n = ToUint32(d); setIndex(tarray, index, NativeType(n)); } else if (ArrayTypeID() == Scalar::Uint8Clamped) { @@ -279,7 +279,7 @@ class TypedArrayObjectTemplate : public TypedArrayObject // for doubles. setIndex(tarray, index, NativeType(d)); } else { - JS_ASSERT(sizeof(NativeType) <= 4); + MOZ_ASSERT(sizeof(NativeType) <= 4); int32_t n = ToInt32(d); setIndex(tarray, index, NativeType(n)); } @@ -288,7 +288,7 @@ class TypedArrayObjectTemplate : public TypedArrayObject static TypedArrayObject * makeProtoInstance(JSContext *cx, HandleObject proto, AllocKind allocKind) { - JS_ASSERT(proto); + MOZ_ASSERT(proto); RootedObject obj(cx, NewBuiltinClassInstance(cx, instanceClass(), allocKind)); if (!obj) @@ -367,12 +367,12 @@ class TypedArrayObjectTemplate : public TypedArrayObject uint32_t arrayByteOffset = obj->byteOffset(); uint32_t bufferByteLength = buffer->byteLength(); JS_ASSERT_IF(!buffer->isNeutered(), buffer->dataPointer() <= obj->viewData()); - JS_ASSERT(bufferByteLength - arrayByteOffset >= arrayByteLength); - JS_ASSERT(arrayByteOffset <= bufferByteLength); + MOZ_ASSERT(bufferByteLength - arrayByteOffset >= arrayByteLength); + MOZ_ASSERT(arrayByteOffset <= bufferByteLength); } // Verify that the private slot is at the expected place - JS_ASSERT(obj->numFixedSlots() == TypedArrayLayout::DATA_SLOT); + MOZ_ASSERT(obj->numFixedSlots() == TypedArrayLayout::DATA_SLOT); #endif if (buffer) { @@ -480,7 +480,7 @@ class TypedArrayObjectTemplate : public TypedArrayObject return nullptr; // must be arrayBuffer } - JS_ASSERT(IsArrayBuffer(bufobj) || bufobj->is()); + MOZ_ASSERT(IsArrayBuffer(bufobj) || bufobj->is()); if (bufobj->is()) { /* * Normally, NonGenericMethodGuard handles the case of transparent @@ -805,8 +805,8 @@ bool ArrayBufferObject::createTypedArrayFromBufferImpl(JSContext *cx, CallArgs args) { typedef TypedArrayObjectTemplate ArrayType; - JS_ASSERT(IsArrayBuffer(args.thisv())); - JS_ASSERT(args.length() == 3); + MOZ_ASSERT(IsArrayBuffer(args.thisv())); + MOZ_ASSERT(args.length() == 3); Rooted buffer(cx, &args.thisv().toObject()); Rooted proto(cx, &args[2].toObject()); @@ -915,8 +915,8 @@ inline DataViewObject * DataViewObject::create(JSContext *cx, uint32_t byteOffset, uint32_t byteLength, Handle arrayBuffer, JSObject *protoArg) { - JS_ASSERT(byteOffset <= INT32_MAX); - JS_ASSERT(byteLength <= INT32_MAX); + MOZ_ASSERT(byteOffset <= INT32_MAX); + MOZ_ASSERT(byteLength <= INT32_MAX); RootedObject proto(cx, protoArg); RootedObject obj(cx); @@ -939,7 +939,7 @@ DataViewObject::create(JSContext *cx, uint32_t byteOffset, uint32_t byteLength, return nullptr; obj->setType(type); } else if (byteLength >= TypedArrayObject::SINGLETON_TYPE_BYTE_LENGTH) { - JS_ASSERT(obj->hasSingletonType()); + MOZ_ASSERT(obj->hasSingletonType()); } else { jsbytecode *pc; RootedScript script(cx, cx->currentScript(&pc)); @@ -954,10 +954,10 @@ DataViewObject::create(JSContext *cx, uint32_t byteOffset, uint32_t byteLength, dvobj.setFixedSlot(TypedArrayLayout::LENGTH_SLOT, Int32Value(byteLength)); dvobj.setFixedSlot(TypedArrayLayout::BUFFER_SLOT, ObjectValue(*arrayBuffer)); InitArrayBufferViewDataPointer(&dvobj, arrayBuffer, byteOffset); - JS_ASSERT(byteOffset + byteLength <= arrayBuffer->byteLength()); + MOZ_ASSERT(byteOffset + byteLength <= arrayBuffer->byteLength()); // Verify that the private slot is at the expected place - JS_ASSERT(dvobj.numFixedSlots() == TypedArrayLayout::DATA_SLOT); + MOZ_ASSERT(dvobj.numFixedSlots() == TypedArrayLayout::DATA_SLOT); if (!arrayBuffer->addView(cx, &dvobj)) return nullptr; @@ -1008,8 +1008,8 @@ DataViewObject::construct(JSContext *cx, JSObject *bufobj, const CallArgs &args, } /* The sum of these cannot overflow a uint32_t */ - JS_ASSERT(byteOffset <= INT32_MAX); - JS_ASSERT(byteLength <= INT32_MAX); + MOZ_ASSERT(byteOffset <= INT32_MAX); + MOZ_ASSERT(byteLength <= INT32_MAX); if (byteOffset + byteLength > bufferLength) { JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_ARG_INDEX_OUT_OF_RANGE, "1"); @@ -1123,7 +1123,7 @@ struct DataViewIO static void fromBuffer(DataType *dest, const uint8_t *unalignedBuffer, bool wantSwap) { - JS_ASSERT((reinterpret_cast(dest) & (Min(MOZ_ALIGNOF(void*), sizeof(DataType)) - 1)) == 0); + MOZ_ASSERT((reinterpret_cast(dest) & (Min(MOZ_ALIGNOF(void*), sizeof(DataType)) - 1)) == 0); memcpy((void *) dest, unalignedBuffer, sizeof(ReadWriteType)); if (wantSwap) { ReadWriteType *rwDest = reinterpret_cast(dest); @@ -1133,7 +1133,7 @@ struct DataViewIO static void toBuffer(uint8_t *unalignedBuffer, const DataType *src, bool wantSwap) { - JS_ASSERT((reinterpret_cast(src) & (Min(MOZ_ALIGNOF(void*), sizeof(DataType)) - 1)) == 0); + MOZ_ASSERT((reinterpret_cast(src) & (Min(MOZ_ALIGNOF(void*), sizeof(DataType)) - 1)) == 0); ReadWriteType temp = *reinterpret_cast(src); if (wantSwap) temp = swapBytes(temp); @@ -1230,7 +1230,7 @@ DataViewObject::write(JSContext *cx, Handle obj, bool DataViewObject::getInt8Impl(JSContext *cx, CallArgs args) { - JS_ASSERT(is(args.thisv())); + MOZ_ASSERT(is(args.thisv())); Rooted thisView(cx, &args.thisv().toObject().as()); @@ -1251,7 +1251,7 @@ DataViewObject::fun_getInt8(JSContext *cx, unsigned argc, Value *vp) bool DataViewObject::getUint8Impl(JSContext *cx, CallArgs args) { - JS_ASSERT(is(args.thisv())); + MOZ_ASSERT(is(args.thisv())); Rooted thisView(cx, &args.thisv().toObject().as()); @@ -1272,7 +1272,7 @@ DataViewObject::fun_getUint8(JSContext *cx, unsigned argc, Value *vp) bool DataViewObject::getInt16Impl(JSContext *cx, CallArgs args) { - JS_ASSERT(is(args.thisv())); + MOZ_ASSERT(is(args.thisv())); Rooted thisView(cx, &args.thisv().toObject().as()); @@ -1293,7 +1293,7 @@ DataViewObject::fun_getInt16(JSContext *cx, unsigned argc, Value *vp) bool DataViewObject::getUint16Impl(JSContext *cx, CallArgs args) { - JS_ASSERT(is(args.thisv())); + MOZ_ASSERT(is(args.thisv())); Rooted thisView(cx, &args.thisv().toObject().as()); @@ -1314,7 +1314,7 @@ DataViewObject::fun_getUint16(JSContext *cx, unsigned argc, Value *vp) bool DataViewObject::getInt32Impl(JSContext *cx, CallArgs args) { - JS_ASSERT(is(args.thisv())); + MOZ_ASSERT(is(args.thisv())); Rooted thisView(cx, &args.thisv().toObject().as()); @@ -1335,7 +1335,7 @@ DataViewObject::fun_getInt32(JSContext *cx, unsigned argc, Value *vp) bool DataViewObject::getUint32Impl(JSContext *cx, CallArgs args) { - JS_ASSERT(is(args.thisv())); + MOZ_ASSERT(is(args.thisv())); Rooted thisView(cx, &args.thisv().toObject().as()); @@ -1356,7 +1356,7 @@ DataViewObject::fun_getUint32(JSContext *cx, unsigned argc, Value *vp) bool DataViewObject::getFloat32Impl(JSContext *cx, CallArgs args) { - JS_ASSERT(is(args.thisv())); + MOZ_ASSERT(is(args.thisv())); Rooted thisView(cx, &args.thisv().toObject().as()); @@ -1378,7 +1378,7 @@ DataViewObject::fun_getFloat32(JSContext *cx, unsigned argc, Value *vp) bool DataViewObject::getFloat64Impl(JSContext *cx, CallArgs args) { - JS_ASSERT(is(args.thisv())); + MOZ_ASSERT(is(args.thisv())); Rooted thisView(cx, &args.thisv().toObject().as()); @@ -1400,7 +1400,7 @@ DataViewObject::fun_getFloat64(JSContext *cx, unsigned argc, Value *vp) bool DataViewObject::setInt8Impl(JSContext *cx, CallArgs args) { - JS_ASSERT(is(args.thisv())); + MOZ_ASSERT(is(args.thisv())); Rooted thisView(cx, &args.thisv().toObject().as()); @@ -1420,7 +1420,7 @@ DataViewObject::fun_setInt8(JSContext *cx, unsigned argc, Value *vp) bool DataViewObject::setUint8Impl(JSContext *cx, CallArgs args) { - JS_ASSERT(is(args.thisv())); + MOZ_ASSERT(is(args.thisv())); Rooted thisView(cx, &args.thisv().toObject().as()); @@ -1440,7 +1440,7 @@ DataViewObject::fun_setUint8(JSContext *cx, unsigned argc, Value *vp) bool DataViewObject::setInt16Impl(JSContext *cx, CallArgs args) { - JS_ASSERT(is(args.thisv())); + MOZ_ASSERT(is(args.thisv())); Rooted thisView(cx, &args.thisv().toObject().as()); @@ -1460,7 +1460,7 @@ DataViewObject::fun_setInt16(JSContext *cx, unsigned argc, Value *vp) bool DataViewObject::setUint16Impl(JSContext *cx, CallArgs args) { - JS_ASSERT(is(args.thisv())); + MOZ_ASSERT(is(args.thisv())); Rooted thisView(cx, &args.thisv().toObject().as()); @@ -1480,7 +1480,7 @@ DataViewObject::fun_setUint16(JSContext *cx, unsigned argc, Value *vp) bool DataViewObject::setInt32Impl(JSContext *cx, CallArgs args) { - JS_ASSERT(is(args.thisv())); + MOZ_ASSERT(is(args.thisv())); Rooted thisView(cx, &args.thisv().toObject().as()); @@ -1500,7 +1500,7 @@ DataViewObject::fun_setInt32(JSContext *cx, unsigned argc, Value *vp) bool DataViewObject::setUint32Impl(JSContext *cx, CallArgs args) { - JS_ASSERT(is(args.thisv())); + MOZ_ASSERT(is(args.thisv())); Rooted thisView(cx, &args.thisv().toObject().as()); @@ -1520,7 +1520,7 @@ DataViewObject::fun_setUint32(JSContext *cx, unsigned argc, Value *vp) bool DataViewObject::setFloat32Impl(JSContext *cx, CallArgs args) { - JS_ASSERT(is(args.thisv())); + MOZ_ASSERT(is(args.thisv())); Rooted thisView(cx, &args.thisv().toObject().as()); @@ -1540,7 +1540,7 @@ DataViewObject::fun_setFloat32(JSContext *cx, unsigned argc, Value *vp) bool DataViewObject::setFloat64Impl(JSContext *cx, CallArgs args) { - JS_ASSERT(is(args.thisv())); + MOZ_ASSERT(is(args.thisv())); Rooted thisView(cx, &args.thisv().toObject().as()); @@ -2155,7 +2155,7 @@ JS_GetInt8ArrayData(JSObject *obj) if (!obj) return nullptr; TypedArrayObject *tarr = &obj->as(); - JS_ASSERT((int32_t) tarr->type() == Scalar::Int8); + MOZ_ASSERT((int32_t) tarr->type() == Scalar::Int8); return static_cast(tarr->viewData()); } @@ -2166,7 +2166,7 @@ JS_GetUint8ArrayData(JSObject *obj) if (!obj) return nullptr; TypedArrayObject *tarr = &obj->as(); - JS_ASSERT((int32_t) tarr->type() == Scalar::Uint8); + MOZ_ASSERT((int32_t) tarr->type() == Scalar::Uint8); return static_cast(tarr->viewData()); } @@ -2177,7 +2177,7 @@ JS_GetUint8ClampedArrayData(JSObject *obj) if (!obj) return nullptr; TypedArrayObject *tarr = &obj->as(); - JS_ASSERT((int32_t) tarr->type() == Scalar::Uint8Clamped); + MOZ_ASSERT((int32_t) tarr->type() == Scalar::Uint8Clamped); return static_cast(tarr->viewData()); } @@ -2188,7 +2188,7 @@ JS_GetInt16ArrayData(JSObject *obj) if (!obj) return nullptr; TypedArrayObject *tarr = &obj->as(); - JS_ASSERT((int32_t) tarr->type() == Scalar::Int16); + MOZ_ASSERT((int32_t) tarr->type() == Scalar::Int16); return static_cast(tarr->viewData()); } @@ -2199,7 +2199,7 @@ JS_GetUint16ArrayData(JSObject *obj) if (!obj) return nullptr; TypedArrayObject *tarr = &obj->as(); - JS_ASSERT((int32_t) tarr->type() == Scalar::Uint16); + MOZ_ASSERT((int32_t) tarr->type() == Scalar::Uint16); return static_cast(tarr->viewData()); } @@ -2210,7 +2210,7 @@ JS_GetInt32ArrayData(JSObject *obj) if (!obj) return nullptr; TypedArrayObject *tarr = &obj->as(); - JS_ASSERT((int32_t) tarr->type() == Scalar::Int32); + MOZ_ASSERT((int32_t) tarr->type() == Scalar::Int32); return static_cast(tarr->viewData()); } @@ -2221,7 +2221,7 @@ JS_GetUint32ArrayData(JSObject *obj) if (!obj) return nullptr; TypedArrayObject *tarr = &obj->as(); - JS_ASSERT((int32_t) tarr->type() == Scalar::Uint32); + MOZ_ASSERT((int32_t) tarr->type() == Scalar::Uint32); return static_cast(tarr->viewData()); } @@ -2232,7 +2232,7 @@ JS_GetFloat32ArrayData(JSObject *obj) if (!obj) return nullptr; TypedArrayObject *tarr = &obj->as(); - JS_ASSERT((int32_t) tarr->type() == Scalar::Float32); + MOZ_ASSERT((int32_t) tarr->type() == Scalar::Float32); return static_cast(tarr->viewData()); } @@ -2243,7 +2243,7 @@ JS_GetFloat64ArrayData(JSObject *obj) if (!obj) return nullptr; TypedArrayObject *tarr = &obj->as(); - JS_ASSERT((int32_t) tarr->type() == Scalar::Float64); + MOZ_ASSERT((int32_t) tarr->type() == Scalar::Float64); return static_cast(tarr->viewData()); } diff --git a/js/src/vm/TypedArrayObject.h b/js/src/vm/TypedArrayObject.h index b8dace2c244a..03999c461da8 100644 --- a/js/src/vm/TypedArrayObject.h +++ b/js/src/vm/TypedArrayObject.h @@ -111,10 +111,10 @@ class TypedArrayObject : public ArrayBufferViewObject static gc::AllocKind AllocKindForLazyBuffer(size_t nbytes) { - JS_ASSERT(nbytes <= INLINE_BUFFER_LIMIT); + MOZ_ASSERT(nbytes <= INLINE_BUFFER_LIMIT); /* For GGC we need at least one slot in which to store a forwarding pointer. */ size_t dataSlots = Max(size_t(1), AlignBytes(nbytes, sizeof(Value)) / sizeof(Value)); - JS_ASSERT(nbytes <= dataSlots * sizeof(Value)); + MOZ_ASSERT(nbytes <= dataSlots * sizeof(Value)); return gc::GetGCObjectKind(FIXED_DATA_START + dataSlots); } @@ -232,7 +232,7 @@ IsTypedArrayConstructor(HandleValue v, uint32_t type); inline Scalar::Type TypedArrayObject::type() const { - JS_ASSERT(IsTypedArrayClass(getClass())); + MOZ_ASSERT(IsTypedArrayClass(getClass())); return static_cast(getClass() - &classes[0]); } @@ -254,7 +254,7 @@ IsTypedArrayIndex(jsid id, uint64_t *indexp) { if (JSID_IS_INT(id)) { int32_t i = JSID_TO_INT(id); - JS_ASSERT(i >= 0); + MOZ_ASSERT(i >= 0); *indexp = (double)i; return true; } @@ -334,13 +334,13 @@ class DataViewObject : public ArrayBufferViewObject static Value byteOffsetValue(DataViewObject *view) { Value v = view->getReservedSlot(TypedArrayLayout::BYTEOFFSET_SLOT); - JS_ASSERT(v.toInt32() >= 0); + MOZ_ASSERT(v.toInt32() >= 0); return v; } static Value byteLengthValue(DataViewObject *view) { Value v = view->getReservedSlot(TypedArrayLayout::LENGTH_SLOT); - JS_ASSERT(v.toInt32() >= 0); + MOZ_ASSERT(v.toInt32() >= 0); return v; } diff --git a/js/src/vm/Xdr.cpp b/js/src/vm/Xdr.cpp index 006e673e38a3..bd5c2a2c9fdb 100644 --- a/js/src/vm/Xdr.cpp +++ b/js/src/vm/Xdr.cpp @@ -27,7 +27,7 @@ XDRBuffer::freeBuffer() bool XDRBuffer::grow(size_t n) { - JS_ASSERT(n > size_t(limit - cursor)); + MOZ_ASSERT(n > size_t(limit - cursor)); const size_t MEM_BLOCK = 8192; size_t offset = cursor - base; diff --git a/js/src/vm/Xdr.h b/js/src/vm/Xdr.h index 5315048e50cc..9bb231534740 100644 --- a/js/src/vm/Xdr.h +++ b/js/src/vm/Xdr.h @@ -40,7 +40,7 @@ class XDRBuffer { } void *getData(uint32_t *lengthp) const { - JS_ASSERT(size_t(cursor - base) <= size_t(UINT32_MAX)); + MOZ_ASSERT(size_t(cursor - base) <= size_t(UINT32_MAX)); *lengthp = uint32_t(cursor - base); return base; } @@ -52,7 +52,7 @@ class XDRBuffer { } const uint8_t *read(size_t n) { - JS_ASSERT(n <= size_t(limit - cursor)); + MOZ_ASSERT(n <= size_t(limit - cursor)); uint8_t *ptr = cursor; cursor += n; return ptr; @@ -61,8 +61,8 @@ class XDRBuffer { const char *readCString() { char *ptr = reinterpret_cast(cursor); cursor = reinterpret_cast(strchr(ptr, '\0')) + 1; - JS_ASSERT(base < cursor); - JS_ASSERT(cursor <= limit); + MOZ_ASSERT(base < cursor); + MOZ_ASSERT(cursor <= limit); return ptr; } From a30117e0b931fe3b7f4b3fde11d4e7ef4b96b260 Mon Sep 17 00:00:00 2001 From: "Nicolas B. Pierron" Date: Wed, 1 Oct 2014 19:17:53 +0200 Subject: [PATCH 45/63] Bug 1074911 - Replace JS_ASSERT_IF by MOZ_ASSERT_IF. r=jorendorff Apply the following script sed -i ' /JS_ASSERT_IF(/ { s/JS_ASSERT_IF(/MOZ_ASSERT_IF(/; :b; s/ \\$/\\/; /;/ { p; d; }; n; s/^/ /; b b; }; s/JS_ASSERT_IF (/MOZ_ASSERT_IF(/; ' --- js/src/asmjs/AsmJSFrameIterator.cpp | 2 +- js/src/asmjs/AsmJSModule.cpp | 12 ++-- js/src/asmjs/AsmJSModule.h | 14 ++--- js/src/asmjs/AsmJSValidate.cpp | 10 ++-- js/src/asmjs/AsmJSValidate.h | 4 +- js/src/builtin/Eval.cpp | 8 +-- js/src/ctypes/CTypes.cpp | 8 +-- js/src/ds/InlineMap.h | 4 +- js/src/ds/SplayTree.h | 4 +- js/src/frontend/BytecodeCompiler.cpp | 16 ++--- js/src/frontend/BytecodeEmitter.cpp | 42 +++++++------- js/src/frontend/BytecodeEmitter.h | 2 +- js/src/frontend/FullParseHandler.h | 6 +- js/src/frontend/ParseMaps.h | 2 +- js/src/frontend/ParseNode.h | 26 ++++----- js/src/frontend/Parser.cpp | 28 ++++----- js/src/frontend/TokenStream.h | 4 +- js/src/gc/Barrier.h | 2 +- js/src/gc/ForkJoinNursery.cpp | 4 +- js/src/gc/Heap.h | 4 +- js/src/gc/Marking.cpp | 46 +++++++-------- js/src/gc/Nursery.cpp | 4 +- js/src/gc/Statistics.cpp | 2 +- js/src/gc/Tracer.cpp | 2 +- js/src/gc/Zone.cpp | 12 ++-- js/src/gc/Zone.h | 2 +- js/src/irregexp/RegExpParser.cpp | 2 +- js/src/jit/BacktrackingAllocator.cpp | 14 ++--- js/src/jit/Bailouts.cpp | 4 +- js/src/jit/BaselineBailouts.cpp | 2 +- js/src/jit/BaselineFrame.h | 10 ++-- js/src/jit/BaselineFrameInfo.h | 2 +- js/src/jit/BaselineIC.cpp | 26 ++++----- js/src/jit/BaselineIC.h | 2 +- js/src/jit/BaselineJIT.cpp | 16 ++--- js/src/jit/BitSet.h | 2 +- js/src/jit/BytecodeAnalysis.h | 2 +- js/src/jit/CodeGenerator.cpp | 8 +-- js/src/jit/CompileInfo-inl.h | 4 +- js/src/jit/CompileInfo.h | 2 +- js/src/jit/ExecutableAllocator.h | 4 +- js/src/jit/Ion.cpp | 16 ++--- js/src/jit/IonBuilder.cpp | 36 ++++++------ js/src/jit/IonCaches.cpp | 10 ++-- js/src/jit/IonFrames-inl.h | 2 +- js/src/jit/IonFrames.cpp | 2 +- js/src/jit/IonMacroAssembler.cpp | 4 +- js/src/jit/JitcodeMap.cpp | 12 ++-- js/src/jit/JitcodeMap.h | 2 +- js/src/jit/LIR.cpp | 2 +- js/src/jit/LIR.h | 2 +- js/src/jit/LinearScan.cpp | 20 +++---- js/src/jit/LiveRangeAllocator.cpp | 22 +++---- js/src/jit/LiveRangeAllocator.h | 10 ++-- js/src/jit/Lowering.cpp | 12 ++-- js/src/jit/MIR.cpp | 6 +- js/src/jit/MIR.h | 8 +-- js/src/jit/MIRGraph.cpp | 10 ++-- js/src/jit/MoveResolver.h | 8 +-- js/src/jit/ParallelSafetyAnalysis.cpp | 2 +- js/src/jit/RangeAnalysis.cpp | 12 ++-- js/src/jit/RangeAnalysis.h | 8 +-- js/src/jit/RegisterAllocator.cpp | 16 ++--- js/src/jit/RegisterSets.h | 2 +- js/src/jit/RematerializedFrame.h | 10 ++-- js/src/jit/VMFunctions.cpp | 10 ++-- js/src/jit/VMFunctions.h | 4 +- js/src/jit/arm/Assembler-arm.cpp | 6 +- js/src/jit/arm/Assembler-arm.h | 2 +- js/src/jit/arm/CodeGenerator-arm.cpp | 14 ++--- js/src/jit/arm/Simulator-arm.cpp | 2 +- js/src/jit/mips/Simulator-mips.cpp | 2 +- js/src/jit/shared/Assembler-shared.h | 2 +- js/src/jit/shared/CodeGenerator-shared.cpp | 14 ++--- .../jit/shared/CodeGenerator-x86-shared.cpp | 18 +++--- .../jit/shared/MacroAssembler-x86-shared.cpp | 4 +- js/src/jit/x64/Assembler-x64.cpp | 2 +- js/src/jit/x86/CodeGenerator-x86.cpp | 2 +- js/src/jsapi.cpp | 24 ++++---- js/src/jsarray.cpp | 4 +- js/src/jsatom.cpp | 2 +- js/src/jscntxt.h | 10 ++-- js/src/jscntxtinlines.h | 38 ++++++------ js/src/jscompartment.cpp | 12 ++-- js/src/jscompartmentinlines.h | 6 +- js/src/jsdate.cpp | 2 +- js/src/jsfun.cpp | 18 +++--- js/src/jsfun.h | 4 +- js/src/jsgc.cpp | 58 +++++++++---------- js/src/jsgc.h | 10 ++-- js/src/jsgcinlines.h | 16 ++--- js/src/jsinfer.cpp | 28 ++++----- js/src/jsinfer.h | 4 +- js/src/jsinferinlines.h | 6 +- js/src/jsiter.cpp | 2 +- js/src/jsnum.cpp | 10 ++-- js/src/jsobj.cpp | 54 ++++++++--------- js/src/jsobj.h | 2 +- js/src/jsobjinlines.h | 14 ++--- js/src/json.cpp | 2 +- js/src/jsopcode.h | 4 +- js/src/jsreflect.cpp | 30 +++++----- js/src/jsscript.cpp | 22 +++---- js/src/jsscriptinlines.h | 2 +- js/src/jsstr.cpp | 4 +- js/src/jsutil.h | 4 +- js/src/jsweakmap.cpp | 4 +- js/src/proxy/CrossCompartmentWrapper.cpp | 4 +- js/src/proxy/Proxy.cpp | 2 +- js/src/shell/js.cpp | 2 +- js/src/shell/jsoptparse.cpp | 2 +- js/src/vm/ArgumentsObject.cpp | 2 +- js/src/vm/ArrayBufferObject.cpp | 2 +- js/src/vm/Compression.cpp | 4 +- js/src/vm/Debugger.cpp | 14 ++--- js/src/vm/Debugger.h | 18 +++--- js/src/vm/ForkJoin.cpp | 2 +- js/src/vm/Interpreter-inl.h | 6 +- js/src/vm/Interpreter.cpp | 18 +++--- js/src/vm/MatchPairs.h | 4 +- js/src/vm/OldDebugAPI.cpp | 4 +- js/src/vm/Probes-inl.h | 2 +- js/src/vm/ProxyObject.cpp | 4 +- js/src/vm/RegExpObject.cpp | 2 +- js/src/vm/RegExpStatics.cpp | 2 +- js/src/vm/RegExpStatics.h | 4 +- js/src/vm/SPSProfiler.cpp | 6 +- js/src/vm/SPSProfiler.h | 8 +-- js/src/vm/ScopeObject-inl.h | 6 +- js/src/vm/ScopeObject.cpp | 18 +++--- js/src/vm/ScopeObject.h | 18 +++--- js/src/vm/SelfHosting.cpp | 4 +- js/src/vm/Shape-inl.h | 8 +-- js/src/vm/Shape.cpp | 42 +++++++------- js/src/vm/Shape.h | 18 +++--- js/src/vm/Stack-inl.h | 20 +++---- js/src/vm/Stack.cpp | 8 +-- js/src/vm/Stack.h | 2 +- js/src/vm/String.cpp | 4 +- js/src/vm/StructuredClone.cpp | 4 +- js/src/vm/TypedArrayObject.cpp | 4 +- 141 files changed, 675 insertions(+), 675 deletions(-) diff --git a/js/src/asmjs/AsmJSFrameIterator.cpp b/js/src/asmjs/AsmJSFrameIterator.cpp index d427bc4c0dbc..98e007c7ff36 100644 --- a/js/src/asmjs/AsmJSFrameIterator.cpp +++ b/js/src/asmjs/AsmJSFrameIterator.cpp @@ -57,7 +57,7 @@ AsmJSFrameIterator::operator++() MOZ_ASSERT(!done()); DebugOnly oldfp = fp_; fp_ += callsite_->stackDepth(); - JS_ASSERT_IF(module_->profilingEnabled(), fp_ == CallerFPFromFP(oldfp)); + MOZ_ASSERT_IF(module_->profilingEnabled(), fp_ == CallerFPFromFP(oldfp)); settle(); } diff --git a/js/src/asmjs/AsmJSModule.cpp b/js/src/asmjs/AsmJSModule.cpp index 6b2dfb3d6256..270c9372bdf9 100644 --- a/js/src/asmjs/AsmJSModule.cpp +++ b/js/src/asmjs/AsmJSModule.cpp @@ -347,7 +347,7 @@ AsmJSModule::finish(ExclusiveContext *cx, TokenStream &tokenStream, MacroAssembl } for (size_t i = 0; i < codeRanges_.length(); i++) { codeRanges_[i].updateOffsets(masm); - JS_ASSERT_IF(i > 0, codeRanges_[i - 1].end() <= codeRanges_[i].begin()); + MOZ_ASSERT_IF(i > 0, codeRanges_[i - 1].end() <= codeRanges_[i].begin()); } for (size_t i = 0; i < builtinThunkOffsets_.length(); i++) builtinThunkOffsets_[i] = masm.actualOffset(builtinThunkOffsets_[i]); @@ -928,7 +928,7 @@ AsmJSModule::Name::serializedSize() const static uint8_t * SerializeName(uint8_t *cursor, PropertyName *name) { - JS_ASSERT_IF(name, !name->empty()); + MOZ_ASSERT_IF(name, !name->empty()); if (name) { static_assert(JSString::MAX_LENGTH <= INT32_MAX, "String length must fit in 31 bits"); uint32_t length = name->length(); @@ -1623,8 +1623,8 @@ AsmJSModule::setProfilingEnabled(bool enabled, JSContext *cx) uint8_t *profilingEntry = code_ + codeRange->begin(); uint8_t *entry = code_ + codeRange->entry(); - JS_ASSERT_IF(profilingEnabled_, callee == profilingEntry); - JS_ASSERT_IF(!profilingEnabled_, callee == entry); + MOZ_ASSERT_IF(profilingEnabled_, callee == profilingEntry); + MOZ_ASSERT_IF(!profilingEnabled_, callee == entry); uint8_t *newCallee = enabled ? profilingEntry : entry; #if defined(JS_CODEGEN_X86) || defined(JS_CODEGEN_X64) @@ -1652,8 +1652,8 @@ AsmJSModule::setProfilingEnabled(bool enabled, JSContext *cx) const CodeRange *codeRange = lookupCodeRange(callee); uint8_t *profilingEntry = code_ + codeRange->begin(); uint8_t *entry = code_ + codeRange->entry(); - JS_ASSERT_IF(profilingEnabled_, callee == profilingEntry); - JS_ASSERT_IF(!profilingEnabled_, callee == entry); + MOZ_ASSERT_IF(profilingEnabled_, callee == profilingEntry); + MOZ_ASSERT_IF(!profilingEnabled_, callee == entry); if (enabled) array[j] = profilingEntry; else diff --git a/js/src/asmjs/AsmJSModule.h b/js/src/asmjs/AsmJSModule.h index d33a04f84893..fc7fc5e8b697 100644 --- a/js/src/asmjs/AsmJSModule.h +++ b/js/src/asmjs/AsmJSModule.h @@ -238,14 +238,14 @@ class AsmJSModule Global(Which which, PropertyName *name) { pod.which_ = which; name_ = name; - JS_ASSERT_IF(name_, name_->isTenured()); + MOZ_ASSERT_IF(name_, name_->isTenured()); } void trace(JSTracer *trc) { if (name_) MarkStringUnbarriered(trc, &name_, "asm.js global name"); - JS_ASSERT_IF(pod.which_ == Variable && pod.u.var.initKind_ == InitConstant, - !pod.u.var.u.numLit_.scalarValue().isMarkable()); + MOZ_ASSERT_IF(pod.which_ == Variable && pod.u.var.initKind_ == InitConstant, + !pod.u.var.u.numLit_.scalarValue().isMarkable()); } public: @@ -430,7 +430,7 @@ class AsmJSModule pod.codeOffset_ = UINT32_MAX; pod.startOffsetInModule_ = startOffsetInModule; pod.endOffsetInModule_ = endOffsetInModule; - JS_ASSERT_IF(maybeFieldName_, name_->isTenured()); + MOZ_ASSERT_IF(maybeFieldName_, name_->isTenured()); } void trace(JSTracer *trc) { @@ -872,17 +872,17 @@ class AsmJSModule void initGlobalArgumentName(PropertyName *n) { MOZ_ASSERT(!isFinishedWithModulePrologue()); - JS_ASSERT_IF(n, n->isTenured()); + MOZ_ASSERT_IF(n, n->isTenured()); globalArgumentName_ = n; } void initImportArgumentName(PropertyName *n) { MOZ_ASSERT(!isFinishedWithModulePrologue()); - JS_ASSERT_IF(n, n->isTenured()); + MOZ_ASSERT_IF(n, n->isTenured()); importArgumentName_ = n; } void initBufferArgumentName(PropertyName *n) { MOZ_ASSERT(!isFinishedWithModulePrologue()); - JS_ASSERT_IF(n, n->isTenured()); + MOZ_ASSERT_IF(n, n->isTenured()); bufferArgumentName_ = n; } PropertyName *globalArgumentName() const { diff --git a/js/src/asmjs/AsmJSValidate.cpp b/js/src/asmjs/AsmJSValidate.cpp index 1b6524287338..f096791194c4 100644 --- a/js/src/asmjs/AsmJSValidate.cpp +++ b/js/src/asmjs/AsmJSValidate.cpp @@ -2935,7 +2935,7 @@ class FunctionCompiler { if (!joinBlock) return true; - JS_ASSERT_IF(curBlock_, thenBlocks.back() == curBlock_); + MOZ_ASSERT_IF(curBlock_, thenBlocks.back() == curBlock_); for (size_t i = 0; i < thenBlocks.length(); i++) { thenBlocks[i]->end(MGoto::New(alloc(), joinBlock)); if (!joinBlock->addPredecessor(alloc(), thenBlocks[i])) @@ -2995,7 +2995,7 @@ class FunctionCompiler { if (!loopStack_.append(pn) || !breakableStack_.append(pn)) return false; - JS_ASSERT_IF(curBlock_, curBlock_->loopDepth() == loopStack_.length() - 1); + MOZ_ASSERT_IF(curBlock_, curBlock_->loopDepth() == loopStack_.length() - 1); if (inDeadCode()) { *loopEntry = nullptr; return true; @@ -3055,7 +3055,7 @@ class FunctionCompiler return true; } MOZ_ASSERT(loopEntry->loopDepth() == loopStack_.length() + 1); - JS_ASSERT_IF(afterLoop, afterLoop->loopDepth() == loopStack_.length()); + MOZ_ASSERT_IF(afterLoop, afterLoop->loopDepth() == loopStack_.length()); if (curBlock_) { MOZ_ASSERT(curBlock_->loopDepth() == loopStack_.length() + 1); curBlock_->end(MGoto::New(alloc(), loopEntry)); @@ -6010,7 +6010,7 @@ CheckIfConditional(FunctionCompiler &f, ParseNode *conditional, ParseNode *thenS // Check post-conditions f.assertCurrentBlockIs(*thenBlock); - JS_ASSERT_IF(!f.inDeadCode(), *thenBlock && *elseOrJoinBlock); + MOZ_ASSERT_IF(!f.inDeadCode(), *thenBlock && *elseOrJoinBlock); return true; } @@ -6037,7 +6037,7 @@ CheckIfCondition(FunctionCompiler &f, ParseNode *cond, ParseNode *thenStmt, // Check post-conditions f.assertCurrentBlockIs(*thenBlock); - JS_ASSERT_IF(!f.inDeadCode(), *thenBlock && *elseOrJoinBlock); + MOZ_ASSERT_IF(!f.inDeadCode(), *thenBlock && *elseOrJoinBlock); return true; } diff --git a/js/src/asmjs/AsmJSValidate.h b/js/src/asmjs/AsmJSValidate.h index 8214d64381d3..208de971adff 100644 --- a/js/src/asmjs/AsmJSValidate.h +++ b/js/src/asmjs/AsmJSValidate.h @@ -86,8 +86,8 @@ IsValidAsmJSHeapLength(uint32_t length) (IsPowerOfTwo(length) || (length & 0x00ffffff) == 0); - JS_ASSERT_IF(valid, length % AsmJSPageSize == 0); - JS_ASSERT_IF(valid, length == RoundUpToNextValidAsmJSHeapLength(length)); + MOZ_ASSERT_IF(valid, length % AsmJSPageSize == 0); + MOZ_ASSERT_IF(valid, length == RoundUpToNextValidAsmJSHeapLength(length)); return valid; } diff --git a/js/src/builtin/Eval.cpp b/js/src/builtin/Eval.cpp index cb7d0ef1faa4..5fd8fcea2c0b 100644 --- a/js/src/builtin/Eval.cpp +++ b/js/src/builtin/Eval.cpp @@ -246,7 +246,7 @@ EvalKernel(JSContext *cx, const CallArgs &args, EvalType evalType, AbstractFrame { MOZ_ASSERT((evalType == INDIRECT_EVAL) == !caller); MOZ_ASSERT((evalType == INDIRECT_EVAL) == !pc); - JS_ASSERT_IF(evalType == INDIRECT_EVAL, scopeobj->is()); + MOZ_ASSERT_IF(evalType == INDIRECT_EVAL, scopeobj->is()); AssertInnerizedScopeChain(cx, *scopeobj); Rooted scopeObjGlobal(cx, &scopeobj->global()); @@ -274,7 +274,7 @@ EvalKernel(JSContext *cx, const CallArgs &args, EvalType evalType, AbstractFrame unsigned staticLevel; RootedValue thisv(cx); if (evalType == DIRECT_EVAL) { - JS_ASSERT_IF(caller.isInterpreterFrame(), !caller.asInterpreterFrame()->runningInJit()); + MOZ_ASSERT_IF(caller.isInterpreterFrame(), !caller.asInterpreterFrame()->runningInJit()); staticLevel = caller.script()->staticLevel() + 1; // Direct calls to eval are supposed to see the caller's |this|. If we @@ -465,8 +465,8 @@ js::DirectEval(JSContext *cx, const CallArgs &args) MOZ_ASSERT(caller.scopeChain()->global().valueIsEval(args.calleev())); MOZ_ASSERT(JSOp(*iter.pc()) == JSOP_EVAL || JSOp(*iter.pc()) == JSOP_SPREADEVAL); - JS_ASSERT_IF(caller.isFunctionFrame(), - caller.compartment() == caller.callee()->compartment()); + MOZ_ASSERT_IF(caller.isFunctionFrame(), + caller.compartment() == caller.callee()->compartment()); RootedObject scopeChain(cx, caller.scopeChain()); return EvalKernel(cx, args, DIRECT_EVAL, caller, scopeChain, iter.pc()); diff --git a/js/src/ctypes/CTypes.cpp b/js/src/ctypes/CTypes.cpp index cd9bf664d754..c38be3ee59b7 100644 --- a/js/src/ctypes/CTypes.cpp +++ b/js/src/ctypes/CTypes.cpp @@ -3303,8 +3303,8 @@ CType::Create(JSContext* cx, // Assert a sanity check on size and alignment: size % alignment should always // be zero. - JS_ASSERT_IF(IsSizeDefined(typeObj), - GetSize(typeObj) % GetAlignment(typeObj) == 0); + MOZ_ASSERT_IF(IsSizeDefined(typeObj), + GetSize(typeObj) % GetAlignment(typeObj) == 0); return typeObj; } @@ -5677,7 +5677,7 @@ FunctionType::Create(JSContext* cx, unsigned argc, jsval* vp) } // Pull out the argument types from the array, if any. - JS_ASSERT_IF(argTypes.length(), arrayObj); + MOZ_ASSERT_IF(argTypes.length(), arrayObj); for (uint32_t i = 0; i < argTypes.length(); ++i) { if (!JS_GetElement(cx, arrayObj, i, argTypes[i])) return false; @@ -6350,7 +6350,7 @@ CData::Create(JSContext* cx, MOZ_ASSERT(CType::IsCType(typeObj)); MOZ_ASSERT(CType::IsSizeDefined(typeObj)); MOZ_ASSERT(ownResult || source); - JS_ASSERT_IF(refObj && CData::IsCData(refObj), !ownResult); + MOZ_ASSERT_IF(refObj && CData::IsCData(refObj), !ownResult); // Get the 'prototype' property from the type. jsval slot = JS_GetReservedSlot(typeObj, SLOT_PROTO); diff --git a/js/src/ds/InlineMap.h b/js/src/ds/InlineMap.h index 86626a990299..04496faa1c0f 100644 --- a/js/src/ds/InlineMap.h +++ b/js/src/ds/InlineMap.h @@ -323,12 +323,12 @@ class InlineMap bool checkInlineRangeInvariants() const { MOZ_ASSERT(uintptr_t(cur) <= uintptr_t(end)); - JS_ASSERT_IF(cur != end, cur->key != nullptr); + MOZ_ASSERT_IF(cur != end, cur->key != nullptr); return true; } bool isInlineRange() const { - JS_ASSERT_IF(isInline, checkInlineRangeInvariants()); + MOZ_ASSERT_IF(isInline, checkInlineRangeInvariants()); return isInline; } diff --git a/js/src/ds/SplayTree.h b/js/src/ds/SplayTree.h index 31d38d6ab736..c10c823085d0 100644 --- a/js/src/ds/SplayTree.h +++ b/js/src/ds/SplayTree.h @@ -272,8 +272,8 @@ class SplayTree MOZ_ASSERT(!root); return nullptr; } - JS_ASSERT_IF(!node->parent, node == root); - JS_ASSERT_IF(minimum, C::compare(minimum->item, node->item) < 0); + MOZ_ASSERT_IF(!node->parent, node == root); + MOZ_ASSERT_IF(minimum, C::compare(minimum->item, node->item) < 0); if (node->left) { MOZ_ASSERT(node->left->parent == node); Node *leftMaximum = checkCoherency(node->left, minimum); diff --git a/js/src/frontend/BytecodeCompiler.cpp b/js/src/frontend/BytecodeCompiler.cpp index 3f854fa93eef..fac1381eb676 100644 --- a/js/src/frontend/BytecodeCompiler.cpp +++ b/js/src/frontend/BytecodeCompiler.cpp @@ -232,13 +232,13 @@ frontend::CompileScript(ExclusiveContext *cx, LifoAlloc *alloc, HandleObject sco * The scripted callerFrame can only be given for compile-and-go scripts * and non-zero static level requires callerFrame. */ - JS_ASSERT_IF(evalCaller, options.compileAndGo); - JS_ASSERT_IF(evalCaller, options.forEval); - JS_ASSERT_IF(staticLevel != 0, evalCaller); + MOZ_ASSERT_IF(evalCaller, options.compileAndGo); + MOZ_ASSERT_IF(evalCaller, options.forEval); + MOZ_ASSERT_IF(staticLevel != 0, evalCaller); if (!CheckLength(cx, srcBuf)) return nullptr; - JS_ASSERT_IF(staticLevel != 0, !options.sourceIsLazy); + MOZ_ASSERT_IF(staticLevel != 0, !options.sourceIsLazy); RootedScriptSource sourceObject(cx, CreateScriptSourceObject(cx, options)); if (!sourceObject) @@ -286,8 +286,8 @@ frontend::CompileScript(ExclusiveContext *cx, LifoAlloc *alloc, HandleObject sco // We can specialize a bit for the given scope chain if that scope chain is the global object. JSObject *globalScope = scopeChain && scopeChain == &scopeChain->global() ? (JSObject*) scopeChain : nullptr; - JS_ASSERT_IF(globalScope, globalScope->isNative()); - JS_ASSERT_IF(globalScope, JSCLASS_HAS_GLOBAL_FLAG_AND_SLOTS(globalScope->getClass())); + MOZ_ASSERT_IF(globalScope, globalScope->isNative()); + MOZ_ASSERT_IF(globalScope, JSCLASS_HAS_GLOBAL_FLAG_AND_SLOTS(globalScope->getClass())); BytecodeEmitter::EmitterMode emitterMode = options.selfHostingMode ? BytecodeEmitter::SelfHosting : BytecodeEmitter::Normal; @@ -604,8 +604,8 @@ CompileFunctionBody(JSContext *cx, MutableHandleFunction fun, const ReadOnlyComp return false; // Assignment must be monotonic to prevent reparsing iloops - JS_ASSERT_IF(directives.strict(), newDirectives.strict()); - JS_ASSERT_IF(directives.asmJS(), newDirectives.asmJS()); + MOZ_ASSERT_IF(directives.strict(), newDirectives.strict()); + MOZ_ASSERT_IF(directives.asmJS(), newDirectives.asmJS()); directives = newDirectives; } diff --git a/js/src/frontend/BytecodeEmitter.cpp b/js/src/frontend/BytecodeEmitter.cpp index b61caf2b128d..a1bedbb650cc 100644 --- a/js/src/frontend/BytecodeEmitter.cpp +++ b/js/src/frontend/BytecodeEmitter.cpp @@ -142,8 +142,8 @@ BytecodeEmitter::BytecodeEmitter(BytecodeEmitter *parent, hasGlobalScope(hasGlobalScope), emitterMode(emitterMode) { - JS_ASSERT_IF(evalCaller, insideEval); - JS_ASSERT_IF(emitterMode == LazyFunction, lazyScript); + MOZ_ASSERT_IF(evalCaller, insideEval); + MOZ_ASSERT_IF(emitterMode == LazyFunction, lazyScript); } bool @@ -450,7 +450,7 @@ EmitLoopHead(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *nextpn) * instruction. nextpn is often a block, in which case the next * instruction typically comes from the first statement inside. */ - JS_ASSERT_IF(nextpn->isKind(PNK_STATEMENTLIST), nextpn->isArity(PN_LIST)); + MOZ_ASSERT_IF(nextpn->isKind(PNK_STATEMENTLIST), nextpn->isArity(PN_LIST)); if (nextpn->isKind(PNK_STATEMENTLIST) && nextpn->pn_head) nextpn = nextpn->pn_head; if (!UpdateSourceCoordNotes(cx, bce, nextpn->pn_pos.begin)) @@ -465,7 +465,7 @@ EmitLoopEntry(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *nextpn) { if (nextpn) { /* Update the line number, as for LOOPHEAD. */ - JS_ASSERT_IF(nextpn->isKind(PNK_STATEMENTLIST), nextpn->isArity(PN_LIST)); + MOZ_ASSERT_IF(nextpn->isKind(PNK_STATEMENTLIST), nextpn->isArity(PN_LIST)); if (nextpn->isKind(PNK_STATEMENTLIST) && nextpn->pn_head) nextpn = nextpn->pn_head; if (!UpdateSourceCoordNotes(cx, bce, nextpn->pn_pos.begin)) @@ -787,7 +787,7 @@ ComputeAliasedSlots(ExclusiveContext *cx, BytecodeEmitter *bce, HandlesetAliased(i, bce->isAliasedName(dn)); } - JS_ASSERT_IF(bce->sc->allLocalsAliased(), AllLocalsAliased(*blockObj)); + MOZ_ASSERT_IF(bce->sc->allLocalsAliased(), AllLocalsAliased(*blockObj)); return true; } @@ -950,7 +950,7 @@ LeaveNestedScope(ExclusiveContext *cx, BytecodeEmitter *bce, StmtInfoBCE *stmt) NestedScopeObject *staticScope = &blockObjBox->object->as(); MOZ_ASSERT(stmt->staticScope == staticScope); MOZ_ASSERT(staticScope == bce->staticScope); - JS_ASSERT_IF(!stmt->isBlockScope, staticScope->is()); + MOZ_ASSERT_IF(!stmt->isBlockScope, staticScope->is()); #endif if (!PopStatementBCE(cx, bce)) @@ -1288,7 +1288,7 @@ EmitAliasedVarOp(ExclusiveContext *cx, JSOp op, ParseNode *pn, BytecodeEmitter * return false; JS_ALWAYS_TRUE(LookupAliasedNameSlot(bceOfDef, bceOfDef->script, pn->name(), &sc)); } else { - JS_ASSERT_IF(bce->sc->isFunctionBox(), local <= bceOfDef->script->bindings.numLocals()); + MOZ_ASSERT_IF(bce->sc->isFunctionBox(), local <= bceOfDef->script->bindings.numLocals()); MOZ_ASSERT(bceOfDef->staticScope->is()); Rooted b(cx, &bceOfDef->staticScope->as()); while (local < b->localOffset()) { @@ -1318,12 +1318,12 @@ EmitVarOp(ExclusiveContext *cx, ParseNode *pn, JSOp op, BytecodeEmitter *bce) return EmitAliasedVarOp(cx, op, sc, NodeNeedsCheckLexical(pn), bce); } - JS_ASSERT_IF(pn->isKind(PNK_NAME), IsArgOp(op) || IsLocalOp(op)); + MOZ_ASSERT_IF(pn->isKind(PNK_NAME), IsArgOp(op) || IsLocalOp(op)); if (!bce->isAliasedName(pn)) { MOZ_ASSERT(pn->isUsed() || pn->isDefn()); - JS_ASSERT_IF(pn->isUsed(), pn->pn_cookie.level() == 0); - JS_ASSERT_IF(pn->isDefn(), pn->pn_cookie.level() == bce->script->staticLevel()); + MOZ_ASSERT_IF(pn->isUsed(), pn->pn_cookie.level() == 0); + MOZ_ASSERT_IF(pn->isDefn(), pn->pn_cookie.level() == bce->script->staticLevel()); return EmitUnaliasedVarOp(cx, op, pn->pn_cookie.slot(), NodeNeedsCheckLexical(pn), bce); } @@ -1426,7 +1426,7 @@ BytecodeEmitter::isAliasedName(ParseNode *pn) return script->formalIsAliased(pn->pn_cookie.slot()); case Definition::VAR: case Definition::CONST: - JS_ASSERT_IF(sc->allLocalsAliased(), script->varIsAliased(pn->pn_cookie.slot())); + MOZ_ASSERT_IF(sc->allLocalsAliased(), script->varIsAliased(pn->pn_cookie.slot())); return script->varIsAliased(pn->pn_cookie.slot()); case Definition::PLACEHOLDER: case Definition::NAMED_LAMBDA: @@ -1593,7 +1593,7 @@ BindNameToSlotHelper(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn) { MOZ_ASSERT(pn->isKind(PNK_NAME)); - JS_ASSERT_IF(pn->isKind(PNK_FUNCTION), pn->isBound()); + MOZ_ASSERT_IF(pn->isKind(PNK_FUNCTION), pn->isBound()); /* Don't attempt if 'pn' is already bound or deoptimized or a function. */ if (pn->isBound() || pn->isDeoptimized()) @@ -1789,7 +1789,7 @@ BindNameToSlotHelper(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn) * scope and dn's scope. */ unsigned skip = bce->script->staticLevel() - dn->pn_cookie.level(); - JS_ASSERT_IF(skip, dn->isClosed()); + MOZ_ASSERT_IF(skip, dn->isClosed()); /* * Explicitly disallow accessing var/let bindings in global scope from @@ -3797,7 +3797,7 @@ EmitVariables(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn, VarEmit break; } - JS_ASSERT_IF(pn2->isDefn(), pn3 == pn2->pn_expr); + MOZ_ASSERT_IF(pn2->isDefn(), pn3 == pn2->pn_expr); if (!pn2->pn_cookie.isFree()) { if (!EmitVarOp(cx, pn2, op, bce)) return false; @@ -4719,8 +4719,8 @@ static bool EmitForOf(ExclusiveContext *cx, BytecodeEmitter *bce, StmtType type, ParseNode *pn, ptrdiff_t top) { MOZ_ASSERT(type == STMT_FOR_OF_LOOP || type == STMT_SPREAD); - JS_ASSERT_IF(type == STMT_FOR_OF_LOOP, pn && pn->pn_left->isKind(PNK_FOROF)); - JS_ASSERT_IF(type == STMT_SPREAD, !pn); + MOZ_ASSERT_IF(type == STMT_FOR_OF_LOOP, pn && pn->pn_left->isKind(PNK_FOROF)); + MOZ_ASSERT_IF(type == STMT_SPREAD, !pn); ParseNode *forHead = pn ? pn->pn_left : nullptr; ParseNode *forBody = pn ? pn->pn_right : nullptr; @@ -5130,7 +5130,7 @@ EmitFunc(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn) { FunctionBox *funbox = pn->pn_funbox; RootedFunction fun(cx, funbox->function()); - JS_ASSERT_IF(fun->isInterpretedLazy(), fun->lazyScript()); + MOZ_ASSERT_IF(fun->isInterpretedLazy(), fun->lazyScript()); /* * Set the EMITTEDFUNCTION flag in function definitions once they have been @@ -5138,7 +5138,7 @@ EmitFunc(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn) * function will be seen by EmitFunc in two places. */ if (pn->pn_dflags & PND_EMITTEDFUNCTION) { - JS_ASSERT_IF(fun->hasScript(), fun->nonLazyScript()); + MOZ_ASSERT_IF(fun->hasScript(), fun->nonLazyScript()); MOZ_ASSERT(pn->functionIsHoisted()); MOZ_ASSERT(bce->sc->isFunctionBox()); return true; @@ -5176,7 +5176,7 @@ EmitFunc(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn) if (outersc->isFunctionBox() && outersc->asFunctionBox()->mightAliasLocals()) funbox->setMightAliasLocals(); // inherit mightAliasLocals from parent - JS_ASSERT_IF(outersc->strict, funbox->strict); + MOZ_ASSERT_IF(outersc->strict, funbox->strict); // Inherit most things (principals, version, etc) from the parent. Rooted parent(cx, bce->script); @@ -5703,7 +5703,7 @@ EmitStatement(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn) if (useful) { JSOp op = wantval ? JSOP_SETRVAL : JSOP_POP; - JS_ASSERT_IF(pn2->isKind(PNK_ASSIGN), pn2->isOp(JSOP_NOP)); + MOZ_ASSERT_IF(pn2->isKind(PNK_ASSIGN), pn2->isOp(JSOP_NOP)); if (!EmitTree(cx, bce, pn2)) return false; if (Emit1(cx, bce, op) < 0) @@ -5787,7 +5787,7 @@ EmitDelete(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn) return false; if (useful) { - JS_ASSERT_IF(pn2->isKind(PNK_CALL), !(pn2->pn_xflags & PNX_SETCALL)); + MOZ_ASSERT_IF(pn2->isKind(PNK_CALL), !(pn2->pn_xflags & PNX_SETCALL)); if (!EmitTree(cx, bce, pn2)) return false; if (Emit1(cx, bce, JSOP_POP) < 0) diff --git a/js/src/frontend/BytecodeEmitter.h b/js/src/frontend/BytecodeEmitter.h index aabe7bec97c3..55b22ab0c43f 100644 --- a/js/src/frontend/BytecodeEmitter.h +++ b/js/src/frontend/BytecodeEmitter.h @@ -32,7 +32,7 @@ class CGConstList { Vector list; public: explicit CGConstList(ExclusiveContext *cx) : list(cx) {} - bool append(Value v) { JS_ASSERT_IF(v.isString(), v.toString()->isAtom()); return list.append(v); } + bool append(Value v) { MOZ_ASSERT_IF(v.isString(), v.toString()->isAtom()); return list.append(v); } size_t length() const { return list.length(); } void finish(ConstArray *array); }; diff --git a/js/src/frontend/FullParseHandler.h b/js/src/frontend/FullParseHandler.h index ce3524f7110d..0cf427fe7ea6 100644 --- a/js/src/frontend/FullParseHandler.h +++ b/js/src/frontend/FullParseHandler.h @@ -344,8 +344,8 @@ class FullParseHandler list->pn_xflags |= PNX_FUNCDEFS; } else { // General deoptimization was done in Parser::functionDef. - JS_ASSERT_IF(pc->sc->isFunctionBox(), - pc->sc->asFunctionBox()->hasExtensibleScope()); + MOZ_ASSERT_IF(pc->sc->isFunctionBox(), + pc->sc->asFunctionBox()->hasExtensibleScope()); } } @@ -443,7 +443,7 @@ class FullParseHandler } ParseNode *newReturnStatement(ParseNode *expr, const TokenPos &pos) { - JS_ASSERT_IF(expr, pos.encloses(expr->pn_pos)); + MOZ_ASSERT_IF(expr, pos.encloses(expr->pn_pos)); return new_(PNK_RETURN, JSOP_RETURN, pos, expr); } diff --git a/js/src/frontend/ParseMaps.h b/js/src/frontend/ParseMaps.h index 9a6d3f80c201..622c7eb1d7e4 100644 --- a/js/src/frontend/ParseMaps.h +++ b/js/src/frontend/ParseMaps.h @@ -292,7 +292,7 @@ class DefinitionList } bool empty() const { - JS_ASSERT_IF(!bits, !node); + MOZ_ASSERT_IF(!bits, !node); return !bits; } }; diff --git a/js/src/frontend/ParseNode.h b/js/src/frontend/ParseNode.h index ee8300756a25..56ec17981cba 100644 --- a/js/src/frontend/ParseNode.h +++ b/js/src/frontend/ParseNode.h @@ -1091,8 +1091,8 @@ class LabeledStatement : public ParseNode static bool test(const ParseNode &node) { bool match = node.isKind(PNK_LABEL); - JS_ASSERT_IF(match, node.isArity(PN_NAME)); - JS_ASSERT_IF(match, node.isOp(JSOP_NOP)); + MOZ_ASSERT_IF(match, node.isArity(PN_NAME)); + MOZ_ASSERT_IF(match, node.isOp(JSOP_NOP)); return match; } }; @@ -1115,8 +1115,8 @@ class LoopControlStatement : public ParseNode static bool test(const ParseNode &node) { bool match = node.isKind(PNK_BREAK) || node.isKind(PNK_CONTINUE); - JS_ASSERT_IF(match, node.isArity(PN_NULLARY)); - JS_ASSERT_IF(match, node.isOp(JSOP_NOP)); + MOZ_ASSERT_IF(match, node.isArity(PN_NULLARY)); + MOZ_ASSERT_IF(match, node.isOp(JSOP_NOP)); return match; } }; @@ -1130,8 +1130,8 @@ class BreakStatement : public LoopControlStatement static bool test(const ParseNode &node) { bool match = node.isKind(PNK_BREAK); - JS_ASSERT_IF(match, node.isArity(PN_NULLARY)); - JS_ASSERT_IF(match, node.isOp(JSOP_NOP)); + MOZ_ASSERT_IF(match, node.isArity(PN_NULLARY)); + MOZ_ASSERT_IF(match, node.isOp(JSOP_NOP)); return match; } }; @@ -1145,8 +1145,8 @@ class ContinueStatement : public LoopControlStatement static bool test(const ParseNode &node) { bool match = node.isKind(PNK_CONTINUE); - JS_ASSERT_IF(match, node.isArity(PN_NULLARY)); - JS_ASSERT_IF(match, node.isOp(JSOP_NOP)); + MOZ_ASSERT_IF(match, node.isArity(PN_NULLARY)); + MOZ_ASSERT_IF(match, node.isOp(JSOP_NOP)); return match; } }; @@ -1188,8 +1188,8 @@ class ConditionalExpression : public ParseNode static bool test(const ParseNode &node) { bool match = node.isKind(PNK_CONDITIONAL); - JS_ASSERT_IF(match, node.isArity(PN_TERNARY)); - JS_ASSERT_IF(match, node.isOp(JSOP_NOP)); + MOZ_ASSERT_IF(match, node.isArity(PN_TERNARY)); + MOZ_ASSERT_IF(match, node.isOp(JSOP_NOP)); return match; } }; @@ -1227,8 +1227,8 @@ class RegExpLiteral : public NullaryNode static bool test(const ParseNode &node) { bool match = node.isKind(PNK_REGEXP); - JS_ASSERT_IF(match, node.isArity(PN_NULLARY)); - JS_ASSERT_IF(match, node.isOp(JSOP_REGEXP)); + MOZ_ASSERT_IF(match, node.isArity(PN_NULLARY)); + MOZ_ASSERT_IF(match, node.isOp(JSOP_REGEXP)); return match; } }; @@ -1247,7 +1247,7 @@ class PropertyAccess : public ParseNode static bool test(const ParseNode &node) { bool match = node.isKind(PNK_DOT); - JS_ASSERT_IF(match, node.isArity(PN_NAME)); + MOZ_ASSERT_IF(match, node.isArity(PN_NAME)); return match; } diff --git a/js/src/frontend/Parser.cpp b/js/src/frontend/Parser.cpp index e40c855f4956..5f2f3fbb05fe 100644 --- a/js/src/frontend/Parser.cpp +++ b/js/src/frontend/Parser.cpp @@ -133,7 +133,7 @@ ParseContext::define(TokenStream &ts, HandlePropertyName name, ParseNode *pn, Definition::Kind kind) { MOZ_ASSERT(!pn->isUsed()); - JS_ASSERT_IF(pn->isDefn(), pn->isPlaceholder()); + MOZ_ASSERT_IF(pn->isDefn(), pn->isPlaceholder()); Definition *prevDef = nullptr; if (kind == Definition::LET) @@ -169,7 +169,7 @@ ParseContext::define(TokenStream &ts, pn->pn_dflags |= prevDef->pn_dflags & PND_CLOSED; } - JS_ASSERT_IF(kind != Definition::LET, !lexdeps->lookup(name)); + MOZ_ASSERT_IF(kind != Definition::LET, !lexdeps->lookup(name)); pn->setDefn(true); pn->pn_dflags &= ~PND_PLACEHOLDER; if (kind == Definition::CONST) @@ -350,7 +350,7 @@ AppendPackedBindings(const ParseContext *pc, const DeclVector &vec * only one binding with a given name is marked aliased. pc->decls * maintains the canonical definition for each name, so use that. */ - JS_ASSERT_IF(dn->isClosed(), pc->decls().lookupFirst(name) == dn); + MOZ_ASSERT_IF(dn->isClosed(), pc->decls().lookupFirst(name) == dn); bool aliased = dn->isClosed() || (pc->sc->allLocalsAliased() && pc->decls().lookupFirst(name) == dn); @@ -1166,7 +1166,7 @@ JSFunction * Parser::newFunction(GenericParseContext *pc, HandleAtom atom, FunctionSyntaxKind kind, JSObject *proto) { - JS_ASSERT_IF(kind == Statement, atom != nullptr); + MOZ_ASSERT_IF(kind == Statement, atom != nullptr); /* * Find the global compilation context in order to pre-set the newborn @@ -1519,7 +1519,7 @@ Parser::functionArguments(FunctionSyntaxKind kind, Node *listp, No } TokenKind tt = tokenStream.getToken(); - JS_ASSERT_IF(parenFreeArrow, tt == TOK_NAME); + MOZ_ASSERT_IF(parenFreeArrow, tt == TOK_NAME); switch (tt) { case TOK_LB: case TOK_LC: @@ -1748,8 +1748,8 @@ Parser::checkFunctionDefinition(HandlePropertyName funName, if (bodyLevel) { MOZ_ASSERT(pn->functionIsHoisted()); - JS_ASSERT_IF(pc->sc->isFunctionBox(), !pn->pn_cookie.isFree()); - JS_ASSERT_IF(!pc->sc->isFunctionBox(), pn->pn_cookie.isFree()); + MOZ_ASSERT_IF(pc->sc->isFunctionBox(), !pn->pn_cookie.isFree()); + MOZ_ASSERT_IF(!pc->sc->isFunctionBox(), pn->pn_cookie.isFree()); } else { /* * As a SpiderMonkey-specific extension, non-body-level function @@ -2006,7 +2006,7 @@ Parser::functionDef(HandlePropertyName funName, FunctionType type, FunctionSyntaxKind kind, GeneratorKind generatorKind) { - JS_ASSERT_IF(kind == Statement, funName); + MOZ_ASSERT_IF(kind == Statement, funName); /* Make a TOK_FUNCTION node. */ Node pn = handler.newFunctionDefinition(); @@ -2053,8 +2053,8 @@ Parser::functionDef(HandlePropertyName funName, return null(); // Assignment must be monotonic to prevent reparsing iloops - JS_ASSERT_IF(directives.strict(), newDirectives.strict()); - JS_ASSERT_IF(directives.asmJS(), newDirectives.asmJS()); + MOZ_ASSERT_IF(directives.strict(), newDirectives.strict()); + MOZ_ASSERT_IF(directives.asmJS(), newDirectives.asmJS()); directives = newDirectives; tokenStream.seek(start); @@ -3027,7 +3027,7 @@ Parser::bindVarOrConst(BindData *data, } DefinitionList::Range defs = pc->decls().lookupMulti(name); - JS_ASSERT_IF(stmt, !defs.empty()); + MOZ_ASSERT_IF(stmt, !defs.empty()); if (defs.empty()) { return pc->define(parser->tokenStream, name, pn, @@ -3587,7 +3587,7 @@ Parser::variables(ParseNodeKind kind, bool *psimple, * The simple flag is set if the declaration has the form 'var x', with * only one variable declared and no initializer expression. */ - JS_ASSERT_IF(psimple, *psimple); + MOZ_ASSERT_IF(psimple, *psimple); JSOp op = kind == PNK_LET ? JSOP_NOP : kind == PNK_VAR ? JSOP_DEFVAR : JSOP_DEFCONST; @@ -3860,7 +3860,7 @@ Parser::letStatement() ParseNode *pn; if (tokenStream.peekToken() == TOK_LP) { pn = letBlock(LetStatement); - JS_ASSERT_IF(pn, pn->isKind(PNK_LET) || pn->isKind(PNK_SEMI)); + MOZ_ASSERT_IF(pn, pn->isKind(PNK_LET) || pn->isKind(PNK_SEMI)); } else { pn = letDeclaration(); } @@ -4370,7 +4370,7 @@ Parser::forStatement() } } - JS_ASSERT_IF(isForDecl, pn1->isArity(PN_LIST)); + MOZ_ASSERT_IF(isForDecl, pn1->isArity(PN_LIST)); MOZ_ASSERT(!!blockObj == (isForDecl && pn1->isOp(JSOP_NOP))); // The form 'for (let ; ; ) ' generates an diff --git a/js/src/frontend/TokenStream.h b/js/src/frontend/TokenStream.h index 54921950c40b..3502d04f4843 100644 --- a/js/src/frontend/TokenStream.h +++ b/js/src/frontend/TokenStream.h @@ -672,13 +672,13 @@ class MOZ_STACK_CLASS TokenStream } const char16_t *addressOfNextRawChar(bool allowPoisoned = false) const { - JS_ASSERT_IF(!allowPoisoned, ptr); // make sure it hasn't been poisoned + MOZ_ASSERT_IF(!allowPoisoned, ptr); // make sure it hasn't been poisoned return ptr; } // Use this with caution! void setAddressOfNextRawChar(const char16_t *a, bool allowPoisoned = false) { - JS_ASSERT_IF(!allowPoisoned, a); + MOZ_ASSERT_IF(!allowPoisoned, a); ptr = a; } diff --git a/js/src/gc/Barrier.h b/js/src/gc/Barrier.h index d341df07acb6..166dc1366642 100644 --- a/js/src/gc/Barrier.h +++ b/js/src/gc/Barrier.h @@ -338,7 +338,7 @@ struct InternalGCMethods return; JS::shadow::Zone *shadowZone = JS::shadow::Zone::asShadowZone(zone); if (shadowZone->needsIncrementalBarrier()) { - JS_ASSERT_IF(v.isMarkable(), shadowRuntimeFromMainThread(v)->needsIncrementalBarrier()); + MOZ_ASSERT_IF(v.isMarkable(), shadowRuntimeFromMainThread(v)->needsIncrementalBarrier()); Value tmp(v); js::gc::MarkValueUnbarriered(shadowZone->barrierTracer(), &tmp, "write barrier"); MOZ_ASSERT(tmp == v); diff --git a/js/src/gc/ForkJoinNursery.cpp b/js/src/gc/ForkJoinNursery.cpp index b370343aaa4a..c193a03d1fa3 100644 --- a/js/src/gc/ForkJoinNursery.cpp +++ b/js/src/gc/ForkJoinNursery.cpp @@ -252,7 +252,7 @@ ForkJoinNursery::pjsCollection(int op) sweepHugeSlots(); MOZ_ASSERT(hugeSlots[hugeSlotsFrom].empty()); - JS_ASSERT_IF(isEvacuating_, hugeSlots[hugeSlotsNew].empty()); + MOZ_ASSERT_IF(isEvacuating_, hugeSlots[hugeSlotsNew].empty()); isEvacuating_ = false; evacuationZone_ = nullptr; @@ -575,7 +575,7 @@ ForkJoinNursery::reallocateSlots(JSObject *obj, HeapSlot *oldSlots, return nullptr; if (!isInsideNewspace(obj)) { - JS_ASSERT_IF(oldSlots, !isInsideNewspace(oldSlots)); + MOZ_ASSERT_IF(oldSlots, !isInsideNewspace(oldSlots)); return obj->zone()->pod_realloc(oldSlots, oldCount, newCount); } diff --git a/js/src/gc/Heap.h b/js/src/gc/Heap.h index 0d3a16a25d2a..21daeee5031f 100644 --- a/js/src/gc/Heap.h +++ b/js/src/gc/Heap.h @@ -1086,7 +1086,7 @@ ArenaHeader::getFirstFreeSpan() const void ArenaHeader::setFirstFreeSpan(const FreeSpan *span) { - JS_ASSERT_IF(!span->isEmpty(), span->isWithinArena(arenaAddress())); + MOZ_ASSERT_IF(!span->isEmpty(), span->isWithinArena(arenaAddress())); firstFreeSpan.compact(*span); } @@ -1356,7 +1356,7 @@ static MOZ_ALWAYS_INLINE void AssertValidToSkipBarrier(TenuredCell *thing) { MOZ_ASSERT(!IsInsideNursery(thing)); - JS_ASSERT_IF(thing, MapAllocToTraceKind(thing->getAllocKind()) != JSTRACE_OBJECT); + MOZ_ASSERT_IF(thing, MapAllocToTraceKind(thing->getAllocKind()) != JSTRACE_OBJECT); } /* static */ MOZ_ALWAYS_INLINE void diff --git a/js/src/gc/Marking.cpp b/js/src/gc/Marking.cpp index 6a3425ccfd6a..dca9ade374b2 100644 --- a/js/src/gc/Marking.cpp +++ b/js/src/gc/Marking.cpp @@ -183,8 +183,8 @@ CheckMarkedThing(JSTracer *trc, T **thingp) return; #ifdef JSGC_COMPACTING - JS_ASSERT_IF(!MovingTracer::IsMovingTracer(trc) && !Nursery::IsMinorCollectionTracer(trc), - !IsForwarded(*thingp)); + MOZ_ASSERT_IF(!MovingTracer::IsMovingTracer(trc) && !Nursery::IsMinorCollectionTracer(trc), + !IsForwarded(*thingp)); #endif /* @@ -204,7 +204,7 @@ CheckMarkedThing(JSTracer *trc, T **thingp) MOZ_ASSERT(CurrentThreadCanAccessRuntime(rt)); - JS_ASSERT_IF(thing->zone()->requireGCTracer(), isGcMarkingTracer); + MOZ_ASSERT_IF(thing->zone()->requireGCTracer(), isGcMarkingTracer); MOZ_ASSERT(thing->isAligned()); @@ -212,11 +212,11 @@ CheckMarkedThing(JSTracer *trc, T **thingp) if (isGcMarkingTracer) { GCMarker *gcMarker = static_cast(trc); - JS_ASSERT_IF(gcMarker->shouldCheckCompartments(), - thing->zone()->isCollecting() || rt->isAtomsZone(thing->zone())); + MOZ_ASSERT_IF(gcMarker->shouldCheckCompartments(), + thing->zone()->isCollecting() || rt->isAtomsZone(thing->zone())); - JS_ASSERT_IF(gcMarker->getMarkColor() == GRAY, - !thing->zone()->isGCMarkingBlack() || rt->isAtomsZone(thing->zone())); + MOZ_ASSERT_IF(gcMarker->getMarkColor() == GRAY, + !thing->zone()->isGCMarkingBlack() || rt->isAtomsZone(thing->zone())); MOZ_ASSERT(!(thing->zone()->isGCSweeping() || thing->zone()->isGCFinished() || @@ -229,8 +229,8 @@ CheckMarkedThing(JSTracer *trc, T **thingp) * part has not been overwritten, and that the free span list head in the * ArenaHeader may not be synced with the real one in ArenaLists. */ - JS_ASSERT_IF(IsThingPoisoned(thing) && rt->isHeapBusy(), - !InFreeList(thing->asTenured()->arenaHeader(), thing)); + MOZ_ASSERT_IF(IsThingPoisoned(thing) && rt->isHeapBusy(), + !InFreeList(thing->asTenured()->arenaHeader(), thing)); #endif } @@ -314,9 +314,9 @@ MarkInternal(JSTracer *trc, T **thingp) } #define JS_ROOT_MARKING_ASSERT(trc) \ - JS_ASSERT_IF(IS_GC_MARKING_TRACER(trc), \ - trc->runtime()->gc.state() == NO_INCREMENTAL || \ - trc->runtime()->gc.state() == MARK_ROOTS); + MOZ_ASSERT_IF(IS_GC_MARKING_TRACER(trc), \ + trc->runtime()->gc.state() == NO_INCREMENTAL || \ + trc->runtime()->gc.state() == MARK_ROOTS); namespace js { namespace gc { @@ -486,7 +486,7 @@ IsAboutToBeFinalized(T **thingp) #endif { Nursery &nursery = rt->gc.nursery; - JS_ASSERT_IF(!rt->isHeapMinorCollecting(), !IsInsideNursery(thing)); + MOZ_ASSERT_IF(!rt->isHeapMinorCollecting(), !IsInsideNursery(thing)); if (rt->isHeapMinorCollecting()) { if (IsInsideNursery(thing)) return !nursery.getForwardedPointer(thingp); @@ -504,8 +504,8 @@ IsAboutToBeFinalized(T **thingp) * compartment group and during minor gc. Rather than do the extra check, * we just assert that it's not necessary. */ - JS_ASSERT_IF(!rt->isHeapMinorCollecting(), - !thing->asTenured()->arenaHeader()->allocatedDuringIncremental); + MOZ_ASSERT_IF(!rt->isHeapMinorCollecting(), + !thing->asTenured()->arenaHeader()->allocatedDuringIncremental); return !thing->asTenured()->isMarked(); } @@ -665,8 +665,8 @@ gc::MarkKind(JSTracer *trc, void **thingp, JSGCTraceKind kind) MOZ_ASSERT(thingp); MOZ_ASSERT(*thingp); DebugOnly cell = static_cast(*thingp); - JS_ASSERT_IF(cell->isTenured(), - kind == MapAllocToTraceKind(cell->asTenured()->getAllocKind())); + MOZ_ASSERT_IF(cell->isTenured(), + kind == MapAllocToTraceKind(cell->asTenured()->getAllocKind())); switch (kind) { case JSTRACE_OBJECT: MarkInternal(trc, reinterpret_cast(thingp)); @@ -1057,7 +1057,7 @@ MaybePushMarkStackBetweenSlices(GCMarker *gcmarker, JSObject *thing) { DebugOnly rt = gcmarker->runtime(); JS_COMPARTMENT_ASSERT(rt, thing); - JS_ASSERT_IF(rt->isHeapBusy(), !IsInsideNursery(thing)); + MOZ_ASSERT_IF(rt->isHeapBusy(), !IsInsideNursery(thing)); if (!IsInsideNursery(thing) && thing->asTenured()->markIfUnmarked(gcmarker->getMarkColor())) gcmarker->pushObject(thing); @@ -1748,11 +1748,11 @@ GCMarker::processMarkStackTop(SliceBudget &budget) // Global objects all have the same trace hook. That hook is safe without barriers // if the global has no custom trace hook of its own, or has been moved to a different // compartment, and so can't have one. - JS_ASSERT_IF(runtime()->gc.isIncrementalGCEnabled() && - !(clasp->trace == JS_GlobalObjectTraceHook && - (!obj->compartment()->options().getTrace() || - !obj->isOwnGlobal())), - clasp->flags & JSCLASS_IMPLEMENTS_BARRIERS); + MOZ_ASSERT_IF(runtime()->gc.isIncrementalGCEnabled() && + !(clasp->trace == JS_GlobalObjectTraceHook && + (!obj->compartment()->options().getTrace() || + !obj->isOwnGlobal())), + clasp->flags & JSCLASS_IMPLEMENTS_BARRIERS); clasp->trace(this, obj); } diff --git a/js/src/gc/Nursery.cpp b/js/src/gc/Nursery.cpp index 5f5a4f83e664..d16a40ba3690 100644 --- a/js/src/gc/Nursery.cpp +++ b/js/src/gc/Nursery.cpp @@ -139,7 +139,7 @@ js::Nursery::isEmpty() const MOZ_ASSERT(runtime_); if (!isEnabled()) return true; - JS_ASSERT_IF(runtime_->gcZeal() != ZealGenerationalGCValue, currentStart_ == start()); + MOZ_ASSERT_IF(runtime_->gcZeal() != ZealGenerationalGCValue, currentStart_ == start()); return position() == currentStart_; } @@ -622,7 +622,7 @@ js::Nursery::forwardTypedArrayPointers(JSObject *dst, JSObject *src) * the start of the data. */ TypedArrayObject &typedArray = src->as(); - JS_ASSERT_IF(typedArray.buffer(), !isInside(src->getPrivate())); + MOZ_ASSERT_IF(typedArray.buffer(), !isInside(src->getPrivate())); if (typedArray.buffer()) return; diff --git a/js/src/gc/Statistics.cpp b/js/src/gc/Statistics.cpp index 0bacc5921abd..4a9c6e2b53c0 100644 --- a/js/src/gc/Statistics.cpp +++ b/js/src/gc/Statistics.cpp @@ -818,7 +818,7 @@ Statistics::beginPhase(Phase phase) MOZ_ASSERT(phases[phase].index == phase); Phase parent = phaseNestingDepth ? phaseNesting[phaseNestingDepth - 1] : PHASE_NO_PARENT; MOZ_ASSERT(phaseNestingDepth < MAX_NESTING); - JS_ASSERT_IF(gcDepth == 1, phases[phase].parent == parent); + MOZ_ASSERT_IF(gcDepth == 1, phases[phase].parent == parent); phaseNesting[phaseNestingDepth] = phase; phaseNestingDepth++; #endif diff --git a/js/src/gc/Tracer.cpp b/js/src/gc/Tracer.cpp index a706daba7d43..3fe76b98a0f4 100644 --- a/js/src/gc/Tracer.cpp +++ b/js/src/gc/Tracer.cpp @@ -587,7 +587,7 @@ GCMarker::checkZone(void *p) { MOZ_ASSERT(started); DebugOnly cell = static_cast(p); - JS_ASSERT_IF(cell->isTenured(), cell->asTenured()->zone()->isCollecting()); + MOZ_ASSERT_IF(cell->isTenured(), cell->asTenured()->zone()->isCollecting()); } #endif diff --git a/js/src/gc/Zone.cpp b/js/src/gc/Zone.cpp index 5905690056e1..dbcb5684ee9e 100644 --- a/js/src/gc/Zone.cpp +++ b/js/src/gc/Zone.cpp @@ -72,7 +72,7 @@ Zone::setNeedsIncrementalBarrier(bool needs, ShouldUpdateJit updateJit) if (needs && runtimeFromMainThread()->isAtomsZone(this)) MOZ_ASSERT(!runtimeFromMainThread()->exclusiveThreadsPresent()); - JS_ASSERT_IF(needs, canCollect()); + MOZ_ASSERT_IF(needs, canCollect()); needsIncrementalBarrier_ = needs; } @@ -141,7 +141,7 @@ Zone::sweepBreakpoints(FreeOp *fop) MOZ_ASSERT(isGCSweepingOrCompacting()); for (ZoneCellIterUnderGC i(this, FINALIZE_SCRIPT); !i.done(); i.next()) { JSScript *script = i.get(); - JS_ASSERT_IF(isGCSweeping(), script->zone()->isGCSweeping()); + MOZ_ASSERT_IF(isGCSweeping(), script->zone()->isGCSweeping()); if (!script->hasAnyBreakpointsOrStepMode()) continue; @@ -156,10 +156,10 @@ Zone::sweepBreakpoints(FreeOp *fop) for (Breakpoint *bp = site->firstBreakpoint(); bp; bp = nextbp) { nextbp = bp->nextInSite(); HeapPtrObject &dbgobj = bp->debugger->toJSObjectRef(); - JS_ASSERT_IF(isGCSweeping() && dbgobj->zone()->isCollecting(), - dbgobj->zone()->isGCSweeping()); + MOZ_ASSERT_IF(isGCSweeping() && dbgobj->zone()->isCollecting(), + dbgobj->zone()->isGCSweeping()); bool dying = scriptGone || IsObjectAboutToBeFinalized(&dbgobj); - JS_ASSERT_IF(!dying, !IsAboutToBeFinalized(&bp->getHandlerRef())); + MOZ_ASSERT_IF(!dying, !IsAboutToBeFinalized(&bp->getHandlerRef())); if (dying) bp->destroy(fop); } @@ -181,7 +181,7 @@ Zone::discardJitCode(FreeOp *fop) /* Assert no baseline scripts are marked as active. */ for (ZoneCellIterUnderGC i(this, FINALIZE_SCRIPT); !i.done(); i.next()) { JSScript *script = i.get(); - JS_ASSERT_IF(script->hasBaselineScript(), !script->baselineScript()->active()); + MOZ_ASSERT_IF(script->hasBaselineScript(), !script->baselineScript()->active()); } #endif diff --git a/js/src/gc/Zone.h b/js/src/gc/Zone.h index 5fc4ea6012ba..53bfcc86c4b7 100644 --- a/js/src/gc/Zone.h +++ b/js/src/gc/Zone.h @@ -180,7 +180,7 @@ struct Zone : public JS::shadow::Zone, }; void setGCState(GCState state) { MOZ_ASSERT(runtimeFromMainThread()->isHeapBusy()); - JS_ASSERT_IF(state != NoGC, canCollect()); + MOZ_ASSERT_IF(state != NoGC, canCollect()); gcState_ = state; } diff --git a/js/src/irregexp/RegExpParser.cpp b/js/src/irregexp/RegExpParser.cpp index 9689b5819066..1e3fcd28cab4 100644 --- a/js/src/irregexp/RegExpParser.cpp +++ b/js/src/irregexp/RegExpParser.cpp @@ -669,7 +669,7 @@ RegExpTree * RegExpParser::ParsePattern() { RegExpTree* result = ParseDisjunction(); - JS_ASSERT_IF(result, !has_more()); + MOZ_ASSERT_IF(result, !has_more()); return result; } diff --git a/js/src/jit/BacktrackingAllocator.cpp b/js/src/jit/BacktrackingAllocator.cpp index c3153a5ef5fa..3e39af8b110a 100644 --- a/js/src/jit/BacktrackingAllocator.cpp +++ b/js/src/jit/BacktrackingAllocator.cpp @@ -723,8 +723,8 @@ BacktrackingAllocator::tryAllocateRegister(PhysicalRegister &r, LiveInterval *in if (!reg->isCompatibleReg(r.reg)) return true; - JS_ASSERT_IF(interval->requirement()->kind() == Requirement::FIXED, - interval->requirement()->allocation() == LAllocation(r.reg)); + MOZ_ASSERT_IF(interval->requirement()->kind() == Requirement::FIXED, + interval->requirement()->allocation() == LAllocation(r.reg)); for (size_t i = 0; i < interval->numRanges(); i++) { AllocatedRange range(interval, interval->getRange(i)), existing; @@ -1181,11 +1181,11 @@ BacktrackingAllocator::populateSafepoints() // to this safepoint. if (ins == reg->ins() && !reg->isTemp()) { DebugOnly def = reg->def(); - JS_ASSERT_IF(def->policy() == LDefinition::MUST_REUSE_INPUT, - def->type() == LDefinition::GENERAL || - def->type() == LDefinition::INT32 || - def->type() == LDefinition::FLOAT32 || - def->type() == LDefinition::DOUBLE); + MOZ_ASSERT_IF(def->policy() == LDefinition::MUST_REUSE_INPUT, + def->type() == LDefinition::GENERAL || + def->type() == LDefinition::INT32 || + def->type() == LDefinition::FLOAT32 || + def->type() == LDefinition::DOUBLE); continue; } diff --git a/js/src/jit/Bailouts.cpp b/js/src/jit/Bailouts.cpp index c7a0668acf13..89f7151cc13b 100644 --- a/js/src/jit/Bailouts.cpp +++ b/js/src/jit/Bailouts.cpp @@ -100,7 +100,7 @@ jit::Bailout(BailoutStack *sp, BaselineBailoutInfo **bailoutInfo) MOZ_ASSERT(retval == BAILOUT_RETURN_OK || retval == BAILOUT_RETURN_FATAL_ERROR || retval == BAILOUT_RETURN_OVERRECURSED); - JS_ASSERT_IF(retval == BAILOUT_RETURN_OK, *bailoutInfo != nullptr); + MOZ_ASSERT_IF(retval == BAILOUT_RETURN_OK, *bailoutInfo != nullptr); if (retval != BAILOUT_RETURN_OK) { // If the bailout failed, then bailout trampoline will pop the @@ -156,7 +156,7 @@ jit::InvalidationBailout(InvalidationBailoutStack *sp, size_t *frameSizeOut, MOZ_ASSERT(retval == BAILOUT_RETURN_OK || retval == BAILOUT_RETURN_FATAL_ERROR || retval == BAILOUT_RETURN_OVERRECURSED); - JS_ASSERT_IF(retval == BAILOUT_RETURN_OK, *bailoutInfo != nullptr); + MOZ_ASSERT_IF(retval == BAILOUT_RETURN_OK, *bailoutInfo != nullptr); if (retval != BAILOUT_RETURN_OK) { // If the bailout failed, then bailout trampoline will pop the diff --git a/js/src/jit/BaselineBailouts.cpp b/js/src/jit/BaselineBailouts.cpp index ce20e130a295..363dfc946a5b 100644 --- a/js/src/jit/BaselineBailouts.cpp +++ b/js/src/jit/BaselineBailouts.cpp @@ -989,7 +989,7 @@ InitFromBailout(JSContext *cx, HandleScript caller, jsbytecode *callerPC, loc2 = slotInfo.nextSlotLocation(); JitSpew(JitSpew_BaselineBailouts, " Popping next stack value into %d.", (int) loc2); - JS_ASSERT_IF(loc1 != PCMappingSlotInfo::SlotIgnore, loc1 != loc2); + MOZ_ASSERT_IF(loc1 != PCMappingSlotInfo::SlotIgnore, loc1 != loc2); builder.popValueInto(loc2); } diff --git a/js/src/jit/BaselineFrame.h b/js/src/jit/BaselineFrame.h index e73051454f8c..501feb5cd3f5 100644 --- a/js/src/jit/BaselineFrame.h +++ b/js/src/jit/BaselineFrame.h @@ -170,21 +170,21 @@ class BaselineFrame Value &unaliasedVar(uint32_t i, MaybeCheckAliasing checkAliasing = CHECK_ALIASING) const { MOZ_ASSERT(i < script()->nfixedvars()); - JS_ASSERT_IF(checkAliasing, !script()->varIsAliased(i)); + MOZ_ASSERT_IF(checkAliasing, !script()->varIsAliased(i)); return *valueSlot(i); } Value &unaliasedFormal(unsigned i, MaybeCheckAliasing checkAliasing = CHECK_ALIASING) const { MOZ_ASSERT(i < numFormalArgs()); - JS_ASSERT_IF(checkAliasing, !script()->argsObjAliasesFormals() && - !script()->formalIsAliased(i)); + MOZ_ASSERT_IF(checkAliasing, !script()->argsObjAliasesFormals() && + !script()->formalIsAliased(i)); return argv()[i]; } Value &unaliasedActual(unsigned i, MaybeCheckAliasing checkAliasing = CHECK_ALIASING) const { MOZ_ASSERT(i < numActualArgs()); - JS_ASSERT_IF(checkAliasing, !script()->argsObjAliasesFormals()); - JS_ASSERT_IF(checkAliasing && i < numFormalArgs(), !script()->formalIsAliased(i)); + MOZ_ASSERT_IF(checkAliasing, !script()->argsObjAliasesFormals()); + MOZ_ASSERT_IF(checkAliasing && i < numFormalArgs(), !script()->formalIsAliased(i)); return argv()[i]; } diff --git a/js/src/jit/BaselineFrameInfo.h b/js/src/jit/BaselineFrameInfo.h index 653130df161a..0065c27b8abb 100644 --- a/js/src/jit/BaselineFrameInfo.h +++ b/js/src/jit/BaselineFrameInfo.h @@ -308,7 +308,7 @@ class FrameInfo void popRegsAndSync(uint32_t uses); inline void assertSyncedStack() const { - JS_ASSERT_IF(stackDepth() > 0, peek(-1)->kind() == StackValue::Stack); + MOZ_ASSERT_IF(stackDepth() > 0, peek(-1)->kind() == StackValue::Stack); } #ifdef DEBUG diff --git a/js/src/jit/BaselineIC.cpp b/js/src/jit/BaselineIC.cpp index 1d0566f8e70c..280d9ca63190 100644 --- a/js/src/jit/BaselineIC.cpp +++ b/js/src/jit/BaselineIC.cpp @@ -174,14 +174,14 @@ ICStub::trace(JSTracer *trc) if (isMonitoredFallback()) { ICTypeMonitor_Fallback *lastMonStub = toMonitoredFallbackStub()->fallbackMonitorStub(); for (ICStubConstIterator iter(lastMonStub->firstMonitorStub()); !iter.atEnd(); iter++) { - JS_ASSERT_IF(iter->next() == nullptr, *iter == lastMonStub); + MOZ_ASSERT_IF(iter->next() == nullptr, *iter == lastMonStub); iter->trace(trc); } } if (isUpdated()) { for (ICStubConstIterator iter(toUpdatedStub()->firstUpdateStub()); !iter.atEnd(); iter++) { - JS_ASSERT_IF(iter->next() == nullptr, iter->isTypeUpdate_Fallback()); + MOZ_ASSERT_IF(iter->next() == nullptr, iter->isTypeUpdate_Fallback()); iter->trace(trc); } } @@ -562,9 +562,9 @@ ICMonitoredStub::ICMonitoredStub(Kind kind, JitCode *stubCode, ICStub *firstMoni { // If the first monitored stub is a ICTypeMonitor_Fallback stub, then // double check that _its_ firstMonitorStub is the same as this one. - JS_ASSERT_IF(firstMonitorStub_->isTypeMonitor_Fallback(), - firstMonitorStub_->toTypeMonitor_Fallback()->firstMonitorStub() == - firstMonitorStub_); + MOZ_ASSERT_IF(firstMonitorStub_->isTypeMonitor_Fallback(), + firstMonitorStub_->toTypeMonitor_Fallback()->firstMonitorStub() == + firstMonitorStub_); } bool @@ -975,7 +975,7 @@ DoWarmUpCounterFallback(JSContext *cx, ICWarmUpCounter_Fallback *stub, BaselineF return false; // Jitcode should only be set here if not at loop entry. - JS_ASSERT_IF(!isLoopEntry, !jitcode); + MOZ_ASSERT_IF(!isLoopEntry, !jitcode); if (!jitcode) return true; @@ -1087,9 +1087,9 @@ DoProfilerFallback(JSContext *cx, BaselineFrame *frame, ICProfiler_Fallback *stu // Unlink any existing PushFunction stub (which may hold stale 'const char *' to // the profile string. - JS_ASSERT_IF(icEntry->firstStub() != stub, - icEntry->firstStub()->isProfiler_PushFunction() && - icEntry->firstStub()->next() == stub); + MOZ_ASSERT_IF(icEntry->firstStub() != stub, + icEntry->firstStub()->isProfiler_PushFunction() && + icEntry->firstStub()->next() == stub); stub->unlinkStubsWithKind(cx, ICStub::Profiler_PushFunction); MOZ_ASSERT(icEntry->firstStub() == stub); @@ -1166,7 +1166,7 @@ bool ICTypeMonitor_Fallback::addMonitorStubForValue(JSContext *cx, JSScript *script, HandleValue val) { bool wasDetachedMonitorChain = lastMonitorStubPtrAddr_ == nullptr; - JS_ASSERT_IF(wasDetachedMonitorChain, numOptimizedMonitorStubs_ == 0); + MOZ_ASSERT_IF(wasDetachedMonitorChain, numOptimizedMonitorStubs_ == 0); if (numOptimizedMonitorStubs_ >= MAX_OPTIMIZED_STUBS) { // TODO: if the TypeSet becomes unknown or has the AnyObject type, @@ -3372,8 +3372,8 @@ CheckHasNoSuchProperty(JSContext *cx, HandleObject obj, HandlePropertyName name, static bool IsCacheableProtoChain(JSObject *obj, JSObject *holder, bool isDOMProxy=false) { - JS_ASSERT_IF(isDOMProxy, IsCacheableDOMProxy(obj)); - JS_ASSERT_IF(!isDOMProxy, obj->isNative()); + MOZ_ASSERT_IF(isDOMProxy, IsCacheableDOMProxy(obj)); + MOZ_ASSERT_IF(!isDOMProxy, obj->isNative()); // Don't handle objects which require a prototype guard. This should // be uncommon so handling it is likely not worth the complexity. @@ -8369,7 +8369,7 @@ TryAttachCallStub(JSContext *cx, ICCall_Fallback *stub, HandleScript script, jsb if (stub->numOptimizedStubs() == 0 && IsOptimizableCallStringSplit(callee, thisv, argc, vp + 2)) return true; - JS_ASSERT_IF(stub->hasStub(ICStub::Call_StringSplit), stub->numOptimizedStubs() == 1); + MOZ_ASSERT_IF(stub->hasStub(ICStub::Call_StringSplit), stub->numOptimizedStubs() == 1); stub->unlinkStubsWithKind(cx, ICStub::Call_StringSplit); diff --git a/js/src/jit/BaselineIC.h b/js/src/jit/BaselineIC.h index 184753db6d20..4412e69ae383 100644 --- a/js/src/jit/BaselineIC.h +++ b/js/src/jit/BaselineIC.h @@ -1365,7 +1365,7 @@ class TypeCheckPrimitiveSetStub : public ICStub existingStub_(existingStub), flags_((existingStub ? existingStub->typeFlags() : 0) | TypeToFlag(type)) { - JS_ASSERT_IF(existingStub_, flags_ != existingStub_->typeFlags()); + MOZ_ASSERT_IF(existingStub_, flags_ != existingStub_->typeFlags()); } TypeCheckPrimitiveSetStub *updateStub() { diff --git a/js/src/jit/BaselineJIT.cpp b/js/src/jit/BaselineJIT.cpp index a278ed5a01d3..c2d847529a88 100644 --- a/js/src/jit/BaselineJIT.cpp +++ b/js/src/jit/BaselineJIT.cpp @@ -96,12 +96,12 @@ EnterBaseline(JSContext *cx, EnterJitData &data) } MOZ_ASSERT(jit::IsBaselineEnabled(cx)); - JS_ASSERT_IF(data.osrFrame, CheckFrame(data.osrFrame)); + MOZ_ASSERT_IF(data.osrFrame, CheckFrame(data.osrFrame)); EnterJitCode enter = cx->runtime()->jitRuntime()->enterBaseline(); // Caller must construct |this| before invoking the Ion function. - JS_ASSERT_IF(data.constructing, data.maxArgv[0].isObject()); + MOZ_ASSERT_IF(data.constructing, data.maxArgv[0].isObject()); data.result.setInt32(data.numActualArgs); { @@ -128,7 +128,7 @@ EnterBaseline(JSContext *cx, EnterJitData &data) // Release temporary buffer used for OSR into Ion. cx->runtime()->getJitRuntime(cx)->freeOsrTempData(); - JS_ASSERT_IF(data.result.isMagic(), data.result.isMagic(JS_ION_ERROR)); + MOZ_ASSERT_IF(data.result.isMagic(), data.result.isMagic(JS_ION_ERROR)); return data.result.isMagic() ? IonExec_Error : IonExec_Ok; } @@ -228,8 +228,8 @@ jit::BaselineCompile(JSContext *cx, JSScript *script) MethodStatus status = compiler.compile(); - JS_ASSERT_IF(status == Method_Compiled, script->hasBaselineScript()); - JS_ASSERT_IF(status != Method_Compiled, !script->hasBaselineScript()); + MOZ_ASSERT_IF(status == Method_Compiled, script->hasBaselineScript()); + MOZ_ASSERT_IF(status != Method_Compiled, !script->hasBaselineScript()); if (status == Method_CantCompile) script->setBaselineScript(cx, BASELINE_DISABLED_SCRIPT); @@ -631,7 +631,7 @@ BaselineScript::copyPCMappingIndexEntries(const PCMappingIndexEntry *entries) uint8_t * BaselineScript::nativeCodeForPC(JSScript *script, jsbytecode *pc, PCMappingSlotInfo *slotInfo) { - JS_ASSERT_IF(script->hasBaselineScript(), script->baselineScript() == this); + MOZ_ASSERT_IF(script->hasBaselineScript(), script->baselineScript() == this); uint32_t pcOffset = script->pcToOffset(pc); @@ -714,14 +714,14 @@ BaselineScript::pcForNativeOffset(JSScript *script, uint32_t nativeOffset, bool i--; PCMappingIndexEntry &entry = pcMappingIndexEntry(i); - JS_ASSERT_IF(isReturn, nativeOffset >= entry.nativeOffset); + MOZ_ASSERT_IF(isReturn, nativeOffset >= entry.nativeOffset); CompactBufferReader reader(pcMappingReader(i)); jsbytecode *curPC = script->offsetToPC(entry.pcOffset); uint32_t curNativeOffset = entry.nativeOffset; MOZ_ASSERT(script->containsPC(curPC)); - JS_ASSERT_IF(isReturn, nativeOffset >= curNativeOffset); + MOZ_ASSERT_IF(isReturn, nativeOffset >= curNativeOffset); // In the raw native-lookup case, the native code address can occur // before the start of ops. Associate those with bytecode offset 0. diff --git a/js/src/jit/BitSet.h b/js/src/jit/BitSet.h index 805a13fd0da6..01783969269b 100644 --- a/js/src/jit/BitSet.h +++ b/js/src/jit/BitSet.h @@ -140,7 +140,7 @@ class BitSet::Iterator index_ += numZeros; value_ >>= numZeros; - JS_ASSERT_IF(index_ < set_.numBits_, set_.contains(index_)); + MOZ_ASSERT_IF(index_ < set_.numBits_, set_.contains(index_)); } public: diff --git a/js/src/jit/BytecodeAnalysis.h b/js/src/jit/BytecodeAnalysis.h index b81ccf467664..e3e9ad4d346b 100644 --- a/js/src/jit/BytecodeAnalysis.h +++ b/js/src/jit/BytecodeAnalysis.h @@ -27,7 +27,7 @@ struct BytecodeInfo void init(unsigned depth) { MOZ_ASSERT(depth <= MAX_STACK_DEPTH); - JS_ASSERT_IF(initialized, stackDepth == depth); + MOZ_ASSERT_IF(initialized, stackDepth == depth); initialized = true; stackDepth = depth; } diff --git a/js/src/jit/CodeGenerator.cpp b/js/src/jit/CodeGenerator.cpp index b354f83b5919..708514159f42 100644 --- a/js/src/jit/CodeGenerator.cpp +++ b/js/src/jit/CodeGenerator.cpp @@ -162,7 +162,7 @@ CodeGenerator::CodeGenerator(MIRGenerator *gen, LIRGraph *graph, MacroAssembler CodeGenerator::~CodeGenerator() { - JS_ASSERT_IF(!gen->compilingAsmJS(), masm.numAsmJSAbsoluteLinks() == 0); + MOZ_ASSERT_IF(!gen->compilingAsmJS(), masm.numAsmJSAbsoluteLinks() == 0); js_delete(scriptCounts_); } @@ -2504,7 +2504,7 @@ CodeGenerator::visitCallKnown(LCallKnown *call) // Missing arguments must have been explicitly appended by the IonBuilder. MOZ_ASSERT(target->nargs() <= call->numStackArgs()); - JS_ASSERT_IF(call->mir()->isConstructing(), target->isInterpretedConstructor()); + MOZ_ASSERT_IF(call->mir()->isConstructing(), target->isInterpretedConstructor()); masm.checkStackAlignment(); @@ -6850,7 +6850,7 @@ CodeGenerator::link(JSContext *cx, types::CompilerConstraintList *constraints) ExecutionMode executionMode = gen->info().executionMode(); OptimizationLevel optimizationLevel = gen->optimizationInfo().level(); - JS_ASSERT_IF(HasIonScript(script, executionMode), executionMode == SequentialExecution); + MOZ_ASSERT_IF(HasIonScript(script, executionMode), executionMode == SequentialExecution); // We finished the new IonScript. Invalidate the current active IonScript, // so we can replace it with this new (probably higher optimized) version. @@ -8404,7 +8404,7 @@ CodeGenerator::visitInArray(LInArray *lir) if (lir->index()->isConstant()) { int32_t index = ToInt32(lir->index()); - JS_ASSERT_IF(index < 0, mir->needsNegativeIntCheck()); + MOZ_ASSERT_IF(index < 0, mir->needsNegativeIntCheck()); if (mir->needsNegativeIntCheck()) { ool = oolCallVM(OperatorInIInfo, lir, (ArgList(), Imm32(index), ToRegister(lir->object())), diff --git a/js/src/jit/CompileInfo-inl.h b/js/src/jit/CompileInfo-inl.h index 838faf2893dc..b12fdb5d3db8 100644 --- a/js/src/jit/CompileInfo-inl.h +++ b/js/src/jit/CompileInfo-inl.h @@ -31,8 +31,8 @@ InlineScriptTree * InlineScriptTree::New(TempAllocator *allocator, InlineScriptTree *callerTree, jsbytecode *callerPc, JSScript *script) { - JS_ASSERT_IF(!callerTree, !callerPc); - JS_ASSERT_IF(callerTree, callerTree->script()->containsPC(callerPc)); + MOZ_ASSERT_IF(!callerTree, !callerPc); + MOZ_ASSERT_IF(callerTree, callerTree->script()->containsPC(callerPc)); // Allocate a new InlineScriptTree void *treeMem = allocator->allocate(sizeof(InlineScriptTree)); diff --git a/js/src/jit/CompileInfo.h b/js/src/jit/CompileInfo.h index ce4e64131e12..9b0b5ac0e3d5 100644 --- a/js/src/jit/CompileInfo.h +++ b/js/src/jit/CompileInfo.h @@ -171,7 +171,7 @@ class CompileInfo executionMode_(executionMode), scriptNeedsArgsObj_(scriptNeedsArgsObj), inlineScriptTree_(inlineScriptTree) { - JS_ASSERT_IF(osrPc, JSOp(*osrPc) == JSOP_LOOPENTRY); + MOZ_ASSERT_IF(osrPc, JSOp(*osrPc) == JSOP_LOOPENTRY); // The function here can flow in from anywhere so look up the canonical // function to ensure that we do not try to embed a nursery pointer in diff --git a/js/src/jit/ExecutableAllocator.h b/js/src/jit/ExecutableAllocator.h index 0a078a6c44db..dbad75e7ded9 100644 --- a/js/src/jit/ExecutableAllocator.h +++ b/js/src/jit/ExecutableAllocator.h @@ -102,7 +102,7 @@ public: void release(bool willDestroy = false) { MOZ_ASSERT(m_refCount != 0); - JS_ASSERT_IF(willDestroy, m_refCount == 1); + MOZ_ASSERT_IF(willDestroy, m_refCount == 1); if (--m_refCount == 0) js_delete(this); } @@ -209,7 +209,7 @@ public: m_smallPools[i]->release(/* willDestroy = */true); // If this asserts we have a pool leak. - JS_ASSERT_IF(m_pools.initialized(), m_pools.empty()); + MOZ_ASSERT_IF(m_pools.initialized(), m_pools.empty()); } void purge() { diff --git a/js/src/jit/Ion.cpp b/js/src/jit/Ion.cpp index 0e951b43bb95..25e4c41c92fa 100644 --- a/js/src/jit/Ion.cpp +++ b/js/src/jit/Ion.cpp @@ -183,7 +183,7 @@ JitRuntime::~JitRuntime() js_delete(ionAlloc_); // By this point, the jitcode global table should be empty. - JS_ASSERT_IF(jitcodeGlobalTable_, jitcodeGlobalTable_->empty()); + MOZ_ASSERT_IF(jitcodeGlobalTable_, jitcodeGlobalTable_->empty()); js_delete(jitcodeGlobalTable_); } @@ -2196,9 +2196,9 @@ Compile(JSContext *cx, HandleScript script, BaselineFrame *osrFrame, jsbytecode { MOZ_ASSERT(jit::IsIonEnabled(cx)); MOZ_ASSERT(jit::IsBaselineEnabled(cx)); - JS_ASSERT_IF(osrPc != nullptr, LoopEntryCanIonOsr(osrPc)); - JS_ASSERT_IF(executionMode == ParallelExecution, !osrFrame && !osrPc); - JS_ASSERT_IF(executionMode == ParallelExecution, !HasIonScript(script, executionMode)); + MOZ_ASSERT_IF(osrPc != nullptr, LoopEntryCanIonOsr(osrPc)); + MOZ_ASSERT_IF(executionMode == ParallelExecution, !osrFrame && !osrPc); + MOZ_ASSERT_IF(executionMode == ParallelExecution, !HasIonScript(script, executionMode)); if (!script->hasBaselineScript()) return Method_Skipped; @@ -2529,7 +2529,7 @@ EnterIon(JSContext *cx, EnterJitData &data) EnterJitCode enter = cx->runtime()->jitRuntime()->enterIon(); // Caller must construct |this| before invoking the Ion function. - JS_ASSERT_IF(data.constructing, data.maxArgv[0].isObject()); + MOZ_ASSERT_IF(data.constructing, data.maxArgv[0].isObject()); data.result.setInt32(data.numActualArgs); { @@ -2549,7 +2549,7 @@ EnterIon(JSContext *cx, EnterJitData &data) // Release temporary buffer used for OSR into Ion. cx->runtime()->getJitRuntime(cx)->freeOsrTempData(); - JS_ASSERT_IF(data.result.isMagic(), data.result.isMagic(JS_ION_ERROR)); + MOZ_ASSERT_IF(data.result.isMagic(), data.result.isMagic(JS_ION_ERROR)); return data.result.isMagic() ? IonExec_Error : IonExec_Ok; } @@ -2652,7 +2652,7 @@ jit::FastInvoke(JSContext *cx, HandleFunction fun, CallArgs &args) args.rval().set(result); - JS_ASSERT_IF(result.isMagic(), result.isMagic(JS_ION_ERROR)); + MOZ_ASSERT_IF(result.isMagic(), result.isMagic(JS_ION_ERROR)); return result.isMagic() ? IonExec_Error : IonExec_Ok; } @@ -2664,7 +2664,7 @@ InvalidateActivation(FreeOp *fop, uint8_t *jitTop, bool invalidateAll) size_t frameno = 1; for (JitFrameIterator it(jitTop, SequentialExecution); !it.done(); ++it, ++frameno) { - JS_ASSERT_IF(frameno == 1, it.type() == JitFrame_Exit); + MOZ_ASSERT_IF(frameno == 1, it.type() == JitFrame_Exit); #ifdef DEBUG switch (it.type()) { diff --git a/js/src/jit/IonBuilder.cpp b/js/src/jit/IonBuilder.cpp index ab923a7cb0d2..3ebb08d531f7 100644 --- a/js/src/jit/IonBuilder.cpp +++ b/js/src/jit/IonBuilder.cpp @@ -2067,7 +2067,7 @@ IonBuilder::finishLoop(CFGState &state, MBasicBlock *successor) MOZ_ASSERT(loopDepth_); loopDepth_--; - JS_ASSERT_IF(successor, successor->loopDepth() == loopDepth_); + MOZ_ASSERT_IF(successor, successor->loopDepth() == loopDepth_); // Compute phis in the loop header and propagate them throughout the loop, // including the successor. @@ -2749,8 +2749,8 @@ IonBuilder::assertValidLoopHeadOp(jsbytecode *pc) // Make sure this is the next opcode after the loop header, // unless the for loop is unconditional. CFGState &state = cfgStack_.back(); - JS_ASSERT_IF((JSOp)*(state.loop.entry->pc()) == JSOP_GOTO, - GetNextPc(state.loop.entry->pc()) == pc); + MOZ_ASSERT_IF((JSOp)*(state.loop.entry->pc()) == JSOP_GOTO, + GetNextPc(state.loop.entry->pc()) == pc); // do-while loops have a source note. jssrcnote *sn = info().getNote(gsn, pc); @@ -3626,7 +3626,7 @@ IonBuilder::processCondSwitchCase(CFGState &state) // non-matching case is an aliased default case. We need to pop the // switch operand as we skip the default case block and use the default // body block directly. - JS_ASSERT_IF(!caseIsNew, caseIsDefault); + MOZ_ASSERT_IF(!caseIsNew, caseIsDefault); if (!caseIsNew && !caseBlock->addPredecessorPopN(alloc(), current, 1)) return ControlStatus_Error; } else { @@ -3678,13 +3678,13 @@ IonBuilder::processCondSwitchBody(CFGState &state) MOZ_ASSERT(currentIdx <= bodies.length()); if (currentIdx == bodies.length()) { - JS_ASSERT_IF(current, pc == state.condswitch.exitpc); + MOZ_ASSERT_IF(current, pc == state.condswitch.exitpc); return processSwitchEnd(state.condswitch.breaks, state.condswitch.exitpc); } // Get the next body MBasicBlock *nextBody = bodies[currentIdx++]; - JS_ASSERT_IF(current, pc == nextBody->pc()); + MOZ_ASSERT_IF(current, pc == nextBody->pc()); // Fix the reverse post-order iteration. graph().moveBlockToEnd(nextBody); @@ -4721,8 +4721,8 @@ IonBuilder::inlineTypeObjectFallback(CallInfo &callInfo, MBasicBlock *dispatchBl // 3. The MGetPropertyCache (and, if applicable, MTypeBarrier) only // have at most a single use. - JS_ASSERT_IF(callInfo.fun()->isGetPropertyCache(), !cache->hasUses()); - JS_ASSERT_IF(callInfo.fun()->isTypeBarrier(), cache->hasOneUse()); + MOZ_ASSERT_IF(callInfo.fun()->isGetPropertyCache(), !cache->hasUses()); + MOZ_ASSERT_IF(callInfo.fun()->isTypeBarrier(), cache->hasOneUse()); // This means that no resume points yet capture the MGetPropertyCache, // so everything from the MGetPropertyCache up until the call is movable. @@ -4812,8 +4812,8 @@ IonBuilder::inlineCalls(CallInfo &callInfo, ObjectVector &targets, // Only handle polymorphic inlining. MOZ_ASSERT(IsIonInlinablePC(pc)); MOZ_ASSERT(choiceSet.length() == targets.length()); - JS_ASSERT_IF(!maybeCache, targets.length() >= 2); - JS_ASSERT_IF(maybeCache, targets.length() >= 1); + MOZ_ASSERT_IF(!maybeCache, targets.length() >= 2); + MOZ_ASSERT_IF(maybeCache, targets.length() >= 1); MBasicBlock *dispatchBlock = current; callInfo.setImplicitlyUsedUnchecked(); @@ -5435,7 +5435,7 @@ IonBuilder::jsop_call(uint32_t argc, bool constructing) if (!getPolyCallTargets(calleeTypes, constructing, originals, 4, &gotLambda)) return false; } - JS_ASSERT_IF(gotLambda, originals.length() <= 1); + MOZ_ASSERT_IF(gotLambda, originals.length() <= 1); // If any call targets need to be cloned, look for existing clones to use. // Keep track of the originals as we need to case on them for poly inline. @@ -5603,7 +5603,7 @@ IonBuilder::makeCallHelper(JSFunction *target, CallInfo &callInfo, bool cloneAtC // Explicitly pad any missing arguments with |undefined|. // This permits skipping the argumentsRectifier. for (int i = targetArgs; i > (int)callInfo.argc(); i--) { - JS_ASSERT_IF(target, !target->isNative()); + MOZ_ASSERT_IF(target, !target->isNative()); MConstant *undef = constant(UndefinedValue()); call->addArg(i, undef); } @@ -5670,8 +5670,8 @@ IonBuilder::makeCall(JSFunction *target, CallInfo &callInfo, bool cloneAtCallsit { // Constructor calls to non-constructors should throw. We don't want to use // CallKnown in this case. - JS_ASSERT_IF(callInfo.constructing() && target, - target->isInterpretedConstructor() || target->isNativeConstructor()); + MOZ_ASSERT_IF(callInfo.constructing() && target, + target->isInterpretedConstructor() || target->isNativeConstructor()); MCall *call = makeCallHelper(target, callInfo, cloneAtCallsite); if (!call) @@ -5851,8 +5851,8 @@ IonBuilder::jsop_newarray_copyonwrite() // with the copy on write flag set already. During the arguments usage // analysis the baseline compiler hasn't run yet, however, though in this // case the template object's type doesn't matter. - JS_ASSERT_IF(info().executionMode() != ArgumentsUsageAnalysis, - templateObject->type()->hasAnyFlags(types::OBJECT_FLAG_COPY_ON_WRITE)); + MOZ_ASSERT_IF(info().executionMode() != ArgumentsUsageAnalysis, + templateObject->type()->hasAnyFlags(types::OBJECT_FLAG_COPY_ON_WRITE)); MNewArrayCopyOnWrite *ins = MNewArrayCopyOnWrite::New(alloc(), constraints(), templateObject, @@ -6272,7 +6272,7 @@ IonBuilder::newOsrPreheader(MBasicBlock *predecessor, jsbytecode *loopEntry) for (uint32_t i = info().startArgSlot(); i < osrBlock->stackDepth(); i++) { MDefinition *existing = current->getSlot(i); MDefinition *def = osrBlock->getSlot(i); - JS_ASSERT_IF(!needsArgsObj || !info().isSlotAliasedAtOsr(i), def->type() == MIRType_Value); + MOZ_ASSERT_IF(!needsArgsObj || !info().isSlotAliasedAtOsr(i), def->type() == MIRType_Value); // Aliased slots are never accessed, since they need to go through // the callobject. No need to type them here. @@ -7360,7 +7360,7 @@ IonBuilder::pushDerivedTypedObject(bool *emitted, types::TemporaryTypeSet *objTypes = obj->resultTypeSet(); const Class *expectedClass = objTypes ? objTypes->getKnownClass() : nullptr; const TypedProto *expectedProto = derivedPrediction.getKnownPrototype(); - JS_ASSERT_IF(expectedClass, IsTypedObjectClass(expectedClass)); + MOZ_ASSERT_IF(expectedClass, IsTypedObjectClass(expectedClass)); // Determine (if possible) the class/proto that the observed type set // describes. diff --git a/js/src/jit/IonCaches.cpp b/js/src/jit/IonCaches.cpp index 26e00ad9d646..c2ff75cd54cf 100644 --- a/js/src/jit/IonCaches.cpp +++ b/js/src/jit/IonCaches.cpp @@ -888,7 +888,7 @@ EmitGetterCall(JSContext *cx, MacroAssembler &masm, // Shape has a getter function. bool callNative = IsCacheableGetPropCallNative(obj, holder, shape); - JS_ASSERT_IF(!callNative, IsCacheableGetPropCallPropertyOp(obj, holder, shape)); + MOZ_ASSERT_IF(!callNative, IsCacheableGetPropCallPropertyOp(obj, holder, shape)); if (callNative) { MOZ_ASSERT(shape->hasGetterValue() && shape->getterValue().isObject() && @@ -2304,7 +2304,7 @@ GenerateCallSetter(JSContext *cx, IonScript *ion, MacroAssembler &masm, Register argVpReg = regSet.takeGeneral(); bool callNative = IsCacheableSetPropCallNative(obj, holder, shape); - JS_ASSERT_IF(!callNative, IsCacheableSetPropCallPropertyOp(obj, holder, shape)); + MOZ_ASSERT_IF(!callNative, IsCacheableSetPropCallPropertyOp(obj, holder, shape)); if (callNative) { MOZ_ASSERT(shape->hasSetterValue() && shape->setterObject() && @@ -2636,7 +2636,7 @@ SetPropertyIC::attachAddSlot(JSContext *cx, HandleScript outerScript, IonScript HandleObject obj, HandleShape oldShape, HandleTypeObject oldType, bool checkTypeset) { - JS_ASSERT_IF(!needsTypeBarrier(), !checkTypeset); + MOZ_ASSERT_IF(!needsTypeBarrier(), !checkTypeset); MacroAssembler masm(cx, ion, outerScript, profilerLeavePc_); RepatchStubAppender attacher(*this); @@ -2997,7 +2997,7 @@ bool SetPropertyParIC::attachAddSlot(LockedJSContext &cx, IonScript *ion, HandleObject obj, HandleShape oldShape, HandleTypeObject oldType, bool checkTypeset) { - JS_ASSERT_IF(!needsTypeBarrier(), !checkTypeset); + MOZ_ASSERT_IF(!needsTypeBarrier(), !checkTypeset); MacroAssembler masm(cx, ion); DispatchStubPrepender attacher(*this); @@ -3792,7 +3792,7 @@ GenerateSetTypedArrayElement(JSContext *cx, MacroAssembler &masm, IonCache::Stub BaseIndex target(elements, index, ScaleFromElemWidth(width)); if (arrayType == Scalar::Float32) { - JS_ASSERT_IF(hasUnaliasedDouble(), tempFloat32 != InvalidFloatReg); + MOZ_ASSERT_IF(hasUnaliasedDouble(), tempFloat32 != InvalidFloatReg); FloatRegister tempFloat = hasUnaliasedDouble() ? tempFloat32 : tempDouble; if (!masm.convertConstantOrRegisterToFloat(cx, value, tempFloat, &failures)) return false; diff --git a/js/src/jit/IonFrames-inl.h b/js/src/jit/IonFrames-inl.h index 283f6dc1b8fd..0197fc6422b1 100644 --- a/js/src/jit/IonFrames-inl.h +++ b/js/src/jit/IonFrames-inl.h @@ -56,7 +56,7 @@ JitFrameIterator::isFakeExitFrame() const prevType() == JitFrame_Unwound_IonJS || prevType() == JitFrame_Unwound_BaselineStub || (prevType() == JitFrame_Entry && type() == JitFrame_Exit)); - JS_ASSERT_IF(res, type() == JitFrame_Exit || type() == JitFrame_BaselineJS); + MOZ_ASSERT_IF(res, type() == JitFrame_Exit || type() == JitFrame_BaselineJS); return res; } diff --git a/js/src/jit/IonFrames.cpp b/js/src/jit/IonFrames.cpp index 15eedbea6e01..6e6c4b5fef1f 100644 --- a/js/src/jit/IonFrames.cpp +++ b/js/src/jit/IonFrames.cpp @@ -2410,7 +2410,7 @@ JitFrameIterator::verifyReturnAddressUsingNativeToBytecodeMap() InlineFrameIterator inlineFrames(GetJSContextFromJitCode(), this); for (size_t idx = 0; idx < location.length(); idx++) { MOZ_ASSERT(idx < location.length()); - JS_ASSERT_IF(idx < location.length() - 1, inlineFrames.more()); + MOZ_ASSERT_IF(idx < location.length() - 1, inlineFrames.more()); JitSpew(JitSpew_Profiling, "Match %d: ION %s:%d(%d) vs N2B %s:%d(%d)", (int)idx, diff --git a/js/src/jit/IonMacroAssembler.cpp b/js/src/jit/IonMacroAssembler.cpp index f10b8e70e803..e35bbcd4de9a 100644 --- a/js/src/jit/IonMacroAssembler.cpp +++ b/js/src/jit/IonMacroAssembler.cpp @@ -850,7 +850,7 @@ MacroAssembler::initGCThing(Register obj, Register slots, JSObject *templateObj, { // Fast initialization of an empty object returned by allocateObject(). - JS_ASSERT_IF(!templateObj->denseElementsAreCopyOnWrite(), !templateObj->hasDynamicElements()); + MOZ_ASSERT_IF(!templateObj->denseElementsAreCopyOnWrite(), !templateObj->hasDynamicElements()); storePtr(ImmGCPtr(templateObj->lastProperty()), Address(obj, JSObject::offsetOfShape())); storePtr(ImmGCPtr(templateObj->type()), Address(obj, JSObject::offsetOfType())); @@ -1752,7 +1752,7 @@ MacroAssembler::convertValueToInt(ValueOperand value, MDefinition *maybeInput, handleStringEntry && handleStringRejoin; - JS_ASSERT_IF(handleStrings, conversion == IntConversion_Any); + MOZ_ASSERT_IF(handleStrings, conversion == IntConversion_Any); Label done, isInt32, isBool, isDouble, isNull, isString; diff --git a/js/src/jit/JitcodeMap.cpp b/js/src/jit/JitcodeMap.cpp index a5c1e81cf15c..b8fb931dc312 100644 --- a/js/src/jit/JitcodeMap.cpp +++ b/js/src/jit/JitcodeMap.cpp @@ -121,7 +121,7 @@ JitcodeGlobalEntry::compare(const JitcodeGlobalEntry &ent1, const JitcodeGlobalE MOZ_ASSERT(!(ent1.isQuery() && ent2.isQuery())); // Ensure no overlaps for non-query lookups. - JS_ASSERT_IF(!ent1.isQuery() && !ent2.isQuery(), !ent1.overlapsWith(ent2)); + MOZ_ASSERT_IF(!ent1.isQuery() && !ent2.isQuery(), !ent1.overlapsWith(ent2)); // For two non-query entries, just comapare the start addresses. if (!ent1.isQuery() && !ent2.isQuery()) @@ -284,7 +284,7 @@ JitcodeRegionEntry::ReadDelta(CompactBufferReader &reader, uint32_t encVal = firstByte; *nativeDelta = encVal >> ENC1_NATIVE_DELTA_SHIFT; *pcDelta = (encVal & ENC1_PC_DELTA_MASK) >> ENC1_PC_DELTA_SHIFT; - JS_ASSERT_IF(*nativeDelta == 0, *pcDelta <= 0); + MOZ_ASSERT_IF(*nativeDelta == 0, *pcDelta <= 0); return; } @@ -295,7 +295,7 @@ JitcodeRegionEntry::ReadDelta(CompactBufferReader &reader, *nativeDelta = encVal >> ENC2_NATIVE_DELTA_SHIFT; *pcDelta = (encVal & ENC2_PC_DELTA_MASK) >> ENC2_PC_DELTA_SHIFT; MOZ_ASSERT(*pcDelta != 0); - JS_ASSERT_IF(*nativeDelta == 0, *pcDelta <= 0); + MOZ_ASSERT_IF(*nativeDelta == 0, *pcDelta <= 0); return; } @@ -311,7 +311,7 @@ JitcodeRegionEntry::ReadDelta(CompactBufferReader &reader, pcDeltaU |= ~ENC3_PC_DELTA_MAX; *pcDelta = pcDeltaU; MOZ_ASSERT(*pcDelta != 0); - JS_ASSERT_IF(*nativeDelta == 0, *pcDelta <= 0); + MOZ_ASSERT_IF(*nativeDelta == 0, *pcDelta <= 0); return; } @@ -328,7 +328,7 @@ JitcodeRegionEntry::ReadDelta(CompactBufferReader &reader, *pcDelta = pcDeltaU; MOZ_ASSERT(*pcDelta != 0); - JS_ASSERT_IF(*nativeDelta == 0, *pcDelta <= 0); + MOZ_ASSERT_IF(*nativeDelta == 0, *pcDelta <= 0); } /* static */ uint32_t @@ -456,7 +456,7 @@ JitcodeRegionEntry::WriteRun(CompactBufferWriter &writer, WriteScriptPc(writer, scriptIdx, pcOffset); spewer.spewAndAdvance(" "); - JS_ASSERT_IF(i < scriptDepth - 1, curTree->hasCaller()); + MOZ_ASSERT_IF(i < scriptDepth - 1, curTree->hasCaller()); curPc = curTree->callerPc(); curTree = curTree->caller(); } diff --git a/js/src/jit/JitcodeMap.h b/js/src/jit/JitcodeMap.h index 1a837410ed2e..b613dd9fc763 100644 --- a/js/src/jit/JitcodeMap.h +++ b/js/src/jit/JitcodeMap.h @@ -740,7 +740,7 @@ class JitcodeRegionEntry MOZ_ASSERT(cur_ <= end_); idx_++; - JS_ASSERT_IF(idx_ == count_, cur_ == end_); + MOZ_ASSERT_IF(idx_ == count_, cur_ == end_); } void reset() { diff --git a/js/src/jit/LIR.cpp b/js/src/jit/LIR.cpp index 56be77f7891f..e1a6197bb069 100644 --- a/js/src/jit/LIR.cpp +++ b/js/src/jit/LIR.cpp @@ -50,7 +50,7 @@ bool LIRGraph::noteNeedsSafepoint(LInstruction *ins) { // Instructions with safepoints must be in linear order. - JS_ASSERT_IF(!safepoints_.empty(), safepoints_.back()->id() < ins->id()); + MOZ_ASSERT_IF(!safepoints_.empty(), safepoints_.back()->id() < ins->id()); if (!ins->isCall() && !nonCallSafepoints_.append(ins)) return false; return safepoints_.append(ins); diff --git a/js/src/jit/LIR.h b/js/src/jit/LIR.h index ac36cbef8f9a..101d490b9bf7 100644 --- a/js/src/jit/LIR.h +++ b/js/src/jit/LIR.h @@ -439,7 +439,7 @@ class LDefinition void set(uint32_t index, Type type, Policy policy) { JS_STATIC_ASSERT(MAX_VIRTUAL_REGISTERS <= VREG_MASK); bits_ = (index << VREG_SHIFT) | (policy << POLICY_SHIFT) | (type << TYPE_SHIFT); - JS_ASSERT_IF(!SupportsSimd, !isSimdType()); + MOZ_ASSERT_IF(!SupportsSimd, !isSimdType()); } public: diff --git a/js/src/jit/LinearScan.cpp b/js/src/jit/LinearScan.cpp index 734ffd763e37..a916b850d2f8 100644 --- a/js/src/jit/LinearScan.cpp +++ b/js/src/jit/LinearScan.cpp @@ -517,11 +517,11 @@ LinearScanAllocator::populateSafepoints() // to this safepoint. if (ins == reg->ins() && !reg->isTemp()) { DebugOnly def = reg->def(); - JS_ASSERT_IF(def->policy() == LDefinition::MUST_REUSE_INPUT, - def->type() == LDefinition::GENERAL || - def->type() == LDefinition::INT32 || - def->type() == LDefinition::FLOAT32 || - def->type() == LDefinition::DOUBLE); + MOZ_ASSERT_IF(def->policy() == LDefinition::MUST_REUSE_INPUT, + def->type() == LDefinition::GENERAL || + def->type() == LDefinition::INT32 || + def->type() == LDefinition::FLOAT32 || + def->type() == LDefinition::DOUBLE); continue; } @@ -934,8 +934,8 @@ LinearScanAllocator::freeAllocation(LiveInterval *interval, LAllocation *alloc) if (!mine->canonicalSpill() && !other->canonicalSpill()) return; - JS_ASSERT_IF(mine->canonicalSpill() && other->canonicalSpill(), - mine->canonicalSpill()->isStackSlot() == other->canonicalSpill()->isStackSlot()); + MOZ_ASSERT_IF(mine->canonicalSpill() && other->canonicalSpill(), + mine->canonicalSpill()->isStackSlot() == other->canonicalSpill()->isStackSlot()); LinearScanVirtualRegister *candidate = mine->canonicalSpill() ? mine : other; if (!candidate->canonicalSpill()->isStackSlot()) @@ -959,7 +959,7 @@ LinearScanAllocator::finishInterval(LiveInterval *interval) LinearScanVirtualRegister *reg = &vregs[interval->vreg()]; // All spills should be equal to the canonical spill location. - JS_ASSERT_IF(alloc->isStackSlot(), *alloc == *reg->canonicalSpill()); + MOZ_ASSERT_IF(alloc->isStackSlot(), *alloc == *reg->canonicalSpill()); bool lastInterval = interval->index() == (reg->numIntervals() - 1); if (lastInterval) { @@ -1483,8 +1483,8 @@ LinearScanAllocator::UnhandledQueue::assertSorted() for (IntervalIterator i(begin()); i != end(); i++) { if (prev) { MOZ_ASSERT(prev->start() >= i->start()); - JS_ASSERT_IF(prev->start() == i->start(), - prev->requirement()->priority() >= i->requirement()->priority()); + MOZ_ASSERT_IF(prev->start() == i->start(), + prev->requirement()->priority() >= i->requirement()->priority()); } prev = *i; } diff --git a/js/src/jit/LiveRangeAllocator.cpp b/js/src/jit/LiveRangeAllocator.cpp index 55657650bc7c..c4a115a0e838 100644 --- a/js/src/jit/LiveRangeAllocator.cpp +++ b/js/src/jit/LiveRangeAllocator.cpp @@ -775,12 +775,12 @@ LiveRangeAllocator::buildLivenessInfo() LUse *use = inputAlloc->toUse(); // The first instruction, LLabel, has no uses. - JS_ASSERT_IF(forLSRA, inputOf(*ins) > outputOf(block->firstId())); + MOZ_ASSERT_IF(forLSRA, inputOf(*ins) > outputOf(block->firstId())); // Call uses should always be at-start or fixed, since the fixed intervals // use all registers. - JS_ASSERT_IF(ins->isCall() && !inputAlloc.isSnapshotInput(), - use->isFixedRegister() || use->usedAtStart()); + MOZ_ASSERT_IF(ins->isCall() && !inputAlloc.isSnapshotInput(), + use->isFixedRegister() || use->usedAtStart()); #ifdef DEBUG // Don't allow at-start call uses if there are temps of the same kind, @@ -804,12 +804,12 @@ LiveRangeAllocator::buildLivenessInfo() MOZ_ASSERT(!(hasUseRegister && hasUseRegisterAtStart)); // LSRA has issues with *AtStart, see bug 1039993. - JS_ASSERT_IF(forLSRA && hasUnaliasedDouble() && hasFloat32Def - && vregs[use].type() == LDefinition::DOUBLE, - !use->usedAtStart()); - JS_ASSERT_IF(forLSRA && hasMultiAlias() && hasDoubleDef - && vregs[use].type() == LDefinition::FLOAT32, - !use->usedAtStart()); + MOZ_ASSERT_IF(forLSRA && hasUnaliasedDouble() && hasFloat32Def + && vregs[use].type() == LDefinition::DOUBLE, + !use->usedAtStart()); + MOZ_ASSERT_IF(forLSRA && hasMultiAlias() && hasDoubleDef + && vregs[use].type() == LDefinition::FLOAT32, + !use->usedAtStart()); #endif // Don't treat RECOVERED_INPUT uses as keeping the vreg alive. @@ -937,7 +937,7 @@ LiveRangeAllocator::buildLivenessInfo() loopDone->clear(); } - JS_ASSERT_IF(!mblock->numPredecessors(), live->empty()); + MOZ_ASSERT_IF(!mblock->numPredecessors(), live->empty()); } validateVirtualRegisters(); @@ -998,7 +998,7 @@ LiveInterval::validateRanges() Range *range = &ranges_[i]; MOZ_ASSERT(range->from < range->to); - JS_ASSERT_IF(prev, prev->to <= range->from); + MOZ_ASSERT_IF(prev, prev->to <= range->from); prev = range; } } diff --git a/js/src/jit/LiveRangeAllocator.h b/js/src/jit/LiveRangeAllocator.h index f5480a9fc993..00ca443adc35 100644 --- a/js/src/jit/LiveRangeAllocator.h +++ b/js/src/jit/LiveRangeAllocator.h @@ -136,10 +136,10 @@ struct UsePosition : public TempObject, // Verify that the usedAtStart() flag is consistent with the // subposition. For now ignore fixed registers, because they // are handled specially around calls. - JS_ASSERT_IF(!use->isFixedRegister(), - pos.subpos() == (use->usedAtStart() - ? CodePosition::INPUT - : CodePosition::OUTPUT)); + MOZ_ASSERT_IF(!use->isFixedRegister(), + pos.subpos() == (use->usedAtStart() + ? CodePosition::INPUT + : CodePosition::OUTPUT)); } }; @@ -652,7 +652,7 @@ class LiveRangeAllocator : protected RegisterAllocator if (interval->numRanges() == 0) continue; - JS_ASSERT_IF(prev, prev->end() <= interval->start()); + MOZ_ASSERT_IF(prev, prev->end() <= interval->start()); interval->validateRanges(); prev = interval; diff --git a/js/src/jit/Lowering.cpp b/js/src/jit/Lowering.cpp index 92a60eaca9ce..ac15e301ef35 100644 --- a/js/src/jit/Lowering.cpp +++ b/js/src/jit/Lowering.cpp @@ -525,8 +525,8 @@ LIRGenerator::visitAssertFloat32(MAssertFloat32 *assertion) DebugOnly checkIsFloat32 = assertion->mustBeFloat32(); if (type != MIRType_Value && !js_JitOptions.eagerCompilation) { - JS_ASSERT_IF(checkIsFloat32, type == MIRType_Float32); - JS_ASSERT_IF(!checkIsFloat32, type != MIRType_Float32); + MOZ_ASSERT_IF(checkIsFloat32, type == MIRType_Float32); + MOZ_ASSERT_IF(!checkIsFloat32, type != MIRType_Float32); } return true; } @@ -2924,8 +2924,8 @@ LIRGenerator::visitStoreTypedArrayElement(MStoreTypedArrayElement *ins) MOZ_ASSERT(ins->index()->type() == MIRType_Int32); if (ins->isFloatArray()) { - JS_ASSERT_IF(ins->arrayType() == Scalar::Float32, ins->value()->type() == MIRType_Float32); - JS_ASSERT_IF(ins->arrayType() == Scalar::Float64, ins->value()->type() == MIRType_Double); + MOZ_ASSERT_IF(ins->arrayType() == Scalar::Float32, ins->value()->type() == MIRType_Float32); + MOZ_ASSERT_IF(ins->arrayType() == Scalar::Float64, ins->value()->type() == MIRType_Double); } else { MOZ_ASSERT(ins->value()->type() == MIRType_Int32); } @@ -2950,8 +2950,8 @@ LIRGenerator::visitStoreTypedArrayElementHole(MStoreTypedArrayElementHole *ins) MOZ_ASSERT(ins->length()->type() == MIRType_Int32); if (ins->isFloatArray()) { - JS_ASSERT_IF(ins->arrayType() == Scalar::Float32, ins->value()->type() == MIRType_Float32); - JS_ASSERT_IF(ins->arrayType() == Scalar::Float64, ins->value()->type() == MIRType_Double); + MOZ_ASSERT_IF(ins->arrayType() == Scalar::Float32, ins->value()->type() == MIRType_Float32); + MOZ_ASSERT_IF(ins->arrayType() == Scalar::Float64, ins->value()->type() == MIRType_Double); } else { MOZ_ASSERT(ins->value()->type() == MIRType_Int32); } diff --git a/js/src/jit/MIR.cpp b/js/src/jit/MIR.cpp index 5843914ee84a..856dfc315d60 100644 --- a/js/src/jit/MIR.cpp +++ b/js/src/jit/MIR.cpp @@ -979,8 +979,8 @@ MCallDOMNative::computeMovable() // the types of our arguments. const JSJitInfo *jitInfo = getJitInfo(); - JS_ASSERT_IF(jitInfo->isMovable, - jitInfo->aliasSet() != JSJitInfo::AliasEverything); + MOZ_ASSERT_IF(jitInfo->isMovable, + jitInfo->aliasSet() != JSJitInfo::AliasEverything); if (jitInfo->isMovable && !isEffectful()) setMovable(); @@ -4148,7 +4148,7 @@ TryAddTypeBarrierForWrite(TempAllocator &alloc, types::CompilerConstraintList *c if (!(*pvalue)->mightBeType(propertyType)) { // The value's type does not match the property type. Just do a VM // call as it will always trigger invalidation of the compiled code. - JS_ASSERT_IF((*pvalue)->type() != MIRType_Value, (*pvalue)->type() != propertyType); + MOZ_ASSERT_IF((*pvalue)->type() != MIRType_Value, (*pvalue)->type() != propertyType); return false; } MInstruction *ins = MUnbox::New(alloc, *pvalue, propertyType, MUnbox::Fallible); diff --git a/js/src/jit/MIR.h b/js/src/jit/MIR.h index 6e288d7d2260..08e39e9c26f0 100644 --- a/js/src/jit/MIR.h +++ b/js/src/jit/MIR.h @@ -1642,7 +1642,7 @@ class MSimdBinaryArith : public MBinaryInstruction MSimdBinaryArith(MDefinition *left, MDefinition *right, Operation op, MIRType type) : MBinaryInstruction(left, right), operation_(op) { - JS_ASSERT_IF(type == MIRType_Int32x4, op == Add || op == Sub); + MOZ_ASSERT_IF(type == MIRType_Int32x4, op == Add || op == Sub); MOZ_ASSERT(IsSimdType(type)); MOZ_ASSERT(left->type() == right->type()); MOZ_ASSERT(left->type() == type); @@ -2397,7 +2397,7 @@ class MNewObject : public MUnaryInstruction templateObjectIsClassPrototype_(templateObjectIsClassPrototype) { JSObject *obj = templateObject(); - JS_ASSERT_IF(templateObjectIsClassPrototype, !shouldUseVM()); + MOZ_ASSERT_IF(templateObjectIsClassPrototype, !shouldUseVM()); setResultType(MIRType_Object); if (!obj->hasSingletonType()) setResultTypeSet(MakeSingletonTypeSet(constraints, obj)); @@ -3527,7 +3527,7 @@ class MUnbox : public MUnaryInstruction, public BoxInputsPolicy::Data // Only allow unboxing a non MIRType_Value when input and output types // don't match. This is often used to force a bailout. Boxing happens // during type analysis. - JS_ASSERT_IF(ins->type() != MIRType_Value, type != ins->type()); + MOZ_ASSERT_IF(ins->type() != MIRType_Value, type != ins->type()); MOZ_ASSERT(type == MIRType_Boolean || type == MIRType_Int32 || @@ -5297,7 +5297,7 @@ class MMul : public MBinaryArithInstruction setTruncateKind(Truncate); setCommutative(); } - JS_ASSERT_IF(mode != Integer, mode == Normal); + MOZ_ASSERT_IF(mode != Integer, mode == Normal); if (type != MIRType_Value) specialization_ = type; diff --git a/js/src/jit/MIRGraph.cpp b/js/src/jit/MIRGraph.cpp index 93356b14625c..6388e053b6e2 100644 --- a/js/src/jit/MIRGraph.cpp +++ b/js/src/jit/MIRGraph.cpp @@ -577,7 +577,7 @@ MBasicBlock::linkOsrValues(MStart *start) cloneRp = def->toOsrReturnValue(); } else if (info().hasArguments() && i == info().argsObjSlot()) { MOZ_ASSERT(def->isConstant() || def->isOsrArgumentsObject()); - JS_ASSERT_IF(def->isConstant(), def->toConstant()->value() == UndefinedValue()); + MOZ_ASSERT_IF(def->isConstant(), def->toConstant()->value() == UndefinedValue()); if (def->isOsrArgumentsObject()) cloneRp = def->toOsrArgumentsObject(); } else { @@ -586,7 +586,7 @@ MBasicBlock::linkOsrValues(MStart *start) // A constant Undefined can show up here for an argument slot when the function uses // a heavyweight argsobj, but the argument in question is stored on the scope chain. - JS_ASSERT_IF(def->isConstant(), def->toConstant()->value() == UndefinedValue()); + MOZ_ASSERT_IF(def->isConstant(), def->toConstant()->value() == UndefinedValue()); if (def->isOsrValue()) cloneRp = def->toOsrValue(); @@ -1140,8 +1140,8 @@ MBasicBlock::assertUsesAreNotWithin(MUseIterator use, MUseIterator end) { #ifdef DEBUG for (; use != end; use++) { - JS_ASSERT_IF(use->consumer()->isDefinition(), - use->consumer()->toDefinition()->block()->id() < id()); + MOZ_ASSERT_IF(use->consumer()->isDefinition(), + use->consumer()->toDefinition()->block()->id() < id()); } #endif } @@ -1315,7 +1315,7 @@ MBasicBlock::replaceSuccessor(size_t pos, MBasicBlock *split) // Note, during split-critical-edges, successors-with-phis is not yet set. // During PAA, this case is handled before we enter. - JS_ASSERT_IF(successorWithPhis_, successorWithPhis_ != getSuccessor(pos)); + MOZ_ASSERT_IF(successorWithPhis_, successorWithPhis_ != getSuccessor(pos)); lastIns()->replaceSuccessor(pos, split); } diff --git a/js/src/jit/MoveResolver.h b/js/src/jit/MoveResolver.h index 545e9bb53134..a945434326e9 100644 --- a/js/src/jit/MoveResolver.h +++ b/js/src/jit/MoveResolver.h @@ -96,10 +96,10 @@ class MoveOperand // only appear in controlled circumstances in the trampoline code // which ensures these cases never come up. - JS_ASSERT_IF(isMemoryOrEffectiveAddress() && other.isGeneralReg(), - base() != other.reg()); - JS_ASSERT_IF(other.isMemoryOrEffectiveAddress() && isGeneralReg(), - other.base() != reg()); + MOZ_ASSERT_IF(isMemoryOrEffectiveAddress() && other.isGeneralReg(), + base() != other.reg()); + MOZ_ASSERT_IF(other.isMemoryOrEffectiveAddress() && isGeneralReg(), + other.base() != reg()); if (kind_ != other.kind_) return false; diff --git a/js/src/jit/ParallelSafetyAnalysis.cpp b/js/src/jit/ParallelSafetyAnalysis.cpp index ee7db6c891a0..ef48782ad69e 100644 --- a/js/src/jit/ParallelSafetyAnalysis.cpp +++ b/js/src/jit/ParallelSafetyAnalysis.cpp @@ -813,7 +813,7 @@ jit::AddPossibleCallees(JSContext *cx, MIRGraph &graph, CallTargetVector &target RootedFunction target(cx, callIns->getSingleTarget()); if (target) { - JS_ASSERT_IF(!target->isInterpreted(), target->hasParallelNative()); + MOZ_ASSERT_IF(!target->isInterpreted(), target->hasParallelNative()); if (target->isInterpreted()) { RootedScript script(cx, target->getOrCreateScript(cx)); diff --git a/js/src/jit/RangeAnalysis.cpp b/js/src/jit/RangeAnalysis.cpp index ba390ceef4d2..01c5001645c9 100644 --- a/js/src/jit/RangeAnalysis.cpp +++ b/js/src/jit/RangeAnalysis.cpp @@ -689,10 +689,10 @@ Range::or_(TempAllocator &alloc, const Range *lhs, const Range *rhs) // The code below uses CountLeadingZeroes32, which has undefined behavior // if its operand is 0. We rely on the code above to protect it. - JS_ASSERT_IF(lhs->lower() >= 0, lhs->upper() != 0); - JS_ASSERT_IF(rhs->lower() >= 0, rhs->upper() != 0); - JS_ASSERT_IF(lhs->upper() < 0, lhs->lower() != -1); - JS_ASSERT_IF(rhs->upper() < 0, rhs->lower() != -1); + MOZ_ASSERT_IF(lhs->lower() >= 0, lhs->upper() != 0); + MOZ_ASSERT_IF(rhs->lower() >= 0, rhs->upper() != 0); + MOZ_ASSERT_IF(lhs->upper() < 0, lhs->lower() != -1); + MOZ_ASSERT_IF(rhs->upper() < 0, rhs->lower() != -1); int32_t lower = INT32_MIN; int32_t upper = INT32_MAX; @@ -1711,7 +1711,7 @@ RangeAnalysis::analyzeLoopIterationCount(MBasicBlock *header, lessEqual = !lessEqual; } - JS_ASSERT_IF(rhs, !rhs->block()->isMarked()); + MOZ_ASSERT_IF(rhs, !rhs->block()->isMarked()); // Ensure the lhs is a phi node from the start of the loop body. if (!lhs.term || !lhs.term->isPhi() || lhs.term->block() != header) @@ -2446,7 +2446,7 @@ MCompare::operandTruncateKind(size_t index) const { // If we're doing an int32 comparison on operands which were previously // floating-point, convert them! - JS_ASSERT_IF(truncateOperands_, isInt32Comparison()); + MOZ_ASSERT_IF(truncateOperands_, isInt32Comparison()); return truncateOperands_ ? TruncateAfterBailouts : NoTruncate; } diff --git a/js/src/jit/RangeAnalysis.h b/js/src/jit/RangeAnalysis.h index 903d5ad0226c..299630ff09b8 100644 --- a/js/src/jit/RangeAnalysis.h +++ b/js/src/jit/RangeAnalysis.h @@ -207,8 +207,8 @@ class Range : public TempObject { // When hasInt32LowerBound_ or hasInt32UpperBound_ are false, we set // lower_ and upper_ to these specific values as it simplifies the // implementation in some places. - JS_ASSERT_IF(!hasInt32LowerBound_, lower_ == JSVAL_INT_MIN); - JS_ASSERT_IF(!hasInt32UpperBound_, upper_ == JSVAL_INT_MAX); + MOZ_ASSERT_IF(!hasInt32LowerBound_, lower_ == JSVAL_INT_MIN); + MOZ_ASSERT_IF(!hasInt32UpperBound_, upper_ == JSVAL_INT_MAX); // max_exponent_ must be one of three possible things. MOZ_ASSERT(max_exponent_ <= MaxFiniteExponent || @@ -223,8 +223,8 @@ class Range : public TempObject { // false, however that value also has exponent 30, which is strictly // less than MaxInt32Exponent. For another example, 1.9 has an exponent // of 0 but requires upper_ to be at least 2, which has exponent 1. - JS_ASSERT_IF(!hasInt32LowerBound_ || !hasInt32UpperBound_, - max_exponent_ + canHaveFractionalPart_ >= MaxInt32Exponent); + MOZ_ASSERT_IF(!hasInt32LowerBound_ || !hasInt32UpperBound_, + max_exponent_ + canHaveFractionalPart_ >= MaxInt32Exponent); MOZ_ASSERT(max_exponent_ + canHaveFractionalPart_ >= mozilla::FloorLog2(mozilla::Abs(upper_))); MOZ_ASSERT(max_exponent_ + canHaveFractionalPart_ >= diff --git a/js/src/jit/RegisterAllocator.cpp b/js/src/jit/RegisterAllocator.cpp index 591d41bc687b..48df402d0d6e 100644 --- a/js/src/jit/RegisterAllocator.cpp +++ b/js/src/jit/RegisterAllocator.cpp @@ -102,17 +102,17 @@ AllocationIntegrityState::check(bool populateSafepoints) MOZ_ASSERT(!def->output()->isUse()); LDefinition oldDef = instructions[ins->id()].outputs[i]; - JS_ASSERT_IF(oldDef.policy() == LDefinition::MUST_REUSE_INPUT, - *def->output() == *ins->getOperand(oldDef.getReusedInput())); + MOZ_ASSERT_IF(oldDef.policy() == LDefinition::MUST_REUSE_INPUT, + *def->output() == *ins->getOperand(oldDef.getReusedInput())); } for (size_t i = 0; i < ins->numTemps(); i++) { LDefinition *temp = ins->getTemp(i); - JS_ASSERT_IF(!temp->isBogusTemp(), temp->output()->isRegister()); + MOZ_ASSERT_IF(!temp->isBogusTemp(), temp->output()->isRegister()); LDefinition oldTemp = instructions[ins->id()].temps[i]; - JS_ASSERT_IF(oldTemp.policy() == LDefinition::MUST_REUSE_INPUT, - *temp->output() == *ins->getOperand(oldTemp.getReusedInput())); + MOZ_ASSERT_IF(oldTemp.policy() == LDefinition::MUST_REUSE_INPUT, + *temp->output() == *ins->getOperand(oldTemp.getReusedInput())); } } } @@ -143,9 +143,9 @@ AllocationIntegrityState::check(bool populateSafepoints) if (!checkSafepointAllocation(ins, vreg, *alloc, populateSafepoints)) return false; } - JS_ASSERT_IF(ins->isCall() && !populateSafepoints, - safepoint->liveRegs().empty(true) && - safepoint->liveRegs().empty(false)); + MOZ_ASSERT_IF(ins->isCall() && !populateSafepoints, + safepoint->liveRegs().empty(true) && + safepoint->liveRegs().empty(false)); } size_t inputIndex = 0; diff --git a/js/src/jit/RegisterSets.h b/js/src/jit/RegisterSets.h index 0ccdf7065004..2381aaad5967 100644 --- a/js/src/jit/RegisterSets.h +++ b/js/src/jit/RegisterSets.h @@ -77,7 +77,7 @@ struct AnyRegister { gpr().aliased(aliasIdx, &gret); ret = AnyRegister(gret); } - JS_ASSERT_IF(aliasIdx == 0, ret == *this); + MOZ_ASSERT_IF(aliasIdx == 0, ret == *this); return ret; } uint32_t numAliased() const { diff --git a/js/src/jit/RematerializedFrame.h b/js/src/jit/RematerializedFrame.h index 5cf62d357667..783ccf12f071 100644 --- a/js/src/jit/RematerializedFrame.h +++ b/js/src/jit/RematerializedFrame.h @@ -145,7 +145,7 @@ class RematerializedFrame } Value &unaliasedVar(unsigned i, MaybeCheckAliasing checkAliasing = CHECK_ALIASING) { - JS_ASSERT_IF(checkAliasing, !script()->varIsAliased(i)); + MOZ_ASSERT_IF(checkAliasing, !script()->varIsAliased(i)); MOZ_ASSERT(i < script()->nfixed()); return locals()[i]; } @@ -158,14 +158,14 @@ class RematerializedFrame } Value &unaliasedFormal(unsigned i, MaybeCheckAliasing checkAliasing = CHECK_ALIASING) { MOZ_ASSERT(i < numFormalArgs()); - JS_ASSERT_IF(checkAliasing, !script()->argsObjAliasesFormals() && - !script()->formalIsAliased(i)); + MOZ_ASSERT_IF(checkAliasing, !script()->argsObjAliasesFormals() && + !script()->formalIsAliased(i)); return argv()[i]; } Value &unaliasedActual(unsigned i, MaybeCheckAliasing checkAliasing = CHECK_ALIASING) { MOZ_ASSERT(i < numActualArgs()); - JS_ASSERT_IF(checkAliasing, !script()->argsObjAliasesFormals()); - JS_ASSERT_IF(checkAliasing && i < numFormalArgs(), !script()->formalIsAliased(i)); + MOZ_ASSERT_IF(checkAliasing, !script()->argsObjAliasesFormals()); + MOZ_ASSERT_IF(checkAliasing && i < numFormalArgs(), !script()->formalIsAliased(i)); return argv()[i]; } diff --git a/js/src/jit/VMFunctions.cpp b/js/src/jit/VMFunctions.cpp index 67ae2e0df31e..3a5a6cd27025 100644 --- a/js/src/jit/VMFunctions.cpp +++ b/js/src/jit/VMFunctions.cpp @@ -148,7 +148,7 @@ bool CheckOverRecursedWithExtra(JSContext *cx, BaselineFrame *frame, uint32_t extra, uint32_t earlyCheck) { - JS_ASSERT_IF(earlyCheck, !frame->overRecursed()); + MOZ_ASSERT_IF(earlyCheck, !frame->overRecursed()); // See |CheckOverRecursed| above. This is a variant of that function which // accepts an argument holding the extra stack space needed for the Baseline @@ -815,10 +815,10 @@ DebugEpilogue(JSContext *cx, BaselineFrame *frame, jsbytecode *pc, bool ok) ok = ScriptDebugEpilogue(cx, frame, pc, ok); if (frame->isNonEvalFunctionFrame()) { - JS_ASSERT_IF(ok, frame->hasReturnValue()); + MOZ_ASSERT_IF(ok, frame->hasReturnValue()); DebugScopes::onPopCall(frame, cx); } else if (frame->isStrictEvalFrame()) { - JS_ASSERT_IF(frame->hasCallObj(), frame->scopeChain()->as().isForEval()); + MOZ_ASSERT_IF(frame->hasCallObj(), frame->scopeChain()->as().isForEval()); DebugScopes::onPopStrictEvalScope(frame); } @@ -1127,8 +1127,8 @@ AssertValidObjectPtr(JSContext *cx, JSObject *obj) MOZ_ASSERT(obj->compartment() == cx->compartment()); MOZ_ASSERT(obj->runtimeFromMainThread() == cx->runtime()); - JS_ASSERT_IF(!obj->hasLazyType(), - obj->type()->clasp() == obj->lastProperty()->getObjectClass()); + MOZ_ASSERT_IF(!obj->hasLazyType(), + obj->type()->clasp() == obj->lastProperty()->getObjectClass()); if (obj->isTenured()) { MOZ_ASSERT(obj->isAligned()); diff --git a/js/src/jit/VMFunctions.h b/js/src/jit/VMFunctions.h index b9c3d8f7fe6d..ffb504d8d586 100644 --- a/js/src/jit/VMFunctions.h +++ b/js/src/jit/VMFunctions.h @@ -239,8 +239,8 @@ struct VMFunction extraValuesToPop(extraValuesToPop) { // Check for valid failure/return type. - JS_ASSERT_IF(outParam != Type_Void && executionMode == SequentialExecution, - returnType == Type_Bool); + MOZ_ASSERT_IF(outParam != Type_Void && executionMode == SequentialExecution, + returnType == Type_Bool); MOZ_ASSERT(returnType == Type_Bool || returnType == Type_Object); } diff --git a/js/src/jit/arm/Assembler-arm.cpp b/js/src/jit/arm/Assembler-arm.cpp index 5da324ac54e1..f57e4033293b 100644 --- a/js/src/jit/arm/Assembler-arm.cpp +++ b/js/src/jit/arm/Assembler-arm.cpp @@ -2095,8 +2095,8 @@ Assembler::as_vfp_float(VFPRegister vd, VFPRegister vn, VFPRegister vm, VFPOp op, Condition c) { // Make sure we believe that all of our operands are the same kind. - JS_ASSERT_IF(!vn.isMissing(), vd.equiv(vn)); - JS_ASSERT_IF(!vm.isMissing(), vd.equiv(vm)); + MOZ_ASSERT_IF(!vn.isMissing(), vd.equiv(vn)); + MOZ_ASSERT_IF(!vm.isMissing(), vd.equiv(vm)); vfp_size sz = vd.isDouble() ? IsDouble : IsSingle; return writeVFPInst(sz, VD(vd) | VN(vn) | VM(vm) | op | VfpArith | c); } @@ -2510,7 +2510,7 @@ void Assembler::RetargetNearBranch(Instruction *i, int offset, Condition cond, bool final) { // Retargeting calls is totally unsupported! - JS_ASSERT_IF(i->is(), i->is() || i->is()); + MOZ_ASSERT_IF(i->is(), i->is() || i->is()); if (i->is()) new (i) InstBLImm(BOffImm(offset), cond); else diff --git a/js/src/jit/arm/Assembler-arm.h b/js/src/jit/arm/Assembler-arm.h index bda94f7c41f7..dd6165b003c4 100644 --- a/js/src/jit/arm/Assembler-arm.h +++ b/js/src/jit/arm/Assembler-arm.h @@ -1690,7 +1690,7 @@ class Assembler : public AssemblerShared int len = high - low + 1; // vdtm can only transfer 16 registers at once. If we need to transfer more, // then either hoops are necessary, or we need to be updating the register. - JS_ASSERT_IF(len > 16, dtmUpdate == WriteBack); + MOZ_ASSERT_IF(len > 16, dtmUpdate == WriteBack); int adjustLow = dtmLoadStore == IsStore ? 0 : 1; int adjustHigh = dtmLoadStore == IsStore ? -1 : 0; diff --git a/js/src/jit/arm/CodeGenerator-arm.cpp b/js/src/jit/arm/CodeGenerator-arm.cpp index 692e3e6ec808..a649983ccc27 100644 --- a/js/src/jit/arm/CodeGenerator-arm.cpp +++ b/js/src/jit/arm/CodeGenerator-arm.cpp @@ -168,8 +168,8 @@ CodeGeneratorARM::bailoutIf(Assembler::Condition condition, LSnapshot *snapshot) // Though the assembler doesn't track all frame pushes, at least make sure // the known value makes sense. We can't use bailout tables if the stack // isn't properly aligned to the static frame size. - JS_ASSERT_IF(frameClass_ != FrameSizeClass::None(), - frameClass_.frameSize() == masm.framePushed()); + MOZ_ASSERT_IF(frameClass_ != FrameSizeClass::None(), + frameClass_.frameSize() == masm.framePushed()); if (assignBailoutId(snapshot)) { uint8_t *code = Assembler::BailoutTableStart(deoptTable_->raw()) + snapshot->bailoutId() * BAILOUT_TABLE_ENTRY_SIZE; @@ -206,8 +206,8 @@ CodeGeneratorARM::bailoutFrom(Label *label, LSnapshot *snapshot) // Though the assembler doesn't track all frame pushes, at least make sure // the known value makes sense. We can't use bailout tables if the stack // isn't properly aligned to the static frame size. - JS_ASSERT_IF(frameClass_ != FrameSizeClass::None(), - frameClass_.frameSize() == masm.framePushed()); + MOZ_ASSERT_IF(frameClass_ != FrameSizeClass::None(), + frameClass_.frameSize() == masm.framePushed()); // On ARM we don't use a bailout table. InlineScriptTree *tree = snapshot->mir()->block()->trackedTree(); @@ -417,7 +417,7 @@ CodeGeneratorARM::visitMulI(LMulI *ins) const LAllocation *rhs = ins->getOperand(1); const LDefinition *dest = ins->getDef(0); MMul *mul = ins->mir(); - JS_ASSERT_IF(mul->mode() == MMul::Integer, !mul->canBeNegativeZero() && !mul->canOverflow()); + MOZ_ASSERT_IF(mul->mode() == MMul::Integer, !mul->canBeNegativeZero() && !mul->canOverflow()); if (rhs->isConstant()) { // Bailout when this condition is met. @@ -2114,8 +2114,8 @@ CodeGeneratorARM::visitSoftUDivOrMod(LSoftUDivOrMod *ins) MOZ_ASSERT(lhs == r0); MOZ_ASSERT(rhs == r1); MOZ_ASSERT(ins->mirRaw()->isDiv() || ins->mirRaw()->isMod()); - JS_ASSERT_IF(ins->mirRaw()->isDiv(), output == r0); - JS_ASSERT_IF(ins->mirRaw()->isMod(), output == r1); + MOZ_ASSERT_IF(ins->mirRaw()->isDiv(), output == r0); + MOZ_ASSERT_IF(ins->mirRaw()->isMod(), output == r1); Label afterDiv; diff --git a/js/src/jit/arm/Simulator-arm.cpp b/js/src/jit/arm/Simulator-arm.cpp index 44424b1e9b00..76df14485024 100644 --- a/js/src/jit/arm/Simulator-arm.cpp +++ b/js/src/jit/arm/Simulator-arm.cpp @@ -1205,7 +1205,7 @@ class Redirection SimulatorRuntime *srt = pt->simulatorRuntime(); AutoLockSimulatorRuntime alsr(srt); - JS_ASSERT_IF(pt->simulator(), pt->simulator()->srt_ == srt); + MOZ_ASSERT_IF(pt->simulator(), pt->simulator()->srt_ == srt); Redirection *current = srt->redirection(); for (; current != nullptr; current = current->next_) { diff --git a/js/src/jit/mips/Simulator-mips.cpp b/js/src/jit/mips/Simulator-mips.cpp index a35a27fca7bd..75c034421692 100644 --- a/js/src/jit/mips/Simulator-mips.cpp +++ b/js/src/jit/mips/Simulator-mips.cpp @@ -1371,7 +1371,7 @@ class Redirection SimulatorRuntime *srt = pt->simulatorRuntime(); AutoLockSimulatorRuntime alsr(srt); - JS_ASSERT_IF(pt->simulator(), pt->simulator()->srt_ == srt); + MOZ_ASSERT_IF(pt->simulator(), pt->simulator()->srt_ == srt); Redirection *current = srt->redirection(); for (; current != nullptr; current = current->next_) { diff --git a/js/src/jit/shared/Assembler-shared.h b/js/src/jit/shared/Assembler-shared.h index 577e1da53f38..8657958f3e8b 100644 --- a/js/src/jit/shared/Assembler-shared.h +++ b/js/src/jit/shared/Assembler-shared.h @@ -206,7 +206,7 @@ struct ImmGCPtr explicit ImmGCPtr(const gc::Cell *ptr) : value(ptr) { MOZ_ASSERT(!IsPoisonedPtr(ptr)); - JS_ASSERT_IF(ptr, ptr->isTenured()); + MOZ_ASSERT_IF(ptr, ptr->isTenured()); // asm.js shouldn't be creating GC things MOZ_ASSERT(!IsCompilingAsmJS()); diff --git a/js/src/jit/shared/CodeGenerator-shared.cpp b/js/src/jit/shared/CodeGenerator-shared.cpp index a1694d67cd99..87c2103907bc 100644 --- a/js/src/jit/shared/CodeGenerator-shared.cpp +++ b/js/src/jit/shared/CodeGenerator-shared.cpp @@ -149,7 +149,7 @@ CodeGeneratorShared::addOutOfLineCode(OutOfLineCode *code, const BytecodeSite &s { code->setFramePushed(masm.framePushed()); code->setBytecodeSite(site); - JS_ASSERT_IF(!gen->compilingAsmJS(), code->script()->containsPC(code->pc())); + MOZ_ASSERT_IF(!gen->compilingAsmJS(), code->script()->containsPC(code->pc())); return outOfLineCode_.append(code); } @@ -167,7 +167,7 @@ CodeGeneratorShared::addNativeToBytecodeEntry(const BytecodeSite &site) jsbytecode *pc = site.pc(); uint32_t nativeOffset = masm.currentOffset(); - JS_ASSERT_IF(nativeToBytecodeList_.empty(), nativeOffset == 0); + MOZ_ASSERT_IF(nativeToBytecodeList_.empty(), nativeOffset == 0); if (!nativeToBytecodeList_.empty()) { size_t lastIdx = nativeToBytecodeList_.length() - 1; @@ -670,7 +670,7 @@ CodeGeneratorShared::verifyCompactNativeToBytecodeMap(JitCode *code) // Back-offset must point to a later area in the payload region than previous // back-offset. This means that back-offsets decrease monotonically. - JS_ASSERT_IF(i > 0, ionTable->regionOffset(i) < ionTable->regionOffset(i - 1)); + MOZ_ASSERT_IF(i > 0, ionTable->regionOffset(i) < ionTable->regionOffset(i - 1)); JitcodeRegionEntry entry = ionTable->regionEntry(i); @@ -731,8 +731,8 @@ CodeGeneratorShared::markSafepoint(LInstruction *ins) bool CodeGeneratorShared::markSafepointAt(uint32_t offset, LInstruction *ins) { - JS_ASSERT_IF(!safepointIndices_.empty(), - offset - safepointIndices_.back().displacement() >= sizeof(uint32_t)); + MOZ_ASSERT_IF(!safepointIndices_.empty(), + offset - safepointIndices_.back().displacement() >= sizeof(uint32_t)); return safepointIndices_.append(SafepointIndex(offset, ins->safepoint())); } @@ -996,13 +996,13 @@ CodeGeneratorShared::callVM(const VMFunction &fun, LInstruction *ins, const Regi // If we're calling a function with an out parameter type of double, make // sure we have an FPU. - JS_ASSERT_IF(fun.outParam == Type_Double, GetIonContext()->runtime->jitSupportsFloatingPoint()); + MOZ_ASSERT_IF(fun.outParam == Type_Double, GetIonContext()->runtime->jitSupportsFloatingPoint()); #ifdef DEBUG if (ins->mirRaw()) { MOZ_ASSERT(ins->mirRaw()->isInstruction()); MInstruction *mir = ins->mirRaw()->toInstruction(); - JS_ASSERT_IF(mir->needsResumePoint(), mir->resumePoint()); + MOZ_ASSERT_IF(mir->needsResumePoint(), mir->resumePoint()); } #endif diff --git a/js/src/jit/shared/CodeGenerator-x86-shared.cpp b/js/src/jit/shared/CodeGenerator-x86-shared.cpp index 48b1ee927130..6e2406b687c8 100644 --- a/js/src/jit/shared/CodeGenerator-x86-shared.cpp +++ b/js/src/jit/shared/CodeGenerator-x86-shared.cpp @@ -420,8 +420,8 @@ CodeGeneratorX86Shared::bailout(const T &binder, LSnapshot *snapshot) // Though the assembler doesn't track all frame pushes, at least make sure // the known value makes sense. We can't use bailout tables if the stack // isn't properly aligned to the static frame size. - JS_ASSERT_IF(frameClass_ != FrameSizeClass::None() && deoptTable_, - frameClass_.frameSize() == masm.framePushed()); + MOZ_ASSERT_IF(frameClass_ != FrameSizeClass::None() && deoptTable_, + frameClass_.frameSize() == masm.framePushed()); #ifdef JS_CODEGEN_X86 // On x64, bailout tables are pointless, because 16 extra bytes are @@ -760,7 +760,7 @@ CodeGeneratorX86Shared::visitOutOfLineUndoALUOperation(OutOfLineUndoALUOperation LAllocation *rhs = ins->getOperand(1); MOZ_ASSERT(reg == ToRegister(lhs)); - JS_ASSERT_IF(rhs->isGeneralReg(), reg != ToRegister(rhs)); + MOZ_ASSERT_IF(rhs->isGeneralReg(), reg != ToRegister(rhs)); // Undo the effect of the ALU operation, which was performed on the output // register and overflowed. Writing to the output register clobbered an @@ -807,7 +807,7 @@ CodeGeneratorX86Shared::visitMulI(LMulI *ins) const LAllocation *lhs = ins->lhs(); const LAllocation *rhs = ins->rhs(); MMul *mul = ins->mir(); - JS_ASSERT_IF(mul->mode() == MMul::Integer, !mul->canBeNegativeZero() && !mul->canOverflow()); + MOZ_ASSERT_IF(mul->mode() == MMul::Integer, !mul->canBeNegativeZero() && !mul->canOverflow()); if (rhs->isConstant()) { // Bailout on -0.0 @@ -901,9 +901,9 @@ CodeGeneratorX86Shared::visitUDivOrMod(LUDivOrMod *ins) Register rhs = ToRegister(ins->rhs()); Register output = ToRegister(ins->output()); - JS_ASSERT_IF(lhs != rhs, rhs != eax); + MOZ_ASSERT_IF(lhs != rhs, rhs != eax); MOZ_ASSERT(rhs != edx); - JS_ASSERT_IF(output == eax, ToRegister(ins->remainder()) == edx); + MOZ_ASSERT_IF(output == eax, ToRegister(ins->remainder()) == edx); ReturnZero *ool = nullptr; @@ -960,7 +960,7 @@ CodeGeneratorX86Shared::visitMulNegativeZeroCheck(MulNegativeZeroCheck *ool) Register result = ToRegister(ins->output()); Operand lhsCopy = ToOperand(ins->lhsCopy()); Operand rhs = ToOperand(ins->rhs()); - JS_ASSERT_IF(lhsCopy.kind() == Operand::REG, lhsCopy.reg() != result.code()); + MOZ_ASSERT_IF(lhsCopy.kind() == Operand::REG, lhsCopy.reg() != result.code()); // Result is -0 if lhs or rhs is negative. masm.movl(lhsCopy, result); @@ -1119,7 +1119,7 @@ CodeGeneratorX86Shared::visitDivI(LDivI *ins) MDiv *mir = ins->mir(); - JS_ASSERT_IF(lhs != rhs, rhs != eax); + MOZ_ASSERT_IF(lhs != rhs, rhs != eax); MOZ_ASSERT(rhs != edx); MOZ_ASSERT(remainder == edx); MOZ_ASSERT(output == eax); @@ -1292,7 +1292,7 @@ CodeGeneratorX86Shared::visitModI(LModI *ins) Register rhs = ToRegister(ins->rhs()); // Required to use idiv. - JS_ASSERT_IF(lhs != rhs, rhs != eax); + MOZ_ASSERT_IF(lhs != rhs, rhs != eax); MOZ_ASSERT(rhs != edx); MOZ_ASSERT(remainder == edx); MOZ_ASSERT(ToRegister(ins->getTemp(0)) == eax); diff --git a/js/src/jit/shared/MacroAssembler-x86-shared.cpp b/js/src/jit/shared/MacroAssembler-x86-shared.cpp index debae6be6124..820ff61708c3 100644 --- a/js/src/jit/shared/MacroAssembler-x86-shared.cpp +++ b/js/src/jit/shared/MacroAssembler-x86-shared.cpp @@ -16,7 +16,7 @@ void MacroAssembler::PushRegsInMask(RegisterSet set, FloatRegisterSet simdSet) { FloatRegisterSet doubleSet(FloatRegisterSet::Subtract(set.fpus(), simdSet)); - JS_ASSERT_IF(simdSet.empty(), doubleSet == set.fpus()); + MOZ_ASSERT_IF(simdSet.empty(), doubleSet == set.fpus()); unsigned numSimd = simdSet.size(); unsigned numDouble = doubleSet.size(); int32_t diffF = numDouble * sizeof(double) + numSimd * Simd128DataSize; @@ -51,7 +51,7 @@ void MacroAssembler::PopRegsInMaskIgnore(RegisterSet set, RegisterSet ignore, FloatRegisterSet simdSet) { FloatRegisterSet doubleSet(FloatRegisterSet::Subtract(set.fpus(), simdSet)); - JS_ASSERT_IF(simdSet.empty(), doubleSet == set.fpus()); + MOZ_ASSERT_IF(simdSet.empty(), doubleSet == set.fpus()); unsigned numSimd = simdSet.size(); unsigned numDouble = doubleSet.size(); int32_t diffG = set.gprs().size() * sizeof(intptr_t); diff --git a/js/src/jit/x64/Assembler-x64.cpp b/js/src/jit/x64/Assembler-x64.cpp index 53a4cf9e0e70..ed957b82a858 100644 --- a/js/src/jit/x64/Assembler-x64.cpp +++ b/js/src/jit/x64/Assembler-x64.cpp @@ -181,7 +181,7 @@ Assembler::finish() // Now that we know the offset to the jump table, squirrel it into the // jump relocation buffer if any JitCode references exist and must be // tracked for GC. - JS_ASSERT_IF(jumpRelocations_.length(), jumpRelocations_.length() >= sizeof(uint32_t)); + MOZ_ASSERT_IF(jumpRelocations_.length(), jumpRelocations_.length() >= sizeof(uint32_t)); if (jumpRelocations_.length()) *(uint32_t *)jumpRelocations_.buffer() = extendedJumpTable_; diff --git a/js/src/jit/x86/CodeGenerator-x86.cpp b/js/src/jit/x86/CodeGenerator-x86.cpp index c6778289ba52..9be426bdb782 100644 --- a/js/src/jit/x86/CodeGenerator-x86.cpp +++ b/js/src/jit/x86/CodeGenerator-x86.cpp @@ -301,7 +301,7 @@ CodeGeneratorX86::visitLoadTypedArrayElementStatic(LLoadTypedArrayElementStatic { const MLoadTypedArrayElementStatic *mir = ins->mir(); Scalar::Type vt = mir->viewType(); - JS_ASSERT_IF(vt == Scalar::Float32, mir->type() == MIRType_Float32); + MOZ_ASSERT_IF(vt == Scalar::Float32, mir->type() == MIRType_Float32); Register ptr = ToRegister(ins->ptr()); const LDefinition *out = ins->output(); diff --git a/js/src/jsapi.cpp b/js/src/jsapi.cpp index 7500cecd8fc3..e186e24ea363 100644 --- a/js/src/jsapi.cpp +++ b/js/src/jsapi.cpp @@ -202,7 +202,7 @@ AssertHeapIsIdleOrStringIsFlat(JSContext *cx, JSString *str) * We allow some functions to be called during a GC as long as the argument * is a flat string, since that will not cause allocation. */ - JS_ASSERT_IF(cx->runtime()->isHeapBusy(), str->isFlat()); + MOZ_ASSERT_IF(cx->runtime()->isHeapBusy(), str->isFlat()); } JS_PUBLIC_API(bool) @@ -624,7 +624,7 @@ JS_NewRuntime(uint32_t maxbytes, uint32_t maxNurseryBytes, JSRuntime *parentRunt // isn't required for correctness, but ensuring that the parent // runtime is not destroyed before this one is more easily done // for the main runtime in the process. - JS_ASSERT_IF(parentRuntime, !parentRuntime->parentRuntime); + MOZ_ASSERT_IF(parentRuntime, !parentRuntime->parentRuntime); JSRuntime *rt = js_new(parentRuntime); if (!rt) @@ -2065,12 +2065,12 @@ JS_SetNativeStackQuota(JSRuntime *rt, size_t systemCodeStackSize, size_t trustedScriptStackSize, size_t untrustedScriptStackSize) { - JS_ASSERT_IF(trustedScriptStackSize, - trustedScriptStackSize < systemCodeStackSize); + MOZ_ASSERT_IF(trustedScriptStackSize, + trustedScriptStackSize < systemCodeStackSize); if (!trustedScriptStackSize) trustedScriptStackSize = systemCodeStackSize; - JS_ASSERT_IF(untrustedScriptStackSize, - untrustedScriptStackSize < trustedScriptStackSize); + MOZ_ASSERT_IF(untrustedScriptStackSize, + untrustedScriptStackSize < trustedScriptStackSize); if (!untrustedScriptStackSize) untrustedScriptStackSize = trustedScriptStackSize; SetNativeStackQuota(rt, StackForSystemCode, systemCodeStackSize); @@ -2484,7 +2484,7 @@ JS_NewObject(JSContext *cx, const JSClass *jsclasp, HandleObject proto, HandleOb MOZ_ASSERT(!(clasp->flags & JSCLASS_IS_GLOBAL)); JSObject *obj = NewObjectWithClassProto(cx, clasp, proto, parent); - JS_ASSERT_IF(obj, obj->getParent()); + MOZ_ASSERT_IF(obj, obj->getParent()); return obj; } @@ -3269,7 +3269,7 @@ JS_DefineProperties(JSContext *cx, HandleObject obj, const JSPropertySpec *ps) // If you do not have a self-hosted getter, you should not have a // self-hosted setter. This is the closest approximation to that // assertion we can have with our setup. - JS_ASSERT_IF(ps->setter.propertyOp.info, ps->setter.propertyOp.op); + MOZ_ASSERT_IF(ps->setter.propertyOp.info, ps->setter.propertyOp.op); ok = DefineProperty(cx, obj, ps->name, JS::UndefinedHandleValue, ps->getter.propertyOp, ps->setter.propertyOp, ps->flags, 0); @@ -5162,7 +5162,7 @@ INTERNED_STRING_TO_JSID(JSContext *cx, JSString *str) { MOZ_ASSERT(str); MOZ_ASSERT(((size_t)str & JSID_TYPE_MASK) == 0); - JS_ASSERT_IF(cx, JS_StringHasBeenInterned(cx, str)); + MOZ_ASSERT_IF(cx, JS_StringHasBeenInterned(cx, str)); return AtomToId(&str->asAtom()); } @@ -5172,7 +5172,7 @@ JS_InternJSString(JSContext *cx, HandleString str) AssertHeapIsIdle(cx); CHECK_REQUEST(cx); JSAtom *atom = AtomizeString(cx, str, InternAtom); - JS_ASSERT_IF(atom, JS_StringHasBeenInterned(cx, atom)); + MOZ_ASSERT_IF(atom, JS_StringHasBeenInterned(cx, atom)); return atom; } @@ -5188,7 +5188,7 @@ JS_InternStringN(JSContext *cx, const char *s, size_t length) AssertHeapIsIdle(cx); CHECK_REQUEST(cx); JSAtom *atom = Atomize(cx, s, length, InternAtom); - JS_ASSERT_IF(atom, JS_StringHasBeenInterned(cx, atom)); + MOZ_ASSERT_IF(atom, JS_StringHasBeenInterned(cx, atom)); return atom; } @@ -5226,7 +5226,7 @@ JS_InternUCStringN(JSContext *cx, const char16_t *s, size_t length) AssertHeapIsIdle(cx); CHECK_REQUEST(cx); JSAtom *atom = AtomizeChars(cx, s, length, InternAtom); - JS_ASSERT_IF(atom, JS_StringHasBeenInterned(cx, atom)); + MOZ_ASSERT_IF(atom, JS_StringHasBeenInterned(cx, atom)); return atom; } diff --git a/js/src/jsarray.cpp b/js/src/jsarray.cpp index 5432342820d5..ee5e54116811 100644 --- a/js/src/jsarray.cpp +++ b/js/src/jsarray.cpp @@ -1292,7 +1292,7 @@ InitArrayElements(JSContext *cx, HandleObject obj, uint32_t start, uint32_t coun MOZ_ASSERT(count < UINT32_MAX / sizeof(Value)); arr->copyDenseElements(start, vector, count); - JS_ASSERT_IF(count != 0, !arr->getDenseElement(newlen - 1).isMagic(JS_ELEMENTS_HOLE)); + MOZ_ASSERT_IF(count != 0, !arr->getDenseElement(newlen - 1).isMagic(JS_ELEMENTS_HOLE)); return true; } while (false); @@ -3175,7 +3175,7 @@ EnsureNewArrayElements(ExclusiveContext *cx, JSObject *obj, uint32_t length) if (!obj->ensureElements(cx, length)) return false; - JS_ASSERT_IF(cap, !obj->hasDynamicElements()); + MOZ_ASSERT_IF(cap, !obj->hasDynamicElements()); return true; } diff --git a/js/src/jsatom.cpp b/js/src/jsatom.cpp index 50baad4b1506..c06e5c1e752b 100644 --- a/js/src/jsatom.cpp +++ b/js/src/jsatom.cpp @@ -257,7 +257,7 @@ JSRuntime::sweepAtoms() bool isDying = IsStringAboutToBeFinalized(&atom); /* Pinned or interned key cannot be finalized. */ - JS_ASSERT_IF(hasContexts() && entry.isTagged(), !isDying); + MOZ_ASSERT_IF(hasContexts() && entry.isTagged(), !isDying); if (isDying) e.removeFront(); diff --git a/js/src/jscntxt.h b/js/src/jscntxt.h index 27148fd20340..afd0425f90f0 100644 --- a/js/src/jscntxt.h +++ b/js/src/jscntxt.h @@ -363,13 +363,13 @@ class ExclusiveContext : public ThreadSafeContext // Threads with an ExclusiveContext may freely access any data in their // compartment and zone. JSCompartment *compartment() const { - JS_ASSERT_IF(runtime_->isAtomsCompartment(compartment_), - runtime_->currentThreadHasExclusiveAccess()); + MOZ_ASSERT_IF(runtime_->isAtomsCompartment(compartment_), + runtime_->currentThreadHasExclusiveAccess()); return compartment_; } JS::Zone *zone() const { - JS_ASSERT_IF(!compartment(), !zone_); - JS_ASSERT_IF(compartment(), js::GetCompartmentZone(compartment()) == zone_); + MOZ_ASSERT_IF(!compartment(), !zone_); + MOZ_ASSERT_IF(compartment(), js::GetCompartmentZone(compartment()) == zone_); return zone_; } @@ -970,7 +970,7 @@ class AutoAssertNoException ~AutoAssertNoException() { - JS_ASSERT_IF(!hadException, !cx->isExceptionPending()); + MOZ_ASSERT_IF(!hadException, !cx->isExceptionPending()); } }; diff --git a/js/src/jscntxtinlines.h b/js/src/jscntxtinlines.h index 8b89aacc9309..1e5e4a98dbfd 100644 --- a/js/src/jscntxtinlines.h +++ b/js/src/jscntxtinlines.h @@ -39,7 +39,7 @@ class CompartmentChecker JSContext *activeContext = nullptr; if (cx->isJSContext()) activeContext = cx->asJSContext()->runtime()->activeContext; - JS_ASSERT_IF(activeContext, cx == activeContext); + MOZ_ASSERT_IF(activeContext, cx == activeContext); #endif } @@ -231,7 +231,7 @@ CallJSNative(JSContext *cx, Native native, const CallArgs &args) bool ok = native(cx, args.length(), args.base()); if (ok) { assertSameCompartment(cx, args.rval()); - JS_ASSERT_IF(!alreadyThrowing, !cx->isExceptionPending()); + MOZ_ASSERT_IF(!alreadyThrowing, !cx->isExceptionPending()); } return ok; } @@ -247,7 +247,7 @@ CallNativeImpl(JSContext *cx, NativeImpl impl, const CallArgs &args) bool ok = impl(cx, args); if (ok) { assertSameCompartment(cx, args.rval()); - JS_ASSERT_IF(!alreadyThrowing, !cx->isExceptionPending()); + MOZ_ASSERT_IF(!alreadyThrowing, !cx->isExceptionPending()); } return ok; } @@ -284,11 +284,11 @@ CallJSNativeConstructor(JSContext *cx, Native native, const CallArgs &args) * * - (new Object(Object)) returns the callee. */ - JS_ASSERT_IF(native != js::proxy_Construct && - native != js::CallOrConstructBoundFunction && - native != js::IteratorConstructor && - (!callee->is() || callee->as().native() != obj_construct), - args.rval().isObject() && callee != &args.rval().toObject()); + MOZ_ASSERT_IF(native != js::proxy_Construct && + native != js::CallOrConstructBoundFunction && + native != js::IteratorConstructor && + (!callee->is() || callee->as().native() != obj_construct), + args.rval().isObject() && callee != &args.rval().toObject()); return true; } @@ -371,7 +371,7 @@ JSContext::setPendingException(js::Value v) this->unwrappedException_ = v; // We don't use assertSameCompartment here to allow // js::SetPendingExceptionCrossContext to work. - JS_ASSERT_IF(v.isObject(), v.toObject().compartment() == compartment()); + MOZ_ASSERT_IF(v.isObject(), v.toObject().compartment() == compartment()); } inline bool @@ -413,25 +413,25 @@ inline void js::ExclusiveContext::setCompartment(JSCompartment *comp) { // ExclusiveContexts can only be in the atoms zone or in exclusive zones. - JS_ASSERT_IF(!isJSContext() && !runtime_->isAtomsCompartment(comp), - comp->zone()->usedByExclusiveThread); + MOZ_ASSERT_IF(!isJSContext() && !runtime_->isAtomsCompartment(comp), + comp->zone()->usedByExclusiveThread); // Normal JSContexts cannot enter exclusive zones. - JS_ASSERT_IF(isJSContext() && comp, - !comp->zone()->usedByExclusiveThread); + MOZ_ASSERT_IF(isJSContext() && comp, + !comp->zone()->usedByExclusiveThread); // Only one thread can be in the atoms compartment at a time. - JS_ASSERT_IF(runtime_->isAtomsCompartment(comp), - runtime_->currentThreadHasExclusiveAccess()); + MOZ_ASSERT_IF(runtime_->isAtomsCompartment(comp), + runtime_->currentThreadHasExclusiveAccess()); // Make sure that the atoms compartment has its own zone. - JS_ASSERT_IF(comp && !runtime_->isAtomsCompartment(comp), - !runtime_->isAtomsZone(comp->zone())); + MOZ_ASSERT_IF(comp && !runtime_->isAtomsCompartment(comp), + !runtime_->isAtomsZone(comp->zone())); // Both the current and the new compartment should be properly marked as // entered at this point. - JS_ASSERT_IF(compartment_, compartment_->hasBeenEntered()); - JS_ASSERT_IF(comp, comp->hasBeenEntered()); + MOZ_ASSERT_IF(compartment_, compartment_->hasBeenEntered()); + MOZ_ASSERT_IF(comp, comp->hasBeenEntered()); compartment_ = comp; zone_ = comp ? comp->zone() : nullptr; diff --git a/js/src/jscompartment.cpp b/js/src/jscompartment.cpp index c7df853ef88d..66446ae7d5ad 100644 --- a/js/src/jscompartment.cpp +++ b/js/src/jscompartment.cpp @@ -73,7 +73,7 @@ JSCompartment::JSCompartment(Zone *zone, const JS::CompartmentOptions &options = jitCompartment_(nullptr) { runtime_->numCompartments++; - JS_ASSERT_IF(options.mergeable(), options.invisibleToDebugger()); + MOZ_ASSERT_IF(options.mergeable(), options.invisibleToDebugger()); } JSCompartment::~JSCompartment() @@ -243,8 +243,8 @@ JSCompartment::putWrapper(JSContext *cx, const CrossCompartmentKey &wrapped, con MOZ_ASSERT(!IsPoisonedPtr(wrapped.wrapped)); MOZ_ASSERT(!IsPoisonedPtr(wrapped.debugger)); MOZ_ASSERT(!IsPoisonedPtr(wrapper.toGCThing())); - JS_ASSERT_IF(wrapped.kind == CrossCompartmentKey::StringWrapper, wrapper.isString()); - JS_ASSERT_IF(wrapped.kind != CrossCompartmentKey::StringWrapper, wrapper.isObject()); + MOZ_ASSERT_IF(wrapped.kind == CrossCompartmentKey::StringWrapper, wrapper.isString()); + MOZ_ASSERT_IF(wrapped.kind != CrossCompartmentKey::StringWrapper, wrapper.isObject()); bool success = crossCompartmentWrappers.put(wrapped, ReadBarriered(wrapper)); #ifdef JSGC_GENERATIONAL @@ -348,8 +348,8 @@ JSCompartment::wrap(JSContext *cx, MutableHandleObject obj, HandleObject existin { MOZ_ASSERT(!cx->runtime()->isAtomsCompartment(this)); MOZ_ASSERT(cx->compartment() == this); - JS_ASSERT_IF(existingArg, existingArg->compartment() == cx->compartment()); - JS_ASSERT_IF(existingArg, IsDeadProxyObject(existingArg)); + MOZ_ASSERT_IF(existingArg, existingArg->compartment() == cx->compartment()); + MOZ_ASSERT_IF(existingArg, IsDeadProxyObject(existingArg)); if (!obj) return true; @@ -720,7 +720,7 @@ JSCompartment::clearTables() // merging a compartment that has been used off thread into another // compartment and zone. MOZ_ASSERT(crossCompartmentWrappers.empty()); - JS_ASSERT_IF(callsiteClones.initialized(), callsiteClones.empty()); + MOZ_ASSERT_IF(callsiteClones.initialized(), callsiteClones.empty()); MOZ_ASSERT(!jitCompartment_); MOZ_ASSERT(!debugScopes); MOZ_ASSERT(!gcWeakMapList); diff --git a/js/src/jscompartmentinlines.h b/js/src/jscompartmentinlines.h index 036e00726934..b259df210928 100644 --- a/js/src/jscompartmentinlines.h +++ b/js/src/jscompartmentinlines.h @@ -24,7 +24,7 @@ JSCompartment::initGlobal(js::GlobalObject &global) js::GlobalObject * JSCompartment::maybeGlobal() const { - JS_ASSERT_IF(global_, global_->compartment() == this); + MOZ_ASSERT_IF(global_, global_->compartment() == this); return global_; } @@ -56,7 +56,7 @@ js::AutoCompartment::~AutoCompartment() inline bool JSCompartment::wrap(JSContext *cx, JS::MutableHandleValue vp, JS::HandleObject existing) { - JS_ASSERT_IF(existing, vp.isObject()); + MOZ_ASSERT_IF(existing, vp.isObject()); /* Only GC things have to be wrapped or copied. */ if (!vp.isMarkable()) @@ -117,7 +117,7 @@ JSCompartment::wrap(JSContext *cx, JS::MutableHandleValue vp, JS::HandleObject e if (!wrap(cx, &obj, existing)) return false; vp.setObject(*obj); - JS_ASSERT_IF(cacheResult, obj == cacheResult); + MOZ_ASSERT_IF(cacheResult, obj == cacheResult); return true; } diff --git a/js/src/jsdate.cpp b/js/src/jsdate.cpp index 6e26beb1d765..e9e18914aad8 100644 --- a/js/src/jsdate.cpp +++ b/js/src/jsdate.cpp @@ -184,7 +184,7 @@ DaysInFebruary(double year) static inline double DayWithinYear(double t, double year) { - JS_ASSERT_IF(IsFinite(t), YearFromTime(t) == year); + MOZ_ASSERT_IF(IsFinite(t), YearFromTime(t) == year); return Day(t) - DayFromYear(year); } diff --git a/js/src/jsfun.cpp b/js/src/jsfun.cpp index bdca702b5ab1..c971f05a393a 100644 --- a/js/src/jsfun.cpp +++ b/js/src/jsfun.cpp @@ -567,9 +567,9 @@ js::XDRInterpretedFunction(XDRState *xdr, HandleObject enclosingScope, Han // The environment of any function which is not reused will always be // null, it is later defined when a function is cloned or reused to // mirror the scope chain. - JS_ASSERT_IF(fun->hasSingletonType() && - !((lazy && lazy->hasBeenCloned()) || (script && script->hasBeenCloned())), - fun->environment() == nullptr); + MOZ_ASSERT_IF(fun->hasSingletonType() && + !((lazy && lazy->hasBeenCloned()) || (script && script->hasBeenCloned())), + fun->environment() == nullptr); } if (!xdr->codeUint32(&firstword)) @@ -955,7 +955,7 @@ js::FindBody(JSContext *cx, HandleFunction fun, HandleLinearString src, size_t * if (tt == TOK_ERROR) return false; bool braced = tt == TOK_LC; - JS_ASSERT_IF(fun->isExprClosure(), !braced); + MOZ_ASSERT_IF(fun->isExprClosure(), !braced); *bodyStart = ts.currentToken().pos.begin; if (braced) *bodyStart += 1; @@ -1037,10 +1037,10 @@ js::FunctionToString(JSContext *cx, HandleFunction fun, bool bodyOnly, bool lamb // Functions created with the constructor can't be arrow functions or // expression closures. - JS_ASSERT_IF(funCon, !fun->isArrow()); - JS_ASSERT_IF(funCon, !exprBody); - JS_ASSERT_IF(!funCon && !fun->isArrow(), - src->length() > 0 && src->latin1OrTwoByteChar(0) == '('); + MOZ_ASSERT_IF(funCon, !fun->isArrow()); + MOZ_ASSERT_IF(funCon, !exprBody); + MOZ_ASSERT_IF(!funCon && !fun->isArrow(), + src->length() > 0 && src->latin1OrTwoByteChar(0) == '('); // If a function inherits strict mode by having scopes above it that // have "use strict", we insert "use strict" into the body of the @@ -1949,7 +1949,7 @@ js::NewFunctionWithProto(ExclusiveContext *cx, HandleObject funobjArg, Native na if (funobj) { MOZ_ASSERT(funobj->is()); MOZ_ASSERT(funobj->getParent() == parent); - JS_ASSERT_IF(native, funobj->hasSingletonType()); + MOZ_ASSERT_IF(native, funobj->hasSingletonType()); } else { // Don't give asm.js module functions a singleton type since they // are cloned (via CloneFunctionObjectIfNotSingleton) which assumes diff --git a/js/src/jsfun.h b/js/src/jsfun.h index 76fd256a4dde..af783ede8f6c 100644 --- a/js/src/jsfun.h +++ b/js/src/jsfun.h @@ -461,7 +461,7 @@ class JSFunction : public JSObject public: inline bool isExtended() const { JS_STATIC_ASSERT(FinalizeKind != ExtendedFinalizeKind); - JS_ASSERT_IF(isTenured(), !!(flags() & EXTENDED) == (asTenured()->getAllocKind() == ExtendedFinalizeKind)); + MOZ_ASSERT_IF(isTenured(), !!(flags() & EXTENDED) == (asTenured()->getAllocKind() == ExtendedFinalizeKind)); return !!(flags() & EXTENDED); } @@ -484,7 +484,7 @@ class JSFunction : public JSObject js::gc::AllocKind kind = FinalizeKind; if (isExtended()) kind = ExtendedFinalizeKind; - JS_ASSERT_IF(isTenured(), kind == asTenured()->getAllocKind()); + MOZ_ASSERT_IF(isTenured(), kind == asTenured()->getAllocKind()); return kind; } }; diff --git a/js/src/jsgc.cpp b/js/src/jsgc.cpp index 3cef22b42eca..73edb0c49481 100644 --- a/js/src/jsgc.cpp +++ b/js/src/jsgc.cpp @@ -689,7 +689,7 @@ inline Chunk * ChunkPool::Enum::front() { Chunk *chunk = *chunkp; - JS_ASSERT_IF(chunk, pool.getEmptyCount() != 0); + MOZ_ASSERT_IF(chunk, pool.getEmptyCount() != 0); return chunk; } @@ -740,8 +740,8 @@ GCRuntime::expireChunkPool(bool shrinkBuffers, bool releaseAll) } } MOZ_ASSERT(chunkPool.getEmptyCount() <= tunables.maxEmptyChunkCount()); - JS_ASSERT_IF(shrinkBuffers, chunkPool.getEmptyCount() <= tunables.minEmptyChunkCount()); - JS_ASSERT_IF(releaseAll, chunkPool.getEmptyCount() == 0); + MOZ_ASSERT_IF(shrinkBuffers, chunkPool.getEmptyCount() <= tunables.minEmptyChunkCount()); + MOZ_ASSERT_IF(releaseAll, chunkPool.getEmptyCount() == 0); return freeList; } @@ -2206,8 +2206,8 @@ RelocateCell(Zone *zone, TenuredCell *src, AllocKind thingKind, size_t thingSize if (JSObjectMovedOp op = srcObj->getClass()->ext.objectMovedOp) op(dstObj, srcObj); - JS_ASSERT_IF(dstObj->isNative(), - !PtrIsInRange((const Value*)dstObj->getDenseElements(), src, thingSize)); + MOZ_ASSERT_IF(dstObj->isNative(), + !PtrIsInRange((const Value*)dstObj->getDenseElements(), src, thingSize)); } // Copy the mark bits. @@ -2716,7 +2716,7 @@ template ArenaLists::refillFreeList(ThreadSafeContext *cx, AllocKind thingKind) { MOZ_ASSERT(cx->allocator()->arenas.freeLists[thingKind].isEmpty()); - JS_ASSERT_IF(cx->isJSContext(), !cx->asJSContext()->runtime()->isHeapBusy()); + MOZ_ASSERT_IF(cx->isJSContext(), !cx->asJSContext()->runtime()->isHeapBusy()); Zone *zone = cx->allocator()->zone_; @@ -2724,8 +2724,8 @@ ArenaLists::refillFreeList(ThreadSafeContext *cx, AllocKind thingKind) cx->asJSContext()->runtime()->gc.incrementalState != NO_INCREMENTAL && zone->usage.gcBytes() > zone->threshold.gcTriggerBytes(); - JS_ASSERT_IF(cx->isJSContext() && allowGC, - !cx->asJSContext()->runtime()->currentThreadHasExclusiveAccess()); + MOZ_ASSERT_IF(cx->isJSContext() && allowGC, + !cx->asJSContext()->runtime()->currentThreadHasExclusiveAccess()); for (;;) { if (MOZ_UNLIKELY(runGC)) { @@ -3099,7 +3099,7 @@ GCRuntime::decommitArenasFromAvailableList(Chunk **availableListHeadp) * chunk->info.prevp becomes null when the allocator thread consumed * all chunks from the available list. */ - JS_ASSERT_IF(chunk->info.prevp, *chunk->info.prevp == chunk); + MOZ_ASSERT_IF(chunk->info.prevp, *chunk->info.prevp == chunk); if (chunk->info.prevp == availableListHeadp || !chunk->info.prevp) break; @@ -3472,7 +3472,7 @@ Zone::sweepCompartments(FreeOp *fop, bool keepAtleastOne, bool lastGC) } } compartments.resize(write - compartments.begin()); - JS_ASSERT_IF(keepAtleastOne, !compartments.empty()); + MOZ_ASSERT_IF(keepAtleastOne, !compartments.empty()); } void @@ -4104,14 +4104,14 @@ js::gc::MarkingValidator::validate() * If a non-incremental GC wouldn't have collected a cell, then * an incremental GC won't collect it. */ - JS_ASSERT_IF(bitmap->isMarked(cell, BLACK), incBitmap->isMarked(cell, BLACK)); + MOZ_ASSERT_IF(bitmap->isMarked(cell, BLACK), incBitmap->isMarked(cell, BLACK)); /* * If the cycle collector isn't allowed to collect an object * after a non-incremental GC has run, then it isn't allowed to * collected it after an incremental GC. */ - JS_ASSERT_IF(!bitmap->isMarked(cell, GRAY), !incBitmap->isMarked(cell, GRAY)); + MOZ_ASSERT_IF(!bitmap->isMarked(cell, GRAY), !incBitmap->isMarked(cell, GRAY)); thing += Arena::thingSize(kind); } @@ -4292,7 +4292,7 @@ GCRuntime::findZoneGroups() MOZ_ASSERT(zone->isGCMarking()); } - JS_ASSERT_IF(!isIncremental, !currentZoneGroup->nextGroup()); + MOZ_ASSERT_IF(!isIncremental, !currentZoneGroup->nextGroup()); } static void @@ -4378,8 +4378,8 @@ ProxyObject::grayLinkSlot(JSObject *obj) static void AssertNotOnGrayList(JSObject *obj) { - JS_ASSERT_IF(IsGrayListObject(obj), - obj->getReservedSlot(ProxyObject::grayLinkSlot(obj)).isUndefined()); + MOZ_ASSERT_IF(IsGrayListObject(obj), + obj->getReservedSlot(ProxyObject::grayLinkSlot(obj)).isUndefined()); } #endif @@ -4395,7 +4395,7 @@ NextIncomingCrossCompartmentPointer(JSObject *prev, bool unlink) { unsigned slot = ProxyObject::grayLinkSlot(prev); JSObject *next = prev->getReservedSlot(slot).toObjectOrNull(); - JS_ASSERT_IF(next, IsGrayListObject(next)); + MOZ_ASSERT_IF(next, IsGrayListObject(next)); if (unlink) prev->setSlot(slot, UndefinedValue()); @@ -4450,9 +4450,9 @@ MarkIncomingCrossCompartmentPointers(JSRuntime *rt, const uint32_t color) bool unlinkList = color == GRAY; for (GCCompartmentGroupIter c(rt); !c.done(); c.next()) { - JS_ASSERT_IF(color == GRAY, c->zone()->isGCMarkingGray()); - JS_ASSERT_IF(color == BLACK, c->zone()->isGCMarkingBlack()); - JS_ASSERT_IF(c->gcIncomingGrayPointers, IsGrayListObject(c->gcIncomingGrayPointers)); + MOZ_ASSERT_IF(color == GRAY, c->zone()->isGCMarkingGray()); + MOZ_ASSERT_IF(color == BLACK, c->zone()->isGCMarkingBlack()); + MOZ_ASSERT_IF(c->gcIncomingGrayPointers, IsGrayListObject(c->gcIncomingGrayPointers)); for (JSObject *src = c->gcIncomingGrayPointers; src; @@ -4942,7 +4942,7 @@ GCRuntime::endSweepPhase(bool lastGC) gcstats::AutoPhase ap(stats, gcstats::PHASE_SWEEP); FreeOp fop(rt); - JS_ASSERT_IF(lastGC, !sweepOnBackgroundThread); + MOZ_ASSERT_IF(lastGC, !sweepOnBackgroundThread); /* * Recalculate whether GC was full or not as this may have changed due to @@ -5044,9 +5044,9 @@ GCRuntime::endSweepPhase(bool lastGC) #ifdef DEBUG for (ZonesIter zone(rt, WithAtoms); !zone.done(); zone.next()) { for (unsigned i = 0 ; i < FINALIZE_LIMIT ; ++i) { - JS_ASSERT_IF(!IsBackgroundFinalized(AllocKind(i)) || - !sweepOnBackgroundThread, - !zone->allocator.arenas.arenaListsToSweep[i]); + MOZ_ASSERT_IF(!IsBackgroundFinalized(AllocKind(i)) || + !sweepOnBackgroundThread, + !zone->allocator.arenas.arenaListsToSweep[i]); } } @@ -5119,7 +5119,7 @@ AutoTraceSession::AutoTraceSession(JSRuntime *rt, js::HeapState heapState) MOZ_ASSERT(rt->gc.heapState == Idle); MOZ_ASSERT(heapState != Idle); #ifdef JSGC_GENERATIONAL - JS_ASSERT_IF(heapState == MajorCollecting, rt->gc.nursery.isEmpty()); + MOZ_ASSERT_IF(heapState == MajorCollecting, rt->gc.nursery.isEmpty()); #endif // Threads with an exclusive context can hit refillFreeList while holding @@ -5341,7 +5341,7 @@ GCRuntime::incrementalCollectSlice(int64_t budget, } #endif - JS_ASSERT_IF(incrementalState != NO_INCREMENTAL, isIncremental); + MOZ_ASSERT_IF(incrementalState != NO_INCREMENTAL, isIncremental); isIncremental = budget != SliceBudget::Unlimited; if (zeal == ZealIncrementalRootsThenFinish || zeal == ZealIncrementalMarkAllThenFinish) { @@ -5714,7 +5714,7 @@ GCRuntime::collect(bool incremental, int64_t budget, JSGCInvocationKind gckind, return; #endif - JS_ASSERT_IF(!incremental || budget != SliceBudget::Unlimited, JSGC_INCREMENTAL); + MOZ_ASSERT_IF(!incremental || budget != SliceBudget::Unlimited, JSGC_INCREMENTAL); AutoStopVerifyingBarriers av(rt, reason == JS::gcreason::SHUTDOWN_CC || reason == JS::gcreason::DESTROY_RUNTIME); @@ -5892,7 +5892,7 @@ GCRuntime::minorGC(JS::gcreason::Reason reason) TraceLogger *logger = TraceLoggerForMainThread(rt); AutoTraceLog logMinorGC(logger, TraceLogger::MinorGC); nursery.collect(rt, reason, nullptr); - JS_ASSERT_IF(!rt->mainThread.suppressGC, nursery.isEmpty()); + MOZ_ASSERT_IF(!rt->mainThread.suppressGC, nursery.isEmpty()); #endif } @@ -5910,7 +5910,7 @@ GCRuntime::minorGC(JSContext *cx, JS::gcreason::Reason reason) if (pretenureTypes[i]->canPreTenure()) pretenureTypes[i]->setShouldPreTenure(cx); } - JS_ASSERT_IF(!rt->mainThread.suppressGC, nursery.isEmpty()); + MOZ_ASSERT_IF(!rt->mainThread.suppressGC, nursery.isEmpty()); #endif } @@ -6192,7 +6192,7 @@ js::ReleaseAllJITCode(FreeOp *fop) /* Assert no baseline scripts are marked as active. */ for (ZoneCellIter i(zone, FINALIZE_SCRIPT); !i.done(); i.next()) { JSScript *script = i.get(); - JS_ASSERT_IF(script->hasBaselineScript(), !script->baselineScript()->active()); + MOZ_ASSERT_IF(script->hasBaselineScript(), !script->baselineScript()->active()); } #endif diff --git a/js/src/jsgc.h b/js/src/jsgc.h index 862287985b4c..040c5793c230 100644 --- a/js/src/jsgc.h +++ b/js/src/jsgc.h @@ -312,7 +312,7 @@ struct SortedArenaListSegment // Appends |aheader| to this segment. void append(ArenaHeader *aheader) { MOZ_ASSERT(aheader); - JS_ASSERT_IF(head, head->getAllocKind() == aheader->getAllocKind()); + MOZ_ASSERT_IF(head, head->getAllocKind() == aheader->getAllocKind()); *tailp = aheader; tailp = &aheader->next; } @@ -400,11 +400,11 @@ class ArenaList { void check() const { #ifdef DEBUG // If the list is empty, it must have this form. - JS_ASSERT_IF(!head_, cursorp_ == &head_); + MOZ_ASSERT_IF(!head_, cursorp_ == &head_); // If there's an arena following the cursor, it must not be full. ArenaHeader *cursor = *cursorp_; - JS_ASSERT_IF(cursor, cursor->hasFreeThings()); + MOZ_ASSERT_IF(cursor, cursor->hasFreeThings()); #endif } @@ -1295,9 +1295,9 @@ template inline void CheckGCThingAfterMovingGC(T *t) { - JS_ASSERT_IF(t, !IsInsideNursery(t)); + MOZ_ASSERT_IF(t, !IsInsideNursery(t)); #ifdef JSGC_COMPACTING - JS_ASSERT_IF(t, !IsForwarded(t)); + MOZ_ASSERT_IF(t, !IsForwarded(t)); #endif } diff --git a/js/src/jsgcinlines.h b/js/src/jsgcinlines.h index 18617ac0ce2a..57b4b346e0e2 100644 --- a/js/src/jsgcinlines.h +++ b/js/src/jsgcinlines.h @@ -20,7 +20,7 @@ class Shape; inline Allocator * ThreadSafeContext::allocator() const { - JS_ASSERT_IF(isJSContext(), &asJSContext()->zone()->allocator == allocator_); + MOZ_ASSERT_IF(isJSContext(), &asJSContext()->zone()->allocator == allocator_); return allocator_; } @@ -501,11 +501,11 @@ CheckAllocatorState(ThreadSafeContext *cx, AllocKind kind) JSContext *ncx = cx->asJSContext(); JSRuntime *rt = ncx->runtime(); #if defined(JS_GC_ZEAL) || defined(DEBUG) - JS_ASSERT_IF(rt->isAtomsCompartment(ncx->compartment()), - kind == FINALIZE_STRING || - kind == FINALIZE_FAT_INLINE_STRING || - kind == FINALIZE_SYMBOL || - kind == FINALIZE_JITCODE); + MOZ_ASSERT_IF(rt->isAtomsCompartment(ncx->compartment()), + kind == FINALIZE_STRING || + kind == FINALIZE_FAT_INLINE_STRING || + kind == FINALIZE_SYMBOL || + kind == FINALIZE_JITCODE); MOZ_ASSERT(!rt->isHeapBusy()); MOZ_ASSERT(rt->gc.isAllocAllowed()); #endif @@ -545,8 +545,8 @@ CheckIncrementalZoneState(ThreadSafeContext *cx, T *t) return; Zone *zone = cx->asJSContext()->zone(); - JS_ASSERT_IF(t && zone->wasGCStarted() && (zone->isGCMarking() || zone->isGCSweeping()), - t->asTenured()->arenaHeader()->allocatedDuringIncremental); + MOZ_ASSERT_IF(t && zone->wasGCStarted() && (zone->isGCMarking() || zone->isGCSweeping()), + t->asTenured()->arenaHeader()->allocatedDuringIncremental); #endif } diff --git a/js/src/jsinfer.cpp b/js/src/jsinfer.cpp index f557b4b0bfcc..2ba42ff1f9fb 100644 --- a/js/src/jsinfer.cpp +++ b/js/src/jsinfer.cpp @@ -1199,7 +1199,7 @@ types::FinishCompilation(JSContext *cx, HandleScript script, ExecutionMode execu #ifdef DEBUG for (size_t i = 0; i < types.compilerOutputs->length(); i++) { const CompilerOutput &co = (*types.compilerOutputs)[i]; - JS_ASSERT_IF(co.isValid(), co.script() != script || co.mode() != executionMode); + MOZ_ASSERT_IF(co.isValid(), co.script() != script || co.mode() != executionMode); } #endif @@ -1405,7 +1405,7 @@ TemporaryTypeSet::getKnownMIRType() * added to the set. */ DebugOnly empty = flags == 0 && baseObjectCount() == 0; - JS_ASSERT_IF(empty, type == jit::MIRType_Value); + MOZ_ASSERT_IF(empty, type == jit::MIRType_Value); return type; } @@ -1436,7 +1436,7 @@ HeapTypeSetKey::knownMIRType(CompilerConstraintList *constraints) * that the exact tag is unknown, as it will stay unknown as more types are * added to the set. */ - JS_ASSERT_IF(types->empty(), type == jit::MIRType_Value); + MOZ_ASSERT_IF(types->empty(), type == jit::MIRType_Value); return type; } @@ -1963,7 +1963,7 @@ TemporaryTypeSet::convertDoubleElements(CompilerConstraintList *constraints) } } - JS_ASSERT_IF(alwaysConvert, maybeConvert); + MOZ_ASSERT_IF(alwaysConvert, maybeConvert); if (maybeConvert && dontConvert) return AmbiguousDoubleConversion; @@ -2170,7 +2170,7 @@ TypeObject * TypeCompartment::newTypeObject(ExclusiveContext *cx, const Class *clasp, Handle proto, TypeObjectFlags initialFlags) { - JS_ASSERT_IF(proto.isObject(), cx->isInsideCurrentCompartment(proto.toObject())); + MOZ_ASSERT_IF(proto.isObject(), cx->isInsideCurrentCompartment(proto.toObject())); if (cx->isJSContext()) { if (proto.isObject() && IsInsideNursery(proto.toObject())) @@ -3013,8 +3013,8 @@ TypeObject::addDefiniteProperties(ExclusiveContext *cx, Shape *shape) while (!shape->isEmptyShape()) { jsid id = IdToTypeId(shape->propid()); if (!JSID_IS_VOID(id)) { - JS_ASSERT_IF(shape->slot() >= shape->numFixedSlots(), - shape->numFixedSlots() == JSObject::MAX_FIXED_SLOTS); + MOZ_ASSERT_IF(shape->slot() >= shape->numFixedSlots(), + shape->numFixedSlots() == JSObject::MAX_FIXED_SLOTS); TypeSet *types = getProperty(cx, id); if (!types) return false; @@ -3175,8 +3175,8 @@ TypeObject::setFlags(ExclusiveContext *cx, TypeObjectFlags flags) if (singleton()) { /* Make sure flags are consistent with persistent object state. */ - JS_ASSERT_IF(flags & OBJECT_FLAG_ITERATED, - singleton()->lastProperty()->hasObjectFlag(BaseShape::ITERATED_SINGLETON)); + MOZ_ASSERT_IF(flags & OBJECT_FLAG_ITERATED, + singleton()->lastProperty()->hasObjectFlag(BaseShape::ITERATED_SINGLETON)); } addFlags(flags); @@ -4215,7 +4215,7 @@ JSObject::splicePrototype(JSContext *cx, const Class *clasp, Handle MOZ_ASSERT(self->hasSingletonType()); /* Inner objects may not appear on prototype chains. */ - JS_ASSERT_IF(proto.isObject(), !proto.toObject()->getClass()->ext.outerObject); + MOZ_ASSERT_IF(proto.isObject(), !proto.toObject()->getClass()->ext.outerObject); /* * Force type instantiation when splicing lazy types. This may fail, @@ -4369,7 +4369,7 @@ static void TypeObjectTablePostBarrier(ExclusiveContext *cx, TypeObjectWithNewScriptSet *table, const Class *clasp, TaggedProto proto, JSFunction *fun) { - JS_ASSERT_IF(fun, !IsInsideNursery(fun)); + MOZ_ASSERT_IF(fun, !IsInsideNursery(fun)); if (!proto.isObject()) return; @@ -4389,8 +4389,8 @@ TypeObjectTablePostBarrier(ExclusiveContext *cx, TypeObjectWithNewScriptSet *tab TypeObject * ExclusiveContext::getNewType(const Class *clasp, TaggedProto proto, JSFunction *fun) { - JS_ASSERT_IF(fun, proto.isObject()); - JS_ASSERT_IF(proto.isObject(), isInsideCurrentCompartment(proto.toObject())); + MOZ_ASSERT_IF(fun, proto.isObject()); + MOZ_ASSERT_IF(proto.isObject(), isInsideCurrentCompartment(proto.toObject())); TypeObjectWithNewScriptSet &newTypeObjects = compartment()->newTypeObjects; @@ -4483,7 +4483,7 @@ ExclusiveContext::getNewType(const Class *clasp, TaggedProto proto, JSFunction * TypeObject * ExclusiveContext::getSingletonType(const Class *clasp, TaggedProto proto) { - JS_ASSERT_IF(proto.isObject(), compartment() == proto.toObject()->compartment()); + MOZ_ASSERT_IF(proto.isObject(), compartment() == proto.toObject()->compartment()); AutoEnterAnalysis enter(this); diff --git a/js/src/jsinfer.h b/js/src/jsinfer.h index cdea64018277..507b4037d9f1 100644 --- a/js/src/jsinfer.h +++ b/js/src/jsinfer.h @@ -1146,8 +1146,8 @@ struct TypeObject : public gc::TenuredCell } bool unknownProperties() { - JS_ASSERT_IF(flags() & OBJECT_FLAG_UNKNOWN_PROPERTIES, - hasAllFlags(OBJECT_FLAG_DYNAMIC_MASK)); + MOZ_ASSERT_IF(flags() & OBJECT_FLAG_UNKNOWN_PROPERTIES, + hasAllFlags(OBJECT_FLAG_DYNAMIC_MASK)); return !!(flags() & OBJECT_FLAG_UNKNOWN_PROPERTIES); } diff --git a/js/src/jsinferinlines.h b/js/src/jsinferinlines.h index bbe02023dcc5..d3b54a38d19a 100644 --- a/js/src/jsinferinlines.h +++ b/js/src/jsinferinlines.h @@ -1167,7 +1167,7 @@ inline TypeObject::TypeObject(const Class *clasp, TaggedProto proto, TypeObjectF mozilla::PodZero(this); /* Inner objects may not appear on prototype chains. */ - JS_ASSERT_IF(proto.isObject(), !proto.toObject()->getClass()->ext.outerObject); + MOZ_ASSERT_IF(proto.isObject(), !proto.toObject()->getClass()->ext.outerObject); this->clasp_ = clasp; this->proto_ = proto.raw(); @@ -1197,7 +1197,7 @@ TypeObject::getProperty(ExclusiveContext *cx, jsid id) MOZ_ASSERT(cx->compartment()->activeAnalysis); MOZ_ASSERT(JSID_IS_VOID(id) || JSID_IS_EMPTY(id) || JSID_IS_STRING(id) || JSID_IS_SYMBOL(id)); - JS_ASSERT_IF(!JSID_IS_EMPTY(id), id == IdToTypeId(id)); + MOZ_ASSERT_IF(!JSID_IS_EMPTY(id), id == IdToTypeId(id)); MOZ_ASSERT(!unknownProperties()); if (HeapTypeSet *types = maybeGetProperty(id)) @@ -1238,7 +1238,7 @@ inline HeapTypeSet * TypeObject::maybeGetProperty(jsid id) { MOZ_ASSERT(JSID_IS_VOID(id) || JSID_IS_EMPTY(id) || JSID_IS_STRING(id) || JSID_IS_SYMBOL(id)); - JS_ASSERT_IF(!JSID_IS_EMPTY(id), id == IdToTypeId(id)); + MOZ_ASSERT_IF(!JSID_IS_EMPTY(id), id == IdToTypeId(id)); MOZ_ASSERT(!unknownProperties()); Property *prop = HashSetLookup diff --git a/js/src/jsiter.cpp b/js/src/jsiter.cpp index df8439c29bb8..fb3a7cf2839d 100644 --- a/js/src/jsiter.cpp +++ b/js/src/jsiter.cpp @@ -1014,7 +1014,7 @@ bool js::ValueToIterator(JSContext *cx, unsigned flags, MutableHandleValue vp) { /* JSITER_KEYVALUE must always come with JSITER_FOREACH */ - JS_ASSERT_IF(flags & JSITER_KEYVALUE, flags & JSITER_FOREACH); + MOZ_ASSERT_IF(flags & JSITER_KEYVALUE, flags & JSITER_FOREACH); RootedObject obj(cx); if (vp.isObject()) { diff --git a/js/src/jsnum.cpp b/js/src/jsnum.cpp index 6bdfefc85ad8..ebeded9e1c89 100644 --- a/js/src/jsnum.cpp +++ b/js/src/jsnum.cpp @@ -593,7 +593,7 @@ static T * BackfillInt32InBuffer(int32_t si, T *buffer, size_t size, size_t *length) { uint32_t ui = Abs(si); - JS_ASSERT_IF(si == INT32_MIN, ui == uint32_t(INT32_MAX) + 1); + MOZ_ASSERT_IF(si == INT32_MIN, ui == uint32_t(INT32_MAX) + 1); RangedPtr end(buffer + size - 1, buffer, size); *end = '\0'; @@ -1318,10 +1318,10 @@ js_NumberToStringWithBase(ThreadSafeContext *cx, double d, int base) js_ReportOutOfMemory(cx); return nullptr; } - JS_ASSERT_IF(base == 10, - !cbuf.dbuf && numStr >= cbuf.sbuf && numStr < cbuf.sbuf + cbuf.sbufSize); - JS_ASSERT_IF(base != 10, - cbuf.dbuf && cbuf.dbuf == numStr); + MOZ_ASSERT_IF(base == 10, + !cbuf.dbuf && numStr >= cbuf.sbuf && numStr < cbuf.sbuf + cbuf.sbufSize); + MOZ_ASSERT_IF(base != 10, + cbuf.dbuf && cbuf.dbuf == numStr); } JSFlatString *s = NewStringCopyZ(cx, numStr); diff --git a/js/src/jsobj.cpp b/js/src/jsobj.cpp index 2eac0a196be5..fd87b3386fef 100644 --- a/js/src/jsobj.cpp +++ b/js/src/jsobj.cpp @@ -282,7 +282,7 @@ PropDesc::initFromPropertyDescriptor(Handle desc) isUndefined_ = false; attrs = uint8_t(desc.attributes()); - JS_ASSERT_IF(attrs & JSPROP_READONLY, !(attrs & (JSPROP_GETTER | JSPROP_SETTER))); + MOZ_ASSERT_IF(attrs & JSPROP_READONLY, !(attrs & (JSPROP_GETTER | JSPROP_SETTER))); if (desc.hasGetterOrSetterObject()) { hasGet_ = true; get_ = desc.hasGetterObject() && desc.getterObject() @@ -555,7 +555,7 @@ PropDesc::initialize(JSContext *cx, const Value &origval, bool checkAccessors) return false; } - JS_ASSERT_IF(attrs & JSPROP_READONLY, !(attrs & (JSPROP_GETTER | JSPROP_SETTER))); + MOZ_ASSERT_IF(attrs & JSPROP_READONLY, !(attrs & (JSPROP_GETTER | JSPROP_SETTER))); return true; } @@ -1278,7 +1278,7 @@ JSObject::sealOrFreeze(JSContext *cx, HandleObject obj, ImmutabilityType it) return false; /* preventExtensions must sparsify dense objects, so we can assign to holes without checks. */ - JS_ASSERT_IF(obj->isNative(), obj->getDenseCapacity() == 0); + MOZ_ASSERT_IF(obj->isNative(), obj->getDenseCapacity() == 0); if (obj->isNative() && !obj->inDictionaryMode() && !IsAnyTypedArray(obj)) { /* @@ -1445,9 +1445,9 @@ NewObject(ExclusiveContext *cx, types::TypeObject *type_, JSObject *parent, gc:: const Class *clasp = type_->clasp(); MOZ_ASSERT(clasp != &ArrayObject::class_); - JS_ASSERT_IF(clasp == &JSFunction::class_, - kind == JSFunction::FinalizeKind || kind == JSFunction::ExtendedFinalizeKind); - JS_ASSERT_IF(parent, &parent->global() == cx->global()); + MOZ_ASSERT_IF(clasp == &JSFunction::class_, + kind == JSFunction::FinalizeKind || kind == JSFunction::ExtendedFinalizeKind); + MOZ_ASSERT_IF(parent, &parent->global() == cx->global()); RootedTypeObject type(cx, type_); @@ -1514,7 +1514,7 @@ void NewObjectCache::fillProto(EntryIndex entry, const Class *clasp, js::TaggedProto proto, gc::AllocKind kind, JSObject *obj) { - JS_ASSERT_IF(proto.isObject(), !proto.toObject()->is()); + MOZ_ASSERT_IF(proto.isObject(), !proto.toObject()->is()); MOZ_ASSERT(obj->getTaggedProto() == proto); return fill(entry, clasp, proto.raw(), kind, obj); } @@ -2039,8 +2039,8 @@ JSObject * js::DeepCloneObjectLiteral(JSContext *cx, HandleObject obj, NewObjectKind newKind) { /* NB: Keep this in sync with XDRObjectLiteral. */ - JS_ASSERT_IF(obj->hasSingletonType(), - JS::CompartmentOptionsRef(cx).getSingletonsAsTemplates()); + MOZ_ASSERT_IF(obj->hasSingletonType(), + JS::CompartmentOptionsRef(cx).getSingletonsAsTemplates()); MOZ_ASSERT(obj->is() || obj->is()); // Result of the clone function. @@ -2129,8 +2129,8 @@ js::XDRObjectLiteral(XDRState *xdr, MutableHandleObject obj) /* NB: Keep this in sync with DeepCloneObjectLiteral. */ JSContext *cx = xdr->cx(); - JS_ASSERT_IF(mode == XDR_ENCODE && obj->hasSingletonType(), - JS::CompartmentOptionsRef(cx).getSingletonsAsTemplates()); + MOZ_ASSERT_IF(mode == XDR_ENCODE && obj->hasSingletonType(), + JS::CompartmentOptionsRef(cx).getSingletonsAsTemplates()); // Distinguish between objects and array classes. uint32_t isArray = 0; @@ -2298,7 +2298,7 @@ js::XDRObjectLiteral(XDRState *xdr, MutableHandleObject obj) } } - JS_ASSERT_IF(mode == XDR_DECODE, !obj->inDictionaryMode()); + MOZ_ASSERT_IF(mode == XDR_DECODE, !obj->inDictionaryMode()); } // Fix up types, distinguishing singleton-typed objects. @@ -2361,7 +2361,7 @@ js::CloneObjectLiteral(JSContext *cx, HandleObject parent, HandleObject srcObj) { if (srcObj->getClass() == &JSObject::class_) { AllocKind kind = GetBackgroundAllocKind(GuessObjectGCKind(srcObj->numFixedSlots())); - JS_ASSERT_IF(srcObj->isTenured(), kind == srcObj->asTenured()->getAllocKind()); + MOZ_ASSERT_IF(srcObj->isTenured(), kind == srcObj->asTenured()->getAllocKind()); JSObject *proto = cx->global()->getOrCreateObjectPrototype(cx); if (!proto) @@ -2389,9 +2389,9 @@ js::CloneObjectLiteral(JSContext *cx, HandleObject parent, HandleObject srcObj) // The only markable values in copy on write arrays are atoms, which // can be freely copied between compartments. value = srcObj->getDenseElement(i); - JS_ASSERT_IF(value.isMarkable(), - value.toGCThing()->isTenured() && - cx->runtime()->isAtomsZone(value.toGCThing()->asTenured()->zone())); + MOZ_ASSERT_IF(value.isMarkable(), + value.toGCThing()->isTenured() && + cx->runtime()->isAtomsZone(value.toGCThing()->asTenured()->zone())); id = INT_TO_JSID(i); if (!JSObject::defineGeneric(cx, res, id, value, nullptr, nullptr, JSPROP_ENUMERATE)) @@ -2569,7 +2569,7 @@ JSObject::TradeGuts(JSContext *cx, JSObject *a, JSObject *b, TradeGutsReserved & b->type_ = tmp; /* Don't try to swap a JSFunction for a plain function JSObject. */ - JS_ASSERT_IF(a->is(), a->tenuredSizeOfThis() == b->tenuredSizeOfThis()); + MOZ_ASSERT_IF(a->is(), a->tenuredSizeOfThis() == b->tenuredSizeOfThis()); /* * Regexp guts are more complicated -- we would need to migrate the @@ -3063,7 +3063,7 @@ JSObject::growSlots(ThreadSafeContext *cx, HandleObject obj, uint32_t oldCount, { MOZ_ASSERT(cx->isThreadLocal(obj)); MOZ_ASSERT(newCount > oldCount); - JS_ASSERT_IF(!obj->is(), newCount >= SLOT_CAPACITY_MIN); + MOZ_ASSERT_IF(!obj->is(), newCount >= SLOT_CAPACITY_MIN); /* * Slot capacities are determined by the span of allocated objects. Due to @@ -3118,7 +3118,7 @@ JSObject::shrinkSlots(ThreadSafeContext *cx, HandleObject obj, uint32_t oldCount return; } - JS_ASSERT_IF(!obj->is(), newCount >= SLOT_CAPACITY_MIN); + MOZ_ASSERT_IF(!obj->is(), newCount >= SLOT_CAPACITY_MIN); HeapSlot *newslots = ReallocateSlots(cx, obj, obj->slots, oldCount, newCount); if (!newslots) @@ -3882,7 +3882,7 @@ JSObject::allocSlot(ThreadSafeContext *cx, HandleObject obj, uint32_t *slotp) #ifdef DEBUG MOZ_ASSERT(last < slot); uint32_t next = obj->getSlot(last).toPrivateUint32(); - JS_ASSERT_IF(next != SHAPE_INVALID_SLOT, next < slot); + MOZ_ASSERT_IF(next != SHAPE_INVALID_SLOT, next < slot); #endif *slotp = last; @@ -3916,14 +3916,14 @@ JSObject::freeSlot(uint32_t slot) uint32_t &last = lastProperty()->table().freelist; /* Can't afford to check the whole freelist, but let's check the head. */ - JS_ASSERT_IF(last != SHAPE_INVALID_SLOT, last < slotSpan() && last != slot); + MOZ_ASSERT_IF(last != SHAPE_INVALID_SLOT, last < slotSpan() && last != slot); /* * Place all freed slots other than reserved slots (bug 595230) on the * dictionary's free list. */ if (JSSLOT_FREE(getClass()) <= slot) { - JS_ASSERT_IF(last != SHAPE_INVALID_SLOT, last < slotSpan()); + MOZ_ASSERT_IF(last != SHAPE_INVALID_SLOT, last < slotSpan()); setSlot(slot, PrivateUint32Value(last)); last = slot; return; @@ -4916,11 +4916,11 @@ NativeGetInline(JSContext *cx, if (shape->hasSlot()) { vp.set(pobj->nativeGetSlot(shape->slot())); - JS_ASSERT_IF(!vp.isMagic(JS_UNINITIALIZED_LEXICAL) && - !pobj->hasSingletonType() && - !pobj->template is() && - shape->hasDefaultGetter(), - js::types::TypeHasProperty(cx, pobj->type(), shape->propid(), vp)); + MOZ_ASSERT_IF(!vp.isMagic(JS_UNINITIALIZED_LEXICAL) && + !pobj->hasSingletonType() && + !pobj->template is() && + shape->hasDefaultGetter(), + js::types::TypeHasProperty(cx, pobj->type(), shape->propid(), vp)); } else { vp.setUndefined(); } diff --git a/js/src/jsobj.h b/js/src/jsobj.h index 7df067dd8663..d4dd2691dc6c 100644 --- a/js/src/jsobj.h +++ b/js/src/jsobj.h @@ -1126,7 +1126,7 @@ class JSObject : public js::ObjectImpl ok = js::DefaultValue(cx, obj, hint, vp); else ok = op(cx, obj, hint, vp); - JS_ASSERT_IF(ok, vp.isPrimitive()); + MOZ_ASSERT_IF(ok, vp.isPrimitive()); return ok; } diff --git a/js/src/jsobjinlines.h b/js/src/jsobjinlines.h index 2a61142fa089..0d0fafc253eb 100644 --- a/js/src/jsobjinlines.h +++ b/js/src/jsobjinlines.h @@ -374,7 +374,7 @@ JSObject::initDenseElementsUnbarriered(uint32_t dstStart, const js::Value *src, /* static */ inline bool JSObject::setSingletonType(js::ExclusiveContext *cx, js::HandleObject obj) { - JS_ASSERT_IF(cx->isJSContext(), !IsInsideNursery(obj)); + MOZ_ASSERT_IF(cx->isJSContext(), !IsInsideNursery(obj)); js::types::TypeObject *type = cx->getSingletonType(obj->getClass(), obj->getTaggedProto()); if (!type) @@ -519,10 +519,10 @@ JSObject::create(js::ExclusiveContext *cx, js::gc::AllocKind kind, js::gc::Initi MOZ_ASSERT(shape && type); MOZ_ASSERT(type->clasp() == shape->getObjectClass()); MOZ_ASSERT(type->clasp() != &js::ArrayObject::class_); - JS_ASSERT_IF(!ClassCanHaveFixedData(type->clasp()), - js::gc::GetGCKindSlots(kind, type->clasp()) == shape->numFixedSlots()); - JS_ASSERT_IF(type->clasp()->flags & JSCLASS_BACKGROUND_FINALIZE, IsBackgroundFinalized(kind)); - JS_ASSERT_IF(type->clasp()->finalize, heap == js::gc::TenuredHeap); + MOZ_ASSERT_IF(!ClassCanHaveFixedData(type->clasp()), + js::gc::GetGCKindSlots(kind, type->clasp()) == shape->numFixedSlots()); + MOZ_ASSERT_IF(type->clasp()->flags & JSCLASS_BACKGROUND_FINALIZE, IsBackgroundFinalized(kind)); + MOZ_ASSERT_IF(type->clasp()->finalize, heap == js::gc::TenuredHeap); const js::Class *clasp = type->clasp(); size_t nDynamicSlots = dynamicSlotsCount(shape->numFixedSlots(), shape->slotSpan(), clasp); @@ -589,7 +589,7 @@ JSObject::createArrayInternal(js::ExclusiveContext *cx, js::gc::AllocKind kind, MOZ_ASSERT(shape && type); MOZ_ASSERT(type->clasp() == shape->getObjectClass()); MOZ_ASSERT(type->clasp() == &js::ArrayObject::class_); - JS_ASSERT_IF(type->clasp()->finalize, heap == js::gc::TenuredHeap); + MOZ_ASSERT_IF(type->clasp()->finalize, heap == js::gc::TenuredHeap); // Arrays can use their fixed slots to store elements, so can't have shapes // which allow named properties to be stored in the fixed slots. @@ -1099,7 +1099,7 @@ CopyInitializerObject(JSContext *cx, HandleObject baseobj, NewObjectKind newKind gc::AllocKind allocKind = gc::GetGCObjectFixedSlotsKind(baseobj->numFixedSlots()); allocKind = gc::GetBackgroundAllocKind(allocKind); - JS_ASSERT_IF(baseobj->isTenured(), allocKind == baseobj->asTenured()->getAllocKind()); + MOZ_ASSERT_IF(baseobj->isTenured(), allocKind == baseobj->asTenured()->getAllocKind()); RootedObject obj(cx); obj = NewBuiltinClassInstance(cx, &JSObject::class_, allocKind, newKind); if (!obj) diff --git a/js/src/json.cpp b/js/src/json.cpp index 9fb3af9fb393..7a7a5fed12b6 100644 --- a/js/src/json.cpp +++ b/js/src/json.cpp @@ -328,7 +328,7 @@ JO(JSContext *cx, HandleObject obj, StringifyContext *scx) MOZ_ASSERT(JS_IsArrayObject(cx, scx->replacer)); props = &scx->propertyList; } else { - JS_ASSERT_IF(scx->replacer, scx->propertyList.length() == 0); + MOZ_ASSERT_IF(scx->replacer, scx->propertyList.length() == 0); ids.emplace(cx); if (!GetPropertyNames(cx, obj, JSITER_OWNONLY, ids.ptr())) return false; diff --git a/js/src/jsopcode.h b/js/src/jsopcode.h index 67915dd6d558..75904b4d502b 100644 --- a/js/src/jsopcode.h +++ b/js/src/jsopcode.h @@ -349,10 +349,10 @@ public: void advanceTo(ptrdiff_t relpc) { // Must always advance! If the same or an earlier PC is erroneously // passed in, we will already be past the relevant src notes - JS_ASSERT_IF(offset > 0, relpc > offset); + MOZ_ASSERT_IF(offset > 0, relpc > offset); // Next src note should be for after the current offset - JS_ASSERT_IF(offset > 0, SN_IS_TERMINATOR(sn) || SN_DELTA(sn) > 0); + MOZ_ASSERT_IF(offset > 0, SN_IS_TERMINATOR(sn) || SN_DELTA(sn) > 0); // The first PC requested is always considered to be a line header lineHeader = (offset == 0); diff --git a/js/src/jsreflect.cpp b/js/src/jsreflect.cpp index ca19f28875d7..1e82ec3daf64 100644 --- a/js/src/jsreflect.cpp +++ b/js/src/jsreflect.cpp @@ -340,7 +340,7 @@ class NodeBuilder // previous stack frame (i.e. we're just choosing between two // already-rooted values). HandleValue opt(HandleValue v) { - JS_ASSERT_IF(v.isMagic(), v.whyMagic() == JS_SERIALIZE_NO_NODE); + MOZ_ASSERT_IF(v.isMagic(), v.whyMagic() == JS_SERIALIZE_NO_NODE); return v.isMagic(JS_SERIALIZE_NO_NODE) ? JS::UndefinedHandleValue : v; } @@ -494,7 +494,7 @@ class NodeBuilder } bool setProperty(HandleObject obj, const char *name, HandleValue val) { - JS_ASSERT_IF(val.isMagic(), val.whyMagic() == JS_SERIALIZE_NO_NODE); + MOZ_ASSERT_IF(val.isMagic(), val.whyMagic() == JS_SERIALIZE_NO_NODE); /* * Bug 575416: instead of Atomize, lookup constant atoms in tbl file @@ -731,7 +731,7 @@ NodeBuilder::newArray(NodeVector &elts, MutableHandleValue dst) for (size_t i = 0; i < len; i++) { RootedValue val(cx, elts[i]); - JS_ASSERT_IF(val.isMagic(), val.whyMagic() == JS_SERIALIZE_NO_NODE); + MOZ_ASSERT_IF(val.isMagic(), val.whyMagic() == JS_SERIALIZE_NO_NODE); /* Represent "no node" as an array hole by not adding the value. */ if (val.isMagic(JS_SERIALIZE_NO_NODE)) @@ -2037,7 +2037,7 @@ ASTSerializer::variableDeclarator(ParseNode *pn, VarDeclKind *pkind, MutableHand if (pn->isKind(PNK_NAME)) { pnleft = pn; pnright = pn->isUsed() ? nullptr : pn->pn_expr; - JS_ASSERT_IF(pnright, pn->pn_pos.encloses(pnright->pn_pos)); + MOZ_ASSERT_IF(pnright, pn->pn_pos.encloses(pnright->pn_pos)); } else if (pn->isKind(PNK_ASSIGN)) { pnleft = pn->pn_left; pnright = pn->pn_right; @@ -2131,7 +2131,7 @@ bool ASTSerializer::exportDeclaration(ParseNode *pn, MutableHandleValue dst) { MOZ_ASSERT(pn->isKind(PNK_EXPORT) || pn->isKind(PNK_EXPORT_FROM)); - JS_ASSERT_IF(pn->isKind(PNK_EXPORT_FROM), pn->pn_right->isKind(PNK_STRING)); + MOZ_ASSERT_IF(pn->isKind(PNK_EXPORT_FROM), pn->pn_right->isKind(PNK_STRING)); RootedValue decl(cx, NullValue()); NodeVector elts(cx); @@ -2193,7 +2193,7 @@ ASTSerializer::exportSpecifier(ParseNode *pn, MutableHandleValue dst) bool ASTSerializer::switchCase(ParseNode *pn, MutableHandleValue dst) { - JS_ASSERT_IF(pn->pn_left, pn->pn_pos.encloses(pn->pn_left->pn_pos)); + MOZ_ASSERT_IF(pn->pn_left, pn->pn_pos.encloses(pn->pn_left->pn_pos)); MOZ_ASSERT(pn->pn_pos.encloses(pn->pn_right->pn_pos)); NodeVector stmts(cx); @@ -2245,7 +2245,7 @@ bool ASTSerializer::catchClause(ParseNode *pn, bool *isGuarded, MutableHandleValue dst) { MOZ_ASSERT(pn->pn_pos.encloses(pn->pn_kid1->pn_pos)); - JS_ASSERT_IF(pn->pn_kid2, pn->pn_pos.encloses(pn->pn_kid2->pn_pos)); + MOZ_ASSERT_IF(pn->pn_kid2, pn->pn_pos.encloses(pn->pn_kid2->pn_pos)); MOZ_ASSERT(pn->pn_pos.encloses(pn->pn_kid3->pn_pos)); RootedValue var(cx), guard(cx), body(cx); @@ -2265,8 +2265,8 @@ bool ASTSerializer::tryStatement(ParseNode *pn, MutableHandleValue dst) { MOZ_ASSERT(pn->pn_pos.encloses(pn->pn_kid1->pn_pos)); - JS_ASSERT_IF(pn->pn_kid2, pn->pn_pos.encloses(pn->pn_kid2->pn_pos)); - JS_ASSERT_IF(pn->pn_kid3, pn->pn_pos.encloses(pn->pn_kid3->pn_pos)); + MOZ_ASSERT_IF(pn->pn_kid2, pn->pn_pos.encloses(pn->pn_kid2->pn_pos)); + MOZ_ASSERT_IF(pn->pn_kid3, pn->pn_pos.encloses(pn->pn_kid3->pn_pos)); RootedValue body(cx); if (!statement(pn->pn_kid1, &body)) @@ -2377,7 +2377,7 @@ ASTSerializer::statement(ParseNode *pn, MutableHandleValue dst) { MOZ_ASSERT(pn->pn_pos.encloses(pn->pn_kid1->pn_pos)); MOZ_ASSERT(pn->pn_pos.encloses(pn->pn_kid2->pn_pos)); - JS_ASSERT_IF(pn->pn_kid3, pn->pn_pos.encloses(pn->pn_kid3->pn_pos)); + MOZ_ASSERT_IF(pn->pn_kid3, pn->pn_pos.encloses(pn->pn_kid3->pn_pos)); RootedValue test(cx), cons(cx), alt(cx); @@ -2427,9 +2427,9 @@ ASTSerializer::statement(ParseNode *pn, MutableHandleValue dst) ParseNode *head = pn->pn_left; - JS_ASSERT_IF(head->pn_kid1, head->pn_pos.encloses(head->pn_kid1->pn_pos)); - JS_ASSERT_IF(head->pn_kid2, head->pn_pos.encloses(head->pn_kid2->pn_pos)); - JS_ASSERT_IF(head->pn_kid3, head->pn_pos.encloses(head->pn_kid3->pn_pos)); + MOZ_ASSERT_IF(head->pn_kid1, head->pn_pos.encloses(head->pn_kid1->pn_pos)); + MOZ_ASSERT_IF(head->pn_kid2, head->pn_pos.encloses(head->pn_kid2->pn_pos)); + MOZ_ASSERT_IF(head->pn_kid3, head->pn_pos.encloses(head->pn_kid3->pn_pos)); RootedValue stmt(cx); if (!statement(pn->pn_right, &stmt)) @@ -2510,7 +2510,7 @@ ASTSerializer::statement(ParseNode *pn, MutableHandleValue dst) case PNK_THROW: case PNK_RETURN: { - JS_ASSERT_IF(pn->pn_kid, pn->pn_pos.encloses(pn->pn_kid->pn_pos)); + MOZ_ASSERT_IF(pn->pn_kid, pn->pn_pos.encloses(pn->pn_kid->pn_pos)); RootedValue arg(cx); @@ -2986,7 +2986,7 @@ ASTSerializer::expression(ParseNode *pn, MutableHandleValue dst) case PNK_YIELD: { - JS_ASSERT_IF(pn->pn_kid, pn->pn_pos.encloses(pn->pn_kid->pn_pos)); + MOZ_ASSERT_IF(pn->pn_kid, pn->pn_pos.encloses(pn->pn_kid->pn_pos)); RootedValue arg(cx); return optExpression(pn->pn_kid, &arg) && diff --git a/js/src/jsscript.cpp b/js/src/jsscript.cpp index 388ff5abefad..fd9271c38790 100644 --- a/js/src/jsscript.cpp +++ b/js/src/jsscript.cpp @@ -602,7 +602,7 @@ js::XDRScript(XDRState *xdr, HandleObject enclosingScope, HandleScript enc uint32_t nvars = 0; if (mode == XDR_ENCODE) { script = scriptp.get(); - JS_ASSERT_IF(enclosingScript, enclosingScript->compartment() == script->compartment()); + MOZ_ASSERT_IF(enclosingScript, enclosingScript->compartment() == script->compartment()); nargs = script->bindings.numArgs(); nblocklocals = script->bindings.numBlockScoped(); @@ -1768,7 +1768,7 @@ SourceCompressionTask::work() ScriptSource::~ScriptSource() { - JS_ASSERT_IF(inCompressedSourceSet, dataType == DataCompressed); + MOZ_ASSERT_IF(inCompressedSourceSet, dataType == DataCompressed); switch (dataType) { case DataUncompressed: @@ -3090,7 +3090,7 @@ js::CloneScript(JSContext *cx, HandleObject enclosingScope, HandleFunction fun, HeapValue *vector = Rebase(dst, src, src->consts()->vector); dst->consts()->vector = vector; for (unsigned i = 0; i < nconsts; ++i) - JS_ASSERT_IF(vector[i].isMarkable(), vector[i].toString()->isAtom()); + MOZ_ASSERT_IF(vector[i].isMarkable(), vector[i].toString()->isAtom()); } if (nobjects != 0) { HeapPtrObject *vector = Rebase(dst, src, src->objects()->vector); @@ -3121,8 +3121,8 @@ js::CloneFunctionScript(JSContext *cx, HandleFunction original, HandleFunction c RootedScript script(cx, clone->nonLazyScript()); MOZ_ASSERT(script); MOZ_ASSERT(script->compartment() == original->compartment()); - JS_ASSERT_IF(script->compartment() != cx->compartment(), - !script->enclosingStaticScope()); + MOZ_ASSERT_IF(script->compartment() != cx->compartment(), + !script->enclosingStaticScope()); RootedObject scope(cx, script->enclosingStaticScope()); @@ -3338,9 +3338,9 @@ JSScript::markChildren(JSTracer *trc) // JSScript::Create(), but not yet finished initializing it with // fullyInitFromEmitter() or fullyInitTrivial(). - JS_ASSERT_IF(IS_GC_MARKING_TRACER(trc) && - static_cast(trc)->shouldCheckCompartments(), - zone()->isCollecting()); + MOZ_ASSERT_IF(IS_GC_MARKING_TRACER(trc) && + static_cast(trc)->shouldCheckCompartments(), + zone()->isCollecting()); for (uint32_t i = 0; i < natoms(); ++i) { if (atoms[i]) @@ -3487,7 +3487,7 @@ JSScript::setArgumentsHasVarBinding() void JSScript::setNeedsArgsObj(bool needsArgsObj) { - JS_ASSERT_IF(needsArgsObj, argumentsHasVarBinding()); + MOZ_ASSERT_IF(needsArgsObj, argumentsHasVarBinding()); needsArgsAnalysis_ = false; needsArgsObj_ = needsArgsObj; } @@ -3655,7 +3655,7 @@ void LazyScript::setParent(JSObject *enclosingScope, ScriptSourceObject *sourceObject) { MOZ_ASSERT(!sourceObject_ && !enclosingScope_); - JS_ASSERT_IF(enclosingScope, function_->compartment() == enclosingScope->compartment()); + MOZ_ASSERT_IF(enclosingScope, function_->compartment() == enclosingScope->compartment()); MOZ_ASSERT(function_->compartment() == sourceObject->compartment()); enclosingScope_ = enclosingScope; @@ -3721,7 +3721,7 @@ LazyScript::CreateRaw(ExclusiveContext *cx, HandleFunction fun, p.usesArgumentsAndApply = false; LazyScript *res = LazyScript::CreateRaw(cx, fun, packedFields, begin, end, lineno, column); - JS_ASSERT_IF(res, res->version() == version); + MOZ_ASSERT_IF(res, res->version() == version); return res; } diff --git a/js/src/jsscriptinlines.h b/js/src/jsscriptinlines.h index 811ea03eda87..bfecfc3c26b0 100644 --- a/js/src/jsscriptinlines.h +++ b/js/src/jsscriptinlines.h @@ -89,7 +89,7 @@ inline JSFunction * JSScript::getFunction(size_t index) { JSFunction *fun = &getObject(index)->as(); - JS_ASSERT_IF(fun->isNative(), IsAsmJSModuleNative(fun->native())); + MOZ_ASSERT_IF(fun->isNative(), IsAsmJSModuleNative(fun->native())); return fun; } diff --git a/js/src/jsstr.cpp b/js/src/jsstr.cpp index d2c8569ab39a..14385cbee3c4 100644 --- a/js/src/jsstr.cpp +++ b/js/src/jsstr.cpp @@ -5181,8 +5181,8 @@ js::PutEscapedStringImpl(char *buffer, size_t bufferSize, FILE *fp, const CharT } state; MOZ_ASSERT(quote == 0 || quote == '\'' || quote == '"'); - JS_ASSERT_IF(!buffer, bufferSize == 0); - JS_ASSERT_IF(fp, !buffer); + MOZ_ASSERT_IF(!buffer, bufferSize == 0); + MOZ_ASSERT_IF(fp, !buffer); if (bufferSize == 0) buffer = nullptr; diff --git a/js/src/jsutil.h b/js/src/jsutil.h index a5e9a38ea1dd..0a0013f78dd6 100644 --- a/js/src/jsutil.h +++ b/js/src/jsutil.h @@ -35,8 +35,8 @@ js_memcpy(void *dst_, const void *src_, size_t len) { char *dst = (char *) dst_; const char *src = (const char *) src_; - JS_ASSERT_IF(dst >= src, (size_t) (dst - src) >= len); - JS_ASSERT_IF(src >= dst, (size_t) (src - dst) >= len); + MOZ_ASSERT_IF(dst >= src, (size_t) (dst - src) >= len); + MOZ_ASSERT_IF(src >= dst, (size_t) (src - dst) >= len); return memcpy(dst, src, len); } diff --git a/js/src/jsweakmap.cpp b/js/src/jsweakmap.cpp index 2a9ac817d763..245f25190d83 100644 --- a/js/src/jsweakmap.cpp +++ b/js/src/jsweakmap.cpp @@ -28,7 +28,7 @@ WeakMapBase::WeakMapBase(JSObject *memOf, JSCompartment *c) next(WeakMapNotInList), marked(false) { - JS_ASSERT_IF(memberOf, memberOf->compartment() == c); + MOZ_ASSERT_IF(memberOf, memberOf->compartment() == c); } WeakMapBase::~WeakMapBase() @@ -400,7 +400,7 @@ SetWeakMapEntryInternal(JSContext *cx, Handle mapObj, } MOZ_ASSERT(key->compartment() == mapObj->compartment()); - JS_ASSERT_IF(value.isObject(), value.toObject().compartment() == mapObj->compartment()); + MOZ_ASSERT_IF(value.isObject(), value.toObject().compartment() == mapObj->compartment()); if (!map->put(key, value)) { JS_ReportOutOfMemory(cx); return false; diff --git a/js/src/proxy/CrossCompartmentWrapper.cpp b/js/src/proxy/CrossCompartmentWrapper.cpp index 1712a2893001..e9c490e6ebb5 100644 --- a/js/src/proxy/CrossCompartmentWrapper.cpp +++ b/js/src/proxy/CrossCompartmentWrapper.cpp @@ -521,8 +521,8 @@ js::RemapWrapper(JSContext *cx, JSObject *wobjArg, JSObject *newTargetArg) // If we're mapping to a different target (as opposed to just recomputing // for the same target), we must not have an existing wrapper for the new // target, otherwise this will break. - JS_ASSERT_IF(origTarget != newTarget, - !wcompartment->lookupWrapper(ObjectValue(*newTarget))); + MOZ_ASSERT_IF(origTarget != newTarget, + !wcompartment->lookupWrapper(ObjectValue(*newTarget))); // The old value should still be in the cross-compartment wrapper map, and // the lookup should return wobj. diff --git a/js/src/proxy/Proxy.cpp b/js/src/proxy/Proxy.cpp index 0ffe48b4cb2c..e53d0a770a5e 100644 --- a/js/src/proxy/Proxy.cpp +++ b/js/src/proxy/Proxy.cpp @@ -861,7 +861,7 @@ js::NewProxyObject(JSContext *cx, const BaseProxyHandler *handler, HandleValue p void ProxyObject::renew(JSContext *cx, const BaseProxyHandler *handler, Value priv) { - JS_ASSERT_IF(IsCrossCompartmentWrapper(this), IsDeadProxyObject(this)); + MOZ_ASSERT_IF(IsCrossCompartmentWrapper(this), IsDeadProxyObject(this)); MOZ_ASSERT(getParent() == cx->global()); MOZ_ASSERT(getClass() == &ProxyObject::class_); MOZ_ASSERT(!getClass()->ext.innerObject); diff --git a/js/src/shell/js.cpp b/js/src/shell/js.cpp index 7cdd24d10ba1..45f3fb5e1fcc 100644 --- a/js/src/shell/js.cpp +++ b/js/src/shell/js.cpp @@ -443,7 +443,7 @@ RunFile(JSContext *cx, Handle obj, const char *filename, FILE *file, gGotError = false; (void) JS::Compile(cx, obj, options, file, &script); - JS_ASSERT_IF(!script, gGotError); + MOZ_ASSERT_IF(!script, gGotError); } #ifdef DEBUG diff --git a/js/src/shell/jsoptparse.cpp b/js/src/shell/jsoptparse.cpp index 9277092d0e40..cc5846e202ea 100644 --- a/js/src/shell/jsoptparse.cpp +++ b/js/src/shell/jsoptparse.cpp @@ -615,7 +615,7 @@ OptionParser::addOptionalStringArg(const char *name, const char *help) bool OptionParser::addOptionalMultiStringArg(const char *name, const char *help) { - JS_ASSERT_IF(!arguments.empty(), !arguments.back()->isVariadic()); + MOZ_ASSERT_IF(!arguments.empty(), !arguments.back()->isVariadic()); if (!arguments.reserve(arguments.length() + 1)) return false; MultiStringOption *mso = js_new(1, name, help, (const char *) nullptr); diff --git a/js/src/vm/ArgumentsObject.cpp b/js/src/vm/ArgumentsObject.cpp index 1a96198c9009..fd3a68aa3bde 100644 --- a/js/src/vm/ArgumentsObject.cpp +++ b/js/src/vm/ArgumentsObject.cpp @@ -22,7 +22,7 @@ using namespace js::gc; static void CopyStackFrameArguments(const AbstractFramePtr frame, HeapValue *dst, unsigned totalArgs) { - JS_ASSERT_IF(frame.isInterpreterFrame(), !frame.asInterpreterFrame()->runningInJit()); + MOZ_ASSERT_IF(frame.isInterpreterFrame(), !frame.asInterpreterFrame()->runningInJit()); MOZ_ASSERT(Max(frame.numActualArgs(), frame.numFormalArgs()) == totalArgs); diff --git a/js/src/vm/ArrayBufferObject.cpp b/js/src/vm/ArrayBufferObject.cpp index 635ba70f94b4..821c548426cc 100644 --- a/js/src/vm/ArrayBufferObject.cpp +++ b/js/src/vm/ArrayBufferObject.cpp @@ -581,7 +581,7 @@ ArrayBufferObject * ArrayBufferObject::create(JSContext *cx, uint32_t nbytes, BufferContents contents, NewObjectKind newKind /* = GenericObject */) { - JS_ASSERT_IF(contents.kind() & MAPPED_BUFFER, contents); + MOZ_ASSERT_IF(contents.kind() & MAPPED_BUFFER, contents); // If we need to allocate data, try to use a larger object size class so // that the array buffer's data can be allocated inline with the object. diff --git a/js/src/vm/Compression.cpp b/js/src/vm/Compression.cpp index 6d20098347c2..ddacbab8564f 100644 --- a/js/src/vm/Compression.cpp +++ b/js/src/vm/Compression.cpp @@ -97,8 +97,8 @@ Compressor::compressMore() MOZ_ASSERT(zs.avail_out == 0); return MOREOUTPUT; } - JS_ASSERT_IF(!done, ret == Z_OK); - JS_ASSERT_IF(done, ret == Z_STREAM_END); + MOZ_ASSERT_IF(!done, ret == Z_OK); + MOZ_ASSERT_IF(done, ret == Z_STREAM_END); return done ? DONE : CONTINUE; } diff --git a/js/src/vm/Debugger.cpp b/js/src/vm/Debugger.cpp index 62b506aa17b1..e3873087454e 100644 --- a/js/src/vm/Debugger.cpp +++ b/js/src/vm/Debugger.cpp @@ -365,7 +365,7 @@ Debugger::Debugger(JSContext *cx, JSObject *dbg) Debugger::~Debugger() { - JS_ASSERT_IF(debuggees.initialized(), debuggees.empty()); + MOZ_ASSERT_IF(debuggees.initialized(), debuggees.empty()); emptyAllocationsLog(); /* @@ -885,7 +885,7 @@ void Debugger::resultToCompletion(JSContext *cx, bool ok, const Value &rv, JSTrapStatus *status, MutableHandleValue value) { - JS_ASSERT_IF(ok, !cx->isExceptionPending()); + MOZ_ASSERT_IF(ok, !cx->isExceptionPending()); if (ok) { *status = JSTRAP_RETURN; @@ -2392,7 +2392,7 @@ Debugger::cleanupDebuggeeGlobalBeforeRemoval(FreeOp *fop, GlobalObject *global, * to avoid invalidating the live enumerator. */ MOZ_ASSERT(debuggees.has(global)); - JS_ASSERT_IF(debugEnum, debugEnum->front() == global); + MOZ_ASSERT_IF(debugEnum, debugEnum->front() == global); /* * FIXME Debugger::slowPathOnLeaveFrame needs to kill all Debugger.Frame @@ -2438,7 +2438,7 @@ Debugger::cleanupDebuggeeGlobalBeforeRemoval(FreeOp *fop, GlobalObject *global, if (bp->site->script->compartment() == global->compartment()) bp->destroy(fop); } - JS_ASSERT_IF(debuggees.empty(), !firstBreakpoint()); + MOZ_ASSERT_IF(debuggees.empty(), !firstBreakpoint()); /* * If we are tracking allocation sites, we need to remove the object @@ -4783,7 +4783,7 @@ js::EvaluateInEnv(JSContext *cx, Handle env, HandleValue thisv, AbstractFr MutableHandleValue rval) { assertSameCompartment(cx, env, frame); - JS_ASSERT_IF(frame, thisv.get() == frame.thisValue()); + MOZ_ASSERT_IF(frame, thisv.get() == frame.thisValue()); MOZ_ASSERT(!IsPoisonedPtr(chars.start().get())); @@ -4822,8 +4822,8 @@ DebuggerGenericEval(JSContext *cx, const char *fullMethodName, const Value &code ScriptFrameIter *iter) { /* Either we're specifying the frame, or a global. */ - JS_ASSERT_IF(iter, !scope); - JS_ASSERT_IF(!iter, scope && scope->is()); + MOZ_ASSERT_IF(iter, !scope); + MOZ_ASSERT_IF(!iter, scope && scope->is()); /* Check the first argument, the eval code string. */ if (!code.isString()) { diff --git a/js/src/vm/Debugger.h b/js/src/vm/Debugger.h index 654a467a5485..e120c91b817a 100644 --- a/js/src/vm/Debugger.h +++ b/js/src/vm/Debugger.h @@ -86,7 +86,7 @@ class DebuggerWeakMap : private WeakMap > bool relookupOrAdd(AddPtr &p, const KeyInput &k, const ValueInput &v) { MOZ_ASSERT(v->compartment() == Base::compartment); MOZ_ASSERT(!k->compartment()->options_.mergeable()); - JS_ASSERT_IF(!InvisibleKeysOk, !k->compartment()->options_.invisibleToDebugger()); + MOZ_ASSERT_IF(!InvisibleKeysOk, !k->compartment()->options_.invisibleToDebugger()); MOZ_ASSERT(!Base::has(k)); if (!incZoneCount(k->zone())) return false; @@ -115,7 +115,7 @@ class DebuggerWeakMap : private WeakMap > bool hasKeyInZone(JS::Zone *zone) { CountMap::Ptr p = zoneCounts.lookup(zone); - JS_ASSERT_IF(p, p->value() > 0); + MOZ_ASSERT_IF(p, p->value() > 0); return p; } @@ -203,7 +203,7 @@ class Debugger : private mozilla::LinkedListElement struct AllocationSite : public mozilla::LinkedListElement { explicit AllocationSite(HandleObject frame) : frame(frame) { - JS_ASSERT_IF(frame, UncheckedUnwrap(frame)->is()); + MOZ_ASSERT_IF(frame, UncheckedUnwrap(frame)->is()); }; RelocatablePtrObject frame; }; @@ -760,14 +760,14 @@ Debugger::onExceptionUnwind(JSContext *cx, MutableHandleValue vp) void Debugger::onNewScript(JSContext *cx, HandleScript script, GlobalObject *compileAndGoGlobal) { - JS_ASSERT_IF(script->compileAndGo(), compileAndGoGlobal); - JS_ASSERT_IF(script->compileAndGo(), compileAndGoGlobal == &script->uninlinedGlobal()); + MOZ_ASSERT_IF(script->compileAndGo(), compileAndGoGlobal); + MOZ_ASSERT_IF(script->compileAndGo(), compileAndGoGlobal == &script->uninlinedGlobal()); // We early return in slowPathOnNewScript for self-hosted scripts, so we can // ignore those in our assertion here. - JS_ASSERT_IF(!script->compartment()->options().invisibleToDebugger() && - !script->selfHosted(), - script->compartment()->firedOnNewGlobalObject); - JS_ASSERT_IF(!script->compileAndGo(), !compileAndGoGlobal); + MOZ_ASSERT_IF(!script->compartment()->options().invisibleToDebugger() && + !script->selfHosted(), + script->compartment()->firedOnNewGlobalObject); + MOZ_ASSERT_IF(!script->compileAndGo(), !compileAndGoGlobal); if (script->compartment()->debugMode()) slowPathOnNewScript(cx, script, compileAndGoGlobal); } diff --git a/js/src/vm/ForkJoin.cpp b/js/src/vm/ForkJoin.cpp index 16107c4d173b..e1fadabb1d14 100644 --- a/js/src/vm/ForkJoin.cpp +++ b/js/src/vm/ForkJoin.cpp @@ -501,7 +501,7 @@ ForkJoinOperation::apply() // - Re-enqueue main script and any uncompiled scripts that were called // - Too many bailouts: Fallback to sequential - JS_ASSERT_IF(!IsBaselineEnabled(cx_), !IsIonEnabled(cx_)); + MOZ_ASSERT_IF(!IsBaselineEnabled(cx_), !IsIonEnabled(cx_)); if (!IsBaselineEnabled(cx_) || !IsIonEnabled(cx_)) return sequentialExecution(true); diff --git a/js/src/vm/Interpreter-inl.h b/js/src/vm/Interpreter-inl.h index 7ad670a6776d..d575de9b29d2 100644 --- a/js/src/vm/Interpreter-inl.h +++ b/js/src/vm/Interpreter-inl.h @@ -31,7 +31,7 @@ namespace js { inline bool ComputeThis(JSContext *cx, AbstractFramePtr frame) { - JS_ASSERT_IF(frame.isInterpreterFrame(), !frame.asInterpreterFrame()->runningInJit()); + MOZ_ASSERT_IF(frame.isInterpreterFrame(), !frame.asInterpreterFrame()->runningInJit()); if (frame.isFunctionFrame() && frame.fun()->isArrow()) { /* @@ -57,7 +57,7 @@ ComputeThis(JSContext *cx, AbstractFramePtr frame) * and undefined |this| values will unwrap to the same object in the function and * eval frames, so are not required to be wrapped. */ - JS_ASSERT_IF(frame.isEvalFrame(), thisv.isUndefined() || thisv.isNull()); + MOZ_ASSERT_IF(frame.isEvalFrame(), thisv.isUndefined() || thisv.isNull()); } JSObject *thisObj = BoxNonStrictThis(cx, thisv); @@ -305,7 +305,7 @@ SetNameOperation(JSContext *cx, JSScript *script, jsbytecode *pc, HandleObject s HandleValue val) { MOZ_ASSERT(*pc == JSOP_SETNAME || *pc == JSOP_SETGNAME); - JS_ASSERT_IF(*pc == JSOP_SETGNAME, scope == cx->global()); + MOZ_ASSERT_IF(*pc == JSOP_SETGNAME, scope == cx->global()); bool strict = script->strict(); RootedPropertyName name(cx, script->getName(pc)); diff --git a/js/src/vm/Interpreter.cpp b/js/src/vm/Interpreter.cpp index c931dcc1e95e..ecf8813c21ff 100644 --- a/js/src/vm/Interpreter.cpp +++ b/js/src/vm/Interpreter.cpp @@ -121,7 +121,7 @@ js::BoxNonStrictThis(JSContext *cx, const CallReceiver &call) #ifdef DEBUG JSFunction *fun = call.callee().is() ? &call.callee().as() : nullptr; - JS_ASSERT_IF(fun && fun->isInterpreted(), !fun->strict()); + MOZ_ASSERT_IF(fun && fun->isInterpreted(), !fun->strict()); #endif JSObject *thisObj = BoxNonStrictThis(cx, call.thisv()); @@ -462,7 +462,7 @@ js::Invoke(JSContext *cx, CallArgs args, MaybeConstruct construct) if (MOZ_UNLIKELY(clasp == &js_NoSuchMethodClass)) return NoSuchMethod(cx, args.length(), args.base()); #endif - JS_ASSERT_IF(construct, !args.callee().constructHook()); + MOZ_ASSERT_IF(construct, !args.callee().constructHook()); JSNative call = args.callee().callHook(); if (!call) return ReportIsNotFunction(cx, args.calleev(), args.length() + 1, construct); @@ -471,7 +471,7 @@ js::Invoke(JSContext *cx, CallArgs args, MaybeConstruct construct) /* Invoke native functions. */ JSFunction *fun = &args.callee().as(); - JS_ASSERT_IF(construct, !fun->isNativeConstructor()); + MOZ_ASSERT_IF(construct, !fun->isNativeConstructor()); if (fun->isNative()) return CallJSNative(cx, fun->native(), args); @@ -494,7 +494,7 @@ js::Invoke(JSContext *cx, CallArgs args, MaybeConstruct construct) bool ok = RunScript(cx, state); - JS_ASSERT_IF(ok && construct, args.rval().isObject()); + MOZ_ASSERT_IF(ok && construct, args.rval().isObject()); return ok; } @@ -609,8 +609,8 @@ bool js::ExecuteKernel(JSContext *cx, HandleScript script, JSObject &scopeChainArg, const Value &thisv, ExecuteType type, AbstractFramePtr evalInFrame, Value *result) { - JS_ASSERT_IF(evalInFrame, type == EXECUTE_DEBUG); - JS_ASSERT_IF(type == EXECUTE_GLOBAL, !scopeChainArg.is()); + MOZ_ASSERT_IF(evalInFrame, type == EXECUTE_DEBUG); + MOZ_ASSERT_IF(type == EXECUTE_GLOBAL, !scopeChainArg.is()); #ifdef DEBUG if (thisv.isObject()) { RootedObject thisObj(cx, &thisv.toObject()); @@ -649,7 +649,7 @@ js::Execute(JSContext *cx, HandleScript script, JSObject &scopeChainArg, Value * JSObject *s = scopeChain; do { assertSameCompartment(cx, s); - JS_ASSERT_IF(!s->enclosingScope(), s->is()); + MOZ_ASSERT_IF(!s->enclosingScope(), s->is()); } while ((s = s->enclosingScope())); #endif @@ -1432,8 +1432,8 @@ Interpret(JSContext *cx, RunState &state) #define SANITY_CHECKS() \ JS_BEGIN_MACRO \ js::gc::MaybeVerifyBarriers(cx); \ - JS_ASSERT_IF(script->hasScriptCounts(), \ - activation.opMask() == EnableInterruptsPseudoOpcode); \ + MOZ_ASSERT_IF(script->hasScriptCounts(), \ + activation.opMask() == EnableInterruptsPseudoOpcode); \ JS_END_MACRO gc::MaybeVerifyBarriers(cx, true); diff --git a/js/src/vm/MatchPairs.h b/js/src/vm/MatchPairs.h index 09005c4e8c63..c16233943e71 100644 --- a/js/src/vm/MatchPairs.h +++ b/js/src/vm/MatchPairs.h @@ -46,8 +46,8 @@ struct MatchPair inline bool check() const { MOZ_ASSERT(limit >= start); - JS_ASSERT_IF(start < 0, start == -1); - JS_ASSERT_IF(limit < 0, limit == -1); + MOZ_ASSERT_IF(start < 0, start == -1); + MOZ_ASSERT_IF(limit < 0, limit == -1); return true; } }; diff --git a/js/src/vm/OldDebugAPI.cpp b/js/src/vm/OldDebugAPI.cpp index 6cd295098362..209e9ca0d551 100644 --- a/js/src/vm/OldDebugAPI.cpp +++ b/js/src/vm/OldDebugAPI.cpp @@ -42,7 +42,7 @@ using mozilla::PodZero; JSTrapStatus js::ScriptDebugPrologue(JSContext *cx, AbstractFramePtr frame, jsbytecode *pc) { - JS_ASSERT_IF(frame.isInterpreterFrame(), frame.asInterpreterFrame() == cx->interpreterFrame()); + MOZ_ASSERT_IF(frame.isInterpreterFrame(), frame.asInterpreterFrame() == cx->interpreterFrame()); RootedValue rval(cx); JSTrapStatus status = Debugger::onEnterFrame(cx, frame, &rval); @@ -67,7 +67,7 @@ js::ScriptDebugPrologue(JSContext *cx, AbstractFramePtr frame, jsbytecode *pc) bool js::ScriptDebugEpilogue(JSContext *cx, AbstractFramePtr frame, jsbytecode *pc, bool okArg) { - JS_ASSERT_IF(frame.isInterpreterFrame(), frame.asInterpreterFrame() == cx->interpreterFrame()); + MOZ_ASSERT_IF(frame.isInterpreterFrame(), frame.asInterpreterFrame() == cx->interpreterFrame()); bool ok = okArg; diff --git a/js/src/vm/Probes-inl.h b/js/src/vm/Probes-inl.h index 453abaa1cdd2..71cd416f9ba7 100644 --- a/js/src/vm/Probes-inl.h +++ b/js/src/vm/Probes-inl.h @@ -55,7 +55,7 @@ probes::EnterScript(JSContext *cx, JSScript *script, JSFunction *maybeFun, if (rt->spsProfiler.enabled()) { if (!rt->spsProfiler.enter(script, maybeFun)) return false; - JS_ASSERT_IF(!fp->isGeneratorFrame(), !fp->hasPushedSPSFrame()); + MOZ_ASSERT_IF(!fp->isGeneratorFrame(), !fp->hasPushedSPSFrame()); fp->setPushedSPSFrame(); } diff --git a/js/src/vm/ProxyObject.cpp b/js/src/vm/ProxyObject.cpp index a13db112c6e7..0f492aeec6ac 100644 --- a/js/src/vm/ProxyObject.cpp +++ b/js/src/vm/ProxyObject.cpp @@ -23,8 +23,8 @@ ProxyObject::New(JSContext *cx, const BaseProxyHandler *handler, HandleValue pri const Class *clasp = options.clasp(); MOZ_ASSERT(isValidProxyClass(clasp)); - JS_ASSERT_IF(proto.isObject(), cx->compartment() == proto.toObject()->compartment()); - JS_ASSERT_IF(parent, cx->compartment() == parent->compartment()); + MOZ_ASSERT_IF(proto.isObject(), cx->compartment() == proto.toObject()->compartment()); + MOZ_ASSERT_IF(parent, cx->compartment() == parent->compartment()); /* * Eagerly mark properties unknown for proxies, so we don't try to track diff --git a/js/src/vm/RegExpObject.cpp b/js/src/vm/RegExpObject.cpp index abfe28751224..1ffa2244d835 100644 --- a/js/src/vm/RegExpObject.cpp +++ b/js/src/vm/RegExpObject.cpp @@ -853,7 +853,7 @@ js::CloneRegExpObject(JSContext *cx, JSObject *obj_) RegExpObjectBuilder builder(cx); Rooted regex(cx, &obj_->as()); JSObject *res = builder.clone(regex); - JS_ASSERT_IF(res, res->type() == regex->type()); + MOZ_ASSERT_IF(res, res->type() == regex->type()); return res; } diff --git a/js/src/vm/RegExpStatics.cpp b/js/src/vm/RegExpStatics.cpp index 125b44e3b1db..5c10358e48dc 100644 --- a/js/src/vm/RegExpStatics.cpp +++ b/js/src/vm/RegExpStatics.cpp @@ -74,7 +74,7 @@ RegExpStatics::markFlagsSet(JSContext *cx) // type changes on RegExp.prototype, so mark a state change to trigger // recompilation of all such code (when recompiling, a stub call will // always be performed). - JS_ASSERT_IF(cx->global()->hasRegExpStatics(), this == cx->global()->getRegExpStatics(cx)); + MOZ_ASSERT_IF(cx->global()->hasRegExpStatics(), this == cx->global()->getRegExpStatics(cx)); types::MarkTypeObjectFlags(cx, cx->global(), types::OBJECT_FLAG_REGEXP_FLAGS_SET); } diff --git a/js/src/vm/RegExpStatics.h b/js/src/vm/RegExpStatics.h index 9b7ec4fff694..9d053f488477 100644 --- a/js/src/vm/RegExpStatics.h +++ b/js/src/vm/RegExpStatics.h @@ -403,8 +403,8 @@ RegExpStatics::copyTo(RegExpStatics &dst) dst.flags = flags; dst.pendingLazyEvaluation = pendingLazyEvaluation; - JS_ASSERT_IF(pendingLazyEvaluation, lazySource); - JS_ASSERT_IF(pendingLazyEvaluation, matchesInput); + MOZ_ASSERT_IF(pendingLazyEvaluation, lazySource); + MOZ_ASSERT_IF(pendingLazyEvaluation, matchesInput); } inline void diff --git a/js/src/vm/SPSProfiler.cpp b/js/src/vm/SPSProfiler.cpp index 90cd530b4253..d41189d51385 100644 --- a/js/src/vm/SPSProfiler.cpp +++ b/js/src/vm/SPSProfiler.cpp @@ -56,7 +56,7 @@ void SPSProfiler::setProfilingStack(ProfileEntry *stack, uint32_t *size, uint32_t max) { AutoSPSLock lock(lock_); - JS_ASSERT_IF(size_ && *size_ != 0, !enabled()); + MOZ_ASSERT_IF(size_ && *size_ != 0, !enabled()); if (!strings.initialized()) strings.init(); stack_ = stack; @@ -218,8 +218,8 @@ SPSProfiler::enterAsmJS(const char *string, void *sp) void SPSProfiler::push(const char *string, void *sp, JSScript *script, jsbytecode *pc, bool copy) { - JS_ASSERT_IF(sp != nullptr, script == nullptr && pc == nullptr); - JS_ASSERT_IF(sp == nullptr, script != nullptr && pc != nullptr); + MOZ_ASSERT_IF(sp != nullptr, script == nullptr && pc == nullptr); + MOZ_ASSERT_IF(sp == nullptr, script != nullptr && pc != nullptr); /* these operations cannot be re-ordered, so volatile-ize operations */ volatile ProfileEntry *stack = stack_; diff --git a/js/src/vm/SPSProfiler.h b/js/src/vm/SPSProfiler.h index 281f9f0525d6..5c77368d5a6a 100644 --- a/js/src/vm/SPSProfiler.h +++ b/js/src/vm/SPSProfiler.h @@ -154,7 +154,7 @@ class SPSProfiler ProfileEntry *stack() { return stack_; } /* management of whether instrumentation is on or off */ - bool enabled() { JS_ASSERT_IF(enabled_, installed()); return enabled_; } + bool enabled() { MOZ_ASSERT_IF(enabled_, installed()); return enabled_; } bool installed() { return stack_ != nullptr && size_ != nullptr; } void enable(bool enabled); void enableSlowAssertions(bool enabled) { slowAssertions = enabled; } @@ -338,10 +338,10 @@ class SPSInstrumentation bool enterInlineFrame(jsbytecode *callerPC) { if (!enabled()) return true; - JS_ASSERT_IF(frames.empty(), callerPC == nullptr); + MOZ_ASSERT_IF(frames.empty(), callerPC == nullptr); - JS_ASSERT_IF(frame != nullptr, frame->script != nullptr); - JS_ASSERT_IF(frame != nullptr, frame->left == 1); + MOZ_ASSERT_IF(frame != nullptr, frame->script != nullptr); + MOZ_ASSERT_IF(frame != nullptr, frame->left == 1); if (!frames.empty()) { MOZ_ASSERT(frame == &frames[frames.length() - 1]); frame->pc = callerPC; diff --git a/js/src/vm/ScopeObject-inl.h b/js/src/vm/ScopeObject-inl.h index 64e3b4c7e4b8..6084dee0e1ea 100644 --- a/js/src/vm/ScopeObject-inl.h +++ b/js/src/vm/ScopeObject-inl.h @@ -20,7 +20,7 @@ ScopeObject::setAliasedVar(JSContext *cx, ScopeCoordinate sc, PropertyName *name JS_STATIC_ASSERT(CallObject::RESERVED_SLOTS == BlockObject::RESERVED_SLOTS); // name may be null if we don't need to track side effects on the object. - JS_ASSERT_IF(hasSingletonType(), name); + MOZ_ASSERT_IF(hasSingletonType(), name); if (hasSingletonType()) { MOZ_ASSERT(name); @@ -81,8 +81,8 @@ StaticScopeIter::operator++(int) } else { onNamedLambda = true; } - JS_ASSERT_IF(obj, obj->template is() || obj->template is()); - JS_ASSERT_IF(onNamedLambda, obj->template is()); + MOZ_ASSERT_IF(obj, obj->template is() || obj->template is()); + MOZ_ASSERT_IF(onNamedLambda, obj->template is()); } template diff --git a/js/src/vm/ScopeObject.cpp b/js/src/vm/ScopeObject.cpp index 58aa532c690a..12d4408dd4a8 100644 --- a/js/src/vm/ScopeObject.cpp +++ b/js/src/vm/ScopeObject.cpp @@ -133,8 +133,8 @@ js::ScopeCoordinateFunctionScript(JSScript *script, jsbytecode *pc) void ScopeObject::setEnclosingScope(HandleObject obj) { - JS_ASSERT_IF(obj->is() || obj->is() || obj->is(), - obj->isDelegate()); + MOZ_ASSERT_IF(obj->is() || obj->is() || obj->is(), + obj->isDelegate()); setFixedSlot(SCOPE_CHAIN_SLOT, ObjectValue(*obj)); } @@ -275,8 +275,8 @@ CallObject * CallObject::createForStrictEval(JSContext *cx, AbstractFramePtr frame) { MOZ_ASSERT(frame.isStrictEvalFrame()); - JS_ASSERT_IF(frame.isInterpreterFrame(), cx->interpreterFrame() == frame.asInterpreterFrame()); - JS_ASSERT_IF(frame.isInterpreterFrame(), cx->interpreterRegs().pc == frame.script()->code()); + MOZ_ASSERT_IF(frame.isInterpreterFrame(), cx->interpreterFrame() == frame.asInterpreterFrame()); + MOZ_ASSERT_IF(frame.isInterpreterFrame(), cx->interpreterRegs().pc == frame.script()->code()); RootedFunction callee(cx); RootedScript script(cx, frame.script()); @@ -1211,14 +1211,14 @@ ScopeIter::settle() } else { type_ = Block; hasScopeObject_ = staticScope_->as().needsClone(); - JS_ASSERT_IF(hasScopeObject_, - cur_->as().staticBlock() == *staticScope_); + MOZ_ASSERT_IF(hasScopeObject_, + cur_->as().staticBlock() == *staticScope_); } } else if (cur_->is()) { CallObject &callobj = cur_->as(); type_ = callobj.isForEval() ? StrictEvalScope : Call; hasScopeObject_ = true; - JS_ASSERT_IF(type_ == Call, callobj.callee().nonLazyScript() == frame_.script()); + MOZ_ASSERT_IF(type_ == Call, callobj.callee().nonLazyScript() == frame_.script()); } else { MOZ_ASSERT(!cur_->is()); MOZ_ASSERT(frame_.isGlobalFrame() || frame_.isDebuggerFrame()); @@ -2116,7 +2116,7 @@ DebugScopes::addDebugScope(JSContext *cx, const ScopeIter &si, DebugScopeObject { MOZ_ASSERT(!si.hasScopeObject()); MOZ_ASSERT(cx->compartment() == debugScope.compartment()); - JS_ASSERT_IF(si.frame().isFunctionFrame(), !si.frame().callee()->isGenerator()); + MOZ_ASSERT_IF(si.frame().isFunctionFrame(), !si.frame().callee()->isGenerator()); if (!CanUseDebugScopeMaps(cx)) return true; @@ -2429,7 +2429,7 @@ GetDebugScopeForMissing(JSContext *cx, const ScopeIter &si) } case ScopeIter::Block: { // Generators should always reify their scopes. - JS_ASSERT_IF(si.frame().isFunctionFrame(), !si.frame().callee()->isGenerator()); + MOZ_ASSERT_IF(si.frame().isFunctionFrame(), !si.frame().callee()->isGenerator()); Rooted staticBlock(cx, &si.staticBlock()); ClonedBlockObject *block = ClonedBlockObject::create(cx, staticBlock, si.frame()); if (!block) diff --git a/js/src/vm/ScopeObject.h b/js/src/vm/ScopeObject.h index c69566aebd66..65395a814b63 100644 --- a/js/src/vm/ScopeObject.h +++ b/js/src/vm/ScopeObject.h @@ -67,16 +67,16 @@ class StaticScopeIter : obj(cx, obj), onNamedLambda(false) { JS_STATIC_ASSERT(allowGC == CanGC); - JS_ASSERT_IF(obj, obj->is() || obj->is() || - obj->is()); + MOZ_ASSERT_IF(obj, obj->is() || obj->is() || + obj->is()); } explicit StaticScopeIter(JSObject *obj) : obj((ExclusiveContext *) nullptr, obj), onNamedLambda(false) { JS_STATIC_ASSERT(allowGC == NoGC); - JS_ASSERT_IF(obj, obj->is() || obj->is() || - obj->is()); + MOZ_ASSERT_IF(obj, obj->is() || obj->is() || + obj->is()); } bool done() const; @@ -271,8 +271,8 @@ class CallObject : public ScopeObject /* True if this is for a strict mode eval frame. */ bool isForEval() const { MOZ_ASSERT(getFixedSlot(CALLEE_SLOT).isObjectOrNull()); - JS_ASSERT_IF(getFixedSlot(CALLEE_SLOT).isObject(), - getFixedSlot(CALLEE_SLOT).toObject().is()); + MOZ_ASSERT_IF(getFixedSlot(CALLEE_SLOT).isObject(), + getFixedSlot(CALLEE_SLOT).toObject().is()); return getFixedSlot(CALLEE_SLOT).isNull(); } @@ -532,7 +532,7 @@ class StaticBlockObject : public BlockObject /* Initialization functions for above fields. */ void setAliased(unsigned i, bool aliased) { - JS_ASSERT_IF(i > 0, slotValue(i-1).isBoolean()); + MOZ_ASSERT_IF(i > 0, slotValue(i-1).isBoolean()); setSlotValue(i, BooleanValue(aliased)); if (aliased && !needsClone()) { setSlotValue(0, MagicValue(JS_BLOCK_NEEDS_CLONE)); @@ -584,12 +584,12 @@ class ClonedBlockObject : public BlockObject /* Assuming 'put' has been called, return the value of the ith let var. */ const Value &var(unsigned i, MaybeCheckAliasing checkAliasing = CHECK_ALIASING) { - JS_ASSERT_IF(checkAliasing, staticBlock().isAliased(i)); + MOZ_ASSERT_IF(checkAliasing, staticBlock().isAliased(i)); return slotValue(i); } void setVar(unsigned i, const Value &v, MaybeCheckAliasing checkAliasing = CHECK_ALIASING) { - JS_ASSERT_IF(checkAliasing, staticBlock().isAliased(i)); + MOZ_ASSERT_IF(checkAliasing, staticBlock().isAliased(i)); setSlotValue(i, v); } diff --git a/js/src/vm/SelfHosting.cpp b/js/src/vm/SelfHosting.cpp index 954d1baf9875..17851ddc7712 100644 --- a/js/src/vm/SelfHosting.cpp +++ b/js/src/vm/SelfHosting.cpp @@ -473,8 +473,8 @@ js::intrinsic_UnsafePutElements(JSContext *cx, unsigned argc, Value *vp) uint32_t idx = args[idxi].toInt32(); if (IsAnyTypedArray(arrobj.get()) || arrobj->is()) { - JS_ASSERT_IF(IsAnyTypedArray(arrobj.get()), idx < AnyTypedArrayLength(arrobj.get())); - JS_ASSERT_IF(arrobj->is(), idx < uint32_t(arrobj->as().length())); + MOZ_ASSERT_IF(IsAnyTypedArray(arrobj.get()), idx < AnyTypedArrayLength(arrobj.get())); + MOZ_ASSERT_IF(arrobj->is(), idx < uint32_t(arrobj->as().length())); RootedValue tmp(cx, args[elemi]); // XXX: Always non-strict. if (!JSObject::setElement(cx, arrobj, arrobj, idx, &tmp, false)) diff --git a/js/src/vm/Shape-inl.h b/js/src/vm/Shape-inl.h index e58b0813271a..b022759fa39c 100644 --- a/js/src/vm/Shape-inl.h +++ b/js/src/vm/Shape-inl.h @@ -72,7 +72,7 @@ Shape::searchThreadLocal(ThreadSafeContext *cx, Shape *start, jsid id, * allocated thread locally. In that case, we may add to the * table. Otherwise it is not allowed. */ - JS_ASSERT_IF(adding, cx->isThreadLocal(start) && start->inDictionary()); + MOZ_ASSERT_IF(adding, cx->isThreadLocal(start) && start->inDictionary()); if (start->inDictionary()) { *pspp = start->table().search(id, adding); @@ -88,7 +88,7 @@ inline bool Shape::set(JSContext* cx, HandleObject obj, HandleObject receiver, bool strict, MutableHandleValue vp) { - JS_ASSERT_IF(hasDefaultSetter(), hasGetterValue()); + MOZ_ASSERT_IF(hasDefaultSetter(), hasGetterValue()); if (attrs & JSPROP_SETTER) { Value fval = setterValue(); @@ -192,8 +192,8 @@ AutoRooterGetterSetter::Inner::Inner(ThreadSafeContext *cx, uint8_t attrs, : CustomAutoRooter(cx), attrs(attrs), pgetter(pgetter_), psetter(psetter_) { - JS_ASSERT_IF(attrs & JSPROP_GETTER, !IsPoisonedPtr(*pgetter)); - JS_ASSERT_IF(attrs & JSPROP_SETTER, !IsPoisonedPtr(*psetter)); + MOZ_ASSERT_IF(attrs & JSPROP_GETTER, !IsPoisonedPtr(*pgetter)); + MOZ_ASSERT_IF(attrs & JSPROP_SETTER, !IsPoisonedPtr(*psetter)); } inline diff --git a/js/src/vm/Shape.cpp b/js/src/vm/Shape.cpp index 013572fb03fb..bb75d2f4e4a0 100644 --- a/js/src/vm/Shape.cpp +++ b/js/src/vm/Shape.cpp @@ -92,9 +92,9 @@ Shape::insertIntoDictionary(HeapPtrShape *dictp) MOZ_ASSERT(inDictionary()); MOZ_ASSERT(!listp); - JS_ASSERT_IF(*dictp, (*dictp)->inDictionary()); - JS_ASSERT_IF(*dictp, (*dictp)->listp == dictp); - JS_ASSERT_IF(*dictp, compartment() == (*dictp)->compartment()); + MOZ_ASSERT_IF(*dictp, (*dictp)->inDictionary()); + MOZ_ASSERT_IF(*dictp, (*dictp)->listp == dictp); + MOZ_ASSERT_IF(*dictp, compartment() == (*dictp)->compartment()); setParent(dictp->get()); if (parent) @@ -134,7 +134,7 @@ Shape::handoffTableTo(Shape *shape) BaseShape *nbase = base(); - JS_ASSERT_IF(shape->hasSlot(), nbase->slotSpan() > shape->slot()); + MOZ_ASSERT_IF(shape->hasSlot(), nbase->slotSpan() > shape->slot()); this->base_ = nbase->baseUnowned(); nbase->adoptUnowned(shape->base()->toUnowned()); @@ -410,7 +410,7 @@ JSObject::getChildProperty(ExclusiveContext *cx, if (!shape) return nullptr; //MOZ_ASSERT(shape->parent == parent); - //JS_ASSERT_IF(parent != lastProperty(), parent == lastProperty()->parent); + //MOZ_ASSERT_IF(parent != lastProperty(), parent == lastProperty()->parent); if (!JSObject::setLastProperty(cx, obj, shape)) return nullptr; } @@ -589,7 +589,7 @@ JSObject::addPropertyInternal(typename ExecutionModeTraits::ExclusiveConte bool allowDictionary) { MOZ_ASSERT(cx->isThreadLocal(obj)); - JS_ASSERT_IF(!allowDictionary, !obj->inDictionaryMode()); + MOZ_ASSERT_IF(!allowDictionary, !obj->inDictionaryMode()); AutoRooterGetterSetter gsRoot(cx, attrs, &getter, &setter); @@ -604,7 +604,7 @@ JSObject::addPropertyInternal(typename ExecutionModeTraits::ExclusiveConte (slot == SHAPE_INVALID_SLOT) || obj->lastProperty()->hasMissingSlot() || (slot == obj->lastProperty()->maybeSlot() + 1); - JS_ASSERT_IF(!allowDictionary, stableSlot); + MOZ_ASSERT_IF(!allowDictionary, stableSlot); if (allowDictionary && (!stableSlot || ShouldConvertToDictionary(obj))) { @@ -833,7 +833,7 @@ JSObject::putProperty(typename ExecutionModeTraits::ExclusiveContextType c } /* Property exists: search must have returned a valid *spp. */ - JS_ASSERT_IF(spp, !SHAPE_IS_REMOVED(*spp)); + MOZ_ASSERT_IF(spp, !SHAPE_IS_REMOVED(*spp)); if (!CheckCanChangeAttrs(cx, obj, shape, &attrs)) return nullptr; @@ -880,7 +880,7 @@ JSObject::putProperty(typename ExecutionModeTraits::ExclusiveContextType c shape = SHAPE_FETCH(spp); } - JS_ASSERT_IF(shape->hasSlot() && !(attrs & JSPROP_SHARED), shape->slot() == slot); + MOZ_ASSERT_IF(shape->hasSlot() && !(attrs & JSPROP_SHARED), shape->slot() == slot); if (obj->inDictionaryMode()) { /* @@ -907,7 +907,7 @@ JSObject::putProperty(typename ExecutionModeTraits::ExclusiveContextType c else shape->base_ = nbase; - JS_ASSERT_IF(attrs & (JSPROP_GETTER | JSPROP_SETTER), attrs & JSPROP_SHARED); + MOZ_ASSERT_IF(attrs & (JSPROP_GETTER | JSPROP_SETTER), attrs & JSPROP_SHARED); shape->setSlot(slot); shape->attrs = uint8_t(attrs); @@ -981,7 +981,7 @@ JSObject::changeProperty(typename ExecutionModeTraits::ExclusiveContextTyp MOZ_ASSERT(obj->nativeContainsPure(shape)); attrs |= shape->attrs & mask; - JS_ASSERT_IF(attrs & (JSPROP_GETTER | JSPROP_SETTER), attrs & JSPROP_SHARED); + MOZ_ASSERT_IF(attrs & (JSPROP_GETTER | JSPROP_SETTER), attrs & JSPROP_SHARED); /* Allow only shared (slotless) => unshared (slotful) transition. */ MOZ_ASSERT(!((attrs ^ shape->attrs) & JSPROP_SHARED) || @@ -1113,7 +1113,7 @@ JSObject::removeProperty(ExclusiveContext *cx, jsid id_) */ Shape *aprop = self->lastProperty(); for (int n = 50; --n >= 0 && aprop->parent; aprop = aprop->parent) - JS_ASSERT_IF(aprop != shape, self->nativeContains(cx, aprop)); + MOZ_ASSERT_IF(aprop != shape, self->nativeContains(cx, aprop)); #endif } @@ -1201,11 +1201,11 @@ ObjectImpl::replaceWithNewEquivalentShape(ThreadSafeContext *cx, Shape *oldShape MOZ_ASSERT(cx->isThreadLocal(this)); MOZ_ASSERT(cx->isThreadLocal(oldShape)); MOZ_ASSERT(cx->isInsideCurrentCompartment(oldShape)); - JS_ASSERT_IF(oldShape != lastProperty(), - inDictionaryMode() && - ((cx->isExclusiveContext() - ? nativeLookup(cx->asExclusiveContext(), oldShape->propidRef()) - : nativeLookupPure(oldShape->propidRef())) == oldShape)); + MOZ_ASSERT_IF(oldShape != lastProperty(), + inDictionaryMode() && + ((cx->isExclusiveContext() + ? nativeLookup(cx->asExclusiveContext(), oldShape->propidRef()) + : nativeLookupPure(oldShape->propidRef())) == oldShape)); ObjectImpl *self = this; @@ -1527,8 +1527,8 @@ BaseShape::assertConsistency() UnownedBaseShape *unowned = baseUnowned(); MOZ_ASSERT(hasGetterObject() == unowned->hasGetterObject()); MOZ_ASSERT(hasSetterObject() == unowned->hasSetterObject()); - JS_ASSERT_IF(hasGetterObject(), getterObject() == unowned->getterObject()); - JS_ASSERT_IF(hasSetterObject(), setterObject() == unowned->setterObject()); + MOZ_ASSERT_IF(hasGetterObject(), getterObject() == unowned->getterObject()); + MOZ_ASSERT_IF(hasSetterObject(), setterObject() == unowned->setterObject()); MOZ_ASSERT(getObjectParent() == unowned->getObjectParent()); MOZ_ASSERT(getObjectMetadata() == unowned->getObjectMetadata()); MOZ_ASSERT(getObjectFlags() == unowned->getObjectFlags()); @@ -1715,8 +1715,8 @@ EmptyShape::getInitialShape(ExclusiveContext *cx, const Class *clasp, TaggedProt JSObject *parent, JSObject *metadata, size_t nfixed, uint32_t objectFlags) { - JS_ASSERT_IF(proto.isObject(), cx->isInsideCurrentCompartment(proto.toObject())); - JS_ASSERT_IF(parent, cx->isInsideCurrentCompartment(parent)); + MOZ_ASSERT_IF(proto.isObject(), cx->isInsideCurrentCompartment(proto.toObject())); + MOZ_ASSERT_IF(parent, cx->isInsideCurrentCompartment(parent)); InitialShapeSet &table = cx->compartment()->initialShapes; diff --git a/js/src/vm/Shape.h b/js/src/vm/Shape.h index 25d42540d1d6..a48af2a5bfff 100644 --- a/js/src/vm/Shape.h +++ b/js/src/vm/Shape.h @@ -456,7 +456,7 @@ class BaseShape : public gc::TenuredCell bool hasSetterObject() const { return !!(flags & HAS_SETTER_OBJECT); } JSObject *setterObject() const { MOZ_ASSERT(hasSetterObject()); return setterObj; } - bool hasTable() const { JS_ASSERT_IF(table_, isOwned()); return table_ != nullptr; } + bool hasTable() const { MOZ_ASSERT_IF(table_, isOwned()); return table_ != nullptr; } ShapeTable &table() const { MOZ_ASSERT(table_ && isOwned()); return *table_; } void setTable(ShapeTable *table) { MOZ_ASSERT(isOwned()); table_ = table; } @@ -720,10 +720,10 @@ class Shape : public gc::TenuredCell void handoffTableTo(Shape *newShape); void setParent(Shape *p) { - JS_ASSERT_IF(p && !p->hasMissingSlot() && !inDictionary(), - p->maybeSlot() <= maybeSlot()); - JS_ASSERT_IF(p && !inDictionary(), - hasSlot() == (p->maybeSlot() != maybeSlot())); + MOZ_ASSERT_IF(p && !p->hasMissingSlot() && !inDictionary(), + p->maybeSlot() <= maybeSlot()); + MOZ_ASSERT_IF(p && !inDictionary(), + hasSlot() == (p->maybeSlot() != maybeSlot())); parent = p; } @@ -926,7 +926,7 @@ class Shape : public gc::TenuredCell } bool isEmptyShape() const { - JS_ASSERT_IF(JSID_IS_EMPTY(propid_), hasMissingSlot()); + MOZ_ASSERT_IF(JSID_IS_EMPTY(propid_), hasMissingSlot()); return JSID_IS_EMPTY(propid_); } @@ -1011,7 +1011,7 @@ class Shape : public gc::TenuredCell * the prototype property. See bug 552432. */ bool shadowable() const { - JS_ASSERT_IF(isDataDescriptor(), writable()); + MOZ_ASSERT_IF(isDataDescriptor(), writable()); return hasSlot() || (attrs & JSPROP_SHADOWABLE); } @@ -1248,7 +1248,7 @@ struct StackShape MOZ_ASSERT(base); MOZ_ASSERT(!JSID_IS_VOID(propid)); MOZ_ASSERT(slot <= SHAPE_INVALID_SLOT); - JS_ASSERT_IF(attrs & (JSPROP_GETTER | JSPROP_SETTER), attrs & JSPROP_SHARED); + MOZ_ASSERT_IF(attrs & (JSPROP_GETTER | JSPROP_SETTER), attrs & JSPROP_SHARED); } explicit StackShape(Shape *shape) @@ -1357,7 +1357,7 @@ Shape::Shape(const StackShape &other, uint32_t nfixed) flags(other.flags), parent(nullptr) { - JS_ASSERT_IF(attrs & (JSPROP_GETTER | JSPROP_SETTER), attrs & JSPROP_SHARED); + MOZ_ASSERT_IF(attrs & (JSPROP_GETTER | JSPROP_SETTER), attrs & JSPROP_SHARED); kids.setNull(); } diff --git a/js/src/vm/Stack-inl.h b/js/src/vm/Stack-inl.h index 8eac4b5c352c..662b20f7b1eb 100644 --- a/js/src/vm/Stack-inl.h +++ b/js/src/vm/Stack-inl.h @@ -33,14 +33,14 @@ IsCacheableNonGlobalScope(JSObject *obj) { bool cacheable = (obj->is() || obj->is() || obj->is()); - JS_ASSERT_IF(cacheable, !obj->getOps()->lookupProperty); + MOZ_ASSERT_IF(cacheable, !obj->getOps()->lookupProperty); return cacheable; } inline HandleObject InterpreterFrame::scopeChain() const { - JS_ASSERT_IF(!(flags_ & HAS_SCOPECHAIN), isFunctionFrame()); + MOZ_ASSERT_IF(!(flags_ & HAS_SCOPECHAIN), isFunctionFrame()); if (!(flags_ & HAS_SCOPECHAIN)) { scopeChain_ = callee().environment(); flags_ |= HAS_SCOPECHAIN; @@ -111,7 +111,7 @@ InterpreterFrame::initLocals() inline Value & InterpreterFrame::unaliasedVar(uint32_t i, MaybeCheckAliasing checkAliasing) { - JS_ASSERT_IF(checkAliasing, !script()->varIsAliased(i)); + MOZ_ASSERT_IF(checkAliasing, !script()->varIsAliased(i)); MOZ_ASSERT(i < script()->nfixedvars()); return slots()[i]; } @@ -130,8 +130,8 @@ inline Value & InterpreterFrame::unaliasedFormal(unsigned i, MaybeCheckAliasing checkAliasing) { MOZ_ASSERT(i < numFormalArgs()); - JS_ASSERT_IF(checkAliasing, !script()->argsObjAliasesFormals()); - JS_ASSERT_IF(checkAliasing, !script()->formalIsAliased(i)); + MOZ_ASSERT_IF(checkAliasing, !script()->argsObjAliasesFormals()); + MOZ_ASSERT_IF(checkAliasing, !script()->formalIsAliased(i)); return argv()[i]; } @@ -139,8 +139,8 @@ inline Value & InterpreterFrame::unaliasedActual(unsigned i, MaybeCheckAliasing checkAliasing) { MOZ_ASSERT(i < numActualArgs()); - JS_ASSERT_IF(checkAliasing, !script()->argsObjAliasesFormals()); - JS_ASSERT_IF(checkAliasing && i < numFormalArgs(), !script()->formalIsAliased(i)); + MOZ_ASSERT_IF(checkAliasing, !script()->argsObjAliasesFormals()); + MOZ_ASSERT_IF(checkAliasing && i < numFormalArgs(), !script()->formalIsAliased(i)); return argv()[i]; } @@ -760,7 +760,7 @@ Activation::Activation(ThreadSafeContext *cx, Kind kind) Activation::~Activation() { - JS_ASSERT_IF(isProfiling(), this != cx_->perThreadData->profilingActivation_); + MOZ_ASSERT_IF(isProfiling(), this != cx_->perThreadData->profilingActivation_); MOZ_ASSERT(cx_->perThreadData->activation_ == this); MOZ_ASSERT(hideScriptedCallerCount_ == 0); cx_->perThreadData->activation_ = prev_; @@ -807,7 +807,7 @@ InterpreterActivation::InterpreterActivation(RunState &state, JSContext *cx, regs_ = state.asGenerator()->gen()->regs; } - JS_ASSERT_IF(entryFrame_->isEvalFrame(), state_.script()->isActiveEval()); + MOZ_ASSERT_IF(entryFrame_->isEvalFrame(), state_.script()->isActiveEval()); } InterpreterActivation::~InterpreterActivation() @@ -818,7 +818,7 @@ InterpreterActivation::~InterpreterActivation() JSContext *cx = cx_->asJSContext(); MOZ_ASSERT(oldFrameCount_ == cx->runtime()->interpreterStack().frameCount_); - JS_ASSERT_IF(oldFrameCount_ == 0, cx->runtime()->interpreterStack().allocator_.used() == 0); + MOZ_ASSERT_IF(oldFrameCount_ == 0, cx->runtime()->interpreterStack().allocator_.used() == 0); if (state_.isGenerator()) { JSGenerator *gen = state_.asGenerator()->gen(); diff --git a/js/src/vm/Stack.cpp b/js/src/vm/Stack.cpp index a1a58c24c402..242b42ee035e 100644 --- a/js/src/vm/Stack.cpp +++ b/js/src/vm/Stack.cpp @@ -84,7 +84,7 @@ InterpreterFrame::initExecuteFrame(JSContext *cx, JSScript *script, AbstractFram prevpc_ = nullptr; prevsp_ = nullptr; - JS_ASSERT_IF(evalInFramePrev, isDebuggerFrame()); + MOZ_ASSERT_IF(evalInFramePrev, isDebuggerFrame()); evalInFramePrev_ = evalInFramePrev; #ifdef DEBUG @@ -272,7 +272,7 @@ InterpreterFrame::epilogue(JSContext *cx) if (isEvalFrame()) { if (isStrictEvalFrame()) { - JS_ASSERT_IF(hasCallObj(), scopeChain()->as().isForEval()); + MOZ_ASSERT_IF(hasCallObj(), scopeChain()->as().isForEval()); if (MOZ_UNLIKELY(cx->compartment()->debugMode())) DebugScopes::onPopStrictEvalScope(this); } else if (isDirectEvalFrame()) { @@ -304,8 +304,8 @@ InterpreterFrame::epilogue(JSContext *cx) MOZ_ASSERT(isNonEvalFunctionFrame()); if (fun()->isHeavyweight()) - JS_ASSERT_IF(hasCallObj(), - scopeChain()->as().callee().nonLazyScript() == script); + MOZ_ASSERT_IF(hasCallObj(), + scopeChain()->as().callee().nonLazyScript() == script); else AssertDynamicScopeMatchesStaticScope(cx, script, scopeChain()); diff --git a/js/src/vm/Stack.h b/js/src/vm/Stack.h index 51ef46a2d056..2205718e1615 100644 --- a/js/src/vm/Stack.h +++ b/js/src/vm/Stack.h @@ -792,7 +792,7 @@ class InterpreterFrame bool isGeneratorFrame() const { bool ret = flags_ & GENERATOR; - JS_ASSERT_IF(ret, isNonEvalFunctionFrame()); + MOZ_ASSERT_IF(ret, isNonEvalFunctionFrame()); return ret; } diff --git a/js/src/vm/String.cpp b/js/src/vm/String.cpp index 6672e91f5d13..33894b6e80ad 100644 --- a/js/src/vm/String.cpp +++ b/js/src/vm/String.cpp @@ -467,8 +467,8 @@ js::ConcatStrings(ThreadSafeContext *cx, typename MaybeRooted::HandleType left, typename MaybeRooted::HandleType right) { - JS_ASSERT_IF(!left->isAtom(), cx->isInsideCurrentZone(left)); - JS_ASSERT_IF(!right->isAtom(), cx->isInsideCurrentZone(right)); + MOZ_ASSERT_IF(!left->isAtom(), cx->isInsideCurrentZone(left)); + MOZ_ASSERT_IF(!right->isAtom(), cx->isInsideCurrentZone(right)); size_t leftLen = left->length(); if (leftLen == 0) diff --git a/js/src/vm/StructuredClone.cpp b/js/src/vm/StructuredClone.cpp index 3475f1e9a9be..90d0c82dab7d 100644 --- a/js/src/vm/StructuredClone.cpp +++ b/js/src/vm/StructuredClone.cpp @@ -1206,8 +1206,8 @@ JSStructuredCloneWriter::transferOwnership() } MOZ_ASSERT(point <= out.rawBuffer() + out.count()); - JS_ASSERT_IF(point < out.rawBuffer() + out.count(), - uint32_t(LittleEndian::readUint64(point) >> 32) < SCTAG_TRANSFER_MAP_HEADER); + MOZ_ASSERT_IF(point < out.rawBuffer() + out.count(), + uint32_t(LittleEndian::readUint64(point) >> 32) < SCTAG_TRANSFER_MAP_HEADER); return true; } diff --git a/js/src/vm/TypedArrayObject.cpp b/js/src/vm/TypedArrayObject.cpp index c800f59bb20b..d244737f60a5 100644 --- a/js/src/vm/TypedArrayObject.cpp +++ b/js/src/vm/TypedArrayObject.cpp @@ -334,7 +334,7 @@ class TypedArrayObjectTemplate : public TypedArrayObject makeInstance(JSContext *cx, Handle buffer, uint32_t byteOffset, uint32_t len, HandleObject proto) { - JS_ASSERT_IF(!buffer, byteOffset == 0); + MOZ_ASSERT_IF(!buffer, byteOffset == 0); gc::AllocKind allocKind = buffer ? GetGCObjectKind(instanceClass()) @@ -366,7 +366,7 @@ class TypedArrayObjectTemplate : public TypedArrayObject uint32_t arrayByteLength = obj->byteLength(); uint32_t arrayByteOffset = obj->byteOffset(); uint32_t bufferByteLength = buffer->byteLength(); - JS_ASSERT_IF(!buffer->isNeutered(), buffer->dataPointer() <= obj->viewData()); + MOZ_ASSERT_IF(!buffer->isNeutered(), buffer->dataPointer() <= obj->viewData()); MOZ_ASSERT(bufferByteLength - arrayByteOffset >= arrayByteLength); MOZ_ASSERT(arrayByteOffset <= bufferByteLength); } From 5093e96c815111eabea35faf9dd28037301cf946 Mon Sep 17 00:00:00 2001 From: "Nicolas B. Pierron" Date: Wed, 1 Oct 2014 19:17:53 +0200 Subject: [PATCH 46/63] Bug 1074911 - Remove JS_ASSERT and JS_ASSERT_IF macros. r=jorendorff --- js/public/Utility.h | 3 --- 1 file changed, 3 deletions(-) diff --git a/js/public/Utility.h b/js/public/Utility.h index ff9d75ad0b42..c2fbd567973a 100644 --- a/js/public/Utility.h +++ b/js/public/Utility.h @@ -51,9 +51,6 @@ namespace js {} #define JS_SWEPT_FRAME_PATTERN 0x5b #define JS_POISONED_FORKJOIN_CHUNK 0xBD -#define JS_ASSERT(expr) MOZ_ASSERT(expr) -#define JS_ASSERT_IF(cond, expr) MOZ_ASSERT_IF(cond, expr) - #define JS_STATIC_ASSERT(cond) static_assert(cond, "JS_STATIC_ASSERT") #define JS_STATIC_ASSERT_IF(cond, expr) MOZ_STATIC_ASSERT_IF(cond, expr, "JS_STATIC_ASSERT_IF") From 5fe316221d298265f8406a16c4e79838a468cd47 Mon Sep 17 00:00:00 2001 From: Kai Engert Date: Wed, 1 Oct 2014 19:30:41 +0200 Subject: [PATCH 47/63] Bug 1075686, pick up NSS 3.17.2 beta 1 to fix bug 1057161 --- security/nss/TAG-INFO | 2 +- security/nss/coreconf/coreconf.dep | 1 + security/nss/lib/freebl/ec.c | 5 +++++ security/nss/lib/nss/nss.h | 6 +++--- security/nss/lib/softoken/pkcs11.c | 11 +++++++++++ security/nss/lib/softoken/softkver.h | 6 +++--- security/nss/lib/util/nssutil.h | 6 +++--- security/nss/tests/chains/chains.sh | 0 8 files changed, 27 insertions(+), 10 deletions(-) mode change 100644 => 100755 security/nss/tests/chains/chains.sh diff --git a/security/nss/TAG-INFO b/security/nss/TAG-INFO index 91f7b39828d5..a68b3dc8f8a3 100644 --- a/security/nss/TAG-INFO +++ b/security/nss/TAG-INFO @@ -1 +1 @@ -NSS_3_17_1_RTM +NSS_3_17_2_BETA1 diff --git a/security/nss/coreconf/coreconf.dep b/security/nss/coreconf/coreconf.dep index 5182f75552c8..590d1bfaeee3 100644 --- a/security/nss/coreconf/coreconf.dep +++ b/security/nss/coreconf/coreconf.dep @@ -10,3 +10,4 @@ */ #error "Do not include this header file." + diff --git a/security/nss/lib/freebl/ec.c b/security/nss/lib/freebl/ec.c index ca53c1ae8874..6af242dc1083 100644 --- a/security/nss/lib/freebl/ec.c +++ b/security/nss/lib/freebl/ec.c @@ -870,6 +870,11 @@ cleanup: /* ** Checks the signature on the given digest using the key provided. +** +** The key argument must represent a valid EC public key (a point on +** the relevant curve). If it is not a valid point, then the behavior +** of this function is undefined. In cases where a public key might +** not be valid, use EC_ValidatePublicKey to check. */ SECStatus ECDSA_VerifyDigest(ECPublicKey *key, const SECItem *signature, diff --git a/security/nss/lib/nss/nss.h b/security/nss/lib/nss/nss.h index 628cb640fe7d..ed8267206ee6 100644 --- a/security/nss/lib/nss/nss.h +++ b/security/nss/lib/nss/nss.h @@ -33,12 +33,12 @@ * The format of the version string should be * ".[.[.]][ ][ ]" */ -#define NSS_VERSION "3.17.1" _NSS_ECC_STRING _NSS_CUSTOMIZED +#define NSS_VERSION "3.17.2" _NSS_ECC_STRING _NSS_CUSTOMIZED " Beta" #define NSS_VMAJOR 3 #define NSS_VMINOR 17 -#define NSS_VPATCH 1 +#define NSS_VPATCH 2 #define NSS_VBUILD 0 -#define NSS_BETA PR_FALSE +#define NSS_BETA PR_TRUE #ifndef RC_INVOKED diff --git a/security/nss/lib/softoken/pkcs11.c b/security/nss/lib/softoken/pkcs11.c index 6fa4e4ecce38..f25ca502f25d 100644 --- a/security/nss/lib/softoken/pkcs11.c +++ b/security/nss/lib/softoken/pkcs11.c @@ -969,6 +969,17 @@ sftk_handlePublicKeyObject(SFTKSession *session, SFTKObject *object, } object->infoFree = (SFTKFree) nsslowkey_DestroyPublicKey; + // Check that an imported EC key is valid + if (key_type == CKK_EC) { + NSSLOWKEYPublicKey *pubKey = (NSSLOWKEYPublicKey*) object->objectInfo; + SECStatus rv = EC_ValidatePublicKey(&pubKey->u.ec.ecParams, + &pubKey->u.ec.publicValue); + + if (rv != SECSuccess) { + return CKR_TEMPLATE_INCONSISTENT; + } + } + if (sftk_isTrue(object,CKA_TOKEN)) { SFTKSlot *slot = session->slot; SFTKDBHandle *certHandle = sftk_getCertDB(slot); diff --git a/security/nss/lib/softoken/softkver.h b/security/nss/lib/softoken/softkver.h index 0c3482fc45c4..08d6689e321f 100644 --- a/security/nss/lib/softoken/softkver.h +++ b/security/nss/lib/softoken/softkver.h @@ -25,11 +25,11 @@ * The format of the version string should be * ".[.[.]][ ][ ]" */ -#define SOFTOKEN_VERSION "3.17.1" SOFTOKEN_ECC_STRING +#define SOFTOKEN_VERSION "3.17.2" SOFTOKEN_ECC_STRING " Beta" #define SOFTOKEN_VMAJOR 3 #define SOFTOKEN_VMINOR 17 -#define SOFTOKEN_VPATCH 1 +#define SOFTOKEN_VPATCH 2 #define SOFTOKEN_VBUILD 0 -#define SOFTOKEN_BETA PR_FALSE +#define SOFTOKEN_BETA PR_TRUE #endif /* _SOFTKVER_H_ */ diff --git a/security/nss/lib/util/nssutil.h b/security/nss/lib/util/nssutil.h index 5e471f7ca10a..f1ae8e3e2c64 100644 --- a/security/nss/lib/util/nssutil.h +++ b/security/nss/lib/util/nssutil.h @@ -19,12 +19,12 @@ * The format of the version string should be * ".[.[.]][ ]" */ -#define NSSUTIL_VERSION "3.17.1" +#define NSSUTIL_VERSION "3.17.2 Beta" #define NSSUTIL_VMAJOR 3 #define NSSUTIL_VMINOR 17 -#define NSSUTIL_VPATCH 1 +#define NSSUTIL_VPATCH 2 #define NSSUTIL_VBUILD 0 -#define NSSUTIL_BETA PR_FALSE +#define NSSUTIL_BETA PR_TRUE SEC_BEGIN_PROTOS diff --git a/security/nss/tests/chains/chains.sh b/security/nss/tests/chains/chains.sh old mode 100644 new mode 100755 From 818507baa1c28c3e2a17565bf3f8e97010333082 Mon Sep 17 00:00:00 2001 From: Ryan VanderMeulen Date: Wed, 1 Oct 2014 13:39:22 -0400 Subject: [PATCH 48/63] Backed out changeset 31a25f47264b (bug 1067942) for Linux mochitest-other crashes. CLOSED TREE --- .../source/test/test-ui-action-button.js | 2 +- addon-sdk/source/test/test-ui-sidebar.js | 2 +- .../source/test/test-ui-toggle-button.js | 2 +- js/src/js.msg | 2 +- js/src/jscntxtinlines.h | 2 +- js/src/jsobj.cpp | 22 ++++++++----------- js/src/jsobj.h | 2 +- js/src/vm/Shape-inl.h | 2 +- js/xpconnect/src/XPCQuickStubs.cpp | 2 +- 9 files changed, 17 insertions(+), 21 deletions(-) diff --git a/addon-sdk/source/test/test-ui-action-button.js b/addon-sdk/source/test/test-ui-action-button.js index 9083b35be908..6dd76ff9a72a 100644 --- a/addon-sdk/source/test/test-ui-action-button.js +++ b/addon-sdk/source/test/test-ui-action-button.js @@ -253,7 +253,7 @@ exports['test button global state updated'] = function(assert) { // check read-only properties assert.throws(() => button.id = 'another-id', - /^setting getter-only property/, + /^setting a property that has only a getter/, 'id cannot be set at runtime'); assert.equal(button.id, 'my-button-4', diff --git a/addon-sdk/source/test/test-ui-sidebar.js b/addon-sdk/source/test/test-ui-sidebar.js index 0737e275f0b8..3342f9ceb474 100644 --- a/addon-sdk/source/test/test-ui-sidebar.js +++ b/addon-sdk/source/test/test-ui-sidebar.js @@ -1074,7 +1074,7 @@ exports.testSidebarGettersAndSettersAfterDestroy = function(assert) { assert.equal(sidebar.id, undefined, 'sidebar after destroy has no id'); assert.throws(() => sidebar.id = 'foo-tang', - /^setting getter-only property/, + /^setting a property that has only a getter/, 'id cannot be set at runtime'); assert.equal(sidebar.id, undefined, 'sidebar after destroy has no id'); diff --git a/addon-sdk/source/test/test-ui-toggle-button.js b/addon-sdk/source/test/test-ui-toggle-button.js index 930491df6240..03c2e084b217 100644 --- a/addon-sdk/source/test/test-ui-toggle-button.js +++ b/addon-sdk/source/test/test-ui-toggle-button.js @@ -263,7 +263,7 @@ exports['test button global state updated'] = function(assert) { // check read-only properties assert.throws(() => button.id = 'another-id', - /^setting getter-only property/, + /^setting a property that has only a getter/, 'id cannot be set at runtime'); assert.equal(button.id, 'my-button-4', diff --git a/js/src/js.msg b/js/src/js.msg index 79680e57de9e..248286b6a081 100644 --- a/js/src/js.msg +++ b/js/src/js.msg @@ -63,7 +63,7 @@ MSG_DEF(JSMSG_BAD_GETTER_OR_SETTER, 1, JSEXN_TYPEERR, "invalid {0} usage") MSG_DEF(JSMSG_BAD_ARRAY_LENGTH, 0, JSEXN_RANGEERR, "invalid array length") MSG_DEF(JSMSG_REDECLARED_VAR, 2, JSEXN_TYPEERR, "redeclaration of {0} {1}") MSG_DEF(JSMSG_UNDECLARED_VAR, 1, JSEXN_REFERENCEERR, "assignment to undeclared variable {0}") -MSG_DEF(JSMSG_GETTER_ONLY, 1, JSEXN_TYPEERR, "setting getter-only property {0}") +MSG_DEF(JSMSG_GETTER_ONLY, 0, JSEXN_TYPEERR, "setting a property that has only a getter") MSG_DEF(JSMSG_UNDEFINED_PROP, 1, JSEXN_REFERENCEERR, "reference to undefined property {0}") MSG_DEF(JSMSG_INVALID_MAP_ITERABLE, 0, JSEXN_TYPEERR, "iterable for map should have array-like objects") MSG_DEF(JSMSG_NESTING_GENERATOR, 0, JSEXN_TYPEERR, "already executing generator") diff --git a/js/src/jscntxtinlines.h b/js/src/jscntxtinlines.h index 1e5e4a98dbfd..99df8a87e254 100644 --- a/js/src/jscntxtinlines.h +++ b/js/src/jscntxtinlines.h @@ -335,7 +335,7 @@ CallSetter(JSContext *cx, HandleObject obj, HandleId id, StrictPropertyOp op, un } if (attrs & JSPROP_GETTER) - return js_ReportGetterOnlyAssignment(cx, id, strict); + return js_ReportGetterOnlyAssignment(cx, strict); return CallJSPropertyOpSetter(cx, op, obj, id, strict, vp); } diff --git a/js/src/jsobj.cpp b/js/src/jsobj.cpp index fd87b3386fef..15fc60453483 100644 --- a/js/src/jsobj.cpp +++ b/js/src/jsobj.cpp @@ -5008,7 +5008,7 @@ js::NativeSet(typename ExecutionModeTraits::ContextType cxArg, * or throw if we're in strict mode. */ if (!shape->hasGetterValue() && shape->hasDefaultSetter()) - return js_ReportGetterOnlyAssignment(cx, shape->propid(), strict); + return js_ReportGetterOnlyAssignment(cx, strict); } RootedValue ovp(cx, vp); @@ -5511,7 +5511,7 @@ baseops::SetPropertyHelper(typename ExecutionModeTraits::ContextType cxArg if (mode == ParallelExecution) return !strict; - return js_ReportGetterOnlyAssignment(cxArg->asJSContext(), id, strict); + return js_ReportGetterOnlyAssignment(cxArg->asJSContext(), strict); } } else { MOZ_ASSERT(shape->isDataDescriptor()); @@ -6172,18 +6172,14 @@ js_GetObjectSlotName(JSTracer *trc, char *buf, size_t bufsize) } bool -js_ReportGetterOnlyAssignment(JSContext *cx, jsid id, bool strict) +js_ReportGetterOnlyAssignment(JSContext *cx, bool strict) { - RootedValue val(cx, IdToValue(id)); - return js_ReportValueErrorFlags(cx, - strict - ? JSREPORT_ERROR - : JSREPORT_WARNING | JSREPORT_STRICT, - JSMSG_GETTER_ONLY, - JSDVG_IGNORE_STACK, - val, - js::NullPtr(), - nullptr, nullptr); + return JS_ReportErrorFlagsAndNumber(cx, + strict + ? JSREPORT_ERROR + : JSREPORT_WARNING | JSREPORT_STRICT, + js_GetErrorMessage, nullptr, + JSMSG_GETTER_ONLY); } #ifdef DEBUG diff --git a/js/src/jsobj.h b/js/src/jsobj.h index d4dd2691dc6c..82499bef1e72 100644 --- a/js/src/jsobj.h +++ b/js/src/jsobj.h @@ -1598,7 +1598,7 @@ extern void js_GetObjectSlotName(JSTracer *trc, char *buf, size_t bufsize); extern bool -js_ReportGetterOnlyAssignment(JSContext *cx, jsid id, bool strict); +js_ReportGetterOnlyAssignment(JSContext *cx, bool strict); namespace js { diff --git a/js/src/vm/Shape-inl.h b/js/src/vm/Shape-inl.h index b022759fa39c..3ba80c17f049 100644 --- a/js/src/vm/Shape-inl.h +++ b/js/src/vm/Shape-inl.h @@ -96,7 +96,7 @@ Shape::set(JSContext* cx, HandleObject obj, HandleObject receiver, bool strict, } if (attrs & JSPROP_GETTER) - return js_ReportGetterOnlyAssignment(cx, propid(), strict); + return js_ReportGetterOnlyAssignment(cx, strict); RootedId id(cx, propid()); diff --git a/js/xpconnect/src/XPCQuickStubs.cpp b/js/xpconnect/src/XPCQuickStubs.cpp index ea117aaf6892..eb1ad532b60a 100644 --- a/js/xpconnect/src/XPCQuickStubs.cpp +++ b/js/xpconnect/src/XPCQuickStubs.cpp @@ -394,7 +394,7 @@ xpc_qsGetterOnlyNativeStub(JSContext *cx, unsigned argc, jsval *vp) JSREPORT_WARNING | JSREPORT_STRICT | JSREPORT_STRICT_MODE_ERROR, js_GetErrorMessage, nullptr, - JSMSG_GETTER_ONLY, ""); + JSMSG_GETTER_ONLY); } xpc_qsDOMString::xpc_qsDOMString(JSContext *cx, HandleValue v, From 864c184e3081e0cddf569e77afae218154e1df5f Mon Sep 17 00:00:00 2001 From: Brian Smith Date: Thu, 14 Aug 2014 12:02:55 -0700 Subject: [PATCH 49/63] bug 1045739 - (1/2) mozilla::pkix: stop checking revocation for expired certificates r=keeler --- security/pkix/lib/pkixbuild.cpp | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/security/pkix/lib/pkixbuild.cpp b/security/pkix/lib/pkixbuild.cpp index a4fbd66dceb4..5a3d9e1214e7 100644 --- a/security/pkix/lib/pkixbuild.cpp +++ b/security/pkix/lib/pkixbuild.cpp @@ -50,7 +50,7 @@ public: Time time, KeyPurposeId requiredEKUIfPresent, const CertPolicyId& requiredPolicy, /*optional*/ const Input* stapledOCSPResponse, - unsigned int subCACount) + unsigned int subCACount, Result deferredSubjectError) : trustDomain(trustDomain) , subject(subject) , time(time) @@ -58,6 +58,7 @@ public: , requiredPolicy(requiredPolicy) , stapledOCSPResponse(stapledOCSPResponse) , subCACount(subCACount) + , deferredSubjectError(deferredSubjectError) , result(Result::FATAL_ERROR_LIBRARY_FAILURE) , resultWasSet(false) { @@ -77,6 +78,7 @@ private: const CertPolicyId& requiredPolicy; /*optional*/ Input const* const stapledOCSPResponse; const unsigned int subCACount; + const Result deferredSubjectError; Result RecordResult(Result currentResult, /*out*/ bool& keepGoing); Result result; @@ -185,13 +187,19 @@ PathBuildingStep::Check(Input potentialIssuerDER, return RecordResult(rv, keepGoing); } - CertID certID(subject.GetIssuer(), potentialIssuer.GetSubjectPublicKeyInfo(), - subject.GetSerialNumber()); - rv = trustDomain.CheckRevocation(subject.endEntityOrCA, certID, time, - stapledOCSPResponse, - subject.GetAuthorityInfoAccess()); - if (rv != Success) { - return RecordResult(rv, keepGoing); + // We avoid doing revocation checking for expired certificates because OCSP + // responders are allowed to forget about expired certificates, and many OCSP + // responders return an error when asked for the status of an expired + // certificate. + if (deferredSubjectError != Result::ERROR_EXPIRED_CERTIFICATE) { + CertID certID(subject.GetIssuer(), potentialIssuer.GetSubjectPublicKeyInfo(), + subject.GetSerialNumber()); + rv = trustDomain.CheckRevocation(subject.endEntityOrCA, certID, time, + stapledOCSPResponse, + subject.GetAuthorityInfoAccess()); + if (rv != Success) { + return RecordResult(rv, keepGoing); + } } return RecordResult(Success, keepGoing); @@ -268,7 +276,8 @@ BuildForward(TrustDomain& trustDomain, PathBuildingStep pathBuilder(trustDomain, subject, time, requiredEKUIfPresent, requiredPolicy, - stapledOCSPResponse, subCACount); + stapledOCSPResponse, subCACount, + deferredEndEntityError); // TODO(bug 965136): Add SKI/AKI matching optimizations rv = trustDomain.FindIssuer(subject.GetIssuer(), pathBuilder, time); From 2f89ed329542a884c7824c406f0774b61859ad1d Mon Sep 17 00:00:00 2001 From: David Keeler Date: Wed, 1 Oct 2014 10:20:31 -0700 Subject: [PATCH 50/63] bug 1045739 - (part 2/2) mozilla::pkix: test that revocation checking doesn't occur for expired certificates r=mmc --- security/pkix/test/gtest/pkixbuild_tests.cpp | 118 +++++++++++++++++++ 1 file changed, 118 insertions(+) diff --git a/security/pkix/test/gtest/pkixbuild_tests.cpp b/security/pkix/test/gtest/pkixbuild_tests.cpp index f37fe3eeda9e..a7ac7dd4e49a 100644 --- a/security/pkix/test/gtest/pkixbuild_tests.cpp +++ b/security/pkix/test/gtest/pkixbuild_tests.cpp @@ -300,3 +300,121 @@ TEST_F(pkixbuild, BeyondMaxAcceptableCertChainLength) nullptr/*stapledOCSPResponse*/)); } } + +// A TrustDomain that explicitly fails if CheckRevocation is called. +// It is initialized with the DER encoding of a root certificate that +// is treated as a trust anchor and is assumed to have issued all certificates +// (i.e. FindIssuer always attempts to build the next step in the chain with +// it). +class ExpiredCertTrustDomain : public TrustDomain +{ +public: + ExpiredCertTrustDomain(ByteString rootDER) + : rootDER(rootDER) + { + } + + // The CertPolicyId argument is unused because we don't care about EV. + virtual Result GetCertTrust(EndEntityOrCA endEntityOrCA, const CertPolicyId&, + Input candidateCert, + /*out*/ TrustLevel& trustLevel) + { + Input rootCert; + Result rv = rootCert.Init(rootDER.data(), rootDER.length()); + if (rv != Success) { + return rv; + } + if (InputsAreEqual(candidateCert, rootCert)) { + trustLevel = TrustLevel::TrustAnchor; + } else { + trustLevel = TrustLevel::InheritsTrust; + } + return Success; + } + + virtual Result FindIssuer(Input encodedIssuerName, + IssuerChecker& checker, Time time) + { + // keepGoing is an out parameter from IssuerChecker.Check. It would tell us + // whether or not to continue attempting other potential issuers. We only + // know of one potential issuer, however, so we ignore it. + bool keepGoing; + Input rootCert; + Result rv = rootCert.Init(rootDER.data(), rootDER.length()); + if (rv != Success) { + return rv; + } + return checker.Check(rootCert, nullptr, keepGoing); + } + + virtual Result CheckRevocation(EndEntityOrCA, const CertID&, Time, + /*optional*/ const Input*, + /*optional*/ const Input*) + { + ADD_FAILURE(); + return Result::FATAL_ERROR_LIBRARY_FAILURE; + } + + virtual Result IsChainValid(const DERArray&, Time) + { + return Success; + } + + virtual Result VerifySignedData(const SignedDataWithSignature& signedData, + Input subjectPublicKeyInfo) + { + return ::mozilla::pkix::VerifySignedData(signedData, subjectPublicKeyInfo, + nullptr); + } + + virtual Result DigestBuf(Input, /*out*/uint8_t*, size_t) + { + ADD_FAILURE(); + return Result::FATAL_ERROR_LIBRARY_FAILURE; + } + + virtual Result CheckPublicKey(Input subjectPublicKeyInfo) + { + return TestCheckPublicKey(subjectPublicKeyInfo); + } + +private: + ByteString rootDER; +}; + +TEST_F(pkixbuild, NoRevocationCheckingForExpiredCert) +{ + const char* rootCN = "Root CA"; + ScopedTestKeyPair rootKey; + ByteString rootDER(CreateCert(rootCN, rootCN, EndEntityOrCA::MustBeCA, + nullptr, rootKey, nullptr)); + EXPECT_NE(ENCODING_FAILED, rootDER); + ExpiredCertTrustDomain expiredCertTrustDomain(rootDER); + + ByteString serialNumber(CreateEncodedSerialNumber(100)); + EXPECT_NE(ENCODING_FAILED, serialNumber); + ByteString issuerDER(CNToDERName(rootCN)); + EXPECT_NE(ENCODING_FAILED, issuerDER); + ByteString subjectDER(CNToDERName("Expired End-Entity Cert")); + EXPECT_NE(ENCODING_FAILED, subjectDER); + ScopedTestKeyPair unusedSubjectKey; + ByteString certDER(CreateEncodedCertificate( + v3, sha256WithRSAEncryption, + serialNumber, issuerDER, + oneDayBeforeNow - Time::ONE_DAY_IN_SECONDS, + oneDayBeforeNow, + subjectDER, nullptr, rootKey.get(), + SignatureAlgorithm::rsa_pkcs1_with_sha256, + unusedSubjectKey)); + EXPECT_NE(ENCODING_FAILED, certDER); + + Input cert; + ASSERT_EQ(Success, cert.Init(certDER.data(), certDER.length())); + ASSERT_EQ(Result::ERROR_EXPIRED_CERTIFICATE, + BuildCertChain(expiredCertTrustDomain, cert, Now(), + EndEntityOrCA::MustBeEndEntity, + KeyUsage::noParticularKeyUsageRequired, + KeyPurposeId::id_kp_serverAuth, + CertPolicyId::anyPolicy, + nullptr)); +} From 8c1ed009692c92201bfcfc68c17e42196d64dcd0 Mon Sep 17 00:00:00 2001 From: Bas Schouten Date: Wed, 1 Oct 2014 19:50:24 +0200 Subject: [PATCH 51/63] Bug 1075621: Support Direct2D 1.1 for ScaledFontDWrite::CopyGlyphsToBuilder. r=jrmuizel --- gfx/2d/ScaledFontDWrite.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gfx/2d/ScaledFontDWrite.cpp b/gfx/2d/ScaledFontDWrite.cpp index 41ea87453294..e1e1b7137f73 100644 --- a/gfx/2d/ScaledFontDWrite.cpp +++ b/gfx/2d/ScaledFontDWrite.cpp @@ -326,7 +326,7 @@ ScaledFontDWrite::GetPathForGlyphs(const GlyphBuffer &aBuffer, const DrawTarget void ScaledFontDWrite::CopyGlyphsToBuilder(const GlyphBuffer &aBuffer, PathBuilder *aBuilder, BackendType aBackendType, const Matrix *aTransformHint) { - if (aBackendType != BackendType::DIRECT2D) { + if (aBackendType != BackendType::DIRECT2D && aBackendType != BackendType::DIRECT2D1_1) { ScaledFontBase::CopyGlyphsToBuilder(aBuffer, aBuilder, aBackendType, aTransformHint); return; } From 34e15d49a413cd00514c7c6b3c1926adbdb3c950 Mon Sep 17 00:00:00 2001 From: Bas Schouten Date: Wed, 1 Oct 2014 19:50:24 +0200 Subject: [PATCH 52/63] Bug 1075615: Pretranslate the pattern matrix when the pattern specifies a sampling rect. r=jrmuizel --- gfx/2d/DrawTargetD2D1.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gfx/2d/DrawTargetD2D1.cpp b/gfx/2d/DrawTargetD2D1.cpp index e8084fcab093..44a39b77bb5e 100644 --- a/gfx/2d/DrawTargetD2D1.cpp +++ b/gfx/2d/DrawTargetD2D1.cpp @@ -1210,16 +1210,16 @@ DrawTargetD2D1::CreateBrushForPattern(const Pattern &aPattern, Float aAlpha) } D2D1_RECT_F samplingBounds; + Matrix mat = pat->mMatrix; if (!pat->mSamplingRect.IsEmpty()) { samplingBounds = D2DRect(pat->mSamplingRect); + mat.PreTranslate(pat->mSamplingRect.x, pat->mSamplingRect.y); } else { samplingBounds = D2D1::RectF(0, 0, Float(pat->mSurface->GetSize().width), Float(pat->mSurface->GetSize().height)); } - Matrix mat = pat->mMatrix; - RefPtr imageBrush; RefPtr image = GetImageForSurface(pat->mSurface, mat, pat->mExtendMode); mDC->CreateImageBrush(image, From e4844e6b2c0bb4bd1f6dce2f3c9423ffb4021b48 Mon Sep 17 00:00:00 2001 From: Bas Schouten Date: Wed, 1 Oct 2014 19:50:25 +0200 Subject: [PATCH 53/63] Bug 902952 - Part 1: Add a slight amount of fuzz for radial gradient tests. r=jrmuizel --- layout/reftests/css-gradients/reftest.list | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/layout/reftests/css-gradients/reftest.list b/layout/reftests/css-gradients/reftest.list index 0303c1218177..ddc4baabdd1a 100644 --- a/layout/reftests/css-gradients/reftest.list +++ b/layout/reftests/css-gradients/reftest.list @@ -95,11 +95,11 @@ fuzzy-if(Android,17,13320) == radial-shape-farthest-side-1c.html radial-shape-fa == repeating-linear-1a.html repeating-linear-1-ref.html == repeating-linear-1b.html repeating-linear-1-ref.html == repeating-linear-2a.html repeating-linear-2-ref.html -fuzzy-if(d2d,124,2612) == repeating-radial-1a.html repeating-radial-1-ref.html +fuzzy-if(d2d,127,2612) == repeating-radial-1a.html repeating-radial-1-ref.html == repeating-radial-1b.html repeating-radial-1-ref.html -fuzzy-if(d2d,124,2612) == repeating-radial-1c.html repeating-radial-1-ref.html +fuzzy-if(d2d,127,2612) == repeating-radial-1c.html repeating-radial-1-ref.html == repeating-radial-1d.html repeating-radial-1-ref.html -fuzzy-if(d2d,124,2612) == repeating-radial-1e.html repeating-radial-1-ref.html +fuzzy-if(d2d,127,2612) == repeating-radial-1e.html repeating-radial-1-ref.html == repeating-radial-1f.html repeating-radial-1-ref.html == repeating-radial-2a.html repeating-radial-2-ref.html == repeating-radial-2b.html repeating-radial-2-ref.html From 6176118a0a0b27a6996b71a2578ad3937e27baed Mon Sep 17 00:00:00 2001 From: Bas Schouten Date: Wed, 1 Oct 2014 19:50:25 +0200 Subject: [PATCH 54/63] Bug 902952 - Part 2: Use Direct2D 1.1 where available. r=jrmuizel --- modules/libpref/init/all.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/modules/libpref/init/all.js b/modules/libpref/init/all.js index bbc3779094e6..c8d94394495d 100644 --- a/modules/libpref/init/all.js +++ b/modules/libpref/init/all.js @@ -577,8 +577,8 @@ pref("gfx.font_rendering.opentype_svg.enabled", true); #ifdef XP_WIN // comma separated list of backends to use in order of preference // e.g., pref("gfx.canvas.azure.backends", "direct2d,skia,cairo"); -pref("gfx.canvas.azure.backends", "direct2d,skia,cairo"); -pref("gfx.content.azure.backends", "direct2d,cairo"); +pref("gfx.canvas.azure.backends", "direct2d1.1,direct2d,skia,cairo"); +pref("gfx.content.azure.backends", "direct2d1.1,direct2d,cairo"); #else #ifdef XP_MACOSX pref("gfx.content.azure.backends", "cg"); @@ -3899,6 +3899,7 @@ pref("gfx.xrender.enabled",true); #ifdef XP_WIN // Whether to disable the automatic detection and use of direct2d. pref("gfx.direct2d.disabled", false); +pref("gfx.direct2d.use1_1", true); // Whether to attempt to enable Direct2D regardless of automatic detection or // blacklisting From 4fe50667acbb5907390c6da3704212444a7ee517 Mon Sep 17 00:00:00 2001 From: Botond Ballo Date: Wed, 1 Oct 2014 13:26:37 -0400 Subject: [PATCH 55/63] Bug 1073618 - When starting a snap-back after a fling, only consider APZCs along the handoff chain from the flinging APZC onwards. r=kats --- gfx/layers/apz/src/APZCTreeManager.h | 2 -- gfx/layers/apz/src/AsyncPanZoomController.cpp | 3 ++- gfx/layers/apz/src/OverscrollHandoffState.cpp | 11 ++++++----- gfx/layers/apz/src/OverscrollHandoffState.h | 5 +++-- 4 files changed, 11 insertions(+), 10 deletions(-) diff --git a/gfx/layers/apz/src/APZCTreeManager.h b/gfx/layers/apz/src/APZCTreeManager.h index e5cdcdc4809b..2479ab573648 100644 --- a/gfx/layers/apz/src/APZCTreeManager.h +++ b/gfx/layers/apz/src/APZCTreeManager.h @@ -341,8 +341,6 @@ public: nsRefPtr aOverscrollHandoffChain, bool aHandoff); - void SnapBackOverscrolledApzc(AsyncPanZoomController* aStart); - /* * Build the chain of APZCs that will handle overscroll for a pan starting at |aInitialTarget|. */ diff --git a/gfx/layers/apz/src/AsyncPanZoomController.cpp b/gfx/layers/apz/src/AsyncPanZoomController.cpp index b45658aef75d..e477e3a0ae8b 100644 --- a/gfx/layers/apz/src/AsyncPanZoomController.cpp +++ b/gfx/layers/apz/src/AsyncPanZoomController.cpp @@ -520,7 +520,8 @@ public: // is this one, then the SetState(NOTHING) in UpdateAnimation will // stomp on the SetState(SNAP_BACK) it does. mDeferredTasks.append(NewRunnableMethod(mOverscrollHandoffChain.get(), - &OverscrollHandoffChain::SnapBackOverscrolledApzc)); + &OverscrollHandoffChain::SnapBackOverscrolledApzc, + &mApzc)); return false; } diff --git a/gfx/layers/apz/src/OverscrollHandoffState.cpp b/gfx/layers/apz/src/OverscrollHandoffState.cpp index 2dca96d70b80..4df47406a1c8 100644 --- a/gfx/layers/apz/src/OverscrollHandoffState.cpp +++ b/gfx/layers/apz/src/OverscrollHandoffState.cpp @@ -88,18 +88,19 @@ OverscrollHandoffChain::ClearOverscroll() const } void -OverscrollHandoffChain::SnapBackOverscrolledApzc() const +OverscrollHandoffChain::SnapBackOverscrolledApzc(const AsyncPanZoomController* aStart) const { - uint32_t i = 0; - for (i = 0; i < Length(); ++i) { + uint32_t i = IndexOf(aStart); + for (; i < Length(); ++i) { AsyncPanZoomController* apzc = mChain[i]; if (!apzc->IsDestroyed() && apzc->SnapBackIfOverscrolled()) { - // At most one APZC along the hand-off chain can be overscrolled. + // At most one APZC from |aStart| onwards can be overscrolled. break; } } - // In debug builds, verify our assumption that only one APZC is overscrolled. + // In debug builds, verify our assumption that only one APZC from |aStart| + // onwards is overscrolled. #ifdef DEBUG ++i; for (; i < Length(); ++i) { diff --git a/gfx/layers/apz/src/OverscrollHandoffState.h b/gfx/layers/apz/src/OverscrollHandoffState.h index a390db29dca9..06f50e53095b 100644 --- a/gfx/layers/apz/src/OverscrollHandoffState.h +++ b/gfx/layers/apz/src/OverscrollHandoffState.h @@ -98,8 +98,9 @@ public: // Clear overscroll all the way up the chain. void ClearOverscroll() const; - // Snap back the APZC that is overscrolled, if any. - void SnapBackOverscrolledApzc() const; + // Snap back the APZC that is overscrolled on the subset of the chain from + // |aStart| onwards, if any. + void SnapBackOverscrolledApzc(const AsyncPanZoomController* aStart) const; // Determine whether the given APZC, or any APZC further in the chain, // has room to be panned. From 80d061a15b4ffd146ed1343f7318e74650df7c39 Mon Sep 17 00:00:00 2001 From: Gokcehan Kara Date: Wed, 1 Oct 2014 20:59:15 +0200 Subject: [PATCH 56/63] Bug 1070689 - Change return type of dosprintf functions from int to bool (in jsprf.cpp). r=nbp --- js/src/jsprf.cpp | 211 +++++++++++++++++++---------------------------- 1 file changed, 86 insertions(+), 125 deletions(-) diff --git a/js/src/jsprf.cpp b/js/src/jsprf.cpp index 72bab4220619..42580fedf5e0 100644 --- a/js/src/jsprf.cpp +++ b/js/src/jsprf.cpp @@ -40,7 +40,7 @@ using namespace js; struct SprintfState { - int (*stuff)(SprintfState *ss, const char *sp, size_t len); + bool (*stuff)(SprintfState *ss, const char *sp, size_t len); char *base; char *cur; @@ -82,19 +82,18 @@ typedef mozilla::Vector NumArgStateVecto #define FLAG_ZEROS 0x8 #define FLAG_NEG 0x10 -inline int +inline bool generic_write(SprintfState *ss, const char *src, size_t srclen) { return (*ss->stuff)(ss, src, srclen); } -inline int +inline bool generic_write(SprintfState *ss, const char16_t *src, size_t srclen) { const size_t CHUNK_SIZE = 64; char chunk[CHUNK_SIZE]; - int rv = 0; size_t j = 0; size_t i = 0; while (i < srclen) { @@ -102,53 +101,48 @@ generic_write(SprintfState *ss, const char16_t *src, size_t srclen) chunk[j++] = char(src[i++]); if (j == CHUNK_SIZE || i == srclen) { - rv = (*ss->stuff)(ss, chunk, j); - if (rv != 0) - return rv; + if (!(*ss->stuff)(ss, chunk, j)) + return false; j = 0; } } - return 0; + return true; } // Fill into the buffer using the data in src template -static int +static bool fill2(SprintfState *ss, const Char *src, int srclen, int width, int flags) { char space = ' '; - int rv; width -= srclen; if (width > 0 && (flags & FLAG_LEFT) == 0) { // Right adjusting if (flags & FLAG_ZEROS) space = '0'; while (--width >= 0) { - rv = (*ss->stuff)(ss, &space, 1); - if (rv < 0) - return rv; + if (!(*ss->stuff)(ss, &space, 1)) + return false; } } // Copy out the source data - rv = generic_write(ss, src, srclen); - if (rv < 0) - return rv; + if (!generic_write(ss, src, srclen)) + return false; if (width > 0 && (flags & FLAG_LEFT) != 0) { // Left adjusting while (--width >= 0) { - rv = (*ss->stuff)(ss, &space, 1); - if (rv < 0) - return rv; + if (!(*ss->stuff)(ss, &space, 1)) + return false; } } - return 0; + return true; } /* * Fill a number. The order is: optional-sign zero-filling conversion-digits */ -static int +static bool fill_n(SprintfState *ss, const char *src, int srclen, int width, int prec, int type, int flags) { int zerowidth = 0; @@ -157,7 +151,6 @@ fill_n(SprintfState *ss, const char *src, int srclen, int width, int prec, int t int leftspaces = 0; int rightspaces = 0; int cvtwidth; - int rv; char sign; if ((type & 1) == 0) { @@ -200,54 +193,41 @@ fill_n(SprintfState *ss, const char *src, int srclen, int width, int prec, int t } } while (--leftspaces >= 0) { - rv = (*ss->stuff)(ss, " ", 1); - if (rv < 0) { - return rv; - } + if (!(*ss->stuff)(ss, " ", 1)) + return false; } if (signwidth) { - rv = (*ss->stuff)(ss, &sign, 1); - if (rv < 0) { - return rv; - } + if (!(*ss->stuff)(ss, &sign, 1)) + return false; } while (--precwidth >= 0) { - rv = (*ss->stuff)(ss, "0", 1); - if (rv < 0) { - return rv; - } + if (!(*ss->stuff)(ss, "0", 1)) + return false; } while (--zerowidth >= 0) { - rv = (*ss->stuff)(ss, "0", 1); - if (rv < 0) { - return rv; - } - } - rv = (*ss->stuff)(ss, src, uint32_t(srclen)); - if (rv < 0) { - return rv; + if (!(*ss->stuff)(ss, "0", 1)) + return false; } + if (!(*ss->stuff)(ss, src, uint32_t(srclen))) + return false; while (--rightspaces >= 0) { - rv = (*ss->stuff)(ss, " ", 1); - if (rv < 0) { - return rv; - } + if (!(*ss->stuff)(ss, " ", 1)) + return false; } - return 0; + return true; } /* Convert a long into its printable form. */ -static int cvt_l(SprintfState *ss, long num, int width, int prec, int radix, - int type, int flags, const char *hexp) +static bool cvt_l(SprintfState *ss, long num, int width, int prec, int radix, + int type, int flags, const char *hexp) { char cvtbuf[100]; char *cvt; int digits; // according to the man page this needs to happen - if ((prec == 0) && (num == 0)) { - return 0; - } + if ((prec == 0) && (num == 0)) + return true; // Converting decimal is a little tricky. In the unsigned case we // need to stop when we hit 10 digits. In the signed case, we can @@ -271,12 +251,12 @@ static int cvt_l(SprintfState *ss, long num, int width, int prec, int radix, } /* Convert a 64-bit integer into its printable form. */ -static int cvt_ll(SprintfState *ss, int64_t num, int width, int prec, int radix, - int type, int flags, const char *hexp) +static bool cvt_ll(SprintfState *ss, int64_t num, int width, int prec, int radix, + int type, int flags, const char *hexp) { // According to the man page, this needs to happen. if (prec == 0 && num == 0) - return 0; + return true; // Converting decimal is a little tricky. In the unsigned case we // need to stop when we hit 10 digits. In the signed case, we can @@ -309,7 +289,7 @@ static int cvt_ll(SprintfState *ss, int64_t num, int width, int prec, int radix, * * XXX stop using sprintf to convert floating point */ -static int cvt_f(SprintfState *ss, double d, const char *fmt0, const char *fmt1) +static bool cvt_f(SprintfState *ss, double d, const char *fmt0, const char *fmt1) { char fin[20]; char fout[300]; @@ -318,7 +298,7 @@ static int cvt_f(SprintfState *ss, double d, const char *fmt0, const char *fmt1) MOZ_ASSERT((amount > 0) && (amount < (int)sizeof(fin))); if (amount >= (int)sizeof(fin)) { // Totally bogus % command to sprintf. Just ignore it - return 0; + return true; } js_memcpy(fin, fmt0, (size_t)amount); fin[amount] = 0; @@ -355,11 +335,11 @@ static inline size_t generic_strlen(const char16_t *s) { return js_strlen(s); } * where -1 means until NUL. */ template -static int +static bool cvt_s(SprintfState *ss, const Char *s, int width, int prec, int flags) { if (prec == 0) - return 0; + return true; if (!s) s = generic_null_str(s); @@ -590,7 +570,7 @@ BuildArgArray(const char *fmt, va_list ap, NumArgStateVector& nas) /* * The workhorse sprintf code. */ -static int +static bool dosprintf(SprintfState *ss, const char *fmt, va_list ap) { char c; @@ -610,7 +590,7 @@ dosprintf(SprintfState *ss, const char *fmt, va_list ap) static const char hex[] = "0123456789abcdef"; static const char HEX[] = "0123456789ABCDEF"; const char *hexp; - int rv, i; + int i; char pattern[20]; const char *dolPt = nullptr; // in "%4$.2f", dolPt will point to '.' @@ -621,15 +601,14 @@ dosprintf(SprintfState *ss, const char *fmt, va_list ap) if (!BuildArgArray(fmt, ap, nas)) { // the fmt contains error Numbered Argument format, jliu@netscape.com MOZ_ASSERT(0); - return rv; + return false; } while ((c = *fmt++) != 0) { if (c != '%') { - rv = (*ss->stuff)(ss, fmt - 1, 1); - if (rv < 0) { - return rv; - } + if (!(*ss->stuff)(ss, fmt - 1, 1)) + return false; + continue; } fmt0 = fmt - 1; @@ -640,10 +619,9 @@ dosprintf(SprintfState *ss, const char *fmt, va_list ap) c = *fmt++; if (c == '%') { // quoting a % with %% - rv = (*ss->stuff)(ss, fmt - 1, 1); - if (rv < 0) { - return rv; - } + if (!(*ss->stuff)(ss, fmt - 1, 1)) + return false; + continue; } @@ -656,7 +634,7 @@ dosprintf(SprintfState *ss, const char *fmt, va_list ap) } if (nas[i - 1].type == TYPE_UNKNOWN) - return -1; + return false; ap = nas[i - 1].ap; dolPt = fmt; @@ -785,10 +763,9 @@ dosprintf(SprintfState *ss, const char *fmt, va_list ap) case TYPE_UINT32: u.l = (long)va_arg(ap, uint32_t); do_long: - rv = cvt_l(ss, u.l, width, prec, radix, type, flags, hexp); - if (rv < 0) { - return rv; - } + if (!cvt_l(ss, u.l, width, prec, radix, type, flags, hexp)) + return false; + break; case TYPE_INT64: @@ -801,10 +778,9 @@ dosprintf(SprintfState *ss, const char *fmt, va_list ap) case TYPE_UINT64: u.ll = va_arg(ap, uint64_t); do_longlong: - rv = cvt_ll(ss, u.ll, width, prec, radix, type, flags, hexp); - if (rv < 0) { - return rv; - } + if (!cvt_ll(ss, u.ll, width, prec, radix, type, flags, hexp)) + return false; + break; } break; @@ -819,41 +795,35 @@ dosprintf(SprintfState *ss, const char *fmt, va_list ap) if (i < int(sizeof(pattern))) { pattern[0] = '%'; js_memcpy(&pattern[1], dolPt, size_t(i)); - rv = cvt_f(ss, u.d, pattern, &pattern[i + 1]); + if (!cvt_f(ss, u.d, pattern, &pattern[i + 1])) + return false; } - } else - rv = cvt_f(ss, u.d, fmt0, fmt); - - if (rv < 0) { - return rv; + } else { + if (!cvt_f(ss, u.d, fmt0, fmt)) + return false; } + break; case 'c': if ((flags & FLAG_LEFT) == 0) { while (width-- > 1) { - rv = (*ss->stuff)(ss, " ", 1); - if (rv < 0) { - return rv; - } + if (!(*ss->stuff)(ss, " ", 1)) + return false; } } switch (type) { case TYPE_INT16: case TYPE_INTN: u.ch = va_arg(ap, int); - rv = (*ss->stuff)(ss, &u.ch, 1); + if (!(*ss->stuff)(ss, &u.ch, 1)) + return false; break; } - if (rv < 0) { - return rv; - } if (flags & FLAG_LEFT) { while (width-- > 1) { - rv = (*ss->stuff)(ss, " ", 1); - if (rv < 0) { - return rv; - } + if (!(*ss->stuff)(ss, " ", 1)) + return false; } } break; @@ -885,13 +855,12 @@ dosprintf(SprintfState *ss, const char *fmt, va_list ap) case 's': if(type == TYPE_INT16) { u.ws = va_arg(ap, const char16_t*); - rv = cvt_s(ss, u.ws, width, prec, flags); + if (!cvt_s(ss, u.ws, width, prec, flags)) + return false; } else { u.s = va_arg(ap, const char*); - rv = cvt_s(ss, u.s, width, prec, flags); - } - if (rv < 0) { - return rv; + if (!cvt_s(ss, u.s, width, prec, flags)) + return false; } break; @@ -907,21 +876,18 @@ dosprintf(SprintfState *ss, const char *fmt, va_list ap) #if 0 MOZ_ASSERT(0); #endif - rv = (*ss->stuff)(ss, "%", 1); - if (rv < 0) { - return rv; - } - rv = (*ss->stuff)(ss, fmt - 1, 1); - if (rv < 0) { - return rv; - } + if (!(*ss->stuff)(ss, "%", 1)) + return false; + if (!(*ss->stuff)(ss, fmt - 1, 1)) + return false; } } // Stuff trailing NUL - rv = (*ss->stuff)(ss, "\0", 1); + if (!(*ss->stuff)(ss, "\0", 1)) + return false; - return rv; + return true; } /************************************************************************/ @@ -930,7 +896,7 @@ dosprintf(SprintfState *ss, const char *fmt, va_list ap) * Stuff routine that automatically grows the js_malloc'd output buffer * before it overflows. */ -static int +static bool GrowStuff(SprintfState *ss, const char *sp, size_t len) { ptrdiff_t off; @@ -944,7 +910,7 @@ GrowStuff(SprintfState *ss, const char *sp, size_t len) newbase = static_cast(js_realloc(ss->base, newlen)); if (!newbase) { /* Ran out of memory */ - return -1; + return false; } ss->base = newbase; ss->maxlen = newlen; @@ -957,7 +923,7 @@ GrowStuff(SprintfState *ss, const char *sp, size_t len) *ss->cur++ = *sp++; } MOZ_ASSERT(size_t(ss->cur - ss->base) <= ss->maxlen); - return 0; + return true; } /* @@ -988,14 +954,12 @@ JS_PUBLIC_API(char *) JS_vsmprintf(const char *fmt, va_list ap) { SprintfState ss; - int rv; ss.stuff = GrowStuff; ss.base = 0; ss.cur = 0; ss.maxlen = 0; - rv = dosprintf(&ss, fmt, ap); - if (rv < 0) { + if (!dosprintf(&ss, fmt, ap)) { js_free(ss.base); return 0; } @@ -1005,7 +969,7 @@ JS_vsmprintf(const char *fmt, va_list ap) /* * Stuff routine that discards overflow data */ -static int +static bool LimitStuff(SprintfState *ss, const char *sp, size_t len) { size_t limit = ss->maxlen - (ss->cur - ss->base); @@ -1016,7 +980,7 @@ LimitStuff(SprintfState *ss, const char *sp, size_t len) --len; *ss->cur++ = *sp++; } - return 0; + return true; } /* @@ -1046,9 +1010,8 @@ JS_vsnprintf(char *out, uint32_t outlen, const char *fmt, va_list ap) uint32_t n; MOZ_ASSERT(int32_t(outlen) > 0); - if (int32_t(outlen) <= 0) { + if (int32_t(outlen) <= 0) return 0; - } ss.stuff = LimitStuff; ss.base = out; @@ -1080,7 +1043,6 @@ JS_PUBLIC_API(char *) JS_vsprintf_append(char *last, const char *fmt, va_list ap) { SprintfState ss; - int rv; ss.stuff = GrowStuff; if (last) { @@ -1093,8 +1055,7 @@ JS_vsprintf_append(char *last, const char *fmt, va_list ap) ss.cur = 0; ss.maxlen = 0; } - rv = dosprintf(&ss, fmt, ap); - if (rv < 0) { + if (!dosprintf(&ss, fmt, ap)) { js_free(ss.base); return 0; } From b2c88c5dfe4e5699c3584afaf556b8c5c22143ef Mon Sep 17 00:00:00 2001 From: Jonathan Kew Date: Wed, 1 Oct 2014 20:25:48 +0100 Subject: [PATCH 57/63] Bug 902762 pt 1 - Pass a 'vertical' flag to font shapers, and support vertical shaping through harfbuzz. r=jdaggett --- gfx/thebes/gfxCoreTextShaper.cpp | 1 + gfx/thebes/gfxCoreTextShaper.h | 1 + gfx/thebes/gfxDWriteFonts.cpp | 7 +- gfx/thebes/gfxFT2Fonts.cpp | 3 +- gfx/thebes/gfxFT2Fonts.h | 1 + gfx/thebes/gfxFont.cpp | 76 +++-- gfx/thebes/gfxFont.h | 9 +- gfx/thebes/gfxFontUtils.h | 7 +- gfx/thebes/gfxGDIFont.cpp | 3 +- gfx/thebes/gfxGDIFont.h | 1 + gfx/thebes/gfxGraphiteShaper.cpp | 1 + gfx/thebes/gfxGraphiteShaper.h | 1 + gfx/thebes/gfxHarfBuzzShaper.cpp | 460 +++++++++++++++++++++++-------- gfx/thebes/gfxHarfBuzzShaper.h | 58 +++- gfx/thebes/gfxMacFont.cpp | 10 +- gfx/thebes/gfxMacFont.h | 1 + gfx/thebes/gfxTextRun.cpp | 15 +- layout/media/symbols.def.in | 3 + 18 files changed, 492 insertions(+), 166 deletions(-) diff --git a/gfx/thebes/gfxCoreTextShaper.cpp b/gfx/thebes/gfxCoreTextShaper.cpp index 93fe5a477976..7ab77f9d944e 100644 --- a/gfx/thebes/gfxCoreTextShaper.cpp +++ b/gfx/thebes/gfxCoreTextShaper.cpp @@ -52,6 +52,7 @@ gfxCoreTextShaper::ShapeText(gfxContext *aContext, uint32_t aOffset, uint32_t aLength, int32_t aScript, + bool aVertical, gfxShapedText *aShapedText) { // Create a CFAttributedString with text and style info, so we can use CoreText to lay it out. diff --git a/gfx/thebes/gfxCoreTextShaper.h b/gfx/thebes/gfxCoreTextShaper.h index 75f341554d52..21f6d4770b5e 100644 --- a/gfx/thebes/gfxCoreTextShaper.h +++ b/gfx/thebes/gfxCoreTextShaper.h @@ -23,6 +23,7 @@ public: uint32_t aOffset, uint32_t aLength, int32_t aScript, + bool aVertical, gfxShapedText *aShapedText); // clean up static objects that may have been cached diff --git a/gfx/thebes/gfxDWriteFonts.cpp b/gfx/thebes/gfxDWriteFonts.cpp index c15ada25df8a..656795c7bc50 100644 --- a/gfx/thebes/gfxDWriteFonts.cpp +++ b/gfx/thebes/gfxDWriteFonts.cpp @@ -219,9 +219,10 @@ gfxDWriteFont::ComputeMetrics(AntialiasOption anAAOption) TRUETYPE_TAG('h','h','e','a')); if (hheaTable) { uint32_t len; - const HheaTable* hhea = - reinterpret_cast(hb_blob_get_data(hheaTable, &len)); - if (len >= sizeof(HheaTable)) { + const MetricsHeader* hhea = + reinterpret_cast + (hb_blob_get_data(hheaTable, &len)); + if (len >= sizeof(MetricsHeader)) { mMetrics->maxAdvance = uint16_t(hhea->advanceWidthMax) * mFUnitsConvFactor; } diff --git a/gfx/thebes/gfxFT2Fonts.cpp b/gfx/thebes/gfxFT2Fonts.cpp index f6e875efddff..1ba7cabffe20 100644 --- a/gfx/thebes/gfxFT2Fonts.cpp +++ b/gfx/thebes/gfxFT2Fonts.cpp @@ -48,10 +48,11 @@ gfxFT2Font::ShapeText(gfxContext *aContext, uint32_t aOffset, uint32_t aLength, int32_t aScript, + bool aVertical, gfxShapedText *aShapedText) { if (!gfxFont::ShapeText(aContext, aText, aOffset, aLength, aScript, - aShapedText)) { + aVertical, aShapedText)) { // harfbuzz must have failed(?!), just render raw glyphs AddRange(aText, aOffset, aLength, aShapedText); PostShapingFixup(aContext, aText, aOffset, aLength, aShapedText); diff --git a/gfx/thebes/gfxFT2Fonts.h b/gfx/thebes/gfxFT2Fonts.h index f0e390c5a60c..a0db69946a28 100644 --- a/gfx/thebes/gfxFT2Fonts.h +++ b/gfx/thebes/gfxFT2Fonts.h @@ -77,6 +77,7 @@ protected: uint32_t aOffset, uint32_t aLength, int32_t aScript, + bool aVertical, gfxShapedText *aShapedText); void FillGlyphDataForChar(uint32_t ch, CachedGlyphData *gd); diff --git a/gfx/thebes/gfxFont.cpp b/gfx/thebes/gfxFont.cpp index 3a4b81ab1075..4988efd6ab95 100644 --- a/gfx/thebes/gfxFont.cpp +++ b/gfx/thebes/gfxFont.cpp @@ -2214,6 +2214,7 @@ gfxFont::GetShapedWord(gfxContext *aContext, uint32_t aLength, uint32_t aHash, int32_t aRunScript, + bool aVertical, int32_t aAppUnitsPerDevUnit, uint32_t aFlags, gfxTextPerfMetrics *aTextPerf GFX_MAYBE_UNUSED) @@ -2273,7 +2274,7 @@ gfxFont::GetShapedWord(gfxContext *aContext, } DebugOnly ok = - ShapeText(aContext, aText, 0, aLength, aRunScript, sw); + ShapeText(aContext, aText, 0, aLength, aRunScript, aVertical, sw); NS_WARN_IF_FALSE(ok, "failed to shape word - expect garbled text"); @@ -2323,6 +2324,7 @@ gfxFont::ShapeText(gfxContext *aContext, uint32_t aOffset, uint32_t aLength, int32_t aScript, + bool aVertical, gfxShapedText *aShapedText) { nsDependentCSubstring ascii((const char*)aText, aLength); @@ -2332,7 +2334,7 @@ gfxFont::ShapeText(gfxContext *aContext, return false; } return ShapeText(aContext, utf16.BeginReading(), aOffset, aLength, - aScript, aShapedText); + aScript, aVertical, aShapedText); } bool @@ -2341,17 +2343,20 @@ gfxFont::ShapeText(gfxContext *aContext, uint32_t aOffset, uint32_t aLength, int32_t aScript, + bool aVertical, gfxShapedText *aShapedText) { bool ok = false; - if (FontCanSupportGraphite()) { + // XXX Currently, we do all vertical shaping through harfbuzz. + // Vertical graphite support may be wanted as a future enhancement. + if (FontCanSupportGraphite() && !aVertical) { if (gfxPlatform::GetPlatform()->UseGraphiteShaping()) { if (!mGraphiteShaper) { mGraphiteShaper = new gfxGraphiteShaper(this); } ok = mGraphiteShaper->ShapeText(aContext, aText, aOffset, aLength, - aScript, aShapedText); + aScript, aVertical, aShapedText); } } @@ -2360,7 +2365,7 @@ gfxFont::ShapeText(gfxContext *aContext, mHarfBuzzShaper = new gfxHarfBuzzShaper(this); } ok = mHarfBuzzShaper->ShapeText(aContext, aText, aOffset, aLength, - aScript, aShapedText); + aScript, aVertical, aShapedText); } NS_WARN_IF_FALSE(ok, "shaper failed, expect scrambled or missing text"); @@ -2397,6 +2402,7 @@ gfxFont::ShapeFragmentWithoutWordCache(gfxContext *aContext, uint32_t aOffset, uint32_t aLength, int32_t aScript, + bool aVertical, gfxTextRun *aTextRun) { aTextRun->SetupClusterBoundaries(aOffset, aText, aLength); @@ -2432,7 +2438,8 @@ gfxFont::ShapeFragmentWithoutWordCache(gfxContext *aContext, } } - ok = ShapeText(aContext, aText, aOffset, fragLen, aScript, aTextRun); + ok = ShapeText(aContext, aText, aOffset, fragLen, aScript, aVertical, + aTextRun); aText += fragLen; aOffset += fragLen; @@ -2460,6 +2467,7 @@ gfxFont::ShapeTextWithoutWordCache(gfxContext *aContext, uint32_t aOffset, uint32_t aLength, int32_t aScript, + bool aVertical, gfxTextRun *aTextRun) { uint32_t fragStart = 0; @@ -2478,7 +2486,7 @@ gfxFont::ShapeTextWithoutWordCache(gfxContext *aContext, if (length > 0) { ok = ShapeFragmentWithoutWordCache(aContext, aText + fragStart, aOffset + fragStart, length, - aScript, aTextRun); + aScript, aVertical, aTextRun); } if (i == aLength) { @@ -2534,7 +2542,8 @@ gfxFont::SplitAndInitTextRun(gfxContext *aContext, const T *aString, // text for this font run uint32_t aRunStart, // position in the textrun uint32_t aRunLength, - int32_t aRunScript) + int32_t aRunScript, + bool aVertical) { if (aRunLength == 0) { return true; @@ -2569,7 +2578,8 @@ gfxFont::SplitAndInitTextRun(gfxContext *aContext, HasSpaces(aString, aRunLength)) { TEXT_PERF_INCR(tp, wordCacheSpaceRules); return ShapeTextWithoutWordCache(aContext, aString, - aRunStart, aRunLength, aRunScript, + aRunStart, aRunLength, + aRunScript, aVertical, aTextRun); } } @@ -2622,6 +2632,7 @@ gfxFont::SplitAndInitTextRun(gfxContext *aContext, aRunStart + wordStart, length, aRunScript, + aVertical, aTextRun); if (!ok) { return false; @@ -2638,7 +2649,7 @@ gfxFont::SplitAndInitTextRun(gfxContext *aContext, } gfxShapedWord *sw = GetShapedWord(aContext, aString + wordStart, length, - hash, aRunScript, + hash, aRunScript, aVertical, appUnitsPerDevUnit, wordFlags, tp); if (sw) { @@ -2652,7 +2663,9 @@ gfxFont::SplitAndInitTextRun(gfxContext *aContext, // word was terminated by a space: add that to the textrun uint16_t orientation = flags & gfxTextRunFactory::TEXT_ORIENT_MASK; if (orientation == gfxTextRunFactory::TEXT_ORIENT_VERTICAL_MIXED) { - orientation = gfxTextRunFactory::TEXT_ORIENT_VERTICAL_UPRIGHT; + orientation = aVertical ? + gfxTextRunFactory::TEXT_ORIENT_VERTICAL_UPRIGHT : + gfxTextRunFactory::TEXT_ORIENT_VERTICAL_SIDEWAYS_RIGHT; } if (!aTextRun->SetSpaceGlyphIfSimple(this, aContext, aRunStart + i, ch, @@ -2662,7 +2675,7 @@ gfxFont::SplitAndInitTextRun(gfxContext *aContext, gfxShapedWord *sw = GetShapedWord(aContext, &space, 1, - gfxShapedWord::HashMix(0, ' '), aRunScript, + gfxShapedWord::HashMix(0, ' '), aRunScript, aVertical, appUnitsPerDevUnit, flags | gfxTextRunFactory::TEXT_IS_8BIT, tp); if (sw) { @@ -2711,15 +2724,17 @@ gfxFont::SplitAndInitTextRun(gfxContext *aContext, const uint8_t *aString, uint32_t aRunStart, uint32_t aRunLength, - int32_t aRunScript); + int32_t aRunScript, + bool aVertical); template bool gfxFont::SplitAndInitTextRun(gfxContext *aContext, gfxTextRun *aTextRun, const char16_t *aString, uint32_t aRunStart, uint32_t aRunLength, - int32_t aRunScript); - + int32_t aRunScript, + bool aVertical); + template<> bool gfxFont::InitFakeSmallCapsRun(gfxContext *aContext, @@ -2745,6 +2760,8 @@ gfxFont::InitFakeSmallCapsRun(gfxContext *aContext, RunCaseAction runAction = kNoChange; uint32_t runStart = 0; + bool vertical = + aOrientation == gfxTextRunFactory::TEXT_ORIENT_VERTICAL_UPRIGHT; for (uint32_t i = 0; i <= aLength; ++i) { uint32_t extraCodeUnits = 0; // Will be set to 1 if we need to consume @@ -2803,7 +2820,7 @@ gfxFont::InitFakeSmallCapsRun(gfxContext *aContext, if (!f->SplitAndInitTextRun(aContext, aTextRun, aText + runStart, aOffset + runStart, runLength, - aScript)) { + aScript, vertical)) { ok = false; } break; @@ -2844,7 +2861,7 @@ gfxFont::InitFakeSmallCapsRun(gfxContext *aContext, if (!f->SplitAndInitTextRun(aContext, tempRun, convertedString.BeginReading(), 0, convertedString.Length(), - aScript)) { + aScript, vertical)) { ok = false; } else { nsAutoPtr mergedRun; @@ -2863,7 +2880,7 @@ gfxFont::InitFakeSmallCapsRun(gfxContext *aContext, if (!f->SplitAndInitTextRun(aContext, aTextRun, convertedString.BeginReading(), aOffset + runStart, runLength, - aScript)) { + aScript, vertical)) { ok = false; } } @@ -3024,9 +3041,10 @@ gfxFont::InitMetricsFromSfntTables(Metrics& aMetrics) if (!hheaTable) { return false; // no 'hhea' table -> not an sfnt } - const HheaTable* hhea = - reinterpret_cast(hb_blob_get_data(hheaTable, &len)); - if (len < sizeof(HheaTable)) { + const MetricsHeader* hhea = + reinterpret_cast + (hb_blob_get_data(hheaTable, &len)); + if (len < sizeof(MetricsHeader)) { return false; } @@ -3272,10 +3290,10 @@ gfxFont::CreateVerticalMetrics() if (!metrics->aveCharWidth) { gfxFontEntry::AutoTable hheaTable(mFontEntry, kHheaTableTag); if (hheaTable) { - const HheaTable* hhea = - reinterpret_cast(hb_blob_get_data(hheaTable, - &len)); - if (len >= sizeof(HheaTable)) { + const MetricsHeader* hhea = + reinterpret_cast + (hb_blob_get_data(hheaTable, &len)); + if (len >= sizeof(MetricsHeader)) { SET_SIGNED(aveCharWidth, int16_t(hhea->ascender) - int16_t(hhea->descender)); metrics->maxAscent = metrics->aveCharWidth / 2; @@ -3288,10 +3306,10 @@ gfxFont::CreateVerticalMetrics() // Read real vertical metrics if available. gfxFontEntry::AutoTable vheaTable(mFontEntry, kVheaTableTag); if (vheaTable) { - const HheaTable* vhea = - reinterpret_cast(hb_blob_get_data(vheaTable, - &len)); - if (len >= sizeof(HheaTable)) { + const MetricsHeader* vhea = + reinterpret_cast + (hb_blob_get_data(vheaTable, &len)); + if (len >= sizeof(MetricsHeader)) { SET_UNSIGNED(maxAdvance, vhea->advanceWidthMax); SET_SIGNED(maxAscent, vhea->ascender); SET_SIGNED(maxDescent, -int16_t(vhea->descender)); diff --git a/gfx/thebes/gfxFont.h b/gfx/thebes/gfxFont.h index f92e4f48ecf2..d439bf0d122b 100644 --- a/gfx/thebes/gfxFont.h +++ b/gfx/thebes/gfxFont.h @@ -610,6 +610,7 @@ public: uint32_t aOffset, uint32_t aLength, int32_t aScript, + bool aVertical, gfxShapedText *aShapedText) = 0; gfxFont *GetFont() const { return mFont; } @@ -1630,7 +1631,8 @@ public: const T *aString, uint32_t aRunStart, uint32_t aRunLength, - int32_t aRunScript); + int32_t aRunScript, + bool aVertical); // Get a ShapedWord representing the given text (either 8- or 16-bit) // for use in setting up a gfxTextRun. @@ -1640,6 +1642,7 @@ public: uint32_t aLength, uint32_t aHash, int32_t aRunScript, + bool aVertical, int32_t aAppUnitsPerDevUnit, uint32_t aFlags, gfxTextPerfMetrics *aTextPerf); @@ -1816,6 +1819,7 @@ protected: uint32_t aOffset, // dest offset in gfxShapedText uint32_t aLength, int32_t aScript, + bool aVertical, gfxShapedText *aShapedText); // where to store the result // Call the appropriate shaper to generate glyphs for aText and store @@ -1825,6 +1829,7 @@ protected: uint32_t aOffset, uint32_t aLength, int32_t aScript, + bool aVertical, gfxShapedText *aShapedText); // Helper to adjust for synthetic bold and set character-type flags @@ -1849,6 +1854,7 @@ protected: uint32_t aOffset, uint32_t aLength, int32_t aScript, + bool aVertical, gfxTextRun *aTextRun); // Shape a fragment of text (a run that is known to contain only @@ -1862,6 +1868,7 @@ protected: uint32_t aOffset, uint32_t aLength, int32_t aScript, + bool aVertical, gfxTextRun *aTextRun); void CheckForFeaturesInvolvingSpace(); diff --git a/gfx/thebes/gfxFontUtils.h b/gfx/thebes/gfxFontUtils.h index c783caefae00..439752cae4da 100644 --- a/gfx/thebes/gfxFontUtils.h +++ b/gfx/thebes/gfxFontUtils.h @@ -553,7 +553,10 @@ struct PostTable { AutoSwap_PRUint32 maxMemType1; }; -struct HheaTable { +// This structure is used for both 'hhea' and 'vhea' tables. +// The field names here are those of the horizontal version; the +// vertical table just exchanges vertical and horizontal coordinates. +struct MetricsHeader { AutoSwap_PRUint32 version; AutoSwap_PRInt16 ascender; AutoSwap_PRInt16 descender; @@ -570,7 +573,7 @@ struct HheaTable { AutoSwap_PRInt16 reserved3; AutoSwap_PRInt16 reserved4; AutoSwap_PRInt16 metricDataFormat; - AutoSwap_PRUint16 numOfLongHorMetrics; + AutoSwap_PRUint16 numOfLongMetrics; }; struct MaxpTableHeader { diff --git a/gfx/thebes/gfxGDIFont.cpp b/gfx/thebes/gfxGDIFont.cpp index 70c02a2da3be..238b1eded7ac 100644 --- a/gfx/thebes/gfxGDIFont.cpp +++ b/gfx/thebes/gfxGDIFont.cpp @@ -83,6 +83,7 @@ gfxGDIFont::ShapeText(gfxContext *aContext, uint32_t aOffset, uint32_t aLength, int32_t aScript, + bool aVertical, gfxShapedText *aShapedText) { if (!mMetrics) { @@ -102,7 +103,7 @@ gfxGDIFont::ShapeText(gfxContext *aContext, } return gfxFont::ShapeText(aContext, aText, aOffset, aLength, aScript, - aShapedText); + aVertical, aShapedText); } const gfxFont::Metrics& diff --git a/gfx/thebes/gfxGDIFont.h b/gfx/thebes/gfxGDIFont.h index 4b5e15a3226c..2e320eccc5f4 100644 --- a/gfx/thebes/gfxGDIFont.h +++ b/gfx/thebes/gfxGDIFont.h @@ -77,6 +77,7 @@ protected: uint32_t aOffset, uint32_t aLength, int32_t aScript, + bool aVertical, gfxShapedText *aShapedText); void Initialize(); // creates metrics and Cairo fonts diff --git a/gfx/thebes/gfxGraphiteShaper.cpp b/gfx/thebes/gfxGraphiteShaper.cpp index 076b3df92552..62c74c24563f 100644 --- a/gfx/thebes/gfxGraphiteShaper.cpp +++ b/gfx/thebes/gfxGraphiteShaper.cpp @@ -89,6 +89,7 @@ gfxGraphiteShaper::ShapeText(gfxContext *aContext, uint32_t aOffset, uint32_t aLength, int32_t aScript, + bool aVertical, gfxShapedText *aShapedText) { // some font back-ends require this in order to get proper hinted metrics diff --git a/gfx/thebes/gfxGraphiteShaper.h b/gfx/thebes/gfxGraphiteShaper.h index b9941ae47074..8127a8405635 100644 --- a/gfx/thebes/gfxGraphiteShaper.h +++ b/gfx/thebes/gfxGraphiteShaper.h @@ -22,6 +22,7 @@ public: uint32_t aOffset, uint32_t aLength, int32_t aScript, + bool aVertical, gfxShapedText *aShapedText); static void Shutdown(); diff --git a/gfx/thebes/gfxHarfBuzzShaper.cpp b/gfx/thebes/gfxHarfBuzzShaper.cpp index bbf4b8a2ead9..99a74e83778d 100644 --- a/gfx/thebes/gfxHarfBuzzShaper.cpp +++ b/gfx/thebes/gfxHarfBuzzShaper.cpp @@ -39,14 +39,18 @@ gfxHarfBuzzShaper::gfxHarfBuzzShaper(gfxFont *aFont) mHBFont(nullptr), mKernTable(nullptr), mHmtxTable(nullptr), - mNumLongMetrics(0), + mVmtxTable(nullptr), + mVORGTable(nullptr), mCmapTable(nullptr), mCmapFormat(-1), mSubtableOffset(0), mUVSTableOffset(0), + mNumLongHMetrics(0), + mNumLongVMetrics(0), mUseFontGetGlyph(aFont->ProvidesGetGlyph()), mUseFontGlyphWidths(false), - mInitialized(false) + mInitialized(false), + mVerticalInitialized(false) { } @@ -166,30 +170,15 @@ HBGetGlyph(hb_font_t *font, void *font_data, return *glyph != 0; } -struct HMetricsHeader { - AutoSwap_PRUint32 tableVersionNumber; - AutoSwap_PRInt16 ascender; - AutoSwap_PRInt16 descender; - AutoSwap_PRInt16 lineGap; - AutoSwap_PRUint16 advanceWidthMax; - AutoSwap_PRInt16 minLeftSideBearing; - AutoSwap_PRInt16 minRightSideBearing; - AutoSwap_PRInt16 xMaxExtent; - AutoSwap_PRInt16 caretSlopeRise; - AutoSwap_PRInt16 caretSlopeRun; - AutoSwap_PRInt16 caretOffset; - AutoSwap_PRInt16 reserved[4]; - AutoSwap_PRInt16 metricDataFormat; - AutoSwap_PRUint16 numberOfHMetrics; +// Glyph metrics structures, shared (with appropriate reinterpretation of +// field names) by horizontal and vertical metrics tables. +struct LongMetric { + AutoSwap_PRUint16 advanceWidth; // or advanceHeight, when vertical + AutoSwap_PRInt16 lsb; // or tsb, when vertical }; -struct HLongMetric { - AutoSwap_PRUint16 advanceWidth; - AutoSwap_PRInt16 lsb; -}; - -struct HMetrics { - HLongMetric metrics[1]; // actually numberOfHMetrics +struct GlyphMetrics { + LongMetric metrics[1]; // actually numberOfLongMetrics // the variable-length metrics[] array is immediately followed by: // AutoSwap_PRUint16 leftSideBearing[]; }; @@ -198,23 +187,51 @@ hb_position_t gfxHarfBuzzShaper::GetGlyphHAdvance(gfxContext *aContext, hb_codepoint_t glyph) const { - // font did not implement GetHintedGlyphWidth, so get an unhinted value + // font did not implement GetGlyphWidth, so get an unhinted value // directly from the font tables - NS_ASSERTION((mNumLongMetrics > 0) && mHmtxTable != nullptr, + NS_ASSERTION((mNumLongHMetrics > 0) && mHmtxTable != nullptr, "font is lacking metrics, we shouldn't be here"); - if (glyph >= uint32_t(mNumLongMetrics)) { - glyph = mNumLongMetrics - 1; + if (glyph >= uint32_t(mNumLongHMetrics)) { + glyph = mNumLongHMetrics - 1; } // glyph must be valid now, because we checked during initialization - // that mNumLongMetrics is > 0, and that the hmtx table is large enough - // to contain mNumLongMetrics records - const HMetrics* hmtx = - reinterpret_cast(hb_blob_get_data(mHmtxTable, nullptr)); + // that mNumLongHMetrics is > 0, and that the metrics table is large enough + // to contain mNumLongHMetrics records + const GlyphMetrics* metrics = + reinterpret_cast(hb_blob_get_data(mHmtxTable, + nullptr)); return FloatToFixed(mFont->FUnitsToDevUnitsFactor() * - uint16_t(hmtx->metrics[glyph].advanceWidth)); + uint16_t(metrics->metrics[glyph].advanceWidth)); +} + +hb_position_t +gfxHarfBuzzShaper::GetGlyphVAdvance(gfxContext *aContext, + hb_codepoint_t glyph) const +{ + if (!mVmtxTable) { + // Must be a "vertical" font that doesn't actually have vertical metrics; + // use a fixed advance. + return FloatToFixed(mFont->GetMetrics(gfxFont::eVertical).aveCharWidth); + } + + NS_ASSERTION(mNumLongVMetrics > 0, + "font is lacking metrics, we shouldn't be here"); + + if (glyph >= uint32_t(mNumLongVMetrics)) { + glyph = mNumLongVMetrics - 1; + } + + // glyph must be valid now, because we checked during initialization + // that mNumLongVMetrics is > 0, and that the metrics table is large enough + // to contain mNumLongVMetrics records + const GlyphMetrics* metrics = + reinterpret_cast(hb_blob_get_data(mVmtxTable, + nullptr)); + return FloatToFixed(mFont->FUnitsToDevUnitsFactor() * + uint16_t(metrics->metrics[glyph].advanceWidth)); } /* static */ @@ -232,6 +249,111 @@ gfxHarfBuzzShaper::HBGetGlyphHAdvance(hb_font_t *font, void *font_data, } } +/* static */ +hb_position_t +gfxHarfBuzzShaper::HBGetGlyphVAdvance(hb_font_t *font, void *font_data, + hb_codepoint_t glyph, void *user_data) +{ + const gfxHarfBuzzShaper::FontCallbackData *fcd = + static_cast(font_data); + gfxFont *gfxfont = fcd->mShaper->GetFont(); + if (gfxfont->ProvidesGlyphWidths()) { + return gfxfont->GetGlyphWidth(fcd->mContext, glyph); + } else { + return fcd->mShaper->GetGlyphVAdvance(fcd->mContext, glyph); + } +} + +/* static */ +hb_bool_t +gfxHarfBuzzShaper::HBGetGlyphHOrigin(hb_font_t *font, void *font_data, + hb_codepoint_t glyph, + hb_position_t *x, hb_position_t *y, + void *user_data) +{ + // We work in horizontal coordinates, so no origin adjustment needed here. + return true; +} + +struct VORG { + AutoSwap_PRUint16 majorVersion; + AutoSwap_PRUint16 minorVersion; + AutoSwap_PRInt16 defaultVertOriginY; + AutoSwap_PRUint16 numVertOriginYMetrics; +}; + +struct VORGrec { + AutoSwap_PRUint16 glyphIndex; + AutoSwap_PRInt16 vertOriginY; +}; + +/* static */ +hb_bool_t +gfxHarfBuzzShaper::HBGetGlyphVOrigin(hb_font_t *font, void *font_data, + hb_codepoint_t glyph, + hb_position_t *x, hb_position_t *y, + void *user_data) +{ + const gfxHarfBuzzShaper::FontCallbackData *fcd = + static_cast(font_data); + fcd->mShaper->GetGlyphVOrigin(fcd->mContext, glyph, x, y); + return true; +} + +void +gfxHarfBuzzShaper::GetGlyphVOrigin(gfxContext *aContext, hb_codepoint_t aGlyph, + hb_position_t *aX, hb_position_t *aY) const +{ + *aX = -0.5 * GetGlyphHAdvance(aContext, aGlyph); + + if (mVORGTable) { + // We checked in Initialize() that the VORG table is safely readable, + // so no length/bounds-check needed here. + const VORG* vorg = + reinterpret_cast(hb_blob_get_data(mVORGTable, nullptr)); + + const VORGrec *lo = reinterpret_cast(vorg + 1); + const VORGrec *hi = lo + uint16_t(vorg->numVertOriginYMetrics); + const VORGrec *limit = hi; + while (lo < hi) { + const VORGrec *mid = lo + (hi - lo) / 2; + if (uint16_t(mid->glyphIndex) < aGlyph) { + lo = mid + 1; + } else { + hi = mid; + } + } + + if (lo < limit && uint16_t(lo->glyphIndex) == aGlyph) { + *aY = -FloatToFixed(GetFont()->FUnitsToDevUnitsFactor() * + int16_t(lo->vertOriginY)); + } else { + *aY = -FloatToFixed(GetFont()->FUnitsToDevUnitsFactor() * + int16_t(vorg->defaultVertOriginY)); + } + return; + } + + // XXX should we consider using OS/2 sTypo* metrics if available? + + gfxFontEntry::AutoTable hheaTable(GetFont()->GetFontEntry(), + TRUETYPE_TAG('h','h','e','a')); + if (hheaTable) { + uint32_t len; + const MetricsHeader* hhea = + reinterpret_cast(hb_blob_get_data(hheaTable, + &len)); + if (len >= sizeof(MetricsHeader)) { + *aY = -FloatToFixed(GetFont()->FUnitsToDevUnitsFactor() * + int16_t(hhea->ascender)); + return; + } + } + + NS_NOTREACHED("we shouldn't be here!"); + *aY = -FloatToFixed(GetFont()->GetAdjustedSize() / 2); +} + static hb_bool_t HBGetContourPoint(hb_font_t *font, void *font_data, unsigned int point_index, hb_codepoint_t glyph, @@ -858,6 +980,15 @@ gfxHarfBuzzShaper::Initialize() hb_font_funcs_set_glyph_h_advance_func(sHBFontFuncs, HBGetGlyphHAdvance, nullptr, nullptr); + hb_font_funcs_set_glyph_v_advance_func(sHBFontFuncs, + HBGetGlyphVAdvance, + nullptr, nullptr); + hb_font_funcs_set_glyph_h_origin_func(sHBFontFuncs, + HBGetGlyphHOrigin, + nullptr, nullptr); + hb_font_funcs_set_glyph_v_origin_func(sHBFontFuncs, + HBGetGlyphVOrigin, + nullptr, nullptr); hb_font_funcs_set_glyph_contour_point_func(sHBFontFuncs, HBGetContourPoint, nullptr, nullptr); @@ -910,36 +1041,9 @@ gfxHarfBuzzShaper::Initialize() } if (!mUseFontGlyphWidths) { - // if font doesn't implement GetGlyphWidth, we will be reading - // the hmtx table directly; - // read mNumLongMetrics from hhea table without caching its blob, - // and preload/cache the hmtx table - gfxFontEntry::AutoTable hheaTable(entry, TRUETYPE_TAG('h','h','e','a')); - if (hheaTable) { - uint32_t len; - const HMetricsHeader* hhea = - reinterpret_cast - (hb_blob_get_data(hheaTable, &len)); - if (len >= sizeof(HMetricsHeader)) { - mNumLongMetrics = hhea->numberOfHMetrics; - if (mNumLongMetrics > 0 && - int16_t(hhea->metricDataFormat) == 0) { - // no point reading hmtx if number of entries is zero! - // in that case, we won't be able to use this font - // (this method will return FALSE below if mHmtx is null) - mHmtxTable = - entry->GetFontTable(TRUETYPE_TAG('h','m','t','x')); - if (hb_blob_get_length(mHmtxTable) < - mNumLongMetrics * sizeof(HLongMetric)) { - // hmtx table is not large enough for the claimed - // number of entries: invalid, do not use. - hb_blob_destroy(mHmtxTable); - mHmtxTable = nullptr; - } - } - } - } - if (!mHmtxTable) { + // If font doesn't implement GetGlyphWidth, we will be reading + // the metrics table directly, so make sure we can load it. + if (!LoadHmtxTable()) { return false; } } @@ -953,12 +1057,109 @@ gfxHarfBuzzShaper::Initialize() return true; } +bool +gfxHarfBuzzShaper::LoadHmtxTable() +{ + // Read mNumLongHMetrics from metrics-head table without caching its + // blob, and preload/cache the metrics table. + gfxFontEntry *entry = mFont->GetFontEntry(); + gfxFontEntry::AutoTable hheaTable(entry, TRUETYPE_TAG('h','h','e','a')); + if (hheaTable) { + uint32_t len; + const MetricsHeader* hhea = + reinterpret_cast + (hb_blob_get_data(hheaTable, &len)); + if (len >= sizeof(MetricsHeader)) { + mNumLongHMetrics = hhea->numOfLongMetrics; + if (mNumLongHMetrics > 0 && + int16_t(hhea->metricDataFormat) == 0) { + // no point reading metrics if number of entries is zero! + // in that case, we won't be able to use this font + // (this method will return FALSE below if mHmtxTable + // is null) + mHmtxTable = entry->GetFontTable(TRUETYPE_TAG('h','m','t','x')); + if (hb_blob_get_length(mHmtxTable) < + mNumLongHMetrics * sizeof(LongMetric)) { + // metrics table is not large enough for the claimed + // number of entries: invalid, do not use. + hb_blob_destroy(mHmtxTable); + mHmtxTable = nullptr; + } + } + } + } + if (!mHmtxTable) { + return false; + } + return true; +} + +bool +gfxHarfBuzzShaper::InitializeVertical() +{ + if (!mHmtxTable) { + if (!LoadHmtxTable()) { + return false; + } + } + + // Load vertical metrics if present in the font; if not, we'll synthesize + // vertical glyph advances based on (horizontal) ascent/descent metrics. + gfxFontEntry *entry = mFont->GetFontEntry(); + gfxFontEntry::AutoTable vheaTable(entry, TRUETYPE_TAG('v','h','e','a')); + if (vheaTable) { + uint32_t len; + const MetricsHeader* vhea = + reinterpret_cast + (hb_blob_get_data(vheaTable, &len)); + if (len >= sizeof(MetricsHeader)) { + mNumLongVMetrics = vhea->numOfLongMetrics; + if (mNumLongVMetrics > 0 && + int16_t(vhea->metricDataFormat) == 0) { + mVmtxTable = entry->GetFontTable(TRUETYPE_TAG('v','m','t','x')); + if (hb_blob_get_length(mVmtxTable) < + mNumLongVMetrics * sizeof(LongMetric)) { + // metrics table is not large enough for the claimed + // number of entries: invalid, do not use. + hb_blob_destroy(mVmtxTable); + mVmtxTable = nullptr; + } + } + } + } + + // For CFF fonts only, load a VORG table if present. + if (entry->HasFontTable(TRUETYPE_TAG('C','F','F',' '))) { + mVORGTable = entry->GetFontTable(TRUETYPE_TAG('V','O','R','G')); + if (mVORGTable) { + uint32_t len; + const VORG* vorg = + reinterpret_cast(hb_blob_get_data(mVORGTable, + &len)); + if (len < sizeof(VORG) || + uint16_t(vorg->majorVersion) != 1 || + uint16_t(vorg->minorVersion) != 0 || + len < sizeof(VORG) + uint16_t(vorg->numVertOriginYMetrics) * + sizeof(VORGrec)) { + // VORG table is an unknown version, or not large enough + // to be valid -- discard it. + NS_WARNING("discarding invalid VORG table"); + hb_blob_destroy(mVORGTable); + mVORGTable = nullptr; + } + } + } + + return true; +} + bool gfxHarfBuzzShaper::ShapeText(gfxContext *aContext, const char16_t *aText, uint32_t aOffset, uint32_t aLength, int32_t aScript, + bool aVertical, gfxShapedText *aShapedText) { // some font back-ends require this in order to get proper hinted metrics @@ -972,6 +1173,12 @@ gfxHarfBuzzShaper::ShapeText(gfxContext *aContext, return false; } + if (aVertical) { + if (!InitializeVertical()) { + return false; + } + } + const gfxFontStyle *style = mFont->GetStyle(); nsAutoTArray features; @@ -1007,8 +1214,11 @@ gfxHarfBuzzShaper::ShapeText(gfxContext *aContext, bool isRightToLeft = aShapedText->IsRightToLeft(); hb_buffer_t *buffer = hb_buffer_create(); hb_buffer_set_unicode_funcs(buffer, sHBUnicodeFuncs); - hb_buffer_set_direction(buffer, isRightToLeft ? HB_DIRECTION_RTL : - HB_DIRECTION_LTR); + + hb_buffer_set_direction(buffer, + aVertical ? HB_DIRECTION_TTB : + (isRightToLeft ? HB_DIRECTION_RTL : + HB_DIRECTION_LTR)); hb_script_t scriptTag; if (aShapedText->GetFlags() & gfxTextRunFactory::TEXT_USE_MATH_SCRIPT) { scriptTag = sMathScript; @@ -1042,7 +1252,7 @@ gfxHarfBuzzShaper::ShapeText(gfxContext *aContext, } nsresult rv = SetGlyphsFromRun(aContext, aShapedText, aOffset, aLength, - aText, buffer); + aText, buffer, aVertical); NS_WARN_IF_FALSE(NS_SUCCEEDED(rv), "failed to store glyphs into gfxShapedWord"); hb_buffer_destroy(buffer); @@ -1055,12 +1265,13 @@ gfxHarfBuzzShaper::ShapeText(gfxContext *aContext, // for charToGlyphArray nsresult -gfxHarfBuzzShaper::SetGlyphsFromRun(gfxContext *aContext, - gfxShapedText *aShapedText, - uint32_t aOffset, - uint32_t aLength, +gfxHarfBuzzShaper::SetGlyphsFromRun(gfxContext *aContext, + gfxShapedText *aShapedText, + uint32_t aOffset, + uint32_t aLength, const char16_t *aText, - hb_buffer_t *aBuffer) + hb_buffer_t *aBuffer, + bool aVertical) { uint32_t numGlyphs; const hb_glyph_info_t *ginfo = hb_buffer_get_glyph_infos(aBuffer, &numGlyphs); @@ -1092,9 +1303,13 @@ gfxHarfBuzzShaper::SetGlyphsFromRun(gfxContext *aContext, int32_t glyphStart = 0; // looking for a clump that starts at this glyph int32_t charStart = 0; // and this char index within the range of the run - bool roundX; - bool roundY; - aContext->GetRoundOffsetsToPixels(&roundX, &roundY); + bool roundI; + bool roundB; + if (aVertical) { + aContext->GetRoundOffsetsToPixels(&roundB, &roundI); + } else { + aContext->GetRoundOffsetsToPixels(&roundI, &roundB); + } int32_t appUnitsPerDevUnit = aShapedText->GetAppUnitsPerDevUnit(); gfxShapedText::CompressedGlyph *charGlyphs = @@ -1114,10 +1329,10 @@ gfxHarfBuzzShaper::SetGlyphsFromRun(gfxContext *aContext, // // The value of the residual is the part of the desired distance that has // not been included in integer offsets. - hb_position_t x_residual = 0; + hb_position_t residual = 0; // keep track of y-position to set glyph offsets if needed - nscoord yPos = 0; + nscoord bPos = 0; const hb_glyph_position_t *posInfo = hb_buffer_get_glyph_positions(aBuffer, nullptr); @@ -1212,28 +1427,43 @@ gfxHarfBuzzShaper::SetGlyphsFromRun(gfxContext *aContext, continue; } - hb_position_t x_offset = posInfo[glyphStart].x_offset; - hb_position_t x_advance = posInfo[glyphStart].x_advance; - nscoord xOffset, advance; - if (roundX) { - xOffset = - appUnitsPerDevUnit * FixedToIntRound(x_offset + x_residual); - // Desired distance from the base glyph to the next reference point. - hb_position_t width = x_advance - x_offset; - int intWidth = FixedToIntRound(width); - x_residual = width - FloatToFixed(intWidth); - advance = appUnitsPerDevUnit * intWidth + xOffset; + // HarfBuzz gives us physical x- and y-coordinates, but we will store + // them as logical inline- and block-direction values in the textrun. + + hb_position_t i_offset, i_advance; // inline-direction offset/advance + hb_position_t b_offset, b_advance; // block-direction offset/advance + if (aVertical) { + i_offset = posInfo[glyphStart].y_offset; + i_advance = posInfo[glyphStart].y_advance; + b_offset = posInfo[glyphStart].x_offset; + b_advance = posInfo[glyphStart].x_advance; } else { - xOffset = floor(hb2appUnits * x_offset + 0.5); - advance = floor(hb2appUnits * x_advance + 0.5); + i_offset = posInfo[glyphStart].x_offset; + i_advance = posInfo[glyphStart].x_advance; + b_offset = posInfo[glyphStart].y_offset; + b_advance = posInfo[glyphStart].y_advance; + } + + nscoord iOffset, advance; + if (roundI) { + iOffset = + appUnitsPerDevUnit * FixedToIntRound(i_offset + residual); + // Desired distance from the base glyph to the next reference point. + hb_position_t width = i_advance - i_offset; + int intWidth = FixedToIntRound(width); + residual = width - FloatToFixed(intWidth); + advance = appUnitsPerDevUnit * intWidth + iOffset; + } else { + iOffset = floor(hb2appUnits * i_offset + 0.5); + advance = floor(hb2appUnits * i_advance + 0.5); } // Check if it's a simple one-to-one mapping if (glyphsInClump == 1 && gfxTextRun::CompressedGlyph::IsSimpleGlyphID(ginfo[glyphStart].codepoint) && gfxTextRun::CompressedGlyph::IsSimpleAdvance(advance) && charGlyphs[baseCharIndex].IsClusterStart() && - xOffset == 0 && - posInfo[glyphStart].y_offset == 0 && yPos == 0) + iOffset == 0 && b_offset == 0 && + b_advance == 0 && bPos == 0) { charGlyphs[baseCharIndex].SetSimpleGlyph(advance, ginfo[glyphStart].codepoint); @@ -1247,41 +1477,49 @@ gfxHarfBuzzShaper::SetGlyphsFromRun(gfxContext *aContext, detailedGlyphs.AppendElement(); details->mGlyphID = ginfo[glyphStart].codepoint; - details->mXOffset = xOffset; + details->mXOffset = iOffset; details->mAdvance = advance; - hb_position_t y_offset = posInfo[glyphStart].y_offset; - details->mYOffset = yPos - - (roundY ? appUnitsPerDevUnit * FixedToIntRound(y_offset) - : floor(hb2appUnits * y_offset + 0.5)); + details->mYOffset = bPos - + (roundB ? appUnitsPerDevUnit * FixedToIntRound(b_offset) + : floor(hb2appUnits * b_offset + 0.5)); - hb_position_t y_advance = posInfo[glyphStart].y_advance; - if (y_advance != 0) { - yPos -= - roundY ? appUnitsPerDevUnit * FixedToIntRound(y_advance) - : floor(hb2appUnits * y_advance + 0.5); + if (b_advance != 0) { + bPos -= + roundB ? appUnitsPerDevUnit * FixedToIntRound(b_advance) + : floor(hb2appUnits * b_advance + 0.5); } if (++glyphStart >= glyphEnd) { break; } - x_offset = posInfo[glyphStart].x_offset; - x_advance = posInfo[glyphStart].x_advance; - if (roundX) { - xOffset = appUnitsPerDevUnit * - FixedToIntRound(x_offset + x_residual); + if (aVertical) { + i_offset = posInfo[glyphStart].y_offset; + i_advance = posInfo[glyphStart].y_advance; + b_offset = posInfo[glyphStart].x_offset; + b_advance = posInfo[glyphStart].x_advance; + } else { + i_offset = posInfo[glyphStart].x_offset; + i_advance = posInfo[glyphStart].x_advance; + b_offset = posInfo[glyphStart].y_offset; + b_advance = posInfo[glyphStart].y_advance; + } + + if (roundI) { + iOffset = appUnitsPerDevUnit * + FixedToIntRound(i_offset + residual); // Desired distance to the next reference point. The // residual is considered here, and includes the residual // from the base glyph offset and subsequent advances, so // that the distance from the base glyph is optimized // rather than the distance from combining marks. - x_advance += x_residual; - int intAdvance = FixedToIntRound(x_advance); - x_residual = x_advance - FloatToFixed(intAdvance); + i_advance += residual; + int intAdvance = FixedToIntRound(i_advance); + residual = i_advance - FloatToFixed(intAdvance); advance = appUnitsPerDevUnit * intAdvance; } else { - xOffset = floor(hb2appUnits * x_offset + 0.5); - advance = floor(hb2appUnits * x_advance + 0.5); + iOffset = floor(hb2appUnits * i_offset + 0.5); + advance = floor(hb2appUnits * i_advance + 0.5); } } diff --git a/gfx/thebes/gfxHarfBuzzShaper.h b/gfx/thebes/gfxHarfBuzzShaper.h index 908d965a9c9e..ba726a9bbad4 100644 --- a/gfx/thebes/gfxHarfBuzzShaper.h +++ b/gfx/thebes/gfxHarfBuzzShaper.h @@ -31,6 +31,7 @@ public: uint32_t aOffset, uint32_t aLength, int32_t aScript, + bool aVertical, gfxShapedText *aShapedText); // get a given font table in harfbuzz blob form @@ -44,11 +45,33 @@ public: hb_position_t GetGlyphHAdvance(gfxContext *aContext, hb_codepoint_t glyph) const; + hb_position_t GetGlyphVAdvance(gfxContext *aContext, + hb_codepoint_t glyph) const; + + void GetGlyphVOrigin(gfxContext *aContext, hb_codepoint_t aGlyph, + hb_position_t *aX, hb_position_t *aY) const; + // get harfbuzz horizontal advance in 16.16 fixed point format. static hb_position_t HBGetGlyphHAdvance(hb_font_t *font, void *font_data, hb_codepoint_t glyph, void *user_data); + // get harfbuzz vertical advance in 16.16 fixed point format. + static hb_position_t + HBGetGlyphVAdvance(hb_font_t *font, void *font_data, + hb_codepoint_t glyph, void *user_data); + + static hb_bool_t + HBGetGlyphHOrigin(hb_font_t *font, void *font_data, + hb_codepoint_t glyph, + hb_position_t *x, hb_position_t *y, + void *user_data); + static hb_bool_t + HBGetGlyphVOrigin(hb_font_t *font, void *font_data, + hb_codepoint_t glyph, + hb_position_t *x, hb_position_t *y, + void *user_data); + hb_position_t GetHKerning(uint16_t aFirstGlyph, uint16_t aSecondGlyph) const; @@ -68,12 +91,13 @@ public: } protected: - nsresult SetGlyphsFromRun(gfxContext *aContext, - gfxShapedText *aShapedText, - uint32_t aOffset, - uint32_t aLength, + nsresult SetGlyphsFromRun(gfxContext *aContext, + gfxShapedText *aShapedText, + uint32_t aOffset, + uint32_t aLength, const char16_t *aText, - hb_buffer_t *aBuffer); + hb_buffer_t *aBuffer, + bool aVertical); // retrieve glyph positions, applying advance adjustments and attachments // returns results in appUnits @@ -82,6 +106,9 @@ protected: nsTArray& aPositions, uint32_t aAppUnitsPerDevUnit); + bool InitializeVertical(); + bool LoadHmtxTable(); + // harfbuzz face object: we acquire a reference from the font entry // on shaper creation, and release it in our destructor hb_face_t *mHBFace; @@ -99,13 +126,12 @@ protected: // Old-style TrueType kern table, if we're not doing GPOS kerning mutable hb_blob_t *mKernTable; - // Cached copy of the hmtx table and numLongMetrics field from hhea, - // for use when looking up glyph metrics; initialized to 0 by the - // constructor so we can tell it hasn't been set yet. - // This is a signed value so that we can use -1 to indicate - // an error (if the hhea table was not available). + // Cached copy of the hmtx table. mutable hb_blob_t *mHmtxTable; - mutable int32_t mNumLongMetrics; + + // For vertical fonts, cached vmtx and VORG table, if present. + mutable hb_blob_t *mVmtxTable; + mutable hb_blob_t *mVORGTable; // Cached pointer to cmap subtable to be used for char-to-glyph mapping. // This comes from GetFontTablePtr; if it is non-null, our destructor @@ -115,6 +141,15 @@ protected: mutable uint32_t mSubtableOffset; mutable uint32_t mUVSTableOffset; + // Cached copy of numLongMetrics field from the hhea table, + // for use when looking up glyph metrics; initialized to 0 by the + // constructor so we can tell it hasn't been set yet. + // This is a signed value so that we can use -1 to indicate + // an error (if the hhea table was not available). + mutable int32_t mNumLongHMetrics; + // Similarly for vhea if it's a vertical font. + mutable int32_t mNumLongVMetrics; + // Whether the font implements GetGlyph, or we should read tables // directly bool mUseFontGetGlyph; @@ -123,6 +158,7 @@ protected: bool mUseFontGlyphWidths; bool mInitialized; + bool mVerticalInitialized; }; #endif /* GFX_HARFBUZZSHAPER_H */ diff --git a/gfx/thebes/gfxMacFont.cpp b/gfx/thebes/gfxMacFont.cpp index 0af44bcef4a8..44608b9470c7 100644 --- a/gfx/thebes/gfxMacFont.cpp +++ b/gfx/thebes/gfxMacFont.cpp @@ -124,6 +124,7 @@ gfxMacFont::ShapeText(gfxContext *aContext, uint32_t aOffset, uint32_t aLength, int32_t aScript, + bool aVertical, gfxShapedText *aShapedText) { if (!mIsValid) { @@ -131,19 +132,22 @@ gfxMacFont::ShapeText(gfxContext *aContext, return false; } - if (static_cast(GetFontEntry())->RequiresAATLayout()) { + // Currently, we don't support vertical shaping via CoreText, + // so we ignore RequiresAATLayout if vertical is requested. + if (static_cast(GetFontEntry())->RequiresAATLayout() && + !aVertical) { if (!mCoreTextShaper) { mCoreTextShaper = new gfxCoreTextShaper(this); } if (mCoreTextShaper->ShapeText(aContext, aText, aOffset, aLength, - aScript, aShapedText)) { + aScript, aVertical, aShapedText)) { PostShapingFixup(aContext, aText, aOffset, aLength, aShapedText); return true; } } return gfxFont::ShapeText(aContext, aText, aOffset, aLength, aScript, - aShapedText); + aVertical, aShapedText); } bool diff --git a/gfx/thebes/gfxMacFont.h b/gfx/thebes/gfxMacFont.h index 565797636d01..36ec9de140f8 100644 --- a/gfx/thebes/gfxMacFont.h +++ b/gfx/thebes/gfxMacFont.h @@ -57,6 +57,7 @@ protected: uint32_t aOffset, uint32_t aLength, int32_t aScript, + bool aVertical, gfxShapedText *aShapedText); void InitMetrics(); diff --git a/gfx/thebes/gfxTextRun.cpp b/gfx/thebes/gfxTextRun.cpp index bbe232f99cc7..24c273bf06e0 100644 --- a/gfx/thebes/gfxTextRun.cpp +++ b/gfx/thebes/gfxTextRun.cpp @@ -1240,10 +1240,13 @@ gfxTextRun::SetSpaceGlyph(gfxFont *aFont, gfxContext *aContext, gfxTextRunFactory::TEXT_IS_ASCII | gfxTextRunFactory::TEXT_IS_PERSISTENT | aOrientation; + bool vertical = + (GetFlags() & gfxTextRunFactory::TEXT_ORIENT_VERTICAL_UPRIGHT) != 0; gfxShapedWord *sw = aFont->GetShapedWord(aContext, &space, 1, gfxShapedWord::HashMix(0, ' '), MOZ_SCRIPT_LATIN, + vertical, mAppUnitsPerDevUnit, flags, nullptr); @@ -2224,7 +2227,8 @@ gfxFontGroup::InitScriptRun(gfxContext *aContext, const gfxTextRange& range = fontRanges[r]; uint32_t matchedLength = range.Length(); gfxFont *matchedFont = range.font; - + bool vertical = + range.orientation == gfxTextRunFactory::TEXT_ORIENT_VERTICAL_UPRIGHT; // create the glyph run for this range if (matchedFont && mStyle.noFallbackVariantFeatures) { // common case - just do glyph layout and record the @@ -2236,7 +2240,8 @@ gfxFontGroup::InitScriptRun(gfxContext *aContext, aString + runStart, aOffset + runStart, matchedLength, - aRunScript)) { + aRunScript, + vertical)) { // glyph layout failed! treat as missing glyphs matchedFont = nullptr; } @@ -2275,7 +2280,8 @@ gfxFontGroup::InitScriptRun(gfxContext *aContext, aString + runStart, aOffset + runStart, matchedLength, - aRunScript)) { + aRunScript, + vertical)) { // glyph layout failed! treat as missing glyphs matchedFont = nullptr; } @@ -2319,7 +2325,8 @@ gfxFontGroup::InitScriptRun(gfxContext *aContext, aString + runStart, aOffset + runStart, matchedLength, - aRunScript)) { + aRunScript, + vertical)) { // glyph layout failed! treat as missing glyphs matchedFont = nullptr; } diff --git a/layout/media/symbols.def.in b/layout/media/symbols.def.in index a3f6abed8ef3..063e0061abea 100644 --- a/layout/media/symbols.def.in +++ b/layout/media/symbols.def.in @@ -570,6 +570,9 @@ hb_font_funcs_set_glyph_contour_point_func hb_font_funcs_set_glyph_func hb_font_funcs_set_glyph_h_advance_func hb_font_funcs_set_glyph_h_kerning_func +hb_font_funcs_set_glyph_h_origin_func +hb_font_funcs_set_glyph_v_origin_func +hb_font_funcs_set_glyph_v_advance_func hb_font_set_funcs hb_font_set_ppem hb_font_set_scale From 7e8dfb9a44f4d014c3e8dceea54fe1cbf5187cc6 Mon Sep 17 00:00:00 2001 From: Jonathan Kew Date: Wed, 1 Oct 2014 20:25:48 +0100 Subject: [PATCH 58/63] Bug 902762 pt 2 - Support for vertical textruns and fonts through gfxTextRun::Draw. r=jdaggett --- gfx/thebes/gfxFont.cpp | 78 +++++++++++++++++++++++++++++---------- gfx/thebes/gfxFont.h | 5 ++- gfx/thebes/gfxTextRun.cpp | 24 ++++++++---- gfx/thebes/gfxTextRun.h | 4 +- 4 files changed, 80 insertions(+), 31 deletions(-) diff --git a/gfx/thebes/gfxFont.cpp b/gfx/thebes/gfxFont.cpp index 4988efd6ab95..d862e829c537 100644 --- a/gfx/thebes/gfxFont.cpp +++ b/gfx/thebes/gfxFont.cpp @@ -1692,16 +1692,28 @@ gfxFont::DrawOneGlyph(uint32_t aGlyphID, double aAdvance, gfxPoint *aPt, const TextRunDrawParams& runParams(aBuffer.mRunParams); const FontDrawParams& fontParams(aBuffer.mFontParams); - double glyphX; - if (runParams.isRTL) { - aPt->x -= aAdvance; + double glyphX, glyphY; + if (fontParams.isVerticalFont) { glyphX = aPt->x; + if (runParams.isRTL) { + aPt->y -= aAdvance; + glyphY = aPt->y; + } else { + glyphY = aPt->y; + aPt->y += aAdvance; + } } else { - glyphX = aPt->x; - aPt->x += aAdvance; + glyphY = aPt->y; + if (runParams.isRTL) { + aPt->x -= aAdvance; + glyphX = aPt->x; + } else { + glyphX = aPt->x; + aPt->x += aAdvance; + } } gfxPoint devPt(ToDeviceUnits(glyphX, runParams.devPerApp), - ToDeviceUnits(aPt->y, runParams.devPerApp)); + ToDeviceUnits(glyphY, runParams.devPerApp)); if (fontParams.haveSVGGlyphs) { if (!runParams.paintSVGGlyphs) { @@ -1727,7 +1739,11 @@ gfxFont::DrawOneGlyph(uint32_t aGlyphID, double aAdvance, gfxPoint *aPt, // Synthetic bolding (if required) by multi-striking. for (int32_t i = 0; i < fontParams.extraStrikes; ++i) { - devPt.x += fontParams.synBoldOnePixelOffset; + if (fontParams.isVerticalFont) { + devPt.y += fontParams.synBoldOnePixelOffset; + } else { + devPt.x += fontParams.synBoldOnePixelOffset; + } aBuffer.OutputGlyph(aGlyphID, devPt); } @@ -1747,8 +1763,10 @@ gfxFont::DrawGlyphs(gfxShapedText *aShapedText, bool emittedGlyphs = false; GlyphBufferAzure buffer(aRunParams, aFontParams); + gfxFloat& inlineCoord = aFontParams.isVerticalFont ? aPt->y : aPt->x; + if (aRunParams.spacing) { - aPt->x += aRunParams.direction * aRunParams.spacing[0].mBefore; + inlineCoord += aRunParams.direction * aRunParams.spacing[0].mBefore; } const gfxShapedText::CompressedGlyph *glyphData = @@ -1767,22 +1785,31 @@ gfxFont::DrawGlyphs(gfxShapedText *aShapedText, NS_ASSERTION(details, "detailedGlyph should not be missing!"); for (uint32_t j = 0; j < glyphCount; ++j, ++details) { double advance = details->mAdvance; + if (glyphData->IsMissing()) { // Default-ignorable chars will have zero advance width; // we don't have to draw the hexbox for them. if (aRunParams.drawMode != DrawMode::GLYPH_PATH && advance > 0) { double glyphX = aPt->x; + double glyphY = aPt->y; if (aRunParams.isRTL) { - glyphX -= advance; + if (aFontParams.isVerticalFont) { + glyphY -= advance; + } else { + glyphX -= advance; + } } gfxPoint pt(ToDeviceUnits(glyphX, aRunParams.devPerApp), - ToDeviceUnits(aPt->y, aRunParams.devPerApp)); + ToDeviceUnits(glyphY, aRunParams.devPerApp)); gfxFloat advanceDevUnits = ToDeviceUnits(advance, aRunParams.devPerApp); gfxFloat height = GetMetrics(eHorizontal).maxAscent; - gfxRect glyphRect(pt.x, pt.y - height, - advanceDevUnits, height); + gfxRect glyphRect = aFontParams.isVerticalFont ? + gfxRect(pt.x - height / 2, pt.y, + height, advanceDevUnits) : + gfxRect(pt.x, pt.y - height, + advanceDevUnits, height); // If there's a fake-italic skew in effect as part // of the drawTarget's transform, we need to remove @@ -1806,12 +1833,18 @@ gfxFont::DrawGlyphs(gfxShapedText *aShapedText, } } else { gfxPoint glyphXY(*aPt); - glyphXY.x += details->mXOffset; - glyphXY.y += details->mYOffset; + if (aFontParams.isVerticalFont) { + glyphXY.x += details->mYOffset; + glyphXY.y += details->mXOffset; + } else { + glyphXY.x += details->mXOffset; + glyphXY.y += details->mYOffset; + } DrawOneGlyph(details->mGlyphID, advance, &glyphXY, buffer, &emittedGlyphs); } - aPt->x += aRunParams.direction * advance; + + inlineCoord += aRunParams.direction * advance; } } } @@ -1821,7 +1854,7 @@ gfxFont::DrawGlyphs(gfxShapedText *aShapedText, if (i + 1 < aCount) { space += aRunParams.spacing[i + 1].mBefore; } - aPt->x += aRunParams.direction * space; + inlineCoord += aRunParams.direction * space; } } @@ -1830,7 +1863,8 @@ gfxFont::DrawGlyphs(gfxShapedText *aShapedText, void gfxFont::Draw(gfxTextRun *aTextRun, uint32_t aStart, uint32_t aEnd, - gfxPoint *aPt, const TextRunDrawParams& aRunParams) + gfxPoint *aPt, const TextRunDrawParams& aRunParams, + uint16_t aOrientation) { NS_ASSERTION(aRunParams.drawMode == DrawMode::GLYPH_PATH || !(int(aRunParams.drawMode) & int(DrawMode::GLYPH_PATH)), @@ -1850,6 +1884,8 @@ gfxFont::Draw(gfxTextRun *aTextRun, uint32_t aStart, uint32_t aEnd, fontParams.haveSVGGlyphs = GetFontEntry()->TryGetSVGData(this); fontParams.haveColorGlyphs = GetFontEntry()->TryGetColorGlyphs(); fontParams.contextPaint = aRunParams.runContextPaint; + fontParams.isVerticalFont = + aOrientation == gfxTextRunFactory::TEXT_ORIENT_VERTICAL_UPRIGHT; nsAutoPtr contextPaint; if (fontParams.haveSVGGlyphs && !fontParams.contextPaint) { @@ -1920,16 +1956,18 @@ gfxFont::Draw(gfxTextRun *aTextRun, uint32_t aStart, uint32_t aEnd, } } - double origY = aPt->y; + gfxFloat& baseline = fontParams.isVerticalFont ? aPt->x : aPt->y; + gfxFloat origBaseline = baseline; if (mStyle.baselineOffset != 0.0) { - aPt->y += mStyle.baselineOffset * aTextRun->GetAppUnitsPerDevUnit(); + baseline += + mStyle.baselineOffset * aTextRun->GetAppUnitsPerDevUnit(); } bool emittedGlyphs = DrawGlyphs(aTextRun, aStart, aEnd - aStart, aPt, aRunParams, fontParams); - aPt->y = origY; + baseline = origBaseline; if (aRunParams.callbacks && emittedGlyphs) { aRunParams.callbacks->NotifyGlyphPathEmitted(); diff --git a/gfx/thebes/gfxFont.h b/gfx/thebes/gfxFont.h index d439bf0d122b..3c783372b35a 100644 --- a/gfx/thebes/gfxFont.h +++ b/gfx/thebes/gfxFont.h @@ -1528,7 +1528,8 @@ public: * -- all glyphs use this font */ void Draw(gfxTextRun *aTextRun, uint32_t aStart, uint32_t aEnd, - gfxPoint *aPt, const TextRunDrawParams& aRunParams); + gfxPoint *aPt, const TextRunDrawParams& aRunParams, + uint16_t aOrientation); /** * Measure a run of characters. See gfxTextRun::Metrics. @@ -2060,6 +2061,7 @@ struct TextRunDrawParams { gfxFloat direction; double devPerApp; DrawMode drawMode; + bool isVerticalRun; bool isRTL; bool paintSVGGlyphs; }; @@ -2073,6 +2075,7 @@ struct FontDrawParams { double synBoldOnePixelOffset; int32_t extraStrikes; mozilla::gfx::DrawOptions drawOptions; + bool isVerticalFont; bool haveSVGGlyphs; bool haveColorGlyphs; }; diff --git a/gfx/thebes/gfxTextRun.cpp b/gfx/thebes/gfxTextRun.cpp index 24c273bf06e0..703e69c5cb42 100644 --- a/gfx/thebes/gfxTextRun.cpp +++ b/gfx/thebes/gfxTextRun.cpp @@ -397,13 +397,13 @@ void gfxTextRun::DrawGlyphs(gfxFont *aFont, uint32_t aStart, uint32_t aEnd, gfxPoint *aPt, PropertyProvider *aProvider, uint32_t aSpacingStart, uint32_t aSpacingEnd, - TextRunDrawParams& aParams) + TextRunDrawParams& aParams, uint16_t aOrientation) { nsAutoTArray spacingBuffer; bool haveSpacing = GetAdjustedSpacingArray(aStart, aEnd, aProvider, aSpacingStart, aSpacingEnd, &spacingBuffer); aParams.spacing = haveSpacing ? spacingBuffer.Elements() : nullptr; - aFont->Draw(this, aStart, aEnd, aPt, aParams); + aFont->Draw(this, aStart, aEnd, aPt, aParams, aOrientation); } static void @@ -430,7 +430,7 @@ ClipPartialLigature(gfxTextRun *aTextRun, gfxFloat *aLeft, gfxFloat *aRight, void gfxTextRun::DrawPartialLigature(gfxFont *aFont, uint32_t aStart, uint32_t aEnd, gfxPoint *aPt, PropertyProvider *aProvider, - TextRunDrawParams& aParams) + TextRunDrawParams& aParams, uint16_t aOrientation) { if (aStart >= aEnd) return; @@ -462,7 +462,7 @@ gfxTextRun::DrawPartialLigature(gfxFont *aFont, uint32_t aStart, uint32_t aEnd, gfxPoint pt(aPt->x - aParams.direction * data.mPartAdvance, aPt->y); DrawGlyphs(aFont, data.mLigatureStart, data.mLigatureEnd, &pt, - aProvider, aStart, aEnd, aParams); + aProvider, aStart, aEnd, aParams, aOrientation); aParams.context->Restore(); aPt->x += aParams.direction * data.mPartWidth; @@ -577,6 +577,7 @@ gfxTextRun::Draw(gfxContext *aContext, gfxPoint aPt, DrawMode aDrawMode, TextRunDrawParams params; params.context = aContext; params.devPerApp = 1.0 / double(GetAppUnitsPerDevUnit()); + params.isVerticalRun = IsVertical(); params.isRTL = IsRightToLeft(); params.direction = direction; params.drawMode = aDrawMode; @@ -620,15 +621,18 @@ gfxTextRun::Draw(gfxContext *aContext, gfxPoint aPt, DrawMode aDrawMode, if (drawPartial) { DrawPartialLigature(font, start, ligatureRunStart, &pt, - aProvider, params); + aProvider, params, + iter.GetGlyphRun()->mOrientation); } DrawGlyphs(font, ligatureRunStart, ligatureRunEnd, &pt, - aProvider, ligatureRunStart, ligatureRunEnd, params); + aProvider, ligatureRunStart, ligatureRunEnd, params, + iter.GetGlyphRun()->mOrientation); if (drawPartial) { DrawPartialLigature(font, ligatureRunEnd, end, &pt, - aProvider, params); + aProvider, params, + iter.GetGlyphRun()->mOrientation); } } @@ -638,7 +642,11 @@ gfxTextRun::Draw(gfxContext *aContext, gfxPoint aPt, DrawMode aDrawMode, } if (aAdvanceWidth) { - *aAdvanceWidth = (pt.x - aPt.x)*direction; + if (params.isVerticalRun) { + *aAdvanceWidth = (pt.y - aPt.y) * params.direction; + } else { + *aAdvanceWidth = (pt.x - aPt.x) * params.direction; + } } } diff --git a/gfx/thebes/gfxTextRun.h b/gfx/thebes/gfxTextRun.h index ffbddc3b20f3..b4472f5e7a35 100644 --- a/gfx/thebes/gfxTextRun.h +++ b/gfx/thebes/gfxTextRun.h @@ -673,7 +673,7 @@ private: PropertyProvider *aProvider); void DrawPartialLigature(gfxFont *aFont, uint32_t aStart, uint32_t aEnd, gfxPoint *aPt, PropertyProvider *aProvider, - TextRunDrawParams& aParams); + TextRunDrawParams& aParams, uint16_t aOrientation); // Advance aStart to the start of the nearest ligature; back up aEnd // to the nearest ligature end; may result in *aStart == *aEnd void ShrinkToLigatureBoundaries(uint32_t *aStart, uint32_t *aEnd); @@ -698,7 +698,7 @@ private: void DrawGlyphs(gfxFont *aFont, uint32_t aStart, uint32_t aEnd, gfxPoint *aPt, PropertyProvider *aProvider, uint32_t aSpacingStart, uint32_t aSpacingEnd, - TextRunDrawParams& aParams); + TextRunDrawParams& aParams, uint16_t aOrientation); // XXX this should be changed to a GlyphRun plus a maybe-null GlyphRun*, // for smaller size especially in the super-common one-glyphrun case From e46d88166d71e7aa9567333b04a40e5a6e04351f Mon Sep 17 00:00:00 2001 From: Jonathan Kew Date: Wed, 1 Oct 2014 20:25:49 +0100 Subject: [PATCH 59/63] Bug 902762 pt 3 - Make DrawPartialLigature aware of vertical runs. r=jdaggett --- gfx/thebes/gfxTextRun.cpp | 64 ++++++++++++++++++++++++++++----------- 1 file changed, 47 insertions(+), 17 deletions(-) diff --git a/gfx/thebes/gfxTextRun.cpp b/gfx/thebes/gfxTextRun.cpp index 703e69c5cb42..4e190e637ca4 100644 --- a/gfx/thebes/gfxTextRun.cpp +++ b/gfx/thebes/gfxTextRun.cpp @@ -407,22 +407,25 @@ gfxTextRun::DrawGlyphs(gfxFont *aFont, uint32_t aStart, uint32_t aEnd, } static void -ClipPartialLigature(gfxTextRun *aTextRun, gfxFloat *aLeft, gfxFloat *aRight, - gfxFloat aXOrigin, gfxTextRun::LigatureData *aLigature) +ClipPartialLigature(const gfxTextRun* aTextRun, + gfxFloat *aStart, gfxFloat *aEnd, + gfxFloat aOrigin, + gfxTextRun::LigatureData *aLigature) { if (aLigature->mClipBeforePart) { if (aTextRun->IsRightToLeft()) { - *aRight = std::min(*aRight, aXOrigin); + *aEnd = std::min(*aEnd, aOrigin); } else { - *aLeft = std::max(*aLeft, aXOrigin); + *aStart = std::max(*aStart, aOrigin); } } if (aLigature->mClipAfterPart) { - gfxFloat endEdge = aXOrigin + aTextRun->GetDirection()*aLigature->mPartWidth; + gfxFloat endEdge = + aOrigin + aTextRun->GetDirection() * aLigature->mPartWidth; if (aTextRun->IsRightToLeft()) { - *aLeft = std::max(*aLeft, endEdge); + *aStart = std::max(*aStart, endEdge); } else { - *aRight = std::min(*aRight, endEdge); + *aEnd = std::min(*aEnd, endEdge); } } } @@ -432,15 +435,23 @@ gfxTextRun::DrawPartialLigature(gfxFont *aFont, uint32_t aStart, uint32_t aEnd, gfxPoint *aPt, PropertyProvider *aProvider, TextRunDrawParams& aParams, uint16_t aOrientation) { - if (aStart >= aEnd) + if (aStart >= aEnd) { return; + } // Draw partial ligature. We hack this by clipping the ligature. LigatureData data = ComputeLigatureData(aStart, aEnd, aProvider); gfxRect clipExtents = aParams.context->GetClipExtents(); - gfxFloat left = clipExtents.X() * mAppUnitsPerDevUnit; - gfxFloat right = clipExtents.XMost() * mAppUnitsPerDevUnit; - ClipPartialLigature(this, &left, &right, aPt->x, &data); + gfxFloat start, end; + if (aParams.isVerticalRun) { + start = clipExtents.Y() * mAppUnitsPerDevUnit; + end = clipExtents.YMost() * mAppUnitsPerDevUnit; + ClipPartialLigature(this, &start, &end, aPt->y, &data); + } else { + start = clipExtents.X() * mAppUnitsPerDevUnit; + end = clipExtents.XMost() * mAppUnitsPerDevUnit; + ClipPartialLigature(this, &start, &end, aPt->x, &data); + } { // Need to preserve the path, otherwise this can break canvas text-on-path; @@ -453,19 +464,38 @@ gfxTextRun::DrawPartialLigature(gfxFont *aFont, uint32_t aStart, uint32_t aEnd, // Also, make sure we snap the rectangle to device pixels. aParams.context->Save(); aParams.context->NewPath(); - aParams.context->Rectangle(gfxRect(left / mAppUnitsPerDevUnit, - clipExtents.Y(), - (right - left) / mAppUnitsPerDevUnit, - clipExtents.Height()), true); + if (aParams.isVerticalRun) { + aParams.context->Rectangle(gfxRect(clipExtents.X(), + start / mAppUnitsPerDevUnit, + clipExtents.Width(), + (end - start) / mAppUnitsPerDevUnit), + true); + } else { + aParams.context->Rectangle(gfxRect(start / mAppUnitsPerDevUnit, + clipExtents.Y(), + (end - start) / mAppUnitsPerDevUnit, + clipExtents.Height()), + true); + } aParams.context->Clip(); } - gfxPoint pt(aPt->x - aParams.direction * data.mPartAdvance, aPt->y); + gfxPoint pt; + if (aParams.isVerticalRun) { + pt = gfxPoint(aPt->x, aPt->y - aParams.direction * data.mPartAdvance); + } else { + pt = gfxPoint(aPt->x - aParams.direction * data.mPartAdvance, aPt->y); + } + DrawGlyphs(aFont, data.mLigatureStart, data.mLigatureEnd, &pt, aProvider, aStart, aEnd, aParams, aOrientation); aParams.context->Restore(); - aPt->x += aParams.direction * data.mPartWidth; + if (aParams.isVerticalRun) { + aPt->y += aParams.direction * data.mPartWidth; + } else { + aPt->x += aParams.direction * data.mPartWidth; + } } // returns true if a glyph run is using a font with synthetic bolding enabled, false otherwise From 934e56f8da877d56fcbb114f7839a2339c49f25e Mon Sep 17 00:00:00 2001 From: Jonathan Kew Date: Wed, 1 Oct 2014 20:25:49 +0100 Subject: [PATCH 60/63] Bug 902762 pt 4 - Support for orientation:sideways-right when drawing vertical textruns. r=jdaggett --- gfx/thebes/gfxFont.cpp | 31 +++++++++++++++++++++++++++++++ gfx/thebes/gfxTextRun.cpp | 23 +++++++++++++---------- 2 files changed, 44 insertions(+), 10 deletions(-) diff --git a/gfx/thebes/gfxFont.cpp b/gfx/thebes/gfxFont.cpp index d862e829c537..4d6c62eef855 100644 --- a/gfx/thebes/gfxFont.cpp +++ b/gfx/thebes/gfxFont.cpp @@ -1887,6 +1887,32 @@ gfxFont::Draw(gfxTextRun *aTextRun, uint32_t aStart, uint32_t aEnd, fontParams.isVerticalFont = aOrientation == gfxTextRunFactory::TEXT_ORIENT_VERTICAL_UPRIGHT; + bool sideways = false; + gfxPoint origPt = *aPt; + if (aRunParams.isVerticalRun && !fontParams.isVerticalFont) { + sideways = true; + aRunParams.context->Save(); + gfxPoint p(aPt->x * aRunParams.devPerApp, + aPt->y * aRunParams.devPerApp); + const Metrics& metrics = GetMetrics(eHorizontal); + // Adjust the matrix to draw the (horizontally-shaped) textrun with + // 90-degree CW rotation, and adjust position so that the rotated + // horizontal text (which uses a standard alphabetic baseline) will + // look OK when juxtaposed with upright glyphs (rendered on a centered + // vertical baseline). The adjustment here is somewhat ad hoc; we + // should eventually look for baseline tables[1] in the fonts and use + // those if available. + // [1] http://www.microsoft.com/typography/otspec/base.htm + aRunParams.context->SetMatrix(aRunParams.context->CurrentMatrix(). + Translate(p). // translate origin for rotation + Rotate(M_PI / 2.0). // turn 90deg clockwise + Translate(-p). // undo the translation + Translate(gfxPoint(0, metrics.emAscent - metrics.emDescent) / 2)); + // and offset the (alphabetic) baseline of the + // horizontally-shaped text from the (centered) + // default baseline used for vertical + } + nsAutoPtr contextPaint; if (fontParams.haveSVGGlyphs && !fontParams.contextPaint) { // If no pattern is specified for fill, use the current pattern @@ -1975,6 +2001,11 @@ gfxFont::Draw(gfxTextRun *aTextRun, uint32_t aStart, uint32_t aEnd, aRunParams.dt->SetTransform(oldMat); aRunParams.dt->SetPermitSubpixelAA(oldSubpixelAA); + + if (sideways) { + aRunParams.context->Restore(); + *aPt = gfxPoint(origPt.x, origPt.y + (aPt->x - origPt.x)); + } } bool diff --git a/gfx/thebes/gfxTextRun.cpp b/gfx/thebes/gfxTextRun.cpp index 4e190e637ca4..e9d8762a74fd 100644 --- a/gfx/thebes/gfxTextRun.cpp +++ b/gfx/thebes/gfxTextRun.cpp @@ -616,8 +616,6 @@ gfxTextRun::Draw(gfxContext *aContext, gfxPoint aPt, DrawMode aDrawMode, params.paintSVGGlyphs = !aCallbacks || aCallbacks->mShouldPaintSVGGlyphs; params.dt = aContext->GetDrawTarget(); - gfxPoint pt = aPt; - // synthetic bolding draws glyphs twice ==> colors with opacity won't draw // correctly unless first drawn without alpha BufferAlphaColor syntheticBoldBuffer(aContext); @@ -638,6 +636,8 @@ gfxTextRun::Draw(gfxContext *aContext, gfxPoint aPt, DrawMode aDrawMode, } GlyphRunIterator iter(this, aStart, aLength); + gfxFloat advance = 0.0; + while (iter.NextRun()) { gfxFont *font = iter.GetGlyphRun()->mFont; uint32_t start = iter.GetStringStart(); @@ -648,22 +648,29 @@ gfxTextRun::Draw(gfxContext *aContext, gfxPoint aPt, DrawMode aDrawMode, bool drawPartial = aDrawMode == DrawMode::GLYPH_FILL || (aDrawMode == DrawMode::GLYPH_PATH && aCallbacks); + gfxPoint origPt = aPt; if (drawPartial) { - DrawPartialLigature(font, start, ligatureRunStart, &pt, + DrawPartialLigature(font, start, ligatureRunStart, &aPt, aProvider, params, iter.GetGlyphRun()->mOrientation); } - DrawGlyphs(font, ligatureRunStart, ligatureRunEnd, &pt, + DrawGlyphs(font, ligatureRunStart, ligatureRunEnd, &aPt, aProvider, ligatureRunStart, ligatureRunEnd, params, iter.GetGlyphRun()->mOrientation); if (drawPartial) { - DrawPartialLigature(font, ligatureRunEnd, end, &pt, + DrawPartialLigature(font, ligatureRunEnd, end, &aPt, aProvider, params, iter.GetGlyphRun()->mOrientation); } + + if (params.isVerticalRun) { + advance += (aPt.y - origPt.y) * params.direction; + } else { + advance += (aPt.x - origPt.x) * params.direction; + } } // composite result when synthetic bolding used @@ -672,11 +679,7 @@ gfxTextRun::Draw(gfxContext *aContext, gfxPoint aPt, DrawMode aDrawMode, } if (aAdvanceWidth) { - if (params.isVerticalRun) { - *aAdvanceWidth = (pt.y - aPt.y) * params.direction; - } else { - *aAdvanceWidth = (pt.x - aPt.x) * params.direction; - } + *aAdvanceWidth = advance; } } From 01ab03b8daddeedc5fe37a55e07b295e31efb8a6 Mon Sep 17 00:00:00 2001 From: Jonathan Kew Date: Wed, 1 Oct 2014 20:25:49 +0100 Subject: [PATCH 61/63] Bug 902762 pt 5 - Handle vertical textruns when painting text in nsTextFrame. r=smontagu --- layout/generic/nsTextFrame.cpp | 48 +++++++++++++++++++++++++--------- 1 file changed, 35 insertions(+), 13 deletions(-) diff --git a/layout/generic/nsTextFrame.cpp b/layout/generic/nsTextFrame.cpp index bb1bd5683aee..2a4b322bf529 100644 --- a/layout/generic/nsTextFrame.cpp +++ b/layout/generic/nsTextFrame.cpp @@ -5551,16 +5551,18 @@ nsTextFrame::PaintTextWithSelectionColors(gfxContext* aCtx, return false; } - const gfxFloat startXOffset = aTextBaselinePt.x - aFramePt.x; - gfxFloat xOffset, hyphenWidth; + bool vertical = mTextRun->IsVertical(); + const gfxFloat startIOffset = vertical ? + aTextBaselinePt.y - aFramePt.y : aTextBaselinePt.x - aFramePt.x; + gfxFloat iOffset, hyphenWidth; uint32_t offset, length; // in transformed string SelectionType type; TextRangeStyle rangeStyle; // Draw background colors if (anyBackgrounds) { SelectionIterator iterator(prevailingSelections, aContentOffset, aContentLength, - aProvider, mTextRun, startXOffset); - while (iterator.GetNextSegment(&xOffset, &offset, &length, &hyphenWidth, + aProvider, mTextRun, startIOffset); + while (iterator.GetNextSegment(&iOffset, &offset, &length, &hyphenWidth, &type, &rangeStyle)) { nscolor foreground, background; GetSelectionTextColors(type, aTextPaintStyle, rangeStyle, @@ -5569,11 +5571,18 @@ nsTextFrame::PaintTextWithSelectionColors(gfxContext* aCtx, gfxFloat advance = hyphenWidth + mTextRun->GetAdvanceWidth(offset, length, &aProvider); if (NS_GET_A(background) > 0) { - gfxFloat x = xOffset - (mTextRun->IsRightToLeft() ? advance : 0); + gfxRect bgRect; + gfxFloat offs = iOffset - (mTextRun->IsRightToLeft() ? advance : 0); + if (vertical) { + bgRect = gfxRect(aFramePt.x, aFramePt.y + offs, + GetSize().width, advance); + } else { + bgRect = gfxRect(aFramePt.x + offs, aFramePt.y, + advance, GetSize().height); + } PaintSelectionBackground(aCtx, aTextPaintStyle.PresContext(), background, aDirtyRect, - gfxRect(aFramePt.x + x, aFramePt.y, advance, - GetSize().height), aCallbacks); + bgRect, aCallbacks); } iterator.UpdateWithAdvance(advance); } @@ -5584,13 +5593,15 @@ nsTextFrame::PaintTextWithSelectionColors(gfxContext* aCtx, nsRect dirtyRect(aDirtyRect.x, aDirtyRect.y, aDirtyRect.width, aDirtyRect.height); SelectionIterator iterator(prevailingSelections, aContentOffset, aContentLength, - aProvider, mTextRun, startXOffset); - while (iterator.GetNextSegment(&xOffset, &offset, &length, &hyphenWidth, + aProvider, mTextRun, startIOffset); + while (iterator.GetNextSegment(&iOffset, &offset, &length, &hyphenWidth, &type, &rangeStyle)) { nscolor foreground, background; GetSelectionTextColors(type, aTextPaintStyle, rangeStyle, &foreground, &background); - gfxPoint textBaselinePt(aFramePt.x + xOffset, aTextBaselinePt.y); + gfxPoint textBaselinePt = vertical ? + gfxPoint(aTextBaselinePt.x, aFramePt.y + iOffset) : + gfxPoint(aFramePt.x + iOffset, aTextBaselinePt.y); // Determine what shadow, if any, to draw - either from textStyle // or from the ::-moz-selection pseudo-class if specified there @@ -5611,7 +5622,7 @@ nsTextFrame::PaintTextWithSelectionColors(gfxContext* aCtx, shadow->ShadowAt(i - 1), &aProvider, dirtyRect, aFramePt, textBaselinePt, aCtx, foreground, aClipEdges, - xOffset - (mTextRun->IsRightToLeft() ? + iOffset - (mTextRun->IsRightToLeft() ? shadowMetrics.mBoundingBox.width : 0), shadowMetrics.mBoundingBox); } @@ -5945,10 +5956,17 @@ nsTextFrame::PaintText(nsRenderingContext* aRenderingContext, nsPoint aPt, gfxContext* ctx = aRenderingContext->ThebesContext(); const bool rtl = mTextRun->IsRightToLeft(); + const bool vertical = mTextRun->IsVertical(); const nscoord frameWidth = GetSize().width; gfxPoint framePt(aPt.x, aPt.y); - gfxPoint textBaselinePt(rtl ? gfxFloat(aPt.x + frameWidth) : framePt.x, + gfxPoint textBaselinePt; + if (vertical) { + textBaselinePt = gfxPoint(aPt.x + mAscent, + rtl ? gfxFloat(aPt.y + GetSize().height) : aPt.y); + } else { + textBaselinePt = gfxPoint(rtl ? gfxFloat(aPt.x + frameWidth) : framePt.x, nsLayoutUtils::GetSnappedBaselineY(this, ctx, aPt.y, mAscent)); + } uint32_t startOffset = provider.GetStart().GetSkippedOffset(); uint32_t maxLength = ComputeTransformedLength(provider); nscoord snappedLeftEdge, snappedRightEdge; @@ -5956,7 +5974,11 @@ nsTextFrame::PaintText(nsRenderingContext* aRenderingContext, nsPoint aPt, &startOffset, &maxLength, &snappedLeftEdge, &snappedRightEdge)) { return; } - textBaselinePt.x += rtl ? -snappedRightEdge : snappedLeftEdge; + if (vertical) { + textBaselinePt.y += rtl ? -snappedRightEdge : snappedLeftEdge; + } else { + textBaselinePt.x += rtl ? -snappedRightEdge : snappedLeftEdge; + } nsCharClipDisplayItem::ClipEdges clipEdges(aItem, snappedLeftEdge, snappedRightEdge); nsTextPaintStyle textPaintStyle(this); From 2d08dc1f72b10a967d5ec3fbb52c3c6605731925 Mon Sep 17 00:00:00 2001 From: Jonathan Kew Date: Wed, 1 Oct 2014 20:25:50 +0100 Subject: [PATCH 62/63] Bug 902762 pt 6 - Handle vertical textruns for mouse click in nsTextFrame. r=smontagu --- layout/generic/nsTextFrame.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/layout/generic/nsTextFrame.cpp b/layout/generic/nsTextFrame.cpp index 2a4b322bf529..378134712f49 100644 --- a/layout/generic/nsTextFrame.cpp +++ b/layout/generic/nsTextFrame.cpp @@ -6304,15 +6304,17 @@ nsTextFrame::GetCharacterOffsetAtFramePointInternal(nsPoint aPoint, bool aForInsertionPoint) { ContentOffsets offsets; - + gfxSkipCharsIterator iter = EnsureTextRun(nsTextFrame::eInflated); if (!mTextRun) return offsets; - + PropertyProvider provider(this, iter, nsTextFrame::eInflated); // Trim leading but not trailing whitespace if possible provider.InitializeForDisplay(false); - gfxFloat width = mTextRun->IsRightToLeft() ? mRect.width - aPoint.x : aPoint.x; + gfxFloat width = mTextRun->IsVertical() ? + (mTextRun->IsRightToLeft() ? mRect.height - aPoint.y : aPoint.y) : + (mTextRun->IsRightToLeft() ? mRect.width - aPoint.x : aPoint.x); gfxFloat fitWidth; uint32_t skippedLength = ComputeTransformedLength(provider); From 668168cb493013dbfe07128a8a58900ebe7a8cad Mon Sep 17 00:00:00 2001 From: Jonathan Kew Date: Wed, 1 Oct 2014 20:25:50 +0100 Subject: [PATCH 63/63] Bug 902762 pt 7 - Draw caret appropriately for vertical textruns. r=smontagu --- layout/base/nsCaret.cpp | 57 +++++++++++++++++++++++++--------- layout/generic/nsTextFrame.cpp | 19 ++++++++---- 2 files changed, 56 insertions(+), 20 deletions(-) diff --git a/layout/base/nsCaret.cpp b/layout/base/nsCaret.cpp index a67a2054564a..fa43074d0415 100644 --- a/layout/base/nsCaret.cpp +++ b/layout/base/nsCaret.cpp @@ -305,12 +305,18 @@ nsCaret::GetGeometryForFrame(nsIFrame* aFrame, descent = fm->MaxDescent(); } nscoord height = ascent + descent; - framePos.y = baseline - ascent; + bool vertical = aFrame->GetWritingMode().IsVertical(); + if (vertical) { + framePos.x = baseline - ascent; + } else { + framePos.y = baseline - ascent; + } Metrics caretMetrics = ComputeMetrics(aFrame, aFrameOffset, height); - rect = nsRect(framePos, nsSize(caretMetrics.mCaretWidth, height)); + rect = nsRect(framePos, vertical ? nsSize(height, caretMetrics.mCaretWidth) : + nsSize(caretMetrics.mCaretWidth, height)); - // Clamp the x-position to be within our scroll frame. If we don't, then it - // clips us, and we don't appear at all. See bug 335560. + // Clamp the inline-position to be within our scroll frame. If we don't, then + // it clips us, and we don't appear at all. See bug 335560. nsIFrame *scrollFrame = nsLayoutUtils::GetClosestFrameOfType(aFrame, nsGkAtoms::scrollFrame); if (scrollFrame) { @@ -319,12 +325,20 @@ nsCaret::GetGeometryForFrame(nsIFrame* aFrame, nsIFrame *scrolled = sf->GetScrolledFrame(); nsRect caretInScroll = rect + aFrame->GetOffsetTo(scrolled); - // Now see if thet caret extends beyond the view's bounds. If it does, + // Now see if the caret extends beyond the view's bounds. If it does, // then snap it back, put it as close to the edge as it can. - nscoord overflow = caretInScroll.XMost() - - scrolled->GetVisualOverflowRectRelativeToSelf().width; - if (overflow > 0) { - rect.x -= overflow; + if (vertical) { + nscoord overflow = caretInScroll.YMost() - + scrolled->GetVisualOverflowRectRelativeToSelf().height; + if (overflow > 0) { + rect.y -= overflow; + } + } else { + nscoord overflow = caretInScroll.XMost() - + scrolled->GetVisualOverflowRectRelativeToSelf().width; + if (overflow > 0) { + rect.x -= overflow; + } } } @@ -822,13 +836,19 @@ nsCaret::ComputeCaretRects(nsIFrame* aFrame, int32_t aFrameOffset, { NS_ASSERTION(aFrame, "Should have a frame here"); + bool isVertical = aFrame->GetWritingMode().IsVertical(); + nscoord bidiIndicatorSize; *aCaretRect = GetGeometryForFrame(aFrame, aFrameOffset, &bidiIndicatorSize); // on RTL frames the right edge of mCaretRect must be equal to framePos const nsStyleVisibility* vis = aFrame->StyleVisibility(); if (NS_STYLE_DIRECTION_RTL == vis->mDirection) { - aCaretRect->x -= aCaretRect->width; + if (isVertical) { + aCaretRect->y -= aCaretRect->height; + } else { + aCaretRect->x -= aCaretRect->width; + } } // Simon -- make a hook to draw to the left or right of the caret to show keyboard language direction @@ -846,10 +866,19 @@ nsCaret::ComputeCaretRects(nsIFrame* aFrame, int32_t aFrameOffset, // If keyboard language is RTL, draw the hook on the left; if LTR, to the right // The height of the hook rectangle is the same as the width of the caret // rectangle. - aHookRect->SetRect(aCaretRect->x + (isCaretRTL ? bidiIndicatorSize * -1 : aCaretRect->width), - aCaretRect->y + bidiIndicatorSize, - bidiIndicatorSize, - aCaretRect->width); + if (isVertical) { + aHookRect->SetRect(aCaretRect->XMost() - bidiIndicatorSize, + aCaretRect->y + (isCaretRTL ? bidiIndicatorSize * -1 : + aCaretRect->height), + aCaretRect->height, + bidiIndicatorSize); + } else { + aHookRect->SetRect(aCaretRect->x + (isCaretRTL ? bidiIndicatorSize * -1 : + aCaretRect->width), + aCaretRect->y + bidiIndicatorSize, + bidiIndicatorSize, + aCaretRect->width); + } } } diff --git a/layout/generic/nsTextFrame.cpp b/layout/generic/nsTextFrame.cpp index 378134712f49..508b1da77037 100644 --- a/layout/generic/nsTextFrame.cpp +++ b/layout/generic/nsTextFrame.cpp @@ -6529,18 +6529,25 @@ nsTextFrame::GetPointFromOffset(int32_t inOffset, FindClusterStart(mTextRun, trimmedOffset, &iter); } - gfxFloat advanceWidth = + gfxFloat advance = mTextRun->GetAdvanceWidth(properties.GetStart().GetSkippedOffset(), GetSkippedDistance(properties.GetStart(), iter), &properties); - nscoord width = NSToCoordCeilClamped(advanceWidth); + nscoord iSize = NSToCoordCeilClamped(advance); - if (mTextRun->IsRightToLeft()) { - outPoint->x = mRect.width - width; + if (mTextRun->IsVertical()) { + if (mTextRun->IsRightToLeft()) { + outPoint->y = mRect.height - iSize; + } else { + outPoint->y = iSize; + } } else { - outPoint->x = width; + if (mTextRun->IsRightToLeft()) { + outPoint->x = mRect.width - iSize; + } else { + outPoint->x = iSize; + } } - outPoint->y = 0; return NS_OK; }