Index: src/compiler/mips/code-generator-mips.cc |
diff --git a/src/compiler/mips/code-generator-mips.cc b/src/compiler/mips/code-generator-mips.cc |
index a49ec4e9f2f18352955d6d8ec12331049610be12..8bb47ef4f79e3fcc0196dd23e10b9d57f0df1850 100644 |
--- a/src/compiler/mips/code-generator-mips.cc |
+++ b/src/compiler/mips/code-generator-mips.cc |
@@ -1078,17 +1078,20 @@ void CodeGenerator::AssemblePrologue() { |
if (descriptor->kind() == CallDescriptor::kCallAddress) { |
__ Push(ra, fp); |
__ mov(fp, sp); |
+ |
const RegList saves = descriptor->CalleeSavedRegisters(); |
- if (saves != 0) { // Save callee-saved registers. |
- // TODO(plind): make callee save size const, possibly DCHECK it. |
- int register_save_area_size = 0; |
- for (int i = Register::kNumRegisters - 1; i >= 0; i--) { |
- if (!((1 << i) & saves)) continue; |
- register_save_area_size += kPointerSize; |
- } |
- frame()->SetRegisterSaveAreaSize(register_save_area_size); |
- __ MultiPush(saves); |
- } |
+ // Save callee-saved registers. |
+ __ MultiPush(saves); |
+ DCHECK(kNumCalleeSaved == base::bits::CountPopulation32(saves)); |
+ int register_save_area_size = kNumCalleeSaved * kPointerSize; |
+ |
+ const RegList saves_fpu = descriptor->CalleeSavedFPRegisters(); |
+ // Save callee-saved FPU registers. |
+ __ MultiPushFPU(saves_fpu); |
+ DCHECK(kNumCalleeSavedFPU == base::bits::CountPopulation32(saves_fpu)); |
+ register_save_area_size += kNumCalleeSavedFPU * kDoubleSize * kPointerSize; |
+ |
+ frame()->SetRegisterSaveAreaSize(register_save_area_size); |
} else if (descriptor->IsJSFunctionCall()) { |
CompilationInfo* info = this->info(); |
__ Prologue(info->IsCodePreAgingActive()); |
@@ -1131,11 +1134,13 @@ void CodeGenerator::AssembleReturn() { |
if (stack_slots > 0) { |
__ Addu(sp, sp, Operand(stack_slots * kPointerSize)); |
} |
- // Restore registers. |
+ // Restore FPU registers. |
+ const RegList saves_fpu = descriptor->CalleeSavedFPRegisters(); |
+ __ MultiPopFPU(saves_fpu); |
+ |
+ // Restore GP registers. |
const RegList saves = descriptor->CalleeSavedRegisters(); |
- if (saves != 0) { |
- __ MultiPop(saves); |
- } |
+ __ MultiPop(saves); |
} |
__ mov(sp, fp); |
__ Pop(ra, fp); |