| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 2661 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2672 Deoptimize(instr->environment()); | 2672 Deoptimize(instr->environment()); |
| 2673 return; | 2673 return; |
| 2674 } | 2674 } |
| 2675 | 2675 |
| 2676 // Check for (0 / -x) that will produce negative zero. | 2676 // Check for (0 / -x) that will produce negative zero. |
| 2677 HDiv* hdiv = instr->hydrogen(); | 2677 HDiv* hdiv = instr->hydrogen(); |
| 2678 if (hdiv->CheckFlag(HValue::kBailoutOnMinusZero) && divisor < 0) { | 2678 if (hdiv->CheckFlag(HValue::kBailoutOnMinusZero) && divisor < 0) { |
| 2679 DeoptimizeIfZero(dividend, instr->environment()); | 2679 DeoptimizeIfZero(dividend, instr->environment()); |
| 2680 } | 2680 } |
| 2681 | 2681 |
| 2682 __ FlooringDiv(result, dividend, Abs(divisor)); | 2682 __ TruncatingDiv(result, dividend, Abs(divisor)); |
| 2683 __ Add(result, result, Operand(dividend, LSR, 31)); | |
| 2684 if (divisor < 0) __ Neg(result, result); | 2683 if (divisor < 0) __ Neg(result, result); |
| 2685 | 2684 |
| 2686 if (!hdiv->CheckFlag(HInstruction::kAllUsesTruncatingToInt32)) { | 2685 if (!hdiv->CheckFlag(HInstruction::kAllUsesTruncatingToInt32)) { |
| 2687 Register temp = ToRegister32(instr->temp()); | 2686 Register temp = ToRegister32(instr->temp()); |
| 2688 ASSERT(!AreAliased(dividend, result, temp)); | 2687 ASSERT(!AreAliased(dividend, result, temp)); |
| 2689 __ Sxtw(dividend.X(), dividend); | 2688 __ Sxtw(dividend.X(), dividend); |
| 2690 __ Mov(temp, divisor); | 2689 __ Mov(temp, divisor); |
| 2691 __ Smsubl(temp.X(), result, temp, dividend.X()); | 2690 __ Smsubl(temp.X(), result, temp, dividend.X()); |
| 2692 DeoptimizeIfNotZero(temp, instr->environment()); | 2691 DeoptimizeIfNotZero(temp, instr->environment()); |
| 2693 } | 2692 } |
| (...skipping 1194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3888 return; | 3887 return; |
| 3889 } | 3888 } |
| 3890 | 3889 |
| 3891 // Check for (0 / -x) that will produce negative zero. | 3890 // Check for (0 / -x) that will produce negative zero. |
| 3892 HMathFloorOfDiv* hdiv = instr->hydrogen(); | 3891 HMathFloorOfDiv* hdiv = instr->hydrogen(); |
| 3893 if (hdiv->CheckFlag(HValue::kBailoutOnMinusZero) && divisor < 0) { | 3892 if (hdiv->CheckFlag(HValue::kBailoutOnMinusZero) && divisor < 0) { |
| 3894 __ Cmp(dividend, 0); | 3893 __ Cmp(dividend, 0); |
| 3895 DeoptimizeIf(eq, instr->environment()); | 3894 DeoptimizeIf(eq, instr->environment()); |
| 3896 } | 3895 } |
| 3897 | 3896 |
| 3898 __ FlooringDiv(result, dividend, divisor); | 3897 // TODO(svenpanne) Add correction terms. |
| 3898 __ TruncatingDiv(result, dividend, divisor); |
| 3899 } | 3899 } |
| 3900 | 3900 |
| 3901 | 3901 |
| 3902 void LCodeGen::DoFlooringDivI(LFlooringDivI* instr) { | 3902 void LCodeGen::DoFlooringDivI(LFlooringDivI* instr) { |
| 3903 Register dividend = ToRegister32(instr->dividend()); | 3903 Register dividend = ToRegister32(instr->dividend()); |
| 3904 Register divisor = ToRegister32(instr->divisor()); | 3904 Register divisor = ToRegister32(instr->divisor()); |
| 3905 Register remainder = ToRegister32(instr->temp()); | 3905 Register remainder = ToRegister32(instr->temp()); |
| 3906 Register result = ToRegister32(instr->result()); | 3906 Register result = ToRegister32(instr->result()); |
| 3907 | 3907 |
| 3908 // This can't cause an exception on ARM, so we can speculatively | 3908 // This can't cause an exception on ARM, so we can speculatively |
| (...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4161 int32_t divisor = instr->divisor(); | 4161 int32_t divisor = instr->divisor(); |
| 4162 Register result = ToRegister32(instr->result()); | 4162 Register result = ToRegister32(instr->result()); |
| 4163 Register temp = ToRegister32(instr->temp()); | 4163 Register temp = ToRegister32(instr->temp()); |
| 4164 ASSERT(!AreAliased(dividend, result, temp)); | 4164 ASSERT(!AreAliased(dividend, result, temp)); |
| 4165 | 4165 |
| 4166 if (divisor == 0) { | 4166 if (divisor == 0) { |
| 4167 Deoptimize(instr->environment()); | 4167 Deoptimize(instr->environment()); |
| 4168 return; | 4168 return; |
| 4169 } | 4169 } |
| 4170 | 4170 |
| 4171 __ FlooringDiv(result, dividend, Abs(divisor)); | 4171 __ TruncatingDiv(result, dividend, Abs(divisor)); |
| 4172 __ Add(result, result, Operand(dividend, LSR, 31)); | |
| 4173 __ Sxtw(dividend.X(), dividend); | 4172 __ Sxtw(dividend.X(), dividend); |
| 4174 __ Mov(temp, Abs(divisor)); | 4173 __ Mov(temp, Abs(divisor)); |
| 4175 __ Smsubl(result.X(), result, temp, dividend.X()); | 4174 __ Smsubl(result.X(), result, temp, dividend.X()); |
| 4176 | 4175 |
| 4177 // Check for negative zero. | 4176 // Check for negative zero. |
| 4178 HMod* hmod = instr->hydrogen(); | 4177 HMod* hmod = instr->hydrogen(); |
| 4179 if (hmod->CheckFlag(HValue::kBailoutOnMinusZero)) { | 4178 if (hmod->CheckFlag(HValue::kBailoutOnMinusZero)) { |
| 4180 Label remainder_not_zero; | 4179 Label remainder_not_zero; |
| 4181 __ Cbnz(result, &remainder_not_zero); | 4180 __ Cbnz(result, &remainder_not_zero); |
| 4182 DeoptimizeIfNegative(dividend, instr->environment()); | 4181 DeoptimizeIfNegative(dividend, instr->environment()); |
| (...skipping 1658 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5841 __ Bind(&out_of_object); | 5840 __ Bind(&out_of_object); |
| 5842 __ Ldr(result, FieldMemOperand(object, JSObject::kPropertiesOffset)); | 5841 __ Ldr(result, FieldMemOperand(object, JSObject::kPropertiesOffset)); |
| 5843 // Index is equal to negated out of object property index plus 1. | 5842 // Index is equal to negated out of object property index plus 1. |
| 5844 __ Sub(result, result, Operand::UntagSmiAndScale(index, kPointerSizeLog2)); | 5843 __ Sub(result, result, Operand::UntagSmiAndScale(index, kPointerSizeLog2)); |
| 5845 __ Ldr(result, FieldMemOperand(result, | 5844 __ Ldr(result, FieldMemOperand(result, |
| 5846 FixedArray::kHeaderSize - kPointerSize)); | 5845 FixedArray::kHeaderSize - kPointerSize)); |
| 5847 __ Bind(&done); | 5846 __ Bind(&done); |
| 5848 } | 5847 } |
| 5849 | 5848 |
| 5850 } } // namespace v8::internal | 5849 } } // namespace v8::internal |
| OLD | NEW |