Index: src/mips/macro-assembler-mips.cc |
diff --git a/src/mips/macro-assembler-mips.cc b/src/mips/macro-assembler-mips.cc |
index c7f727bef604e1e0eff71ff0987b00b57f5d2c56..45e901bdb91d3eef2c97f9c99dfbd32e2947228d 100644 |
--- a/src/mips/macro-assembler-mips.cc |
+++ b/src/mips/macro-assembler-mips.cc |
@@ -703,52 +703,114 @@ void MacroAssembler::li(Register rd, Operand j, bool gen2instr) { |
void MacroAssembler::MultiPush(RegList regs) { |
- int16_t NumSaved = 0; |
- int16_t NumToPush = NumberOfBitsSet(regs); |
+ int16_t num_to_push = NumberOfBitsSet(regs); |
+ int16_t stack_offset = num_to_push * kPointerSize; |
- addiu(sp, sp, -4 * NumToPush); |
+ Subu(sp, sp, Operand(stack_offset)); |
for (int16_t i = kNumRegisters; i > 0; i--) { |
if ((regs & (1 << i)) != 0) { |
- sw(ToRegister(i), MemOperand(sp, 4 * (NumToPush - ++NumSaved))); |
+ stack_offset -= kPointerSize; |
+ sw(ToRegister(i), MemOperand(sp, stack_offset)); |
} |
} |
} |
void MacroAssembler::MultiPushReversed(RegList regs) { |
- int16_t NumSaved = 0; |
- int16_t NumToPush = NumberOfBitsSet(regs); |
+ int16_t num_to_push = NumberOfBitsSet(regs); |
+ int16_t stack_offset = num_to_push * kPointerSize; |
- addiu(sp, sp, -4 * NumToPush); |
+ Subu(sp, sp, Operand(stack_offset)); |
for (int16_t i = 0; i < kNumRegisters; i++) { |
if ((regs & (1 << i)) != 0) { |
- sw(ToRegister(i), MemOperand(sp, 4 * (NumToPush - ++NumSaved))); |
+ stack_offset -= kPointerSize; |
+ sw(ToRegister(i), MemOperand(sp, stack_offset)); |
} |
} |
} |
void MacroAssembler::MultiPop(RegList regs) { |
- int16_t NumSaved = 0; |
+ int16_t stack_offset = 0; |
for (int16_t i = 0; i < kNumRegisters; i++) { |
if ((regs & (1 << i)) != 0) { |
- lw(ToRegister(i), MemOperand(sp, 4 * (NumSaved++))); |
+ lw(ToRegister(i), MemOperand(sp, stack_offset)); |
+ stack_offset += kPointerSize; |
} |
} |
- addiu(sp, sp, 4 * NumSaved); |
+ addiu(sp, sp, stack_offset); |
} |
void MacroAssembler::MultiPopReversed(RegList regs) { |
- int16_t NumSaved = 0; |
+ int16_t stack_offset = 0; |
for (int16_t i = kNumRegisters; i > 0; i--) { |
if ((regs & (1 << i)) != 0) { |
- lw(ToRegister(i), MemOperand(sp, 4 * (NumSaved++))); |
+ lw(ToRegister(i), MemOperand(sp, stack_offset)); |
+ stack_offset += kPointerSize; |
} |
} |
- addiu(sp, sp, 4 * NumSaved); |
+ addiu(sp, sp, stack_offset); |
+} |
+ |
+ |
+void MacroAssembler::MultiPushFPU(RegList regs) { |
+ CpuFeatures::Scope scope(FPU); |
+ int16_t num_to_push = NumberOfBitsSet(regs); |
+ int16_t stack_offset = num_to_push * kDoubleSize; |
+ |
+ Subu(sp, sp, Operand(stack_offset)); |
+ for (int16_t i = kNumRegisters; i > 0; i--) { |
+ if ((regs & (1 << i)) != 0) { |
+ stack_offset -= kDoubleSize; |
+ sdc1(FPURegister::from_code(i), MemOperand(sp, stack_offset)); |
+ } |
+ } |
+} |
+ |
+ |
+void MacroAssembler::MultiPushReversedFPU(RegList regs) { |
+ CpuFeatures::Scope scope(FPU); |
+ int16_t num_to_push = NumberOfBitsSet(regs); |
+ int16_t stack_offset = num_to_push * kDoubleSize; |
+ |
+ Subu(sp, sp, Operand(stack_offset)); |
+ for (int16_t i = 0; i < kNumRegisters; i++) { |
+ if ((regs & (1 << i)) != 0) { |
+ stack_offset -= kDoubleSize; |
+ sdc1(FPURegister::from_code(i), MemOperand(sp, stack_offset)); |
+ } |
+ } |
+} |
+ |
+ |
+void MacroAssembler::MultiPopFPU(RegList regs) { |
+ CpuFeatures::Scope scope(FPU); |
+ int16_t stack_offset = 0; |
+ |
+ for (int16_t i = 0; i < kNumRegisters; i++) { |
+ if ((regs & (1 << i)) != 0) { |
+ ldc1(FPURegister::from_code(i), MemOperand(sp, stack_offset)); |
+ stack_offset += kDoubleSize; |
+ } |
+ } |
+ addiu(sp, sp, stack_offset); |
+} |
+ |
+ |
+void MacroAssembler::MultiPopReversedFPU(RegList regs) { |
+ CpuFeatures::Scope scope(FPU); |
+ int16_t stack_offset = 0; |
+ |
+ for (int16_t i = kNumRegisters; i > 0; i--) { |
+ if ((regs & (1 << i)) != 0) { |
+ ldc1(FPURegister::from_code(i), MemOperand(sp, stack_offset)); |
+ stack_offset += kDoubleSize; |
+ } |
+ } |
+ addiu(sp, sp, stack_offset); |
} |