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 1331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1342 | 1342 |
1343 | 1343 |
1344 LInstruction* LChunkBuilder::DoFlooringDivByConstI(HMathFloorOfDiv* instr) { | 1344 LInstruction* LChunkBuilder::DoFlooringDivByConstI(HMathFloorOfDiv* instr) { |
1345 ASSERT(instr->representation().IsInteger32()); | 1345 ASSERT(instr->representation().IsInteger32()); |
1346 ASSERT(instr->left()->representation().Equals(instr->representation())); | 1346 ASSERT(instr->left()->representation().Equals(instr->representation())); |
1347 ASSERT(instr->right()->representation().Equals(instr->representation())); | 1347 ASSERT(instr->right()->representation().Equals(instr->representation())); |
1348 LOperand* dividend = UseRegister(instr->left()); | 1348 LOperand* dividend = UseRegister(instr->left()); |
1349 int32_t divisor = instr->right()->GetInteger32Constant(); | 1349 int32_t divisor = instr->right()->GetInteger32Constant(); |
1350 LOperand* temp1 = FixedTemp(rax); | 1350 LOperand* temp1 = FixedTemp(rax); |
1351 LOperand* temp2 = FixedTemp(rdx); | 1351 LOperand* temp2 = FixedTemp(rdx); |
| 1352 LOperand* temp3 = |
| 1353 ((divisor > 0 && !instr->CheckFlag(HValue::kLeftCanBeNegative)) || |
| 1354 (divisor < 0 && !instr->CheckFlag(HValue::kLeftCanBePositive))) ? |
| 1355 NULL : TempRegister(); |
1352 LInstruction* result = | 1356 LInstruction* result = |
1353 DefineFixed(new(zone()) LFlooringDivByConstI(dividend, | 1357 DefineFixed(new(zone()) LFlooringDivByConstI(dividend, |
1354 divisor, | 1358 divisor, |
1355 temp1, | 1359 temp1, |
1356 temp2), | 1360 temp2, |
| 1361 temp3), |
1357 rdx); | 1362 rdx); |
1358 bool can_deopt = | 1363 if (divisor == 0 || |
1359 divisor == 0 || | 1364 (instr->CheckFlag(HValue::kBailoutOnMinusZero) && divisor < 0)) { |
1360 (instr->CheckFlag(HValue::kBailoutOnMinusZero) && divisor < 0); | 1365 result = AssignEnvironment(result); |
1361 return can_deopt ? AssignEnvironment(result) : result; | 1366 } |
| 1367 return result; |
1362 } | 1368 } |
1363 | 1369 |
1364 | 1370 |
1365 LInstruction* LChunkBuilder::DoMathFloorOfDiv(HMathFloorOfDiv* instr) { | 1371 LInstruction* LChunkBuilder::DoMathFloorOfDiv(HMathFloorOfDiv* instr) { |
1366 if (instr->RightIsPowerOf2()) { | 1372 if (instr->RightIsPowerOf2()) { |
1367 return DoFlooringDivByPowerOf2I(instr); | 1373 return DoFlooringDivByPowerOf2I(instr); |
1368 } else if (false && instr->right()->IsConstant()) { | 1374 } else if (instr->right()->IsConstant()) { |
1369 return DoFlooringDivByConstI(instr); // TODO(svenpanne) Fix and re-enable. | 1375 return DoFlooringDivByConstI(instr); |
1370 } else { | 1376 } else { |
1371 return DoDivI(instr); | 1377 return DoDivI(instr); |
1372 } | 1378 } |
1373 } | 1379 } |
1374 | 1380 |
1375 | 1381 |
1376 LInstruction* LChunkBuilder::DoModByPowerOf2I(HMod* instr) { | 1382 LInstruction* LChunkBuilder::DoModByPowerOf2I(HMod* instr) { |
1377 ASSERT(instr->representation().IsSmiOrInteger32()); | 1383 ASSERT(instr->representation().IsSmiOrInteger32()); |
1378 ASSERT(instr->left()->representation().Equals(instr->representation())); | 1384 ASSERT(instr->left()->representation().Equals(instr->representation())); |
1379 ASSERT(instr->right()->representation().Equals(instr->representation())); | 1385 ASSERT(instr->right()->representation().Equals(instr->representation())); |
(...skipping 1141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2521 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { | 2527 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { |
2522 LOperand* object = UseRegister(instr->object()); | 2528 LOperand* object = UseRegister(instr->object()); |
2523 LOperand* index = UseTempRegister(instr->index()); | 2529 LOperand* index = UseTempRegister(instr->index()); |
2524 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); | 2530 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); |
2525 } | 2531 } |
2526 | 2532 |
2527 | 2533 |
2528 } } // namespace v8::internal | 2534 } } // namespace v8::internal |
2529 | 2535 |
2530 #endif // V8_TARGET_ARCH_X64 | 2536 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |