| 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 1354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1365 | 1365 |
| 1366 void LCodeGen::DoUnknownOSRValue(LUnknownOSRValue* instr) { | 1366 void LCodeGen::DoUnknownOSRValue(LUnknownOSRValue* instr) { |
| 1367 GenerateOsrPrologue(); | 1367 GenerateOsrPrologue(); |
| 1368 } | 1368 } |
| 1369 | 1369 |
| 1370 | 1370 |
| 1371 void LCodeGen::DoModI(LModI* instr) { | 1371 void LCodeGen::DoModI(LModI* instr) { |
| 1372 HMod* hmod = instr->hydrogen(); | 1372 HMod* hmod = instr->hydrogen(); |
| 1373 HValue* left = hmod->left(); | 1373 HValue* left = hmod->left(); |
| 1374 HValue* right = hmod->right(); | 1374 HValue* right = hmod->right(); |
| 1375 if (hmod->HasPowerOf2Divisor()) { | 1375 if (hmod->RightIsPowerOf2()) { |
| 1376 // TODO(svenpanne) We should really do the strength reduction on the | 1376 // TODO(svenpanne) We should really do the strength reduction on the |
| 1377 // Hydrogen level. | 1377 // Hydrogen level. |
| 1378 Register left_reg = ToRegister(instr->left()); | 1378 Register left_reg = ToRegister(instr->left()); |
| 1379 ASSERT(left_reg.is(ToRegister(instr->result()))); | 1379 ASSERT(left_reg.is(ToRegister(instr->result()))); |
| 1380 | 1380 |
| 1381 // Note: The code below even works when right contains kMinInt. | 1381 // Note: The code below even works when right contains kMinInt. |
| 1382 int32_t divisor = Abs(right->GetInteger32Constant()); | 1382 int32_t divisor = Abs(right->GetInteger32Constant()); |
| 1383 | 1383 |
| 1384 Label left_is_not_negative, done; | 1384 Label left_is_not_negative, done; |
| 1385 if (left->CanBeNegative()) { | 1385 if (left->CanBeNegative()) { |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1447 __ jmp(&done, Label::kNear); | 1447 __ jmp(&done, Label::kNear); |
| 1448 __ bind(&positive_left); | 1448 __ bind(&positive_left); |
| 1449 } | 1449 } |
| 1450 __ idiv(right_reg); | 1450 __ idiv(right_reg); |
| 1451 __ bind(&done); | 1451 __ bind(&done); |
| 1452 } | 1452 } |
| 1453 } | 1453 } |
| 1454 | 1454 |
| 1455 | 1455 |
| 1456 void LCodeGen::DoDivI(LDivI* instr) { | 1456 void LCodeGen::DoDivI(LDivI* instr) { |
| 1457 if (!instr->is_flooring() && instr->hydrogen()->HasPowerOf2Divisor()) { | 1457 if (!instr->is_flooring() && instr->hydrogen()->RightIsPowerOf2()) { |
| 1458 Register dividend = ToRegister(instr->left()); | 1458 Register dividend = ToRegister(instr->left()); |
| 1459 int32_t divisor = instr->hydrogen()->right()->GetInteger32Constant(); | 1459 int32_t divisor = instr->hydrogen()->right()->GetInteger32Constant(); |
| 1460 int32_t test_value = 0; | 1460 int32_t test_value = 0; |
| 1461 int32_t power = 0; | 1461 int32_t power = 0; |
| 1462 | 1462 |
| 1463 if (divisor > 0) { | 1463 if (divisor > 0) { |
| 1464 test_value = divisor - 1; | 1464 test_value = divisor - 1; |
| 1465 power = WhichPowerOf2(divisor); | 1465 power = WhichPowerOf2(divisor); |
| 1466 } else { | 1466 } else { |
| 1467 // Check for (0 / -x) that will produce negative zero. | 1467 // Check for (0 / -x) that will produce negative zero. |
| (...skipping 4888 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6356 FixedArray::kHeaderSize - kPointerSize)); | 6356 FixedArray::kHeaderSize - kPointerSize)); |
| 6357 __ bind(&done); | 6357 __ bind(&done); |
| 6358 } | 6358 } |
| 6359 | 6359 |
| 6360 | 6360 |
| 6361 #undef __ | 6361 #undef __ |
| 6362 | 6362 |
| 6363 } } // namespace v8::internal | 6363 } } // namespace v8::internal |
| 6364 | 6364 |
| 6365 #endif // V8_TARGET_ARCH_IA32 | 6365 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |