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

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

Issue 233013004: Version 3.25.28.12 (merged r20544, r20645, r20664, r20553) (Closed) Base URL: https://v8.googlecode.com/svn/branches/3.25
Patch Set: Created 6 years, 8 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 | « src/ia32/lithium-codegen-ia32.cc ('k') | src/version.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/mips/lithium-codegen-mips.cc
diff --git a/src/mips/lithium-codegen-mips.cc b/src/mips/lithium-codegen-mips.cc
index f62c7bb76db3599393feabd0e87ec2c4c6f94856..d9899fe0b31532abd1c7f8c1c58dfa7849287716 100644
--- a/src/mips/lithium-codegen-mips.cc
+++ b/src/mips/lithium-codegen-mips.cc
@@ -1331,25 +1331,27 @@ void LCodeGen::DoFlooringDivByPowerOf2I(LFlooringDivByPowerOf2I* instr) {
if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) {
DeoptimizeIf(eq, instr->environment(), result, Operand(zero_reg));
}
- if (instr->hydrogen()->CheckFlag(HValue::kLeftCanBeMinInt)) {
- // Note that we could emit branch-free code, but that would need one more
- // register.
- __ Xor(at, scratch, result);
- if (divisor == -1) {
- DeoptimizeIf(ge, instr->environment(), at, Operand(zero_reg));
- __ sra(result, dividend, shift);
- } else {
- Label no_overflow, done;
- __ Branch(&no_overflow, lt, at, Operand(zero_reg));
- __ li(result, Operand(kMinInt / divisor));
- __ Branch(&done);
- __ bind(&no_overflow);
- __ sra(result, dividend, shift);
- __ bind(&done);
- }
- } else {
+
+ // If the negation could not overflow, simply shifting is OK.
+ if (!instr->hydrogen()->CheckFlag(HValue::kLeftCanBeMinInt)) {
__ sra(result, dividend, shift);
+ return;
+ }
+
+ // Dividing by -1 is basically negation, unless we overflow.
+ __ Xor(at, scratch, result);
+ if (divisor == -1) {
+ DeoptimizeIf(ge, instr->environment(), at, Operand(zero_reg));
+ return;
}
+
+ Label no_overflow, done;
+ __ Branch(&no_overflow, lt, at, Operand(zero_reg));
+ __ li(result, Operand(kMinInt / divisor));
+ __ Branch(&done);
+ __ bind(&no_overflow);
+ __ sra(result, dividend, shift);
+ __ bind(&done);
}
« no previous file with comments | « src/ia32/lithium-codegen-ia32.cc ('k') | src/version.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698