Chromium Code Reviews| Index: src/x64/macro-assembler-x64.cc |
| diff --git a/src/x64/macro-assembler-x64.cc b/src/x64/macro-assembler-x64.cc |
| index 27900c1eef739719ef98b0041446f83b666df6ca..66446ae2cc7f06bb578933446870e1cfbd895660 100644 |
| --- a/src/x64/macro-assembler-x64.cc |
| +++ b/src/x64/macro-assembler-x64.cc |
| @@ -1567,7 +1567,8 @@ void MacroAssembler::SmiSubConstant(Register dst, Register src, Smi* constant) { |
| void MacroAssembler::SmiSubConstant(Register dst, |
| Register src, |
| Smi* constant, |
| - Label* on_not_smi_result, |
| + SmiOperationExecutionMode mode, |
| + Label* bailout_label, |
| Label::Distance near_jump) { |
| if (constant->value() == 0) { |
| if (!dst.is(src)) { |
| @@ -1575,36 +1576,28 @@ 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); |
| + LoadSmiConstant(kScratchRegister, constant); |
| + subq(dst, kScratchRegister); |
| + if (mode.Contains(BAILOUT_ON_NO_OVERFLOW)) { |
| + j(no_overflow, bailout_label, near_jump); |
| + ASSERT(mode.Contains(NEED_RESERVE_SOURCES)); |
| + addq(dst, kScratchRegister); |
| + } else if (mode.Contains(BAILOUT_ON_OVERFLOW)) { |
| + if (mode.Contains(NEED_RESERVE_SOURCES)) { |
| + Label done; |
| + j(no_overflow, &done, Label::kNear); |
| + addq(dst, kScratchRegister); |
| + jmp(bailout_label, near_jump); |
| + bind(&done); |
| + } else { |
| + // Implement this when SimSubConstant is invoked from Crankshaft. |
| + UNIMPLEMENTED(); // Not used. |
|
danno
2013/10/14 18:30:45
I would feel more comfortable if you implemented t
haitao.feng
2013/10/16 09:17:01
Done.
|
| + } |
| } 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); |
| + ASSERT(mode.IsEmpty()); |
|
danno
2013/10/14 18:30:45
Turn this ASSERT into a CHECK
haitao.feng
2013/10/16 09:17:01
Done.
|
| } |
| } else { |
| - 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(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. |
| - addq(dst, src); |
| - } else { |
| - // Subtract by adding the negation. |
| - LoadSmiConstant(dst, Smi::FromInt(-(constant->value()))); |
| - addq(dst, src); |
| - j(overflow, on_not_smi_result, near_jump); |
| - } |
| + UNIMPLEMENTED(); // Not used. |
|
danno
2013/10/14 18:30:45
I would feel more comfortable if you implemented t
haitao.feng
2013/10/16 09:17:01
Done.
|
| } |
| } |