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 1386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1397 int32_t power_of_2_factor = | 1397 int32_t power_of_2_factor = |
1398 CompilerIntrinsics::CountTrailingZeros(divisor_abs); | 1398 CompilerIntrinsics::CountTrailingZeros(divisor_abs); |
1399 DivMagicNumbers magic_numbers = | 1399 DivMagicNumbers magic_numbers = |
1400 DivMagicNumberFor(divisor_abs >> power_of_2_factor); | 1400 DivMagicNumberFor(divisor_abs >> power_of_2_factor); |
1401 if (magic_numbers.M != InvalidDivMagicNumber.M) return true; | 1401 if (magic_numbers.M != InvalidDivMagicNumber.M) return true; |
1402 | 1402 |
1403 return false; | 1403 return false; |
1404 } | 1404 } |
1405 | 1405 |
1406 | 1406 |
1407 HValue* LChunkBuilder::SimplifiedDividendForMathFloorOfDiv(HValue* dividend) { | |
1408 // A value with an integer representation does not need to be transformed. | |
1409 if (dividend->representation().IsInteger32()) { | |
1410 return dividend; | |
1411 // A change from an integer32 can be replaced by the integer32 value. | |
1412 } else if (dividend->IsChange() && | |
1413 HChange::cast(dividend)->from().IsInteger32()) { | |
1414 return HChange::cast(dividend)->value(); | |
1415 } | |
1416 return NULL; | |
1417 } | |
1418 | |
1419 | |
1420 HValue* LChunkBuilder::SimplifiedDivisorForMathFloorOfDiv(HValue* divisor) { | 1407 HValue* LChunkBuilder::SimplifiedDivisorForMathFloorOfDiv(HValue* divisor) { |
1421 if (CpuFeatures::IsSupported(SUDIV)) { | 1408 if (CpuFeatures::IsSupported(SUDIV)) { |
1422 // A value with an integer representation does not need to be transformed. | 1409 // A value with an integer representation does not need to be transformed. |
1423 if (divisor->representation().IsInteger32()) { | 1410 if (divisor->representation().IsInteger32()) { |
1424 return divisor; | 1411 return divisor; |
1425 // A change from an integer32 can be replaced by the integer32 value. | 1412 // A change from an integer32 can be replaced by the integer32 value. |
1426 } else if (divisor->IsChange() && | 1413 } else if (divisor->IsChange() && |
1427 HChange::cast(divisor)->from().IsInteger32()) { | 1414 HChange::cast(divisor)->from().IsInteger32()) { |
1428 return HChange::cast(divisor)->value(); | 1415 return HChange::cast(divisor)->value(); |
1429 } | 1416 } |
(...skipping 1234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2664 | 2651 |
2665 | 2652 |
2666 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { | 2653 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { |
2667 LOperand* object = UseRegister(instr->object()); | 2654 LOperand* object = UseRegister(instr->object()); |
2668 LOperand* index = UseRegister(instr->index()); | 2655 LOperand* index = UseRegister(instr->index()); |
2669 return DefineAsRegister(new(zone()) LLoadFieldByIndex(object, index)); | 2656 return DefineAsRegister(new(zone()) LLoadFieldByIndex(object, index)); |
2670 } | 2657 } |
2671 | 2658 |
2672 | 2659 |
2673 } } // namespace v8::internal | 2660 } } // namespace v8::internal |
OLD | NEW |