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 4708 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4719 STATIC_ASSERT(kHeapObjectTag == 1); | 4719 STATIC_ASSERT(kHeapObjectTag == 1); |
4720 __ adc(input_reg, input_reg, Operand(input_reg)); | 4720 __ adc(input_reg, input_reg, Operand(input_reg)); |
4721 | 4721 |
4722 // Heap number map check. | 4722 // Heap number map check. |
4723 __ ldr(scratch1, FieldMemOperand(input_reg, HeapObject::kMapOffset)); | 4723 __ ldr(scratch1, FieldMemOperand(input_reg, HeapObject::kMapOffset)); |
4724 __ LoadRoot(ip, Heap::kHeapNumberMapRootIndex); | 4724 __ LoadRoot(ip, Heap::kHeapNumberMapRootIndex); |
4725 __ cmp(scratch1, Operand(ip)); | 4725 __ cmp(scratch1, Operand(ip)); |
4726 | 4726 |
4727 if (instr->truncating()) { | 4727 if (instr->truncating()) { |
4728 Register scratch3 = ToRegister(instr->temp2()); | 4728 Register scratch3 = ToRegister(instr->temp2()); |
4729 SwVfpRegister single_scratch = double_scratch.low(); | |
4730 ASSERT(!scratch3.is(input_reg) && | 4729 ASSERT(!scratch3.is(input_reg) && |
4731 !scratch3.is(scratch1) && | 4730 !scratch3.is(scratch1) && |
4732 !scratch3.is(scratch2)); | 4731 !scratch3.is(scratch2)); |
4733 // Performs a truncating conversion of a floating point number as used by | 4732 // Performs a truncating conversion of a floating point number as used by |
4734 // the JS bitwise operations. | 4733 // the JS bitwise operations. |
4735 Label heap_number; | 4734 Label heap_number; |
4736 __ b(eq, &heap_number); | 4735 __ b(eq, &heap_number); |
4737 // Check for undefined. Undefined is converted to zero for truncating | 4736 // Check for undefined. Undefined is converted to zero for truncating |
4738 // conversions. | 4737 // conversions. |
4739 __ LoadRoot(ip, Heap::kUndefinedValueRootIndex); | 4738 __ LoadRoot(ip, Heap::kUndefinedValueRootIndex); |
4740 __ cmp(input_reg, Operand(ip)); | 4739 __ cmp(input_reg, Operand(ip)); |
4741 DeoptimizeIf(ne, instr->environment()); | 4740 DeoptimizeIf(ne, instr->environment()); |
4742 __ mov(input_reg, Operand(0)); | 4741 __ mov(input_reg, Operand(0)); |
4743 __ b(&done); | 4742 __ b(&done); |
4744 | 4743 |
4745 __ bind(&heap_number); | 4744 __ bind(&heap_number); |
4746 __ sub(scratch1, input_reg, Operand(kHeapObjectTag)); | 4745 __ sub(scratch1, input_reg, Operand(kHeapObjectTag)); |
4747 __ vldr(double_scratch2, scratch1, HeapNumber::kValueOffset); | 4746 __ vldr(double_scratch2, scratch1, HeapNumber::kValueOffset); |
4748 | 4747 |
4749 __ EmitECMATruncate(input_reg, | 4748 __ EmitECMATruncate(input_reg, |
4750 double_scratch2, | 4749 double_scratch2, |
4751 single_scratch, | 4750 double_scratch, |
4752 scratch1, | 4751 scratch1, |
4753 scratch2, | 4752 scratch2, |
4754 scratch3); | 4753 scratch3); |
4755 | 4754 |
4756 } else { | 4755 } else { |
4757 CpuFeatures::Scope scope(VFP3); | 4756 CpuFeatures::Scope scope(VFP3); |
4758 // Deoptimize if we don't have a heap number. | 4757 // Deoptimize if we don't have a heap number. |
4759 DeoptimizeIf(ne, instr->environment()); | 4758 DeoptimizeIf(ne, instr->environment()); |
4760 | 4759 |
4761 __ sub(ip, input_reg, Operand(kHeapObjectTag)); | 4760 __ sub(ip, input_reg, Operand(kHeapObjectTag)); |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4823 instr->hydrogen()->deoptimize_on_minus_zero(), | 4822 instr->hydrogen()->deoptimize_on_minus_zero(), |
4824 instr->environment()); | 4823 instr->environment()); |
4825 } | 4824 } |
4826 | 4825 |
4827 | 4826 |
4828 void LCodeGen::DoDoubleToI(LDoubleToI* instr) { | 4827 void LCodeGen::DoDoubleToI(LDoubleToI* instr) { |
4829 Register result_reg = ToRegister(instr->result()); | 4828 Register result_reg = ToRegister(instr->result()); |
4830 Register scratch1 = scratch0(); | 4829 Register scratch1 = scratch0(); |
4831 Register scratch2 = ToRegister(instr->temp()); | 4830 Register scratch2 = ToRegister(instr->temp()); |
4832 DwVfpRegister double_input = ToDoubleRegister(instr->value()); | 4831 DwVfpRegister double_input = ToDoubleRegister(instr->value()); |
| 4832 DwVfpRegister double_scratch = double_scratch0(); |
4833 | 4833 |
4834 Label done; | 4834 Label done; |
4835 | 4835 |
4836 if (instr->truncating()) { | 4836 if (instr->truncating()) { |
4837 Register scratch3 = ToRegister(instr->temp2()); | 4837 Register scratch3 = ToRegister(instr->temp2()); |
4838 SwVfpRegister single_scratch = double_scratch0().low(); | |
4839 __ EmitECMATruncate(result_reg, | 4838 __ EmitECMATruncate(result_reg, |
4840 double_input, | 4839 double_input, |
4841 single_scratch, | 4840 double_scratch, |
4842 scratch1, | 4841 scratch1, |
4843 scratch2, | 4842 scratch2, |
4844 scratch3); | 4843 scratch3); |
4845 } else { | 4844 } else { |
4846 DwVfpRegister double_scratch = double_scratch0(); | |
4847 __ EmitVFPTruncate(kRoundToMinusInf, | 4845 __ EmitVFPTruncate(kRoundToMinusInf, |
4848 result_reg, | 4846 result_reg, |
4849 double_input, | 4847 double_input, |
4850 scratch1, | 4848 scratch1, |
4851 double_scratch, | 4849 double_scratch, |
4852 kCheckForInexactConversion); | 4850 kCheckForInexactConversion); |
4853 | 4851 |
4854 // Deoptimize if we had a vfp invalid exception, | 4852 // Deoptimize if we had a vfp invalid exception, |
4855 // including inexact operation. | 4853 // including inexact operation. |
4856 DeoptimizeIf(ne, instr->environment()); | 4854 DeoptimizeIf(ne, instr->environment()); |
(...skipping 927 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5784 __ sub(scratch, result, Operand(index, LSL, kPointerSizeLog2 - kSmiTagSize)); | 5782 __ sub(scratch, result, Operand(index, LSL, kPointerSizeLog2 - kSmiTagSize)); |
5785 __ ldr(result, FieldMemOperand(scratch, | 5783 __ ldr(result, FieldMemOperand(scratch, |
5786 FixedArray::kHeaderSize - kPointerSize)); | 5784 FixedArray::kHeaderSize - kPointerSize)); |
5787 __ bind(&done); | 5785 __ bind(&done); |
5788 } | 5786 } |
5789 | 5787 |
5790 | 5788 |
5791 #undef __ | 5789 #undef __ |
5792 | 5790 |
5793 } } // namespace v8::internal | 5791 } } // namespace v8::internal |
OLD | NEW |