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 1272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1283 dividend, divisor)); | 1283 dividend, divisor)); |
1284 if (divisor == 0 || | 1284 if (divisor == 0 || |
1285 (instr->CheckFlag(HValue::kBailoutOnMinusZero) && divisor < 0) || | 1285 (instr->CheckFlag(HValue::kBailoutOnMinusZero) && divisor < 0) || |
1286 !instr->CheckFlag(HInstruction::kAllUsesTruncatingToInt32)) { | 1286 !instr->CheckFlag(HInstruction::kAllUsesTruncatingToInt32)) { |
1287 result = AssignEnvironment(result); | 1287 result = AssignEnvironment(result); |
1288 } | 1288 } |
1289 return result; | 1289 return result; |
1290 } | 1290 } |
1291 | 1291 |
1292 | 1292 |
1293 LInstruction* LChunkBuilder::DoDivI(HBinaryOperation* instr) { | 1293 LInstruction* LChunkBuilder::DoDivI(HDiv* instr) { |
1294 ASSERT(instr->representation().IsSmiOrInteger32()); | 1294 ASSERT(instr->representation().IsSmiOrInteger32()); |
1295 ASSERT(instr->left()->representation().Equals(instr->representation())); | 1295 ASSERT(instr->left()->representation().Equals(instr->representation())); |
1296 ASSERT(instr->right()->representation().Equals(instr->representation())); | 1296 ASSERT(instr->right()->representation().Equals(instr->representation())); |
1297 LOperand* dividend = UseRegister(instr->left()); | 1297 LOperand* dividend = UseRegister(instr->left()); |
1298 LOperand* divisor = UseRegister(instr->right()); | 1298 LOperand* divisor = UseRegister(instr->right()); |
1299 LDivI* div = new(zone()) LDivI(dividend, divisor); | 1299 LDivI* div = new(zone()) LDivI(dividend, divisor); |
1300 return AssignEnvironment(DefineAsRegister(div)); | 1300 return AssignEnvironment(DefineAsRegister(div)); |
1301 } | 1301 } |
1302 | 1302 |
1303 | 1303 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1344 LInstruction* result = DefineAsRegister( | 1344 LInstruction* result = DefineAsRegister( |
1345 new(zone()) LFlooringDivByConstI(dividend, divisor, temp)); | 1345 new(zone()) LFlooringDivByConstI(dividend, divisor, temp)); |
1346 if (divisor == 0 || | 1346 if (divisor == 0 || |
1347 (instr->CheckFlag(HValue::kBailoutOnMinusZero) && divisor < 0)) { | 1347 (instr->CheckFlag(HValue::kBailoutOnMinusZero) && divisor < 0)) { |
1348 result = AssignEnvironment(result); | 1348 result = AssignEnvironment(result); |
1349 } | 1349 } |
1350 return result; | 1350 return result; |
1351 } | 1351 } |
1352 | 1352 |
1353 | 1353 |
| 1354 LInstruction* LChunkBuilder::DoFlooringDivI(HMathFloorOfDiv* instr) { |
| 1355 ASSERT(instr->representation().IsSmiOrInteger32()); |
| 1356 ASSERT(instr->left()->representation().Equals(instr->representation())); |
| 1357 ASSERT(instr->right()->representation().Equals(instr->representation())); |
| 1358 LOperand* dividend = UseRegister(instr->left()); |
| 1359 LOperand* divisor = UseRegister(instr->right()); |
| 1360 LFlooringDivI* div = new(zone()) LFlooringDivI(dividend, divisor); |
| 1361 return AssignEnvironment(DefineAsRegister(div)); |
| 1362 } |
| 1363 |
| 1364 |
1354 LInstruction* LChunkBuilder::DoMathFloorOfDiv(HMathFloorOfDiv* instr) { | 1365 LInstruction* LChunkBuilder::DoMathFloorOfDiv(HMathFloorOfDiv* instr) { |
1355 if (instr->RightIsPowerOf2()) { | 1366 if (instr->RightIsPowerOf2()) { |
1356 return DoFlooringDivByPowerOf2I(instr); | 1367 return DoFlooringDivByPowerOf2I(instr); |
1357 } else if (instr->right()->IsConstant()) { | 1368 } else if (instr->right()->IsConstant()) { |
1358 return DoFlooringDivByConstI(instr); | 1369 return DoFlooringDivByConstI(instr); |
1359 } else { | 1370 } else { |
1360 return DoDivI(instr); | 1371 return DoFlooringDivI(instr); |
1361 } | 1372 } |
1362 } | 1373 } |
1363 | 1374 |
1364 | 1375 |
1365 LInstruction* LChunkBuilder::DoModByPowerOf2I(HMod* instr) { | 1376 LInstruction* LChunkBuilder::DoModByPowerOf2I(HMod* instr) { |
1366 ASSERT(instr->representation().IsSmiOrInteger32()); | 1377 ASSERT(instr->representation().IsSmiOrInteger32()); |
1367 ASSERT(instr->left()->representation().Equals(instr->representation())); | 1378 ASSERT(instr->left()->representation().Equals(instr->representation())); |
1368 ASSERT(instr->right()->representation().Equals(instr->representation())); | 1379 ASSERT(instr->right()->representation().Equals(instr->representation())); |
1369 LOperand* dividend = UseRegisterAtStart(instr->left()); | 1380 LOperand* dividend = UseRegisterAtStart(instr->left()); |
1370 int32_t divisor = instr->right()->GetInteger32Constant(); | 1381 int32_t divisor = instr->right()->GetInteger32Constant(); |
(...skipping 1121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2492 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { | 2503 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { |
2493 LOperand* object = UseRegister(instr->object()); | 2504 LOperand* object = UseRegister(instr->object()); |
2494 LOperand* index = UseRegister(instr->index()); | 2505 LOperand* index = UseRegister(instr->index()); |
2495 LLoadFieldByIndex* load = new(zone()) LLoadFieldByIndex(object, index); | 2506 LLoadFieldByIndex* load = new(zone()) LLoadFieldByIndex(object, index); |
2496 LInstruction* result = DefineSameAsFirst(load); | 2507 LInstruction* result = DefineSameAsFirst(load); |
2497 return AssignPointerMap(result); | 2508 return AssignPointerMap(result); |
2498 } | 2509 } |
2499 | 2510 |
2500 | 2511 |
2501 } } // namespace v8::internal | 2512 } } // namespace v8::internal |
OLD | NEW |