Bug 998170 - IonMonkey: Eliminate LPhi's numInputs_ member. r=nbp

This commit is contained in:
Dan Gohman 2014-04-18 11:13:44 -07:00
Родитель ad4273ba8f
Коммит 20f5665364
4 изменённых файлов: 13 добавлений и 23 удалений

Просмотреть файл

@ -325,7 +325,7 @@ BacktrackingAllocator::groupAndQueueRegisters()
for (size_t j = 0; j < block->numPhis(); j++) {
LPhi *phi = block->getPhi(j);
uint32_t output = phi->getDef(0)->virtualRegister();
for (size_t k = 0; k < phi->numOperands(); k++) {
for (size_t k = 0, kend = phi->numOperands(); k < kend; k++) {
uint32_t input = phi->getOperand(k)->toUse()->virtualRegister();
if (!tryGroupRegisters(input, output))
return false;

Просмотреть файл

@ -5587,13 +5587,11 @@ class MPhi;
// corresponding to the predecessor taken in the control flow graph.
class LPhi MOZ_FINAL : public LInstruction
{
uint32_t numInputs_;
LAllocation *inputs_;
LDefinition def_;
bool init(MIRGenerator *gen);
LPhi(MPhi *mir);
LPhi()
{ }
public:
LIR_HEADER(Phi)
@ -5612,7 +5610,7 @@ class LPhi MOZ_FINAL : public LInstruction
def_ = def;
}
size_t numOperands() const {
return numInputs_;
return mir_->toPhi()->numOperands();
}
LAllocation *getOperand(size_t index) {
JS_ASSERT(index < numOperands());

Просмотреть файл

@ -197,24 +197,16 @@ LSnapshot::rewriteRecoveredInput(LUse input)
}
}
bool
LPhi::init(MIRGenerator *gen)
{
inputs_ = gen->allocate<LAllocation>(numInputs_);
return !!inputs_;
}
LPhi::LPhi(MPhi *mir)
: numInputs_(mir->numOperands())
{
}
LPhi *
LPhi::New(MIRGenerator *gen, MPhi *ins)
{
LPhi *phi = new(gen->alloc()) LPhi(ins);
if (!phi->init(gen))
LPhi *phi = new (gen->alloc()) LPhi();
LAllocation *inputs = gen->allocate<LAllocation>(ins->numOperands());
if (!inputs)
return nullptr;
phi->inputs_ = inputs;
phi->setMir(ins);
return phi;
}

Просмотреть файл

@ -42,7 +42,7 @@ AllocationIntegrityState::record()
virtualRegisters[vreg] = phi->getDef(0);
if (!info.outputs.append(*phi->getDef(0)))
return false;
for (size_t k = 0; k < phi->numOperands(); k++) {
for (size_t k = 0, kend = phi->numOperands(); k < kend; k++) {
if (!info.inputs.append(*phi->getOperand(k)))
return false;
}
@ -232,7 +232,7 @@ AllocationIntegrityState::checkIntegrity(LBlock *block, LInstruction *ins,
const InstructionInfo &info = blocks[block->mir()->id()].phis[i];
LPhi *phi = block->getPhi(i);
if (info.outputs[0].virtualRegister() == vreg) {
for (size_t j = 0; j < phi->numOperands(); j++) {
for (size_t j = 0, jend = phi->numOperands(); j < jend; j++) {
uint32_t newvreg = info.inputs[j].toUse()->virtualRegister();
LBlock *predecessor = graph.getBlock(block->mir()->getPredecessor(j)->id());
if (!addPredecessor(predecessor, newvreg, alloc))
@ -244,7 +244,7 @@ AllocationIntegrityState::checkIntegrity(LBlock *block, LInstruction *ins,
// No phi which defined the vreg we are tracking, follow back through all
// predecessors with the existing vreg.
for (size_t i = 0; i < block->mir()->numPredecessors(); i++) {
for (size_t i = 0, iend = block->mir()->numPredecessors(); i < iend; i++) {
LBlock *predecessor = graph.getBlock(block->mir()->getPredecessor(i)->id());
if (!addPredecessor(predecessor, vreg, alloc))
return false;