Bug 784739 - Switch from NULL to nullptr in js/src/vm/ (2/5); r=ehsan

--HG--
extra : rebase_source : 262155dccf7b2846f3037c56c089973b5481ce5c
This commit is contained in:
Birunthan Mohanathas 2013-09-27 16:31:00 -04:00
parent 5e809a4878
commit c92580e571
13 changed files with 182 additions and 177 deletions

View File

@ -56,7 +56,7 @@ js::ForkJoinSlices(JSContext *cx)
JSContext * JSContext *
ForkJoinSlice::acquireContext() ForkJoinSlice::acquireContext()
{ {
return NULL; return nullptr;
} }
void void
@ -313,7 +313,7 @@ class ForkJoinShared : public TaskExecutor, public Monitor
uint32_t rendezvousIndex_; // Number of rendezvous attempts uint32_t rendezvousIndex_; // Number of rendezvous attempts
bool gcRequested_; // True if a worker requested a GC bool gcRequested_; // True if a worker requested a GC
JS::gcreason::Reason gcReason_; // Reason given to request GC JS::gcreason::Reason gcReason_; // Reason given to request GC
Zone *gcZone_; // Zone for GC, or NULL for full Zone *gcZone_; // Zone for GC, or nullptr for full
///////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////
// Asynchronous Flags // Asynchronous Flags
@ -429,7 +429,7 @@ class AutoSetForkJoinSlice
} }
~AutoSetForkJoinSlice() { ~AutoSetForkJoinSlice() {
PR_SetThreadPrivate(ForkJoinSlice::ThreadPrivateIndex, NULL); PR_SetThreadPrivate(ForkJoinSlice::ThreadPrivateIndex, nullptr);
} }
}; };
@ -523,7 +523,7 @@ js::ParallelDo::ParallelDo(JSContext *cx,
: bailouts(0), : bailouts(0),
bailoutCause(ParallelBailoutNone), bailoutCause(ParallelBailoutNone),
bailoutScript(cx), bailoutScript(cx),
bailoutBytecode(NULL), bailoutBytecode(nullptr),
cx_(cx), cx_(cx),
fun_(fun), fun_(fun),
bailoutRecords_(cx), bailoutRecords_(cx),
@ -1164,7 +1164,7 @@ js::ParallelDo::parallelExecution(ExecutionStatus *status)
// Recursive use of the ThreadPool is not supported. Right now we // Recursive use of the ThreadPool is not supported. Right now we
// cannot get here because parallel code cannot invoke native // cannot get here because parallel code cannot invoke native
// functions such as ForkJoin(). // functions such as ForkJoin().
JS_ASSERT(ForkJoinSlice::Current() == NULL); JS_ASSERT(ForkJoinSlice::Current() == nullptr);
AutoEnterParallelSection enter(cx_); AutoEnterParallelSection enter(cx_);
@ -1269,7 +1269,8 @@ class ParallelIonInvoke
bool invoke(PerThreadData *perThread) { bool invoke(PerThreadData *perThread) {
RootedValue result(perThread); RootedValue result(perThread);
enter_(jitcode_, argc_ + 1, argv_ + 1, NULL, calleeToken_, NULL, 0, result.address()); enter_(jitcode_, argc_ + 1, argv_ + 1, nullptr, calleeToken_, nullptr, 0,
result.address());
return !result.isMagic(); return !result.isMagic();
} }
}; };
@ -1288,8 +1289,8 @@ ForkJoinShared::ForkJoinShared(JSContext *cx,
threadPool_(threadPool), threadPool_(threadPool),
fun_(fun), fun_(fun),
numSlices_(numSlices), numSlices_(numSlices),
rendezvousEnd_(NULL), rendezvousEnd_(nullptr),
cxLock_(NULL), cxLock_(nullptr),
records_(records), records_(records),
allocators_(cx), allocators_(cx),
uncompleted_(uncompleted), uncompleted_(uncompleted),
@ -1297,7 +1298,7 @@ ForkJoinShared::ForkJoinShared(JSContext *cx,
rendezvousIndex_(0), rendezvousIndex_(0),
gcRequested_(false), gcRequested_(false),
gcReason_(JS::gcreason::NUM_REASONS), gcReason_(JS::gcreason::NUM_REASONS),
gcZone_(NULL), gcZone_(nullptr),
abort_(false), abort_(false),
fatal_(false), fatal_(false),
rendezvous_(false) rendezvous_(false)
@ -1403,7 +1404,7 @@ ForkJoinShared::transferArenasToCompartmentAndProcessGCRequests()
else else
TriggerZoneGC(gcZone_, gcReason_); TriggerZoneGC(gcZone_, gcReason_);
gcRequested_ = false; gcRequested_ = false;
gcZone_ = NULL; gcZone_ = nullptr;
} }
} }
@ -1423,7 +1424,7 @@ ForkJoinShared::executeFromWorker(uint32_t workerId, uintptr_t stackLimit)
// lock has not been initialized in these cases. // lock has not been initialized in these cases.
thisThread.ionStackLimit = stackLimit; thisThread.ionStackLimit = stackLimit;
executePortion(&thisThread, workerId); executePortion(&thisThread, workerId);
TlsPerThreadData.set(NULL); TlsPerThreadData.set(nullptr);
AutoLockMonitor lock(*this); AutoLockMonitor lock(*this);
uncompleted_ -= 1; uncompleted_ -= 1;
@ -1457,9 +1458,9 @@ ForkJoinShared::executePortion(PerThreadData *perThread,
// Make a new IonContext for the slice, which is needed if we need to // Make a new IonContext for the slice, which is needed if we need to
// re-enter the VM. // re-enter the VM.
IonContext icx(cx_->runtime(), cx_->compartment(), NULL); IonContext icx(cx_->runtime(), cx_->compartment(), nullptr);
JS_ASSERT(slice.bailoutRecord->topScript == NULL); JS_ASSERT(slice.bailoutRecord->topScript == nullptr);
RootedObject fun(perThread, fun_); RootedObject fun(perThread, fun_);
JS_ASSERT(fun->is<JSFunction>()); JS_ASSERT(fun->is<JSFunction>());
@ -1471,7 +1472,7 @@ ForkJoinShared::executePortion(PerThreadData *perThread,
// and fallback. // and fallback.
Spew(SpewOps, "Down (Script no longer present)"); Spew(SpewOps, "Down (Script no longer present)");
slice.bailoutRecord->setCause(ParallelBailoutMainScriptNotPresent, slice.bailoutRecord->setCause(ParallelBailoutMainScriptNotPresent,
NULL, NULL, NULL); nullptr, nullptr, nullptr);
setAbortFlag(false); setAbortFlag(false);
} else { } else {
ParallelIonInvoke<3> fii(cx_->runtime(), callee, 3); ParallelIonInvoke<3> fii(cx_->runtime(), callee, 3);
@ -1512,7 +1513,7 @@ ForkJoinShared::check(ForkJoinSlice &slice)
// if (!js_HandleExecutionInterrupt(cx_)) // if (!js_HandleExecutionInterrupt(cx_))
// return setAbortFlag(true); // return setAbortFlag(true);
slice.bailoutRecord->setCause(ParallelBailoutInterrupt, slice.bailoutRecord->setCause(ParallelBailoutInterrupt,
NULL, NULL, NULL); nullptr, nullptr, nullptr);
setAbortFlag(false); setAbortFlag(false);
return false; return false;
} }
@ -1623,7 +1624,7 @@ ForkJoinShared::requestGC(JS::gcreason::Reason reason)
{ {
AutoLockMonitor lock(*this); AutoLockMonitor lock(*this);
gcZone_ = NULL; gcZone_ = nullptr;
gcReason_ = reason; gcReason_ = reason;
gcRequested_ = true; gcRequested_ = true;
} }
@ -1636,7 +1637,7 @@ ForkJoinShared::requestZoneGC(JS::Zone *zone, JS::gcreason::Reason reason)
if (gcRequested_ && gcZone_ != zone) { if (gcRequested_ && gcZone_ != zone) {
// If a full GC has been requested, or a GC for another zone, // If a full GC has been requested, or a GC for another zone,
// issue a request for a full GC. // issue a request for a full GC.
gcZone_ = NULL; gcZone_ = nullptr;
gcReason_ = reason; gcReason_ = reason;
gcRequested_ = true; gcRequested_ = true;
} else { } else {
@ -1718,7 +1719,7 @@ bool
ForkJoinSlice::InitializeTLS() ForkJoinSlice::InitializeTLS()
{ {
if (!TLSInitialized) { if (!TLSInitialized) {
if (PR_NewThreadPrivateIndex(&ThreadPrivateIndex, NULL) != PR_SUCCESS) if (PR_NewThreadPrivateIndex(&ThreadPrivateIndex, nullptr) != PR_SUCCESS)
return false; return false;
TLSInitialized = true; TLSInitialized = true;
} }
@ -1730,7 +1731,7 @@ ForkJoinSlice::requestGC(JS::gcreason::Reason reason)
{ {
shared->requestGC(reason); shared->requestGC(reason);
bailoutRecord->setCause(ParallelBailoutRequestedGC, bailoutRecord->setCause(ParallelBailoutRequestedGC,
NULL, NULL, NULL); nullptr, nullptr, nullptr);
shared->setAbortFlag(false); shared->setAbortFlag(false);
} }
@ -1739,7 +1740,7 @@ ForkJoinSlice::requestZoneGC(JS::Zone *zone, JS::gcreason::Reason reason)
{ {
shared->requestZoneGC(zone, reason); shared->requestZoneGC(zone, reason);
bailoutRecord->setCause(ParallelBailoutRequestedZoneGC, bailoutRecord->setCause(ParallelBailoutRequestedZoneGC,
NULL, NULL, NULL); nullptr, nullptr, nullptr);
shared->setAbortFlag(false); shared->setAbortFlag(false);
} }
@ -1764,7 +1765,7 @@ js::ParallelBailoutRecord::init(JSContext *cx)
void void
js::ParallelBailoutRecord::reset(JSContext *cx) js::ParallelBailoutRecord::reset(JSContext *cx)
{ {
topScript = NULL; topScript = nullptr;
cause = ParallelBailoutNone; cause = ParallelBailoutNone;
depth = 0; depth = 0;
} }
@ -1798,7 +1799,7 @@ js::ParallelBailoutRecord::addTrace(JSScript *script,
// Ideally, this should never occur, because we should always have // Ideally, this should never occur, because we should always have
// a script when we invoke setCause, but I havent' fully // a script when we invoke setCause, but I havent' fully
// refactored things to that point yet: // refactored things to that point yet:
if (topScript == NULL && script != NULL) if (topScript == nullptr && script != nullptr)
topScript = script; topScript = script;
if (depth < MaxDepth) { if (depth < MaxDepth) {

View File

@ -382,7 +382,7 @@ class LockedJSContext
: slice_(slice), : slice_(slice),
cx_(slice->acquireContext()) cx_(slice->acquireContext())
#else #else
: cx_(NULL) : cx_(nullptr)
#endif #endif
{ } { }
@ -401,7 +401,7 @@ InParallelSection()
{ {
#ifdef JS_THREADSAFE #ifdef JS_THREADSAFE
ForkJoinSlice *current = ForkJoinSlice::Current(); ForkJoinSlice *current = ForkJoinSlice::Current();
return current != NULL; return current != nullptr;
#else #else
return false; return false;
#endif #endif
@ -476,7 +476,7 @@ js::ForkJoinSlice::Current()
#if defined(JS_THREADSAFE) && defined(JS_ION) #if defined(JS_THREADSAFE) && defined(JS_ION)
return (ForkJoinSlice*) PR_GetThreadPrivate(ThreadPrivateIndex); return (ForkJoinSlice*) PR_GetThreadPrivate(ThreadPrivateIndex);
#else #else
return NULL; return nullptr;
#endif #endif
} }

View File

@ -50,7 +50,7 @@ js_InitFunctionClass(JSContext *cx, HandleObject obj)
static bool static bool
ThrowTypeError(JSContext *cx, unsigned argc, Value *vp) ThrowTypeError(JSContext *cx, unsigned argc, Value *vp)
{ {
JS_ReportErrorFlagsAndNumber(cx, JSREPORT_ERROR, js_GetErrorMessage, NULL, JS_ReportErrorFlagsAndNumber(cx, JSREPORT_ERROR, js_GetErrorMessage, nullptr,
JSMSG_THROW_TYPE_ERROR); JSMSG_THROW_TYPE_ERROR);
return false; return false;
} }
@ -141,7 +141,7 @@ ProtoSetterImpl(JSContext *cx, CallArgs args)
* have a mutable [[Prototype]]. * have a mutable [[Prototype]].
*/ */
if (obj->is<ProxyObject>() || obj->is<ArrayBufferObject>()) { if (obj->is<ProxyObject>() || obj->is<ArrayBufferObject>()) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_INCOMPATIBLE_PROTO, JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_INCOMPATIBLE_PROTO,
"Object", "__proto__ setter", "Object", "__proto__ setter",
obj->is<ProxyObject>() ? "Proxy" : "ArrayBuffer"); obj->is<ProxyObject>() ? "Proxy" : "ArrayBuffer");
return false; return false;
@ -191,9 +191,9 @@ GlobalObject::initFunctionAndObjectClasses(JSContext *cx)
* Create |Object.prototype| first, mirroring CreateBlankProto but for the * Create |Object.prototype| first, mirroring CreateBlankProto but for the
* prototype of the created object. * prototype of the created object.
*/ */
objectProto = NewObjectWithGivenProto(cx, &JSObject::class_, NULL, self, SingletonObject); objectProto = NewObjectWithGivenProto(cx, &JSObject::class_, nullptr, self, SingletonObject);
if (!objectProto) if (!objectProto)
return NULL; return nullptr;
/* /*
* The default 'new' type of Object.prototype is required by type inference * The default 'new' type of Object.prototype is required by type inference
@ -201,7 +201,7 @@ GlobalObject::initFunctionAndObjectClasses(JSContext *cx)
* objects in JSON and script literals. * objects in JSON and script literals.
*/ */
if (!setNewTypeUnknown(cx, &JSObject::class_, objectProto)) if (!setNewTypeUnknown(cx, &JSObject::class_, objectProto))
return NULL; return nullptr;
/* Create |Function.prototype| next so we can create other functions. */ /* Create |Function.prototype| next so we can create other functions. */
RootedFunction functionProto(cx); RootedFunction functionProto(cx);
@ -209,7 +209,7 @@ GlobalObject::initFunctionAndObjectClasses(JSContext *cx)
JSObject *functionProto_ = NewObjectWithGivenProto(cx, &JSFunction::class_, JSObject *functionProto_ = NewObjectWithGivenProto(cx, &JSFunction::class_,
objectProto, self, SingletonObject); objectProto, self, SingletonObject);
if (!functionProto_) if (!functionProto_)
return NULL; return nullptr;
functionProto = &functionProto_->as<JSFunction>(); functionProto = &functionProto_->as<JSFunction>();
/* /*
@ -217,10 +217,10 @@ GlobalObject::initFunctionAndObjectClasses(JSContext *cx)
* give it the guts to be one. * give it the guts to be one.
*/ */
{ {
JSObject *proto = NewFunction(cx, functionProto, NULL, 0, JSFunction::INTERPRETED, JSObject *proto = NewFunction(cx, functionProto, nullptr, 0, JSFunction::INTERPRETED,
self, NullPtr()); self, NullPtr());
if (!proto) if (!proto)
return NULL; return nullptr;
JS_ASSERT(proto == functionProto); JS_ASSERT(proto == functionProto);
functionProto->setIsFunctionPrototype(); functionProto->setIsFunctionPrototype();
} }
@ -229,15 +229,16 @@ GlobalObject::initFunctionAndObjectClasses(JSContext *cx)
size_t sourceLen = strlen(rawSource); size_t sourceLen = strlen(rawSource);
jschar *source = InflateString(cx, rawSource, &sourceLen); jschar *source = InflateString(cx, rawSource, &sourceLen);
if (!source) if (!source)
return NULL; return nullptr;
ScriptSource *ss = cx->new_<ScriptSource>(/* originPrincipals = */ (JSPrincipals*) NULL); ScriptSource *ss =
cx->new_<ScriptSource>(/* originPrincipals = */ (JSPrincipals*)nullptr);
if (!ss) { if (!ss) {
js_free(source); js_free(source);
return NULL; return nullptr;
} }
RootedScriptSource sourceObject(cx, ScriptSourceObject::create(cx, ss)); RootedScriptSource sourceObject(cx, ScriptSourceObject::create(cx, ss));
if (!sourceObject) if (!sourceObject)
return NULL; return nullptr;
ss->setSource(source, sourceLen); ss->setSource(source, sourceLen);
CompileOptions options(cx); CompileOptions options(cx);
@ -253,12 +254,12 @@ GlobalObject::initFunctionAndObjectClasses(JSContext *cx)
0, 0,
ss->length())); ss->length()));
if (!script || !JSScript::fullyInitTrivial(cx, script)) if (!script || !JSScript::fullyInitTrivial(cx, script))
return NULL; return nullptr;
functionProto->initScript(script); functionProto->initScript(script);
types::TypeObject* protoType = functionProto->getType(cx); types::TypeObject* protoType = functionProto->getType(cx);
if (!protoType) if (!protoType)
return NULL; return nullptr;
protoType->interpretedFunction = functionProto; protoType->interpretedFunction = functionProto;
script->setFunction(functionProto); script->setFunction(functionProto);
@ -268,7 +269,7 @@ GlobalObject::initFunctionAndObjectClasses(JSContext *cx)
* CloneFunctionObject. * CloneFunctionObject.
*/ */
if (!setNewTypeUnknown(cx, &JSFunction::class_, functionProto)) if (!setNewTypeUnknown(cx, &JSFunction::class_, functionProto))
return NULL; return nullptr;
} }
/* Create the Object function now that we have a [[Prototype]] for it. */ /* Create the Object function now that we have a [[Prototype]] for it. */
@ -277,12 +278,12 @@ GlobalObject::initFunctionAndObjectClasses(JSContext *cx)
RootedObject ctor(cx, NewObjectWithGivenProto(cx, &JSFunction::class_, functionProto, RootedObject ctor(cx, NewObjectWithGivenProto(cx, &JSFunction::class_, functionProto,
self, SingletonObject)); self, SingletonObject));
if (!ctor) if (!ctor)
return NULL; return nullptr;
RootedAtom objectAtom(cx, cx->names().Object); RootedAtom objectAtom(cx, cx->names().Object);
objectCtor = NewFunction(cx, ctor, obj_construct, 1, JSFunction::NATIVE_CTOR, self, objectCtor = NewFunction(cx, ctor, obj_construct, 1, JSFunction::NATIVE_CTOR, self,
objectAtom); objectAtom);
if (!objectCtor) if (!objectCtor)
return NULL; return nullptr;
} }
/* /*
@ -298,12 +299,12 @@ GlobalObject::initFunctionAndObjectClasses(JSContext *cx)
RootedObject ctor(cx, NewObjectWithGivenProto(cx, &JSFunction::class_, functionProto, RootedObject ctor(cx, NewObjectWithGivenProto(cx, &JSFunction::class_, functionProto,
self, SingletonObject)); self, SingletonObject));
if (!ctor) if (!ctor)
return NULL; return nullptr;
RootedAtom functionAtom(cx, cx->names().Function); RootedAtom functionAtom(cx, cx->names().Function);
functionCtor = NewFunction(cx, ctor, Function, 1, JSFunction::NATIVE_CTOR, self, functionCtor = NewFunction(cx, ctor, Function, 1, JSFunction::NATIVE_CTOR, self,
functionAtom); functionAtom);
if (!functionCtor) if (!functionCtor)
return NULL; return nullptr;
JS_ASSERT(ctor == functionCtor); JS_ASSERT(ctor == functionCtor);
} }
@ -318,9 +319,9 @@ GlobalObject::initFunctionAndObjectClasses(JSContext *cx)
* primordial values have. * primordial values have.
*/ */
if (!LinkConstructorAndPrototype(cx, objectCtor, objectProto) || if (!LinkConstructorAndPrototype(cx, objectCtor, objectProto) ||
!DefinePropertiesAndBrand(cx, objectProto, NULL, object_methods)) !DefinePropertiesAndBrand(cx, objectProto, nullptr, object_methods))
{ {
return NULL; return nullptr;
} }
/* /*
@ -332,12 +333,12 @@ GlobalObject::initFunctionAndObjectClasses(JSContext *cx)
RootedFunction getter(cx, NewFunction(cx, NullPtr(), ProtoGetter, 0, JSFunction::NATIVE_FUN, RootedFunction getter(cx, NewFunction(cx, NullPtr(), ProtoGetter, 0, JSFunction::NATIVE_FUN,
self, NullPtr())); self, NullPtr()));
if (!getter) if (!getter)
return NULL; return nullptr;
#if JS_HAS_OBJ_PROTO_PROP #if JS_HAS_OBJ_PROTO_PROP
RootedFunction setter(cx, NewFunction(cx, NullPtr(), ProtoSetter, 0, JSFunction::NATIVE_FUN, RootedFunction setter(cx, NewFunction(cx, NullPtr(), ProtoSetter, 0, JSFunction::NATIVE_FUN,
self, NullPtr())); self, NullPtr()));
if (!setter) if (!setter)
return NULL; return nullptr;
RootedValue undefinedValue(cx, UndefinedValue()); RootedValue undefinedValue(cx, UndefinedValue());
if (!JSObject::defineProperty(cx, objectProto, if (!JSObject::defineProperty(cx, objectProto,
cx->names().proto, undefinedValue, cx->names().proto, undefinedValue,
@ -345,25 +346,25 @@ GlobalObject::initFunctionAndObjectClasses(JSContext *cx)
JS_DATA_TO_FUNC_PTR(StrictPropertyOp, setter.get()), JS_DATA_TO_FUNC_PTR(StrictPropertyOp, setter.get()),
JSPROP_GETTER | JSPROP_SETTER | JSPROP_SHARED)) JSPROP_GETTER | JSPROP_SETTER | JSPROP_SHARED))
{ {
return NULL; return nullptr;
} }
#endif /* JS_HAS_OBJ_PROTO_PROP */ #endif /* JS_HAS_OBJ_PROTO_PROP */
self->setProtoGetter(getter); self->setProtoGetter(getter);
if (!DefinePropertiesAndBrand(cx, objectCtor, NULL, object_static_methods) || if (!DefinePropertiesAndBrand(cx, objectCtor, nullptr, object_static_methods) ||
!LinkConstructorAndPrototype(cx, functionCtor, functionProto) || !LinkConstructorAndPrototype(cx, functionCtor, functionProto) ||
!DefinePropertiesAndBrand(cx, functionProto, NULL, function_methods) || !DefinePropertiesAndBrand(cx, functionProto, nullptr, function_methods) ||
!DefinePropertiesAndBrand(cx, functionCtor, NULL, NULL)) !DefinePropertiesAndBrand(cx, functionCtor, nullptr, nullptr))
{ {
return NULL; return nullptr;
} }
/* Add the global Function and Object properties now. */ /* Add the global Function and Object properties now. */
if (!self->addDataProperty(cx, cx->names().Object, JSProto_Object + JSProto_LIMIT * 2, 0)) if (!self->addDataProperty(cx, cx->names().Object, JSProto_Object + JSProto_LIMIT * 2, 0))
return NULL; return nullptr;
if (!self->addDataProperty(cx, cx->names().Function, JSProto_Function + JSProto_LIMIT * 2, 0)) if (!self->addDataProperty(cx, cx->names().Function, JSProto_Function + JSProto_LIMIT * 2, 0))
return NULL; return nullptr;
/* Heavy lifting done, but lingering tasks remain. */ /* Heavy lifting done, but lingering tasks remain. */
@ -371,25 +372,25 @@ GlobalObject::initFunctionAndObjectClasses(JSContext *cx)
RootedId evalId(cx, NameToId(cx->names().eval)); RootedId evalId(cx, NameToId(cx->names().eval));
JSObject *evalobj = DefineFunction(cx, self, evalId, IndirectEval, 1, JSFUN_STUB_GSOPS); JSObject *evalobj = DefineFunction(cx, self, evalId, IndirectEval, 1, JSFUN_STUB_GSOPS);
if (!evalobj) if (!evalobj)
return NULL; return nullptr;
self->setOriginalEval(evalobj); self->setOriginalEval(evalobj);
/* ES5 13.2.3: Construct the unique [[ThrowTypeError]] function object. */ /* ES5 13.2.3: Construct the unique [[ThrowTypeError]] function object. */
RootedFunction throwTypeError(cx, NewFunction(cx, NullPtr(), ThrowTypeError, 0, RootedFunction throwTypeError(cx, NewFunction(cx, NullPtr(), ThrowTypeError, 0,
JSFunction::NATIVE_FUN, self, NullPtr())); JSFunction::NATIVE_FUN, self, NullPtr()));
if (!throwTypeError) if (!throwTypeError)
return NULL; return nullptr;
if (!JSObject::preventExtensions(cx, throwTypeError)) if (!JSObject::preventExtensions(cx, throwTypeError))
return NULL; return nullptr;
self->setThrowTypeError(throwTypeError); self->setThrowTypeError(throwTypeError);
RootedObject intrinsicsHolder(cx); RootedObject intrinsicsHolder(cx);
if (cx->runtime()->isSelfHostingGlobal(self)) { if (cx->runtime()->isSelfHostingGlobal(self)) {
intrinsicsHolder = self; intrinsicsHolder = self;
} else { } else {
intrinsicsHolder = NewObjectWithClassProto(cx, &JSObject::class_, NULL, self, TenuredObject); intrinsicsHolder = NewObjectWithClassProto(cx, &JSObject::class_, nullptr, self, TenuredObject);
if (!intrinsicsHolder) if (!intrinsicsHolder)
return NULL; return nullptr;
} }
self->setIntrinsicsHolder(intrinsicsHolder); self->setIntrinsicsHolder(intrinsicsHolder);
/* Define a property 'global' with the current global as its value. */ /* Define a property 'global' with the current global as its value. */
@ -398,7 +399,7 @@ GlobalObject::initFunctionAndObjectClasses(JSContext *cx)
global, JS_PropertyStub, JS_StrictPropertyStub, global, JS_PropertyStub, JS_StrictPropertyStub,
JSPROP_PERMANENT | JSPROP_READONLY)) JSPROP_PERMANENT | JSPROP_READONLY))
{ {
return NULL; return nullptr;
} }
/* /*
@ -411,7 +412,7 @@ GlobalObject::initFunctionAndObjectClasses(JSContext *cx)
*/ */
Rooted<TaggedProto> tagged(cx, TaggedProto(objectProto)); Rooted<TaggedProto> tagged(cx, TaggedProto(objectProto));
if (self->shouldSplicePrototype(cx) && !self->splicePrototype(cx, self->getClass(), tagged)) if (self->shouldSplicePrototype(cx) && !self->splicePrototype(cx, self->getClass(), tagged))
return NULL; return nullptr;
/* /*
* Notify any debuggers about the creation of the script for * Notify any debuggers about the creation of the script for
@ -427,23 +428,23 @@ GlobalObject::create(JSContext *cx, const Class *clasp)
{ {
JS_ASSERT(clasp->flags & JSCLASS_IS_GLOBAL); JS_ASSERT(clasp->flags & JSCLASS_IS_GLOBAL);
JSObject *obj = NewObjectWithGivenProto(cx, clasp, NULL, NULL, SingletonObject); JSObject *obj = NewObjectWithGivenProto(cx, clasp, nullptr, nullptr, SingletonObject);
if (!obj) if (!obj)
return NULL; return nullptr;
Rooted<GlobalObject *> global(cx, &obj->as<GlobalObject>()); Rooted<GlobalObject *> global(cx, &obj->as<GlobalObject>());
cx->compartment()->initGlobal(*global); cx->compartment()->initGlobal(*global);
if (!global->setVarObj(cx)) if (!global->setVarObj(cx))
return NULL; return nullptr;
if (!global->setDelegate(cx)) if (!global->setDelegate(cx))
return NULL; return nullptr;
/* Construct a regexp statics object for this global object. */ /* Construct a regexp statics object for this global object. */
JSObject *res = RegExpStatics::create(cx, global); JSObject *res = RegExpStatics::create(cx, global);
if (!res) if (!res)
return NULL; return nullptr;
global->initSlot(REGEXP_STATICS, ObjectValue(*res)); global->initSlot(REGEXP_STATICS, ObjectValue(*res));
return global; return global;
@ -520,7 +521,7 @@ CreateBlankProto(JSContext *cx, const Class *clasp, JSObject &proto, GlobalObjec
RootedObject blankProto(cx, NewObjectWithGivenProto(cx, clasp, &proto, &global, SingletonObject)); RootedObject blankProto(cx, NewObjectWithGivenProto(cx, clasp, &proto, &global, SingletonObject));
if (!blankProto) if (!blankProto)
return NULL; return nullptr;
return blankProto; return blankProto;
} }
@ -531,7 +532,7 @@ GlobalObject::createBlankPrototype(JSContext *cx, const Class *clasp)
Rooted<GlobalObject*> self(cx, this); Rooted<GlobalObject*> self(cx, this);
JSObject *objectProto = getOrCreateObjectPrototype(cx); JSObject *objectProto = getOrCreateObjectPrototype(cx);
if (!objectProto) if (!objectProto)
return NULL; return nullptr;
return CreateBlankProto(cx, clasp, *objectProto, *self.get()); return CreateBlankProto(cx, clasp, *objectProto, *self.get());
} }
@ -588,7 +589,7 @@ GlobalObject::getDebuggers()
{ {
Value debuggers = getReservedSlot(DEBUGGERS); Value debuggers = getReservedSlot(DEBUGGERS);
if (debuggers.isUndefined()) if (debuggers.isUndefined())
return NULL; return nullptr;
JS_ASSERT(debuggers.toObject().getClass() == &GlobalDebuggees_class); JS_ASSERT(debuggers.toObject().getClass() == &GlobalDebuggees_class);
return (DebuggerVector *) debuggers.toObject().getPrivate(); return (DebuggerVector *) debuggers.toObject().getPrivate();
} }
@ -601,12 +602,12 @@ GlobalObject::getOrCreateDebuggers(JSContext *cx, Handle<GlobalObject*> global)
if (debuggers) if (debuggers)
return debuggers; return debuggers;
JSObject *obj = NewObjectWithGivenProto(cx, &GlobalDebuggees_class, NULL, global); JSObject *obj = NewObjectWithGivenProto(cx, &GlobalDebuggees_class, nullptr, global);
if (!obj) if (!obj)
return NULL; return nullptr;
debuggers = cx->new_<DebuggerVector>(); debuggers = cx->new_<DebuggerVector>();
if (!debuggers) if (!debuggers)
return NULL; return nullptr;
obj->setPrivate(debuggers); obj->setPrivate(debuggers);
global->setReservedSlot(DEBUGGERS, ObjectValue(*obj)); global->setReservedSlot(DEBUGGERS, ObjectValue(*obj));
return debuggers; return debuggers;
@ -646,7 +647,7 @@ GlobalObject::getSelfHostedFunction(JSContext *cx, HandleAtom selfHostedName, Ha
if (!funVal.isUndefined()) if (!funVal.isUndefined())
return true; return true;
JSFunction *fun = NewFunction(cx, NullPtr(), NULL, nargs, JSFunction::INTERPRETED_LAZY, JSFunction *fun = NewFunction(cx, NullPtr(), nullptr, nargs, JSFunction::INTERPRETED_LAZY,
holder, name, JSFunction::ExtendedFinalizeKind, SingletonObject); holder, name, JSFunction::ExtendedFinalizeKind, SingletonObject);
if (!fun) if (!fun)
return false; return false;
@ -654,5 +655,5 @@ GlobalObject::getSelfHostedFunction(JSContext *cx, HandleAtom selfHostedName, Ha
fun->setExtendedSlot(0, StringValue(selfHostedName)); fun->setExtendedSlot(0, StringValue(selfHostedName));
funVal.setObject(*fun); funVal.setObject(*fun);
return JSObject::defineGeneric(cx, holder, shId, funVal, NULL, NULL, 0); return JSObject::defineGeneric(cx, holder, shId, funVal, nullptr, nullptr, 0);
} }

View File

@ -265,7 +265,7 @@ class GlobalObject : public JSObject
return &getPrototype(JSProto_Object).toObject(); return &getPrototype(JSProto_Object).toObject();
Rooted<GlobalObject*> self(cx, this); Rooted<GlobalObject*> self(cx, this);
if (!initFunctionAndObjectClasses(cx)) if (!initFunctionAndObjectClasses(cx))
return NULL; return nullptr;
return &self->getPrototype(JSProto_Object).toObject(); return &self->getPrototype(JSProto_Object).toObject();
} }
@ -274,7 +274,7 @@ class GlobalObject : public JSObject
return &getPrototype(JSProto_Function).toObject(); return &getPrototype(JSProto_Function).toObject();
Rooted<GlobalObject*> self(cx, this); Rooted<GlobalObject*> self(cx, this);
if (!initFunctionAndObjectClasses(cx)) if (!initFunctionAndObjectClasses(cx))
return NULL; return nullptr;
return &self->getPrototype(JSProto_Function).toObject(); return &self->getPrototype(JSProto_Function).toObject();
} }
@ -283,7 +283,7 @@ class GlobalObject : public JSObject
return &getPrototype(JSProto_Array).toObject(); return &getPrototype(JSProto_Array).toObject();
Rooted<GlobalObject*> self(cx, this); Rooted<GlobalObject*> self(cx, this);
if (!js_InitArrayClass(cx, self)) if (!js_InitArrayClass(cx, self))
return NULL; return nullptr;
return &self->getPrototype(JSProto_Array).toObject(); return &self->getPrototype(JSProto_Array).toObject();
} }
@ -292,7 +292,7 @@ class GlobalObject : public JSObject
return &getPrototype(JSProto_Boolean).toObject(); return &getPrototype(JSProto_Boolean).toObject();
Rooted<GlobalObject*> self(cx, this); Rooted<GlobalObject*> self(cx, this);
if (!js_InitBooleanClass(cx, self)) if (!js_InitBooleanClass(cx, self))
return NULL; return nullptr;
return &self->getPrototype(JSProto_Boolean).toObject(); return &self->getPrototype(JSProto_Boolean).toObject();
} }
@ -301,7 +301,7 @@ class GlobalObject : public JSObject
return &getPrototype(JSProto_Number).toObject(); return &getPrototype(JSProto_Number).toObject();
Rooted<GlobalObject*> self(cx, this); Rooted<GlobalObject*> self(cx, this);
if (!js_InitNumberClass(cx, self)) if (!js_InitNumberClass(cx, self))
return NULL; return nullptr;
return &self->getPrototype(JSProto_Number).toObject(); return &self->getPrototype(JSProto_Number).toObject();
} }
@ -310,7 +310,7 @@ class GlobalObject : public JSObject
return &getPrototype(JSProto_String).toObject(); return &getPrototype(JSProto_String).toObject();
Rooted<GlobalObject*> self(cx, this); Rooted<GlobalObject*> self(cx, this);
if (!js_InitStringClass(cx, self)) if (!js_InitStringClass(cx, self))
return NULL; return nullptr;
return &self->getPrototype(JSProto_String).toObject(); return &self->getPrototype(JSProto_String).toObject();
} }
@ -319,7 +319,7 @@ class GlobalObject : public JSObject
return &getPrototype(JSProto_RegExp).toObject(); return &getPrototype(JSProto_RegExp).toObject();
Rooted<GlobalObject*> self(cx, this); Rooted<GlobalObject*> self(cx, this);
if (!js_InitRegExpClass(cx, self)) if (!js_InitRegExpClass(cx, self))
return NULL; return nullptr;
return &self->getPrototype(JSProto_RegExp).toObject(); return &self->getPrototype(JSProto_RegExp).toObject();
} }
@ -328,7 +328,7 @@ class GlobalObject : public JSObject
return &getPrototype(JSProto_ArrayBuffer).toObject(); return &getPrototype(JSProto_ArrayBuffer).toObject();
Rooted<GlobalObject*> self(cx, this); Rooted<GlobalObject*> self(cx, this);
if (!js_InitTypedArrayClasses(cx, self)) if (!js_InitTypedArrayClasses(cx, self))
return NULL; return nullptr;
return &self->getPrototype(JSProto_ArrayBuffer).toObject(); return &self->getPrototype(JSProto_ArrayBuffer).toObject();
} }
@ -338,7 +338,7 @@ class GlobalObject : public JSObject
return &getPrototype(key).toObject(); return &getPrototype(key).toObject();
Rooted<GlobalObject*> self(cx, this); Rooted<GlobalObject*> self(cx, this);
if (!js_InitExceptionClasses(cx, self)) if (!js_InitExceptionClasses(cx, self))
return NULL; return nullptr;
return &self->getPrototype(key).toObject(); return &self->getPrototype(key).toObject();
} }
@ -383,7 +383,7 @@ class GlobalObject : public JSObject
return &v.toObject(); return &v.toObject();
Rooted<GlobalObject*> self(cx, this); Rooted<GlobalObject*> self(cx, this);
if (!init(cx, self)) if (!init(cx, self))
return NULL; return nullptr;
return &self->getSlot(slot).toObject(); return &self->getSlot(slot).toObject();
} }
@ -426,7 +426,7 @@ class GlobalObject : public JSObject
return &getPrototype(JSProto_DataView).toObject(); return &getPrototype(JSProto_DataView).toObject();
Rooted<GlobalObject*> self(cx, this); Rooted<GlobalObject*> self(cx, this);
if (!js_InitTypedArrayClasses(cx, self)) if (!js_InitTypedArrayClasses(cx, self))
return NULL; return nullptr;
return &self->getPrototype(JSProto_DataView).toObject(); return &self->getPrototype(JSProto_DataView).toObject();
} }
@ -442,7 +442,7 @@ class GlobalObject : public JSObject
return true; return true;
if (!cx->runtime()->cloneSelfHostedValue(cx, name, value)) if (!cx->runtime()->cloneSelfHostedValue(cx, name, value))
return false; return false;
return JS_DefinePropertyById(cx, holder, id, value, NULL, NULL, 0); return JS_DefinePropertyById(cx, holder, id, value, nullptr, nullptr, 0);
} }
bool setIntrinsicValue(JSContext *cx, PropertyName *name, HandleValue value) { bool setIntrinsicValue(JSContext *cx, PropertyName *name, HandleValue value) {
@ -512,13 +512,13 @@ class GlobalObject : public JSObject
/* /*
* The collection of Debugger objects debugging this global. If this global * The collection of Debugger objects debugging this global. If this global
* is not a debuggee, this returns either NULL or an empty vector. * is not a debuggee, this returns either nullptr or an empty vector.
*/ */
DebuggerVector *getDebuggers(); DebuggerVector *getDebuggers();
/* /*
* The same, but create the empty vector if one does not already * The same, but create the empty vector if one does not already
* exist. Returns NULL only on OOM. * exist. Returns nullptr only on OOM.
*/ */
static DebuggerVector *getOrCreateDebuggers(JSContext *cx, Handle<GlobalObject*> global); static DebuggerVector *getOrCreateDebuggers(JSContext *cx, Handle<GlobalObject*> global);

View File

@ -104,7 +104,7 @@ GuardFunApplyArgumentsOptimization(JSContext *cx, AbstractFramePtr frame, Handle
* *
* For objects, return the object itself. For string, boolean, and number * For objects, return the object itself. For string, boolean, and number
* primitive values, return the appropriate constructor's prototype. For * primitive values, return the appropriate constructor's prototype. For
* undefined and null, throw an error and return NULL, attributing the * undefined and null, throw an error and return nullptr, attributing the
* problem to the value at |spindex| on the stack. * problem to the value at |spindex| on the stack.
*/ */
JS_ALWAYS_INLINE JSObject * JS_ALWAYS_INLINE JSObject *
@ -124,7 +124,7 @@ ValuePropertyBearer(JSContext *cx, StackFrame *fp, HandleValue v, int spindex)
JS_ASSERT(v.isNull() || v.isUndefined()); JS_ASSERT(v.isNull() || v.isUndefined());
js_ReportIsNullOrUndefined(cx, spindex, v, NullPtr()); js_ReportIsNullOrUndefined(cx, spindex, v, NullPtr());
return NULL; return nullptr;
} }
inline bool inline bool
@ -289,7 +289,7 @@ DefVarOrConstOperation(JSContext *cx, HandleObject varobj, HandlePropertyName dn
if (AtomToPrintableString(cx, dn, &bytes)) { if (AtomToPrintableString(cx, dn, &bytes)) {
JS_ALWAYS_FALSE(JS_ReportErrorFlagsAndNumber(cx, JSREPORT_ERROR, JS_ALWAYS_FALSE(JS_ReportErrorFlagsAndNumber(cx, JSREPORT_ERROR,
js_GetErrorMessage, js_GetErrorMessage,
NULL, JSMSG_REDECLARED_VAR, nullptr, JSMSG_REDECLARED_VAR,
(oldAttrs & JSPROP_READONLY) (oldAttrs & JSPROP_READONLY)
? "const" ? "const"
: "var", : "var",
@ -493,7 +493,7 @@ InitElemOperation(JSContext *cx, HandleObject obj, HandleValue idval, HandleValu
if (!ValueToId<CanGC>(cx, idval, &id)) if (!ValueToId<CanGC>(cx, idval, &id))
return false; return false;
return JSObject::defineGeneric(cx, obj, id, val, NULL, NULL, JSPROP_ENUMERATE); return JSObject::defineGeneric(cx, obj, id, val, nullptr, nullptr, JSPROP_ENUMERATE);
} }
static JS_ALWAYS_INLINE bool static JS_ALWAYS_INLINE bool
@ -519,12 +519,12 @@ InitArrayElemOperation(JSContext *cx, jsbytecode *pc, HandleObject obj, uint32_t
return false; return false;
} }
} else { } else {
if (!JSObject::defineElement(cx, obj, index, val, NULL, NULL, JSPROP_ENUMERATE)) if (!JSObject::defineElement(cx, obj, index, val, nullptr, nullptr, JSPROP_ENUMERATE))
return false; return false;
} }
if (op == JSOP_INITELEM_INC && index == INT32_MAX) { if (op == JSOP_INITELEM_INC && index == INT32_MAX) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_SPREAD_TOO_LARGE); JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_SPREAD_TOO_LARGE);
return false; return false;
} }
@ -660,7 +660,7 @@ ReportIfNotFunction(JSContext *cx, const Value &v, MaybeConstruct construct = NO
return &v.toObject().as<JSFunction>(); return &v.toObject().as<JSFunction>();
ReportIsNotFunction(cx, v, -1, construct); ReportIsNotFunction(cx, v, -1, construct);
return NULL; return nullptr;
} }
/* /*
@ -715,7 +715,7 @@ class FastInvokeGuard
return false; return false;
} }
if (ictx_.empty()) if (ictx_.empty())
ictx_.construct(cx, (js::jit::TempAllocator *)NULL); ictx_.construct(cx, (js::jit::TempAllocator *)nullptr);
JS_ASSERT(fun_->nonLazyScript() == script_); JS_ASSERT(fun_->nonLazyScript() == script_);
jit::MethodStatus status = jit::CanEnterUsingFastInvoke(cx, script_, args_.length()); jit::MethodStatus status = jit::CanEnterUsingFastInvoke(cx, script_, args_.length());

View File

@ -140,7 +140,7 @@ js::BoxNonStrictThis(JSContext *cx, const CallReceiver &call)
JS_ASSERT(!call.thisv().isMagic()); JS_ASSERT(!call.thisv().isMagic());
#ifdef DEBUG #ifdef DEBUG
JSFunction *fun = call.callee().is<JSFunction>() ? &call.callee().as<JSFunction>() : NULL; JSFunction *fun = call.callee().is<JSFunction>() ? &call.callee().as<JSFunction>() : nullptr;
JS_ASSERT_IF(fun && fun->isInterpreted(), !fun->strict()); JS_ASSERT_IF(fun && fun->isInterpreted(), !fun->strict());
#endif #endif
@ -190,7 +190,7 @@ js::OnUnknownMethod(JSContext *cx, HandleObject obj, Value idval_, MutableHandle
TypeScript::MonitorUnknown(cx); TypeScript::MonitorUnknown(cx);
if (value.isObject()) { if (value.isObject()) {
JSObject *obj = NewObjectWithClassProto(cx, &js_NoSuchMethodClass, NULL, NULL); JSObject *obj = NewObjectWithClassProto(cx, &js_NoSuchMethodClass, nullptr, nullptr);
if (!obj) if (!obj)
return false; return false;
@ -297,8 +297,8 @@ NameOperation(JSContext *cx, StackFrame *fp, jsbytecode *pc, MutableHandleValue
if (IsGlobalOp(JSOp(*pc))) if (IsGlobalOp(JSOp(*pc)))
obj = &obj->global(); obj = &obj->global();
Shape *shape = NULL; Shape *shape = nullptr;
JSObject *scope = NULL, *pobj = NULL; JSObject *scope = nullptr, *pobj = nullptr;
if (LookupNameNoGC(cx, name, obj, &scope, &pobj, &shape)) { if (LookupNameNoGC(cx, name, obj, &scope, &pobj, &shape)) {
if (FetchNameNoGC(pobj, shape, vp)) if (FetchNameNoGC(pobj, shape, vp))
return true; return true;
@ -349,7 +349,7 @@ js::ReportIsNotFunction(JSContext *cx, const Value &v, int numToSkip, MaybeConst
int spIndex = numToSkip >= 0 ? -(numToSkip + 1) : JSDVG_SEARCH_STACK; int spIndex = numToSkip >= 0 ? -(numToSkip + 1) : JSDVG_SEARCH_STACK;
RootedValue val(cx, v); RootedValue val(cx, v);
js_ReportValueError3(cx, error, spIndex, val, NullPtr(), NULL, NULL); js_ReportValueError3(cx, error, spIndex, val, NullPtr(), nullptr, nullptr);
return false; return false;
} }
@ -363,7 +363,7 @@ js::ValueToCallable(JSContext *cx, const Value &v, int numToSkip, MaybeConstruct
} }
ReportIsNotFunction(cx, v, numToSkip, construct); ReportIsNotFunction(cx, v, numToSkip, construct);
return NULL; return nullptr;
} }
static JS_NEVER_INLINE bool static JS_NEVER_INLINE bool
@ -883,7 +883,7 @@ TryNoteIter::TryNoteIter(JSContext *cx, const FrameRegs &regs)
tn = script->trynotes()->vector; tn = script->trynotes()->vector;
tnEnd = tn + script->trynotes()->length; tnEnd = tn + script->trynotes()->length;
} else { } else {
tn = tnEnd = NULL; tn = tnEnd = nullptr;
} }
settle(); settle();
} }
@ -1012,8 +1012,8 @@ js::IteratorNext(JSContext *cx, HandleObject iterobj, MutableHandleValue rval)
FrameGuard::FrameGuard(RunState &state, FrameRegs &regs) FrameGuard::FrameGuard(RunState &state, FrameRegs &regs)
: state_(state), : state_(state),
regs_(regs), regs_(regs),
stack_(NULL), stack_(nullptr),
fp_(NULL) fp_(nullptr)
{ } { }
FrameGuard::~FrameGuard() FrameGuard::~FrameGuard()
@ -1204,7 +1204,7 @@ ModOperation(JSContext *cx, HandleScript script, jsbytecode *pc, HandleValue lhs
static JS_ALWAYS_INLINE bool static JS_ALWAYS_INLINE bool
SetObjectElementOperation(JSContext *cx, Handle<JSObject*> obj, HandleId id, const Value &value, SetObjectElementOperation(JSContext *cx, Handle<JSObject*> obj, HandleId id, const Value &value,
bool strict, JSScript *script = NULL, jsbytecode *pc = NULL) bool strict, JSScript *script = nullptr, jsbytecode *pc = nullptr)
{ {
types::TypeScript::MonitorAssign(cx, obj, id); types::TypeScript::MonitorAssign(cx, obj, id);
@ -1758,8 +1758,8 @@ BEGIN_CASE(JSOP_IN)
RootedShape &prop = rootShape0; RootedShape &prop = rootShape0;
if (!JSObject::lookupGeneric(cx, obj, id, &obj2, &prop)) if (!JSObject::lookupGeneric(cx, obj, id, &obj2, &prop))
goto error; goto error;
bool cond = prop != NULL; bool cond = prop != nullptr;
prop = NULL; prop = nullptr;
TRY_BRANCH_AFTER_COND(cond, 2); TRY_BRANCH_AFTER_COND(cond, 2);
regs.sp--; regs.sp--;
regs.sp[-1].setBoolean(cond); regs.sp[-1].setBoolean(cond);
@ -2399,7 +2399,7 @@ BEGIN_CASE(JSOP_SPREADEVAL)
uint32_t length = aobj->as<ArrayObject>().length(); uint32_t length = aobj->as<ArrayObject>().length();
if (length > ARGS_LENGTH_MAX) { if (length > ARGS_LENGTH_MAX) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr,
op == JSOP_SPREADNEW ? JSMSG_TOO_MANY_CON_SPREADARGS op == JSOP_SPREADNEW ? JSMSG_TOO_MANY_CON_SPREADARGS
: JSMSG_TOO_MANY_FUN_SPREADARGS); : JSMSG_TOO_MANY_FUN_SPREADARGS);
goto error; goto error;
@ -2778,7 +2778,8 @@ BEGIN_CASE(JSOP_SETALIASEDVAR)
// Avoid computing the name if no type updates are needed, as this may be // Avoid computing the name if no type updates are needed, as this may be
// expensive on scopes with large numbers of variables. // expensive on scopes with large numbers of variables.
PropertyName *name = obj.hasSingletonType() ? ScopeCoordinateName(cx, script, regs.pc) : NULL; PropertyName *name = obj.hasSingletonType() ? ScopeCoordinateName(cx, script, regs.pc)
: nullptr;
obj.setAliasedVar(cx, sc, name, regs.sp[-1]); obj.setAliasedVar(cx, sc, name, regs.sp[-1]);
} }
@ -2937,7 +2938,7 @@ BEGIN_CASE(JSOP_NEWINIT)
NewObjectKind newKind; NewObjectKind newKind;
if (i == JSProto_Array) { if (i == JSProto_Array) {
newKind = UseNewTypeForInitializer(cx, script, regs.pc, &ArrayObject::class_); newKind = UseNewTypeForInitializer(cx, script, regs.pc, &ArrayObject::class_);
obj = NewDenseEmptyArray(cx, NULL, newKind); obj = NewDenseEmptyArray(cx, nullptr, newKind);
} else { } else {
gc::AllocKind allocKind = GuessObjectGCKind(0); gc::AllocKind allocKind = GuessObjectGCKind(0);
newKind = UseNewTypeForInitializer(cx, script, regs.pc, &JSObject::class_); newKind = UseNewTypeForInitializer(cx, script, regs.pc, &JSObject::class_);
@ -2956,7 +2957,7 @@ BEGIN_CASE(JSOP_NEWARRAY)
unsigned count = GET_UINT24(regs.pc); unsigned count = GET_UINT24(regs.pc);
RootedObject &obj = rootObject0; RootedObject &obj = rootObject0;
NewObjectKind newKind = UseNewTypeForInitializer(cx, script, regs.pc, &ArrayObject::class_); NewObjectKind newKind = UseNewTypeForInitializer(cx, script, regs.pc, &ArrayObject::class_);
obj = NewDenseAllocatedArray(cx, count, NULL, newKind); obj = NewDenseAllocatedArray(cx, count, nullptr, newKind);
if (!obj || !SetInitializerObjectType(cx, script, regs.pc, obj, newKind)) if (!obj || !SetInitializerObjectType(cx, script, regs.pc, obj, newKind))
goto error; goto error;
@ -3008,7 +3009,7 @@ BEGIN_CASE(JSOP_INITPROP)
if (JS_UNLIKELY(name == cx->names().proto) if (JS_UNLIKELY(name == cx->names().proto)
? !baseops::SetPropertyHelper(cx, obj, obj, id, 0, &rval, script->strict) ? !baseops::SetPropertyHelper(cx, obj, obj, id, 0, &rval, script->strict)
: !DefineNativeProperty(cx, obj, id, rval, NULL, NULL, : !DefineNativeProperty(cx, obj, id, rval, nullptr, nullptr,
JSPROP_ENUMERATE, 0, 0, 0)) { JSPROP_ENUMERATE, 0, 0, 0)) {
goto error; goto error;
} }
@ -3078,12 +3079,13 @@ BEGIN_CASE(JSOP_SPREAD)
RootedValue &iterVal = rootValue0; RootedValue &iterVal = rootValue0;
while (iter.next()) { while (iter.next()) {
if (count == INT32_MAX) { if (count == INT32_MAX) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr,
JSMSG_SPREAD_TOO_LARGE); JSMSG_SPREAD_TOO_LARGE);
goto error; goto error;
} }
iterVal = iter.value(); iterVal = iter.value();
if (!JSObject::defineElement(cx, arr, count++, iterVal, NULL, NULL, JSPROP_ENUMERATE)) if (!JSObject::defineElement(cx, arr, count++, iterVal, nullptr, nullptr,
JSPROP_ENUMERATE))
goto error; goto error;
} }
if (!iter.close()) if (!iter.close())
@ -3295,7 +3297,7 @@ default:
{ {
char numBuf[12]; char numBuf[12];
JS_snprintf(numBuf, sizeof numBuf, "%d", op); JS_snprintf(numBuf, sizeof numBuf, "%d", op);
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr,
JSMSG_BAD_BYTECODE, numBuf); JSMSG_BAD_BYTECODE, numBuf);
goto error; goto error;
} }
@ -3503,7 +3505,7 @@ js::Lambda(JSContext *cx, HandleFunction fun, HandleObject parent)
{ {
RootedObject clone(cx, CloneFunctionObjectIfNotSingleton(cx, fun, parent, TenuredObject)); RootedObject clone(cx, CloneFunctionObjectIfNotSingleton(cx, fun, parent, TenuredObject));
if (!clone) if (!clone)
return NULL; return nullptr;
if (fun->isArrow()) { if (fun->isArrow()) {
// Note that this will assert if called from Ion code. Ion can't yet // Note that this will assert if called from Ion code. Ion can't yet
@ -3519,12 +3521,12 @@ js::Lambda(JSContext *cx, HandleFunction fun, HandleObject parent)
} }
if (!ComputeThis(cx, frame)) if (!ComputeThis(cx, frame))
return NULL; return nullptr;
RootedValue thisval(cx, frame.thisValue()); RootedValue thisval(cx, frame.thisValue());
clone = js_fun_bind(cx, clone, thisval, NULL, 0); clone = js_fun_bind(cx, clone, thisval, nullptr, 0);
if (!clone) if (!clone)
return NULL; return nullptr;
clone->as<JSFunction>().flags |= JSFunction::ARROW; clone->as<JSFunction>().flags |= JSFunction::ARROW;
} }
@ -3599,7 +3601,7 @@ js::DefFunOperation(JSContext *cx, HandleScript script, HandleObject scopeChain,
if (shape->isAccessorDescriptor() || !shape->writable() || !shape->enumerable()) { if (shape->isAccessorDescriptor() || !shape->writable() || !shape->enumerable()) {
JSAutoByteString bytes; JSAutoByteString bytes;
if (AtomToPrintableString(cx, name, &bytes)) { if (AtomToPrintableString(cx, name, &bytes)) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_CANT_REDEFINE_PROP, JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_CANT_REDEFINE_PROP,
bytes.ptr()); bytes.ptr());
} }
@ -3621,7 +3623,7 @@ js::DefFunOperation(JSContext *cx, HandleScript script, HandleObject scopeChain,
bool bool
js::SetCallOperation(JSContext *cx) js::SetCallOperation(JSContext *cx)
{ {
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_BAD_LEFTSIDE_OF_ASS); JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_BAD_LEFTSIDE_OF_ASS);
return false; return false;
} }

View File

@ -62,7 +62,7 @@ class MatchPairs
protected: protected:
/* Not used directly: use ScopedMatchPairs or VectorMatchPairs. */ /* Not used directly: use ScopedMatchPairs or VectorMatchPairs. */
MatchPairs() MatchPairs()
: pairCount_(0), pairs_(NULL) : pairCount_(0), pairs_(nullptr)
{ } { }
protected: protected:
@ -75,7 +75,7 @@ class MatchPairs
bool initArray(size_t pairCount); bool initArray(size_t pairCount);
bool initArrayFrom(MatchPairs &copyFrom); bool initArrayFrom(MatchPairs &copyFrom);
void forgetArray() { pairs_ = NULL; } void forgetArray() { pairs_ = nullptr; }
void displace(size_t disp); void displace(size_t disp);
void checkAgainst(size_t inputLength) { void checkAgainst(size_t inputLength) {

View File

@ -51,7 +51,7 @@ InefficientNonFlatteningStringHashPolicy::hash(const Lookup &l)
chars = l->pureChars(); chars = l->pureChars();
} else { } else {
// Slowest hash function evar! // Slowest hash function evar!
if (!l->copyNonPureChars(/* tcx */ NULL, ownedChars)) if (!l->copyNonPureChars(/* tcx */ nullptr, ownedChars))
MOZ_CRASH("oom"); MOZ_CRASH("oom");
chars = ownedChars; chars = ownedChars;
} }
@ -71,7 +71,7 @@ InefficientNonFlatteningStringHashPolicy::match(const JSString *const &k, const
if (k->hasPureChars()) { if (k->hasPureChars()) {
c1 = k->pureChars(); c1 = k->pureChars();
} else { } else {
if (!k->copyNonPureChars(/* tcx */ NULL, ownedChars1)) if (!k->copyNonPureChars(/* tcx */ nullptr, ownedChars1))
MOZ_CRASH("oom"); MOZ_CRASH("oom");
c1 = ownedChars1; c1 = ownedChars1;
} }
@ -81,7 +81,7 @@ InefficientNonFlatteningStringHashPolicy::match(const JSString *const &k, const
if (l->hasPureChars()) { if (l->hasPureChars()) {
c2 = l->pureChars(); c2 = l->pureChars();
} else { } else {
if (!l->copyNonPureChars(/* tcx */ NULL, ownedChars2)) if (!l->copyNonPureChars(/* tcx */ nullptr, ownedChars2))
MOZ_CRASH("oom"); MOZ_CRASH("oom");
c2 = ownedChars2; c2 = ownedChars2;
} }
@ -113,7 +113,7 @@ NotableStringInfo::NotableStringInfo(JSString *str, const StringInfo &info)
if (str->hasPureChars()) { if (str->hasPureChars()) {
chars = str->pureChars(); chars = str->pureChars();
} else { } else {
if (!str->copyNonPureChars(/* tcx */ NULL, ownedChars)) if (!str->copyNonPureChars(/* tcx */ nullptr, ownedChars))
MOZ_CRASH("oom"); MOZ_CRASH("oom");
chars = ownedChars; chars = ownedChars;
} }
@ -139,7 +139,7 @@ NotableStringInfo::NotableStringInfo(MoveRef<NotableStringInfo> info)
: StringInfo(info) : StringInfo(info)
{ {
buffer = info->buffer; buffer = info->buffer;
info->buffer = NULL; info->buffer = nullptr;
} }
NotableStringInfo &NotableStringInfo::operator=(MoveRef<NotableStringInfo> info) NotableStringInfo &NotableStringInfo::operator=(MoveRef<NotableStringInfo> info)
@ -480,7 +480,7 @@ JS::CollectRuntimeStats(JSRuntime *rt, RuntimeStats *rtStats, ObjectPrivateVisit
#endif #endif
for (CompartmentsIter comp(rt); !comp.done(); comp.next()) for (CompartmentsIter comp(rt); !comp.done(); comp.next())
comp->compartmentStats = NULL; comp->compartmentStats = nullptr;
size_t numDirtyChunks = size_t numDirtyChunks =
(rtStats->gcHeapChunkTotal - rtStats->gcHeapUnusedChunks) / gc::ChunkSize; (rtStats->gcHeapChunkTotal - rtStats->gcHeapUnusedChunks) / gc::ChunkSize;

View File

@ -35,8 +35,8 @@ class Monitor
public: public:
Monitor() Monitor()
: lock_(NULL), : lock_(nullptr),
condVar_(NULL) condVar_(nullptr)
{ } { }
~Monitor() { ~Monitor() {

View File

@ -18,7 +18,7 @@ NumberObject::create(JSContext *cx, double d)
{ {
JSObject *obj = NewBuiltinClassInstance(cx, &class_); JSObject *obj = NewBuiltinClassInstance(cx, &class_);
if (!obj) if (!obj)
return NULL; return nullptr;
NumberObject &numobj = obj->as<NumberObject>(); NumberObject &numobj = obj->as<NumberObject>();
numobj.setPrimitiveValue(d); numobj.setPrimitiveValue(d);
return &numobj; return &numobj;

View File

@ -37,7 +37,7 @@ PropDesc::checkGetter(JSContext *cx)
{ {
if (hasGet_) { if (hasGet_) {
if (!js_IsCallable(get_) && !get_.isUndefined()) { if (!js_IsCallable(get_) && !get_.isUndefined()) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_BAD_GET_SET_FIELD, JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_BAD_GET_SET_FIELD,
js_getter_str); js_getter_str);
return false; return false;
} }
@ -50,7 +50,7 @@ PropDesc::checkSetter(JSContext *cx)
{ {
if (hasSet_) { if (hasSet_) {
if (!js_IsCallable(set_) && !set_.isUndefined()) { if (!js_IsCallable(set_) && !set_.isUndefined()) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_BAD_GET_SET_FIELD, JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_BAD_GET_SET_FIELD,
js_setter_str); js_setter_str);
return false; return false;
} }
@ -63,7 +63,7 @@ CheckArgCompartment(JSContext *cx, JSObject *obj, HandleValue v,
const char *methodname, const char *propname) const char *methodname, const char *propname)
{ {
if (v.isObject() && v.toObject().compartment() != obj->compartment()) { if (v.isObject() && v.toObject().compartment() != obj->compartment()) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_DEBUG_COMPARTMENT_MISMATCH, JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_DEBUG_COMPARTMENT_MISMATCH,
methodname, propname); methodname, propname);
return false; return false;
} }
@ -193,7 +193,7 @@ js::ObjectImpl::checkShapeConsistency()
MOZ_ASSERT(isNative()); MOZ_ASSERT(isNative());
Shape *shape = lastProperty(); Shape *shape = lastProperty();
Shape *prev = NULL; Shape *prev = nullptr;
if (inDictionaryMode()) { if (inDictionaryMode()) {
MOZ_ASSERT(shape->hasTable()); MOZ_ASSERT(shape->hasTable());
@ -485,7 +485,7 @@ DenseElementsHeader::defineElement(JSContext *cx, Handle<ObjectImpl*> obj, uint3
MOZ_ALWAYS_FALSE(js_ReportValueErrorFlags(cx, JSREPORT_ERROR, JSMSG_OBJECT_NOT_EXTENSIBLE, MOZ_ALWAYS_FALSE(js_ReportValueErrorFlags(cx, JSREPORT_ERROR, JSMSG_OBJECT_NOT_EXTENSIBLE,
JSDVG_IGNORE_STACK, JSDVG_IGNORE_STACK,
val, NullPtr(), val, NullPtr(),
NULL, NULL)); nullptr, nullptr));
return false; return false;
} }
@ -517,7 +517,8 @@ js::ArrayBufferDelegate(JSContext *cx, Handle<ObjectImpl*> obj)
MOZ_ASSERT(obj->hasClass(&ArrayBufferObject::class_)); MOZ_ASSERT(obj->hasClass(&ArrayBufferObject::class_));
if (obj->getPrivate()) if (obj->getPrivate())
return static_cast<JSObject *>(obj->getPrivate()); return static_cast<JSObject *>(obj->getPrivate());
JSObject *delegate = NewObjectWithGivenProto(cx, &JSObject::class_, obj->getProto(), NULL); JSObject *delegate = NewObjectWithGivenProto(cx, &JSObject::class_,
obj->getProto(), nullptr);
obj->setPrivateGCThing(delegate); obj->setPrivateGCThing(delegate);
return delegate; return delegate;
} }
@ -534,7 +535,7 @@ TypedElementsHeader<T>::defineElement(JSContext *cx, Handle<ObjectImpl*> obj,
RootedValue val(cx, ObjectValue(*obj)); RootedValue val(cx, ObjectValue(*obj));
js_ReportValueErrorFlags(cx, JSREPORT_ERROR, JSMSG_OBJECT_NOT_EXTENSIBLE, js_ReportValueErrorFlags(cx, JSREPORT_ERROR, JSMSG_OBJECT_NOT_EXTENSIBLE,
JSDVG_IGNORE_STACK, JSDVG_IGNORE_STACK,
val, NullPtr(), NULL, NULL); val, NullPtr(), nullptr, nullptr);
return false; return false;
} }
@ -573,7 +574,7 @@ js::GetOwnProperty(JSContext *cx, Handle<ObjectImpl*> obj, PropertyId pid_, unsi
Rooted<jsid> id(cx, pid.get().asId()); Rooted<jsid> id(cx, pid.get().asId());
Rooted<JSObject*> robj(cx, static_cast<JSObject*>(obj.get())); Rooted<JSObject*> robj(cx, static_cast<JSObject*>(obj.get()));
if (clasp->flags & JSCLASS_NEW_RESOLVE) { if (clasp->flags & JSCLASS_NEW_RESOLVE) {
Rooted<JSObject*> obj2(cx, NULL); Rooted<JSObject*> obj2(cx, nullptr);
JSNewResolveOp op = reinterpret_cast<JSNewResolveOp>(resolve); JSNewResolveOp op = reinterpret_cast<JSNewResolveOp>(resolve);
if (!op(cx, robj, id, resolveFlags, &obj2)) if (!op(cx, robj, id, resolveFlags, &obj2))
return false; return false;

View File

@ -892,7 +892,7 @@ IsObjectValueInCompartment(js::Value v, JSCompartment *comp);
* allocated array (the slots member). For an object with N fixed slots, shapes * allocated array (the slots member). For an object with N fixed slots, shapes
* with slots [0..N-1] are stored in the fixed slots, and the remainder are * with slots [0..N-1] are stored in the fixed slots, and the remainder are
* stored in the dynamic array. If all properties fit in the fixed slots, the * stored in the dynamic array. If all properties fit in the fixed slots, the
* 'slots' member is NULL. * 'slots' member is nullptr.
* *
* Elements are indexed via the 'elements' member. This member can point to * Elements are indexed via the 'elements' member. This member can point to
* either the shared emptyObjectElements singleton, into the inline value array * either the shared emptyObjectElements singleton, into the inline value array
@ -1033,7 +1033,7 @@ class ObjectImpl : public gc::BarrieredCell<ObjectImpl>
Shape * Shape *
replaceWithNewEquivalentShape(ExclusiveContext *cx, replaceWithNewEquivalentShape(ExclusiveContext *cx,
Shape *existingShape, Shape *newShape = NULL); Shape *existingShape, Shape *newShape = nullptr);
enum GenerateShape { enum GenerateShape {
GENERATE_NONE, GENERATE_NONE,
@ -1064,7 +1064,7 @@ class ObjectImpl : public gc::BarrieredCell<ObjectImpl>
if (start + length < fixed) { if (start + length < fixed) {
*fixedStart = &fixedSlots()[start]; *fixedStart = &fixedSlots()[start];
*fixedEnd = &fixedSlots()[start + length]; *fixedEnd = &fixedSlots()[start + length];
*slotsStart = *slotsEnd = NULL; *slotsStart = *slotsEnd = nullptr;
} else { } else {
uint32_t localCopy = fixed - start; uint32_t localCopy = fixed - start;
*fixedStart = &fixedSlots()[start]; *fixedStart = &fixedSlots()[start];
@ -1073,7 +1073,7 @@ class ObjectImpl : public gc::BarrieredCell<ObjectImpl>
*slotsEnd = &slots[length - localCopy]; *slotsEnd = &slots[length - localCopy];
} }
} else { } else {
*fixedStart = *fixedEnd = NULL; *fixedStart = *fixedEnd = nullptr;
*slotsStart = &slots[start - fixed]; *slotsStart = &slots[start - fixed];
*slotsEnd = &slots[start - fixed + length]; *slotsEnd = &slots[start - fixed + length];
} }
@ -1167,7 +1167,7 @@ class ObjectImpl : public gc::BarrieredCell<ObjectImpl>
return shape_; return shape_;
} }
bool generateOwnShape(ExclusiveContext *cx, js::Shape *newShape = NULL) { bool generateOwnShape(ExclusiveContext *cx, js::Shape *newShape = nullptr) {
return replaceWithNewEquivalentShape(cx, lastProperty(), newShape); return replaceWithNewEquivalentShape(cx, lastProperty(), newShape);
} }
@ -1220,10 +1220,10 @@ class ObjectImpl : public gc::BarrieredCell<ObjectImpl>
} }
bool nativeContains(ExclusiveContext *cx, jsid id) { bool nativeContains(ExclusiveContext *cx, jsid id) {
return nativeLookup(cx, id) != NULL; return nativeLookup(cx, id) != nullptr;
} }
bool nativeContains(ExclusiveContext *cx, PropertyName* name) { bool nativeContains(ExclusiveContext *cx, PropertyName* name) {
return nativeLookup(cx, name) != NULL; return nativeLookup(cx, name) != nullptr;
} }
bool nativeContains(ExclusiveContext *cx, Shape* shape) { bool nativeContains(ExclusiveContext *cx, Shape* shape) {
return nativeLookup(cx, shape->propid()) == shape; return nativeLookup(cx, shape->propid()) == shape;
@ -1242,7 +1242,7 @@ class ObjectImpl : public gc::BarrieredCell<ObjectImpl>
} }
bool nativeContainsPure(jsid id) { bool nativeContainsPure(jsid id) {
return nativeLookupPure(id) != NULL; return nativeLookupPure(id) != nullptr;
} }
bool nativeContainsPure(PropertyName* name) { bool nativeContainsPure(PropertyName* name) {
return nativeContainsPure(NameToId(name)); return nativeContainsPure(NameToId(name));

View File

@ -201,7 +201,7 @@ CheckDebugMode(JSContext *cx)
*/ */
if (!debugMode) { if (!debugMode) {
JS_ReportErrorFlagsAndNumber(cx, JSREPORT_ERROR, js_GetErrorMessage, JS_ReportErrorFlagsAndNumber(cx, JSREPORT_ERROR, js_GetErrorMessage,
NULL, JSMSG_NEED_DEBUG_MODE); nullptr, JSMSG_NEED_DEBUG_MODE);
} }
return debugMode; return debugMode;
} }
@ -243,7 +243,7 @@ JS_ClearTrap(JSContext *cx, JSScript *script, jsbytecode *pc,
site->clearTrap(cx->runtime()->defaultFreeOp(), handlerp, closurep); site->clearTrap(cx->runtime()->defaultFreeOp(), handlerp, closurep);
} else { } else {
if (handlerp) if (handlerp)
*handlerp = NULL; *handlerp = nullptr;
if (closurep) if (closurep)
*closurep = JSVAL_VOID; *closurep = JSVAL_VOID;
} }
@ -309,7 +309,7 @@ JS_SetWatchPoint(JSContext *cx, JSObject *obj_, jsid id_,
if (JSID_IS_INT(id)) { if (JSID_IS_INT(id)) {
propid = id; propid = id;
} else if (JSID_IS_OBJECT(id)) { } else if (JSID_IS_OBJECT(id)) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_CANT_WATCH_PROP); JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_CANT_WATCH_PROP);
return false; return false;
} else { } else {
RootedValue val(cx, IdToValue(id)); RootedValue val(cx, IdToValue(id));
@ -325,7 +325,7 @@ JS_SetWatchPoint(JSContext *cx, JSObject *obj_, jsid id_,
return false; return false;
if (!obj->isNative()) { if (!obj->isNative()) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_CANT_WATCH, JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_CANT_WATCH,
obj->getClass()->name); obj->getClass()->name);
return false; return false;
} }
@ -461,7 +461,7 @@ JS_GetFunctionLocalNameArray(JSContext *cx, JSFunction *fun, void **memp)
RootedScript script(cx, fun->nonLazyScript()); RootedScript script(cx, fun->nonLazyScript());
BindingVector bindings(cx); BindingVector bindings(cx);
if (!FillBindingVector(script, &bindings)) if (!FillBindingVector(script, &bindings))
return NULL; return nullptr;
LifoAlloc &lifo = cx->tempLifoAlloc(); LifoAlloc &lifo = cx->tempLifoAlloc();
@ -470,7 +470,7 @@ JS_GetFunctionLocalNameArray(JSContext *cx, JSFunction *fun, void **memp)
void *mem = lifo.alloc(sizeof(LifoAlloc::Mark) + bindings.length() * sizeof(uintptr_t)); void *mem = lifo.alloc(sizeof(LifoAlloc::Mark) + bindings.length() * sizeof(uintptr_t));
if (!mem) { if (!mem) {
js_ReportOutOfMemory(cx); js_ReportOutOfMemory(cx);
return NULL; return nullptr;
} }
*memp = mem; *memp = mem;
*reinterpret_cast<LifoAlloc::Mark*>(mem) = mark; *reinterpret_cast<LifoAlloc::Mark*>(mem) = mark;
@ -505,7 +505,7 @@ JS_PUBLIC_API(JSScript *)
JS_GetFunctionScript(JSContext *cx, JSFunction *fun) JS_GetFunctionScript(JSContext *cx, JSFunction *fun)
{ {
if (fun->isNative()) if (fun->isNative())
return NULL; return nullptr;
if (fun->isInterpretedLazy()) { if (fun->isInterpretedLazy()) {
RootedFunction rootedFun(cx, fun); RootedFunction rootedFun(cx, fun);
AutoCompartment funCompartment(cx, rootedFun); AutoCompartment funCompartment(cx, rootedFun);
@ -570,7 +570,7 @@ JS_GetScriptSourceMap(JSContext *cx, JSScript *script)
{ {
ScriptSource *source = script->scriptSource(); ScriptSource *source = script->scriptSource();
JS_ASSERT(source); JS_ASSERT(source);
return source->hasSourceMapURL() ? source->sourceMapURL() : NULL; return source->hasSourceMapURL() ? source->sourceMapURL() : nullptr;
} }
JS_PUBLIC_API(unsigned) JS_PUBLIC_API(unsigned)
@ -666,7 +666,7 @@ JS_GetPropertyDescArray(JSContext *cx, JSObject *obj_, JSPropertyDescArray *pda)
assertSameCompartment(cx, obj); assertSameCompartment(cx, obj);
uint32_t i = 0; uint32_t i = 0;
JSPropertyDesc *pd = NULL; JSPropertyDesc *pd = nullptr;
if (obj->is<DebugScopeObject>()) { if (obj->is<DebugScopeObject>()) {
AutoIdVector props(cx); AutoIdVector props(cx);
@ -680,10 +680,10 @@ JS_GetPropertyDescArray(JSContext *cx, JSObject *obj_, JSPropertyDescArray *pda)
for (i = 0; i < props.length(); ++i) { for (i = 0; i < props.length(); ++i) {
pd[i].id = JSVAL_NULL; pd[i].id = JSVAL_NULL;
pd[i].value = JSVAL_NULL; pd[i].value = JSVAL_NULL;
if (!AddValueRoot(cx, &pd[i].id, NULL)) if (!AddValueRoot(cx, &pd[i].id, nullptr))
goto bad; goto bad;
pd[i].id = IdToValue(props[i]); pd[i].id = IdToValue(props[i]);
if (!AddValueRoot(cx, &pd[i].value, NULL)) if (!AddValueRoot(cx, &pd[i].value, nullptr))
goto bad; goto bad;
if (!Proxy::get(cx, obj, obj, props.handleAt(i), MutableHandleValue::fromMarkedLocation(&pd[i].value))) if (!Proxy::get(cx, obj, obj, props.handleAt(i), MutableHandleValue::fromMarkedLocation(&pd[i].value)))
goto bad; goto bad;
@ -697,7 +697,7 @@ JS_GetPropertyDescArray(JSContext *cx, JSObject *obj_, JSPropertyDescArray *pda)
const Class *clasp; const Class *clasp;
clasp = obj->getClass(); clasp = obj->getClass();
if (!obj->isNative() || (clasp->flags & JSCLASS_NEW_ENUMERATE)) { if (!obj->isNative() || (clasp->flags & JSCLASS_NEW_ENUMERATE)) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr,
JSMSG_CANT_DESCRIBE_PROPS, clasp->name); JSMSG_CANT_DESCRIBE_PROPS, clasp->name);
return false; return false;
} }
@ -707,7 +707,7 @@ JS_GetPropertyDescArray(JSContext *cx, JSObject *obj_, JSPropertyDescArray *pda)
/* Return an empty pda early if obj has no own properties. */ /* Return an empty pda early if obj has no own properties. */
if (obj->nativeEmpty()) { if (obj->nativeEmpty()) {
pda->length = 0; pda->length = 0;
pda->array = NULL; pda->array = nullptr;
return true; return true;
} }
@ -722,14 +722,14 @@ JS_GetPropertyDescArray(JSContext *cx, JSObject *obj_, JSPropertyDescArray *pda)
pd[i].id = JSVAL_NULL; pd[i].id = JSVAL_NULL;
pd[i].value = JSVAL_NULL; pd[i].value = JSVAL_NULL;
pd[i].alias = JSVAL_NULL; pd[i].alias = JSVAL_NULL;
if (!AddValueRoot(cx, &pd[i].id, NULL)) if (!AddValueRoot(cx, &pd[i].id, nullptr))
goto bad; goto bad;
if (!AddValueRoot(cx, &pd[i].value, NULL)) if (!AddValueRoot(cx, &pd[i].value, nullptr))
goto bad; goto bad;
shape = const_cast<Shape *>(&r.front()); shape = const_cast<Shape *>(&r.front());
if (!GetPropertyDesc(cx, obj, shape, &pd[i])) if (!GetPropertyDesc(cx, obj, shape, &pd[i]))
goto bad; goto bad;
if ((pd[i].flags & JSPD_ALIAS) && !AddValueRoot(cx, &pd[i].alias, NULL)) if ((pd[i].flags & JSPD_ALIAS) && !AddValueRoot(cx, &pd[i].alias, nullptr))
goto bad; goto bad;
if (++i == obj->propertyCount()) if (++i == obj->propertyCount())
break; break;
@ -761,7 +761,7 @@ JS_PutPropertyDescArray(JSContext *cx, JSPropertyDescArray *pda)
js_RemoveRoot(cx->runtime(), &pd[i].alias); js_RemoveRoot(cx->runtime(), &pd[i].alias);
} }
js_free(pd); js_free(pd);
pda->array = NULL; pda->array = nullptr;
pda->length = 0; pda->length = 0;
} }
@ -972,14 +972,14 @@ JS::DescribeStack(JSContext *cx, unsigned maxFrames)
desc.lineno = PCToLineNumber(i.script(), i.pc()); desc.lineno = PCToLineNumber(i.script(), i.pc());
desc.fun = i.maybeCallee(); desc.fun = i.maybeCallee();
if (!frames.append(desc)) if (!frames.append(desc))
return NULL; return nullptr;
if (frames.length() == maxFrames) if (frames.length() == maxFrames)
break; break;
} }
JS::StackDescription *desc = js_new<JS::StackDescription>(); JS::StackDescription *desc = js_new<JS::StackDescription>();
if (!desc) if (!desc)
return NULL; return nullptr;
desc->nframes = frames.length(); desc->nframes = frames.length();
desc->frames = frames.extractRawBuffer(); desc->frames = frames.extractRawBuffer();
@ -1015,7 +1015,7 @@ class AutoPropertyDescArray
void fetch(JSObject *obj) { void fetch(JSObject *obj) {
JS_ASSERT(!descArray_.array); JS_ASSERT(!descArray_.array);
if (!JS_GetPropertyDescArray(cx_, obj, &descArray_)) if (!JS_GetPropertyDescArray(cx_, obj, &descArray_))
descArray_.array = NULL; descArray_.array = nullptr;
} }
JSPropertyDescArray * operator ->() { JSPropertyDescArray * operator ->() {
@ -1031,10 +1031,10 @@ FormatValue(JSContext *cx, const Value &vArg, JSAutoByteString &bytes)
RootedValue v(cx, vArg); RootedValue v(cx, vArg);
JSString *str = ToString<CanGC>(cx, v); JSString *str = ToString<CanGC>(cx, v);
if (!str) if (!str)
return NULL; return nullptr;
const char *buf = bytes.encodeLatin1(cx, str); const char *buf = bytes.encodeLatin1(cx, str);
if (!buf) if (!buf)
return NULL; return nullptr;
const char *found = strstr(buf, "function "); const char *found = strstr(buf, "function ");
if (found && (found - buf <= 2)) if (found && (found - buf <= 2))
return "[function]"; return "[function]";
@ -1095,7 +1095,7 @@ FormatFrame(JSContext *cx, const NonBuiltinScriptFrameIter &iter, char *buf, int
for (uint32_t i = 0; i < callProps->length; i++) { for (uint32_t i = 0; i < callProps->length; i++) {
JSPropertyDesc* desc = &callProps->array[i]; JSPropertyDesc* desc = &callProps->array[i];
JSAutoByteString nameBytes; JSAutoByteString nameBytes;
const char *name = NULL; const char *name = nullptr;
bool hasName = JSVAL_IS_STRING(desc->id); bool hasName = JSVAL_IS_STRING(desc->id);
if (hasName) if (hasName)
name = FormatValue(cx, desc->id, nameBytes); name = FormatValue(cx, desc->id, nameBytes);
@ -1134,7 +1134,7 @@ FormatFrame(JSContext *cx, const NonBuiltinScriptFrameIter &iter, char *buf, int
JS_snprintf(number, 8, "%d", (int) k); JS_snprintf(number, 8, "%d", (int) k);
JSAutoByteString valueBytes; JSAutoByteString valueBytes;
const char *value = NULL; const char *value = nullptr;
if (JS_GetProperty(cx, argsObj, number, &val) && if (JS_GetProperty(cx, argsObj, number, &val) &&
(value = FormatValue(cx, val, valueBytes))) (value = FormatValue(cx, val, valueBytes)))
{ {
@ -1197,7 +1197,7 @@ FormatFrame(JSContext *cx, const NonBuiltinScriptFrameIter &iter, char *buf, int
if (!thisVal.isUndefined()) { if (!thisVal.isUndefined()) {
JSAutoByteString thisValBytes; JSAutoByteString thisValBytes;
RootedString thisValStr(cx, ToString<CanGC>(cx, thisVal)); RootedString thisValStr(cx, ToString<CanGC>(cx, thisVal));
const char *str = NULL; const char *str = nullptr;
if (thisValStr && if (thisValStr &&
(str = thisValBytes.encodeLatin1(cx, thisValStr))) (str = thisValBytes.encodeLatin1(cx, thisValStr)))
{ {
@ -1274,7 +1274,7 @@ JSAbstractFramePtr::callObject(JSContext *cx)
{ {
AbstractFramePtr frame = Valueify(*this); AbstractFramePtr frame = Valueify(*this);
if (!frame.isFunctionFrame()) if (!frame.isFunctionFrame())
return NULL; return nullptr;
JSObject *o = GetDebugScopeForFrame(cx, frame); JSObject *o = GetDebugScopeForFrame(cx, frame);
@ -1292,7 +1292,7 @@ JSAbstractFramePtr::callObject(JSContext *cx)
return o; return o;
o = o->enclosingScope(); o = o->enclosingScope();
} }
return NULL; return nullptr;
} }
JSFunction * JSFunction *