| 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 647 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 658 } | 658 } |
| 659 | 659 |
| 660 | 660 |
| 661 void DoubleToIStub::Generate(MacroAssembler* masm) { | 661 void DoubleToIStub::Generate(MacroAssembler* masm) { |
| 662 Label out_of_range, only_low, negate, done; | 662 Label out_of_range, only_low, negate, done; |
| 663 Register input_reg = source(); | 663 Register input_reg = source(); |
| 664 Register result_reg = destination(); | 664 Register result_reg = destination(); |
| 665 | 665 |
| 666 int double_offset = offset(); | 666 int double_offset = offset(); |
| 667 // Account for saved regs if input is sp. | 667 // Account for saved regs if input is sp. |
| 668 if (input_reg.is(sp)) double_offset += 2 * kPointerSize; | 668 if (input_reg.is(sp)) double_offset += 3 * kPointerSize; |
| 669 | 669 |
| 670 // Immediate values for this stub fit in instructions, so it's safe to use ip. | 670 Register scratch = GetRegisterThatIsNotOneOf(input_reg, result_reg); |
| 671 Register scratch = ip; | |
| 672 Register scratch_low = | 671 Register scratch_low = |
| 673 GetRegisterThatIsNotOneOf(input_reg, result_reg, scratch); | 672 GetRegisterThatIsNotOneOf(input_reg, result_reg, scratch); |
| 674 Register scratch_high = | 673 Register scratch_high = |
| 675 GetRegisterThatIsNotOneOf(input_reg, result_reg, scratch, scratch_low); | 674 GetRegisterThatIsNotOneOf(input_reg, result_reg, scratch, scratch_low); |
| 676 LowDwVfpRegister double_scratch = kScratchDoubleReg; | 675 LowDwVfpRegister double_scratch = kScratchDoubleReg; |
| 677 | 676 |
| 678 __ Push(scratch_high, scratch_low); | 677 __ Push(scratch_high, scratch_low, scratch); |
| 679 | 678 |
| 680 if (!skip_fastpath()) { | 679 if (!skip_fastpath()) { |
| 681 // Load double input. | 680 // Load double input. |
| 682 __ vldr(double_scratch, MemOperand(input_reg, double_offset)); | 681 __ vldr(double_scratch, MemOperand(input_reg, double_offset)); |
| 683 __ vmov(scratch_low, scratch_high, double_scratch); | 682 __ vmov(scratch_low, scratch_high, double_scratch); |
| 684 | 683 |
| 685 // Do fast-path convert from double to int. | 684 // Do fast-path convert from double to int. |
| 686 __ vcvt_s32_f64(double_scratch.low(), double_scratch); | 685 __ vcvt_s32_f64(double_scratch.low(), double_scratch); |
| 687 __ vmov(result_reg, double_scratch.low()); | 686 __ vmov(result_reg, double_scratch.low()); |
| 688 | 687 |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 751 // scratch_high LSR 31 equals zero. | 750 // scratch_high LSR 31 equals zero. |
| 752 // New result = (result eor 0) + 0 = result. | 751 // New result = (result eor 0) + 0 = result. |
| 753 // If the input was negative, we have to negate the result. | 752 // If the input was negative, we have to negate the result. |
| 754 // Input_high ASR 31 equals 0xffffffff and scratch_high LSR 31 equals 1. | 753 // Input_high ASR 31 equals 0xffffffff and scratch_high LSR 31 equals 1. |
| 755 // New result = (result eor 0xffffffff) + 1 = 0 - result. | 754 // New result = (result eor 0xffffffff) + 1 = 0 - result. |
| 756 __ eor(result_reg, result_reg, Operand(scratch_high, ASR, 31)); | 755 __ eor(result_reg, result_reg, Operand(scratch_high, ASR, 31)); |
| 757 __ add(result_reg, result_reg, Operand(scratch_high, LSR, 31)); | 756 __ add(result_reg, result_reg, Operand(scratch_high, LSR, 31)); |
| 758 | 757 |
| 759 __ bind(&done); | 758 __ bind(&done); |
| 760 | 759 |
| 761 __ Pop(scratch_high, scratch_low); | 760 __ Pop(scratch_high, scratch_low, scratch); |
| 762 __ Ret(); | 761 __ Ret(); |
| 763 } | 762 } |
| 764 | 763 |
| 765 | 764 |
| 766 void WriteInt32ToHeapNumberStub::GenerateFixedRegStubsAheadOfTime( | 765 void WriteInt32ToHeapNumberStub::GenerateFixedRegStubsAheadOfTime( |
| 767 Isolate* isolate) { | 766 Isolate* isolate) { |
| 768 WriteInt32ToHeapNumberStub stub1(r1, r0, r2); | 767 WriteInt32ToHeapNumberStub stub1(r1, r0, r2); |
| 769 WriteInt32ToHeapNumberStub stub2(r2, r0, r3); | 768 WriteInt32ToHeapNumberStub stub2(r2, r0, r3); |
| 770 stub1.GetCode(isolate); | 769 stub1.GetCode(isolate); |
| 771 stub2.GetCode(isolate); | 770 stub2.GetCode(isolate); |
| (...skipping 5079 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5851 __ bind(&fast_elements_case); | 5850 __ bind(&fast_elements_case); |
| 5852 GenerateCase(masm, FAST_ELEMENTS); | 5851 GenerateCase(masm, FAST_ELEMENTS); |
| 5853 } | 5852 } |
| 5854 | 5853 |
| 5855 | 5854 |
| 5856 #undef __ | 5855 #undef __ |
| 5857 | 5856 |
| 5858 } } // namespace v8::internal | 5857 } } // namespace v8::internal |
| 5859 | 5858 |
| 5860 #endif // V8_TARGET_ARCH_ARM | 5859 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |