mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 784739 - Switch from NULL to nullptr in js/src/ (4/9); r=ehsan
--HG-- extra : rebase_source : 26f4daad52a3a49995aee16669406ab551132f43
This commit is contained in:
parent
a4ed25f406
commit
94e0274ace
@ -506,7 +506,7 @@ ChunkPool::get(JSRuntime *rt)
|
||||
JS_ASSERT(!emptyCount);
|
||||
chunk = Chunk::allocate(rt);
|
||||
if (!chunk)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
JS_ASSERT(chunk->info.numArenasFreeCommitted == ArenasPerChunk);
|
||||
rt->gcNumArenasFreeCommitted += ArenasPerChunk;
|
||||
}
|
||||
@ -541,7 +541,7 @@ ChunkPool::expire(JSRuntime *rt, bool releaseAll)
|
||||
* without emptying the list, the older chunks will stay at the tail
|
||||
* and are more likely to reach the max age.
|
||||
*/
|
||||
Chunk *freeList = NULL;
|
||||
Chunk *freeList = nullptr;
|
||||
int freeChunkCount = 0;
|
||||
for (Chunk **chunkp = &emptyChunkListHead; *chunkp; ) {
|
||||
JS_ASSERT(emptyCount);
|
||||
@ -603,7 +603,7 @@ Chunk::allocate(JSRuntime *rt)
|
||||
#endif
|
||||
|
||||
if (!chunk)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
chunk->init(rt);
|
||||
rt->gcStats.count(gcstats::STAT_NEW_CHUNK);
|
||||
return chunk;
|
||||
@ -661,7 +661,7 @@ Chunk::init(JSRuntime *rt)
|
||||
arenas[i].aheader.setAsNotAllocated();
|
||||
arenas[i].aheader.next = (i + 1 < ArenasPerChunk)
|
||||
? &arenas[i + 1].aheader
|
||||
: NULL;
|
||||
: nullptr;
|
||||
}
|
||||
|
||||
/* The rest of info fields are initialized in PickChunk. */
|
||||
@ -707,8 +707,8 @@ Chunk::removeFromAvailableList()
|
||||
JS_ASSERT(info.next->info.prevp == &info.next);
|
||||
info.next->info.prevp = info.prevp;
|
||||
}
|
||||
info.prevp = NULL;
|
||||
info.next = NULL;
|
||||
info.prevp = nullptr;
|
||||
info.next = nullptr;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -771,7 +771,7 @@ Chunk::allocateArena(Zone *zone, AllocKind thingKind)
|
||||
|
||||
JSRuntime *rt = zone->runtimeFromAnyThread();
|
||||
if (!rt->isHeapMinorCollecting() && rt->gcBytes >= rt->gcMaxBytes)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
ArenaHeader *aheader = JS_LIKELY(info.numArenasFreeCommitted > 0)
|
||||
? fetchNextFreeArena(rt)
|
||||
@ -845,7 +845,7 @@ PickChunk(Zone *zone)
|
||||
|
||||
chunk = rt->gcChunkPool.get(rt);
|
||||
if (!chunk)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
rt->gcChunkAllocationSinceLastGC = true;
|
||||
|
||||
@ -857,11 +857,11 @@ PickChunk(Zone *zone)
|
||||
JS_ASSERT(!p);
|
||||
if (!rt->gcChunkSet.add(p, chunk)) {
|
||||
Chunk::release(rt, chunk);
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
chunk->info.prevp = NULL;
|
||||
chunk->info.next = NULL;
|
||||
chunk->info.prevp = nullptr;
|
||||
chunk->info.next = nullptr;
|
||||
chunk->addToAvailableList(zone);
|
||||
|
||||
return chunk;
|
||||
@ -1018,8 +1018,8 @@ js_FinishGC(JSRuntime *rt)
|
||||
|
||||
rt->zones.clear();
|
||||
|
||||
rt->gcSystemAvailableChunkListHead = NULL;
|
||||
rt->gcUserAvailableChunkListHead = NULL;
|
||||
rt->gcSystemAvailableChunkListHead = nullptr;
|
||||
rt->gcUserAvailableChunkListHead = nullptr;
|
||||
for (GCChunkSet::Range r(rt->gcChunkSet.all()); !r.empty(); r.popFront())
|
||||
Chunk::release(rt, r.front());
|
||||
rt->gcChunkSet.clear();
|
||||
@ -1098,7 +1098,7 @@ js::AddScriptRoot(JSContext *cx, JSScript **rp, const char *name)
|
||||
extern JS_FRIEND_API(bool)
|
||||
js_AddObjectRoot(JSRuntime *rt, JSObject **objp)
|
||||
{
|
||||
return AddRoot(rt, objp, NULL, JS_GC_ROOT_OBJECT_PTR);
|
||||
return AddRoot(rt, objp, nullptr, JS_GC_ROOT_OBJECT_PTR);
|
||||
}
|
||||
|
||||
extern JS_FRIEND_API(void)
|
||||
@ -1215,7 +1215,7 @@ ArenaLists::allocateFromArenaInline(Zone *zone, AllocKind thingKind)
|
||||
* a lock.
|
||||
*/
|
||||
|
||||
Chunk *chunk = NULL;
|
||||
Chunk *chunk = nullptr;
|
||||
|
||||
ArenaList *al = &arenaLists[thingKind];
|
||||
AutoLockGC maybeLock;
|
||||
@ -1237,7 +1237,7 @@ ArenaLists::allocateFromArenaInline(Zone *zone, AllocKind thingKind)
|
||||
* Let the caller to wait for the background allocation to
|
||||
* finish and restart the allocation attempt.
|
||||
*/
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
} else if (*bfs == BFS_JUST_FINISHED) {
|
||||
/* See comments before BackgroundFinalizeState definition. */
|
||||
@ -1281,7 +1281,7 @@ ArenaLists::allocateFromArenaInline(Zone *zone, AllocKind thingKind)
|
||||
maybeLock.lock(zone->runtimeFromAnyThread());
|
||||
chunk = PickChunk(zone);
|
||||
if (!chunk)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -1296,7 +1296,7 @@ ArenaLists::allocateFromArenaInline(Zone *zone, AllocKind thingKind)
|
||||
JS_ASSERT(!*al->cursor);
|
||||
ArenaHeader *aheader = chunk->allocateArena(zone, thingKind);
|
||||
if (!aheader)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
if (JS_UNLIKELY(zone->wasGCStarted())) {
|
||||
if (zone->needsBarrier()) {
|
||||
@ -1424,7 +1424,7 @@ ArenaLists::backgroundFinalize(FreeOp *fop, ArenaHeader *listHead, bool onBackgr
|
||||
else
|
||||
lists->backgroundFinalizeState[thingKind] = BFS_DONE;
|
||||
|
||||
lists->arenaListsToSweep[thingKind] = NULL;
|
||||
lists->arenaListsToSweep[thingKind] = nullptr;
|
||||
}
|
||||
|
||||
void
|
||||
@ -1509,7 +1509,7 @@ RunLastDitchGC(JSContext *cx, JS::Zone *zone, AllocKind thingKind)
|
||||
if (void *thing = zone->allocator.arenas.allocateFromFreeList(thingKind, thingSize))
|
||||
return thing;
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
template <AllowGC allowGC>
|
||||
@ -1553,7 +1553,7 @@ ArenaLists::refillFreeList(ThreadSafeContext *cx, AllocKind thingKind)
|
||||
}
|
||||
|
||||
if (!cx->allowGC() || !allowGC)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
/*
|
||||
* We failed to allocate. Run the GC if we haven't done it already.
|
||||
@ -1566,7 +1566,7 @@ ArenaLists::refillFreeList(ThreadSafeContext *cx, AllocKind thingKind)
|
||||
|
||||
JS_ASSERT(allowGC);
|
||||
js_ReportOutOfMemory(cx);
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
template void *
|
||||
@ -1586,12 +1586,12 @@ js::InitTracer(JSTracer *trc, JSRuntime *rt, JSTraceCallback callback)
|
||||
{
|
||||
trc->runtime = rt;
|
||||
trc->callback = callback;
|
||||
trc->debugPrinter = NULL;
|
||||
trc->debugPrintArg = NULL;
|
||||
trc->debugPrinter = nullptr;
|
||||
trc->debugPrintArg = nullptr;
|
||||
trc->debugPrintIndex = size_t(-1);
|
||||
trc->eagerlyTraceWeakMaps = TraceWeakMapValues;
|
||||
#ifdef JS_GC_ZEAL
|
||||
trc->realLocation = NULL;
|
||||
trc->realLocation = nullptr;
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -1641,11 +1641,11 @@ GCMarker::GCMarker(JSRuntime *rt)
|
||||
: stack(size_t(-1)),
|
||||
color(BLACK),
|
||||
started(false),
|
||||
unmarkedArenaStackTop(NULL),
|
||||
unmarkedArenaStackTop(nullptr),
|
||||
markLaterArenas(0),
|
||||
grayFailed(false)
|
||||
{
|
||||
InitTracer(this, rt, NULL);
|
||||
InitTracer(this, rt, nullptr);
|
||||
}
|
||||
|
||||
bool
|
||||
@ -1834,7 +1834,7 @@ void
|
||||
GCMarker::endBufferingGrayRoots()
|
||||
{
|
||||
JS_ASSERT(callback == GrayCallback);
|
||||
callback = NULL;
|
||||
callback = nullptr;
|
||||
JS_ASSERT(IS_GC_MARKING_TRACER(this));
|
||||
}
|
||||
|
||||
@ -2189,7 +2189,7 @@ SweepBackgroundThings(JSRuntime* rt, bool onBackgroundThread)
|
||||
}
|
||||
}
|
||||
|
||||
rt->gcSweepingZones = NULL;
|
||||
rt->gcSweepingZones = nullptr;
|
||||
}
|
||||
|
||||
#ifdef JS_THREADSAFE
|
||||
@ -2257,7 +2257,7 @@ GCHelperThread::finish()
|
||||
|
||||
|
||||
#ifdef JS_THREADSAFE
|
||||
PRThread *join = NULL;
|
||||
PRThread *join = nullptr;
|
||||
{
|
||||
AutoLockGC lock(rt);
|
||||
if (thread && state != SHUTDOWN) {
|
||||
@ -2482,7 +2482,7 @@ GCHelperThread::replenishAndFreeLater(void *ptr)
|
||||
break;
|
||||
freeCursor = (void **) js_malloc(FREE_ARRAY_SIZE);
|
||||
if (!freeCursor) {
|
||||
freeCursorEnd = NULL;
|
||||
freeCursorEnd = nullptr;
|
||||
break;
|
||||
}
|
||||
freeCursorEnd = freeCursor + FREE_ARRAY_LENGTH;
|
||||
@ -2506,7 +2506,7 @@ GCHelperThread::doSweep()
|
||||
if (freeCursor) {
|
||||
void **array = freeCursorEnd - FREE_ARRAY_LENGTH;
|
||||
freeElementsAndArray(array, freeCursor);
|
||||
freeCursor = freeCursorEnd = NULL;
|
||||
freeCursor = freeCursorEnd = nullptr;
|
||||
} else {
|
||||
JS_ASSERT(!freeCursorEnd);
|
||||
}
|
||||
@ -2730,7 +2730,7 @@ CompartmentOfCell(Cell *thing, JSGCTraceKind kind)
|
||||
else if (kind == JSTRACE_SCRIPT)
|
||||
return static_cast<JSScript *>(thing)->compartment();
|
||||
else
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
static void
|
||||
@ -3267,7 +3267,7 @@ FinishMarkingValidation(JSRuntime *rt)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
js_delete(rt->gcMarkingValidator);
|
||||
rt->gcMarkingValidator = NULL;
|
||||
rt->gcMarkingValidator = nullptr;
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -3415,7 +3415,7 @@ GetNextZoneGroup(JSRuntime *rt)
|
||||
}
|
||||
|
||||
rt->gcAbortSweepAfterCurrentGroup = false;
|
||||
rt->gcCurrentZoneGroup = NULL;
|
||||
rt->gcCurrentZoneGroup = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@ -3559,7 +3559,7 @@ MarkIncomingCrossCompartmentPointers(JSRuntime *rt, const uint32_t color)
|
||||
}
|
||||
|
||||
if (unlinkList)
|
||||
c->gcIncomingGrayPointers = NULL;
|
||||
c->gcIncomingGrayPointers = nullptr;
|
||||
}
|
||||
|
||||
SliceBudget budget;
|
||||
@ -3605,7 +3605,7 @@ ResetGrayList(JSCompartment *comp)
|
||||
JSObject *src = comp->gcIncomingGrayPointers;
|
||||
while (src)
|
||||
src = NextIncomingCrossCompartmentPointer(src, true);
|
||||
comp->gcIncomingGrayPointers = NULL;
|
||||
comp->gcIncomingGrayPointers = nullptr;
|
||||
}
|
||||
|
||||
void
|
||||
@ -4805,12 +4805,12 @@ js::NewCompartment(JSContext *cx, Zone *zone, JSPrincipals *principals,
|
||||
if (!zone) {
|
||||
zone = cx->new_<Zone>(rt);
|
||||
if (!zone)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
zoneHolder.reset(zone);
|
||||
|
||||
if (!zone->init(cx))
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
zone->setGCLastBytes(8192, GC_NORMAL);
|
||||
|
||||
@ -4820,7 +4820,7 @@ js::NewCompartment(JSContext *cx, Zone *zone, JSPrincipals *principals,
|
||||
|
||||
ScopedJSDeletePtr<JSCompartment> compartment(cx->new_<JSCompartment>(zone, options));
|
||||
if (!compartment || !compartment->init(cx))
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
// Set up the principals.
|
||||
JS_SetCompartmentPrincipals(compartment, principals);
|
||||
@ -4829,12 +4829,12 @@ js::NewCompartment(JSContext *cx, Zone *zone, JSPrincipals *principals,
|
||||
|
||||
if (!zone->compartments.append(compartment.get())) {
|
||||
js_ReportOutOfMemory(cx);
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (zoneHolder && !rt->zones.append(zone)) {
|
||||
js_ReportOutOfMemory(cx);
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
zoneHolder.forget();
|
||||
@ -5049,7 +5049,7 @@ ReleaseScriptCounts(FreeOp *fop)
|
||||
vec[i].scriptCounts.destroy(fop);
|
||||
|
||||
fop->delete_(rt->scriptAndCountsVector);
|
||||
rt->scriptAndCountsVector = NULL;
|
||||
rt->scriptAndCountsVector = nullptr;
|
||||
}
|
||||
|
||||
JS_FRIEND_API(void)
|
||||
@ -5158,10 +5158,10 @@ ArenaLists::adoptArenas(JSRuntime *rt, ArenaLists *fromArenaLists)
|
||||
|
||||
ArenaList *fromList = &fromArenaLists->arenaLists[thingKind];
|
||||
ArenaList *toList = &arenaLists[thingKind];
|
||||
while (fromList->head != NULL) {
|
||||
while (fromList->head != nullptr) {
|
||||
ArenaHeader *fromHeader = fromList->head;
|
||||
fromList->head = fromHeader->next;
|
||||
fromHeader->next = NULL;
|
||||
fromHeader->next = nullptr;
|
||||
|
||||
toList->insert(fromHeader);
|
||||
}
|
||||
@ -5175,7 +5175,7 @@ ArenaLists::containsArena(JSRuntime *rt, ArenaHeader *needle)
|
||||
AutoLockGC lock(rt);
|
||||
size_t allocKind = needle->getAllocKind();
|
||||
for (ArenaHeader *aheader = arenaLists[allocKind].head;
|
||||
aheader != NULL;
|
||||
aheader != nullptr;
|
||||
aheader = aheader->next)
|
||||
{
|
||||
if (aheader == needle)
|
||||
|
@ -70,7 +70,7 @@ class ChunkPool {
|
||||
|
||||
public:
|
||||
ChunkPool()
|
||||
: emptyChunkListHead(NULL),
|
||||
: emptyChunkListHead(nullptr),
|
||||
emptyCount(0) { }
|
||||
|
||||
size_t getEmptyCount() const {
|
||||
@ -359,7 +359,7 @@ struct ArenaList {
|
||||
}
|
||||
|
||||
void clear() {
|
||||
head = NULL;
|
||||
head = nullptr;
|
||||
cursor = &head;
|
||||
}
|
||||
|
||||
@ -419,8 +419,8 @@ class ArenaLists
|
||||
for (size_t i = 0; i != FINALIZE_LIMIT; ++i)
|
||||
backgroundFinalizeState[i] = BFS_DONE;
|
||||
for (size_t i = 0; i != FINALIZE_LIMIT; ++i)
|
||||
arenaListsToSweep[i] = NULL;
|
||||
gcShapeArenasToSweep = NULL;
|
||||
arenaListsToSweep[i] = nullptr;
|
||||
gcShapeArenasToSweep = nullptr;
|
||||
}
|
||||
|
||||
~ArenaLists() {
|
||||
@ -817,14 +817,14 @@ class GCHelperThread {
|
||||
public:
|
||||
GCHelperThread(JSRuntime *rt)
|
||||
: rt(rt),
|
||||
thread(NULL),
|
||||
wakeup(NULL),
|
||||
done(NULL),
|
||||
thread(nullptr),
|
||||
wakeup(nullptr),
|
||||
done(nullptr),
|
||||
state(IDLE),
|
||||
sweepFlag(false),
|
||||
shrinkFlag(false),
|
||||
freeCursor(NULL),
|
||||
freeCursorEnd(NULL),
|
||||
freeCursor(nullptr),
|
||||
freeCursorEnd(nullptr),
|
||||
backgroundAllocation(true)
|
||||
{ }
|
||||
|
||||
@ -915,11 +915,11 @@ struct MarkStack {
|
||||
size_t sizeLimit;
|
||||
|
||||
MarkStack(size_t sizeLimit)
|
||||
: stack(NULL),
|
||||
tos(NULL),
|
||||
limit(NULL),
|
||||
ballast(NULL),
|
||||
ballastLimit(NULL),
|
||||
: stack(nullptr),
|
||||
tos(nullptr),
|
||||
limit(nullptr),
|
||||
ballast(nullptr),
|
||||
ballastLimit(nullptr),
|
||||
sizeLimit(sizeLimit) { }
|
||||
|
||||
~MarkStack() {
|
||||
@ -1310,7 +1310,7 @@ js_FinalizeStringRT(JSRuntime *rt, JSString *str);
|
||||
* Macro to test if a traversal is the marking phase of the GC.
|
||||
*/
|
||||
#define IS_GC_MARKING_TRACER(trc) \
|
||||
((trc)->callback == NULL || (trc)->callback == GCMarker::GrayCallback)
|
||||
((trc)->callback == nullptr || (trc)->callback == GCMarker::GrayCallback)
|
||||
|
||||
namespace js {
|
||||
|
||||
|
@ -118,13 +118,13 @@ class ArenaIter
|
||||
}
|
||||
|
||||
void init() {
|
||||
aheader = NULL;
|
||||
remainingHeader = NULL;
|
||||
aheader = nullptr;
|
||||
remainingHeader = nullptr;
|
||||
}
|
||||
|
||||
void init(ArenaHeader *aheaderArg) {
|
||||
aheader = aheaderArg;
|
||||
remainingHeader = NULL;
|
||||
remainingHeader = nullptr;
|
||||
}
|
||||
|
||||
void init(JS::Zone *zone, AllocKind kind) {
|
||||
@ -132,7 +132,7 @@ class ArenaIter
|
||||
remainingHeader = zone->allocator.arenas.getFirstArenaToSweep(kind);
|
||||
if (!aheader) {
|
||||
aheader = remainingHeader;
|
||||
remainingHeader = NULL;
|
||||
remainingHeader = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@ -148,7 +148,7 @@ class ArenaIter
|
||||
aheader = aheader->next;
|
||||
if (!aheader) {
|
||||
aheader = remainingHeader;
|
||||
remainingHeader = NULL;
|
||||
remainingHeader = nullptr;
|
||||
}
|
||||
}
|
||||
};
|
||||
@ -214,7 +214,7 @@ class CellIterImpl
|
||||
break;
|
||||
}
|
||||
if (aiter.done()) {
|
||||
cell = NULL;
|
||||
cell = nullptr;
|
||||
return;
|
||||
}
|
||||
ArenaHeader *aheader = aiter.get();
|
||||
@ -266,7 +266,7 @@ class CellIter : public CellIterImpl
|
||||
gc::FinishBackgroundFinalize(zone->runtimeFromMainThread());
|
||||
}
|
||||
if (lists->isSynchronizedFreeList(kind)) {
|
||||
lists = NULL;
|
||||
lists = nullptr;
|
||||
} else {
|
||||
JS_ASSERT(!zone->runtimeFromMainThread()->isHeapBusy());
|
||||
lists->copyFreeListToArena(kind);
|
||||
@ -351,7 +351,7 @@ typedef CompartmentsIterT<GCZoneGroupIter> GCCompartmentGroupIter;
|
||||
#ifdef JSGC_GENERATIONAL
|
||||
/*
|
||||
* Attempt to allocate a new GC thing out of the nursery. If there is not enough
|
||||
* room in the nursery or there is an OOM, this method will return NULL.
|
||||
* room in the nursery or there is an OOM, this method will return nullptr.
|
||||
*/
|
||||
template <typename T, AllowGC allowGC>
|
||||
inline T *
|
||||
@ -376,7 +376,7 @@ TryNewNurseryGCThing(ThreadSafeContext *cxArg, size_t thingSize)
|
||||
return t;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
#endif /* JSGC_GENERATIONAL */
|
||||
|
||||
|
@ -398,7 +398,7 @@ TypeSet::add(JSContext *cx, TypeConstraint *constraint, bool callExisting)
|
||||
InferSpewColor(constraint), constraint, InferSpewColorReset(),
|
||||
constraint->kind());
|
||||
|
||||
JS_ASSERT(constraint->next == NULL);
|
||||
JS_ASSERT(constraint->next == nullptr);
|
||||
constraint->next = constraintList;
|
||||
constraintList = constraint;
|
||||
|
||||
@ -463,14 +463,14 @@ TypeSet::clone(LifoAlloc *alloc) const
|
||||
if (capacity) {
|
||||
newSet = alloc->newArray<TypeObjectKey*>(capacity);
|
||||
if (!newSet)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
PodCopy(newSet, objectSet, capacity);
|
||||
}
|
||||
|
||||
uint32_t newFlags = flags & ~(TYPE_FLAG_STACK_SET | TYPE_FLAG_HEAP_SET);
|
||||
TemporaryTypeSet *res = alloc->new_<TemporaryTypeSet>(newFlags, capacity ? newSet : objectSet);
|
||||
if (!res)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
return res;
|
||||
}
|
||||
@ -501,20 +501,20 @@ TemporaryTypeSet::addObject(TypeObjectKey *key, LifoAlloc *alloc)
|
||||
TypeSet::unionSets(TypeSet *a, TypeSet *b, LifoAlloc *alloc)
|
||||
{
|
||||
TemporaryTypeSet *res = alloc->new_<TemporaryTypeSet>(a->baseFlags() | b->baseFlags(),
|
||||
static_cast<TypeObjectKey**>(NULL));
|
||||
static_cast<TypeObjectKey**>(nullptr));
|
||||
if (!res)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
if (!res->unknownObject()) {
|
||||
for (size_t i = 0; i < a->getObjectCount() && !res->unknownObject(); i++) {
|
||||
TypeObjectKey *key = a->getObject(i);
|
||||
if (key && !res->addObject(key, alloc))
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
for (size_t i = 0; i < b->getObjectCount() && !res->unknownObject(); i++) {
|
||||
TypeObjectKey *key = b->getObject(i);
|
||||
if (key && !res->addObject(key, alloc))
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@ -674,7 +674,7 @@ TypeObjectKey::newScript()
|
||||
if (addendum && addendum->isNewScript())
|
||||
return addendum->asNewScript();
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool
|
||||
@ -883,7 +883,7 @@ JSObject *
|
||||
TemporaryTypeSet::getSingleton()
|
||||
{
|
||||
if (baseFlags() != 0 || baseObjectCount() != 1)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
return getSingleObject(0);
|
||||
}
|
||||
@ -892,7 +892,7 @@ JSObject *
|
||||
HeapTypeSetKey::singleton(CompilerConstraintList *constraints)
|
||||
{
|
||||
if (actualTypes->baseFlags() != 0 || actualTypes->getObjectCount() != 1)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
JSObject *obj = actualTypes->getSingleObject(0);
|
||||
|
||||
@ -1190,9 +1190,9 @@ const Class *
|
||||
TemporaryTypeSet::getKnownClass()
|
||||
{
|
||||
if (unknownObject())
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
const Class *clasp = NULL;
|
||||
const Class *clasp = nullptr;
|
||||
unsigned count = getObjectCount();
|
||||
|
||||
for (unsigned i = 0; i < count; i++) {
|
||||
@ -1201,7 +1201,7 @@ TemporaryTypeSet::getKnownClass()
|
||||
continue;
|
||||
|
||||
if (clasp && clasp != nclasp)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
clasp = nclasp;
|
||||
}
|
||||
|
||||
@ -1279,9 +1279,9 @@ JSObject *
|
||||
TemporaryTypeSet::getCommonPrototype()
|
||||
{
|
||||
if (unknownObject())
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
JSObject *proto = NULL;
|
||||
JSObject *proto = nullptr;
|
||||
unsigned count = getObjectCount();
|
||||
|
||||
for (unsigned i = 0; i < count; i++) {
|
||||
@ -1295,10 +1295,10 @@ TemporaryTypeSet::getCommonPrototype()
|
||||
|
||||
if (proto) {
|
||||
if (nproto != proto)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
} else {
|
||||
if (!nproto.isObject())
|
||||
return NULL;
|
||||
return nullptr;
|
||||
proto = nproto.toObject();
|
||||
}
|
||||
}
|
||||
@ -1398,7 +1398,7 @@ TypeCompartment::newTypeObject(ExclusiveContext *cx, const Class *clasp, Handle<
|
||||
TypeObject *object = gc::NewGCThing<TypeObject, CanGC>(cx, gc::FINALIZE_TYPE_OBJECT,
|
||||
sizeof(TypeObject), gc::TenuredHeap);
|
||||
if (!object)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
new(object) TypeObject(clasp, proto, unknown);
|
||||
|
||||
if (!cx->typeInferenceEnabled())
|
||||
@ -1414,7 +1414,7 @@ PreviousOpcode(HandleScript script, jsbytecode *pc)
|
||||
JS_ASSERT(analysis->maybeCode(pc));
|
||||
|
||||
if (pc == script->code)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
for (pc--;; pc--) {
|
||||
if (analysis->maybeCode(pc))
|
||||
@ -1426,16 +1426,16 @@ PreviousOpcode(HandleScript script, jsbytecode *pc)
|
||||
|
||||
/*
|
||||
* If pc is an array initializer within an outer multidimensional array
|
||||
* initializer, find the opcode of the previous newarray. NULL otherwise.
|
||||
* initializer, find the opcode of the previous newarray. nullptr otherwise.
|
||||
*/
|
||||
static inline jsbytecode *
|
||||
FindPreviousInnerInitializer(HandleScript script, jsbytecode *initpc)
|
||||
{
|
||||
if (!script->hasAnalysis())
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
if (!script->analysis()->maybeCode(initpc))
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
/*
|
||||
* Pattern match the following bytecode, which will appear between
|
||||
@ -1447,15 +1447,15 @@ FindPreviousInnerInitializer(HandleScript script, jsbytecode *initpc)
|
||||
*/
|
||||
|
||||
if (*initpc != JSOP_NEWARRAY)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
jsbytecode *last = PreviousOpcode(script, initpc);
|
||||
if (!last || *last != JSOP_INITELEM_ARRAY)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
last = PreviousOpcode(script, last);
|
||||
if (!last || *last != JSOP_ENDINIT)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
/*
|
||||
* Find the start of the previous initializer. Keep track of initializer
|
||||
@ -1477,7 +1477,7 @@ FindPreviousInnerInitializer(HandleScript script, jsbytecode *initpc)
|
||||
}
|
||||
|
||||
if (!previnit || *previnit != JSOP_NEWARRAY)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
return previnit;
|
||||
}
|
||||
@ -1491,14 +1491,14 @@ TypeCompartment::addAllocationSiteTypeObject(JSContext *cx, AllocationSiteKey ke
|
||||
allocationSiteTable = cx->new_<AllocationSiteTable>();
|
||||
if (!allocationSiteTable || !allocationSiteTable->init()) {
|
||||
cx->compartment()->types.setPendingNukeTypes(cx);
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
AllocationSiteTable::AddPtr p = allocationSiteTable->lookupForAdd(key);
|
||||
JS_ASSERT(!p);
|
||||
|
||||
TypeObject *res = NULL;
|
||||
TypeObject *res = nullptr;
|
||||
|
||||
/*
|
||||
* If this is an array initializer nested in another array initializer,
|
||||
@ -1521,14 +1521,14 @@ TypeCompartment::addAllocationSiteTypeObject(JSContext *cx, AllocationSiteKey ke
|
||||
|
||||
if (!res) {
|
||||
RootedObject proto(cx);
|
||||
if (!js_GetClassPrototype(cx, key.kind, &proto, NULL))
|
||||
return NULL;
|
||||
if (!js_GetClassPrototype(cx, key.kind, &proto, nullptr))
|
||||
return nullptr;
|
||||
|
||||
Rooted<TaggedProto> tagged(cx, TaggedProto(proto));
|
||||
res = newTypeObject(cx, GetClassForProtoKey(key.kind), tagged);
|
||||
if (!res) {
|
||||
cx->compartment()->types.setPendingNukeTypes(cx);
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
key.script = keyScript;
|
||||
}
|
||||
@ -1542,12 +1542,12 @@ TypeCompartment::addAllocationSiteTypeObject(JSContext *cx, AllocationSiteKey ke
|
||||
RootedObject baseobj(cx, key.script->getObject(GET_UINT32_INDEX(pc)));
|
||||
|
||||
if (!res->addDefiniteProperties(cx, baseobj))
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (!allocationSiteTable->add(p, key, res)) {
|
||||
cx->compartment()->types.setPendingNukeTypes(cx);
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return res;
|
||||
@ -1733,7 +1733,7 @@ TypeCompartment::processPendingRecompiles(FreeOp *fop)
|
||||
|
||||
/* Steal the list of scripts to recompile, else we will try to recursively recompile them. */
|
||||
Vector<RecompileInfo> *pending = pendingRecompiles;
|
||||
pendingRecompiles = NULL;
|
||||
pendingRecompiles = nullptr;
|
||||
|
||||
JS_ASSERT(!pending->empty());
|
||||
|
||||
@ -1780,7 +1780,7 @@ TypeZone::nukeTypes(FreeOp *fop)
|
||||
for (CompartmentsInZoneIter comp(zone()); !comp.done(); comp.next()) {
|
||||
if (comp->types.pendingRecompiles) {
|
||||
fop->free_(comp->types.pendingRecompiles);
|
||||
comp->types.pendingRecompiles = NULL;
|
||||
comp->types.pendingRecompiles = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1911,7 +1911,7 @@ TypeCompartment::print(JSContext *cx, bool force)
|
||||
gc::AutoSuppressGC suppressGC(cx);
|
||||
|
||||
JSCompartment *compartment = this->compartment();
|
||||
AutoEnterAnalysis enter(NULL, compartment);
|
||||
AutoEnterAnalysis enter(nullptr, compartment);
|
||||
|
||||
if (!force && !InferSpewActive(ISpewResult))
|
||||
return;
|
||||
@ -1973,7 +1973,7 @@ struct types::ArrayTableKey : public DefaultHasher<types::ArrayTableKey>
|
||||
JSObject *proto;
|
||||
|
||||
ArrayTableKey()
|
||||
: type(Type::UndefinedType()), proto(NULL)
|
||||
: type(Type::UndefinedType()), proto(nullptr)
|
||||
{}
|
||||
|
||||
static inline uint32_t hash(const ArrayTableKey &v) {
|
||||
@ -1992,7 +1992,7 @@ TypeCompartment::setTypeToHomogenousArray(ExclusiveContext *cx,
|
||||
if (!arrayTypeTable) {
|
||||
arrayTypeTable = cx->new_<ArrayTypeTable>();
|
||||
if (!arrayTypeTable || !arrayTypeTable->init()) {
|
||||
arrayTypeTable = NULL;
|
||||
arrayTypeTable = nullptr;
|
||||
cx->compartment()->types.setPendingNukeTypes(cx);
|
||||
return;
|
||||
}
|
||||
@ -2159,7 +2159,7 @@ TypeCompartment::fixObjectType(ExclusiveContext *cx, JSObject *obj)
|
||||
if (!objectTypeTable) {
|
||||
objectTypeTable = cx->new_<ObjectTypeTable>();
|
||||
if (!objectTypeTable || !objectTypeTable->init()) {
|
||||
objectTypeTable = NULL;
|
||||
objectTypeTable = nullptr;
|
||||
cx->compartment()->types.setPendingNukeTypes(cx);
|
||||
return;
|
||||
}
|
||||
@ -2258,9 +2258,9 @@ TypeCompartment::newTypedObject(JSContext *cx, IdValuePair *properties, size_t n
|
||||
if (!objectTypeTable) {
|
||||
objectTypeTable = cx->new_<ObjectTypeTable>();
|
||||
if (!objectTypeTable || !objectTypeTable->init()) {
|
||||
objectTypeTable = NULL;
|
||||
objectTypeTable = nullptr;
|
||||
cx->compartment()->types.setPendingNukeTypes(cx);
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@ -2279,7 +2279,7 @@ TypeCompartment::newTypedObject(JSContext *cx, IdValuePair *properties, size_t n
|
||||
* ignores objects with dense indexes.
|
||||
*/
|
||||
if (!nproperties || nproperties >= PropertyTree::MAX_HEIGHT)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
gc::AllocKind allocKind = gc::GetGCObjectKind(nproperties);
|
||||
size_t nfixed = gc::GetGCKindSlots(allocKind, &JSObject::class_);
|
||||
@ -2288,19 +2288,19 @@ TypeCompartment::newTypedObject(JSContext *cx, IdValuePair *properties, size_t n
|
||||
ObjectTypeTable::AddPtr p = objectTypeTable->lookupForAdd(lookup);
|
||||
|
||||
if (!p)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
RootedObject obj(cx, NewBuiltinClassInstance(cx, &JSObject::class_, allocKind));
|
||||
if (!obj) {
|
||||
cx->clearPendingException();
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
JS_ASSERT(obj->getProto() == p->value.object->proto);
|
||||
|
||||
RootedShape shape(cx, p->value.shape);
|
||||
if (!JSObject::setLastProperty(cx, obj, shape)) {
|
||||
cx->clearPendingException();
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
UpdateObjectTableEntryTypes(cx, p->value, properties, nproperties);
|
||||
@ -2622,9 +2622,9 @@ TypeObject::clearAddendum(ExclusiveContext *cx)
|
||||
break;
|
||||
}
|
||||
|
||||
/* We NULL out addendum *before* freeing it so the write barrier works. */
|
||||
/* We nullptr out addendum *before* freeing it so the write barrier works. */
|
||||
TypeObjectAddendum *savedAddendum = addendum;
|
||||
addendum = NULL;
|
||||
addendum = nullptr;
|
||||
js_free(savedAddendum);
|
||||
|
||||
markStateChange(cx);
|
||||
@ -3230,7 +3230,7 @@ JSScript::makeAnalysis(JSContext *cx)
|
||||
self->types->analysis->analyzeBytecode(cx);
|
||||
|
||||
if (self->types->analysis->OOM()) {
|
||||
self->types->analysis = NULL;
|
||||
self->types->analysis = nullptr;
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -3276,7 +3276,7 @@ JSObject::shouldSplicePrototype(JSContext *cx)
|
||||
* If inference is disabled we cannot determine from the object whether it
|
||||
* has had its __proto__ set after creation.
|
||||
*/
|
||||
if (getProto() != NULL)
|
||||
if (getProto() != nullptr)
|
||||
return false;
|
||||
return !cx->typeInferenceEnabled() || hasSingletonType();
|
||||
}
|
||||
@ -3306,7 +3306,7 @@ JSObject::splicePrototype(JSContext *cx, const Class *clasp, Handle<TaggedProto>
|
||||
Rooted<TypeObject*> type(cx, self->getType(cx));
|
||||
if (!type)
|
||||
return false;
|
||||
Rooted<TypeObject*> protoType(cx, NULL);
|
||||
Rooted<TypeObject*> protoType(cx, nullptr);
|
||||
if (proto.isObject()) {
|
||||
protoType = proto.toObject()->getType(cx);
|
||||
if (!protoType)
|
||||
@ -3337,14 +3337,14 @@ JSObject::makeLazyType(JSContext *cx, HandleObject obj)
|
||||
if (obj->is<JSFunction>() && obj->as<JSFunction>().isInterpretedLazy()) {
|
||||
RootedFunction fun(cx, &obj->as<JSFunction>());
|
||||
if (!fun->getOrCreateScript(cx))
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
Rooted<TaggedProto> proto(cx, obj->getTaggedProto());
|
||||
TypeObject *type = cx->compartment()->types.newTypeObject(cx, obj->getClass(), proto);
|
||||
if (!type) {
|
||||
if (cx->typeInferenceEnabled())
|
||||
cx->compartment()->types.setPendingNukeTypes(cx);
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (!cx->typeInferenceEnabled()) {
|
||||
@ -3473,7 +3473,7 @@ ExclusiveContext::getNewType(const Class *clasp, TaggedProto proto_, JSFunction
|
||||
TypeObjectSet &newTypeObjects = compartment_->newTypeObjects;
|
||||
|
||||
if (!newTypeObjects.initialized() && !newTypeObjects.init())
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
TypeObjectSet::AddPtr p = newTypeObjects.lookupForAdd(TypeObjectSet::Lookup(clasp, proto_));
|
||||
SkipRoot skipHash(this, &p); /* Prevent the hash from being poisoned. */
|
||||
@ -3504,7 +3504,7 @@ ExclusiveContext::getNewType(const Class *clasp, TaggedProto proto_, JSFunction
|
||||
RootedFunction fun(this, fun_);
|
||||
|
||||
if (proto.isObject() && !proto.toObject()->setDelegate(this))
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
bool markUnknown =
|
||||
proto.isObject()
|
||||
@ -3513,7 +3513,7 @@ ExclusiveContext::getNewType(const Class *clasp, TaggedProto proto_, JSFunction
|
||||
|
||||
RootedTypeObject type(this, compartment_->types.newTypeObject(this, clasp, proto, markUnknown));
|
||||
if (!type)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
/*
|
||||
* If a GC has occured, then the hash we calculated may be invalid, as it
|
||||
@ -3524,7 +3524,7 @@ ExclusiveContext::getNewType(const Class *clasp, TaggedProto proto_, JSFunction
|
||||
gcHappened ? newTypeObjects.putNew(TypeObjectSet::Lookup(clasp, proto), type.get())
|
||||
: newTypeObjects.relookupOrAdd(p, TypeObjectSet::Lookup(clasp, proto), type.get());
|
||||
if (!added)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
#ifdef JSGC_GENERATIONAL
|
||||
if (proto.isObject() && hasNursery() && nursery().isInside(proto.toObject())) {
|
||||
@ -3586,7 +3586,7 @@ ExclusiveContext::getLazyType(const Class *clasp, TaggedProto proto)
|
||||
TypeObjectSet &table = compartment()->lazyTypeObjects;
|
||||
|
||||
if (!table.initialized() && !table.init())
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
TypeObjectSet::AddPtr p = table.lookupForAdd(TypeObjectSet::Lookup(clasp, proto));
|
||||
if (p) {
|
||||
@ -3599,10 +3599,10 @@ ExclusiveContext::getLazyType(const Class *clasp, TaggedProto proto)
|
||||
Rooted<TaggedProto> protoRoot(this, proto);
|
||||
TypeObject *type = compartment()->types.newTypeObject(this, clasp, protoRoot, false);
|
||||
if (!type)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
if (!table.relookupOrAdd(p, TypeObjectSet::Lookup(clasp, protoRoot), type))
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
type->singleton = (JSObject *) TypeObject::LAZY_SINGLETON;
|
||||
|
||||
@ -3645,20 +3645,20 @@ TypeSet::sweep(Zone *zone)
|
||||
} else if (objectCount == 1) {
|
||||
TypeObjectKey *object = (TypeObjectKey *) objectSet;
|
||||
if (IsAboutToBeFinalized(object)) {
|
||||
objectSet = NULL;
|
||||
objectSet = nullptr;
|
||||
setBaseObjectCount(0);
|
||||
}
|
||||
}
|
||||
|
||||
/* All constraints are wiped out on each GC. */
|
||||
constraintList = NULL;
|
||||
constraintList = nullptr;
|
||||
}
|
||||
|
||||
inline void
|
||||
TypeObject::clearProperties()
|
||||
{
|
||||
setBasePropertyCount(0);
|
||||
propertySet = NULL;
|
||||
propertySet = nullptr;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -3761,7 +3761,7 @@ TypeCompartment::sweep(FreeOp *fop)
|
||||
JS_ASSERT(key.type.isUnknown() || !key.type.isSingleObject());
|
||||
|
||||
bool remove = false;
|
||||
TypeObject *typeObject = NULL;
|
||||
TypeObject *typeObject = nullptr;
|
||||
if (!key.type.isUnknown() && key.type.isTypeObject()) {
|
||||
typeObject = key.type.typeObject();
|
||||
if (IsTypeObjectAboutToBeFinalized(&typeObject))
|
||||
@ -3799,7 +3799,7 @@ TypeCompartment::sweep(FreeOp *fop)
|
||||
JS_ASSERT(AtomToId((JSAtom *)str) == key.properties[i]);
|
||||
}
|
||||
JS_ASSERT(!entry.types[i].isSingleObject());
|
||||
TypeObject *typeObject = NULL;
|
||||
TypeObject *typeObject = nullptr;
|
||||
if (entry.types[i].isTypeObject()) {
|
||||
typeObject = entry.types[i].typeObject();
|
||||
if (IsTypeObjectAboutToBeFinalized(&typeObject))
|
||||
@ -3836,7 +3836,7 @@ TypeCompartment::sweep(FreeOp *fop)
|
||||
if (pendingArray)
|
||||
fop->free_(pendingArray);
|
||||
|
||||
pendingArray = NULL;
|
||||
pendingArray = nullptr;
|
||||
pendingCapacity = 0;
|
||||
}
|
||||
|
||||
@ -3866,13 +3866,13 @@ TypeCompartment::clearCompilerOutputs(FreeOp *fop)
|
||||
{
|
||||
if (constrainedOutputs) {
|
||||
fop->delete_(constrainedOutputs);
|
||||
constrainedOutputs = NULL;
|
||||
constrainedOutputs = nullptr;
|
||||
}
|
||||
|
||||
if (pendingRecompiles) {
|
||||
JS_ASSERT(pendingRecompiles->length() == 0);
|
||||
fop->delete_(pendingRecompiles);
|
||||
pendingRecompiles = NULL;
|
||||
pendingRecompiles = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@ -3979,7 +3979,10 @@ TypeCompartment::addSizeOfExcludingThis(mozilla::MallocSizeOf mallocSizeOf,
|
||||
/* Pending arrays are cleared on GC along with the analysis pool. */
|
||||
*pendingArrays += mallocSizeOf(pendingArray);
|
||||
|
||||
/* TypeCompartment::pendingRecompiles is non-NULL only while inference code is running. */
|
||||
/*
|
||||
* TypeCompartment::pendingRecompiles is non-nullptr only while inference
|
||||
* code is running.
|
||||
*/
|
||||
JS_ASSERT(!pendingRecompiles);
|
||||
|
||||
if (allocationSiteTable)
|
||||
@ -4061,7 +4064,7 @@ TypeZone::sweep(FreeOp *fop, bool releaseTypes)
|
||||
|
||||
if (releaseTypes) {
|
||||
script->types->destroy();
|
||||
script->types = NULL;
|
||||
script->types = nullptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -4104,7 +4107,7 @@ TypeScript::printTypes(JSContext *cx, HandleScript script) const
|
||||
if (!bytecodeMap)
|
||||
return;
|
||||
|
||||
AutoEnterAnalysis enter(NULL, script->compartment());
|
||||
AutoEnterAnalysis enter(nullptr, script->compartment());
|
||||
|
||||
if (script->function())
|
||||
fprintf(stderr, "Function");
|
||||
@ -4116,7 +4119,7 @@ TypeScript::printTypes(JSContext *cx, HandleScript script) const
|
||||
|
||||
if (script->function()) {
|
||||
if (js::PropertyName *name = script->function()->name()) {
|
||||
const jschar *chars = name->getChars(NULL);
|
||||
const jschar *chars = name->getChars(nullptr);
|
||||
JSString::dumpChars(chars, name->length());
|
||||
}
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ class TypeRepresentation;
|
||||
class TaggedProto
|
||||
{
|
||||
public:
|
||||
TaggedProto() : proto(NULL) {}
|
||||
TaggedProto() : proto(nullptr) {}
|
||||
TaggedProto(JSObject *proto) : proto(proto) {}
|
||||
|
||||
uintptr_t toWord() const { return uintptr_t(proto); }
|
||||
@ -259,7 +259,7 @@ public:
|
||||
TypeConstraint *next;
|
||||
|
||||
TypeConstraint()
|
||||
: next(NULL)
|
||||
: next(nullptr)
|
||||
{}
|
||||
|
||||
/* Debugging name for this kind of constraint. */
|
||||
@ -451,7 +451,7 @@ class TypeSet
|
||||
TypeConstraint *constraintList;
|
||||
|
||||
TypeSet()
|
||||
: flags(0), objectSet(NULL), constraintList(NULL)
|
||||
: flags(0), objectSet(nullptr), constraintList(nullptr)
|
||||
{}
|
||||
|
||||
void print();
|
||||
@ -466,7 +466,7 @@ class TypeSet
|
||||
bool unknownObject() const { return !!(flags & (TYPE_FLAG_UNKNOWN | TYPE_FLAG_ANYOBJECT)); }
|
||||
|
||||
bool empty() const { return !baseFlags() && !baseObjectCount(); }
|
||||
bool noConstraints() const { return constraintList == NULL; }
|
||||
bool noConstraints() const { return constraintList == nullptr; }
|
||||
|
||||
bool hasAnyFlag(TypeFlags flags) const {
|
||||
JS_ASSERT((flags & TYPE_FLAG_BASE_MASK) == flags);
|
||||
@ -497,7 +497,7 @@ class TypeSet
|
||||
/*
|
||||
* Iterate through the objects in this set. getObjectCount overapproximates
|
||||
* in the hash case (see SET_ARRAY_SIZE in jsinferinlines.h), and getObject
|
||||
* may return NULL.
|
||||
* may return nullptr.
|
||||
*/
|
||||
inline unsigned getObjectCount() const;
|
||||
inline TypeObjectKey *getObject(unsigned i) const;
|
||||
@ -618,10 +618,10 @@ class TemporaryTypeSet : public TypeSet
|
||||
/* Whether the type set contains objects with any of a set of flags. */
|
||||
bool hasObjectFlags(CompilerConstraintList *constraints, TypeObjectFlags flags);
|
||||
|
||||
/* Get the class shared by all objects in this set, or NULL. */
|
||||
/* Get the class shared by all objects in this set, or nullptr. */
|
||||
const Class *getKnownClass();
|
||||
|
||||
/* Get the prototype shared by all objects in this set, or NULL. */
|
||||
/* Get the prototype shared by all objects in this set, or nullptr. */
|
||||
JSObject *getCommonPrototype();
|
||||
|
||||
/* Get the typed array type of all objects in this set, or TypedArrayObject::TYPE_MAX. */
|
||||
@ -636,7 +636,7 @@ class TemporaryTypeSet : public TypeSet
|
||||
/* Whether clasp->emulatesUndefined() is true for one or more objects in this set. */
|
||||
bool maybeEmulatesUndefined();
|
||||
|
||||
/* Get the single value which can appear in this type set, otherwise NULL. */
|
||||
/* Get the single value which can appear in this type set, otherwise nullptr. */
|
||||
JSObject *getSingleton();
|
||||
|
||||
/* Whether any objects in the type set needs a barrier on id. */
|
||||
@ -1242,7 +1242,7 @@ class CompilerOutput
|
||||
|
||||
public:
|
||||
CompilerOutput()
|
||||
: script_(NULL), mode_(0), pendingInvalidation_(false)
|
||||
: script_(nullptr), mode_(0), pendingInvalidation_(false)
|
||||
{}
|
||||
|
||||
CompilerOutput(JSScript *script, jit::ExecutionMode mode)
|
||||
@ -1255,10 +1255,10 @@ class CompilerOutput
|
||||
inline jit::IonScript *ion() const;
|
||||
|
||||
bool isValid() const {
|
||||
return script_ != NULL;
|
||||
return script_ != nullptr;
|
||||
}
|
||||
void invalidate() {
|
||||
script_ = NULL;
|
||||
script_ = nullptr;
|
||||
}
|
||||
|
||||
void setPendingInvalidation() {
|
||||
@ -1440,12 +1440,12 @@ bool TypeHasProperty(JSContext *cx, TypeObject *obj, jsid id, const Value &value
|
||||
|
||||
#else
|
||||
|
||||
inline const char * InferSpewColorReset() { return NULL; }
|
||||
inline const char * InferSpewColor(TypeConstraint *constraint) { return NULL; }
|
||||
inline const char * InferSpewColor(TypeSet *types) { return NULL; }
|
||||
inline const char * InferSpewColorReset() { return nullptr; }
|
||||
inline const char * InferSpewColor(TypeConstraint *constraint) { return nullptr; }
|
||||
inline const char * InferSpewColor(TypeSet *types) { return nullptr; }
|
||||
inline void InferSpew(SpewChannel which, const char *fmt, ...) {}
|
||||
inline const char * TypeString(Type type) { return NULL; }
|
||||
inline const char * TypeObjectString(TypeObject *type) { return NULL; }
|
||||
inline const char * TypeString(Type type) { return nullptr; }
|
||||
inline const char * TypeObjectString(TypeObject *type) { return nullptr; }
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -29,7 +29,7 @@
|
||||
inline bool
|
||||
js::TaggedProto::isObject() const
|
||||
{
|
||||
/* Skip NULL and Proxy::LazyProto. */
|
||||
/* Skip nullptr and Proxy::LazyProto. */
|
||||
return uintptr_t(proto) > uintptr_t(Proxy::LazyProto);
|
||||
}
|
||||
|
||||
@ -107,7 +107,7 @@ inline CompilerOutput*
|
||||
RecompileInfo::compilerOutput(TypeCompartment &types) const
|
||||
{
|
||||
if (!types.constrainedOutputs || outputIndex >= types.constrainedOutputs->length())
|
||||
return NULL;
|
||||
return nullptr;
|
||||
return &(*types.constrainedOutputs)[outputIndex];
|
||||
}
|
||||
|
||||
@ -371,7 +371,7 @@ GetTypeNewObject(JSContext *cx, JSProtoKey key)
|
||||
{
|
||||
RootedObject proto(cx);
|
||||
if (!js_GetClassPrototype(cx, key, &proto))
|
||||
return NULL;
|
||||
return nullptr;
|
||||
return cx->getNewType(GetClassForProtoKey(key), proto.get());
|
||||
}
|
||||
|
||||
@ -623,8 +623,8 @@ TypeScript::BytecodeTypes(JSScript *script, jsbytecode *pc)
|
||||
TypeScript::StandardType(JSContext *cx, JSProtoKey key)
|
||||
{
|
||||
RootedObject proto(cx);
|
||||
if (!js_GetClassPrototype(cx, key, &proto, NULL))
|
||||
return NULL;
|
||||
if (!js_GetClassPrototype(cx, key, &proto, nullptr))
|
||||
return nullptr;
|
||||
return cx->getNewType(GetClassForProtoKey(key), proto.get());
|
||||
}
|
||||
|
||||
@ -891,7 +891,7 @@ HashKey(T v)
|
||||
|
||||
/*
|
||||
* Insert space for an element into the specified set and grow its capacity if needed.
|
||||
* returned value is an existing or new entry (NULL if new).
|
||||
* returned value is an existing or new entry (nullptr if new).
|
||||
*/
|
||||
template <class T, class U, class KEY>
|
||||
static U **
|
||||
@ -904,7 +904,7 @@ HashSetInsertTry(LifoAlloc &alloc, U **&values, unsigned &count, T key)
|
||||
bool converting = (count == SET_ARRAY_SIZE);
|
||||
|
||||
if (!converting) {
|
||||
while (values[insertpos] != NULL) {
|
||||
while (values[insertpos] != nullptr) {
|
||||
if (KEY::getKey(values[insertpos]) == key)
|
||||
return &values[insertpos];
|
||||
insertpos = (insertpos + 1) & (capacity - 1);
|
||||
@ -921,13 +921,13 @@ HashSetInsertTry(LifoAlloc &alloc, U **&values, unsigned &count, T key)
|
||||
|
||||
U **newValues = alloc.newArray<U*>(newCapacity);
|
||||
if (!newValues)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
mozilla::PodZero(newValues, newCapacity);
|
||||
|
||||
for (unsigned i = 0; i < capacity; i++) {
|
||||
if (values[i]) {
|
||||
unsigned pos = HashKey<T,KEY>(KEY::getKey(values[i])) & (newCapacity - 1);
|
||||
while (newValues[pos] != NULL)
|
||||
while (newValues[pos] != nullptr)
|
||||
pos = (pos + 1) & (newCapacity - 1);
|
||||
newValues[pos] = values[i];
|
||||
}
|
||||
@ -936,21 +936,21 @@ HashSetInsertTry(LifoAlloc &alloc, U **&values, unsigned &count, T key)
|
||||
values = newValues;
|
||||
|
||||
insertpos = HashKey<T,KEY>(key) & (newCapacity - 1);
|
||||
while (values[insertpos] != NULL)
|
||||
while (values[insertpos] != nullptr)
|
||||
insertpos = (insertpos + 1) & (newCapacity - 1);
|
||||
return &values[insertpos];
|
||||
}
|
||||
|
||||
/*
|
||||
* Insert an element into the specified set if it is not already there, returning
|
||||
* an entry which is NULL if the element was not there.
|
||||
* an entry which is nullptr if the element was not there.
|
||||
*/
|
||||
template <class T, class U, class KEY>
|
||||
static inline U **
|
||||
HashSetInsert(LifoAlloc &alloc, U **&values, unsigned &count, T key)
|
||||
{
|
||||
if (count == 0) {
|
||||
JS_ASSERT(values == NULL);
|
||||
JS_ASSERT(values == nullptr);
|
||||
count++;
|
||||
return (U **) &values;
|
||||
}
|
||||
@ -963,7 +963,7 @@ HashSetInsert(LifoAlloc &alloc, U **&values, unsigned &count, T key)
|
||||
values = alloc.newArray<U*>(SET_ARRAY_SIZE);
|
||||
if (!values) {
|
||||
values = (U **) oldData;
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
mozilla::PodZero(values, SET_ARRAY_SIZE);
|
||||
count++;
|
||||
@ -987,35 +987,35 @@ HashSetInsert(LifoAlloc &alloc, U **&values, unsigned &count, T key)
|
||||
return HashSetInsertTry<T,U,KEY>(alloc, values, count, key);
|
||||
}
|
||||
|
||||
/* Lookup an entry in a hash set, return NULL if it does not exist. */
|
||||
/* Lookup an entry in a hash set, return nullptr if it does not exist. */
|
||||
template <class T, class U, class KEY>
|
||||
static inline U *
|
||||
HashSetLookup(U **values, unsigned count, T key)
|
||||
{
|
||||
if (count == 0)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
if (count == 1)
|
||||
return (KEY::getKey((U *) values) == key) ? (U *) values : NULL;
|
||||
return (KEY::getKey((U *) values) == key) ? (U *) values : nullptr;
|
||||
|
||||
if (count <= SET_ARRAY_SIZE) {
|
||||
for (unsigned i = 0; i < count; i++) {
|
||||
if (KEY::getKey(values[i]) == key)
|
||||
return values[i];
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
unsigned capacity = HashSetCapacity(count);
|
||||
unsigned pos = HashKey<T,KEY>(key) & (capacity - 1);
|
||||
|
||||
while (values[pos] != NULL) {
|
||||
while (values[pos] != nullptr) {
|
||||
if (KEY::getKey(values[pos]) == key)
|
||||
return values[pos];
|
||||
pos = (pos + 1) & (capacity - 1);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
inline TypeObjectKey *
|
||||
@ -1060,7 +1060,7 @@ TypeSet::hasType(Type type) const
|
||||
} else {
|
||||
return !!(flags & TYPE_FLAG_ANYOBJECT) ||
|
||||
HashSetLookup<TypeObjectKey*,TypeObjectKey,TypeObjectKey>
|
||||
(objectSet, baseObjectCount(), type.objectKey()) != NULL;
|
||||
(objectSet, baseObjectCount(), type.objectKey()) != nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1076,7 +1076,7 @@ inline void
|
||||
TypeSet::clearObjects()
|
||||
{
|
||||
setBaseObjectCount(0);
|
||||
objectSet = NULL;
|
||||
objectSet = nullptr;
|
||||
}
|
||||
|
||||
inline void
|
||||
@ -1205,14 +1205,14 @@ inline JSObject *
|
||||
TypeSet::getSingleObject(unsigned i) const
|
||||
{
|
||||
TypeObjectKey *key = getObject(i);
|
||||
return (key && key->isSingleObject()) ? key->asSingleObject() : NULL;
|
||||
return (key && key->isSingleObject()) ? key->asSingleObject() : nullptr;
|
||||
}
|
||||
|
||||
inline TypeObject *
|
||||
TypeSet::getTypeObject(unsigned i) const
|
||||
{
|
||||
TypeObjectKey *key = getObject(i);
|
||||
return (key && key->isTypeObject()) ? key->asTypeObject() : NULL;
|
||||
return (key && key->isTypeObject()) ? key->asTypeObject() : nullptr;
|
||||
}
|
||||
|
||||
inline bool
|
||||
@ -1221,7 +1221,7 @@ TypeSet::getTypeOrSingleObject(JSContext *cx, unsigned i, TypeObject **result) c
|
||||
JS_ASSERT(result);
|
||||
JS_ASSERT(cx->compartment()->activeAnalysis);
|
||||
|
||||
*result = NULL;
|
||||
*result = nullptr;
|
||||
|
||||
TypeObject *type = getTypeObject(i);
|
||||
if (!type) {
|
||||
@ -1246,7 +1246,7 @@ TypeSet::getObjectClass(unsigned i) const
|
||||
return object->getClass();
|
||||
if (TypeObject *object = getTypeObject(i))
|
||||
return object->clasp;
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
@ -1297,15 +1297,15 @@ TypeObject::getProperty(ExclusiveContext *cx, jsid id)
|
||||
(cx->typeLifoAlloc(), propertySet, propertyCount, id);
|
||||
if (!pprop) {
|
||||
cx->compartment()->types.setPendingNukeTypes(cx);
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (!*pprop) {
|
||||
setBasePropertyCount(propertyCount);
|
||||
if (!addProperty(cx, id, pprop)) {
|
||||
setBasePropertyCount(0);
|
||||
propertySet = NULL;
|
||||
return NULL;
|
||||
propertySet = nullptr;
|
||||
return nullptr;
|
||||
}
|
||||
if (propertyCount == OBJECT_FLAG_PROPERTY_COUNT_LIMIT) {
|
||||
markUnknown(cx);
|
||||
@ -1337,7 +1337,7 @@ TypeObject::maybeGetProperty(ExclusiveContext *cx, jsid id)
|
||||
Property *prop = HashSetLookup<jsid,Property,Property>
|
||||
(propertySet, basePropertyCount(), id);
|
||||
|
||||
return prop ? &prop->types : NULL;
|
||||
return prop ? &prop->types : nullptr;
|
||||
}
|
||||
|
||||
inline unsigned
|
||||
@ -1484,8 +1484,8 @@ inline void
|
||||
JSScript::clearAnalysis()
|
||||
{
|
||||
if (types) {
|
||||
types->analysis = NULL;
|
||||
types->bytecodeMap = NULL;
|
||||
types->analysis = nullptr;
|
||||
types->bytecodeMap = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user