Fix ARM code for DoModI.

R=ulan@chromium.org
BUG=166379

Review URL: https://chromiumcodereview.appspot.com/11618020

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@13247 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
yangguo@chromium.org 2012-12-20 09:07:05 +00:00
parent 354fc4abe5
commit 9eccd63ccc

View File

@ -1105,6 +1105,16 @@ void LCodeGen::DoModI(LModI* instr) {
DeoptimizeIf(eq, instr->environment());
}
// Check for (kMinInt % -1).
if (instr->hydrogen()->CheckFlag(HValue::kCanOverflow)) {
Label left_not_min_int;
__ cmp(left, Operand(kMinInt));
__ b(ne, &left_not_min_int);
__ cmp(right, Operand(-1));
DeoptimizeIf(eq, instr->environment());
__ bind(&left_not_min_int);
}
// For r3 = r1 % r2; we can have the following ARM code
// sdiv r3, r1, r2
// mls r3, r3, r2, r1
@ -1134,6 +1144,8 @@ void LCodeGen::DoModI(LModI* instr) {
Label vfp_modulo, both_positive, right_negative;
CpuFeatures::Scope scope(VFP2);
// Check for x % 0.
if (instr->hydrogen()->CheckFlag(HValue::kCanBeDivByZero)) {
__ cmp(right, Operand(0));
@ -1356,7 +1368,7 @@ void LCodeGen::DoDivI(LDivI* instr) {
__ bind(&left_not_zero);
}
// Check for (-kMinInt / -1).
// Check for (kMinInt / -1).
if (instr->hydrogen()->CheckFlag(HValue::kCanOverflow)) {
Label left_not_min_int;
__ cmp(left, Operand(kMinInt));