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 1319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1330 return result; | 1330 return result; |
1331 } | 1331 } |
1332 | 1332 |
1333 | 1333 |
1334 LInstruction* LChunkBuilder::DoFlooringDivByConstI(HMathFloorOfDiv* instr) { | 1334 LInstruction* LChunkBuilder::DoFlooringDivByConstI(HMathFloorOfDiv* instr) { |
1335 ASSERT(instr->representation().IsInteger32()); | 1335 ASSERT(instr->representation().IsInteger32()); |
1336 ASSERT(instr->left()->representation().Equals(instr->representation())); | 1336 ASSERT(instr->left()->representation().Equals(instr->representation())); |
1337 ASSERT(instr->right()->representation().Equals(instr->representation())); | 1337 ASSERT(instr->right()->representation().Equals(instr->representation())); |
1338 LOperand* dividend = UseRegister(instr->left()); | 1338 LOperand* dividend = UseRegister(instr->left()); |
1339 int32_t divisor = instr->right()->GetInteger32Constant(); | 1339 int32_t divisor = instr->right()->GetInteger32Constant(); |
1340 LInstruction* result = | 1340 LOperand* temp = |
1341 DefineAsRegister(new(zone()) LFlooringDivByConstI(dividend, divisor)); | 1341 ((divisor > 0 && !instr->CheckFlag(HValue::kLeftCanBeNegative)) || |
1342 bool can_deopt = | 1342 (divisor < 0 && !instr->CheckFlag(HValue::kLeftCanBePositive))) ? |
1343 divisor == 0 || | 1343 NULL : TempRegister(); |
1344 (instr->CheckFlag(HValue::kBailoutOnMinusZero) && divisor < 0); | 1344 LInstruction* result = DefineAsRegister( |
1345 return can_deopt ? AssignEnvironment(result) : result; | 1345 new(zone()) LFlooringDivByConstI(dividend, divisor, temp)); |
| 1346 if (divisor == 0 || |
| 1347 (instr->CheckFlag(HValue::kBailoutOnMinusZero) && divisor < 0)) { |
| 1348 result = AssignEnvironment(result); |
| 1349 } |
| 1350 return result; |
1346 } | 1351 } |
1347 | 1352 |
1348 | 1353 |
1349 LInstruction* LChunkBuilder::DoMathFloorOfDiv(HMathFloorOfDiv* instr) { | 1354 LInstruction* LChunkBuilder::DoMathFloorOfDiv(HMathFloorOfDiv* instr) { |
1350 if (instr->RightIsPowerOf2()) { | 1355 if (instr->RightIsPowerOf2()) { |
1351 return DoFlooringDivByPowerOf2I(instr); | 1356 return DoFlooringDivByPowerOf2I(instr); |
1352 } else if (false && instr->right()->IsConstant()) { | 1357 } else if (instr->right()->IsConstant()) { |
1353 return DoFlooringDivByConstI(instr); // TODO(svenpanne) Fix and re-enable. | 1358 return DoFlooringDivByConstI(instr); |
1354 } else { | 1359 } else { |
1355 return DoDivI(instr); | 1360 return DoDivI(instr); |
1356 } | 1361 } |
1357 } | 1362 } |
1358 | 1363 |
1359 | 1364 |
1360 LInstruction* LChunkBuilder::DoModByPowerOf2I(HMod* instr) { | 1365 LInstruction* LChunkBuilder::DoModByPowerOf2I(HMod* instr) { |
1361 ASSERT(instr->representation().IsSmiOrInteger32()); | 1366 ASSERT(instr->representation().IsSmiOrInteger32()); |
1362 ASSERT(instr->left()->representation().Equals(instr->representation())); | 1367 ASSERT(instr->left()->representation().Equals(instr->representation())); |
1363 ASSERT(instr->right()->representation().Equals(instr->representation())); | 1368 ASSERT(instr->right()->representation().Equals(instr->representation())); |
(...skipping 1120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2484 | 2489 |
2485 | 2490 |
2486 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { | 2491 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { |
2487 LOperand* object = UseRegister(instr->object()); | 2492 LOperand* object = UseRegister(instr->object()); |
2488 LOperand* index = UseRegister(instr->index()); | 2493 LOperand* index = UseRegister(instr->index()); |
2489 return DefineAsRegister(new(zone()) LLoadFieldByIndex(object, index)); | 2494 return DefineAsRegister(new(zone()) LLoadFieldByIndex(object, index)); |
2490 } | 2495 } |
2491 | 2496 |
2492 | 2497 |
2493 } } // namespace v8::internal | 2498 } } // namespace v8::internal |
OLD | NEW |