mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-02 15:15:23 +00:00
Bug 762891 - Specialize more phis in some edge cases. r=dvander
This commit is contained in:
parent
b66b17ef6a
commit
867d4444a7
@ -245,8 +245,16 @@ GuessPhiType(MPhi *phi)
|
||||
MIRType type = MIRType_None;
|
||||
for (size_t i = 0; i < phi->numOperands(); i++) {
|
||||
MDefinition *in = phi->getOperand(i);
|
||||
if (in->isPhi() && !in->toPhi()->triedToSpecialize())
|
||||
continue;
|
||||
if (in->isPhi()) {
|
||||
if (!in->toPhi()->triedToSpecialize())
|
||||
continue;
|
||||
if (in->type() == MIRType_None) {
|
||||
// The operand is a phi we tried to specialize, but we were
|
||||
// unable to guess its type. propagateSpecialization will
|
||||
// propagate the type to this phi when it becomes known.
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (type == MIRType_None) {
|
||||
type = in->type();
|
||||
continue;
|
||||
@ -274,6 +282,8 @@ TypeAnalyzer::respecialize(MPhi *phi, MIRType type)
|
||||
bool
|
||||
TypeAnalyzer::propagateSpecialization(MPhi *phi)
|
||||
{
|
||||
JS_ASSERT(phi->type() != MIRType_None);
|
||||
|
||||
// Verify that this specialization matches any phis depending on it.
|
||||
for (MUseDefIterator iter(phi); iter; iter++) {
|
||||
if (!iter.def()->isPhi())
|
||||
@ -311,7 +321,15 @@ TypeAnalyzer::specializePhis()
|
||||
{
|
||||
for (PostorderIterator block(graph.poBegin()); block != graph.poEnd(); block++) {
|
||||
for (MPhiIterator phi(block->phisBegin()); phi != block->phisEnd(); phi++) {
|
||||
phi->specialize(GuessPhiType(*phi));
|
||||
MIRType type = GuessPhiType(*phi);
|
||||
phi->specialize(type);
|
||||
if (type == MIRType_None) {
|
||||
// We tried to guess the type but failed because all operands are
|
||||
// phis we still have to visit. Set the triedToSpecialize flag but
|
||||
// don't propagate the type to other phis, propagateSpecialization
|
||||
// will do that once we know the type of one of the operands.
|
||||
continue;
|
||||
}
|
||||
if (!propagateSpecialization(*phi))
|
||||
return false;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user