| 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 1597 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1608 ASSERT(ToRegister(instr->left()).is(eax)); | 1608 ASSERT(ToRegister(instr->left()).is(eax)); |
| 1609 ASSERT(ToRegister(instr->result()).is(edx)); | 1609 ASSERT(ToRegister(instr->result()).is(edx)); |
| 1610 Register scratch = ToRegister(instr->temp()); | 1610 Register scratch = ToRegister(instr->temp()); |
| 1611 | 1611 |
| 1612 // Find b which: 2^b < divisor_abs < 2^(b+1). | 1612 // Find b which: 2^b < divisor_abs < 2^(b+1). |
| 1613 unsigned b = 31 - CompilerIntrinsics::CountLeadingZeros(divisor_abs); | 1613 unsigned b = 31 - CompilerIntrinsics::CountLeadingZeros(divisor_abs); |
| 1614 unsigned shift = 32 + b; // Precision +1bit (effectively). | 1614 unsigned shift = 32 + b; // Precision +1bit (effectively). |
| 1615 double multiplier_f = | 1615 double multiplier_f = |
| 1616 static_cast<double>(static_cast<uint64_t>(1) << shift) / divisor_abs; | 1616 static_cast<double>(static_cast<uint64_t>(1) << shift) / divisor_abs; |
| 1617 int64_t multiplier; | 1617 int64_t multiplier; |
| 1618 if (multiplier_f - floor(multiplier_f) < 0.5) { | 1618 if (multiplier_f - std::floor(multiplier_f) < 0.5) { |
| 1619 multiplier = static_cast<int64_t>(floor(multiplier_f)); | 1619 multiplier = static_cast<int64_t>(std::floor(multiplier_f)); |
| 1620 } else { | 1620 } else { |
| 1621 multiplier = static_cast<int64_t>(floor(multiplier_f)) + 1; | 1621 multiplier = static_cast<int64_t>(std::floor(multiplier_f)) + 1; |
| 1622 } | 1622 } |
| 1623 // The multiplier is a uint32. | 1623 // The multiplier is a uint32. |
| 1624 ASSERT(multiplier > 0 && | 1624 ASSERT(multiplier > 0 && |
| 1625 multiplier < (static_cast<int64_t>(1) << 32)); | 1625 multiplier < (static_cast<int64_t>(1) << 32)); |
| 1626 __ mov(scratch, dividend); | 1626 __ mov(scratch, dividend); |
| 1627 if (divisor < 0 && | 1627 if (divisor < 0 && |
| 1628 instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) { | 1628 instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) { |
| 1629 __ test(dividend, dividend); | 1629 __ test(dividend, dividend); |
| 1630 DeoptimizeIf(zero, instr->environment()); | 1630 DeoptimizeIf(zero, instr->environment()); |
| 1631 } | 1631 } |
| (...skipping 4726 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6358 FixedArray::kHeaderSize - kPointerSize)); | 6358 FixedArray::kHeaderSize - kPointerSize)); |
| 6359 __ bind(&done); | 6359 __ bind(&done); |
| 6360 } | 6360 } |
| 6361 | 6361 |
| 6362 | 6362 |
| 6363 #undef __ | 6363 #undef __ |
| 6364 | 6364 |
| 6365 } } // namespace v8::internal | 6365 } } // namespace v8::internal |
| 6366 | 6366 |
| 6367 #endif // V8_TARGET_ARCH_IA32 | 6367 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |