Index: src/compiler/arm64/code-generator-arm64.cc |
diff --git a/src/compiler/arm64/code-generator-arm64.cc b/src/compiler/arm64/code-generator-arm64.cc |
index 8692732112708148b11c9d2824ef67ddf58f7435..fa5743ab8e4d38865959b139b880d58c9801bf08 100644 |
--- a/src/compiler/arm64/code-generator-arm64.cc |
+++ b/src/compiler/arm64/code-generator-arm64.cc |
@@ -1094,9 +1094,23 @@ void CodeGenerator::AssemblePrologue() { |
__ SetStackPointer(csp); |
__ Push(lr, fp); |
__ Mov(fp, csp); |
- // TODO(dcarney): correct callee saved registers. |
- __ PushCalleeSavedRegisters(); |
- frame()->SetRegisterSaveAreaSize(20 * kPointerSize); |
+ |
+ // Save FP registers. |
+ CPURegList saves_fp = CPURegList(CPURegister::kFPRegister, kDRegSizeInBits, |
+ descriptor->CalleeSavedFPRegisters()); |
+ DCHECK(saves_fp.list() == CPURegList::GetCalleeSavedFP().list()); |
+ int saved_count = saves_fp.Count(); |
+ __ PushCPURegList(saves_fp); |
+ // Save registers. |
+ CPURegList saves = CPURegList(CPURegister::kRegister, kXRegSizeInBits, |
+ descriptor->CalleeSavedRegisters()); |
+ // TODO(palfia): TF save list is not in sync with |
+ // CPURegList::GetCalleeSaved(): x30 is missing. |
jbramley
2015/06/29 13:53:09
x30 (lr) is caller-saved in the procedure-call sta
akos.palfi.imgtec
2015/06/30 12:31:49
Acknowledged.
|
+ // DCHECK(saves.list() == CPURegList::GetCalleeSaved().list()); |
+ saved_count += saves.Count(); |
+ __ PushCPURegList(saves); |
+ |
+ frame()->SetRegisterSaveAreaSize(saved_count * kPointerSize); |
} else if (descriptor->IsJSFunctionCall()) { |
CompilationInfo* info = this->info(); |
__ SetStackPointer(jssp); |
@@ -1145,10 +1159,18 @@ void CodeGenerator::AssembleReturn() { |
if (stack_slots > 0) { |
__ Add(csp, csp, AlignedStackSlots(stack_slots) * kPointerSize); |
} |
+ |
// Restore registers. |
- // TODO(dcarney): correct callee saved registers. |
- __ PopCalleeSavedRegisters(); |
+ CPURegList saves = CPURegList(CPURegister::kRegister, kXRegSizeInBits, |
+ descriptor->CalleeSavedRegisters()); |
+ __ PopCPURegList(saves); |
+ |
+ CPURegList saves_fp = |
+ CPURegList(CPURegister::kFPRegister, kDRegSizeInBits, |
+ descriptor->CalleeSavedFPRegisters()); |
+ __ PopCPURegList(saves_fp); |
} |
+ |
__ Mov(csp, fp); |
__ Pop(fp, lr); |
__ Ret(); |