Bug 784739 - Switch from NULL to nullptr in js/src/ (8/9); r=ehsan
authorBirunthan Mohanathas <birunthan@mohanathas.com>
Mon, 07 Oct 2013 12:44:28 -0400
changeset 150037 212dafcf376f624c59aad688c24db443d4ab1d80
parent 150036 421efbf3ad86c5b1d3ddcec26f792bc27940faed
child 150038 09d8891fff222a2eec2267c06cf3a548b7941281
push id34726
push usereakhgari@mozilla.com
push dateMon, 07 Oct 2013 17:28:15 +0000
treeherdermozilla-inbound@c131a717180e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersehsan
bugs784739
milestone27.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 784739 - Switch from NULL to nullptr in js/src/ (8/9); r=ehsan
js/src/jsscriptinlines.h
js/src/jsstr.cpp
js/src/jsstr.h
js/src/jsutil.cpp
js/src/jswatchpoint.cpp
js/src/jsweakmap.cpp
js/src/jsweakmap.h
js/src/jsworkers.cpp
js/src/jsworkers.h
js/src/shell/jsheaptools.cpp
js/src/shell/jsoptparse.cpp
js/src/shell/jsoptparse.h
--- a/js/src/jsscriptinlines.h
+++ b/js/src/jsscriptinlines.h
@@ -16,17 +16,17 @@
 #include "jscompartmentinlines.h"
 
 #include "vm/Shape-inl.h"
 
 namespace js {
 
 inline
 Bindings::Bindings()
-    : callObjShape_(NULL), bindingArrayAndFlag_(TEMPORARY_STORAGE_BIT), numArgs_(0), numVars_(0)
+    : callObjShape_(nullptr), bindingArrayAndFlag_(TEMPORARY_STORAGE_BIT), numArgs_(0), numVars_(0)
 {}
 
 inline
 AliasedFormalIter::AliasedFormalIter(JSScript *script)
   : begin_(script->bindings.bindingArray()),
     p_(begin_),
     end_(begin_ + (script->funHasAnyAliasedFormal ? script->bindings.numArgs() : 0)),
     slot_(CallObject::RESERVED_SLOTS)
@@ -73,17 +73,17 @@ JSScript::getCallerFunction()
 
 inline JSFunction *
 JSScript::functionOrCallerFunction()
 {
     if (function())
         return function();
     if (savedCallerFun)
         return getCallerFunction();
-    return NULL;
+    return nullptr;
 }
 
 inline js::RegExpObject *
 JSScript::getRegExp(size_t index)
 {
     js::ObjectArray *arr = regexps();
     JS_ASSERT(uint32_t(index) < arr->length);
     JSObject *obj = arr->vector[index];
@@ -105,17 +105,17 @@ inline JSPrincipals *
 JSScript::principals()
 {
     return compartment()->principals;
 }
 
 inline JSFunction *
 JSScript::originalFunction() const {
     if (!isCallsiteClone)
-        return NULL;
+        return nullptr;
     return &enclosingScopeOrOriginalFunction_->as<JSFunction>();
 }
 
 inline void
 JSScript::setOriginalFunctionObject(JSObject *fun) {
     JS_ASSERT(isCallsiteClone);
     JS_ASSERT(fun->is<JSFunction>());
     enclosingScopeOrOriginalFunction_ = fun;
--- a/js/src/jsstr.cpp
+++ b/js/src/jsstr.cpp
@@ -69,17 +69,17 @@ typedef Handle<JSLinearString*> HandleLi
 static JSLinearString *
 ArgToRootedString(JSContext *cx, CallArgs &args, unsigned argno)
 {
     if (argno >= args.length())
         return cx->names().undefined;
 
     JSString *str = ToString<CanGC>(cx, args[argno]);
     if (!str)
-        return NULL;
+        return nullptr;
 
     args[argno].setString(str);
     return str->ensureLinear(cx);
 }
 
 /*
  * Forward declarations for URI encode/decode and helper routines
  */
@@ -392,17 +392,17 @@ str_resolve(JSContext *cx, HandleObject 
     RootedString str(cx, obj->as<StringObject>().unbox());
 
     int32_t slot = JSID_TO_INT(id);
     if ((size_t)slot < str->length()) {
         JSString *str1 = cx->runtime()->staticStrings.getUnitStringForElement(cx, str, size_t(slot));
         if (!str1)
             return false;
         RootedValue value(cx, StringValue(str1));
-        if (!JSObject::defineElement(cx, obj, uint32_t(slot), value, NULL, NULL,
+        if (!JSObject::defineElement(cx, obj, uint32_t(slot), value, nullptr, nullptr,
                                      STRING_ELEMENT_ATTRS))
         {
             return false;
         }
         objp.set(obj);
     }
     return true;
 }
@@ -424,40 +424,40 @@ const Class StringObject::class_ = {
  * Returns a JSString * for the |this| value associated with 'call', or throws
  * a TypeError if |this| is null or undefined.  This algorithm is the same as
  * calling CheckObjectCoercible(this), then returning ToString(this), as all
  * String.prototype.* methods do (other than toString and valueOf).
  */
 static JS_ALWAYS_INLINE JSString *
 ThisToStringForStringProto(JSContext *cx, CallReceiver call)
 {
-    JS_CHECK_RECURSION(cx, return NULL);
+    JS_CHECK_RECURSION(cx, return nullptr);
 
     if (call.thisv().isString())
         return call.thisv().toString();
 
     if (call.thisv().isObject()) {
         RootedObject obj(cx, &call.thisv().toObject());
         if (obj->is<StringObject>()) {
             Rooted<jsid> id(cx, NameToId(cx->names().toString));
             if (ClassMethodIsNative(cx, obj, &StringObject::class_, id, js_str_toString)) {
                 JSString *str = obj->as<StringObject>().unbox();
                 call.setThis(StringValue(str));
                 return str;
             }
         }
     } else if (call.thisv().isNullOrUndefined()) {
-        JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_CANT_CONVERT_TO,
+        JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_CANT_CONVERT_TO,
                              call.thisv().isNull() ? "null" : "undefined", "object");
-        return NULL;
+        return nullptr;
     }
 
     JSString *str = ToStringSlow<CanGC>(cx, call.thisv());
     if (!str)
-        return NULL;
+        return nullptr;
 
     call.setThis(StringValue(str));
     return str;
 }
 
 JS_ALWAYS_INLINE bool
 IsString(HandleValue v)
 {
@@ -596,21 +596,21 @@ DoSubstr(JSContext *cx, JSString *str, s
 
         size_t lhsLength = rope->leftChild()->length() - begin;
         size_t rhsLength = begin + len - rope->leftChild()->length();
 
         Rooted<JSRope *> ropeRoot(cx, rope);
         RootedString lhs(cx, js_NewDependentString(cx, ropeRoot->leftChild(),
                                                    begin, lhsLength));
         if (!lhs)
-            return NULL;
+            return nullptr;
 
         RootedString rhs(cx, js_NewDependentString(cx, ropeRoot->rightChild(), 0, rhsLength));
         if (!rhs)
-            return NULL;
+            return nullptr;
 
         return JSRope::new_<CanGC>(cx, lhs, rhs, len);
     }
 
     return js_NewDependentString(cx, str, begin, len);
 }
 
 static bool
@@ -673,28 +673,28 @@ str_substring(JSContext *cx, unsigned ar
 }
 
 JSString* JS_FASTCALL
 js_toLowerCase(JSContext *cx, JSString *str)
 {
     size_t n = str->length();
     const jschar *s = str->getChars(cx);
     if (!s)
-        return NULL;
+        return nullptr;
 
     jschar *news = cx->pod_malloc<jschar>(n + 1);
     if (!news)
-        return NULL;
+        return nullptr;
     for (size_t i = 0; i < n; i++)
         news[i] = unicode::ToLowerCase(s[i]);
     news[n] = 0;
     str = js_NewString<CanGC>(cx, news, n);
     if (!str) {
         js_free(news);
-        return NULL;
+        return nullptr;
     }
     return str;
 }
 
 static inline bool
 ToLowerCaseHelper(JSContext *cx, CallReceiver call)
 {
     RootedString str(cx, ThisToStringForStringProto(cx, call));
@@ -741,27 +741,27 @@ str_toLocaleLowerCase(JSContext *cx, uns
 }
 
 JSString* JS_FASTCALL
 js_toUpperCase(JSContext *cx, JSString *str)
 {
     size_t n = str->length();
     const jschar *s = str->getChars(cx);
     if (!s)
-        return NULL;
+        return nullptr;
     jschar *news = cx->pod_malloc<jschar>(n + 1);
     if (!news)
-        return NULL;
+        return nullptr;
     for (size_t i = 0; i < n; i++)
         news[i] = unicode::ToUpperCase(s[i]);
     news[n] = 0;
     str = js_NewString<CanGC>(cx, news, n);
     if (!str) {
         js_free(news);
-        return NULL;
+        return nullptr;
     }
     return str;
 }
 
 static bool
 ToUpperCaseHelper(JSContext *cx, CallReceiver call)
 {
     RootedString str(cx, ThisToStringForStringProto(cx, call));
@@ -1115,28 +1115,28 @@ class StringSegmentRange
     {}
 
     JS_WARN_UNUSED_RESULT bool init(JSString *str) {
         JS_ASSERT(stack.empty());
         return settle(str);
     }
 
     bool empty() const {
-        return cur == NULL;
+        return cur == nullptr;
     }
 
     JSLinearString *front() const {
         JS_ASSERT(!cur->isRope());
         return cur;
     }
 
     JS_WARN_UNUSED_RESULT bool popFront() {
         JS_ASSERT(!empty());
         if (stack.empty()) {
-            cur = NULL;
+            cur = nullptr;
             return true;
         }
         return settle(stack.popCopy());
     }
 };
 
 /*
  * RopeMatch takes the text to search and the pattern to search for in the text.
@@ -1660,28 +1660,28 @@ class MOZ_STACK_CLASS StringRegExpGuard
      */
     static const size_t MAX_FLAT_PAT_LEN = 256;
 
     static JSAtom *
     flattenPattern(JSContext *cx, JSAtom *patstr)
     {
         StringBuffer sb(cx);
         if (!sb.reserve(patstr->length()))
-            return NULL;
+            return nullptr;
 
         static const jschar ESCAPE_CHAR = '\\';
         const jschar *chars = patstr->chars();
         size_t len = patstr->length();
         for (const jschar *it = chars; it != chars + len; ++it) {
             if (IsRegExpMetaChar(*it)) {
                 if (!sb.append(ESCAPE_CHAR) || !sb.append(*it))
-                    return NULL;
+                    return nullptr;
             } else {
                 if (!sb.append(*it))
-                    return NULL;
+                    return nullptr;
             }
         }
         return sb.finishAtom();
     }
 
   public:
     StringRegExpGuard(JSContext *cx)
       : re_(cx), fm(cx), obj_(cx)
@@ -1707,50 +1707,51 @@ class MOZ_STACK_CLASS StringRegExpGuard
             fm.patstr = AtomizeString<CanGC>(cx, arg);
             if (!fm.patstr)
                 return false;
         }
         return true;
     }
 
     /*
-     * Attempt to match |patstr| to |textstr|. A flags argument, metachars in the
-     * pattern string, or a lengthy pattern string can thwart this process.
+     * Attempt to match |patstr| to |textstr|. A flags argument, metachars in
+     * the pattern string, or a lengthy pattern string can thwart this process.
      *
      * |checkMetaChars| looks for regexp metachars in the pattern string.
      *
      * Return whether flat matching could be used.
      *
-     * N.B. tryFlatMatch returns NULL on OOM, so the caller must check cx->isExceptionPending().
+     * N.B. tryFlatMatch returns nullptr on OOM, so the caller must check
+     * cx->isExceptionPending().
      */
     const FlatMatch *
     tryFlatMatch(JSContext *cx, JSString *textstr, unsigned optarg, unsigned argc,
                  bool checkMetaChars = true)
     {
         if (re_.initialized())
-            return NULL;
+            return nullptr;
 
         fm.pat = fm.patstr->chars();
         fm.patlen = fm.patstr->length();
 
         if (optarg < argc)
-            return NULL;
+            return nullptr;
 
         if (checkMetaChars &&
             (fm.patlen > MAX_FLAT_PAT_LEN || HasRegExpMetaChars(fm.pat, fm.patlen))) {
-            return NULL;
+            return nullptr;
         }
 
         /*
          * textstr could be a rope, so we want to avoid flattening it for as
          * long as possible.
          */
         if (textstr->isRope()) {
             if (!RopeMatch(cx, textstr, fm.pat, fm.patlen, &fm.match_))
-                return NULL;
+                return nullptr;
         } else {
             const jschar *text = textstr->asLinear().chars();
             size_t textlen = textstr->length();
             fm.match_ = StringMatch(text, textlen, fm.pat, fm.patlen);
         }
         return &fm;
     }
 
@@ -1762,17 +1763,17 @@ class MOZ_STACK_CLASS StringRegExpGuard
 
         /* Build RegExp from pattern string. */
         RootedString opt(cx);
         if (optarg < args.length()) {
             opt = ToString<CanGC>(cx, args[optarg]);
             if (!opt)
                 return false;
         } else {
-            opt = NULL;
+            opt = nullptr;
         }
 
         Rooted<JSAtom *> patstr(cx);
         if (flat) {
             patstr = flattenPattern(cx, fm.patstr);
             if (!patstr)
                 return false;
         } else {
@@ -1790,17 +1791,17 @@ class MOZ_STACK_CLASS StringRegExpGuard
         // Don't use RegExpObject::setLastIndex, because that ignores the
         // writability of "lastIndex" on this user-controlled RegExp object.
         RootedValue zero(cx, Int32Value(0));
         return JSObject::setProperty(cx, obj_, obj_, cx->names().lastIndex, &zero, true);
     }
 
     RegExpShared &regExp() { return *re_; }
 
-    bool regExpIsObject() { return obj_ != NULL; }
+    bool regExpIsObject() { return obj_ != nullptr; }
     HandleObject regExpObject() {
         JS_ASSERT(regExpIsObject());
         return obj_;
     }
 
   private:
     StringRegExpGuard(const StringRegExpGuard &) MOZ_DELETE;
     void operator=(const StringRegExpGuard &) MOZ_DELETE;
@@ -2247,17 +2248,17 @@ FindReplaceLength(JSContext *cx, RegExpS
             *sizep = rdata.repstr->length();
             return true;
         }
 
         /*
          * Couldn't handle this property, fall through and despecialize to the
          * general lambda case.
          */
-        rdata.elembase = NULL;
+        rdata.elembase = nullptr;
     }
 
     if (rdata.lambda) {
         RootedObject lambda(cx, rdata.lambda);
         PreserveRegExpStatics staticsGuard(cx, res);
         if (!staticsGuard.init(cx))
             return false;
 
@@ -2576,17 +2577,17 @@ struct StringRange
 static inline JSShortString *
 FlattenSubstrings(JSContext *cx, const jschar *chars,
                   const StringRange *ranges, size_t rangesLen, size_t outputLen)
 {
     JS_ASSERT(JSShortString::lengthFits(outputLen));
 
     JSShortString *str = js_NewGCShortString<CanGC>(cx);
     if (!str)
-        return NULL;
+        return nullptr;
     jschar *buf = str->init(outputLen);
 
     size_t pos = 0;
     for (size_t i = 0; i < rangesLen; i++) {
         PodCopy(buf + pos, chars + ranges[i].start, ranges[i].length);
         pos += ranges[i].length;
     }
     JS_ASSERT(pos == outputLen);
@@ -2602,22 +2603,22 @@ AppendSubstrings(JSContext *cx, Handle<J
     JS_ASSERT(rangesLen);
 
     /* For single substrings, construct a dependent string. */
     if (rangesLen == 1)
         return js_NewDependentString(cx, stableStr, ranges[0].start, ranges[0].length);
 
     const jschar *chars = stableStr->getChars(cx);
     if (!chars)
-        return NULL;
+        return nullptr;
 
     /* Collect substrings into a rope */
     size_t i = 0;
     RopeBuilder rope(cx);
-    RootedString part(cx, NULL);
+    RootedString part(cx, nullptr);
     while (i < rangesLen) {
 
         /* Find maximum range that fits in JSShortString */
         size_t substrLen = 0;
         size_t end = i;
         for (; end < rangesLen; end++) {
             if (substrLen + ranges[end].length > JSShortString::MAX_SHORT_LENGTH)
                 break;
@@ -2630,17 +2631,17 @@ AppendSubstrings(JSContext *cx, Handle<J
             part = js_NewDependentString(cx, stableStr, sr.start, sr.length);
         } else {
             /* Copy the ranges (linearly) into a JSShortString */
             part = FlattenSubstrings(cx, chars, ranges + i, end - i, substrLen);
             i = end;
         }
 
         if (!part)
-            return NULL;
+            return nullptr;
 
         /* Appending to the rope permanently roots the substring. */
         rope.append(part);
     }
 
     return rope.result();
 }
 
@@ -2906,25 +2907,25 @@ js::str_replace(JSContext *cx, unsigned 
         return false;
 
     if (!rdata.g.init(cx, args))
         return false;
 
     /* Extract replacement string/function. */
     if (args.length() >= ReplaceOptArg && js_IsCallable(args[1])) {
         rdata.lambda = &args[1].toObject();
-        rdata.elembase = NULL;
-        rdata.repstr = NULL;
-        rdata.dollar = rdata.dollarEnd = NULL;
+        rdata.elembase = nullptr;
+        rdata.repstr = nullptr;
+        rdata.dollar = rdata.dollarEnd = nullptr;
 
         if (!LambdaIsGetElem(cx, *rdata.lambda, &rdata.elembase))
             return false;
     } else {
-        rdata.lambda = NULL;
-        rdata.elembase = NULL;
+        rdata.lambda = nullptr;
+        rdata.elembase = nullptr;
         rdata.repstr = ArgToRootedString(cx, args, 1);
         if (!rdata.repstr)
             return false;
 
         /* We're about to store pointers into the middle of our string. */
         JSLinearString *linear = rdata.repstr;
         rdata.dollarEnd = linear->chars() + linear->length();
         rdata.dollar = js_strchr_limit(linear->chars(), '$', rdata.dollarEnd);
@@ -3003,17 +3004,17 @@ SplitHelper(JSContext *cx, Handle<JSLine
             Handle<TypeObject*> type)
 {
     size_t strLength = str->length();
     SplitMatchResult result;
 
     /* Step 11. */
     if (strLength == 0) {
         if (!splitMatch(cx, str, 0, &result))
-            return NULL;
+            return nullptr;
 
         /*
          * NB: Unlike in the non-empty string case, it's perfectly fine
          *     (indeed the spec requires it) if we match at the end of the
          *     string.  Thus these cases should hold:
          *
          *   var a = "".split("");
          *   assertEq(a.length, 0);
@@ -3032,17 +3033,17 @@ SplitHelper(JSContext *cx, Handle<JSLine
     size_t index = 0;
 
     /* Step 13. */
     AutoValueVector splits(cx);
 
     while (index < strLength) {
         /* Step 13(a). */
         if (!splitMatch(cx, str, index, &result))
-            return NULL;
+            return nullptr;
 
         /*
          * Step 13(b).
          *
          * Our match algorithm differs from the spec in that it returns the
          * next index at which a match happens.  If no match happens we're
          * done.
          *
@@ -3073,17 +3074,17 @@ SplitHelper(JSContext *cx, Handle<JSLine
         JS_ASSERT(lastEndIndex < endIndex);
         JS_ASSERT(sepLength <= strLength);
         JS_ASSERT(lastEndIndex + sepLength <= endIndex);
 
         /* Steps 13(c)(iii)(1-3). */
         size_t subLength = size_t(endIndex - sepLength - lastEndIndex);
         JSString *sub = js_NewDependentString(cx, str, lastEndIndex, subLength);
         if (!sub || !splits.append(StringValue(sub)))
-            return NULL;
+            return nullptr;
 
         /* Step 13(c)(iii)(4). */
         if (splits.length() == limit)
             return NewDenseCopiedArray(cx, splits.length(), splits.begin());
 
         /* Step 13(c)(iii)(5). */
         lastEndIndex = endIndex;
 
@@ -3093,38 +3094,38 @@ SplitHelper(JSContext *cx, Handle<JSLine
             const MatchPairs &matches = res->getMatches();
             for (size_t i = 0; i < matches.parenCount(); i++) {
                 /* Steps 13(c)(iii)(7)(a-c). */
                 if (!matches[i + 1].isUndefined()) {
                     JSSubString parsub;
                     res->getParen(i + 1, &parsub);
                     sub = js_NewStringCopyN<CanGC>(cx, parsub.chars, parsub.length);
                     if (!sub || !splits.append(StringValue(sub)))
-                        return NULL;
+                        return nullptr;
                 } else {
                     /* Only string entries have been accounted for so far. */
-                    AddTypeProperty(cx, type, NULL, UndefinedValue());
+                    AddTypeProperty(cx, type, nullptr, UndefinedValue());
                     if (!splits.append(UndefinedValue()))
-                        return NULL;
+                        return nullptr;
                 }
 
                 /* Step 13(c)(iii)(7)(d). */
                 if (splits.length() == limit)
                     return NewDenseCopiedArray(cx, splits.length(), splits.begin());
             }
         }
 
         /* Step 13(c)(iii)(8). */
         index = lastEndIndex;
     }
 
     /* Steps 14-15. */
     JSString *sub = js_NewDependentString(cx, str, lastEndIndex, strLength - lastEndIndex);
     if (!sub || !splits.append(StringValue(sub)))
-        return NULL;
+        return nullptr;
 
     /* Step 16. */
     return NewDenseCopiedArray(cx, splits.length(), splits.begin());
 }
 
 namespace {
 
 /*
@@ -3206,17 +3207,17 @@ js::str_split(JSContext *cx, unsigned ar
     /* Steps 1-2. */
     RootedString str(cx, ThisToStringForStringProto(cx, args));
     if (!str)
         return false;
 
     RootedTypeObject type(cx, GetTypeCallerInitObject(cx, JSProto_Array));
     if (!type)
         return false;
-    AddTypeProperty(cx, type, NULL, Type::StringType());
+    AddTypeProperty(cx, type, nullptr, Type::StringType());
 
     /* Step 5: Use the second argument as the split limit, if given. */
     uint32_t limit;
     if (args.hasDefined(1)) {
         double d;
         if (!ToNumber(cx, args[1], &d))
             return false;
         limit = ToUint32(d);
@@ -3518,29 +3519,29 @@ tagify_value(JSContext *cx, CallArgs arg
         return false;
 
     return tagify(cx, begin, param, end, args);
 }
 
 static bool
 str_bold(JSContext *cx, unsigned argc, Value *vp)
 {
-    return tagify(cx, "b", NullPtr(), NULL, CallReceiverFromVp(vp));
+    return tagify(cx, "b", NullPtr(), nullptr, CallReceiverFromVp(vp));
 }
 
 static bool
 str_italics(JSContext *cx, unsigned argc, Value *vp)
 {
-    return tagify(cx, "i", NullPtr(), NULL, CallReceiverFromVp(vp));
+    return tagify(cx, "i", NullPtr(), nullptr, CallReceiverFromVp(vp));
 }
 
 static bool
 str_fixed(JSContext *cx, unsigned argc, Value *vp)
 {
-    return tagify(cx, "tt", NullPtr(), NULL, CallReceiverFromVp(vp));
+    return tagify(cx, "tt", NullPtr(), nullptr, CallReceiverFromVp(vp));
 }
 
 static bool
 str_fontsize(JSContext *cx, unsigned argc, Value *vp)
 {
     return tagify_value(cx, CallArgsFromVp(argc, vp), "font size", "font");
 }
 
@@ -3560,47 +3561,47 @@ static bool
 str_anchor(JSContext *cx, unsigned argc, Value *vp)
 {
     return tagify_value(cx, CallArgsFromVp(argc, vp), "a name", "a");
 }
 
 static bool
 str_strike(JSContext *cx, unsigned argc, Value *vp)
 {
-    return tagify(cx, "strike", NullPtr(), NULL, CallReceiverFromVp(vp));
+    return tagify(cx, "strike", NullPtr(), nullptr, CallReceiverFromVp(vp));
 }
 
 static bool
 str_small(JSContext *cx, unsigned argc, Value *vp)
 {
-    return tagify(cx, "small", NullPtr(), NULL, CallReceiverFromVp(vp));
+    return tagify(cx, "small", NullPtr(), nullptr, CallReceiverFromVp(vp));
 }
 
 static bool
 str_big(JSContext *cx, unsigned argc, Value *vp)
 {
-    return tagify(cx, "big", NullPtr(), NULL, CallReceiverFromVp(vp));
+    return tagify(cx, "big", NullPtr(), nullptr, CallReceiverFromVp(vp));
 }
 
 static bool
 str_blink(JSContext *cx, unsigned argc, Value *vp)
 {
-    return tagify(cx, "blink", NullPtr(), NULL, CallReceiverFromVp(vp));
+    return tagify(cx, "blink", NullPtr(), nullptr, CallReceiverFromVp(vp));
 }
 
 static bool
 str_sup(JSContext *cx, unsigned argc, Value *vp)
 {
-    return tagify(cx, "sup", NullPtr(), NULL, CallReceiverFromVp(vp));
+    return tagify(cx, "sup", NullPtr(), nullptr, CallReceiverFromVp(vp));
 }
 
 static bool
 str_sub(JSContext *cx, unsigned argc, Value *vp)
 {
-    return tagify(cx, "sub", NullPtr(), NULL, CallReceiverFromVp(vp));
+    return tagify(cx, "sub", NullPtr(), nullptr, CallReceiverFromVp(vp));
 }
 #endif /* JS_HAS_STR_HTML_HELPERS */
 
 static const JSFunctionSpec string_methods[] = {
 #if JS_HAS_TOSOURCE
     JS_FN("quote",             str_quote,             0,JSFUN_GENERIC_NATIVE),
     JS_FN(js_toSource_str,     str_toSource,          0,0),
 #endif
@@ -3752,42 +3753,42 @@ js_InitStringClass(JSContext *cx, Handle
 {
     JS_ASSERT(obj->isNative());
 
     Rooted<GlobalObject*> global(cx, &obj->as<GlobalObject>());
 
     Rooted<JSString*> empty(cx, cx->runtime()->emptyString);
     RootedObject proto(cx, global->createBlankPrototype(cx, &StringObject::class_));
     if (!proto || !proto->as<StringObject>().init(cx, empty))
-        return NULL;
+        return nullptr;
 
     /* Now create the String function. */
     RootedFunction ctor(cx);
     ctor = global->createConstructor(cx, js_String, cx->names().String, 1);
     if (!ctor)
-        return NULL;
+        return nullptr;
 
     if (!LinkConstructorAndPrototype(cx, ctor, proto))
-        return NULL;
-
-    if (!DefinePropertiesAndBrand(cx, proto, NULL, string_methods) ||
-        !DefinePropertiesAndBrand(cx, ctor, NULL, string_static_methods))
+        return nullptr;
+
+    if (!DefinePropertiesAndBrand(cx, proto, nullptr, string_methods) ||
+        !DefinePropertiesAndBrand(cx, ctor, nullptr, string_static_methods))
     {
-        return NULL;
+        return nullptr;
     }
 
     if (!DefineConstructorAndPrototype(cx, global, JSProto_String, ctor, proto))
-        return NULL;
+        return nullptr;
 
     /*
      * Define escape/unescape, the URI encode/decode functions, and maybe
      * uneval on the global object.
      */
     if (!JS_DefineFunctions(cx, global, string_functions))
-        return NULL;
+        return nullptr;
 
     return proto;
 }
 
 template <AllowGC allowGC>
 JSStableString *
 js_NewString(ThreadSafeContext *cx, jschar *chars, size_t length)
 {
@@ -3803,17 +3804,17 @@ js_NewString<NoGC>(ThreadSafeContext *cx
 JSLinearString *
 js_NewDependentString(JSContext *cx, JSString *baseArg, size_t start, size_t length)
 {
     if (length == 0)
         return cx->emptyString();
 
     JSLinearString *base = baseArg->ensureLinear(cx);
     if (!base)
-        return NULL;
+        return nullptr;
 
     if (start == 0 && length == base->length())
         return base;
 
     const jschar *chars = base->chars() + start;
 
     if (JSLinearString *staticStr = cx->runtime()->staticStrings.lookup(chars, length))
         return staticStr;
@@ -3825,17 +3826,17 @@ template <AllowGC allowGC>
 JSFlatString *
 js_NewStringCopyN(ExclusiveContext *cx, const jschar *s, size_t n)
 {
     if (JSShortString::lengthFits(n))
         return NewShortString<allowGC>(cx, TwoByteChars(s, n));
 
     jschar *news = cx->pod_malloc<jschar>(n + 1);
     if (!news)
-        return NULL;
+        return nullptr;
     js_strncpy(news, s, n);
     news[n] = 0;
     JSFlatString *str = js_NewString<allowGC>(cx, news, n);
     if (!str)
         js_free(news);
     return str;
 }
 
@@ -3849,17 +3850,17 @@ template <AllowGC allowGC>
 JSFlatString *
 js_NewStringCopyN(ThreadSafeContext *cx, const char *s, size_t n)
 {
     if (JSShortString::lengthFits(n))
         return NewShortString<allowGC>(cx, JS::Latin1Chars(s, n));
 
     jschar *chars = InflateString(cx, s, &n);
     if (!chars)
-        return NULL;
+        return nullptr;
     JSFlatString *str = js_NewString<allowGC>(cx, chars, n);
     if (!str)
         js_free(chars);
     return str;
 }
 
 template JSFlatString *
 js_NewStringCopyN<CanGC>(ThreadSafeContext *cx, const char *s, size_t n);
@@ -3873,17 +3874,17 @@ js_NewStringCopyZ(ExclusiveContext *cx, 
 {
     size_t n = js_strlen(s);
     if (JSShortString::lengthFits(n))
         return NewShortString<allowGC>(cx, TwoByteChars(s, n));
 
     size_t m = (n + 1) * sizeof(jschar);
     jschar *news = (jschar *) cx->malloc_(m);
     if (!news)
-        return NULL;
+        return nullptr;
     js_memcpy(news, s, m);
     JSFlatString *str = js_NewString<allowGC>(cx, news, n);
     if (!str)
         js_free(news);
     return str;
 }
 
 template JSFlatString *
@@ -3910,37 +3911,37 @@ js_ValueToPrintable(JSContext *cx, const
 {
     RootedValue v(cx, vArg);
     JSString *str;
     if (asSource)
         str = ValueToSource(cx, v);
     else
         str = ToString<CanGC>(cx, v);
     if (!str)
-        return NULL;
+        return nullptr;
     str = js_QuoteString(cx, str, 0);
     if (!str)
-        return NULL;
+        return nullptr;
     return bytes->encodeLatin1(cx, str);
 }
 
 template <AllowGC allowGC>
 JSString *
 js::ToStringSlow(ExclusiveContext *cx, typename MaybeRooted<Value, allowGC>::HandleType arg)
 {
     /* As with ToObjectSlow, callers must verify that |arg| isn't a string. */
     JS_ASSERT(!arg.isString());
 
     Value v = arg;
     if (!v.isPrimitive()) {
         if (!cx->shouldBeJSContext() || !allowGC)
-            return NULL;
+            return nullptr;
         RootedValue v2(cx, v);
         if (!ToPrimitive(cx->asJSContext(), JSTYPE_STRING, &v2))
-            return NULL;
+            return nullptr;
         v = v2;
     }
 
     JSString *str;
     if (v.isString()) {
         str = v.toString();
     } else if (v.isInt32()) {
         str = Int32ToString<allowGC>(cx, v.toInt32());
@@ -3960,17 +3961,17 @@ template JSString *
 js::ToStringSlow<CanGC>(ExclusiveContext *cx, HandleValue arg);
 
 template JSString *
 js::ToStringSlow<NoGC>(ExclusiveContext *cx, Value arg);
 
 JSString *
 js::ValueToSource(JSContext *cx, HandleValue v)
 {
-    JS_CHECK_RECURSION(cx, return NULL);
+    JS_CHECK_RECURSION(cx, return nullptr);
     assertSameCompartment(cx, v);
 
     if (v.isUndefined())
         return cx->names().void0;
     if (v.isString())
         return StringToSource(cx, v.toString());
     if (v.isPrimitive()) {
         /* Special case to preserve negative zero, _contra_ toString. */
@@ -3981,21 +3982,21 @@ js::ValueToSource(JSContext *cx, HandleV
             return js_NewStringCopyN<CanGC>(cx, js_negzero_ucNstr, 2);
         }
         return ToString<CanGC>(cx, v);
     }
 
     RootedValue fval(cx);
     RootedObject obj(cx, &v.toObject());
     if (!JSObject::getProperty(cx, obj, obj, cx->names().toSource, &fval))
-        return NULL;
+        return nullptr;
     if (js_IsCallable(fval)) {
         RootedValue rval(cx);
-        if (!Invoke(cx, ObjectValue(*obj), fval, 0, NULL, &rval))
-            return NULL;
+        if (!Invoke(cx, ObjectValue(*obj), fval, 0, nullptr, &rval))
+            return nullptr;
         return ToString<CanGC>(cx, rval);
     }
 
     return ObjectToSource(cx, obj);
 }
 
 JSString *
 js::StringToSource(JSContext *cx, JSString *str)
@@ -4098,31 +4099,31 @@ js_strlen(const jschar *s)
 }
 
 jschar *
 js_strdup(js::ThreadSafeContext *cx, const jschar *s)
 {
     size_t n = js_strlen(s);
     jschar *ret = cx->pod_malloc<jschar>(n + 1);
     if (!ret)
-        return NULL;
+        return nullptr;
     js_strncpy(ret, s, n);
     ret[n] = '\0';
     return ret;
 }
 
 jschar *
 js_strchr_limit(const jschar *s, jschar c, const jschar *limit)
 {
     while (s < limit) {
         if (*s == c)
             return (jschar *)s;
         s++;
     }
-    return NULL;
+    return nullptr;
 }
 
 jschar *
 js::InflateString(ThreadSafeContext *cx, const char *bytes, size_t *lengthp)
 {
     size_t nchars;
     jschar *chars;
     size_t nbytes = *lengthp;
@@ -4136,30 +4137,30 @@ js::InflateString(ThreadSafeContext *cx,
     *lengthp = nchars;
     chars[nchars] = 0;
     return chars;
 
   bad:
     // For compatibility with callers of JS_DecodeBytes we must zero lengthp
     // on errors.
     *lengthp = 0;
-    return NULL;
+    return nullptr;
 }
 
 bool
 js::DeflateStringToBuffer(JSContext *maybecx, const jschar *src, size_t srclen,
                           char *dst, size_t *dstlenp)
 {
     size_t dstlen = *dstlenp;
     if (srclen > dstlen) {
         for (size_t i = 0; i < dstlen; i++)
             dst[i] = (char) src[i];
         if (maybecx) {
             AutoSuppressGC suppress(maybecx);
-            JS_ReportErrorNumber(maybecx, js_GetErrorMessage, NULL,
+            JS_ReportErrorNumber(maybecx, js_GetErrorMessage, nullptr,
                                  JSMSG_BUFFER_TOO_SMALL);
         }
         return false;
     }
     for (size_t i = 0; i < srclen; i++)
         dst[i] = (char) src[i];
     *dstlenp = srclen;
     return true;
@@ -4339,33 +4340,33 @@ Encode(JSContext *cx, Handle<JSLinearStr
     hexBuf[3] = 0;
     for (size_t k = 0; k < length; k++) {
         jschar c = chars[k];
         if (c < 128 && (unescapedSet[c] || (unescapedSet2 && unescapedSet2[c]))) {
             if (!sb.append(c))
                 return false;
         } else {
             if ((c >= 0xDC00) && (c <= 0xDFFF)) {
-                JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_BAD_URI, NULL);
+                JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_BAD_URI, nullptr);
                 return false;
             }
             uint32_t v;
             if (c < 0xD800 || c > 0xDBFF) {
                 v = c;
             } else {
                 k++;
                 if (k == length) {
-                    JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL,
-                                     JSMSG_BAD_URI, NULL);
+                    JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr,
+                                     JSMSG_BAD_URI, nullptr);
                     return false;
                 }
                 jschar c2 = chars[k];
                 if ((c2 < 0xDC00) || (c2 > 0xDFFF)) {
-                    JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL,
-                                     JSMSG_BAD_URI, NULL);
+                    JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr,
+                                     JSMSG_BAD_URI, nullptr);
                     return false;
                 }
                 v = ((c - 0xD800) << 10) + (c2 - 0xDC00) + 0x10000;
             }
             uint8_t utf8buf[4];
             size_t L = js_OneUcs4ToUtf8Char(utf8buf, v);
             for (size_t j = 0; j < L; j++) {
                 hexBuf[1] = HexDigits[utf8buf[j] >> 4];
@@ -4448,17 +4449,17 @@ Decode(JSContext *cx, Handle<JSLinearStr
             if (!sb.append(c))
                 return false;
         }
     }
 
     return TransferBufferToString(sb, rval);
 
   report_bad_uri:
-    JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_BAD_URI);
+    JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_BAD_URI);
     /* FALL THROUGH */
 
     return false;
 }
 
 static bool
 str_decodeURI(JSContext *cx, unsigned argc, Value *vp)
 {
@@ -4473,17 +4474,17 @@ str_decodeURI(JSContext *cx, unsigned ar
 static bool
 str_decodeURI_Component(JSContext *cx, unsigned argc, Value *vp)
 {
     CallArgs args = CallArgsFromVp(argc, vp);
     Rooted<JSLinearString*> str(cx, ArgToRootedString(cx, args, 0));
     if (!str)
         return false;
 
-    return Decode(cx, str, NULL, args.rval());
+    return Decode(cx, str, nullptr, args.rval());
 }
 
 static bool
 str_encodeURI(JSContext *cx, unsigned argc, Value *vp)
 {
     CallArgs args = CallArgsFromVp(argc, vp);
     Rooted<JSLinearString*> str(cx, ArgToRootedString(cx, args, 0));
     if (!str)
@@ -4495,17 +4496,17 @@ str_encodeURI(JSContext *cx, unsigned ar
 static bool
 str_encodeURI_Component(JSContext *cx, unsigned argc, Value *vp)
 {
     CallArgs args = CallArgsFromVp(argc, vp);
     Rooted<JSLinearString*> str(cx, ArgToRootedString(cx, args, 0));
     if (!str)
         return false;
 
-    return Encode(cx, str, js_isUriUnescaped, NULL, args.rval());
+    return Encode(cx, str, js_isUriUnescaped, nullptr, args.rval());
 }
 
 /*
  * Convert one UCS-4 char and write it into a UTF-8 buffer, which must be at
  * least 4 bytes long.  Return the number of UTF-8 bytes of data written.
  */
 int
 js_OneUcs4ToUtf8Char(uint8_t *utf8Buffer, uint32_t ucs4Char)
@@ -4549,17 +4550,17 @@ js::PutEscapedStringImpl(char *buffer, s
         STOP, FIRST_QUOTE, LAST_QUOTE, CHARS, ESCAPE_START, ESCAPE_MORE
     } state;
 
     JS_ASSERT(quote == 0 || quote == '\'' || quote == '"');
     JS_ASSERT_IF(!buffer, bufferSize == 0);
     JS_ASSERT_IF(fp, !buffer);
 
     if (bufferSize == 0)
-        buffer = NULL;
+        buffer = nullptr;
     else
         bufferSize--;
 
     const jschar *charsEnd = chars + length;
     size_t n = 0;
     state = FIRST_QUOTE;
     unsigned shift = 0;
     unsigned hex = 0;
@@ -4633,17 +4634,17 @@ js::PutEscapedStringImpl(char *buffer, s
             break;
         }
         if (buffer) {
             JS_ASSERT(n <= bufferSize);
             if (n != bufferSize) {
                 buffer[n] = c;
             } else {
                 buffer[n] = '\0';
-                buffer = NULL;
+                buffer = nullptr;
             }
         } else if (fp) {
             if (fputc(c, fp) < 0)
                 return size_t(-1);
         }
         n++;
     }
   stop:
--- a/js/src/jsstr.h
+++ b/js/src/jsstr.h
@@ -313,42 +313,42 @@ PutEscapedStringImpl(char *buffer, size_
  * the length of the written output, NOT including the NUL. Thus, a return
  * value of size or more means that the output was truncated. If buffer
  * is null, just returns the length of the output. If quote is not 0, it must
  * be a single or double quote character that will quote the output.
 */
 inline size_t
 PutEscapedString(char *buffer, size_t size, JSLinearString *str, uint32_t quote)
 {
-    size_t n = PutEscapedStringImpl(buffer, size, NULL, str, quote);
+    size_t n = PutEscapedStringImpl(buffer, size, nullptr, str, quote);
 
     /* PutEscapedStringImpl can only fail with a file. */
     JS_ASSERT(n != size_t(-1));
     return n;
 }
 
 inline size_t
 PutEscapedString(char *buffer, size_t bufferSize, const jschar *chars, size_t length, uint32_t quote)
 {
-    size_t n = PutEscapedStringImpl(buffer, bufferSize, NULL, chars, length, quote);
+    size_t n = PutEscapedStringImpl(buffer, bufferSize, nullptr, chars, length, quote);
 
     /* PutEscapedStringImpl can only fail with a file. */
     JS_ASSERT(n != size_t(-1));
     return n;
 }
 
 /*
  * Write str into file escaping any non-printable or non-ASCII character.
  * If quote is not 0, it must be a single or double quote character that
  * will quote the output.
 */
 inline bool
 FileEscapedString(FILE *fp, JSLinearString *str, uint32_t quote)
 {
-    return PutEscapedStringImpl(NULL, 0, fp, str, quote) != size_t(-1);
+    return PutEscapedStringImpl(nullptr, 0, fp, str, quote) != size_t(-1);
 }
 
 bool
 str_match(JSContext *cx, unsigned argc, Value *vp);
 
 bool
 str_search(JSContext *cx, unsigned argc, Value *vp);
 
--- a/js/src/jsutil.cpp
+++ b/js/src/jsutil.cpp
@@ -41,20 +41,20 @@ zlib_free(void *cx, void *addr)
 }
 
 Compressor::Compressor(const unsigned char *inp, size_t inplen)
     : inp(inp),
       inplen(inplen),
       outbytes(0)
 {
     JS_ASSERT(inplen > 0);
-    zs.opaque = NULL;
+    zs.opaque = nullptr;
     zs.next_in = (Bytef *)inp;
     zs.avail_in = 0;
-    zs.next_out = NULL;
+    zs.next_out = nullptr;
     zs.avail_out = 0;
     zs.zalloc = zlib_alloc;
     zs.zfree = zlib_free;
 }
 
 
 Compressor::~Compressor()
 {
@@ -118,17 +118,17 @@ Compressor::compressMore()
 
 bool
 js::DecompressString(const unsigned char *inp, size_t inplen, unsigned char *out, size_t outlen)
 {
     JS_ASSERT(inplen <= UINT32_MAX);
     z_stream zs;
     zs.zalloc = zlib_alloc;
     zs.zfree = zlib_free;
-    zs.opaque = NULL;
+    zs.opaque = nullptr;
     zs.next_in = (Bytef *)inp;
     zs.avail_in = inplen;
     zs.next_out = out;
     JS_ASSERT(outlen);
     zs.avail_out = outlen;
     int ret = inflateInit(&zs);
     if (ret != Z_OK) {
         JS_ASSERT(ret == Z_MEM_ERROR);
--- a/js/src/jswatchpoint.cpp
+++ b/js/src/jswatchpoint.cpp
@@ -259,13 +259,13 @@ WatchpointMap::traceAll(WeakMapTracer *t
     }
 }
 
 void
 WatchpointMap::trace(WeakMapTracer *trc)
 {
     for (Map::Range r = map.all(); !r.empty(); r.popFront()) {
         Map::Entry &entry = r.front();
-        trc->callback(trc, NULL,
+        trc->callback(trc, nullptr,
                       entry.key.object.get(), JSTRACE_OBJECT,
                       entry.value.closure.get(), JSTRACE_OBJECT);
     }
 }
--- a/js/src/jsweakmap.cpp
+++ b/js/src/jsweakmap.cpp
@@ -60,20 +60,20 @@ WeakMapBase::traceAllMappings(WeakMapTra
         for (WeakMapBase *m = c->gcWeakMapList; m; m = m->next)
             m->traceMappings(tracer);
     }
 }
 
 void
 WeakMapBase::resetCompartmentWeakMapList(JSCompartment *c)
 {
-    JS_ASSERT(WeakMapNotInList != NULL);
+    JS_ASSERT(WeakMapNotInList != nullptr);
 
     WeakMapBase *m = c->gcWeakMapList;
-    c->gcWeakMapList = NULL;
+    c->gcWeakMapList = nullptr;
     while (m) {
         WeakMapBase *n = m->next;
         m->next = WeakMapNotInList;
         m = n;
     }
 }
 
 bool
@@ -112,35 +112,35 @@ WeakMapBase::removeWeakMapFromList(WeakM
         }
     }
 }
 
 static JSObject *
 GetKeyArg(JSContext *cx, CallArgs &args)
 {
     if (args[0].isPrimitive()) {
-        JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_NOT_NONNULL_OBJECT);
-        return NULL;
+        JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_NOT_NONNULL_OBJECT);
+        return nullptr;
     }
     return &args[0].toObject();
 }
 
 JS_ALWAYS_INLINE bool
 IsWeakMap(HandleValue v)
 {
     return v.isObject() && v.toObject().is<WeakMapObject>();
 }
 
 JS_ALWAYS_INLINE bool
 WeakMap_has_impl(JSContext *cx, CallArgs args)
 {
     JS_ASSERT(IsWeakMap(args.thisv()));
 
     if (args.length() < 1) {
-        JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_MORE_ARGS_NEEDED,
+        JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_MORE_ARGS_NEEDED,
                              "WeakMap.has", "0", "s");
         return false;
     }
     JSObject *key = GetKeyArg(cx, args);
     if (!key)
         return false;
 
     if (ObjectValueMap *map = args.thisv().toObject().as<WeakMapObject>().getMap()) {
@@ -183,17 +183,17 @@ WeakMap_clear(JSContext *cx, unsigned ar
 }
 
 JS_ALWAYS_INLINE bool
 WeakMap_get_impl(JSContext *cx, CallArgs args)
 {
     JS_ASSERT(IsWeakMap(args.thisv()));
 
     if (args.length() < 1) {
-        JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_MORE_ARGS_NEEDED,
+        JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_MORE_ARGS_NEEDED,
                              "WeakMap.get", "0", "s");
         return false;
     }
     JSObject *key = GetKeyArg(cx, args);
     if (!key)
         return false;
 
     if (ObjectValueMap *map = args.thisv().toObject().as<WeakMapObject>().getMap()) {
@@ -219,17 +219,17 @@ WeakMap_get(JSContext *cx, unsigned argc
 }
 
 JS_ALWAYS_INLINE bool
 WeakMap_delete_impl(JSContext *cx, CallArgs args)
 {
     JS_ASSERT(IsWeakMap(args.thisv()));
 
     if (args.length() < 1) {
-        JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_MORE_ARGS_NEEDED,
+        JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_MORE_ARGS_NEEDED,
                              "WeakMap.delete", "0", "s");
         return false;
     }
     JSObject *key = GetKeyArg(cx, args);
     if (!key)
         return false;
 
     if (ObjectValueMap *map = args.thisv().toObject().as<WeakMapObject>().getMap()) {
@@ -256,30 +256,30 @@ TryPreserveReflector(JSContext *cx, Hand
 {
     if (obj->getClass()->ext.isWrappedNative ||
         (obj->getClass()->flags & JSCLASS_IS_DOMJSCLASS) ||
         (obj->is<ProxyObject>() &&
          obj->as<ProxyObject>().handler()->family() == GetDOMProxyHandlerFamily()))
     {
         JS_ASSERT(cx->runtime()->preserveWrapperCallback);
         if (!cx->runtime()->preserveWrapperCallback(cx, obj)) {
-            JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_BAD_WEAKMAP_KEY);
+            JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_BAD_WEAKMAP_KEY);
             return false;
         }
     }
     return true;
 }
 
 JS_ALWAYS_INLINE bool
 WeakMap_set_impl(JSContext *cx, CallArgs args)
 {
     JS_ASSERT(IsWeakMap(args.thisv()));
 
     if (args.length() < 1) {
-        JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_MORE_ARGS_NEEDED,
+        JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_MORE_ARGS_NEEDED,
                              "WeakMap.set", "0", "s");
         return false;
     }
     RootedObject key(cx, GetKeyArg(cx, args));
     if (!key)
         return false;
 
     RootedValue value(cx, (args.length() > 1) ? args[1] : UndefinedValue());
@@ -326,17 +326,17 @@ WeakMap_set(JSContext *cx, unsigned argc
 }
 
 JS_FRIEND_API(bool)
 JS_NondeterministicGetWeakMapKeys(JSContext *cx, JSObject *objArg, JSObject **ret)
 {
     RootedObject obj(cx, objArg);
     obj = UncheckedUnwrap(obj);
     if (!obj || !obj->is<WeakMapObject>()) {
-        *ret = NULL;
+        *ret = nullptr;
         return true;
     }
     RootedObject arr(cx, NewDenseEmptyArray(cx));
     if (!arr)
         return false;
     ObjectValueMap *map = obj->as<WeakMapObject>().getMap();
     if (map) {
         // Prevent GC from mutating the weakmap while iterating.
@@ -393,20 +393,20 @@ const Class WeakMapObject::class_ = {
     JS_PropertyStub,         /* addProperty */
     JS_DeletePropertyStub,   /* delProperty */
     JS_PropertyStub,         /* getProperty */
     JS_StrictPropertyStub,   /* setProperty */
     JS_EnumerateStub,
     JS_ResolveStub,
     JS_ConvertStub,
     WeakMap_finalize,
-    NULL,                    /* checkAccess */
-    NULL,                    /* call        */
-    NULL,                    /* construct   */
-    NULL,                    /* xdrObject   */
+    nullptr,                 /* checkAccess */
+    nullptr,                 /* call        */
+    nullptr,                 /* construct   */
+    nullptr,                 /* xdrObject   */
     WeakMap_mark
 };
 
 static const JSFunctionSpec weak_map_methods[] = {
     JS_FN("has",    WeakMap_has, 1, 0),
     JS_FN("get",    WeakMap_get, 2, 0),
     JS_FN("delete", WeakMap_delete, 1, 0),
     JS_FN("set",    WeakMap_set, 2, 0),
@@ -418,25 +418,25 @@ JSObject *
 js_InitWeakMapClass(JSContext *cx, HandleObject obj)
 {
     JS_ASSERT(obj->isNative());
 
     Rooted<GlobalObject*> global(cx, &obj->as<GlobalObject>());
 
     RootedObject weakMapProto(cx, global->createBlankPrototype(cx, &WeakMapObject::class_));
     if (!weakMapProto)
-        return NULL;
+        return nullptr;
 
     RootedFunction ctor(cx, global->createConstructor(cx, WeakMap_construct,
                                                       cx->names().WeakMap, 0));
     if (!ctor)
-        return NULL;
+        return nullptr;
 
     if (!LinkConstructorAndPrototype(cx, ctor, weakMapProto))
-        return NULL;
+        return nullptr;
 
-    if (!DefinePropertiesAndBrand(cx, weakMapProto, NULL, weak_map_methods))
-        return NULL;
+    if (!DefinePropertiesAndBrand(cx, weakMapProto, nullptr, weak_map_methods))
+        return nullptr;
 
     if (!DefineConstructorAndPrototype(cx, global, JSProto_WeakMap, ctor, weakMapProto))
-        return NULL;
+        return nullptr;
     return weakMapProto;
 }
--- a/js/src/jsweakmap.h
+++ b/js/src/jsweakmap.h
@@ -112,32 +112,33 @@ class WeakMapBase {
     JSObject *memberOf;
 
     // Compartment that this weak map is part of.
     JSCompartment *compartment;
 
   private:
     // Link in a list of WeakMaps to mark iteratively and sweep in this garbage
     // collection, headed by JSCompartment::gcWeakMapList. The last element of
-    // the list has NULL as its next. Maps not in the list have WeakMapNotInList
-    // as their next.  We must distinguish these cases to avoid creating
-    // infinite lists when a weak map gets traced twice due to delayed marking.
+    // the list has nullptr as its next. Maps not in the list have
+    // WeakMapNotInList as their next.  We must distinguish these cases to
+    // avoid creating infinite lists when a weak map gets traced twice due to
+    // delayed marking.
     WeakMapBase *next;
 };
 
 template <class Key, class Value,
           class HashPolicy = DefaultHasher<Key> >
 class WeakMap : public HashMap<Key, Value, HashPolicy, RuntimeAllocPolicy>, public WeakMapBase
 {
   public:
     typedef HashMap<Key, Value, HashPolicy, RuntimeAllocPolicy> Base;
     typedef typename Base::Enum Enum;
     typedef typename Base::Range Range;
 
-    explicit WeakMap(JSContext *cx, JSObject *memOf=NULL)
+    explicit WeakMap(JSContext *cx, JSObject *memOf = nullptr)
         : Base(cx->runtime()), WeakMapBase(memOf, cx->compartment()) { }
 
   private:
     bool markValue(JSTracer *trc, Value *x) {
         if (gc::IsMarked(x))
             return false;
         gc::Mark(trc, x, "WeakMap entry value");
         JS_ASSERT(gc::IsMarked(x));
@@ -187,17 +188,17 @@ class WeakMap : public HashMap<Key, Valu
                     e.rekeyFront(key);
             } else if (keyNeedsMark(key)) {
                 gc::Mark(trc, const_cast<Key *>(&key), "proxy-preserved WeakMap entry key");
                 if (e.front().key != key)
                     e.rekeyFront(key);
                 gc::Mark(trc, &e.front().value, "WeakMap entry value");
                 markedAny = true;
             }
-            key.unsafeSet(NULL);
+            key.unsafeSet(nullptr);
         }
         return markedAny;
     }
 
     void sweep() {
         /* Remove all entries whose keys remain unmarked. */
         for (Enum e(*this); !e.empty(); e.popFront()) {
             Key k(e.front().key);
@@ -208,17 +209,17 @@ class WeakMap : public HashMap<Key, Valu
         }
         /*
          * Once we've swept, all remaining edges should stay within the
          * known-live part of the graph.
          */
         assertEntriesNotAboutToBeFinalized();
     }
 
-    /* memberOf can be NULL, which means that the map is not part of a JSObject. */
+    /* memberOf can be nullptr, which means that the map is not part of a JSObject. */
     void traceMappings(WeakMapTracer *tracer) {
         for (Range r = Base::all(); !r.empty(); r.popFront()) {
             gc::Cell *key = gc::ToMarkable(r.front().key);
             gc::Cell *value = gc::ToMarkable(r.front().value);
             if (key && value) {
                 tracer->callback(tracer, memberOf,
                                  key, gc::TraceKind(r.front().key),
                                  value, gc::TraceKind(r.front().value));
--- a/js/src/jsworkers.cpp
+++ b/js/src/jsworkers.cpp
@@ -25,44 +25,44 @@ using namespace js;
 using mozilla::DebugOnly;
 
 bool
 js::EnsureWorkerThreadsInitialized(ExclusiveContext *cx)
 {
     // If 'cx' is not a JSContext, we are already off the main thread and the
     // worker threads would have already been initialized.
     if (!cx->isJSContext()) {
-        JS_ASSERT(cx->workerThreadState() != NULL);
+        JS_ASSERT(cx->workerThreadState() != nullptr);
         return true;
     }
 
     JSRuntime *rt = cx->asJSContext()->runtime();
     if (rt->workerThreadState)
         return true;
 
     rt->workerThreadState = rt->new_<WorkerThreadState>();
     if (!rt->workerThreadState)
         return false;
 
     if (!rt->workerThreadState->init(rt)) {
         js_delete(rt->workerThreadState);
-        rt->workerThreadState = NULL;
+        rt->workerThreadState = nullptr;
         return false;
     }
 
     return true;
 }
 
 bool
 js::StartOffThreadAsmJSCompile(ExclusiveContext *cx, AsmJSParallelTask *asmData)
 {
     // Threads already initialized by the AsmJS compiler.
-    JS_ASSERT(cx->workerThreadState() != NULL);
+    JS_ASSERT(cx->workerThreadState() != nullptr);
     JS_ASSERT(asmData->mir);
-    JS_ASSERT(asmData->lir == NULL);
+    JS_ASSERT(asmData->lir == nullptr);
 
     WorkerThreadState &state = *cx->workerThreadState();
     JS_ASSERT(state.numThreads);
 
     AutoLockWorkerThreadState lock(state);
 
     // Don't append this task if another failed.
     if (state.asmJSWorkerFailed())
@@ -166,25 +166,25 @@ js::CancelOffThreadIonCompile(JSCompartm
     }
 }
 
 static const JSClass workerGlobalClass = {
     "internal-worker-global", JSCLASS_GLOBAL_FLAGS,
     JS_PropertyStub,  JS_DeletePropertyStub,
     JS_PropertyStub,  JS_StrictPropertyStub,
     JS_EnumerateStub, JS_ResolveStub,
-    JS_ConvertStub,   NULL
+    JS_ConvertStub,   nullptr
 };
 
 ParseTask::ParseTask(ExclusiveContext *cx, const CompileOptions &options,
                      const jschar *chars, size_t length, JSObject *scopeChain,
                      JS::OffThreadCompileCallback callback, void *callbackData)
   : cx(cx), options(options), chars(chars), length(length),
     alloc(JSRuntime::TEMP_LIFO_ALLOC_PRIMARY_CHUNK_SIZE), scopeChain(scopeChain),
-    callback(callback), callbackData(callbackData), script(NULL), errors(cx)
+    callback(callback), callbackData(callbackData), script(nullptr), errors(cx)
 {
     JSRuntime *rt = scopeChain->runtimeFromMainThread();
 
     if (options.principals())
         JS_HoldPrincipals(options.principals());
     if (options.originPrincipals())
         JS_HoldPrincipals(options.originPrincipals());
     if (!AddObjectRoot(rt, &this->scopeChain, "ParseTask::scopeChain"))
@@ -220,17 +220,17 @@ js::StartOffThreadParseScript(JSContext 
     frontend::MaybeCallSourceHandler(cx, options, chars, length);
 
     if (!EnsureWorkerThreadsInitialized(cx))
         return false;
 
     JS::CompartmentOptions compartmentOptions(cx->compartment()->options());
     compartmentOptions.setZone(JS::FreshZone);
 
-    JSObject *global = JS_NewGlobalObject(cx, &workerGlobalClass, NULL,
+    JSObject *global = JS_NewGlobalObject(cx, &workerGlobalClass, nullptr,
                                           JS::FireOnNewGlobalHook, compartmentOptions);
     if (!global)
         return false;
 
     global->zone()->types.inferenceEnabled = cx->typeInferenceEnabled();
     JS_SetCompartmentPrincipals(global->compartment(), cx->compartment()->principals);
 
     RootedObject obj(cx);
@@ -254,17 +254,17 @@ js::StartOffThreadParseScript(JSContext 
         {
             return false;
         }
     }
 
     cx->runtime()->setUsedByExclusiveThread(global->zone());
 
     ScopedJSDeletePtr<ExclusiveContext> workercx(
-        cx->new_<ExclusiveContext>(cx->runtime(), (PerThreadData *) NULL,
+        cx->new_<ExclusiveContext>(cx->runtime(), (PerThreadData *) nullptr,
                                    ThreadSafeContext::Context_Exclusive));
     if (!workercx)
         return false;
 
     workercx->enterCompartment(global->compartment());
 
     ScopedJSDeletePtr<ParseTask> task(
         cx->new_<ParseTask>(workercx.get(), options, chars, length,
@@ -345,17 +345,17 @@ WorkerThreadState::init(JSRuntime *rt)
         helper.threadData.ref().addToThreadList();
         helper.thread = PR_CreateThread(PR_USER_THREAD,
                                         WorkerThread::ThreadMain, &helper,
                                         PR_PRIORITY_NORMAL, PR_LOCAL_THREAD, PR_JOINABLE_THREAD, 0);
         if (!helper.thread || !helper.threadData.ref().init()) {
             for (size_t j = 0; j < numThreads; j++)
                 threads[j].destroy();
             js_free(threads);
-            threads = NULL;
+            threads = nullptr;
             numThreads = 0;
             return false;
         }
     }
 
     resetAsmJSFailureState();
     return true;
 }
@@ -366,23 +366,23 @@ WorkerThreadState::cleanup(JSRuntime *rt
     // Do preparatory work for shutdown before the final GC has destroyed most
     // of the GC heap.
 
     // Join created threads, to ensure there is no in progress work.
     if (threads) {
         for (size_t i = 0; i < numThreads; i++)
             threads[i].destroy();
         js_free(threads);
-        threads = NULL;
+        threads = nullptr;
         numThreads = 0;
     }
 
     // Clean up any parse tasks which haven't been finished yet.
     while (!parseFinishedList.empty())
-        finishParseTask(/* maybecx = */ NULL, rt, parseFinishedList[0]);
+        finishParseTask(/* maybecx = */ nullptr, rt, parseFinishedList[0]);
 }
 
 WorkerThreadState::~WorkerThreadState()
 {
     JS_ASSERT(!threads);
     JS_ASSERT(parseFinishedList.empty());
 
     if (workerLock)
@@ -405,17 +405,17 @@ WorkerThreadState::lock()
 #endif
 }
 
 void
 WorkerThreadState::unlock()
 {
     JS_ASSERT(isLocked());
 #ifdef DEBUG
-    lockOwner = NULL;
+    lockOwner = nullptr;
 #endif
     PR_Unlock(workerLock);
 }
 
 #ifdef DEBUG
 bool
 WorkerThreadState::isLocked()
 {
@@ -423,17 +423,17 @@ WorkerThreadState::isLocked()
 }
 #endif
 
 void
 WorkerThreadState::wait(CondVar which, uint32_t millis)
 {
     JS_ASSERT(isLocked());
 #ifdef DEBUG
-    lockOwner = NULL;
+    lockOwner = nullptr;
 #endif
     DebugOnly<PRStatus> status =
         PR_WaitCondVar((which == CONSUMER) ? consumerWakeup : producerWakeup,
                        millis ? PR_MillisecondsToInterval(millis) : PR_INTERVAL_NO_TIMEOUT);
     JS_ASSERT(status == PR_SUCCESS);
 #ifdef DEBUG
     lockOwner = PR_GetCurrentThread();
 #endif
@@ -518,17 +518,17 @@ CallNewScriptHookForAllScripts(JSContext
     // The global new script hook is called on every script that was compiled.
     RootedFunction function(cx, script->function());
     CallNewScriptHook(cx, script, function);
 }
 
 JSScript *
 WorkerThreadState::finishParseTask(JSContext *maybecx, JSRuntime *rt, void *token)
 {
-    ParseTask *parseTask = NULL;
+    ParseTask *parseTask = nullptr;
 
     // The token is a ParseTask* which should be in the finished list.
     // Find and remove its entry.
     {
         AutoLockWorkerThreadState lock(*rt->workerThreadState);
         for (size_t i = 0; i < parseFinishedList.length(); i++) {
             if (parseFinishedList[i] == token) {
                 parseTask = parseFinishedList[i];
@@ -576,17 +576,17 @@ WorkerThreadState::finishParseTask(JSCon
     // parse, and inform the debugger about the compiled scripts.
     if (maybecx) {
         AutoCompartment ac(maybecx, parseTask->scopeChain);
         for (size_t i = 0; i < parseTask->errors.length(); i++)
             parseTask->errors[i]->throwError(maybecx);
 
         if (script) {
             // The Debugger only needs to be told about the topmost script that was compiled.
-            GlobalObject *compileAndGoGlobal = NULL;
+            GlobalObject *compileAndGoGlobal = nullptr;
             if (script->compileAndGo)
                 compileAndGoGlobal = &script->global();
             Debugger::onNewScript(maybecx, script, compileAndGoGlobal);
 
             // The NewScript hook needs to be called for all compiled scripts.
             CallNewScriptHookForAllScripts(maybecx, script);
         }
     }
@@ -653,25 +653,25 @@ WorkerThread::handleAsmJSWorkload(Worker
         asmData->compileTime = (after - before) / PRMJ_USEC_PER_MSEC;
 
         success = true;
     } while(0);
     state.lock();
 
     // On failure, signal parent for harvesting in CancelOutstandingJobs().
     if (!success) {
-        asmData = NULL;
+        asmData = nullptr;
         state.noteAsmJSFailure(asmData->func);
         state.notifyAll(WorkerThreadState::CONSUMER);
         return;
     }
 
     // On success, move work to the finished list.
     state.asmJSFinishedList.append(asmData);
-    asmData = NULL;
+    asmData = nullptr;
 
     // Notify the main thread in case it's blocked waiting for a LifoAlloc.
     state.notifyAll(WorkerThreadState::CONSUMER);
 }
 
 void
 WorkerThread::handleIonWorkload(WorkerThreadState &state)
 {
@@ -694,17 +694,17 @@ WorkerThread::handleIonWorkload(WorkerTh
     state.unlock();
     {
         jit::IonContext ictx(runtime, ionBuilder->script()->compartment(), &ionBuilder->temp());
         ionBuilder->setBackgroundCodegen(jit::CompileBackEnd(ionBuilder));
     }
     state.lock();
 
     FinishOffThreadIonCompile(ionBuilder);
-    ionBuilder = NULL;
+    ionBuilder = nullptr;
 
     // Notify the main thread in case it is waiting for the compilation to finish.
     state.notifyAll(WorkerThreadState::CONSUMER);
 
     // Ping the main thread so that the compiled code can be incorporated
     // at the next operation callback. Don't interrupt Ion code for this, as
     // this incorporation can be delayed indefinitely without affecting
     // performance as long as the main thread is actually executing Ion code.
@@ -749,17 +749,17 @@ WorkerThread::handleParseWorkload(Worker
 
     // The callback is invoked while we are still off the main thread.
     parseTask->callback(parseTask, parseTask->callbackData);
 
     // FinishOffThreadScript will need to be called on the script to
     // migrate it into the correct compartment.
     state.parseFinishedList.append(parseTask);
 
-    parseTask = NULL;
+    parseTask = nullptr;
 
     // Notify the main thread in case it is waiting for the parse/emit to finish.
     state.notifyAll(WorkerThreadState::CONSUMER);
 }
 
 void
 WorkerThread::handleCompressionWorkload(WorkerThreadState &state)
 {
@@ -771,18 +771,18 @@ WorkerThread::handleCompressionWorkload(
     compressionTask->workerThread = this;
 
     {
         AutoUnlockWorkerThreadState unlock(runtime);
         if (!compressionTask->compress())
             compressionTask->setOOM();
     }
 
-    compressionTask->workerThread = NULL;
-    compressionTask = NULL;
+    compressionTask->workerThread = nullptr;
+    compressionTask = nullptr;
 
     // Notify the main thread in case it is waiting for the compression to finish.
     state.notifyAll(WorkerThreadState::CONSUMER);
 }
 
 bool
 js::StartOffThreadCompression(ExclusiveContext *cx, SourceCompressionTask *task)
 {
@@ -829,18 +829,18 @@ SourceCompressionTask::complete()
         }
 
         ss->ready_ = true;
 
         // Update memory accounting.
         if (!oom)
             cx->updateMallocCounter(ss->computedSizeOfData());
 
-        ss = NULL;
-        chars = NULL;
+        ss = nullptr;
+        chars = nullptr;
     }
     if (oom) {
         js_ReportOutOfMemory(cx);
         return false;
     }
     return true;
 }
 
@@ -853,42 +853,42 @@ WorkerThreadState::compressionTaskForSou
         if (task->source() == ss)
             return task;
     }
     for (size_t i = 0; i < numThreads; i++) {
         SourceCompressionTask *task = threads[i].compressionTask;
         if (task && task->source() == ss)
             return task;
     }
-    return NULL;
+    return nullptr;
 }
 
 const jschar *
 ScriptSource::getOffThreadCompressionChars(ExclusiveContext *cx)
 {
     // If this is being compressed off thread, return its uncompressed chars.
 
     if (ready()) {
         // Compression has already finished on the source.
-        return NULL;
+        return nullptr;
     }
 
     WorkerThreadState &state = *cx->workerThreadState();
     AutoLockWorkerThreadState lock(state);
 
     // Look for a token that hasn't finished compressing and whose source is
     // the given ScriptSource.
     if (SourceCompressionTask *task = state.compressionTaskForSource(this))
         return task->uncompressedChars();
 
     // Compressing has finished, so this ScriptSource is ready. Avoid future
     // queries on the worker thread state when getting the chars.
     ready_ = true;
 
-    return NULL;
+    return nullptr;
 }
 
 void
 WorkerThread::threadLoop()
 {
     WorkerThreadState &state = *runtime->workerThreadState;
     AutoLockWorkerThreadState lock(state);
 
@@ -1078,17 +1078,17 @@ SourceCompressionTask::complete()
     JS_ASSERT(!active() && !oom);
     return true;
 }
 
 const jschar *
 ScriptSource::getOffThreadCompressionChars(ExclusiveContext *cx)
 {
     JS_ASSERT(ready());
-    return NULL;
+    return nullptr;
 }
 
 AutoPauseWorkersForGC::AutoPauseWorkersForGC(JSRuntime *rt MOZ_GUARD_OBJECT_NOTIFIER_PARAM_IN_IMPL)
 {
     MOZ_GUARD_OBJECT_NOTIFIER_INIT;
 }
 
 AutoPauseWorkersForGC::~AutoPauseWorkersForGC()
--- a/js/src/jsworkers.h
+++ b/js/src/jsworkers.h
@@ -117,17 +117,17 @@ class WorkerThreadState
             asmJSFailedFunction = func;
         numAsmJSFailedJobs++;
     }
     bool asmJSWorkerFailed() const {
         return bool(numAsmJSFailedJobs);
     }
     void resetAsmJSFailureState() {
         numAsmJSFailedJobs = 0;
-        asmJSFailedFunction = NULL;
+        asmJSFailedFunction = nullptr;
     }
     void *maybeAsmJSFailedFunction() const {
         return asmJSFailedFunction;
     }
 
     JSScript *finishParseTask(JSContext *maybecx, JSRuntime *rt, void *token);
     bool compressionInProgress(SourceCompressionTask *task);
     SourceCompressionTask *compressionTaskForSource(ScriptSource *ss);
@@ -230,17 +230,17 @@ StartOffThreadAsmJSCompile(ExclusiveCont
  * Schedule an Ion compilation for a script, given a builder which has been
  * generated and read everything needed from the VM state.
  */
 bool
 StartOffThreadIonCompile(JSContext *cx, jit::IonBuilder *builder);
 
 /*
  * Cancel a scheduled or in progress Ion compilation for script. If script is
- * NULL, all compilations for the compartment are cancelled.
+ * nullptr, all compilations for the compartment are cancelled.
  */
 void
 CancelOffThreadIonCompile(JSCompartment *compartment, JSScript *script);
 
 /*
  * Start a parse/emit cycle for a stream of source. The characters must stay
  * alive until the compilation finishes.
  */
@@ -372,23 +372,23 @@ struct AsmJSParallelTask
 {
     LifoAlloc lifo;         // Provider of all heap memory used for compilation.
     void *func;             // Really, a ModuleCompiler::Func*
     jit::MIRGenerator *mir; // Passed from main thread to worker.
     jit::LIRGraph *lir;     // Passed from worker to main thread.
     unsigned compileTime;
 
     AsmJSParallelTask(size_t defaultChunkSize)
-      : lifo(defaultChunkSize), func(NULL), mir(NULL), lir(NULL), compileTime(0)
+      : lifo(defaultChunkSize), func(nullptr), mir(nullptr), lir(nullptr), compileTime(0)
     { }
 
     void init(void *func, jit::MIRGenerator *mir) {
         this->func = func;
         this->mir = mir;
-        this->lir = NULL;
+        this->lir = nullptr;
     }
 };
 #endif
 
 struct ParseTask
 {
     ExclusiveContext *cx;
     CompileOptions options;
@@ -446,20 +446,20 @@ struct SourceCompressionTask
 #ifdef JS_THREADSAFE
     mozilla::Atomic<int32_t, mozilla::Relaxed> abort_;
 #else
     int32_t abort_;
 #endif
 
   public:
     explicit SourceCompressionTask(ExclusiveContext *cx)
-      : cx(cx), ss(NULL), chars(NULL), oom(false), abort_(0)
+      : cx(cx), ss(nullptr), chars(nullptr), oom(false), abort_(0)
     {
 #ifdef JS_WORKER_THREADS
-        workerThread = NULL;
+        workerThread = nullptr;
 #endif
     }
 
     ~SourceCompressionTask()
     {
         complete();
     }
 
--- a/js/src/shell/jsheaptools.cpp
+++ b/js/src/shell/jsheaptools.cpp
@@ -112,35 +112,35 @@ class HeapReverser : public JSTracer, pu
         ~Edge() { js_free(name); }
 
         /*
          * Move constructor and move assignment. These allow us to live in
          * Vectors without needing to copy our name string when the vector is
          * resized.
          */
         Edge(MoveRef<Edge> rhs) : name(rhs->name), origin(rhs->origin) {
-            rhs->name = NULL;
+            rhs->name = nullptr;
         }
         Edge &operator=(MoveRef<Edge> rhs) {
             this->~Edge();
             new(this) Edge(rhs);
             return *this;
         }
 
         void trace(JSTracer *trc) {
             if (origin)
                 gc::MarkGCThingRoot(trc, &origin, "HeapReverser::Edge");
         }
 
         /* The name of this heap edge. Owned by this Edge. */
         char *name;
 
         /*
-         * The Cell from which this edge originates. NULL means a root. This is
-         * a cell address instead of a Node * because Nodes live in HashMap
+         * The Cell from which this edge originates. nullptr means a root. This
+         * is a cell address instead of a Node * because Nodes live in HashMap
          * table entries; if the HashMap reallocates its table, all pointers to
          * the Nodes it contains would become invalid. You should look up the
          * address here in |map| to find its Node.
          */
         void *origin;
     };
 
     /*
@@ -149,17 +149,17 @@ class HeapReverser : public JSTracer, pu
      */
     typedef HashMap<void *, Node, DefaultHasher<void *>, SystemAllocPolicy> Map;
     Map map;
 
     /* Construct a HeapReverser for |context|'s heap. */
     HeapReverser(JSContext *cx)
       : JS::CustomAutoRooter(cx),
         runtime(JS_GetRuntime(cx)),
-        parent(NULL)
+        parent(nullptr)
     {
         JS_TracerInit(this, runtime, traverseEdgeWithThis);
         JS::DisableGenerationalGC(runtime);
     }
 
     ~HeapReverser() {
         JS::EnableGenerationalGC(runtime);
     }
@@ -171,17 +171,17 @@ class HeapReverser : public JSTracer, pu
 
   private:
     /* A runtime pointer for use by the destructor. */
     JSRuntime *runtime;
 
     /*
      * Return the name of the most recent edge this JSTracer has traversed. The
      * result is allocated with malloc; if we run out of memory, raise an error
-     * in this HeapReverser's context and return NULL.
+     * in this HeapReverser's context and return nullptr.
      *
      * This may not be called after that edge's call to traverseEdge has
      * returned.
      */
     char *getEdgeDescription();
 
     /* Class for setting new parent, and then restoring the original. */
     class AutoParent {
@@ -307,26 +307,26 @@ HeapReverser::reverseHeap()
 
 char *
 HeapReverser::getEdgeDescription()
 {
     if (!debugPrinter && debugPrintIndex == (size_t) -1) {
         const char *arg = static_cast<const char *>(debugPrintArg);
         char *name = js_pod_malloc<char>(strlen(arg) + 1);
         if (!name)
-            return NULL;
+            return nullptr;
         strcpy(name, arg);
         return name;
     }
 
     /* Lovely; but a fixed size is required by JSTraceNamePrinter. */
     static const int nameSize = 200;
     char *name = js_pod_malloc<char>(nameSize);
     if (!name)
-        return NULL;
+        return nullptr;
     if (debugPrinter)
         debugPrinter(this, name, nameSize);
     else
         JS_snprintf(name, nameSize, "%s[%lu]",
                     static_cast<const char *>(debugPrintArg), debugPrintIndex);
 
     /* Shrink storage to fit. */
     return static_cast<char *>(js_realloc(name, strlen(name) + 1));
@@ -424,17 +424,17 @@ ReferenceFinder::visit(void *cell, Path 
     if (!cell)
         return addReferrer(JSVAL_NULL, path);
 
     HeapReverser::Map::Ptr p = reverser.map.lookup(cell);
     JS_ASSERT(p);
     HeapReverser::Node *node = &p->value;
 
     /* Is |cell| a representable cell, reached via a non-empty path? */
-    if (path != NULL) {
+    if (path != nullptr) {
         jsval representation = representable(cell, node->kind);
         if (!JSVAL_IS_VOID(representation))
             return addReferrer(representation, path);
     }
 
     /*
      * If we've made a cycle, don't traverse further. We *do* want to include
      * paths from the target to itself, so we don't want to do this check until
@@ -461,17 +461,17 @@ ReferenceFinder::Path::computeName(JSCon
     /* Walk the edge list and compute the total size of the path. */
     size_t size = 6;
     for (Path *l = this; l; l = l->next)
         size += strlen(l->edge.name) + (l->next ? 2 : 0);
     size += 1;
 
     char *path = cx->pod_malloc<char>(size);
     if (!path)
-        return NULL;
+        return nullptr;
 
     /*
      * Walk the edge list again, and copy the edge names into place, with
      * appropriate separators. Note that we constructed the edge list from
      * target to referrer, which means that the list links point *towards* the
      * target, so we can walk the list and build the path from left to right.
      */
     strcpy(path, "edge: ");
@@ -523,38 +523,38 @@ ReferenceFinder::addReferrer(jsval refer
     uint32_t length;
     return JS_GetArrayLength(context, array, &length) &&
            JS_SetElement(context, array, length, &referrer);
 }
 
 JSObject *
 ReferenceFinder::findReferences(HandleObject target)
 {
-    result = JS_NewObject(context, NULL, NULL, NULL);
+    result = JS_NewObject(context, nullptr, nullptr, nullptr);
     if (!result)
-        return NULL;
-    if (!visit(target, NULL))
-        return NULL;
+        return nullptr;
+    if (!visit(target, nullptr))
+        return nullptr;
 
     return result;
 }
 
 /* See help(findReferences). */
 bool
 FindReferences(JSContext *cx, unsigned argc, jsval *vp)
 {
     if (argc < 1) {
-        JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_MORE_ARGS_NEEDED,
+        JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_MORE_ARGS_NEEDED,
                              "findReferences", "0", "s");
         return false;
     }
 
     RootedValue target(cx, JS_ARGV(cx, vp)[0]);
     if (!target.isObject()) {
-        JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_UNEXPECTED_TYPE,
+        JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_UNEXPECTED_TYPE,
                              "argument", "not an object");
         return false;
     }
 
     /* Walk the JSRuntime, producing a reversed map of the heap. */
     HeapReverser reverser(cx);
     if (!reverser.init() || !reverser.reverseHeap())
         return false;
--- a/js/src/shell/jsoptparse.cpp
+++ b/js/src/shell/jsoptparse.cpp
@@ -281,33 +281,33 @@ OptionParser::handleOption(Option *opt, 
         return Okay;
       }
       /*
        * Valued options are allowed to specify their values either via
        * successive arguments or a single --longflag=value argument.
        */
       case OptionKindString:
       {
-        char *value = NULL;
+        char *value = nullptr;
         if (Result r = extractValue(argc, argv, i, &value))
             return r;
         opt->asStringOption()->value = value;
         return Okay;
       }
       case OptionKindInt:
       {
-        char *value = NULL;
+        char *value = nullptr;
         if (Result r = extractValue(argc, argv, i, &value))
             return r;
         opt->asIntOption()->value = atoi(value);
         return Okay;
       }
       case OptionKindMultiString:
       {
-        char *value = NULL;
+        char *value = nullptr;
         if (Result r = extractValue(argc, argv, i, &value))
             return r;
         StringArg arg(value, *i);
         return opt->asMultiStringOption()->strings.append(arg) ? Okay : Fail;
       }
       default:
         MOZ_ASSUME_UNREACHABLE("unhandled option kind");
     }
@@ -461,17 +461,17 @@ OptionParser::~OptionParser()
 Option *
 OptionParser::findOption(char shortflag)
 {
     for (Option **it = options.begin(), **end = options.end(); it != end; ++it) {
         if ((*it)->shortflag == shortflag)
             return *it;
     }
 
-    return helpOption.shortflag == shortflag ? &helpOption : NULL;
+    return helpOption.shortflag == shortflag ? &helpOption : nullptr;
 }
 
 const Option *
 OptionParser::findOption(char shortflag) const
 {
     return const_cast<OptionParser *>(this)->findOption(shortflag);
 }
 
@@ -491,17 +491,17 @@ OptionParser::findOption(const char *lon
                 return *it;
         } else {
             if (strcmp(target, longflag) == 0)
                 return *it;
         }
   no_match:;
     }
 
-    return strcmp(helpOption.longflag, longflag) ? NULL : &helpOption;
+    return strcmp(helpOption.longflag, longflag) ? nullptr : &helpOption;
 }
 
 const Option *
 OptionParser::findOption(const char *longflag) const
 {
     return const_cast<OptionParser *>(this)->findOption(longflag);
 }
 
@@ -517,24 +517,24 @@ OptionParser::findArgumentIndex(const ch
     }
     return -1;
 }
 
 Option *
 OptionParser::findArgument(const char *name)
 {
     int index = findArgumentIndex(name);
-    return (index == -1) ? NULL : arguments[index];
+    return (index == -1) ? nullptr : arguments[index];
 }
 
 const Option *
 OptionParser::findArgument(const char *name) const
 {
     int index = findArgumentIndex(name);
-    return (index == -1) ? NULL : arguments[index];
+    return (index == -1) ? nullptr : arguments[index];
 }
 
 const char *
 OptionParser::getStringArg(const char *name) const
 {
     return findArgument(name)->asStringOption()->value;
 }
 
@@ -600,27 +600,27 @@ OptionParser::addMultiStringOption(char 
 
 /* Argument builders */
 
 bool
 OptionParser::addOptionalStringArg(const char *name, const char *help)
 {
     if (!arguments.reserve(arguments.length() + 1))
         return false;
-    StringOption *so = js_new<StringOption>(1, name, help, (const char *) NULL);
+    StringOption *so = js_new<StringOption>(1, name, help, (const char *) nullptr);
     if (!so)
         return false;
     arguments.infallibleAppend(so);
     return true;
 }
 
 bool
 OptionParser::addOptionalMultiStringArg(const char *name, const char *help)
 {
     JS_ASSERT_IF(!arguments.empty(), !arguments.back()->isVariadic());
     if (!arguments.reserve(arguments.length() + 1))
         return false;
-    MultiStringOption *mso = js_new<MultiStringOption>(1, name, help, (const char *) NULL);
+    MultiStringOption *mso = js_new<MultiStringOption>(1, name, help, (const char *) nullptr);
     if (!mso)
         return false;
     arguments.infallibleAppend(mso);
     return true;
 }
--- a/js/src/shell/jsoptparse.h
+++ b/js/src/shell/jsoptparse.h
@@ -111,17 +111,17 @@ struct ValuedOption : public Option
 
 inline ValuedOption::~ValuedOption() {}
 
 struct StringOption : public ValuedOption
 {
     const char *value;
 
     StringOption(char shortflag, const char *longflag, const char *help, const char *metavar)
-      : ValuedOption(OptionKindString, shortflag, longflag, help, metavar), value(NULL)
+      : ValuedOption(OptionKindString, shortflag, longflag, help, metavar), value(nullptr)
     {}
 
     virtual ~StringOption() {}
 };
 
 struct IntOption : public ValuedOption
 {
     int value;
@@ -229,17 +229,17 @@ class OptionParser
     Result error(const char *fmt, ...);
     Result extractValue(size_t argc, char **argv, size_t *i, char **value);
     Result handleArg(size_t argc, char **argv, size_t *i, bool *optsAllowed);
     Result handleOption(Option *opt, size_t argc, char **argv, size_t *i, bool *optsAllowed);
 
   public:
     explicit OptionParser(const char *usage)
       : helpOption('h', "help", "Display help information"),
-        usage(usage), ver(NULL), descr(NULL), descrWidth(80), helpWidth(80),
+        usage(usage), ver(nullptr), descr(nullptr), descrWidth(80), helpWidth(80),
         nextArgument(0), restArgument(-1)
     {}
 
     ~OptionParser();
 
     Result parseArgs(int argc, char **argv);
     Result printHelp(const char *progname);