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

View File

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

View File

@ -50,7 +50,7 @@ js_InitFunctionClass(JSContext *cx, HandleObject obj)
static bool
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);
return false;
}
@ -141,7 +141,7 @@ ProtoSetterImpl(JSContext *cx, CallArgs args)
* have a mutable [[Prototype]].
*/
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",
obj->is<ProxyObject>() ? "Proxy" : "ArrayBuffer");
return false;
@ -191,9 +191,9 @@ GlobalObject::initFunctionAndObjectClasses(JSContext *cx)
* Create |Object.prototype| first, mirroring CreateBlankProto but for the
* prototype of the created object.
*/
objectProto = NewObjectWithGivenProto(cx, &JSObject::class_, NULL, self, SingletonObject);
objectProto = NewObjectWithGivenProto(cx, &JSObject::class_, nullptr, self, SingletonObject);
if (!objectProto)
return NULL;
return nullptr;
/*
* 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.
*/
if (!setNewTypeUnknown(cx, &JSObject::class_, objectProto))
return NULL;
return nullptr;
/* Create |Function.prototype| next so we can create other functions. */
RootedFunction functionProto(cx);
@ -209,7 +209,7 @@ GlobalObject::initFunctionAndObjectClasses(JSContext *cx)
JSObject *functionProto_ = NewObjectWithGivenProto(cx, &JSFunction::class_,
objectProto, self, SingletonObject);
if (!functionProto_)
return NULL;
return nullptr;
functionProto = &functionProto_->as<JSFunction>();
/*
@ -217,10 +217,10 @@ GlobalObject::initFunctionAndObjectClasses(JSContext *cx)
* 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());
if (!proto)
return NULL;
return nullptr;
JS_ASSERT(proto == functionProto);
functionProto->setIsFunctionPrototype();
}
@ -229,15 +229,16 @@ GlobalObject::initFunctionAndObjectClasses(JSContext *cx)
size_t sourceLen = strlen(rawSource);
jschar *source = InflateString(cx, rawSource, &sourceLen);
if (!source)
return NULL;
ScriptSource *ss = cx->new_<ScriptSource>(/* originPrincipals = */ (JSPrincipals*) NULL);
return nullptr;
ScriptSource *ss =
cx->new_<ScriptSource>(/* originPrincipals = */ (JSPrincipals*)nullptr);
if (!ss) {
js_free(source);
return NULL;
return nullptr;
}
RootedScriptSource sourceObject(cx, ScriptSourceObject::create(cx, ss));
if (!sourceObject)
return NULL;
return nullptr;
ss->setSource(source, sourceLen);
CompileOptions options(cx);
@ -253,12 +254,12 @@ GlobalObject::initFunctionAndObjectClasses(JSContext *cx)
0,
ss->length()));
if (!script || !JSScript::fullyInitTrivial(cx, script))
return NULL;
return nullptr;
functionProto->initScript(script);
types::TypeObject* protoType = functionProto->getType(cx);
if (!protoType)
return NULL;
return nullptr;
protoType->interpretedFunction = functionProto;
script->setFunction(functionProto);
@ -268,7 +269,7 @@ GlobalObject::initFunctionAndObjectClasses(JSContext *cx)
* CloneFunctionObject.
*/
if (!setNewTypeUnknown(cx, &JSFunction::class_, functionProto))
return NULL;
return nullptr;
}
/* 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,
self, SingletonObject));
if (!ctor)
return NULL;
return nullptr;
RootedAtom objectAtom(cx, cx->names().Object);
objectCtor = NewFunction(cx, ctor, obj_construct, 1, JSFunction::NATIVE_CTOR, self,
objectAtom);
if (!objectCtor)
return NULL;
return nullptr;
}
/*
@ -298,12 +299,12 @@ GlobalObject::initFunctionAndObjectClasses(JSContext *cx)
RootedObject ctor(cx, NewObjectWithGivenProto(cx, &JSFunction::class_, functionProto,
self, SingletonObject));
if (!ctor)
return NULL;
return nullptr;
RootedAtom functionAtom(cx, cx->names().Function);
functionCtor = NewFunction(cx, ctor, Function, 1, JSFunction::NATIVE_CTOR, self,
functionAtom);
if (!functionCtor)
return NULL;
return nullptr;
JS_ASSERT(ctor == functionCtor);
}
@ -318,9 +319,9 @@ GlobalObject::initFunctionAndObjectClasses(JSContext *cx)
* primordial values have.
*/
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,
self, NullPtr()));
if (!getter)
return NULL;
return nullptr;
#if JS_HAS_OBJ_PROTO_PROP
RootedFunction setter(cx, NewFunction(cx, NullPtr(), ProtoSetter, 0, JSFunction::NATIVE_FUN,
self, NullPtr()));
if (!setter)
return NULL;
return nullptr;
RootedValue undefinedValue(cx, UndefinedValue());
if (!JSObject::defineProperty(cx, objectProto,
cx->names().proto, undefinedValue,
@ -345,25 +346,25 @@ GlobalObject::initFunctionAndObjectClasses(JSContext *cx)
JS_DATA_TO_FUNC_PTR(StrictPropertyOp, setter.get()),
JSPROP_GETTER | JSPROP_SETTER | JSPROP_SHARED))
{
return NULL;
return nullptr;
}
#endif /* JS_HAS_OBJ_PROTO_PROP */
self->setProtoGetter(getter);
if (!DefinePropertiesAndBrand(cx, objectCtor, NULL, object_static_methods) ||
if (!DefinePropertiesAndBrand(cx, objectCtor, nullptr, object_static_methods) ||
!LinkConstructorAndPrototype(cx, functionCtor, functionProto) ||
!DefinePropertiesAndBrand(cx, functionProto, NULL, function_methods) ||
!DefinePropertiesAndBrand(cx, functionCtor, NULL, NULL))
!DefinePropertiesAndBrand(cx, functionProto, nullptr, function_methods) ||
!DefinePropertiesAndBrand(cx, functionCtor, nullptr, nullptr))
{
return NULL;
return nullptr;
}
/* Add the global Function and Object properties now. */
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))
return NULL;
return nullptr;
/* Heavy lifting done, but lingering tasks remain. */
@ -371,25 +372,25 @@ GlobalObject::initFunctionAndObjectClasses(JSContext *cx)
RootedId evalId(cx, NameToId(cx->names().eval));
JSObject *evalobj = DefineFunction(cx, self, evalId, IndirectEval, 1, JSFUN_STUB_GSOPS);
if (!evalobj)
return NULL;
return nullptr;
self->setOriginalEval(evalobj);
/* ES5 13.2.3: Construct the unique [[ThrowTypeError]] function object. */
RootedFunction throwTypeError(cx, NewFunction(cx, NullPtr(), ThrowTypeError, 0,
JSFunction::NATIVE_FUN, self, NullPtr()));
if (!throwTypeError)
return NULL;
return nullptr;
if (!JSObject::preventExtensions(cx, throwTypeError))
return NULL;
return nullptr;
self->setThrowTypeError(throwTypeError);
RootedObject intrinsicsHolder(cx);
if (cx->runtime()->isSelfHostingGlobal(self)) {
intrinsicsHolder = self;
} else {
intrinsicsHolder = NewObjectWithClassProto(cx, &JSObject::class_, NULL, self, TenuredObject);
intrinsicsHolder = NewObjectWithClassProto(cx, &JSObject::class_, nullptr, self, TenuredObject);
if (!intrinsicsHolder)
return NULL;
return nullptr;
}
self->setIntrinsicsHolder(intrinsicsHolder);
/* Define a property 'global' with the current global as its value. */
@ -398,7 +399,7 @@ GlobalObject::initFunctionAndObjectClasses(JSContext *cx)
global, JS_PropertyStub, JS_StrictPropertyStub,
JSPROP_PERMANENT | JSPROP_READONLY))
{
return NULL;
return nullptr;
}
/*
@ -411,7 +412,7 @@ GlobalObject::initFunctionAndObjectClasses(JSContext *cx)
*/
Rooted<TaggedProto> tagged(cx, TaggedProto(objectProto));
if (self->shouldSplicePrototype(cx) && !self->splicePrototype(cx, self->getClass(), tagged))
return NULL;
return nullptr;
/*
* 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);
JSObject *obj = NewObjectWithGivenProto(cx, clasp, NULL, NULL, SingletonObject);
JSObject *obj = NewObjectWithGivenProto(cx, clasp, nullptr, nullptr, SingletonObject);
if (!obj)
return NULL;
return nullptr;
Rooted<GlobalObject *> global(cx, &obj->as<GlobalObject>());
cx->compartment()->initGlobal(*global);
if (!global->setVarObj(cx))
return NULL;
return nullptr;
if (!global->setDelegate(cx))
return NULL;
return nullptr;
/* Construct a regexp statics object for this global object. */
JSObject *res = RegExpStatics::create(cx, global);
if (!res)
return NULL;
return nullptr;
global->initSlot(REGEXP_STATICS, ObjectValue(*res));
return global;
@ -520,7 +521,7 @@ CreateBlankProto(JSContext *cx, const Class *clasp, JSObject &proto, GlobalObjec
RootedObject blankProto(cx, NewObjectWithGivenProto(cx, clasp, &proto, &global, SingletonObject));
if (!blankProto)
return NULL;
return nullptr;
return blankProto;
}
@ -531,7 +532,7 @@ GlobalObject::createBlankPrototype(JSContext *cx, const Class *clasp)
Rooted<GlobalObject*> self(cx, this);
JSObject *objectProto = getOrCreateObjectPrototype(cx);
if (!objectProto)
return NULL;
return nullptr;
return CreateBlankProto(cx, clasp, *objectProto, *self.get());
}
@ -588,7 +589,7 @@ GlobalObject::getDebuggers()
{
Value debuggers = getReservedSlot(DEBUGGERS);
if (debuggers.isUndefined())
return NULL;
return nullptr;
JS_ASSERT(debuggers.toObject().getClass() == &GlobalDebuggees_class);
return (DebuggerVector *) debuggers.toObject().getPrivate();
}
@ -601,12 +602,12 @@ GlobalObject::getOrCreateDebuggers(JSContext *cx, Handle<GlobalObject*> global)
if (debuggers)
return debuggers;
JSObject *obj = NewObjectWithGivenProto(cx, &GlobalDebuggees_class, NULL, global);
JSObject *obj = NewObjectWithGivenProto(cx, &GlobalDebuggees_class, nullptr, global);
if (!obj)
return NULL;
return nullptr;
debuggers = cx->new_<DebuggerVector>();
if (!debuggers)
return NULL;
return nullptr;
obj->setPrivate(debuggers);
global->setReservedSlot(DEBUGGERS, ObjectValue(*obj));
return debuggers;
@ -646,7 +647,7 @@ GlobalObject::getSelfHostedFunction(JSContext *cx, HandleAtom selfHostedName, Ha
if (!funVal.isUndefined())
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);
if (!fun)
return false;
@ -654,5 +655,5 @@ GlobalObject::getSelfHostedFunction(JSContext *cx, HandleAtom selfHostedName, Ha
fun->setExtendedSlot(0, StringValue(selfHostedName));
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();
Rooted<GlobalObject*> self(cx, this);
if (!initFunctionAndObjectClasses(cx))
return NULL;
return nullptr;
return &self->getPrototype(JSProto_Object).toObject();
}
@ -274,7 +274,7 @@ class GlobalObject : public JSObject
return &getPrototype(JSProto_Function).toObject();
Rooted<GlobalObject*> self(cx, this);
if (!initFunctionAndObjectClasses(cx))
return NULL;
return nullptr;
return &self->getPrototype(JSProto_Function).toObject();
}
@ -283,7 +283,7 @@ class GlobalObject : public JSObject
return &getPrototype(JSProto_Array).toObject();
Rooted<GlobalObject*> self(cx, this);
if (!js_InitArrayClass(cx, self))
return NULL;
return nullptr;
return &self->getPrototype(JSProto_Array).toObject();
}
@ -292,7 +292,7 @@ class GlobalObject : public JSObject
return &getPrototype(JSProto_Boolean).toObject();
Rooted<GlobalObject*> self(cx, this);
if (!js_InitBooleanClass(cx, self))
return NULL;
return nullptr;
return &self->getPrototype(JSProto_Boolean).toObject();
}
@ -301,7 +301,7 @@ class GlobalObject : public JSObject
return &getPrototype(JSProto_Number).toObject();
Rooted<GlobalObject*> self(cx, this);
if (!js_InitNumberClass(cx, self))
return NULL;
return nullptr;
return &self->getPrototype(JSProto_Number).toObject();
}
@ -310,7 +310,7 @@ class GlobalObject : public JSObject
return &getPrototype(JSProto_String).toObject();
Rooted<GlobalObject*> self(cx, this);
if (!js_InitStringClass(cx, self))
return NULL;
return nullptr;
return &self->getPrototype(JSProto_String).toObject();
}
@ -319,7 +319,7 @@ class GlobalObject : public JSObject
return &getPrototype(JSProto_RegExp).toObject();
Rooted<GlobalObject*> self(cx, this);
if (!js_InitRegExpClass(cx, self))
return NULL;
return nullptr;
return &self->getPrototype(JSProto_RegExp).toObject();
}
@ -328,7 +328,7 @@ class GlobalObject : public JSObject
return &getPrototype(JSProto_ArrayBuffer).toObject();
Rooted<GlobalObject*> self(cx, this);
if (!js_InitTypedArrayClasses(cx, self))
return NULL;
return nullptr;
return &self->getPrototype(JSProto_ArrayBuffer).toObject();
}
@ -338,7 +338,7 @@ class GlobalObject : public JSObject
return &getPrototype(key).toObject();
Rooted<GlobalObject*> self(cx, this);
if (!js_InitExceptionClasses(cx, self))
return NULL;
return nullptr;
return &self->getPrototype(key).toObject();
}
@ -383,7 +383,7 @@ class GlobalObject : public JSObject
return &v.toObject();
Rooted<GlobalObject*> self(cx, this);
if (!init(cx, self))
return NULL;
return nullptr;
return &self->getSlot(slot).toObject();
}
@ -426,7 +426,7 @@ class GlobalObject : public JSObject
return &getPrototype(JSProto_DataView).toObject();
Rooted<GlobalObject*> self(cx, this);
if (!js_InitTypedArrayClasses(cx, self))
return NULL;
return nullptr;
return &self->getPrototype(JSProto_DataView).toObject();
}
@ -442,7 +442,7 @@ class GlobalObject : public JSObject
return true;
if (!cx->runtime()->cloneSelfHostedValue(cx, name, value))
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) {
@ -512,13 +512,13 @@ class GlobalObject : public JSObject
/*
* 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();
/*
* 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);

View File

@ -104,7 +104,7 @@ GuardFunApplyArgumentsOptimization(JSContext *cx, AbstractFramePtr frame, Handle
*
* For objects, return the object itself. For string, boolean, and number
* 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.
*/
JS_ALWAYS_INLINE JSObject *
@ -124,7 +124,7 @@ ValuePropertyBearer(JSContext *cx, StackFrame *fp, HandleValue v, int spindex)
JS_ASSERT(v.isNull() || v.isUndefined());
js_ReportIsNullOrUndefined(cx, spindex, v, NullPtr());
return NULL;
return nullptr;
}
inline bool
@ -289,7 +289,7 @@ DefVarOrConstOperation(JSContext *cx, HandleObject varobj, HandlePropertyName dn
if (AtomToPrintableString(cx, dn, &bytes)) {
JS_ALWAYS_FALSE(JS_ReportErrorFlagsAndNumber(cx, JSREPORT_ERROR,
js_GetErrorMessage,
NULL, JSMSG_REDECLARED_VAR,
nullptr, JSMSG_REDECLARED_VAR,
(oldAttrs & JSPROP_READONLY)
? "const"
: "var",
@ -493,7 +493,7 @@ InitElemOperation(JSContext *cx, HandleObject obj, HandleValue idval, HandleValu
if (!ValueToId<CanGC>(cx, idval, &id))
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
@ -519,12 +519,12 @@ InitArrayElemOperation(JSContext *cx, jsbytecode *pc, HandleObject obj, uint32_t
return false;
}
} 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;
}
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;
}
@ -660,7 +660,7 @@ ReportIfNotFunction(JSContext *cx, const Value &v, MaybeConstruct construct = NO
return &v.toObject().as<JSFunction>();
ReportIsNotFunction(cx, v, -1, construct);
return NULL;
return nullptr;
}
/*
@ -715,7 +715,7 @@ class FastInvokeGuard
return false;
}
if (ictx_.empty())
ictx_.construct(cx, (js::jit::TempAllocator *)NULL);
ictx_.construct(cx, (js::jit::TempAllocator *)nullptr);
JS_ASSERT(fun_->nonLazyScript() == script_);
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());
#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());
#endif
@ -190,7 +190,7 @@ js::OnUnknownMethod(JSContext *cx, HandleObject obj, Value idval_, MutableHandle
TypeScript::MonitorUnknown(cx);
if (value.isObject()) {
JSObject *obj = NewObjectWithClassProto(cx, &js_NoSuchMethodClass, NULL, NULL);
JSObject *obj = NewObjectWithClassProto(cx, &js_NoSuchMethodClass, nullptr, nullptr);
if (!obj)
return false;
@ -297,8 +297,8 @@ NameOperation(JSContext *cx, StackFrame *fp, jsbytecode *pc, MutableHandleValue
if (IsGlobalOp(JSOp(*pc)))
obj = &obj->global();
Shape *shape = NULL;
JSObject *scope = NULL, *pobj = NULL;
Shape *shape = nullptr;
JSObject *scope = nullptr, *pobj = nullptr;
if (LookupNameNoGC(cx, name, obj, &scope, &pobj, &shape)) {
if (FetchNameNoGC(pobj, shape, vp))
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;
RootedValue val(cx, v);
js_ReportValueError3(cx, error, spIndex, val, NullPtr(), NULL, NULL);
js_ReportValueError3(cx, error, spIndex, val, NullPtr(), nullptr, nullptr);
return false;
}
@ -363,7 +363,7 @@ js::ValueToCallable(JSContext *cx, const Value &v, int numToSkip, MaybeConstruct
}
ReportIsNotFunction(cx, v, numToSkip, construct);
return NULL;
return nullptr;
}
static JS_NEVER_INLINE bool
@ -883,7 +883,7 @@ TryNoteIter::TryNoteIter(JSContext *cx, const FrameRegs &regs)
tn = script->trynotes()->vector;
tnEnd = tn + script->trynotes()->length;
} else {
tn = tnEnd = NULL;
tn = tnEnd = nullptr;
}
settle();
}
@ -1012,8 +1012,8 @@ js::IteratorNext(JSContext *cx, HandleObject iterobj, MutableHandleValue rval)
FrameGuard::FrameGuard(RunState &state, FrameRegs &regs)
: state_(state),
regs_(regs),
stack_(NULL),
fp_(NULL)
stack_(nullptr),
fp_(nullptr)
{ }
FrameGuard::~FrameGuard()
@ -1204,7 +1204,7 @@ ModOperation(JSContext *cx, HandleScript script, jsbytecode *pc, HandleValue lhs
static JS_ALWAYS_INLINE bool
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);
@ -1758,8 +1758,8 @@ BEGIN_CASE(JSOP_IN)
RootedShape &prop = rootShape0;
if (!JSObject::lookupGeneric(cx, obj, id, &obj2, &prop))
goto error;
bool cond = prop != NULL;
prop = NULL;
bool cond = prop != nullptr;
prop = nullptr;
TRY_BRANCH_AFTER_COND(cond, 2);
regs.sp--;
regs.sp[-1].setBoolean(cond);
@ -2399,7 +2399,7 @@ BEGIN_CASE(JSOP_SPREADEVAL)
uint32_t length = aobj->as<ArrayObject>().length();
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
: JSMSG_TOO_MANY_FUN_SPREADARGS);
goto error;
@ -2778,7 +2778,8 @@ BEGIN_CASE(JSOP_SETALIASEDVAR)
// Avoid computing the name if no type updates are needed, as this may be
// 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]);
}
@ -2937,7 +2938,7 @@ BEGIN_CASE(JSOP_NEWINIT)
NewObjectKind newKind;
if (i == JSProto_Array) {
newKind = UseNewTypeForInitializer(cx, script, regs.pc, &ArrayObject::class_);
obj = NewDenseEmptyArray(cx, NULL, newKind);
obj = NewDenseEmptyArray(cx, nullptr, newKind);
} else {
gc::AllocKind allocKind = GuessObjectGCKind(0);
newKind = UseNewTypeForInitializer(cx, script, regs.pc, &JSObject::class_);
@ -2956,7 +2957,7 @@ BEGIN_CASE(JSOP_NEWARRAY)
unsigned count = GET_UINT24(regs.pc);
RootedObject &obj = rootObject0;
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))
goto error;
@ -3008,7 +3009,7 @@ BEGIN_CASE(JSOP_INITPROP)
if (JS_UNLIKELY(name == cx->names().proto)
? !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)) {
goto error;
}
@ -3078,12 +3079,13 @@ BEGIN_CASE(JSOP_SPREAD)
RootedValue &iterVal = rootValue0;
while (iter.next()) {
if (count == INT32_MAX) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL,
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr,
JSMSG_SPREAD_TOO_LARGE);
goto error;
}
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;
}
if (!iter.close())
@ -3295,7 +3297,7 @@ default:
{
char numBuf[12];
JS_snprintf(numBuf, sizeof numBuf, "%d", op);
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL,
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr,
JSMSG_BAD_BYTECODE, numBuf);
goto error;
}
@ -3503,7 +3505,7 @@ js::Lambda(JSContext *cx, HandleFunction fun, HandleObject parent)
{
RootedObject clone(cx, CloneFunctionObjectIfNotSingleton(cx, fun, parent, TenuredObject));
if (!clone)
return NULL;
return nullptr;
if (fun->isArrow()) {
// 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))
return NULL;
return nullptr;
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)
return NULL;
return nullptr;
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()) {
JSAutoByteString 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());
}
@ -3621,7 +3623,7 @@ js::DefFunOperation(JSContext *cx, HandleScript script, HandleObject scopeChain,
bool
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;
}

View File

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

View File

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

View File

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

View File

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

View File

@ -37,7 +37,7 @@ PropDesc::checkGetter(JSContext *cx)
{
if (hasGet_) {
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);
return false;
}
@ -50,7 +50,7 @@ PropDesc::checkSetter(JSContext *cx)
{
if (hasSet_) {
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);
return false;
}
@ -63,7 +63,7 @@ CheckArgCompartment(JSContext *cx, JSObject *obj, HandleValue v,
const char *methodname, const char *propname)
{
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);
return false;
}
@ -193,7 +193,7 @@ js::ObjectImpl::checkShapeConsistency()
MOZ_ASSERT(isNative());
Shape *shape = lastProperty();
Shape *prev = NULL;
Shape *prev = nullptr;
if (inDictionaryMode()) {
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,
JSDVG_IGNORE_STACK,
val, NullPtr(),
NULL, NULL));
nullptr, nullptr));
return false;
}
@ -517,7 +517,8 @@ js::ArrayBufferDelegate(JSContext *cx, Handle<ObjectImpl*> obj)
MOZ_ASSERT(obj->hasClass(&ArrayBufferObject::class_));
if (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);
return delegate;
}
@ -534,7 +535,7 @@ TypedElementsHeader<T>::defineElement(JSContext *cx, Handle<ObjectImpl*> obj,
RootedValue val(cx, ObjectValue(*obj));
js_ReportValueErrorFlags(cx, JSREPORT_ERROR, JSMSG_OBJECT_NOT_EXTENSIBLE,
JSDVG_IGNORE_STACK,
val, NullPtr(), NULL, NULL);
val, NullPtr(), nullptr, nullptr);
return false;
}
@ -573,7 +574,7 @@ js::GetOwnProperty(JSContext *cx, Handle<ObjectImpl*> obj, PropertyId pid_, unsi
Rooted<jsid> id(cx, pid.get().asId());
Rooted<JSObject*> robj(cx, static_cast<JSObject*>(obj.get()));
if (clasp->flags & JSCLASS_NEW_RESOLVE) {
Rooted<JSObject*> obj2(cx, NULL);
Rooted<JSObject*> obj2(cx, nullptr);
JSNewResolveOp op = reinterpret_cast<JSNewResolveOp>(resolve);
if (!op(cx, robj, id, resolveFlags, &obj2))
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
* 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
* 'slots' member is NULL.
* 'slots' member is nullptr.
*
* Elements are indexed via the 'elements' member. This member can point to
* either the shared emptyObjectElements singleton, into the inline value array
@ -1033,7 +1033,7 @@ class ObjectImpl : public gc::BarrieredCell<ObjectImpl>
Shape *
replaceWithNewEquivalentShape(ExclusiveContext *cx,
Shape *existingShape, Shape *newShape = NULL);
Shape *existingShape, Shape *newShape = nullptr);
enum GenerateShape {
GENERATE_NONE,
@ -1064,7 +1064,7 @@ class ObjectImpl : public gc::BarrieredCell<ObjectImpl>
if (start + length < fixed) {
*fixedStart = &fixedSlots()[start];
*fixedEnd = &fixedSlots()[start + length];
*slotsStart = *slotsEnd = NULL;
*slotsStart = *slotsEnd = nullptr;
} else {
uint32_t localCopy = fixed - start;
*fixedStart = &fixedSlots()[start];
@ -1073,7 +1073,7 @@ class ObjectImpl : public gc::BarrieredCell<ObjectImpl>
*slotsEnd = &slots[length - localCopy];
}
} else {
*fixedStart = *fixedEnd = NULL;
*fixedStart = *fixedEnd = nullptr;
*slotsStart = &slots[start - fixed];
*slotsEnd = &slots[start - fixed + length];
}
@ -1167,7 +1167,7 @@ class ObjectImpl : public gc::BarrieredCell<ObjectImpl>
return shape_;
}
bool generateOwnShape(ExclusiveContext *cx, js::Shape *newShape = NULL) {
bool generateOwnShape(ExclusiveContext *cx, js::Shape *newShape = nullptr) {
return replaceWithNewEquivalentShape(cx, lastProperty(), newShape);
}
@ -1220,10 +1220,10 @@ class ObjectImpl : public gc::BarrieredCell<ObjectImpl>
}
bool nativeContains(ExclusiveContext *cx, jsid id) {
return nativeLookup(cx, id) != NULL;
return nativeLookup(cx, id) != nullptr;
}
bool nativeContains(ExclusiveContext *cx, PropertyName* name) {
return nativeLookup(cx, name) != NULL;
return nativeLookup(cx, name) != nullptr;
}
bool nativeContains(ExclusiveContext *cx, Shape* shape) {
return nativeLookup(cx, shape->propid()) == shape;
@ -1242,7 +1242,7 @@ class ObjectImpl : public gc::BarrieredCell<ObjectImpl>
}
bool nativeContainsPure(jsid id) {
return nativeLookupPure(id) != NULL;
return nativeLookupPure(id) != nullptr;
}
bool nativeContainsPure(PropertyName* name) {
return nativeContainsPure(NameToId(name));

View File

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