Chromium Code Reviews| Index: src/x64/lithium-x64.cc |
| =================================================================== |
| --- src/x64/lithium-x64.cc (revision 6669) |
| +++ src/x64/lithium-x64.cc (working copy) |
| @@ -1262,8 +1262,20 @@ |
| LInstruction* LChunkBuilder::DoDiv(HDiv* instr) { |
| - Abort("Unimplemented: %s", "DoDiv"); |
| - return NULL; |
| + if (instr->representation().IsDouble()) { |
| + return DoArithmeticD(Token::DIV, instr); |
| + } else if (instr->representation().IsInteger32()) { |
| + // The temporary operand is necessary to ensure that right is not allocated |
| + // into rdx. |
| + LOperand* temp = FixedTemp(rdx); |
| + LOperand* value = UseFixed(instr->left(), rax); |
|
William Hesse
2011/02/08 09:42:47
Dividend might be a more specific name than value.
Rico
2011/02/08 11:22:04
Changed here and on ia32 and arm
|
| + LOperand* divisor = UseRegister(instr->right()); |
| + LDivI* result = new LDivI(value, divisor, temp); |
| + return AssignEnvironment(DefineFixed(result, rax)); |
| + } else { |
| + ASSERT(instr->representation().IsTagged()); |
| + return DoArithmeticT(Token::DIV, instr); |
| + } |
| } |
| @@ -1274,8 +1286,19 @@ |
| LInstruction* LChunkBuilder::DoMul(HMul* instr) { |
| - Abort("Unimplemented: %s", "DoMul"); |
| - return NULL; |
| + if (instr->representation().IsInteger32()) { |
| + ASSERT(instr->left()->representation().IsInteger32()); |
| + ASSERT(instr->right()->representation().IsInteger32()); |
| + LOperand* left = UseRegisterAtStart(instr->LeastConstantOperand()); |
| + LOperand* right = UseOrConstant(instr->MostConstantOperand()); |
| + LMulI* mul = new LMulI(left, right); |
| + return AssignEnvironment(DefineSameAsFirst(mul)); |
| + } else if (instr->representation().IsDouble()) { |
| + return DoArithmeticD(Token::MUL, instr); |
| + } else { |
| + ASSERT(instr->representation().IsTagged()); |
| + return DoArithmeticT(Token::MUL, instr); |
| + } |
| } |