| Index: src/ia32/lithium-codegen-ia32.cc
|
| diff --git a/src/ia32/lithium-codegen-ia32.cc b/src/ia32/lithium-codegen-ia32.cc
|
| index 22e79d1d2c1f859f16c860f11a36d78b8ccda4fa..2d9936f8974236f2723906392bda0cdf0c232bab 100644
|
| --- a/src/ia32/lithium-codegen-ia32.cc
|
| +++ b/src/ia32/lithium-codegen-ia32.cc
|
| @@ -2259,6 +2259,18 @@ void LCodeGen::DoDeferredMathAbsTaggedHeapNumber(LUnaryMathOperation* instr) {
|
| }
|
|
|
|
|
| +void LCodeGen::EmitIntegerMathAbs(LUnaryMathOperation* instr) {
|
| + Register input_reg = ToRegister(instr->InputAt(0));
|
| + __ test(input_reg, Operand(input_reg));
|
| + Label is_positive;
|
| + __ j(not_sign, &is_positive);
|
| + __ neg(input_reg);
|
| + __ test(input_reg, Operand(input_reg));
|
| + DeoptimizeIf(negative, instr->environment());
|
| + __ bind(&is_positive);
|
| +}
|
| +
|
| +
|
| void LCodeGen::DoMathAbs(LUnaryMathOperation* instr) {
|
| // Class for deferred case.
|
| class DeferredMathAbsTaggedHeapNumber: public LDeferredCode {
|
| @@ -2283,31 +2295,15 @@ void LCodeGen::DoMathAbs(LUnaryMathOperation* instr) {
|
| __ subsd(scratch, input_reg);
|
| __ pand(input_reg, scratch);
|
| } else if (r.IsInteger32()) {
|
| - Register input_reg = ToRegister(instr->InputAt(0));
|
| - __ test(input_reg, Operand(input_reg));
|
| - Label is_positive;
|
| - __ j(not_sign, &is_positive);
|
| - __ neg(input_reg);
|
| - __ test(input_reg, Operand(input_reg));
|
| - DeoptimizeIf(negative, instr->environment());
|
| - __ bind(&is_positive);
|
| + EmitIntegerMathAbs(instr);
|
| } else { // Tagged case.
|
| DeferredMathAbsTaggedHeapNumber* deferred =
|
| new DeferredMathAbsTaggedHeapNumber(this, instr);
|
| - Label not_smi;
|
| Register input_reg = ToRegister(instr->InputAt(0));
|
| // Smi check.
|
| __ test(input_reg, Immediate(kSmiTagMask));
|
| __ j(not_zero, deferred->entry());
|
| - __ test(input_reg, Operand(input_reg));
|
| - Label is_positive;
|
| - __ j(not_sign, &is_positive);
|
| - __ neg(input_reg);
|
| -
|
| - __ test(input_reg, Operand(input_reg));
|
| - DeoptimizeIf(negative, instr->environment());
|
| -
|
| - __ bind(&is_positive);
|
| + EmitIntegerMathAbs(instr);
|
| __ bind(deferred->exit());
|
| }
|
| }
|
|
|