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 1271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1282 dividend, divisor)); | 1282 dividend, divisor)); |
1283 if (divisor == 0 || | 1283 if (divisor == 0 || |
1284 (instr->CheckFlag(HValue::kBailoutOnMinusZero) && divisor < 0) || | 1284 (instr->CheckFlag(HValue::kBailoutOnMinusZero) && divisor < 0) || |
1285 !instr->CheckFlag(HInstruction::kAllUsesTruncatingToInt32)) { | 1285 !instr->CheckFlag(HInstruction::kAllUsesTruncatingToInt32)) { |
1286 result = AssignEnvironment(result); | 1286 result = AssignEnvironment(result); |
1287 } | 1287 } |
1288 return result; | 1288 return result; |
1289 } | 1289 } |
1290 | 1290 |
1291 | 1291 |
1292 LInstruction* LChunkBuilder::DoDivI(HBinaryOperation* instr) { | 1292 LInstruction* LChunkBuilder::DoDivI(HDiv* instr) { |
1293 ASSERT(instr->representation().IsSmiOrInteger32()); | 1293 ASSERT(instr->representation().IsSmiOrInteger32()); |
1294 ASSERT(instr->left()->representation().Equals(instr->representation())); | 1294 ASSERT(instr->left()->representation().Equals(instr->representation())); |
1295 ASSERT(instr->right()->representation().Equals(instr->representation())); | 1295 ASSERT(instr->right()->representation().Equals(instr->representation())); |
1296 LOperand* dividend = UseRegister(instr->left()); | 1296 LOperand* dividend = UseRegister(instr->left()); |
1297 LOperand* divisor = UseRegister(instr->right()); | 1297 LOperand* divisor = UseRegister(instr->right()); |
1298 LOperand* temp = CpuFeatures::IsSupported(SUDIV) ? NULL : FixedTemp(d4); | 1298 LOperand* temp = CpuFeatures::IsSupported(SUDIV) ? NULL : FixedTemp(d4); |
1299 LInstruction* result = | 1299 LInstruction* result = |
1300 DefineAsRegister(new(zone()) LDivI(dividend, divisor, temp)); | 1300 DefineAsRegister(new(zone()) LDivI(dividend, divisor, temp)); |
1301 if (instr->CheckFlag(HValue::kCanBeDivByZero) || | 1301 if (instr->CheckFlag(HValue::kCanBeDivByZero) || |
1302 instr->CheckFlag(HValue::kBailoutOnMinusZero) || | 1302 instr->CheckFlag(HValue::kBailoutOnMinusZero) || |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1354 LInstruction* result = DefineAsRegister( | 1354 LInstruction* result = DefineAsRegister( |
1355 new(zone()) LFlooringDivByConstI(dividend, divisor, temp)); | 1355 new(zone()) LFlooringDivByConstI(dividend, divisor, temp)); |
1356 if (divisor == 0 || | 1356 if (divisor == 0 || |
1357 (instr->CheckFlag(HValue::kBailoutOnMinusZero) && divisor < 0)) { | 1357 (instr->CheckFlag(HValue::kBailoutOnMinusZero) && divisor < 0)) { |
1358 result = AssignEnvironment(result); | 1358 result = AssignEnvironment(result); |
1359 } | 1359 } |
1360 return result; | 1360 return result; |
1361 } | 1361 } |
1362 | 1362 |
1363 | 1363 |
| 1364 LInstruction* LChunkBuilder::DoFlooringDivI(HMathFloorOfDiv* instr) { |
| 1365 ASSERT(instr->representation().IsSmiOrInteger32()); |
| 1366 ASSERT(instr->left()->representation().Equals(instr->representation())); |
| 1367 ASSERT(instr->right()->representation().Equals(instr->representation())); |
| 1368 LOperand* dividend = UseRegister(instr->left()); |
| 1369 LOperand* divisor = UseRegister(instr->right()); |
| 1370 LOperand* temp = CpuFeatures::IsSupported(SUDIV) ? NULL : FixedTemp(d4); |
| 1371 LFlooringDivI* div = new(zone()) LFlooringDivI(dividend, divisor, temp); |
| 1372 return AssignEnvironment(DefineAsRegister(div)); |
| 1373 } |
| 1374 |
| 1375 |
1364 LInstruction* LChunkBuilder::DoMathFloorOfDiv(HMathFloorOfDiv* instr) { | 1376 LInstruction* LChunkBuilder::DoMathFloorOfDiv(HMathFloorOfDiv* instr) { |
1365 if (instr->RightIsPowerOf2()) { | 1377 if (instr->RightIsPowerOf2()) { |
1366 return DoFlooringDivByPowerOf2I(instr); | 1378 return DoFlooringDivByPowerOf2I(instr); |
1367 } else if (instr->right()->IsConstant()) { | 1379 } else if (instr->right()->IsConstant()) { |
1368 return DoFlooringDivByConstI(instr); | 1380 return DoFlooringDivByConstI(instr); |
1369 } else { | 1381 } else { |
1370 return DoDivI(instr); | 1382 return DoFlooringDivI(instr); |
1371 } | 1383 } |
1372 } | 1384 } |
1373 | 1385 |
1374 | 1386 |
1375 LInstruction* LChunkBuilder::DoModByPowerOf2I(HMod* instr) { | 1387 LInstruction* LChunkBuilder::DoModByPowerOf2I(HMod* instr) { |
1376 ASSERT(instr->representation().IsSmiOrInteger32()); | 1388 ASSERT(instr->representation().IsSmiOrInteger32()); |
1377 ASSERT(instr->left()->representation().Equals(instr->representation())); | 1389 ASSERT(instr->left()->representation().Equals(instr->representation())); |
1378 ASSERT(instr->right()->representation().Equals(instr->representation())); | 1390 ASSERT(instr->right()->representation().Equals(instr->representation())); |
1379 LOperand* dividend = UseRegisterAtStart(instr->left()); | 1391 LOperand* dividend = UseRegisterAtStart(instr->left()); |
1380 int32_t divisor = instr->right()->GetInteger32Constant(); | 1392 int32_t divisor = instr->right()->GetInteger32Constant(); |
(...skipping 1178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2559 | 2571 |
2560 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { | 2572 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { |
2561 LOperand* object = UseRegister(instr->object()); | 2573 LOperand* object = UseRegister(instr->object()); |
2562 LOperand* index = UseRegister(instr->index()); | 2574 LOperand* index = UseRegister(instr->index()); |
2563 LLoadFieldByIndex* load = new(zone()) LLoadFieldByIndex(object, index); | 2575 LLoadFieldByIndex* load = new(zone()) LLoadFieldByIndex(object, index); |
2564 LInstruction* result = DefineSameAsFirst(load); | 2576 LInstruction* result = DefineSameAsFirst(load); |
2565 return AssignPointerMap(result); | 2577 return AssignPointerMap(result); |
2566 } | 2578 } |
2567 | 2579 |
2568 } } // namespace v8::internal | 2580 } } // namespace v8::internal |
OLD | NEW |