| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 1314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1325 return result; | 1325 return result; |
| 1326 } | 1326 } |
| 1327 | 1327 |
| 1328 | 1328 |
| 1329 LInstruction* LChunkBuilder::DoFlooringDivByConstI(HMathFloorOfDiv* instr) { | 1329 LInstruction* LChunkBuilder::DoFlooringDivByConstI(HMathFloorOfDiv* instr) { |
| 1330 ASSERT(instr->representation().IsInteger32()); | 1330 ASSERT(instr->representation().IsInteger32()); |
| 1331 ASSERT(instr->left()->representation().Equals(instr->representation())); | 1331 ASSERT(instr->left()->representation().Equals(instr->representation())); |
| 1332 ASSERT(instr->right()->representation().Equals(instr->representation())); | 1332 ASSERT(instr->right()->representation().Equals(instr->representation())); |
| 1333 LOperand* dividend = UseRegister(instr->left()); | 1333 LOperand* dividend = UseRegister(instr->left()); |
| 1334 int32_t divisor = instr->right()->GetInteger32Constant(); | 1334 int32_t divisor = instr->right()->GetInteger32Constant(); |
| 1335 LInstruction* result = | 1335 LOperand* temp = |
| 1336 DefineAsRegister(new(zone()) LFlooringDivByConstI(dividend, divisor)); | 1336 ((divisor > 0 && !instr->CheckFlag(HValue::kLeftCanBeNegative)) || |
| 1337 bool can_deopt = | 1337 (divisor < 0 && !instr->CheckFlag(HValue::kLeftCanBePositive))) ? |
| 1338 divisor == 0 || | 1338 NULL : TempRegister(); |
| 1339 (instr->CheckFlag(HValue::kBailoutOnMinusZero) && divisor < 0); | 1339 LInstruction* result = DefineAsRegister( |
| 1340 return can_deopt ? AssignEnvironment(result) : result; | 1340 new(zone()) LFlooringDivByConstI(dividend, divisor, temp)); |
| 1341 if (divisor == 0 || |
| 1342 (instr->CheckFlag(HValue::kBailoutOnMinusZero) && divisor < 0)) { |
| 1343 result = AssignEnvironment(result); |
| 1344 } |
| 1345 return result; |
| 1341 } | 1346 } |
| 1342 | 1347 |
| 1343 | 1348 |
| 1344 LInstruction* LChunkBuilder::DoMathFloorOfDiv(HMathFloorOfDiv* instr) { | 1349 LInstruction* LChunkBuilder::DoMathFloorOfDiv(HMathFloorOfDiv* instr) { |
| 1345 if (instr->RightIsPowerOf2()) { | 1350 if (instr->RightIsPowerOf2()) { |
| 1346 return DoFlooringDivByPowerOf2I(instr); | 1351 return DoFlooringDivByPowerOf2I(instr); |
| 1347 } else if (false && instr->right()->IsConstant()) { | 1352 } else if (instr->right()->IsConstant()) { |
| 1348 return DoFlooringDivByConstI(instr); // TODO(svenpanne) Fix and re-enable. | 1353 return DoFlooringDivByConstI(instr); |
| 1349 } else { | 1354 } else { |
| 1350 return DoDivI(instr); | 1355 return DoDivI(instr); |
| 1351 } | 1356 } |
| 1352 } | 1357 } |
| 1353 | 1358 |
| 1354 | 1359 |
| 1355 LInstruction* LChunkBuilder::DoModByPowerOf2I(HMod* instr) { | 1360 LInstruction* LChunkBuilder::DoModByPowerOf2I(HMod* instr) { |
| 1356 ASSERT(instr->representation().IsSmiOrInteger32()); | 1361 ASSERT(instr->representation().IsSmiOrInteger32()); |
| 1357 ASSERT(instr->left()->representation().Equals(instr->representation())); | 1362 ASSERT(instr->left()->representation().Equals(instr->representation())); |
| 1358 ASSERT(instr->right()->representation().Equals(instr->representation())); | 1363 ASSERT(instr->right()->representation().Equals(instr->representation())); |
| (...skipping 1171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2530 } | 2535 } |
| 2531 | 2536 |
| 2532 | 2537 |
| 2533 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { | 2538 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { |
| 2534 LOperand* object = UseRegister(instr->object()); | 2539 LOperand* object = UseRegister(instr->object()); |
| 2535 LOperand* index = UseRegister(instr->index()); | 2540 LOperand* index = UseRegister(instr->index()); |
| 2536 return DefineAsRegister(new(zone()) LLoadFieldByIndex(object, index)); | 2541 return DefineAsRegister(new(zone()) LLoadFieldByIndex(object, index)); |
| 2537 } | 2542 } |
| 2538 | 2543 |
| 2539 } } // namespace v8::internal | 2544 } } // namespace v8::internal |
| OLD | NEW |