Bug 784739 - Switch from NULL to nullptr in js/src/jit/ (6/7); r=ehsan

--HG--
extra : rebase_source : e5b3e4e45ab587f6953605a67a63814eea9c8056
This commit is contained in:
Birunthan Mohanathas 2013-09-27 16:29:58 -04:00
parent 0e10999ae5
commit 9adb7a582a
23 changed files with 157 additions and 156 deletions

View File

@ -79,7 +79,7 @@ class MIRGenerator
} }
bool compilingAsmJS() const { bool compilingAsmJS() const {
return info_->script() == NULL; return info_->script() == nullptr;
} }
uint32_t maxAsmJSStackArgBytes() const { uint32_t maxAsmJSStackArgBytes() const {

View File

@ -91,7 +91,7 @@ MIRGraph::removeBlock(MBasicBlock *block)
// share the same resumepoints and we cannot distinguish between them. // share the same resumepoints and we cannot distinguish between them.
if (block == osrBlock_) if (block == osrBlock_)
osrBlock_ = NULL; osrBlock_ = nullptr;
if (exitAccumulator_) { if (exitAccumulator_) {
size_t i = 0; size_t i = 0;
@ -140,7 +140,7 @@ MIRGraph::forkJoinSlice()
MBasicBlock *entry = entryBlock(); MBasicBlock *entry = entryBlock();
JS_ASSERT(entry->info().executionMode() == ParallelExecution); JS_ASSERT(entry->info().executionMode() == ParallelExecution);
MInstruction *start = NULL; MInstruction *start = nullptr;
for (MInstructionIterator ins(entry->begin()); ins != entry->end(); ins++) { for (MInstructionIterator ins(entry->begin()); ins != entry->end(); ins++) {
if (ins->isForkJoinSlice()) if (ins->isForkJoinSlice())
return *ins; return *ins;
@ -158,14 +158,14 @@ MBasicBlock *
MBasicBlock::New(MIRGraph &graph, BytecodeAnalysis *analysis, CompileInfo &info, MBasicBlock::New(MIRGraph &graph, BytecodeAnalysis *analysis, CompileInfo &info,
MBasicBlock *pred, jsbytecode *entryPc, Kind kind) MBasicBlock *pred, jsbytecode *entryPc, Kind kind)
{ {
JS_ASSERT(entryPc != NULL); JS_ASSERT(entryPc != nullptr);
MBasicBlock *block = new MBasicBlock(graph, info, entryPc, kind); MBasicBlock *block = new MBasicBlock(graph, info, entryPc, kind);
if (!block->init()) if (!block->init())
return NULL; return nullptr;
if (!block->inherit(analysis, pred, 0)) if (!block->inherit(analysis, pred, 0))
return NULL; return nullptr;
return block; return block;
} }
@ -176,10 +176,10 @@ MBasicBlock::NewPopN(MIRGraph &graph, CompileInfo &info,
{ {
MBasicBlock *block = new MBasicBlock(graph, info, entryPc, kind); MBasicBlock *block = new MBasicBlock(graph, info, entryPc, kind);
if (!block->init()) if (!block->init())
return NULL; return nullptr;
if (!block->inherit(NULL, pred, popped)) if (!block->inherit(nullptr, pred, popped))
return NULL; return nullptr;
return block; return block;
} }
@ -195,10 +195,10 @@ MBasicBlock::NewWithResumePoint(MIRGraph &graph, CompileInfo &info,
block->entryResumePoint_ = resumePoint; block->entryResumePoint_ = resumePoint;
if (!block->init()) if (!block->init())
return NULL; return nullptr;
if (!block->inheritResumePoint(pred)) if (!block->inheritResumePoint(pred))
return NULL; return nullptr;
return block; return block;
} }
@ -207,14 +207,14 @@ MBasicBlock *
MBasicBlock::NewPendingLoopHeader(MIRGraph &graph, CompileInfo &info, MBasicBlock::NewPendingLoopHeader(MIRGraph &graph, CompileInfo &info,
MBasicBlock *pred, jsbytecode *entryPc) MBasicBlock *pred, jsbytecode *entryPc)
{ {
return MBasicBlock::New(graph, NULL, info, pred, entryPc, PENDING_LOOP_HEADER); return MBasicBlock::New(graph, nullptr, info, pred, entryPc, PENDING_LOOP_HEADER);
} }
MBasicBlock * MBasicBlock *
MBasicBlock::NewSplitEdge(MIRGraph &graph, CompileInfo &info, MBasicBlock *pred) MBasicBlock::NewSplitEdge(MIRGraph &graph, CompileInfo &info, MBasicBlock *pred)
{ {
return pred->pc() return pred->pc()
? MBasicBlock::New(graph, NULL, info, pred, pred->pc(), SPLIT_EDGE) ? MBasicBlock::New(graph, nullptr, info, pred, pred->pc(), SPLIT_EDGE)
: MBasicBlock::NewAsmJS(graph, info, pred, SPLIT_EDGE); : MBasicBlock::NewAsmJS(graph, info, pred, SPLIT_EDGE);
} }
@ -229,10 +229,10 @@ MBasicBlock::NewAbortPar(MIRGraph &graph, CompileInfo &info,
block->entryResumePoint_ = resumePoint; block->entryResumePoint_ = resumePoint;
if (!block->init()) if (!block->init())
return NULL; return nullptr;
if (!block->addPredecessorWithoutPhis(pred)) if (!block->addPredecessorWithoutPhis(pred))
return NULL; return nullptr;
block->end(new MAbortPar()); block->end(new MAbortPar());
return block; return block;
@ -241,9 +241,9 @@ MBasicBlock::NewAbortPar(MIRGraph &graph, CompileInfo &info,
MBasicBlock * MBasicBlock *
MBasicBlock::NewAsmJS(MIRGraph &graph, CompileInfo &info, MBasicBlock *pred, Kind kind) MBasicBlock::NewAsmJS(MIRGraph &graph, CompileInfo &info, MBasicBlock *pred, Kind kind)
{ {
MBasicBlock *block = new MBasicBlock(graph, info, /* entryPC = */ NULL, kind); MBasicBlock *block = new MBasicBlock(graph, info, /* entryPC = */ nullptr, kind);
if (!block->init()) if (!block->init())
return NULL; return nullptr;
if (pred) { if (pred) {
block->stackPosition_ = pred->stackPosition_; block->stackPosition_ = pred->stackPosition_;
@ -266,7 +266,7 @@ MBasicBlock::NewAsmJS(MIRGraph &graph, CompileInfo &info, MBasicBlock *pred, Kin
} }
if (!block->predecessors_.append(pred)) if (!block->predecessors_.append(pred))
return NULL; return nullptr;
} }
return block; return block;
@ -277,19 +277,19 @@ MBasicBlock::MBasicBlock(MIRGraph &graph, CompileInfo &info, jsbytecode *pc, Kin
graph_(graph), graph_(graph),
info_(info), info_(info),
stackPosition_(info_.firstStackSlot()), stackPosition_(info_.firstStackSlot()),
lastIns_(NULL), lastIns_(nullptr),
pc_(pc), pc_(pc),
lir_(NULL), lir_(nullptr),
start_(NULL), start_(nullptr),
entryResumePoint_(NULL), entryResumePoint_(nullptr),
successorWithPhis_(NULL), successorWithPhis_(nullptr),
positionInPhiSuccessor_(0), positionInPhiSuccessor_(0),
kind_(kind), kind_(kind),
loopDepth_(0), loopDepth_(0),
mark_(false), mark_(false),
immediateDominator_(NULL), immediateDominator_(nullptr),
numDominated_(0), numDominated_(0),
loopHeader_(NULL), loopHeader_(nullptr),
trackedPc_(pc) trackedPc_(pc)
#if defined (JS_ION_PERF) #if defined (JS_ION_PERF)
, lineno_(0u), , lineno_(0u),
@ -339,7 +339,7 @@ MBasicBlock::inherit(BytecodeAnalysis *analysis, MBasicBlock *pred, uint32_t pop
JS_ASSERT(!entryResumePoint_); JS_ASSERT(!entryResumePoint_);
// Propagate the caller resume point from the inherited block. // Propagate the caller resume point from the inherited block.
MResumePoint *callerResumePoint = pred ? pred->callerResumePoint() : NULL; MResumePoint *callerResumePoint = pred ? pred->callerResumePoint() : nullptr;
// Create a resume point using our initial stack state. // Create a resume point using our initial stack state.
entryResumePoint_ = new MResumePoint(this, pc(), callerResumePoint, MResumePoint::ResumeAt); entryResumePoint_ = new MResumePoint(this, pc(), callerResumePoint, MResumePoint::ResumeAt);
@ -385,7 +385,7 @@ MBasicBlock::inheritResumePoint(MBasicBlock *pred)
JS_ASSERT(info_.nslots() >= stackPosition_); JS_ASSERT(info_.nslots() >= stackPosition_);
JS_ASSERT(kind_ != PENDING_LOOP_HEADER); JS_ASSERT(kind_ != PENDING_LOOP_HEADER);
JS_ASSERT(pred != NULL); JS_ASSERT(pred != nullptr);
if (!predecessors_.append(pred)) if (!predecessors_.append(pred))
return false; return false;
@ -622,7 +622,7 @@ MBasicBlock::discardLastIns()
{ {
JS_ASSERT(lastIns_); JS_ASSERT(lastIns_);
discard(lastIns_); discard(lastIns_);
lastIns_ = NULL; lastIns_ = nullptr;
} }
void void
@ -710,7 +710,7 @@ MBasicBlock::discardAllInstructions()
iter->discardOperand(i); iter->discardOperand(i);
iter = instructions_.removeAt(iter); iter = instructions_.removeAt(iter);
} }
lastIns_ = NULL; lastIns_ = nullptr;
} }
void void
@ -723,7 +723,7 @@ MBasicBlock::discardAllPhiOperands()
} }
for (MBasicBlock **pred = predecessors_.begin(); pred != predecessors_.end(); pred++) for (MBasicBlock **pred = predecessors_.begin(); pred != predecessors_.end(); pred++)
(*pred)->setSuccessorWithPhis(NULL, 0); (*pred)->setSuccessorWithPhis(nullptr, 0);
} }
void void
@ -804,7 +804,7 @@ MBasicBlock::discardPhiAt(MPhiIterator &at)
if (phis_.empty()) { if (phis_.empty()) {
for (MBasicBlock **pred = predecessors_.begin(); pred != predecessors_.end(); pred++) for (MBasicBlock **pred = predecessors_.begin(); pred != predecessors_.end(); pred++)
(*pred)->setSuccessorWithPhis(NULL, 0); (*pred)->setSuccessorWithPhis(nullptr, 0);
} }
return result; return result;
} }
@ -1072,7 +1072,7 @@ MBasicBlock::replacePredecessor(MBasicBlock *old, MBasicBlock *split)
void void
MBasicBlock::clearDominatorInfo() MBasicBlock::clearDominatorInfo()
{ {
setImmediateDominator(NULL); setImmediateDominator(nullptr);
immediatelyDominated_.clear(); immediatelyDominated_.clear();
numDominated_ = 0; numDominated_ = 0;
} }
@ -1155,11 +1155,11 @@ MBasicBlock::immediateDominatorBranch(BranchDirection *pdirection)
*pdirection = FALSE_BRANCH; *pdirection = FALSE_BRANCH;
if (numPredecessors() != 1) if (numPredecessors() != 1)
return NULL; return nullptr;
MBasicBlock *dom = immediateDominator(); MBasicBlock *dom = immediateDominator();
if (dom != getPredecessor(0)) if (dom != getPredecessor(0))
return NULL; return nullptr;
// Look for a trailing MTest branching to this block. // Look for a trailing MTest branching to this block.
MInstruction *ins = dom->lastIns(); MInstruction *ins = dom->lastIns();
@ -1168,13 +1168,13 @@ MBasicBlock::immediateDominatorBranch(BranchDirection *pdirection)
JS_ASSERT(test->ifTrue() == this || test->ifFalse() == this); JS_ASSERT(test->ifTrue() == this || test->ifFalse() == this);
if (test->ifTrue() == this && test->ifFalse() == this) if (test->ifTrue() == this && test->ifFalse() == this)
return NULL; return nullptr;
*pdirection = (test->ifTrue() == this) ? TRUE_BRANCH : FALSE_BRANCH; *pdirection = (test->ifTrue() == this) ? TRUE_BRANCH : FALSE_BRANCH;
return test; return test;
} }
return NULL; return nullptr;
} }
void void

View File

@ -65,7 +65,7 @@ class MBasicBlock : public TempObject, public InlineListNode<MBasicBlock>
////////// BEGIN GRAPH BUILDING INSTRUCTIONS ////////// ////////// BEGIN GRAPH BUILDING INSTRUCTIONS //////////
/////////////////////////////////////////////////////// ///////////////////////////////////////////////////////
// Creates a new basic block for a MIR generator. If |pred| is not NULL, // Creates a new basic block for a MIR generator. If |pred| is not nullptr,
// its slots and stack depth are initialized from |pred|. // its slots and stack depth are initialized from |pred|.
static MBasicBlock *New(MIRGraph &graph, BytecodeAnalysis *analysis, CompileInfo &info, static MBasicBlock *New(MIRGraph &graph, BytecodeAnalysis *analysis, CompileInfo &info,
MBasicBlock *pred, jsbytecode *entryPc, Kind kind); MBasicBlock *pred, jsbytecode *entryPc, Kind kind);
@ -149,8 +149,8 @@ class MBasicBlock : public TempObject, public InlineListNode<MBasicBlock>
MDefinition *pop(); MDefinition *pop();
void popn(uint32_t n); void popn(uint32_t n);
// Adds an instruction to this block's instruction list. |ins| may be NULL // Adds an instruction to this block's instruction list. |ins| may be
// to simplify OOM checking. // nullptr to simplify OOM checking.
void add(MInstruction *ins); void add(MInstruction *ins);
// Marks the last instruction of the block; no further instructions // Marks the last instruction of the block; no further instructions
@ -550,11 +550,11 @@ class MIRGraph
public: public:
MIRGraph(TempAllocator *alloc) MIRGraph(TempAllocator *alloc)
: alloc_(alloc), : alloc_(alloc),
exitAccumulator_(NULL), exitAccumulator_(nullptr),
blockIdGen_(0), blockIdGen_(0),
idGen_(0), idGen_(0),
osrBlock_(NULL), osrBlock_(nullptr),
osrStart_(NULL), osrStart_(nullptr),
numBlocks_(0), numBlocks_(0),
hasTryBlock_(false) hasTryBlock_(false)
{ } { }

View File

@ -49,7 +49,7 @@ MoveResolver::findBlockingMove(const PendingMove *last)
} }
// No blocking moves found. // No blocking moves found.
return NULL; return nullptr;
} }
bool bool

View File

@ -127,7 +127,7 @@ jit::CheckOverRecursedPar(ForkJoinSlice *slice)
if (!JS_CHECK_STACK_SIZE(realStackLimit, &stackDummy_)) { if (!JS_CHECK_STACK_SIZE(realStackLimit, &stackDummy_)) {
slice->bailoutRecord->setCause(ParallelBailoutOverRecursed, slice->bailoutRecord->setCause(ParallelBailoutOverRecursed,
NULL, NULL, NULL); nullptr, nullptr, nullptr);
return false; return false;
} }
@ -160,7 +160,7 @@ jit::PushPar(PushParArgs *args)
JSObject::EnsureDenseResult res = JSObject::EnsureDenseResult res =
args->object->parExtendDenseElements(slice, &args->value, 1); args->object->parExtendDenseElements(slice, &args->value, 1);
if (res != JSObject::ED_OK) if (res != JSObject::ED_OK)
return NULL; return nullptr;
return args->object; return args->object;
} }
@ -168,9 +168,9 @@ JSObject *
jit::ExtendArrayPar(ForkJoinSlice *slice, JSObject *array, uint32_t length) jit::ExtendArrayPar(ForkJoinSlice *slice, JSObject *array, uint32_t length)
{ {
JSObject::EnsureDenseResult res = JSObject::EnsureDenseResult res =
array->parExtendDenseElements(slice, NULL, length); array->parExtendDenseElements(slice, nullptr, length);
if (res != JSObject::ED_OK) if (res != JSObject::ED_OK)
return NULL; return nullptr;
return array; return array;
} }
@ -471,8 +471,8 @@ jit::AbortPar(ParallelBailoutCause cause, JSScript *outermostScript, JSScript *c
(currentScript ? PCToLineNumber(currentScript, bytecode) : 0)); (currentScript ? PCToLineNumber(currentScript, bytecode) : 0));
JS_ASSERT(InParallelSection()); JS_ASSERT(InParallelSection());
JS_ASSERT(outermostScript != NULL); JS_ASSERT(outermostScript != nullptr);
JS_ASSERT(currentScript != NULL); JS_ASSERT(currentScript != nullptr);
JS_ASSERT(outermostScript->hasParallelIonScript()); JS_ASSERT(outermostScript->hasParallelIonScript());
ForkJoinSlice *slice = ForkJoinSlice::Current(); ForkJoinSlice *slice = ForkJoinSlice::Current();
@ -497,7 +497,7 @@ jit::PropagateAbortPar(JSScript *outermostScript, JSScript *currentScript)
ForkJoinSlice *slice = ForkJoinSlice::Current(); ForkJoinSlice *slice = ForkJoinSlice::Current();
if (currentScript) if (currentScript)
slice->bailoutRecord->addTrace(currentScript, NULL); slice->bailoutRecord->addTrace(currentScript, nullptr);
} }
void void

View File

@ -28,11 +28,11 @@ struct PushParArgs {
}; };
// Extends the given object with the given value (like `Array.push`). // Extends the given object with the given value (like `Array.push`).
// Returns NULL on failure or else `args->object`, which is convenient // Returns nullptr on failure or else `args->object`, which is convenient
// during code generation. // during code generation.
JSObject *PushPar(PushParArgs *args); JSObject *PushPar(PushParArgs *args);
// Extends the given array with `length` new holes. Returns NULL on // Extends the given array with `length` new holes. Returns nullptr on
// failure or else `array`, which is convenient during code // failure or else `array`, which is convenient during code
// generation. // generation.
JSObject *ExtendArrayPar(ForkJoinSlice *slice, JSObject *array, uint32_t length); JSObject *ExtendArrayPar(ForkJoinSlice *slice, JSObject *array, uint32_t length);

View File

@ -90,7 +90,7 @@ class ParallelSafetyVisitor : public MInstructionVisitor
ParallelSafetyVisitor(MIRGraph &graph) ParallelSafetyVisitor(MIRGraph &graph)
: graph_(graph), : graph_(graph),
unsafe_(false), unsafe_(false),
slice_(NULL) slice_(nullptr)
{ } { }
void clearUnsafe() { unsafe_ = false; } void clearUnsafe() { unsafe_ = false; }
@ -327,7 +327,7 @@ ParallelSafetyAnalysis::analyze()
// if we encounter an inherently unsafe operation, in // if we encounter an inherently unsafe operation, in
// which case we will transform this block into a bailout // which case we will transform this block into a bailout
// block. // block.
MInstruction *instr = NULL; MInstruction *instr = nullptr;
for (MInstructionIterator ins(block->begin()); for (MInstructionIterator ins(block->begin());
ins != block->end() && !visitor.unsafe();) ins != block->end() && !visitor.unsafe();)
{ {
@ -412,14 +412,14 @@ ParallelSafetyAnalysis::removeResumePointOperands()
// But the call to foo() is dead and has been removed, leading to // But the call to foo() is dead and has been removed, leading to
// an inconsistent IR and assertions at codegen time. // an inconsistent IR and assertions at codegen time.
MConstant *udef = NULL; MConstant *udef = nullptr;
for (ReversePostorderIterator block(graph_.rpoBegin()); block != graph_.rpoEnd(); block++) { for (ReversePostorderIterator block(graph_.rpoBegin()); block != graph_.rpoEnd(); block++) {
if (udef) if (udef)
replaceOperandsOnResumePoint(block->entryResumePoint(), udef); replaceOperandsOnResumePoint(block->entryResumePoint(), udef);
for (MInstructionIterator ins(block->begin()); ins != block->end(); ins++) { for (MInstructionIterator ins(block->begin()); ins != block->end(); ins++) {
if (ins->isStart()) { if (ins->isStart()) {
JS_ASSERT(udef == NULL); JS_ASSERT(udef == nullptr);
udef = MConstant::New(UndefinedValue()); udef = MConstant::New(UndefinedValue());
block->insertAfter(*ins, udef); block->insertAfter(*ins, udef);
} else if (udef) { } else if (udef) {
@ -474,7 +474,7 @@ ParallelSafetyVisitor::convertToBailout(MBasicBlock *block, MInstruction *ins)
// if `block` had phis, we are replacing it with `bailBlock` which does not // if `block` had phis, we are replacing it with `bailBlock` which does not
if (pred->successorWithPhis() == block) if (pred->successorWithPhis() == block)
pred->setSuccessorWithPhis(NULL, 0); pred->setSuccessorWithPhis(nullptr, 0);
// redirect the predecessor to the bailout block // redirect the predecessor to the bailout block
uint32_t succIdx = pred->getSuccessorIndex(block); uint32_t succIdx = pred->getSuccessorIndex(block);
@ -558,7 +558,7 @@ ParallelSafetyVisitor::visitRest(MRest *ins)
bool bool
ParallelSafetyVisitor::visitMathFunction(MMathFunction *ins) ParallelSafetyVisitor::visitMathFunction(MMathFunction *ins)
{ {
return replace(ins, MMathFunction::New(ins->input(), ins->function(), NULL)); return replace(ins, MMathFunction::New(ins->input(), ins->function(), nullptr));
} }
bool bool

View File

@ -36,7 +36,7 @@ struct PcScriptCache
void clear(uint64_t gcNumber) { void clear(uint64_t gcNumber) {
for (uint32_t i = 0; i < Length; i++) for (uint32_t i = 0; i < Length; i++)
entries[i].returnAddress = NULL; entries[i].returnAddress = nullptr;
this->gcNumber = gcNumber; this->gcNumber = gcNumber;
} }

View File

@ -46,7 +46,7 @@ static uint32_t PerfMode = 0;
static bool PerfChecked = false; static bool PerfChecked = false;
static FILE *PerfFilePtr = NULL; static FILE *PerfFilePtr = nullptr;
#ifdef JS_THREADSAFE #ifdef JS_THREADSAFE
# include "jslock.h" # include "jslock.h"
@ -75,7 +75,7 @@ void
js::jit::CheckPerf() { js::jit::CheckPerf() {
if (!PerfChecked) { if (!PerfChecked) {
const char *env = getenv("IONPERF"); const char *env = getenv("IONPERF");
if (env == NULL) { if (env == nullptr) {
PerfMode = PERF_MODE_NONE; PerfMode = PERF_MODE_NONE;
fprintf(stderr, "Warning: JIT perf reporting requires IONPERF set to \"block\" or \"func\". "); fprintf(stderr, "Warning: JIT perf reporting requires IONPERF set to \"block\" or \"func\". ");
fprintf(stderr, "Perf mapping will be deactivated.\n"); fprintf(stderr, "Perf mapping will be deactivated.\n");

View File

@ -148,7 +148,7 @@ RangeAnalysis::addBetaNodes()
MDefinition *left = compare->getOperand(0); MDefinition *left = compare->getOperand(0);
MDefinition *right = compare->getOperand(1); MDefinition *right = compare->getOperand(1);
int32_t bound; int32_t bound;
MDefinition *val = NULL; MDefinition *val = nullptr;
JSOp jsop = compare->jsop(); JSOp jsop = compare->jsop();
@ -163,8 +163,8 @@ RangeAnalysis::addBetaNodes()
bound = right->toConstant()->value().toInt32(); bound = right->toConstant()->value().toInt32();
val = left; val = left;
} else if (left->type() == MIRType_Int32 && right->type() == MIRType_Int32) { } else if (left->type() == MIRType_Int32 && right->type() == MIRType_Int32) {
MDefinition *smaller = NULL; MDefinition *smaller = nullptr;
MDefinition *greater = NULL; MDefinition *greater = nullptr;
if (jsop == JSOP_LT) { if (jsop == JSOP_LT) {
smaller = left; smaller = left;
greater = right; greater = right;
@ -310,7 +310,7 @@ Range::intersect(const Range *lhs, const Range *rhs, bool *emptyRange)
*emptyRange = false; *emptyRange = false;
if (!lhs && !rhs) if (!lhs && !rhs)
return NULL; return nullptr;
if (!lhs) if (!lhs)
return new Range(*rhs); return new Range(*rhs);
@ -336,7 +336,7 @@ Range::intersect(const Range *lhs, const Range *rhs, bool *emptyRange)
// (Bug 765127) // (Bug 765127)
if (newUpper < newLower) { if (newUpper < newLower) {
*emptyRange = true; *emptyRange = true;
return NULL; return nullptr;
} }
Range *r = new Range( Range *r = new Range(
@ -371,8 +371,8 @@ Range::unionWith(const Range *other)
} }
Range::Range(const MDefinition *def) Range::Range(const MDefinition *def)
: symbolicLower_(NULL), : symbolicLower_(nullptr),
symbolicUpper_(NULL) symbolicUpper_(nullptr)
{ {
const Range *other = def->range(); const Range *other = def->range();
if (!other) { if (!other) {
@ -382,12 +382,12 @@ Range::Range(const MDefinition *def)
set(0, 1); set(0, 1);
else else
set(NoInt32LowerBound, NoInt32UpperBound, true, MaxDoubleExponent); set(NoInt32LowerBound, NoInt32UpperBound, true, MaxDoubleExponent);
symbolicLower_ = symbolicUpper_ = NULL; symbolicLower_ = symbolicUpper_ = nullptr;
return; return;
} }
*this = *other; *this = *other;
symbolicLower_ = symbolicUpper_ = NULL; symbolicLower_ = symbolicUpper_ = nullptr;
if (def->type() == MIRType_Boolean) if (def->type() == MIRType_Boolean)
wrapAroundToBoolean(); wrapAroundToBoolean();
@ -766,7 +766,7 @@ MPhi::computeRange()
if (type() != MIRType_Int32 && type() != MIRType_Double) if (type() != MIRType_Int32 && type() != MIRType_Double)
return; return;
Range *range = NULL; Range *range = nullptr;
JS_ASSERT(getOperand(0)->op() != MDefinition::Op_OsrValue); JS_ASSERT(getOperand(0)->op() != MDefinition::Op_OsrValue);
for (size_t i = 0, e = numOperands(); i < e; i++) { for (size_t i = 0, e = numOperands(); i < e; i++) {
if (getOperand(i)->block()->earlyAbort()) { if (getOperand(i)->block()->earlyAbort()) {
@ -780,7 +780,7 @@ MPhi::computeRange()
Range *input = getOperand(i)->range(); Range *input = getOperand(i)->range();
if (!input) { if (!input) {
range = NULL; range = nullptr;
break; break;
} }
@ -1146,7 +1146,7 @@ static Range *GetTypedArrayRange(int type)
break; break;
} }
return NULL; return nullptr;
} }
void void
@ -1258,7 +1258,7 @@ RangeAnalysis::analyzeLoop(MBasicBlock *header)
if (!markBlocksInLoopBody(header, backedge)) if (!markBlocksInLoopBody(header, backedge))
return false; return false;
LoopIterationBound *iterationBound = NULL; LoopIterationBound *iterationBound = nullptr;
MBasicBlock *block = backedge; MBasicBlock *block = backedge;
do { do {
@ -1344,21 +1344,21 @@ LoopIterationBound *
RangeAnalysis::analyzeLoopIterationCount(MBasicBlock *header, RangeAnalysis::analyzeLoopIterationCount(MBasicBlock *header,
MTest *test, BranchDirection direction) MTest *test, BranchDirection direction)
{ {
SimpleLinearSum lhs(NULL, 0); SimpleLinearSum lhs(nullptr, 0);
MDefinition *rhs; MDefinition *rhs;
bool lessEqual; bool lessEqual;
if (!ExtractLinearInequality(test, direction, &lhs, &rhs, &lessEqual)) if (!ExtractLinearInequality(test, direction, &lhs, &rhs, &lessEqual))
return NULL; return nullptr;
// Ensure the rhs is a loop invariant term. // Ensure the rhs is a loop invariant term.
if (rhs && rhs->block()->isMarked()) { if (rhs && rhs->block()->isMarked()) {
if (lhs.term && lhs.term->block()->isMarked()) if (lhs.term && lhs.term->block()->isMarked())
return NULL; return nullptr;
MDefinition *temp = lhs.term; MDefinition *temp = lhs.term;
lhs.term = rhs; lhs.term = rhs;
rhs = temp; rhs = temp;
if (!SafeSub(0, lhs.constant, &lhs.constant)) if (!SafeSub(0, lhs.constant, &lhs.constant))
return NULL; return nullptr;
lessEqual = !lessEqual; lessEqual = !lessEqual;
} }
@ -1366,7 +1366,7 @@ RangeAnalysis::analyzeLoopIterationCount(MBasicBlock *header,
// Ensure the lhs is a phi node from the start of the loop body. // Ensure the lhs is a phi node from the start of the loop body.
if (!lhs.term || !lhs.term->isPhi() || lhs.term->block() != header) if (!lhs.term || !lhs.term->isPhi() || lhs.term->block() != header)
return NULL; return nullptr;
// Check that the value of the lhs changes by a constant amount with each // Check that the value of the lhs changes by a constant amount with each
// loop iteration. This requires that the lhs be written in every loop // loop iteration. This requires that the lhs be written in every loop
@ -1374,14 +1374,14 @@ RangeAnalysis::analyzeLoopIterationCount(MBasicBlock *header,
// the start of the iteration. // the start of the iteration.
if (lhs.term->toPhi()->numOperands() != 2) if (lhs.term->toPhi()->numOperands() != 2)
return NULL; return nullptr;
// The first operand of the phi should be the lhs' value at the start of // The first operand of the phi should be the lhs' value at the start of
// the first executed iteration, and not a value written which could // the first executed iteration, and not a value written which could
// replace the second operand below during the middle of execution. // replace the second operand below during the middle of execution.
MDefinition *lhsInitial = lhs.term->toPhi()->getOperand(0); MDefinition *lhsInitial = lhs.term->toPhi()->getOperand(0);
if (lhsInitial->block()->isMarked()) if (lhsInitial->block()->isMarked())
return NULL; return nullptr;
// The second operand of the phi should be a value written by an add/sub // The second operand of the phi should be a value written by an add/sub
// in every loop iteration, i.e. in a block which dominates the backedge. // in every loop iteration, i.e. in a block which dominates the backedge.
@ -1389,13 +1389,13 @@ RangeAnalysis::analyzeLoopIterationCount(MBasicBlock *header,
if (lhsWrite->isBeta()) if (lhsWrite->isBeta())
lhsWrite = lhsWrite->getOperand(0); lhsWrite = lhsWrite->getOperand(0);
if (!lhsWrite->isAdd() && !lhsWrite->isSub()) if (!lhsWrite->isAdd() && !lhsWrite->isSub())
return NULL; return nullptr;
if (!lhsWrite->block()->isMarked()) if (!lhsWrite->block()->isMarked())
return NULL; return nullptr;
MBasicBlock *bb = header->backedge(); MBasicBlock *bb = header->backedge();
for (; bb != lhsWrite->block() && bb != header; bb = bb->immediateDominator()) {} for (; bb != lhsWrite->block() && bb != header; bb = bb->immediateDominator()) {}
if (bb != lhsWrite->block()) if (bb != lhsWrite->block())
return NULL; return nullptr;
SimpleLinearSum lhsModified = ExtractLinearSum(lhsWrite); SimpleLinearSum lhsModified = ExtractLinearSum(lhsWrite);
@ -1407,7 +1407,7 @@ RangeAnalysis::analyzeLoopIterationCount(MBasicBlock *header,
// iteration, and if it were stored in another variable its use here would // iteration, and if it were stored in another variable its use here would
// be as an operand to a phi node for that variable. // be as an operand to a phi node for that variable.
if (lhsModified.term != lhs.term) if (lhsModified.term != lhs.term)
return NULL; return nullptr;
LinearSum bound; LinearSum bound;
@ -1421,16 +1421,16 @@ RangeAnalysis::analyzeLoopIterationCount(MBasicBlock *header,
if (rhs) { if (rhs) {
if (!bound.add(rhs, 1)) if (!bound.add(rhs, 1))
return NULL; return nullptr;
} }
if (!bound.add(lhsInitial, -1)) if (!bound.add(lhsInitial, -1))
return NULL; return nullptr;
int32_t lhsConstant; int32_t lhsConstant;
if (!SafeSub(0, lhs.constant, &lhsConstant)) if (!SafeSub(0, lhs.constant, &lhsConstant))
return NULL; return nullptr;
if (!bound.add(lhsConstant)) if (!bound.add(lhsConstant))
return NULL; return nullptr;
} else if (lhsModified.constant == -1 && lessEqual) { } else if (lhsModified.constant == -1 && lessEqual) {
// The value of lhs is 'initial(lhs) - iterCount'. Similar to the above // The value of lhs is 'initial(lhs) - iterCount'. Similar to the above
// case, an upper bound on the number of backedges executed is: // case, an upper bound on the number of backedges executed is:
@ -1439,15 +1439,15 @@ RangeAnalysis::analyzeLoopIterationCount(MBasicBlock *header,
// iterCount == initial(lhs) - rhs + lhsN // iterCount == initial(lhs) - rhs + lhsN
if (!bound.add(lhsInitial, 1)) if (!bound.add(lhsInitial, 1))
return NULL; return nullptr;
if (rhs) { if (rhs) {
if (!bound.add(rhs, -1)) if (!bound.add(rhs, -1))
return NULL; return nullptr;
} }
if (!bound.add(lhs.constant)) if (!bound.add(lhs.constant))
return NULL; return nullptr;
} else { } else {
return NULL; return nullptr;
} }
return new LoopIterationBound(header, test, bound); return new LoopIterationBound(header, test, bound);
@ -1515,12 +1515,12 @@ RangeAnalysis::analyzeLoopPhi(MBasicBlock *header, LoopIterationBound *loopBound
if (modified.constant > 0) { if (modified.constant > 0) {
if (initRange && initRange->hasInt32LowerBound()) if (initRange && initRange->hasInt32LowerBound())
phi->range()->setLower(initRange->lower()); phi->range()->setLower(initRange->lower());
phi->range()->setSymbolicLower(new SymbolicBound(NULL, initialSum)); phi->range()->setSymbolicLower(new SymbolicBound(nullptr, initialSum));
phi->range()->setSymbolicUpper(new SymbolicBound(loopBound, limitSum)); phi->range()->setSymbolicUpper(new SymbolicBound(loopBound, limitSum));
} else { } else {
if (initRange && initRange->hasInt32UpperBound()) if (initRange && initRange->hasInt32UpperBound())
phi->range()->setUpper(initRange->upper()); phi->range()->setUpper(initRange->upper());
phi->range()->setSymbolicUpper(new SymbolicBound(NULL, initialSum)); phi->range()->setSymbolicUpper(new SymbolicBound(nullptr, initialSum));
phi->range()->setSymbolicLower(new SymbolicBound(loopBound, limitSum)); phi->range()->setSymbolicLower(new SymbolicBound(loopBound, limitSum));
} }
@ -1548,7 +1548,7 @@ SymbolicBoundIsValid(MBasicBlock *header, MBoundsCheck *ins, const SymbolicBound
static inline MDefinition * static inline MDefinition *
ConvertLinearSum(MBasicBlock *block, const LinearSum &sum) ConvertLinearSum(MBasicBlock *block, const LinearSum &sum)
{ {
MDefinition *def = NULL; MDefinition *def = nullptr;
for (size_t i = 0; i < sum.numTerms(); i++) { for (size_t i = 0; i < sum.numTerms(); i++) {
LinearTerm term = sum.term(i); LinearTerm term = sum.term(i);

View File

@ -48,10 +48,10 @@ struct SymbolicBound : public TempObject
{ {
// Any loop iteration bound from which this was derived. // Any loop iteration bound from which this was derived.
// //
// If non-NULL, then 'sum' is only valid within the loop body, at points // If non-nullptr, then 'sum' is only valid within the loop body, at
// dominated by the loop bound's test (see LoopIterationBound). // points dominated by the loop bound's test (see LoopIterationBound).
// //
// If NULL, then 'sum' is always valid. // If nullptr, then 'sum' is always valid.
LoopIterationBound *loop; LoopIterationBound *loop;
// Computed symbolic bound, see above. // Computed symbolic bound, see above.
@ -196,8 +196,8 @@ class Range : public TempObject {
hasInt32UpperBound_(false), hasInt32UpperBound_(false),
canHaveFractionalPart_(true), canHaveFractionalPart_(true),
max_exponent_(MaxDoubleExponent), max_exponent_(MaxDoubleExponent),
symbolicLower_(NULL), symbolicLower_(nullptr),
symbolicUpper_(NULL) symbolicUpper_(nullptr)
{ {
JS_ASSERT_IF(!hasInt32LowerBound_, lower_ == JSVAL_INT_MIN); JS_ASSERT_IF(!hasInt32LowerBound_, lower_ == JSVAL_INT_MIN);
JS_ASSERT_IF(!hasInt32UpperBound_, upper_ == JSVAL_INT_MAX); JS_ASSERT_IF(!hasInt32UpperBound_, upper_ == JSVAL_INT_MAX);
@ -208,8 +208,8 @@ class Range : public TempObject {
hasInt32UpperBound_(false), hasInt32UpperBound_(false),
canHaveFractionalPart_(f), canHaveFractionalPart_(f),
max_exponent_(e), max_exponent_(e),
symbolicLower_(NULL), symbolicLower_(nullptr),
symbolicUpper_(NULL) symbolicUpper_(nullptr)
{ {
JS_ASSERT(e >= (h == INT64_MIN ? MaxDoubleExponent : mozilla::FloorLog2(mozilla::Abs(h)))); JS_ASSERT(e >= (h == INT64_MIN ? MaxDoubleExponent : mozilla::FloorLog2(mozilla::Abs(h))));
JS_ASSERT(e >= (l == INT64_MIN ? MaxDoubleExponent : mozilla::FloorLog2(mozilla::Abs(l)))); JS_ASSERT(e >= (l == INT64_MIN ? MaxDoubleExponent : mozilla::FloorLog2(mozilla::Abs(l))));
@ -228,8 +228,8 @@ class Range : public TempObject {
hasInt32UpperBound_(other.hasInt32UpperBound_), hasInt32UpperBound_(other.hasInt32UpperBound_),
canHaveFractionalPart_(other.canHaveFractionalPart_), canHaveFractionalPart_(other.canHaveFractionalPart_),
max_exponent_(other.max_exponent_), max_exponent_(other.max_exponent_),
symbolicLower_(NULL), symbolicLower_(nullptr),
symbolicUpper_(NULL) symbolicUpper_(nullptr)
{ {
JS_ASSERT_IF(!hasInt32LowerBound_, lower_ == JSVAL_INT_MIN); JS_ASSERT_IF(!hasInt32LowerBound_, lower_ == JSVAL_INT_MIN);
JS_ASSERT_IF(!hasInt32UpperBound_, upper_ == JSVAL_INT_MAX); JS_ASSERT_IF(!hasInt32UpperBound_, upper_ == JSVAL_INT_MAX);

View File

@ -19,7 +19,7 @@ AllocationIntegrityState::record()
if (!instructions.appendN(InstructionInfo(), graph.numInstructions())) if (!instructions.appendN(InstructionInfo(), graph.numInstructions()))
return false; return false;
if (!virtualRegisters.appendN((LDefinition *)NULL, graph.numVirtualRegisters())) if (!virtualRegisters.appendN((LDefinition *)nullptr, graph.numVirtualRegisters()))
return false; return false;
if (!blocks.reserve(graph.numBlocks())) if (!blocks.reserve(graph.numBlocks()))

View File

@ -254,7 +254,7 @@ class InstructionDataMap
public: public:
InstructionDataMap() InstructionDataMap()
: insData_(NULL), : insData_(nullptr),
numIns_(0) numIns_(0)
{ } { }

View File

@ -111,10 +111,10 @@ class MachineState
} }
bool has(Register reg) const { bool has(Register reg) const {
return regs_[reg.code()] != NULL; return regs_[reg.code()] != nullptr;
} }
bool has(FloatRegister reg) const { bool has(FloatRegister reg) const {
return fpregs_[reg.code()] != NULL; return fpregs_[reg.code()] != nullptr;
} }
uintptr_t read(Register reg) const { uintptr_t read(Register reg) const {
return *regs_[reg.code()]; return *regs_[reg.code()];

View File

@ -45,7 +45,7 @@ StupidAllocator::init()
if (!RegisterAllocator::init()) if (!RegisterAllocator::init())
return false; return false;
if (!virtualRegisters.appendN((LDefinition *)NULL, graph.numVirtualRegisters())) if (!virtualRegisters.appendN((LDefinition *)nullptr, graph.numVirtualRegisters()))
return false; return false;
for (size_t i = 0; i < graph.numBlocks(); i++) { for (size_t i = 0; i < graph.numBlocks(); i++) {
@ -278,7 +278,7 @@ StupidAllocator::syncForBlockEnd(LBlock *block, LInstruction *ins)
for (size_t i = 0; i < registerCount; i++) for (size_t i = 0; i < registerCount; i++)
syncRegister(ins, i); syncRegister(ins, i);
LMoveGroup *group = NULL; LMoveGroup *group = nullptr;
MBasicBlock *successor = block->mir()->successorWithPhis(); MBasicBlock *successor = block->mir()->successorWithPhis();
if (successor) { if (successor) {

View File

@ -31,7 +31,7 @@ class StupidAllocator : public RegisterAllocator
// Whether the physical register is not synced with the backing stack slot. // Whether the physical register is not synced with the backing stack slot.
bool dirty; bool dirty;
void set(uint32_t vreg, LInstruction *ins = NULL, bool dirty = false) { void set(uint32_t vreg, LInstruction *ins = nullptr, bool dirty = false) {
this->vreg = vreg; this->vreg = vreg;
this->age = ins ? ins->id() : 0; this->age = ins ? ins->id() : 0;
this->dirty = dirty; this->dirty = dirty;

View File

@ -95,7 +95,7 @@ BinaryStringPolicy::adjustInputs(MInstruction *ins)
if (in->type() == MIRType_String) if (in->type() == MIRType_String)
continue; continue;
MInstruction *replace = NULL; MInstruction *replace = nullptr;
if (in->type() == MIRType_Int32 || in->type() == MIRType_Double) { if (in->type() == MIRType_Int32 || in->type() == MIRType_Double) {
replace = MToString::New(in); replace = MToString::New(in);
} else { } else {

View File

@ -100,7 +100,7 @@ TypeRepresentationSetBuilder::insert(TypeRepresentation *typeRepr)
if (min == entries_.length()) if (min == entries_.length())
return entries_.append(typeRepr); return entries_.append(typeRepr);
TypeRepresentation **insertLoc = &entries_[min]; TypeRepresentation **insertLoc = &entries_[min];
return entries_.insert(insertLoc, typeRepr) != NULL; return entries_.insert(insertLoc, typeRepr) != nullptr;
} }
bool bool
@ -156,7 +156,7 @@ TypeRepresentationSet::TypeRepresentationSet(size_t length,
TypeRepresentationSet::TypeRepresentationSet() TypeRepresentationSet::TypeRepresentationSet()
: length_(0), : length_(0),
entries_(NULL) entries_(nullptr)
{} {}
bool bool

View File

@ -112,16 +112,16 @@ UnreachableCodeElimination::optimizableSuccessor(MBasicBlock *block)
{ {
// If the last instruction in `block` is a test instruction of a // If the last instruction in `block` is a test instruction of a
// constant value, returns the successor that the branch will // constant value, returns the successor that the branch will
// always branch to at runtime. Otherwise, returns NULL. // always branch to at runtime. Otherwise, returns nullptr.
MControlInstruction *ins = block->lastIns(); MControlInstruction *ins = block->lastIns();
if (!ins->isTest()) if (!ins->isTest())
return NULL; return nullptr;
MTest *testIns = ins->toTest(); MTest *testIns = ins->toTest();
MDefinition *v = testIns->getOperand(0); MDefinition *v = testIns->getOperand(0);
if (!v->isConstant()) if (!v->isConstant())
return NULL; return nullptr;
const Value &val = v->toConstant()->value(); const Value &val = v->toConstant()->value();
BranchDirection bdir = ToBoolean(val) ? TRUE_BRANCH : FALSE_BRANCH; BranchDirection bdir = ToBoolean(val) ? TRUE_BRANCH : FALSE_BRANCH;
@ -194,7 +194,7 @@ UnreachableCodeElimination::prunePointlessBranchesAndMarkReachableBlocks()
block->end(gotoIns); block->end(gotoIns);
MBasicBlock *successorWithPhis = block->successorWithPhis(); MBasicBlock *successorWithPhis = block->successorWithPhis();
if (successorWithPhis && successorWithPhis != succ) if (successorWithPhis && successorWithPhis != succ)
block->setSuccessorWithPhis(NULL, 0); block->setSuccessorWithPhis(nullptr, 0);
} }
return true; return true;
@ -250,7 +250,7 @@ UnreachableCodeElimination::removeUnmarkedBlocksAndClearDominators()
// predecessors need to have the successorWithPhis // predecessors need to have the successorWithPhis
// flag cleared. // flag cleared.
for (size_t i = 0; i < block->numPredecessors(); i++) for (size_t i = 0; i < block->numPredecessors(); i++)
block->getPredecessor(i)->setSuccessorWithPhis(NULL, 0); block->getPredecessor(i)->setSuccessorWithPhis(nullptr, 0);
} }
if (block->isLoopBackedge()) { if (block->isLoopBackedge()) {

View File

@ -38,7 +38,7 @@ VMFunction::addToFunctions()
static bool initialized = false; static bool initialized = false;
if (!initialized) { if (!initialized) {
initialized = true; initialized = true;
functions = NULL; functions = nullptr;
} }
this->next = functions; this->next = functions;
functions = this; functions = this;
@ -103,7 +103,7 @@ bool
CheckOverRecursed(JSContext *cx) CheckOverRecursed(JSContext *cx)
{ {
// IonMonkey's stackLimit is equal to nativeStackLimit by default. When we // IonMonkey's stackLimit is equal to nativeStackLimit by default. When we
// want to trigger an operation callback, we set the ionStackLimit to NULL, // want to trigger an operation callback, we set the ionStackLimit to nullptr,
// which causes the stack limit check to fail. // which causes the stack limit check to fail.
// //
// There are two states we're concerned about here: // There are two states we're concerned about here:
@ -169,7 +169,7 @@ InitProp(JSContext *cx, HandleObject obj, HandlePropertyName name, HandleValue v
if (name == cx->names().proto) if (name == cx->names().proto)
return baseops::SetPropertyHelper(cx, obj, obj, id, 0, &rval, false); return baseops::SetPropertyHelper(cx, obj, obj, id, 0, &rval, false);
return DefineNativeProperty(cx, obj, id, rval, NULL, NULL, JSPROP_ENUMERATE, 0, 0, 0); return DefineNativeProperty(cx, obj, id, rval, nullptr, nullptr, JSPROP_ENUMERATE, 0, 0, 0);
} }
template<bool Equal> template<bool Equal>
@ -257,7 +257,7 @@ NewInitParallelArray(JSContext *cx, HandleObject templateObject)
RootedObject obj(cx, ParallelArrayObject::newInstance(cx, TenuredObject)); RootedObject obj(cx, ParallelArrayObject::newInstance(cx, TenuredObject));
if (!obj) if (!obj)
return NULL; return nullptr;
obj->setType(templateObject->type()); obj->setType(templateObject->type());
@ -271,9 +271,9 @@ NewInitArray(JSContext *cx, uint32_t count, types::TypeObject *typeArg)
NewObjectKind newKind = !type ? SingletonObject : GenericObject; NewObjectKind newKind = !type ? SingletonObject : GenericObject;
if (type && type->isLongLivedForJITAlloc()) if (type && type->isLongLivedForJITAlloc())
newKind = TenuredObject; newKind = TenuredObject;
RootedObject obj(cx, NewDenseAllocatedArray(cx, count, NULL, newKind)); RootedObject obj(cx, NewDenseAllocatedArray(cx, count, nullptr, newKind));
if (!obj) if (!obj)
return NULL; return nullptr;
if (!type) if (!type)
types::TypeScript::Monitor(cx, ObjectValue(*obj)); types::TypeScript::Monitor(cx, ObjectValue(*obj));
@ -292,7 +292,7 @@ NewInitObject(JSContext *cx, HandleObject templateObject)
RootedObject obj(cx, CopyInitializerObject(cx, templateObject, newKind)); RootedObject obj(cx, CopyInitializerObject(cx, templateObject, newKind));
if (!obj) if (!obj)
return NULL; return nullptr;
if (templateObject->hasSingletonType()) if (templateObject->hasSingletonType())
types::TypeScript::Monitor(cx, ObjectValue(*obj)); types::TypeScript::Monitor(cx, ObjectValue(*obj));
@ -317,7 +317,7 @@ NewInitObjectWithClassPrototype(JSContext *cx, HandleObject templateObject)
cx->global(), cx->global(),
newKind); newKind);
if (!obj) if (!obj)
return NULL; return nullptr;
obj->setType(templateObject->type()); obj->setType(templateObject->type());
@ -383,19 +383,19 @@ ArrayConcatDense(JSContext *cx, HandleObject obj1, HandleObject obj2, HandleObje
{ {
Rooted<ArrayObject*> arr1(cx, &obj1->as<ArrayObject>()); Rooted<ArrayObject*> arr1(cx, &obj1->as<ArrayObject>());
Rooted<ArrayObject*> arr2(cx, &obj2->as<ArrayObject>()); Rooted<ArrayObject*> arr2(cx, &obj2->as<ArrayObject>());
Rooted<ArrayObject*> arrRes(cx, objRes ? &objRes->as<ArrayObject>() : NULL); Rooted<ArrayObject*> arrRes(cx, objRes ? &objRes->as<ArrayObject>() : nullptr);
if (arrRes) { if (arrRes) {
// Fast path if we managed to allocate an object inline. // Fast path if we managed to allocate an object inline.
if (!js::array_concat_dense(cx, arr1, arr2, arrRes)) if (!js::array_concat_dense(cx, arr1, arr2, arrRes))
return NULL; return nullptr;
return arrRes; return arrRes;
} }
Value argv[] = { UndefinedValue(), ObjectValue(*arr1), ObjectValue(*arr2) }; Value argv[] = { UndefinedValue(), ObjectValue(*arr1), ObjectValue(*arr2) };
AutoValueArray ava(cx, argv, 3); AutoValueArray ava(cx, argv, 3);
if (!js::array_concat(cx, 1, argv)) if (!js::array_concat(cx, 1, argv))
return NULL; return nullptr;
return &argv[0].toObject(); return &argv[0].toObject();
} }
@ -471,7 +471,7 @@ NewSlots(JSRuntime *rt, unsigned nslots)
Value *slots = reinterpret_cast<Value *>(rt->malloc_(nslots * sizeof(Value))); Value *slots = reinterpret_cast<Value *>(rt->malloc_(nslots * sizeof(Value)));
if (!slots) if (!slots)
return NULL; return nullptr;
for (unsigned i = 0; i < nslots; i++) for (unsigned i = 0; i < nslots; i++)
slots[i] = UndefinedValue(); slots[i] = UndefinedValue();
@ -598,8 +598,8 @@ GetDynamicName(JSContext *cx, JSObject *scopeChain, JSString *str, Value *vp)
return; return;
} }
Shape *shape = NULL; Shape *shape = nullptr;
JSObject *scope = NULL, *pobj = NULL; JSObject *scope = nullptr, *pobj = nullptr;
if (LookupNameNoGC(cx, atom->asPropertyName(), scopeChain, &scope, &pobj, &shape)) { if (LookupNameNoGC(cx, atom->asPropertyName(), scopeChain, &scope, &pobj, &shape)) {
if (FetchNameNoGC(pobj, shape, MutableHandleValue::fromMarkedLocation(vp))) if (FetchNameNoGC(pobj, shape, MutableHandleValue::fromMarkedLocation(vp)))
return; return;
@ -762,7 +762,7 @@ InitRestParameter(JSContext *cx, uint32_t length, Value *rest, HandleObject temp
// slots. // slots.
if (length > 0) { if (length > 0) {
if (!arrRes->ensureElements(cx, length)) if (!arrRes->ensureElements(cx, length))
return NULL; return nullptr;
arrRes->setDenseInitializedLength(length); arrRes->setDenseInitializedLength(length);
arrRes->initDenseElements(0, rest, length); arrRes->initDenseElements(0, rest, length);
arrRes->setLengthInt32(length); arrRes->setLengthInt32(length);
@ -773,7 +773,7 @@ InitRestParameter(JSContext *cx, uint32_t length, Value *rest, HandleObject temp
NewObjectKind newKind = templateObj->type()->isLongLivedForJITAlloc() NewObjectKind newKind = templateObj->type()->isLongLivedForJITAlloc()
? TenuredObject ? TenuredObject
: GenericObject; : GenericObject;
ArrayObject *arrRes = NewDenseCopiedArray(cx, length, rest, NULL, newKind); ArrayObject *arrRes = NewDenseCopiedArray(cx, length, rest, nullptr, newKind);
if (arrRes) if (arrRes)
arrRes->setType(templateObj->type()); arrRes->setType(templateObj->type());
return arrRes; return arrRes;

View File

@ -43,10 +43,11 @@ struct PopValues
// Contains information about a virtual machine function that can be called // Contains information about a virtual machine function that can be called
// from JIT code. Functions described in this manner must conform to a simple // from JIT code. Functions described in this manner must conform to a simple
// protocol: the return type must have a special "failure" value (for example, // protocol: the return type must have a special "failure" value (for example,
// false for bool, or NULL for Objects). If the function is designed to return // false for bool, or nullptr for Objects). If the function is designed to
// a value that does not meet this requirement - such as object-or-NULL, or an // return a value that does not meet this requirement - such as
// integer, an optional, final outParam can be specified. In this case, the // object-or-nullptr, or an integer, an optional, final outParam can be
// return type must be boolean to indicate failure. // specified. In this case, the return type must be boolean to indicate
// failure.
// //
// All functions described by VMFunction take a JSContext * as a first // All functions described by VMFunction take a JSContext * as a first
// argument, and are treated as re-entrant into the VM and therefore fallible. // argument, and are treated as re-entrant into the VM and therefore fallible.
@ -92,7 +93,7 @@ struct VMFunction
// constructor. If the C function use an outparam (!= Type_Void), then // constructor. If the C function use an outparam (!= Type_Void), then
// the only valid failure/return type is boolean -- object pointers are // the only valid failure/return type is boolean -- object pointers are
// pointless because the wrapper will only use it to compare it against // pointless because the wrapper will only use it to compare it against
// NULL before discarding its value. // nullptr before discarding its value.
DataType returnType; DataType returnType;
// Note: a maximum of seven root types is supported. // Note: a maximum of seven root types is supported.
@ -188,7 +189,7 @@ struct VMFunction
} }
VMFunction() VMFunction()
: wrapped(NULL), : wrapped(nullptr),
explicitArgs(0), explicitArgs(0),
argumentProperties(0), argumentProperties(0),
argumentPassedInFloatRegs(0), argumentPassedInFloatRegs(0),
@ -555,7 +556,7 @@ class AutoDetectInvalidation
bool disabled_; bool disabled_;
public: public:
AutoDetectInvalidation(JSContext *cx, Value *rval, IonScript *ionScript = NULL) AutoDetectInvalidation(JSContext *cx, Value *rval, IonScript *ionScript = nullptr)
: cx_(cx), : cx_(cx),
ionScript_(ionScript ? ionScript : GetTopIonJSScript(cx)->ionScript()), ionScript_(ionScript ? ionScript : GetTopIonJSScript(cx)->ionScript()),
rval_(rval), rval_(rval),

View File

@ -305,7 +305,7 @@ ValueNumberer::findDominatingDef(InstructionMap &defs, MDefinition *ins, size_t
value.validUntil = index + ins->block()->numDominated(); value.validUntil = index + ins->block()->numDominated();
if(!defs.put(ins->valueNumber(), value)) if(!defs.put(ins->valueNumber(), value))
return NULL; return nullptr;
dom = ins; dom = ins;
} else { } else {
@ -444,7 +444,7 @@ uint32_t
MDefinition::valueNumber() const MDefinition::valueNumber() const
{ {
JS_ASSERT(block_); JS_ASSERT(block_);
if (valueNumber_ == NULL) if (valueNumber_ == nullptr)
return 0; return 0;
return valueNumber_->valueNumber(); return valueNumber_->valueNumber();
} }
@ -464,7 +464,7 @@ MDefinition *
ValueNumberer::findSplit(MDefinition *def) ValueNumberer::findSplit(MDefinition *def)
{ {
for (MDefinition *vncheck = def->valueNumberData()->classNext; for (MDefinition *vncheck = def->valueNumberData()->classNext;
vncheck != NULL; vncheck != nullptr;
vncheck = vncheck->valueNumberData()->classNext) { vncheck = vncheck->valueNumberData()->classNext) {
if (!def->congruentTo(vncheck)) { if (!def->congruentTo(vncheck)) {
IonSpew(IonSpew_GVN, "Proceeding with split because %d is not congruent to %d", IonSpew(IonSpew_GVN, "Proceeding with split because %d is not congruent to %d",
@ -472,7 +472,7 @@ ValueNumberer::findSplit(MDefinition *def)
return vncheck; return vncheck;
} }
} }
return NULL; return nullptr;
} }
void void
@ -481,9 +481,9 @@ ValueNumberer::breakClass(MDefinition *def)
if (def->valueNumber() == def->id()) { if (def->valueNumber() == def->id()) {
IonSpew(IonSpew_GVN, "Breaking congruence with itself: %d", def->id()); IonSpew(IonSpew_GVN, "Breaking congruence with itself: %d", def->id());
ValueNumberData *defdata = def->valueNumberData(); ValueNumberData *defdata = def->valueNumberData();
JS_ASSERT(defdata->classPrev == NULL); JS_ASSERT(defdata->classPrev == nullptr);
// If the def was the only member of the class, then there is nothing to do. // If the def was the only member of the class, then there is nothing to do.
if (defdata->classNext == NULL) if (defdata->classNext == nullptr)
return; return;
// If upon closer inspection, we are still equivalent to this class // If upon closer inspection, we are still equivalent to this class
// then there isn't anything for us to do. // then there isn't anything for us to do.
@ -510,10 +510,10 @@ ValueNumberer::breakClass(MDefinition *def)
//lastOld is now the last element of the old list (congruent to //lastOld is now the last element of the old list (congruent to
//|def|) //|def|)
lastOld->valueNumberData()->classNext = NULL; lastOld->valueNumberData()->classNext = nullptr;
#ifdef DEBUG #ifdef DEBUG
for (MDefinition *tmp = def; tmp != NULL; tmp = tmp->valueNumberData()->classNext) { for (MDefinition *tmp = def; tmp != nullptr; tmp = tmp->valueNumberData()->classNext) {
JS_ASSERT(tmp->valueNumber() == def->valueNumber()); JS_ASSERT(tmp->valueNumber() == def->valueNumber());
JS_ASSERT(tmp->congruentTo(def)); JS_ASSERT(tmp->congruentTo(def));
JS_ASSERT(tmp != newRep); JS_ASSERT(tmp != newRep);
@ -522,11 +522,11 @@ ValueNumberer::breakClass(MDefinition *def)
//|newRep| is now the first element of a new list, therefore it is the //|newRep| is now the first element of a new list, therefore it is the
//new canonical element. Mark the remaining elements in the list //new canonical element. Mark the remaining elements in the list
//(including |newRep|) //(including |newRep|)
newdata->classPrev = NULL; newdata->classPrev = nullptr;
IonSpew(IonSpew_GVN, "Choosing a new representative: %d", newRep->id()); IonSpew(IonSpew_GVN, "Choosing a new representative: %d", newRep->id());
// make the VN of every member in the class the VN of the new representative number. // make the VN of every member in the class the VN of the new representative number.
for (MDefinition *tmp = newRep; tmp != NULL; tmp = tmp->valueNumberData()->classNext) { for (MDefinition *tmp = newRep; tmp != nullptr; tmp = tmp->valueNumberData()->classNext) {
// if this instruction is already scheduled to be processed, don't do anything. // if this instruction is already scheduled to be processed, don't do anything.
if (tmp->isInWorklist()) if (tmp->isInWorklist())
continue; continue;
@ -551,7 +551,7 @@ ValueNumberer::breakClass(MDefinition *def)
defdata->classNext->valueNumberData()->classPrev = defdata->classPrev; defdata->classNext->valueNumberData()->classPrev = defdata->classPrev;
// Make sure there is no nastinees accidentally linking elements into the old list later. // Make sure there is no nastinees accidentally linking elements into the old list later.
defdata->classPrev = NULL; defdata->classPrev = nullptr;
defdata->classNext = NULL; defdata->classNext = nullptr;
} }
} }

View File

@ -96,7 +96,7 @@ class ValueNumberData : public TempObject {
MDefinition *classPrev; MDefinition *classPrev;
public: public:
ValueNumberData() : number(0), classNext(NULL), classPrev(NULL) {} ValueNumberData() : number(0), classNext(nullptr), classPrev(nullptr) {}
void setValueNumber(uint32_t number_) { void setValueNumber(uint32_t number_) {
number = number_; number = number_;