| 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 3821 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3832 | 3832 |
| 3833 __ Bind(&deopt); | 3833 __ Bind(&deopt); |
| 3834 Deoptimize(instr->environment()); | 3834 Deoptimize(instr->environment()); |
| 3835 | 3835 |
| 3836 __ Bind(&done); | 3836 __ Bind(&done); |
| 3837 } | 3837 } |
| 3838 | 3838 |
| 3839 | 3839 |
| 3840 void LCodeGen::DoFlooringDivByPowerOf2I(LFlooringDivByPowerOf2I* instr) { | 3840 void LCodeGen::DoFlooringDivByPowerOf2I(LFlooringDivByPowerOf2I* instr) { |
| 3841 Register dividend = ToRegister32(instr->dividend()); | 3841 Register dividend = ToRegister32(instr->dividend()); |
| 3842 Register result = ToRegister32(instr->result()); |
| 3842 int32_t divisor = instr->divisor(); | 3843 int32_t divisor = instr->divisor(); |
| 3843 ASSERT(dividend.is(ToRegister32(instr->result()))); | |
| 3844 | 3844 |
| 3845 // If the divisor is positive, things are easy: There can be no deopts and we | 3845 // If the divisor is positive, things are easy: There can be no deopts and we |
| 3846 // can simply do an arithmetic right shift. | 3846 // can simply do an arithmetic right shift. |
| 3847 if (divisor == 1) return; | 3847 if (divisor == 1) return; |
| 3848 int32_t shift = WhichPowerOf2Abs(divisor); | 3848 int32_t shift = WhichPowerOf2Abs(divisor); |
| 3849 if (divisor > 1) { | 3849 if (divisor > 1) { |
| 3850 __ Mov(dividend, Operand(dividend, ASR, shift)); | 3850 __ Mov(result, Operand(dividend, ASR, shift)); |
| 3851 return; | 3851 return; |
| 3852 } | 3852 } |
| 3853 | 3853 |
| 3854 // If the divisor is negative, we have to negate and handle edge cases. | 3854 // If the divisor is negative, we have to negate and handle edge cases. |
| 3855 Label not_kmin_int, done; | 3855 Label not_kmin_int, done; |
| 3856 __ Negs(dividend, dividend); | 3856 __ Negs(result, dividend); |
| 3857 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) { | 3857 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) { |
| 3858 DeoptimizeIf(eq, instr->environment()); | 3858 DeoptimizeIf(eq, instr->environment()); |
| 3859 } | 3859 } |
| 3860 if (instr->hydrogen()->left()->RangeCanInclude(kMinInt)) { | 3860 if (instr->hydrogen()->CheckFlag(HValue::kLeftCanBeMinInt)) { |
| 3861 // Note that we could emit branch-free code, but that would need one more | 3861 // Note that we could emit branch-free code, but that would need one more |
| 3862 // register. | 3862 // register. |
| 3863 __ B(vc, ¬_kmin_int); | |
| 3864 if (divisor == -1) { | 3863 if (divisor == -1) { |
| 3865 Deoptimize(instr->environment()); | 3864 DeoptimizeIf(vs, instr->environment()); |
| 3866 } else { | 3865 } else { |
| 3867 __ Mov(dividend, kMinInt / divisor); | 3866 __ B(vc, ¬_kmin_int); |
| 3867 __ Mov(result, kMinInt / divisor); |
| 3868 __ B(&done); | 3868 __ B(&done); |
| 3869 } | 3869 } |
| 3870 } | 3870 } |
| 3871 __ bind(¬_kmin_int); | 3871 __ bind(¬_kmin_int); |
| 3872 __ Mov(dividend, Operand(dividend, ASR, shift)); | 3872 __ Mov(result, Operand(dividend, ASR, shift)); |
| 3873 __ bind(&done); | 3873 __ bind(&done); |
| 3874 } | 3874 } |
| 3875 | 3875 |
| 3876 | 3876 |
| 3877 void LCodeGen::DoFlooringDivByConstI(LFlooringDivByConstI* instr) { | 3877 void LCodeGen::DoFlooringDivByConstI(LFlooringDivByConstI* instr) { |
| 3878 Register dividend = ToRegister32(instr->dividend()); | 3878 Register dividend = ToRegister32(instr->dividend()); |
| 3879 int32_t divisor = instr->divisor(); | 3879 int32_t divisor = instr->divisor(); |
| 3880 Register result = ToRegister32(instr->result()); | 3880 Register result = ToRegister32(instr->result()); |
| 3881 ASSERT(!AreAliased(dividend, result)); | 3881 ASSERT(!AreAliased(dividend, result)); |
| 3882 | 3882 |
| (...skipping 1949 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5832 __ Bind(&out_of_object); | 5832 __ Bind(&out_of_object); |
| 5833 __ Ldr(result, FieldMemOperand(object, JSObject::kPropertiesOffset)); | 5833 __ Ldr(result, FieldMemOperand(object, JSObject::kPropertiesOffset)); |
| 5834 // Index is equal to negated out of object property index plus 1. | 5834 // Index is equal to negated out of object property index plus 1. |
| 5835 __ Sub(result, result, Operand::UntagSmiAndScale(index, kPointerSizeLog2)); | 5835 __ Sub(result, result, Operand::UntagSmiAndScale(index, kPointerSizeLog2)); |
| 5836 __ Ldr(result, FieldMemOperand(result, | 5836 __ Ldr(result, FieldMemOperand(result, |
| 5837 FixedArray::kHeaderSize - kPointerSize)); | 5837 FixedArray::kHeaderSize - kPointerSize)); |
| 5838 __ Bind(&done); | 5838 __ Bind(&done); |
| 5839 } | 5839 } |
| 5840 | 5840 |
| 5841 } } // namespace v8::internal | 5841 } } // namespace v8::internal |
| OLD | NEW |