| 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 685 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 696 } | 696 } |
| 697 // We need always the same number of instructions as we may need to patch | 697 // We need always the same number of instructions as we may need to patch |
| 698 // this code to load another value which may need 2 instructions to load. | 698 // this code to load another value which may need 2 instructions to load. |
| 699 lui(rd, (j.imm32_ & kHiMask) >> kLuiShift); | 699 lui(rd, (j.imm32_ & kHiMask) >> kLuiShift); |
| 700 ori(rd, rd, (j.imm32_ & kImm16Mask)); | 700 ori(rd, rd, (j.imm32_ & kImm16Mask)); |
| 701 } | 701 } |
| 702 } | 702 } |
| 703 | 703 |
| 704 | 704 |
| 705 void MacroAssembler::MultiPush(RegList regs) { | 705 void MacroAssembler::MultiPush(RegList regs) { |
| 706 int16_t NumSaved = 0; | 706 int16_t num_to_push = NumberOfBitsSet(regs); |
| 707 int16_t NumToPush = NumberOfBitsSet(regs); | 707 int16_t stack_offset = num_to_push * kPointerSize; |
| 708 | 708 |
| 709 addiu(sp, sp, -4 * NumToPush); | 709 Subu(sp, sp, Operand(stack_offset)); |
| 710 for (int16_t i = kNumRegisters; i > 0; i--) { | 710 for (int16_t i = kNumRegisters; i > 0; i--) { |
| 711 if ((regs & (1 << i)) != 0) { | 711 if ((regs & (1 << i)) != 0) { |
| 712 sw(ToRegister(i), MemOperand(sp, 4 * (NumToPush - ++NumSaved))); | 712 stack_offset -= kPointerSize; |
| 713 sw(ToRegister(i), MemOperand(sp, stack_offset)); |
| 713 } | 714 } |
| 714 } | 715 } |
| 715 } | 716 } |
| 716 | 717 |
| 717 | 718 |
| 718 void MacroAssembler::MultiPushReversed(RegList regs) { | 719 void MacroAssembler::MultiPushReversed(RegList regs) { |
| 719 int16_t NumSaved = 0; | 720 int16_t num_to_push = NumberOfBitsSet(regs); |
| 720 int16_t NumToPush = NumberOfBitsSet(regs); | 721 int16_t stack_offset = num_to_push * kPointerSize; |
| 721 | 722 |
| 722 addiu(sp, sp, -4 * NumToPush); | 723 Subu(sp, sp, Operand(stack_offset)); |
| 723 for (int16_t i = 0; i < kNumRegisters; i++) { | 724 for (int16_t i = 0; i < kNumRegisters; i++) { |
| 724 if ((regs & (1 << i)) != 0) { | 725 if ((regs & (1 << i)) != 0) { |
| 725 sw(ToRegister(i), MemOperand(sp, 4 * (NumToPush - ++NumSaved))); | 726 stack_offset -= kPointerSize; |
| 727 sw(ToRegister(i), MemOperand(sp, stack_offset)); |
| 726 } | 728 } |
| 727 } | 729 } |
| 728 } | 730 } |
| 729 | 731 |
| 730 | 732 |
| 731 void MacroAssembler::MultiPop(RegList regs) { | 733 void MacroAssembler::MultiPop(RegList regs) { |
| 732 int16_t NumSaved = 0; | 734 int16_t stack_offset = 0; |
| 733 | 735 |
| 734 for (int16_t i = 0; i < kNumRegisters; i++) { | 736 for (int16_t i = 0; i < kNumRegisters; i++) { |
| 735 if ((regs & (1 << i)) != 0) { | 737 if ((regs & (1 << i)) != 0) { |
| 736 lw(ToRegister(i), MemOperand(sp, 4 * (NumSaved++))); | 738 lw(ToRegister(i), MemOperand(sp, stack_offset)); |
| 739 stack_offset += kPointerSize; |
| 737 } | 740 } |
| 738 } | 741 } |
| 739 addiu(sp, sp, 4 * NumSaved); | 742 addiu(sp, sp, stack_offset); |
| 740 } | 743 } |
| 741 | 744 |
| 742 | 745 |
| 743 void MacroAssembler::MultiPopReversed(RegList regs) { | 746 void MacroAssembler::MultiPopReversed(RegList regs) { |
| 744 int16_t NumSaved = 0; | 747 int16_t stack_offset = 0; |
| 745 | 748 |
| 746 for (int16_t i = kNumRegisters; i > 0; i--) { | 749 for (int16_t i = kNumRegisters; i > 0; i--) { |
| 747 if ((regs & (1 << i)) != 0) { | 750 if ((regs & (1 << i)) != 0) { |
| 748 lw(ToRegister(i), MemOperand(sp, 4 * (NumSaved++))); | 751 lw(ToRegister(i), MemOperand(sp, stack_offset)); |
| 752 stack_offset += kPointerSize; |
| 749 } | 753 } |
| 750 } | 754 } |
| 751 addiu(sp, sp, 4 * NumSaved); | 755 addiu(sp, sp, stack_offset); |
| 752 } | 756 } |
| 753 | 757 |
| 754 | 758 |
| 759 void MacroAssembler::MultiPushFPU(RegList regs) { |
| 760 CpuFeatures::Scope scope(FPU); |
| 761 int16_t num_to_push = NumberOfBitsSet(regs); |
| 762 int16_t stack_offset = num_to_push * kDoubleSize; |
| 763 |
| 764 Subu(sp, sp, Operand(stack_offset)); |
| 765 for (int16_t i = kNumRegisters; i > 0; i--) { |
| 766 if ((regs & (1 << i)) != 0) { |
| 767 stack_offset -= kDoubleSize; |
| 768 sdc1(FPURegister::from_code(i), MemOperand(sp, stack_offset)); |
| 769 } |
| 770 } |
| 771 } |
| 772 |
| 773 |
| 774 void MacroAssembler::MultiPushReversedFPU(RegList regs) { |
| 775 CpuFeatures::Scope scope(FPU); |
| 776 int16_t num_to_push = NumberOfBitsSet(regs); |
| 777 int16_t stack_offset = num_to_push * kDoubleSize; |
| 778 |
| 779 Subu(sp, sp, Operand(stack_offset)); |
| 780 for (int16_t i = 0; i < kNumRegisters; i++) { |
| 781 if ((regs & (1 << i)) != 0) { |
| 782 stack_offset -= kDoubleSize; |
| 783 sdc1(FPURegister::from_code(i), MemOperand(sp, stack_offset)); |
| 784 } |
| 785 } |
| 786 } |
| 787 |
| 788 |
| 789 void MacroAssembler::MultiPopFPU(RegList regs) { |
| 790 CpuFeatures::Scope scope(FPU); |
| 791 int16_t stack_offset = 0; |
| 792 |
| 793 for (int16_t i = 0; i < kNumRegisters; i++) { |
| 794 if ((regs & (1 << i)) != 0) { |
| 795 ldc1(FPURegister::from_code(i), MemOperand(sp, stack_offset)); |
| 796 stack_offset += kDoubleSize; |
| 797 } |
| 798 } |
| 799 addiu(sp, sp, stack_offset); |
| 800 } |
| 801 |
| 802 |
| 803 void MacroAssembler::MultiPopReversedFPU(RegList regs) { |
| 804 CpuFeatures::Scope scope(FPU); |
| 805 int16_t stack_offset = 0; |
| 806 |
| 807 for (int16_t i = kNumRegisters; i > 0; i--) { |
| 808 if ((regs & (1 << i)) != 0) { |
| 809 ldc1(FPURegister::from_code(i), MemOperand(sp, stack_offset)); |
| 810 stack_offset += kDoubleSize; |
| 811 } |
| 812 } |
| 813 addiu(sp, sp, stack_offset); |
| 814 } |
| 815 |
| 816 |
| 755 void MacroAssembler::Ext(Register rt, | 817 void MacroAssembler::Ext(Register rt, |
| 756 Register rs, | 818 Register rs, |
| 757 uint16_t pos, | 819 uint16_t pos, |
| 758 uint16_t size) { | 820 uint16_t size) { |
| 759 ASSERT(pos < 32); | 821 ASSERT(pos < 32); |
| 760 ASSERT(pos + size < 33); | 822 ASSERT(pos + size < 33); |
| 761 | 823 |
| 762 if (mips32r2) { | 824 if (mips32r2) { |
| 763 ext_(rt, rs, pos, size); | 825 ext_(rt, rs, pos, size); |
| 764 } else { | 826 } else { |
| (...skipping 3540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4305 opcode == BGTZL); | 4367 opcode == BGTZL); |
| 4306 opcode = (cond == eq) ? BEQ : BNE; | 4368 opcode = (cond == eq) ? BEQ : BNE; |
| 4307 instr = (instr & ~kOpcodeMask) | opcode; | 4369 instr = (instr & ~kOpcodeMask) | opcode; |
| 4308 masm_.emit(instr); | 4370 masm_.emit(instr); |
| 4309 } | 4371 } |
| 4310 | 4372 |
| 4311 | 4373 |
| 4312 } } // namespace v8::internal | 4374 } } // namespace v8::internal |
| 4313 | 4375 |
| 4314 #endif // V8_TARGET_ARCH_MIPS | 4376 #endif // V8_TARGET_ARCH_MIPS |
| OLD | NEW |