Index: src/compiler/mips64/code-generator-mips64.cc |
diff --git a/src/compiler/mips64/code-generator-mips64.cc b/src/compiler/mips64/code-generator-mips64.cc |
index 74adbf4d2eec1bc232a513adf014affc9c429219..cb465f2d3ed6b069837f9d05074a66f06f711f11 100644 |
--- a/src/compiler/mips64/code-generator-mips64.cc |
+++ b/src/compiler/mips64/code-generator-mips64.cc |
@@ -1151,17 +1151,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()); |
@@ -1204,11 +1207,13 @@ void CodeGenerator::AssembleReturn() { |
if (stack_slots > 0) { |
__ Daddu(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); |