Index: src/x64/lithium-codegen-x64.cc |
=================================================================== |
--- src/x64/lithium-codegen-x64.cc (revision 15967) |
+++ src/x64/lithium-codegen-x64.cc (working copy) |
@@ -3434,6 +3434,17 @@ |
} |
+void LCodeGen::EmitInteger64MathAbs(LMathAbs* instr) { |
+ Register input_reg = ToRegister(instr->value()); |
+ __ testq(input_reg, input_reg); |
+ Label is_positive; |
+ __ j(not_sign, &is_positive, Label::kNear); |
+ __ neg(input_reg); // Sets flags. |
+ DeoptimizeIf(negative, instr->environment()); |
+ __ bind(&is_positive); |
+} |
+ |
+ |
void LCodeGen::DoMathAbs(LMathAbs* instr) { |
// Class for deferred case. |
class DeferredMathAbsTaggedHeapNumber: public LDeferredCode { |
@@ -3459,6 +3470,8 @@ |
__ andpd(input_reg, scratch); |
} else if (r.IsInteger32()) { |
EmitIntegerMathAbs(instr); |
+ } else if (r.IsSmi()) { |
+ EmitInteger64MathAbs(instr); |
} else { // Tagged case. |
DeferredMathAbsTaggedHeapNumber* deferred = |
new(zone()) DeferredMathAbsTaggedHeapNumber(this, instr); |