| 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());
|
| }
|
| }
|
|
|