OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 585 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
596 // Unlike on ARM we don't save all the registers, just the useful ones. | 596 // Unlike on ARM we don't save all the registers, just the useful ones. |
597 // For the rest, there are gaps on the stack, so the offsets remain the same. | 597 // For the rest, there are gaps on the stack, so the offsets remain the same. |
598 const int kNumberOfRegisters = Register::kNumRegisters; | 598 const int kNumberOfRegisters = Register::kNumRegisters; |
599 | 599 |
600 RegList restored_regs = kJSCallerSaved | kCalleeSaved; | 600 RegList restored_regs = kJSCallerSaved | kCalleeSaved; |
601 RegList saved_regs = restored_regs | sp.bit() | ra.bit(); | 601 RegList saved_regs = restored_regs | sp.bit() | ra.bit(); |
602 | 602 |
603 const int kDoubleRegsSize = | 603 const int kDoubleRegsSize = |
604 kDoubleSize * FPURegister::kMaxNumAllocatableRegisters; | 604 kDoubleSize * FPURegister::kMaxNumAllocatableRegisters; |
605 | 605 |
606 if (CpuFeatures::IsSupported(FPU)) { | 606 // Save all FPU registers before messing with them. |
607 CpuFeatureScope scope(masm(), FPU); | 607 __ Subu(sp, sp, Operand(kDoubleRegsSize)); |
608 // Save all FPU registers before messing with them. | 608 for (int i = 0; i < FPURegister::kMaxNumAllocatableRegisters; ++i) { |
609 __ Subu(sp, sp, Operand(kDoubleRegsSize)); | 609 FPURegister fpu_reg = FPURegister::FromAllocationIndex(i); |
610 for (int i = 0; i < FPURegister::kMaxNumAllocatableRegisters; ++i) { | 610 int offset = i * kDoubleSize; |
611 FPURegister fpu_reg = FPURegister::FromAllocationIndex(i); | 611 __ sdc1(fpu_reg, MemOperand(sp, offset)); |
612 int offset = i * kDoubleSize; | |
613 __ sdc1(fpu_reg, MemOperand(sp, offset)); | |
614 } | |
615 } else { | |
616 __ Subu(sp, sp, Operand(kDoubleRegsSize)); | |
617 } | 612 } |
618 | 613 |
619 // Push saved_regs (needed to populate FrameDescription::registers_). | 614 // Push saved_regs (needed to populate FrameDescription::registers_). |
620 // Leave gaps for other registers. | 615 // Leave gaps for other registers. |
621 __ Subu(sp, sp, kNumberOfRegisters * kPointerSize); | 616 __ Subu(sp, sp, kNumberOfRegisters * kPointerSize); |
622 for (int16_t i = kNumberOfRegisters - 1; i >= 0; i--) { | 617 for (int16_t i = kNumberOfRegisters - 1; i >= 0; i--) { |
623 if ((saved_regs & (1 << i)) != 0) { | 618 if ((saved_regs & (1 << i)) != 0) { |
624 __ sw(ToRegister(i), MemOperand(sp, kPointerSize * i)); | 619 __ sw(ToRegister(i), MemOperand(sp, kPointerSize * i)); |
625 } | 620 } |
626 } | 621 } |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
679 if ((saved_regs & (1 << i)) != 0) { | 674 if ((saved_regs & (1 << i)) != 0) { |
680 __ lw(a2, MemOperand(sp, i * kPointerSize)); | 675 __ lw(a2, MemOperand(sp, i * kPointerSize)); |
681 __ sw(a2, MemOperand(a1, offset)); | 676 __ sw(a2, MemOperand(a1, offset)); |
682 } else if (FLAG_debug_code) { | 677 } else if (FLAG_debug_code) { |
683 __ li(a2, kDebugZapValue); | 678 __ li(a2, kDebugZapValue); |
684 __ sw(a2, MemOperand(a1, offset)); | 679 __ sw(a2, MemOperand(a1, offset)); |
685 } | 680 } |
686 } | 681 } |
687 | 682 |
688 int double_regs_offset = FrameDescription::double_registers_offset(); | 683 int double_regs_offset = FrameDescription::double_registers_offset(); |
689 if (CpuFeatures::IsSupported(FPU)) { | 684 // Copy FPU registers to |
690 CpuFeatureScope scope(masm(), FPU); | 685 // double_registers_[DoubleRegister::kNumAllocatableRegisters] |
691 // Copy FPU registers to | 686 for (int i = 0; i < FPURegister::NumAllocatableRegisters(); ++i) { |
692 // double_registers_[DoubleRegister::kNumAllocatableRegisters] | 687 int dst_offset = i * kDoubleSize + double_regs_offset; |
693 for (int i = 0; i < FPURegister::NumAllocatableRegisters(); ++i) { | 688 int src_offset = i * kDoubleSize + kNumberOfRegisters * kPointerSize; |
694 int dst_offset = i * kDoubleSize + double_regs_offset; | 689 __ ldc1(f0, MemOperand(sp, src_offset)); |
695 int src_offset = i * kDoubleSize + kNumberOfRegisters * kPointerSize; | 690 __ sdc1(f0, MemOperand(a1, dst_offset)); |
696 __ ldc1(f0, MemOperand(sp, src_offset)); | |
697 __ sdc1(f0, MemOperand(a1, dst_offset)); | |
698 } | |
699 } | 691 } |
700 | 692 |
701 // Remove the bailout id, eventually return address, and the saved registers | 693 // Remove the bailout id, eventually return address, and the saved registers |
702 // from the stack. | 694 // from the stack. |
703 if (type() == EAGER || type() == OSR) { | 695 if (type() == EAGER || type() == OSR) { |
704 __ Addu(sp, sp, Operand(kSavedRegistersAreaSize + (1 * kPointerSize))); | 696 __ Addu(sp, sp, Operand(kSavedRegistersAreaSize + (1 * kPointerSize))); |
705 } else { | 697 } else { |
706 __ Addu(sp, sp, Operand(kSavedRegistersAreaSize + (2 * kPointerSize))); | 698 __ Addu(sp, sp, Operand(kSavedRegistersAreaSize + (2 * kPointerSize))); |
707 } | 699 } |
708 | 700 |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
757 __ Addu(t2, a2, Operand(a3)); | 749 __ Addu(t2, a2, Operand(a3)); |
758 __ lw(t3, MemOperand(t2, FrameDescription::frame_content_offset())); | 750 __ lw(t3, MemOperand(t2, FrameDescription::frame_content_offset())); |
759 __ push(t3); | 751 __ push(t3); |
760 __ bind(&inner_loop_header); | 752 __ bind(&inner_loop_header); |
761 __ Branch(&inner_push_loop, ne, a3, Operand(zero_reg)); | 753 __ Branch(&inner_push_loop, ne, a3, Operand(zero_reg)); |
762 | 754 |
763 __ Addu(t0, t0, Operand(kPointerSize)); | 755 __ Addu(t0, t0, Operand(kPointerSize)); |
764 __ bind(&outer_loop_header); | 756 __ bind(&outer_loop_header); |
765 __ Branch(&outer_push_loop, lt, t0, Operand(a1)); | 757 __ Branch(&outer_push_loop, lt, t0, Operand(a1)); |
766 | 758 |
767 if (CpuFeatures::IsSupported(FPU)) { | 759 __ lw(a1, MemOperand(a0, Deoptimizer::input_offset())); |
768 CpuFeatureScope scope(masm(), FPU); | 760 for (int i = 0; i < FPURegister::kMaxNumAllocatableRegisters; ++i) { |
769 | 761 const FPURegister fpu_reg = FPURegister::FromAllocationIndex(i); |
770 __ lw(a1, MemOperand(a0, Deoptimizer::input_offset())); | 762 int src_offset = i * kDoubleSize + double_regs_offset; |
771 for (int i = 0; i < FPURegister::kMaxNumAllocatableRegisters; ++i) { | 763 __ ldc1(fpu_reg, MemOperand(a1, src_offset)); |
772 const FPURegister fpu_reg = FPURegister::FromAllocationIndex(i); | |
773 int src_offset = i * kDoubleSize + double_regs_offset; | |
774 __ ldc1(fpu_reg, MemOperand(a1, src_offset)); | |
775 } | |
776 } | 764 } |
777 | 765 |
778 // Push state, pc, and continuation from the last output frame. | 766 // Push state, pc, and continuation from the last output frame. |
779 if (type() != OSR) { | 767 if (type() != OSR) { |
780 __ lw(t2, MemOperand(a2, FrameDescription::state_offset())); | 768 __ lw(t2, MemOperand(a2, FrameDescription::state_offset())); |
781 __ push(t2); | 769 __ push(t2); |
782 } | 770 } |
783 | 771 |
784 __ lw(t2, MemOperand(a2, FrameDescription::pc_offset())); | 772 __ lw(t2, MemOperand(a2, FrameDescription::pc_offset())); |
785 __ push(t2); | 773 __ push(t2); |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
847 } | 835 } |
848 | 836 |
849 ASSERT_EQ(masm()->SizeOfCodeGeneratedSince(&table_start), | 837 ASSERT_EQ(masm()->SizeOfCodeGeneratedSince(&table_start), |
850 count() * table_entry_size_); | 838 count() * table_entry_size_); |
851 } | 839 } |
852 | 840 |
853 #undef __ | 841 #undef __ |
854 | 842 |
855 | 843 |
856 } } // namespace v8::internal | 844 } } // namespace v8::internal |
OLD | NEW |