Skip to content

Commit

Permalink
Bug 784739 - Switch from NULL to nullptr in js/src/jit/ (2/7); r=ehsan
Browse files Browse the repository at this point in the history
--HG--
extra : rebase_source : fc48d50cbd18c872babf1d50fd922178e138c8a6
  • Loading branch information
poiru committed Sep 27, 2013
1 parent df88dfd commit bbb09d4
Show file tree
Hide file tree
Showing 17 changed files with 148 additions and 145 deletions.
106 changes: 54 additions & 52 deletions js/src/jit/BaselineIC.cpp

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions js/src/jit/BaselineInspector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,15 +140,15 @@ ICStub *
BaselineInspector::monomorphicStub(jsbytecode *pc)
{
if (!hasBaselineScript())
return NULL;
return nullptr;

const ICEntry &entry = icEntryFromPC(pc);

ICStub *stub = entry.firstStub();
ICStub *next = stub->next();

if (!next || !next->isFallback())
return NULL;
return nullptr;

return stub;
}
Expand All @@ -163,7 +163,7 @@ BaselineInspector::dimorphicStub(jsbytecode *pc, ICStub **pfirst, ICStub **pseco

ICStub *stub = entry.firstStub();
ICStub *next = stub->next();
ICStub *after = next ? next->next() : NULL;
ICStub *after = next ? next->next() : nullptr;

if (!after || !after->isFallback())
return false;
Expand Down Expand Up @@ -222,7 +222,7 @@ CanUseInt32Compare(ICStub::Kind kind)
MCompare::CompareType
BaselineInspector::expectedCompareType(jsbytecode *pc)
{
ICStub *first = monomorphicStub(pc), *second = NULL;
ICStub *first = monomorphicStub(pc), *second = nullptr;
if (!first && !dimorphicStub(pc, &first, &second))
return MCompare::Compare_Unknown;

Expand All @@ -235,7 +235,7 @@ BaselineInspector::expectedCompareType(jsbytecode *pc)
? first->toCompare_NumberWithUndefined()
: (second && second->isCompare_NumberWithUndefined())
? second->toCompare_NumberWithUndefined()
: NULL;
: nullptr;
if (coerce) {
return coerce->lhsIsUndefined()
? MCompare::Compare_DoubleMaybeCoerceLHS
Expand Down
4 changes: 2 additions & 2 deletions js/src/jit/BaselineInspector.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class BaselineInspector

public:
BaselineInspector(JSContext *cx, JSScript *rawScript)
: script(cx, rawScript), prevLookedUpEntry(NULL)
: script(cx, rawScript), prevLookedUpEntry(nullptr)
{
JS_ASSERT(script);
}
Expand Down Expand Up @@ -82,7 +82,7 @@ class BaselineInspector

template <typename ICInspectorType>
ICInspectorType makeICInspector(jsbytecode *pc, ICStub::Kind expectedFallbackKind) {
ICEntry *ent = NULL;
ICEntry *ent = nullptr;
if (hasBaselineScript()) {
ent = &icEntryFromPC(pc);
JS_ASSERT(ent->fallbackStub()->kind() == expectedFallbackKind);
Expand Down
18 changes: 9 additions & 9 deletions js/src/jit/BaselineJIT.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ PCMappingSlotInfo::ToSlotLocation(const StackValue *stackVal)
}

BaselineScript::BaselineScript(uint32_t prologueOffset, uint32_t spsPushToggleOffset)
: method_(NULL),
: method_(nullptr),
fallbackStubSpace_(),
prologueOffset_(prologueOffset),
#ifdef DEBUG
Expand Down Expand Up @@ -106,7 +106,7 @@ EnterBaseline(JSContext *cx, EnterJitData &data)
data.result.setInt32(data.numActualArgs);
{
AssertCompartmentUnchanged pcc(cx);
IonContext ictx(cx, NULL);
IonContext ictx(cx, nullptr);
JitActivation activation(cx, data.constructing);
JSAutoResolveFlags rf(cx, RESOLVE_INFER);
AutoFlushInhibitor afi(cx->runtime()->ionRuntime());
Expand Down Expand Up @@ -182,7 +182,7 @@ jit::EnterBaselineAtBranch(JSContext *cx, StackFrame *fp, jsbytecode *pc)
data.numActualArgs = fp->numActualArgs();
data.maxArgc = Max(fp->numActualArgs(), fp->numFormalArgs()) + 1; // +1 = include |this|
data.maxArgv = fp->argv() - 1; // -1 = include |this|
data.scopeChain = NULL;
data.scopeChain = nullptr;
data.calleeToken = CalleeToToken(&fp->callee());
} else {
thisv = fp->thisValue();
Expand Down Expand Up @@ -376,7 +376,7 @@ BaselineScript::New(JSContext *cx, uint32_t prologueOffset,

uint8_t *buffer = (uint8_t *)cx->malloc_(allocBytes);
if (!buffer)
return NULL;
return nullptr;

BaselineScript *script = reinterpret_cast<BaselineScript *>(buffer);
new (script) BaselineScript(prologueOffset, spsPushToggleOffset);
Expand Down Expand Up @@ -477,10 +477,10 @@ BaselineScript::maybeICEntryFromReturnOffset(CodeOffsetLabel returnOffset)
mid = bottom + (top - bottom) / 2;
}
if (mid >= numICEntries())
return NULL;
return nullptr;

if (icEntry(mid).returnOffset().offset() != returnOffset.offset())
return NULL;
return nullptr;

return &icEntry(mid);
}
Expand Down Expand Up @@ -737,7 +737,7 @@ BaselineScript::toggleDebugTraps(JSScript *script, jsbytecode *pc)
SrcNoteLineScanner scanner(script->notes(), script->lineno);

JSRuntime *rt = script->runtimeFromMainThread();
IonContext ictx(rt, script->compartment(), NULL);
IonContext ictx(rt, script->compartment(), nullptr);
AutoFlushCache afc("DebugTraps", rt->ionRuntime());

for (uint32_t i = 0; i < numPCMappingIndexEntries(); i++) {
Expand Down Expand Up @@ -807,7 +807,7 @@ BaselineScript::purgeOptimizedStubs(Zone *zone)
if (lastStub->isFallback()) {
// Unlink all stubs allocated in the optimized space.
ICStub *stub = entry.firstStub();
ICStub *prev = NULL;
ICStub *prev = nullptr;

while (stub->next()) {
if (!stub->allocatedInFallbackSpace()) {
Expand Down Expand Up @@ -868,7 +868,7 @@ jit::FinishDiscardBaselineScript(FreeOp *fop, JSScript *script)
}

BaselineScript *baseline = script->baselineScript();
script->setBaselineScript(NULL);
script->setBaselineScript(nullptr);
BaselineScript::Destroy(fop, baseline);
}

Expand Down
6 changes: 3 additions & 3 deletions js/src/jit/BaselineJIT.h
Original file line number Diff line number Diff line change
Expand Up @@ -250,12 +250,12 @@ struct BaselineScript
void copyPCMappingIndexEntries(const PCMappingIndexEntry *entries);

void copyPCMappingEntries(const CompactBufferWriter &entries);
uint8_t *nativeCodeForPC(JSScript *script, jsbytecode *pc, PCMappingSlotInfo *slotInfo = NULL);
uint8_t *nativeCodeForPC(JSScript *script, jsbytecode *pc, PCMappingSlotInfo *slotInfo = nullptr);
jsbytecode *pcForReturnOffset(JSScript *script, uint32_t nativeOffset);
jsbytecode *pcForReturnAddress(JSScript *script, uint8_t *nativeAddress);

// Toggle debug traps (used for breakpoints and step mode) in the script.
// If |pc| is NULL, toggle traps for all ops in the script. Else, only
// If |pc| is nullptr, toggle traps for all ops in the script. Else, only
// toggle traps at |pc|.
void toggleDebugTraps(JSScript *script, jsbytecode *pc);

Expand Down Expand Up @@ -341,7 +341,7 @@ struct BaselineBailoutInfo
uint32_t
BailoutIonToBaseline(JSContext *cx, JitActivation *activation, IonBailoutIterator &iter,
bool invalidate, BaselineBailoutInfo **bailoutInfo,
const ExceptionBailoutInfo *exceptionInfo = NULL);
const ExceptionBailoutInfo *exceptionInfo = nullptr);

// Mark baseline scripts on the stack as active, so that they are not discarded
// during GC.
Expand Down
2 changes: 1 addition & 1 deletion js/src/jit/BitSet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ BitSet::New(unsigned int max)
{
BitSet *result = new BitSet(max);
if (!result->init())
return NULL;
return nullptr;
return result;
}

Expand Down
2 changes: 1 addition & 1 deletion js/src/jit/BitSet.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class BitSet : private TempObject
private:
BitSet(unsigned int max) :
max_(max),
bits_(NULL) {}
bits_(nullptr) {}

unsigned int max_;
uint32_t *bits_;
Expand Down
2 changes: 1 addition & 1 deletion js/src/jit/BytecodeAnalysis.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class BytecodeAnalysis
BytecodeInfo *maybeInfo(jsbytecode *pc) {
if (infos_[pc - script_->code].initialized)
return &infos_[pc - script_->code];
return NULL;
return nullptr;
}

bool usesScopeChain() {
Expand Down
4 changes: 2 additions & 2 deletions js/src/jit/C1Spewer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ bool
C1Spewer::init(const char *path)
{
spewout_ = fopen(path, "w");
return (spewout_ != NULL);
return (spewout_ != nullptr);
}

void
Expand All @@ -41,7 +41,7 @@ C1Spewer::beginFunction(MIRGraph *graph, HandleScript script)
fprintf(spewout_, " name \"asm.js compilation\"\n");
fprintf(spewout_, " method \"asm.js compilation\"\n");
}
fprintf(spewout_, " date %d\n", (int)time(NULL));
fprintf(spewout_, " date %d\n", (int)time(nullptr));
fprintf(spewout_, "end_compilation\n");
}

Expand Down
2 changes: 1 addition & 1 deletion js/src/jit/C1Spewer.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class C1Spewer

public:
C1Spewer()
: graph(NULL), script(NullPtr()), spewout_(NULL)
: graph(nullptr), script(NullPtr()), spewout_(nullptr)
{ }

bool init(const char *path);
Expand Down
Loading

0 comments on commit bbb09d4

Please sign in to comment.