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 2689 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2700 Register temp = ToRegister32(instr->temp()); | 2700 Register temp = ToRegister32(instr->temp()); |
2701 ASSERT(!AreAliased(dividend, result, temp)); | 2701 ASSERT(!AreAliased(dividend, result, temp)); |
2702 __ Sxtw(dividend.X(), dividend); | 2702 __ Sxtw(dividend.X(), dividend); |
2703 __ Mov(temp, divisor); | 2703 __ Mov(temp, divisor); |
2704 __ Smsubl(temp.X(), result, temp, dividend.X()); | 2704 __ Smsubl(temp.X(), result, temp, dividend.X()); |
2705 DeoptimizeIfNotZero(temp, instr->environment()); | 2705 DeoptimizeIfNotZero(temp, instr->environment()); |
2706 } | 2706 } |
2707 } | 2707 } |
2708 | 2708 |
2709 | 2709 |
| 2710 // TODO(svenpanne) Refactor this to avoid code duplication with DoFlooringDivI. |
2710 void LCodeGen::DoDivI(LDivI* instr) { | 2711 void LCodeGen::DoDivI(LDivI* instr) { |
2711 HBinaryOperation* hdiv = instr->hydrogen(); | 2712 HBinaryOperation* hdiv = instr->hydrogen(); |
2712 Register dividend = ToRegister32(instr->left()); | 2713 Register dividend = ToRegister32(instr->dividend()); |
2713 Register divisor = ToRegister32(instr->right()); | 2714 Register divisor = ToRegister32(instr->divisor()); |
2714 Register result = ToRegister32(instr->result()); | 2715 Register result = ToRegister32(instr->result()); |
2715 | 2716 |
2716 // Issue the division first, and then check for any deopt cases whilst the | 2717 // Issue the division first, and then check for any deopt cases whilst the |
2717 // result is computed. | 2718 // result is computed. |
2718 __ Sdiv(result, dividend, divisor); | 2719 __ Sdiv(result, dividend, divisor); |
2719 | 2720 |
2720 if (hdiv->CheckFlag(HValue::kAllUsesTruncatingToInt32)) { | 2721 if (hdiv->CheckFlag(HValue::kAllUsesTruncatingToInt32)) { |
2721 ASSERT_EQ(NULL, instr->temp()); | 2722 ASSERT_EQ(NULL, instr->temp()); |
2722 return; | 2723 return; |
2723 } | 2724 } |
(...skipping 1205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3929 __ B(&done); | 3930 __ B(&done); |
3930 __ bind(&needs_adjustment); | 3931 __ bind(&needs_adjustment); |
3931 __ Add(temp, dividend, Operand(divisor > 0 ? 1 : -1)); | 3932 __ Add(temp, dividend, Operand(divisor > 0 ? 1 : -1)); |
3932 __ TruncatingDiv(result, temp, Abs(divisor)); | 3933 __ TruncatingDiv(result, temp, Abs(divisor)); |
3933 if (divisor < 0) __ Neg(result, result); | 3934 if (divisor < 0) __ Neg(result, result); |
3934 __ Sub(result, result, Operand(1)); | 3935 __ Sub(result, result, Operand(1)); |
3935 __ bind(&done); | 3936 __ bind(&done); |
3936 } | 3937 } |
3937 | 3938 |
3938 | 3939 |
| 3940 // TODO(svenpanne) Refactor this to avoid code duplication with DoDivI. |
3939 void LCodeGen::DoFlooringDivI(LFlooringDivI* instr) { | 3941 void LCodeGen::DoFlooringDivI(LFlooringDivI* instr) { |
3940 Register dividend = ToRegister32(instr->dividend()); | 3942 Register dividend = ToRegister32(instr->dividend()); |
3941 Register divisor = ToRegister32(instr->divisor()); | 3943 Register divisor = ToRegister32(instr->divisor()); |
3942 Register remainder = ToRegister32(instr->temp()); | 3944 Register remainder = ToRegister32(instr->temp()); |
3943 Register result = ToRegister32(instr->result()); | 3945 Register result = ToRegister32(instr->result()); |
3944 | 3946 |
3945 // This can't cause an exception on ARM, so we can speculatively | 3947 // This can't cause an exception on ARM, so we can speculatively |
3946 // execute it already now. | 3948 // execute it already now. |
3947 __ Sdiv(result, dividend, divisor); | 3949 __ Sdiv(result, dividend, divisor); |
3948 | 3950 |
(...skipping 1998 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5947 __ Ldr(result, FieldMemOperand(object, JSObject::kPropertiesOffset)); | 5949 __ Ldr(result, FieldMemOperand(object, JSObject::kPropertiesOffset)); |
5948 // Index is equal to negated out of object property index plus 1. | 5950 // Index is equal to negated out of object property index plus 1. |
5949 __ Sub(result, result, Operand::UntagSmiAndScale(index, kPointerSizeLog2)); | 5951 __ Sub(result, result, Operand::UntagSmiAndScale(index, kPointerSizeLog2)); |
5950 __ Ldr(result, FieldMemOperand(result, | 5952 __ Ldr(result, FieldMemOperand(result, |
5951 FixedArray::kHeaderSize - kPointerSize)); | 5953 FixedArray::kHeaderSize - kPointerSize)); |
5952 __ Bind(deferred->exit()); | 5954 __ Bind(deferred->exit()); |
5953 __ Bind(&done); | 5955 __ Bind(&done); |
5954 } | 5956 } |
5955 | 5957 |
5956 } } // namespace v8::internal | 5958 } } // namespace v8::internal |
OLD | NEW |