Both sides of a modulo have to be demotable before we can optimize using imod (456477, r=danderson).
Both sides of a modulo have to be demotable before we can optimize using imod (456477, r=danderson).
--- a/js/src/jstracer.cpp
+++ b/js/src/jstracer.cpp
@@ -678,17 +678,17 @@ public:
if (isPromote(args[1])) {
LIns* args2[] = { s0, demote(out, args[1]), args[2], args[3] };
return out->insCall(F_Any_setelem_int, args2);
}
break;
case F_dmod:
// FIXME: We should really have LIR_imod and LIR_idiv (455496).
JS_ASSERT(s0->isQuad() && args[1]->isQuad());
- if (args[1]->isconstq() && args[1]->constvalq() && isPromote(s0)) {
+ if (args[1]->isconstq() && args[1]->constvalq() && isPromote(args[1]) && isPromote(s0)) {
LIns* args2[] = { demote(out, s0), demote(out, args[1]) };
return out->ins1(LIR_i2f, out->insCall(F_imod, args2));
}
break;
}
return out->insCall(fid, args);
}
};