Chromium Code Reviews| Index: src/x64/lithium-codegen-x64.cc |
| diff --git a/src/x64/lithium-codegen-x64.cc b/src/x64/lithium-codegen-x64.cc |
| index 4fa4b668c8308690ac7cb5fa0594c53a97e75be9..0ad766d28dc88d7ddd7bc1877e29a64027e793e3 100644 |
| --- a/src/x64/lithium-codegen-x64.cc |
| +++ b/src/x64/lithium-codegen-x64.cc |
| @@ -1298,7 +1298,11 @@ void LCodeGen::DoMulI(LMulI* instr) { |
| LOperand* right = instr->right(); |
| if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) { |
| - __ movl(kScratchRegister, left); |
| + if (instr->hydrogen_value()->representation().IsSmi()) { |
| + __ movq(kScratchRegister, left); |
| + } else { |
| + __ movl(kScratchRegister, left); |
| + } |
| } |
| bool can_overflow = |
| @@ -1346,14 +1350,14 @@ void LCodeGen::DoMulI(LMulI* instr) { |
| } |
| } else if (right->IsStackSlot()) { |
| if (instr->hydrogen_value()->representation().IsSmi()) { |
| - __ SmiToInteger32(left, left); |
| + __ SmiToInteger64(left, left); |
| __ imul(left, ToOperand(right)); |
| } else { |
| __ imull(left, ToOperand(right)); |
| } |
| } else { |
| if (instr->hydrogen_value()->representation().IsSmi()) { |
| - __ SmiToInteger32(left, left); |
| + __ SmiToInteger64(left, left); |
| __ imul(left, ToRegister(right)); |
| } else { |
| __ imull(left, ToRegister(right)); |
| @@ -1367,9 +1371,15 @@ void LCodeGen::DoMulI(LMulI* instr) { |
| if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) { |
| // Bail out if the result is supposed to be negative zero. |
| Label done; |
| - __ testl(left, left); |
| + if (instr->hydrogen_value()->representation().IsSmi()) { |
| + __ testq(left, left); |
| + } else { |
| + __ testl(left, left); |
| + } |
| __ j(not_zero, &done, Label::kNear); |
| if (right->IsConstantOperand()) { |
| + // Constant can't be represented as Smi due to immediate size limit |
|
Toon Verwaest
2013/08/10 14:13:19
Full stop at the end of the sentence.
weiliang.lin2
2013/08/10 16:43:26
Done.
|
| + ASSERT(!instr->hydrogen_value()->representation().IsSmi()); |
| if (ToInteger32(LConstantOperand::cast(right)) < 0) { |
| DeoptimizeIf(no_condition, instr->environment()); |
| } else if (ToInteger32(LConstantOperand::cast(right)) == 0) { |
| @@ -1377,11 +1387,19 @@ void LCodeGen::DoMulI(LMulI* instr) { |
| DeoptimizeIf(less, instr->environment()); |
| } |
| } else if (right->IsStackSlot()) { |
| - __ orl(kScratchRegister, ToOperand(right)); |
| + if (instr->hydrogen_value()->representation().IsSmi()) { |
| + __ or_(kScratchRegister, ToOperand(right)); |
| + } else { |
| + __ orl(kScratchRegister, ToOperand(right)); |
| + } |
| DeoptimizeIf(sign, instr->environment()); |
| } else { |
| // Test the non-zero operand for negative sign. |
| - __ orl(kScratchRegister, ToRegister(right)); |
| + if (instr->hydrogen_value()->representation().IsSmi()) { |
| + __ or_(kScratchRegister, ToRegister(right)); |
| + } else { |
| + __ orl(kScratchRegister, ToRegister(right)); |
| + } |
| DeoptimizeIf(sign, instr->environment()); |
| } |
| __ bind(&done); |