Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(32)

Unified Diff: src/arm/lithium-codegen-arm.cc

Issue 22964004: Fix a bug in Div when all uses are truncating (Closed) Base URL: https://github.com/v8/v8.git@master
Patch Set: Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/ia32/lithium-codegen-ia32.cc » ('j') | test/mjsunit/shift-for-integer-div.js » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/arm/lithium-codegen-arm.cc
diff --git a/src/arm/lithium-codegen-arm.cc b/src/arm/lithium-codegen-arm.cc
index 9ec80f819a062dbf3078fc4a0487b765177a19cb..d090f9203f66046ff8f4eecba405867802e3da87 100644
--- a/src/arm/lithium-codegen-arm.cc
+++ b/src/arm/lithium-codegen-arm.cc
@@ -1394,10 +1394,18 @@ void LCodeGen::DoDivI(LDivI* instr) {
if (test_value != 0) {
if (instr->hydrogen()->CheckFlag(
HInstruction::kAllUsesTruncatingToInt32)) {
+ Label negative, done;
__ cmp(dividend, Operand(0));
+ __ b(lt, &negative);
+ __ mov(dividend, Operand(dividend, ASR, power));
+ if (divisor < 0) __ rsb(dividend, dividend, Operand(0));
+ __ jmp(&done);
+
+ __ bind(&negative);
__ rsb(dividend, dividend, Operand(0), LeaveCC, lt);
__ mov(dividend, Operand(dividend, ASR, power));
- if (divisor > 0) __ rsb(dividend, dividend, Operand(0), LeaveCC, lt);
+ if (divisor > 0) __ rsb(dividend, dividend, Operand(0));
+ __ bind(&done);
return; // Don't fall through to "__ rsb" below.
} else {
// Deoptimize if remainder is not 0.
« no previous file with comments | « no previous file | src/ia32/lithium-codegen-ia32.cc » ('j') | test/mjsunit/shift-for-integer-div.js » ('J')

Powered by Google App Engine
This is Rietveld 408576698