| Index: src/x64/macro-assembler-x64.cc
|
| diff --git a/src/x64/macro-assembler-x64.cc b/src/x64/macro-assembler-x64.cc
|
| index 96fa4fc49630424093eaa29874c118e95c34a115..bd1933e4f190e3ac59866886844eefcbe1d887fe 100644
|
| --- a/src/x64/macro-assembler-x64.cc
|
| +++ b/src/x64/macro-assembler-x64.cc
|
| @@ -1584,20 +1584,14 @@ void MacroAssembler::SmiSubConstant(Register dst,
|
| }
|
| } else if (dst.is(src)) {
|
| ASSERT(!dst.is(kScratchRegister));
|
| - if (constant->value() == Smi::kMinValue) {
|
| - // Subtracting min-value from any non-negative value will overflow.
|
| - // We test the non-negativeness before doing the subtraction.
|
| - testq(src, src);
|
| - j(not_sign, on_not_smi_result, near_jump);
|
| - LoadSmiConstant(kScratchRegister, constant);
|
| - subq(dst, kScratchRegister);
|
| - } else {
|
| - // Subtract by adding the negation.
|
| - LoadSmiConstant(kScratchRegister, Smi::FromInt(-constant->value()));
|
| - addq(kScratchRegister, dst);
|
| - j(overflow, on_not_smi_result, near_jump);
|
| - movq(dst, kScratchRegister);
|
| - }
|
| + Label done;
|
| + LoadSmiConstant(kScratchRegister, constant);
|
| + subq(dst, kScratchRegister);
|
| + j(no_overflow, &done, Label::kNear);
|
| + // Restore src.
|
| + addq(dst, kScratchRegister);
|
| + jmp(on_not_smi_result, near_jump);
|
| + bind(&done);
|
| } else {
|
| if (constant->value() == Smi::kMinValue) {
|
| // Subtracting min-value from any non-negative value will overflow.
|
| @@ -1605,8 +1599,7 @@ void MacroAssembler::SmiSubConstant(Register dst,
|
| testq(src, src);
|
| j(not_sign, on_not_smi_result, near_jump);
|
| LoadSmiConstant(dst, constant);
|
| - // Adding and subtracting the min-value gives the same result, it only
|
| - // differs on the overflow bit, which we don't check here.
|
| + // No overflow.
|
| addq(dst, src);
|
| } else {
|
| // Subtract by adding the negation.
|
|
|