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

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

Issue 1192413002: MIPS64: Fix random failures of fannkuch.js. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Addressed comments 2. Created 5 years, 6 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/mips64/lithium-codegen-mips64.h ('k') | test/mjsunit/math-abs.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/mips64/lithium-codegen-mips64.cc
diff --git a/src/mips64/lithium-codegen-mips64.cc b/src/mips64/lithium-codegen-mips64.cc
index 0082a3f50b389b906d7b1f6bd4d37148c5cd132e..c4988f4ec7688c577914bef73b4b5d619e21e486 100644
--- a/src/mips64/lithium-codegen-mips64.cc
+++ b/src/mips64/lithium-codegen-mips64.cc
@@ -3773,13 +3773,27 @@ void LCodeGen::EmitIntegerMathAbs(LMathAbs* instr) {
Label done;
__ Branch(USE_DELAY_SLOT, &done, ge, input, Operand(zero_reg));
__ mov(result, input);
- __ dsubu(result, zero_reg, input);
+ __ subu(result, zero_reg, input);
// Overflow if result is still negative, i.e. 0x80000000.
DeoptimizeIf(lt, instr, Deoptimizer::kOverflow, result, Operand(zero_reg));
__ bind(&done);
}
+void LCodeGen::EmitSmiMathAbs(LMathAbs* instr) {
+ Register input = ToRegister(instr->value());
+ Register result = ToRegister(instr->result());
+ Assembler::BlockTrampolinePoolScope block_trampoline_pool(masm_);
+ Label done;
+ __ Branch(USE_DELAY_SLOT, &done, ge, input, Operand(zero_reg));
+ __ mov(result, input);
+ __ dsubu(result, zero_reg, input);
+ // Overflow if result is still negative, i.e. 0x80000000 00000000.
+ DeoptimizeIf(lt, instr, Deoptimizer::kOverflow, result, Operand(zero_reg));
+ __ bind(&done);
+}
+
+
void LCodeGen::DoMathAbs(LMathAbs* instr) {
// Class for deferred case.
class DeferredMathAbsTaggedHeapNumber final : public LDeferredCode {
@@ -3800,8 +3814,10 @@ void LCodeGen::DoMathAbs(LMathAbs* instr) {
FPURegister input = ToDoubleRegister(instr->value());
FPURegister result = ToDoubleRegister(instr->result());
__ abs_d(result, input);
- } else if (r.IsSmiOrInteger32()) {
+ } else if (r.IsInteger32()) {
EmitIntegerMathAbs(instr);
+ } else if (r.IsSmi()) {
+ EmitSmiMathAbs(instr);
} else {
// Representation is tagged.
DeferredMathAbsTaggedHeapNumber* deferred =
@@ -3810,7 +3826,7 @@ void LCodeGen::DoMathAbs(LMathAbs* instr) {
// Smi check.
__ JumpIfNotSmi(input, deferred->entry());
// If smi, handle it directly.
- EmitIntegerMathAbs(instr);
+ EmitSmiMathAbs(instr);
__ bind(deferred->exit());
}
}
« no previous file with comments | « src/mips64/lithium-codegen-mips64.h ('k') | test/mjsunit/math-abs.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698