Bug 870095 - Prefer clobbering binary operands with no further uses. r=h4writer

This commit is contained in:
Sean Stangl 2013-05-08 16:42:50 -07:00
parent 7dea1ba01d
commit af63beda97

View File

@ -858,8 +858,10 @@ ReorderCommutative(MDefinition **lhsp, MDefinition **rhsp)
MDefinition *lhs = *lhsp;
MDefinition *rhs = *rhsp;
// Put the constant in the right-hand side, if there is one.
if (lhs->isConstant()) {
// Ensure that if there is a constant, then it is in rhs.
// In addition, since clobbering binary operations clobber the left
// operand, prefer a lhs operand with no further uses.
if (lhs->isConstant() || rhs->useCount() == 1) {
*rhsp = lhs;
*lhsp = rhs;
}
@ -1156,6 +1158,7 @@ LIRGenerator::visitAdd(MAdd *ins)
if (ins->specialization() == MIRType_Double) {
JS_ASSERT(lhs->type() == MIRType_Double);
ReorderCommutative(&lhs, &rhs);
return lowerForFPU(new LMathD(JSOP_ADD), ins, lhs, rhs);
}