Bug 901391 - Fix specializing phis with cold inputs that aren't MIRType_Value. (r=jandem)

This commit is contained in:
Shu-yu Guo 2013-08-07 15:38:25 -07:00
parent 2b436f2b47
commit 8375a98dd7
2 changed files with 16 additions and 1 deletions

View File

@ -541,7 +541,7 @@ TypeAnalyzer::adjustPhiInputs(MPhi *phi)
// If we specialized a type that's not Value, either every input is of
// that type or the input's typeset was unobserved (i.e. the opcode hasn't
// been executed yet.) Be optimistic and insert unboxes.
// been executed yet.)
if (phiType != MIRType_Value) {
for (size_t i = 0, e = phi->numOperands(); i < e; i++) {
MDefinition *in = phi->getOperand(i);
@ -551,6 +551,17 @@ TypeAnalyzer::adjustPhiInputs(MPhi *phi)
if (in->isBox() && in->toBox()->input()->type() == phiType) {
phi->replaceOperand(i, in->toBox()->input());
} else {
// If we know this branch will fail to convert to phiType,
// insert a box that'll immediately fail in the fallible unbox
// below.
if (in->type() != MIRType_Value) {
MBox *box = MBox::New(in);
in->block()->insertBefore(in->block()->lastIns(), box);
in = box;
}
// Be optimistic and insert unboxes when the operand is a
// value.
MUnbox *unbox = MUnbox::New(in, phiType, MUnbox::Fallible);
in->block()->insertBefore(in->block()->lastIns(), unbox);
phi->replaceOperand(i, unbox);

View File

@ -0,0 +1,4 @@
function testPartition() {
if( "null" || new testPartition()) {}
}
testPartition();