| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 1300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1311 LDivI* result = new LDivI(dividend, divisor, temp); | 1311 LDivI* result = new LDivI(dividend, divisor, temp); |
| 1312 return AssignEnvironment(DefineFixed(result, rax)); | 1312 return AssignEnvironment(DefineFixed(result, rax)); |
| 1313 } else { | 1313 } else { |
| 1314 ASSERT(instr->representation().IsTagged()); | 1314 ASSERT(instr->representation().IsTagged()); |
| 1315 return DoArithmeticT(Token::DIV, instr); | 1315 return DoArithmeticT(Token::DIV, instr); |
| 1316 } | 1316 } |
| 1317 } | 1317 } |
| 1318 | 1318 |
| 1319 | 1319 |
| 1320 LInstruction* LChunkBuilder::DoMod(HMod* instr) { | 1320 LInstruction* LChunkBuilder::DoMod(HMod* instr) { |
| 1321 Abort("Unimplemented: %s", "DoMod"); | 1321 if (instr->representation().IsInteger32()) { |
| 1322 return NULL; | 1322 ASSERT(instr->left()->representation().IsInteger32()); |
| 1323 ASSERT(instr->right()->representation().IsInteger32()); |
| 1324 // The temporary operand is necessary to ensure that right is not allocated |
| 1325 // into edx. |
| 1326 LOperand* temp = FixedTemp(rdx); |
| 1327 LOperand* value = UseFixed(instr->left(), rax); |
| 1328 LOperand* divisor = UseRegister(instr->right()); |
| 1329 LModI* mod = new LModI(value, divisor, temp); |
| 1330 LInstruction* result = DefineFixed(mod, rdx); |
| 1331 return (instr->CheckFlag(HValue::kBailoutOnMinusZero) || |
| 1332 instr->CheckFlag(HValue::kCanBeDivByZero)) |
| 1333 ? AssignEnvironment(result) |
| 1334 : result; |
| 1335 } else if (instr->representation().IsTagged()) { |
| 1336 return DoArithmeticT(Token::MOD, instr); |
| 1337 } else { |
| 1338 ASSERT(instr->representation().IsDouble()); |
| 1339 // We call a C function for double modulo. It can't trigger a GC. |
| 1340 // We need to use fixed result register for the call. |
| 1341 // TODO(fschneider): Allow any register as input registers. |
| 1342 LOperand* left = UseFixedDouble(instr->left(), xmm1); |
| 1343 LOperand* right = UseFixedDouble(instr->right(), xmm2); |
| 1344 LArithmeticD* result = new LArithmeticD(Token::MOD, left, right); |
| 1345 return MarkAsCall(DefineFixedDouble(result, xmm1), instr); |
| 1346 } |
| 1323 } | 1347 } |
| 1324 | 1348 |
| 1325 | 1349 |
| 1326 LInstruction* LChunkBuilder::DoMul(HMul* instr) { | 1350 LInstruction* LChunkBuilder::DoMul(HMul* instr) { |
| 1327 if (instr->representation().IsInteger32()) { | 1351 if (instr->representation().IsInteger32()) { |
| 1328 ASSERT(instr->left()->representation().IsInteger32()); | 1352 ASSERT(instr->left()->representation().IsInteger32()); |
| 1329 ASSERT(instr->right()->representation().IsInteger32()); | 1353 ASSERT(instr->right()->representation().IsInteger32()); |
| 1330 LOperand* left = UseRegisterAtStart(instr->LeastConstantOperand()); | 1354 LOperand* left = UseRegisterAtStart(instr->LeastConstantOperand()); |
| 1331 LOperand* right = UseOrConstant(instr->MostConstantOperand()); | 1355 LOperand* right = UseOrConstant(instr->MostConstantOperand()); |
| 1332 LMulI* mul = new LMulI(left, right); | 1356 LMulI* mul = new LMulI(left, right); |
| (...skipping 628 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1961 | 1985 |
| 1962 LInstruction* LChunkBuilder::DoLeaveInlined(HLeaveInlined* instr) { | 1986 LInstruction* LChunkBuilder::DoLeaveInlined(HLeaveInlined* instr) { |
| 1963 HEnvironment* outer = current_block_->last_environment()->outer(); | 1987 HEnvironment* outer = current_block_->last_environment()->outer(); |
| 1964 current_block_->UpdateEnvironment(outer); | 1988 current_block_->UpdateEnvironment(outer); |
| 1965 return NULL; | 1989 return NULL; |
| 1966 } | 1990 } |
| 1967 | 1991 |
| 1968 } } // namespace v8::internal | 1992 } } // namespace v8::internal |
| 1969 | 1993 |
| 1970 #endif // V8_TARGET_ARCH_X64 | 1994 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |