| 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 1325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1336 return AssignEnvironment(AssignPointerMap( | 1336 return AssignEnvironment(AssignPointerMap( |
| 1337 DefineFixed(new LDivI(dividend, divisor), r0))); | 1337 DefineFixed(new LDivI(dividend, divisor), r0))); |
| 1338 } else { | 1338 } else { |
| 1339 return DoArithmeticT(Token::DIV, instr); | 1339 return DoArithmeticT(Token::DIV, instr); |
| 1340 } | 1340 } |
| 1341 } | 1341 } |
| 1342 | 1342 |
| 1343 | 1343 |
| 1344 LInstruction* LChunkBuilder::DoMod(HMod* instr) { | 1344 LInstruction* LChunkBuilder::DoMod(HMod* instr) { |
| 1345 if (instr->representation().IsInteger32()) { | 1345 if (instr->representation().IsInteger32()) { |
| 1346 // TODO(1042) The fixed register allocation | |
| 1347 // is needed because we call GenericBinaryOpStub from | |
| 1348 // the generated code, which requires registers r0 | |
| 1349 // and r1 to be used. We should remove that | |
| 1350 // when we provide a native implementation. | |
| 1351 ASSERT(instr->left()->representation().IsInteger32()); | 1346 ASSERT(instr->left()->representation().IsInteger32()); |
| 1352 ASSERT(instr->right()->representation().IsInteger32()); | 1347 ASSERT(instr->right()->representation().IsInteger32()); |
| 1353 | 1348 |
| 1354 LInstruction* result; | 1349 LModI* mod; |
| 1355 if (instr->HasPowerOf2Divisor()) { | 1350 if (instr->HasPowerOf2Divisor()) { |
| 1356 ASSERT(!instr->CheckFlag(HValue::kCanBeDivByZero)); | 1351 ASSERT(!instr->CheckFlag(HValue::kCanBeDivByZero)); |
| 1357 LOperand* value = UseRegisterAtStart(instr->left()); | 1352 LOperand* value = UseRegisterAtStart(instr->left()); |
| 1358 LModI* mod = new LModI(value, UseOrConstant(instr->right())); | 1353 mod = new LModI(value, UseOrConstant(instr->right())); |
| 1359 result = DefineSameAsFirst(mod); | |
| 1360 result = AssignEnvironment(result); | |
| 1361 } else { | 1354 } else { |
| 1362 LOperand* value = UseFixed(instr->left(), r0); | 1355 LOperand* dividend = UseRegister(instr->left()); |
| 1363 LOperand* divisor = UseFixed(instr->right(), r1); | 1356 LOperand* divisor = UseRegisterAtStart(instr->right()); |
| 1364 result = DefineFixed(new LModI(value, divisor), r0); | 1357 mod = new LModI(dividend, |
| 1365 result = AssignEnvironment(AssignPointerMap(result)); | 1358 divisor, |
| 1359 TempRegister(), |
| 1360 FixedTemp(d1), |
| 1361 FixedTemp(d2)); |
| 1366 } | 1362 } |
| 1367 | 1363 |
| 1368 return result; | 1364 return AssignEnvironment(DefineSameAsFirst(mod)); |
| 1369 } else if (instr->representation().IsTagged()) { | 1365 } else if (instr->representation().IsTagged()) { |
| 1370 return DoArithmeticT(Token::MOD, instr); | 1366 return DoArithmeticT(Token::MOD, instr); |
| 1371 } else { | 1367 } else { |
| 1372 ASSERT(instr->representation().IsDouble()); | 1368 ASSERT(instr->representation().IsDouble()); |
| 1373 // We call a C function for double modulo. It can't trigger a GC. | 1369 // We call a C function for double modulo. It can't trigger a GC. |
| 1374 // We need to use fixed result register for the call. | 1370 // We need to use fixed result register for the call. |
| 1375 // TODO(fschneider): Allow any register as input registers. | 1371 // TODO(fschneider): Allow any register as input registers. |
| 1376 LOperand* left = UseFixedDouble(instr->left(), d1); | 1372 LOperand* left = UseFixedDouble(instr->left(), d1); |
| 1377 LOperand* right = UseFixedDouble(instr->right(), d2); | 1373 LOperand* right = UseFixedDouble(instr->right(), d2); |
| 1378 LArithmeticD* result = new LArithmeticD(Token::MOD, left, right); | 1374 LArithmeticD* result = new LArithmeticD(Token::MOD, left, right); |
| (...skipping 690 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2069 | 2065 |
| 2070 | 2066 |
| 2071 LInstruction* LChunkBuilder::DoLeaveInlined(HLeaveInlined* instr) { | 2067 LInstruction* LChunkBuilder::DoLeaveInlined(HLeaveInlined* instr) { |
| 2072 HEnvironment* outer = current_block_->last_environment()->outer(); | 2068 HEnvironment* outer = current_block_->last_environment()->outer(); |
| 2073 current_block_->UpdateEnvironment(outer); | 2069 current_block_->UpdateEnvironment(outer); |
| 2074 return NULL; | 2070 return NULL; |
| 2075 } | 2071 } |
| 2076 | 2072 |
| 2077 | 2073 |
| 2078 } } // namespace v8::internal | 2074 } } // namespace v8::internal |
| OLD | NEW |