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 590 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
601 | 601 |
602 void DoubleToIStub::Generate(MacroAssembler* masm) { | 602 void DoubleToIStub::Generate(MacroAssembler* masm) { |
603 Label out_of_range, only_low, negate, done; | 603 Label out_of_range, only_low, negate, done; |
604 Register input_reg = source(); | 604 Register input_reg = source(); |
605 Register result_reg = destination(); | 605 Register result_reg = destination(); |
606 | 606 |
607 int double_offset = offset(); | 607 int double_offset = offset(); |
608 // Account for saved regs if input is sp. | 608 // Account for saved regs if input is sp. |
609 if (input_reg.is(sp)) double_offset += 2 * kPointerSize; | 609 if (input_reg.is(sp)) double_offset += 2 * kPointerSize; |
610 | 610 |
611 // Immediate values for this stub fit in instructions, so it's safe to use ip. | 611 Register scratch = GetRegisterThatIsNotOneOf(input_reg, result_reg); |
612 Register scratch = ip; | |
613 Register scratch_low = | 612 Register scratch_low = |
614 GetRegisterThatIsNotOneOf(input_reg, result_reg, scratch); | 613 GetRegisterThatIsNotOneOf(input_reg, result_reg, scratch); |
615 Register scratch_high = | 614 Register scratch_high = |
616 GetRegisterThatIsNotOneOf(input_reg, result_reg, scratch, scratch_low); | 615 GetRegisterThatIsNotOneOf(input_reg, result_reg, scratch, scratch_low); |
617 LowDwVfpRegister double_scratch = kScratchDoubleReg; | 616 LowDwVfpRegister double_scratch = kScratchDoubleReg; |
618 | 617 |
618 __ Push(scratch); | |
619 __ Push(scratch_high, scratch_low); | 619 __ Push(scratch_high, scratch_low); |
rmcilroy
2014/01/14 14:23:30
Since Benedikt has fixed the Push/Pop typo, please
Mostyn Bramley-Moore
2014/01/14 14:30:58
Done.
I have verified that this works on master n
| |
620 | 620 |
621 if (!skip_fastpath()) { | 621 if (!skip_fastpath()) { |
622 // Load double input. | 622 // Load double input. |
623 __ vldr(double_scratch, MemOperand(input_reg, double_offset)); | 623 __ vldr(double_scratch, MemOperand(input_reg, double_offset)); |
624 __ vmov(scratch_low, scratch_high, double_scratch); | 624 __ vmov(scratch_low, scratch_high, double_scratch); |
625 | 625 |
626 // Do fast-path convert from double to int. | 626 // Do fast-path convert from double to int. |
627 __ vcvt_s32_f64(double_scratch.low(), double_scratch); | 627 __ vcvt_s32_f64(double_scratch.low(), double_scratch); |
628 __ vmov(result_reg, double_scratch.low()); | 628 __ vmov(result_reg, double_scratch.low()); |
629 | 629 |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
693 // New result = (result eor 0) + 0 = result. | 693 // New result = (result eor 0) + 0 = result. |
694 // If the input was negative, we have to negate the result. | 694 // If the input was negative, we have to negate the result. |
695 // Input_high ASR 31 equals 0xffffffff and scratch_high LSR 31 equals 1. | 695 // Input_high ASR 31 equals 0xffffffff and scratch_high LSR 31 equals 1. |
696 // New result = (result eor 0xffffffff) + 1 = 0 - result. | 696 // New result = (result eor 0xffffffff) + 1 = 0 - result. |
697 __ eor(result_reg, result_reg, Operand(scratch_high, ASR, 31)); | 697 __ eor(result_reg, result_reg, Operand(scratch_high, ASR, 31)); |
698 __ add(result_reg, result_reg, Operand(scratch_high, LSR, 31)); | 698 __ add(result_reg, result_reg, Operand(scratch_high, LSR, 31)); |
699 | 699 |
700 __ bind(&done); | 700 __ bind(&done); |
701 | 701 |
702 __ Pop(scratch_high, scratch_low); | 702 __ Pop(scratch_high, scratch_low); |
703 __ Pop(scratch); | |
703 __ Ret(); | 704 __ Ret(); |
704 } | 705 } |
705 | 706 |
706 | 707 |
707 void WriteInt32ToHeapNumberStub::GenerateFixedRegStubsAheadOfTime( | 708 void WriteInt32ToHeapNumberStub::GenerateFixedRegStubsAheadOfTime( |
708 Isolate* isolate) { | 709 Isolate* isolate) { |
709 WriteInt32ToHeapNumberStub stub1(r1, r0, r2); | 710 WriteInt32ToHeapNumberStub stub1(r1, r0, r2); |
710 WriteInt32ToHeapNumberStub stub2(r2, r0, r3); | 711 WriteInt32ToHeapNumberStub stub2(r2, r0, r3); |
711 stub1.GetCode(isolate); | 712 stub1.GetCode(isolate); |
712 stub2.GetCode(isolate); | 713 stub2.GetCode(isolate); |
(...skipping 5132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5845 __ bind(&fast_elements_case); | 5846 __ bind(&fast_elements_case); |
5846 GenerateCase(masm, FAST_ELEMENTS); | 5847 GenerateCase(masm, FAST_ELEMENTS); |
5847 } | 5848 } |
5848 | 5849 |
5849 | 5850 |
5850 #undef __ | 5851 #undef __ |
5851 | 5852 |
5852 } } // namespace v8::internal | 5853 } } // namespace v8::internal |
5853 | 5854 |
5854 #endif // V8_TARGET_ARCH_ARM | 5855 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |