Bug 1304672: Rename MBasicBlock::NewAsmJS into MBasicBlock::New; r?luke
(and setBackedgeAsmJS to setBackedgeWasm)
MozReview-Commit-ID: n86nANp8TI
--- a/js/src/asmjs/WasmIonCompile.cpp
+++ b/js/src/asmjs/WasmIonCompile.cpp
@@ -1341,18 +1341,18 @@ class FunctionCompiler
blockDepth_++;
loopDepth_++;
if (inDeadCode())
return true;
// Create the loop header.
MOZ_ASSERT(curBlock_->loopDepth() == loopDepth_ - 1);
- *loopHeader = MBasicBlock::NewAsmJS(mirGraph(), info(), curBlock_,
- MBasicBlock::PENDING_LOOP_HEADER);
+ *loopHeader = MBasicBlock::New(mirGraph(), info(), curBlock_,
+ MBasicBlock::PENDING_LOOP_HEADER);
if (!*loopHeader)
return false;
(*loopHeader)->setLoopDepth(loopDepth_);
mirGraph().addBlock(*loopHeader);
curBlock_->end(MGoto::New(alloc(), *loopHeader));
MBasicBlock* body;
@@ -1369,17 +1369,17 @@ class FunctionCompiler
MDefinition* def = b->getSlot(i);
if (def->isUnused())
b->setSlot(i, def->toPhi()->getOperand(0));
}
}
bool setLoopBackedge(MBasicBlock* loopEntry, MBasicBlock* loopBody, MBasicBlock* backedge)
{
- if (!loopEntry->setBackedgeAsmJS(backedge))
+ if (!loopEntry->setBackedgeWasm(backedge))
return false;
// Flag all redundant phis as unused.
for (MPhiIterator phi = loopEntry->phisBegin(); phi != loopEntry->phisEnd(); phi++) {
MOZ_ASSERT(phi->numOperands() == 2);
if (phi->getOperand(0) == phi->getOperand(1))
phi->setUnused();
}
@@ -1581,17 +1581,17 @@ class FunctionCompiler
}
bool done() const { return iter_.done(); }
/*************************************************************************/
private:
bool newBlock(MBasicBlock* pred, MBasicBlock** block)
{
- *block = MBasicBlock::NewAsmJS(mirGraph(), info(), pred, MBasicBlock::NORMAL);
+ *block = MBasicBlock::New(mirGraph(), info(), pred, MBasicBlock::NORMAL);
if (!*block)
return false;
mirGraph().addBlock(*block);
(*block)->setLoopDepth(loopDepth_);
return true;
}
bool goToNewBlock(MBasicBlock* pred, MBasicBlock** block)
--- a/js/src/jit/LoopUnroller.cpp
+++ b/js/src/jit/LoopUnroller.cpp
@@ -214,19 +214,19 @@ LoopUnroller::go(LoopIterationBound* bou
oldPreheader, header->trackedSite(), MBasicBlock::LOOP_HEADER);
unrolledBackedge =
MBasicBlock::New(graph, nullptr, info,
unrolledHeader, backedge->trackedSite(), MBasicBlock::NORMAL);
newPreheader =
MBasicBlock::New(graph, nullptr, info,
unrolledHeader, oldPreheader->trackedSite(), MBasicBlock::NORMAL);
} else {
- unrolledHeader = MBasicBlock::NewAsmJS(graph, info, oldPreheader, MBasicBlock::LOOP_HEADER);
- unrolledBackedge = MBasicBlock::NewAsmJS(graph, info, unrolledHeader, MBasicBlock::NORMAL);
- newPreheader = MBasicBlock::NewAsmJS(graph, info, unrolledHeader, MBasicBlock::NORMAL);
+ unrolledHeader = MBasicBlock::New(graph, info, oldPreheader, MBasicBlock::LOOP_HEADER);
+ unrolledBackedge = MBasicBlock::New(graph, info, unrolledHeader, MBasicBlock::NORMAL);
+ newPreheader = MBasicBlock::New(graph, info, unrolledHeader, MBasicBlock::NORMAL);
}
unrolledHeader->discardAllResumePoints();
unrolledBackedge->discardAllResumePoints();
newPreheader->discardAllResumePoints();
// Insert new blocks at their RPO position, and update block ids.
graph.insertBlockAfter(oldPreheader, unrolledHeader);
--- a/js/src/jit/MIRGraph.cpp
+++ b/js/src/jit/MIRGraph.cpp
@@ -274,18 +274,18 @@ MBasicBlock::NewPendingLoopHeader(MIRGra
return block;
}
MBasicBlock*
MBasicBlock::NewSplitEdge(MIRGraph& graph, const CompileInfo& info, MBasicBlock* pred, size_t predEdgeIdx, MBasicBlock* succ)
{
MBasicBlock* split = nullptr;
if (!pred->pc()) {
- // The predecessor does not have a PC, this is an AsmJS compilation.
- split = MBasicBlock::NewAsmJS(graph, info, pred, SPLIT_EDGE);
+ // The predecessor does not have a PC, this is a Wasm compilation.
+ split = MBasicBlock::New(graph, info, pred, SPLIT_EDGE);
if (!split)
return nullptr;
} else {
// The predecessor has a PC, this is an IonBuilder compilation.
MResumePoint* succEntry = succ->entryResumePoint();
BytecodeSite* site = new(graph.alloc()) BytecodeSite(succ->trackedTree(), succEntry->pc());
split = new(graph.alloc()) MBasicBlock(graph, info, site, SPLIT_EDGE);
@@ -324,18 +324,18 @@ MBasicBlock::NewSplitEdge(MIRGraph& grap
// any entry resume point.
MOZ_ASSERT_IF(def->block() == succ, def->isPhi());
if (def->block() == succ)
def = def->toPhi()->getOperand(succEdgeIdx);
splitEntry->initOperand(i, def);
}
- // This is done in the NewAsmJS, so we cannot keep this line below,
- // where the rest of the graph is modified.
+ // This is done in the New variant for wasm, so we cannot keep this
+ // line below, where the rest of the graph is modified.
if (!split->predecessors_.append(pred))
return nullptr;
}
split->setLoopDepth(succ->loopDepth());
// Insert the split edge block in-between.
split->end(MGoto::New(graph.alloc(), succ));
@@ -343,17 +343,17 @@ MBasicBlock::NewSplitEdge(MIRGraph& grap
graph.insertBlockAfter(pred, split);
pred->replaceSuccessor(predEdgeIdx, split);
succ->replacePredecessor(pred, split);
return split;
}
MBasicBlock*
-MBasicBlock::NewAsmJS(MIRGraph& graph, const CompileInfo& info, MBasicBlock* pred, Kind kind)
+MBasicBlock::New(MIRGraph& graph, const CompileInfo& info, MBasicBlock* pred, Kind kind)
{
BytecodeSite* site = new(graph.alloc()) BytecodeSite();
MBasicBlock* block = new(graph.alloc()) MBasicBlock(graph, info, site, kind);
if (!block->init())
return nullptr;
if (pred) {
block->stackPosition_ = pred->stackPosition_;
@@ -1257,29 +1257,29 @@ MBasicBlock::setBackedge(TempAllocator&
if (!predecessors_.append(pred))
return AbortReason_Alloc;
return AbortReason_NoAbort;
}
bool
-MBasicBlock::setBackedgeAsmJS(MBasicBlock* pred)
+MBasicBlock::setBackedgeWasm(MBasicBlock* pred)
{
// Predecessors must be finished, and at the correct stack depth.
MOZ_ASSERT(hasLastIns());
MOZ_ASSERT(pred->hasLastIns());
MOZ_ASSERT(stackDepth() == pred->stackDepth());
// We must be a pending loop header
MOZ_ASSERT(kind_ == PENDING_LOOP_HEADER);
// Add exit definitions to each corresponding phi at the entry.
// Note: Phis are inserted in the same order as the slots. (see
- // MBasicBlock::NewAsmJS)
+ // MBasicBlock::New)
size_t slot = 0;
for (MPhiIterator phi = phisBegin(); phi != phisEnd(); phi++, slot++) {
MPhi* entryDef = *phi;
MDefinition* exitDef = pred->getSlot(slot);
// Assert that we already placed phis for each slot.
MOZ_ASSERT(entryDef->block() == this);
--- a/js/src/jit/MIRGraph.h
+++ b/js/src/jit/MIRGraph.h
@@ -103,29 +103,28 @@ class MBasicBlock : public TempObject, p
///////////////////////////////////////////////////////
////////// BEGIN GRAPH BUILDING INSTRUCTIONS //////////
///////////////////////////////////////////////////////
// Creates a new basic block for a MIR generator. If |pred| is not nullptr,
// its slots and stack depth are initialized from |pred|.
static MBasicBlock* New(MIRGraph& graph, BytecodeAnalysis* analysis, const CompileInfo& info,
MBasicBlock* pred, BytecodeSite* site, Kind kind);
+ static MBasicBlock* New(MIRGraph& graph, const CompileInfo& info, MBasicBlock* pred, Kind kind);
static MBasicBlock* NewPopN(MIRGraph& graph, const CompileInfo& info,
MBasicBlock* pred, BytecodeSite* site, Kind kind, uint32_t popn);
static MBasicBlock* NewWithResumePoint(MIRGraph& graph, const CompileInfo& info,
MBasicBlock* pred, BytecodeSite* site,
MResumePoint* resumePoint);
static MBasicBlock* NewPendingLoopHeader(MIRGraph& graph, const CompileInfo& info,
MBasicBlock* pred, BytecodeSite* site,
unsigned loopStateSlots);
static MBasicBlock* NewSplitEdge(MIRGraph& graph, const CompileInfo& info,
MBasicBlock* pred, size_t predEdgeIdx,
MBasicBlock* succ);
- static MBasicBlock* NewAsmJS(MIRGraph& graph, const CompileInfo& info,
- MBasicBlock* pred, Kind kind);
bool dominates(const MBasicBlock* other) const {
return other->domIndex() - domIndex() < numDominated();
}
void setId(uint32_t id) {
id_ = id;
}
@@ -251,17 +250,17 @@ class MBasicBlock : public TempObject, p
// Resets all the dominator info so that it can be recomputed.
void clearDominatorInfo();
// Sets a back edge. This places phi nodes and rewrites instructions within
// the current loop as necessary. If the backedge introduces new types for
// phis at the loop header, returns a disabling abort.
MOZ_MUST_USE AbortReason setBackedge(TempAllocator& alloc, MBasicBlock* block);
- MOZ_MUST_USE bool setBackedgeAsmJS(MBasicBlock* block);
+ MOZ_MUST_USE bool setBackedgeWasm(MBasicBlock* block);
// Resets a LOOP_HEADER block to a NORMAL block. This is needed when
// optimizations remove the backedge.
void clearLoopHeader();
// Sets a block to a LOOP_HEADER block, with newBackedge as its backedge.
// This is needed when optimizations remove the normal entry to a loop
// with multiple entries.
--- a/js/src/jit/ValueNumbering.cpp
+++ b/js/src/jit/ValueNumbering.cpp
@@ -426,18 +426,17 @@ bool
ValueNumberer::fixupOSROnlyLoop(MBasicBlock* block, MBasicBlock* backedge)
{
// Create an empty and unreachable(!) block which jumps to |block|. This
// allows |block| to remain marked as a loop header, so we don't have to
// worry about moving a different block into place as the new loop header,
// which is hard, especially if the OSR is into a nested loop. Doing all
// that would produce slightly more optimal code, but this is so
// extraordinarily rare that it isn't worth the complexity.
- MBasicBlock* fake = MBasicBlock::NewAsmJS(graph_, block->info(),
- nullptr, MBasicBlock::NORMAL);
+ MBasicBlock* fake = MBasicBlock::New(graph_, block->info(), nullptr, MBasicBlock::NORMAL);
if (fake == nullptr)
return false;
graph_.insertBlockBefore(block, fake);
fake->setImmediateDominator(fake);
fake->addNumDominated(1);
fake->setDomIndex(fake->id());
fake->setUnreachable();
--- a/js/src/jsapi-tests/testJitMinimalFunc.h
+++ b/js/src/jsapi-tests/testJitMinimalFunc.h
@@ -45,32 +45,32 @@ struct MinimalFunc : MinimalAlloc
graph(&alloc),
mir(static_cast<CompileCompartment*>(nullptr), options, &alloc, &graph,
&info, static_cast<const OptimizationInfo*>(nullptr)),
numParams(0)
{ }
MBasicBlock* createEntryBlock()
{
- MBasicBlock* block = MBasicBlock::NewAsmJS(graph, info, nullptr, MBasicBlock::NORMAL);
+ MBasicBlock* block = MBasicBlock::New(graph, info, nullptr, MBasicBlock::NORMAL);
graph.addBlock(block);
return block;
}
MBasicBlock* createOsrEntryBlock()
{
- MBasicBlock* block = MBasicBlock::NewAsmJS(graph, info, nullptr, MBasicBlock::NORMAL);
+ MBasicBlock* block = MBasicBlock::New(graph, info, nullptr, MBasicBlock::NORMAL);
graph.addBlock(block);
graph.setOsrBlock(block);
return block;
}
MBasicBlock* createBlock(MBasicBlock* pred)
{
- MBasicBlock* block = MBasicBlock::NewAsmJS(graph, info, pred, MBasicBlock::NORMAL);
+ MBasicBlock* block = MBasicBlock::New(graph, info, pred, MBasicBlock::NORMAL);
graph.addBlock(block);
return block;
}
MParameter* createParameter()
{
MParameter* p = MParameter::New(alloc, numParams++, nullptr);
return p;