Bug 891070 - IonMonkey: Reimplement MUrsh::canOverflow using range information. r=nbp

This commit is contained in:
Dan Gohman 2013-07-08 20:24:56 -07:00
parent 450e204ccf
commit 4538c73709
2 changed files with 9 additions and 19 deletions

View File

@ -1290,6 +1290,14 @@ MMul::canOverflow()
return !range() || !range()->isInt32();
}
bool
MUrsh::canOverflow()
{
if (!canOverflow_)
return false;
return !range() || !range()->isInt32();
}
static inline bool
KnownNonStringPrimitive(MDefinition *op)
{

View File

@ -2895,25 +2895,7 @@ class MUrsh : public MShiftInstruction
void infer(BaselineInspector *inspector, jsbytecode *pc);
bool canOverflow() {
// solution is only negative when lhs < 0 and rhs & 0x1f == 0
MDefinition *lhs = getOperand(0);
MDefinition *rhs = getOperand(1);
if (lhs->isConstant()) {
Value lhsv = lhs->toConstant()->value();
if (lhsv.isInt32() && lhsv.toInt32() >= 0)
return false;
}
if (rhs->isConstant()) {
Value rhsv = rhs->toConstant()->value();
if (rhsv.isInt32() && rhsv.toInt32() % 32 != 0)
return false;
}
return canOverflow_;
}
bool canOverflow();
bool fallible() {
return canOverflow();