Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(112)

Unified Diff: src/compiler/ppc/code-generator-ppc.cc

Issue 1271583002: PPC: Clean up register save/restore logic. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/compiler/c-linkage.cc ('k') | src/ppc/code-stubs-ppc.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/ppc/code-generator-ppc.cc
diff --git a/src/compiler/ppc/code-generator-ppc.cc b/src/compiler/ppc/code-generator-ppc.cc
index 3d91e68a83d790198d8bb5817e23e8826060002b..4e9f99fb9c3f5a51299c9a21a3f64abdfaa732ea 100644
--- a/src/compiler/ppc/code-generator-ppc.cc
+++ b/src/compiler/ppc/code-generator-ppc.cc
@@ -1296,27 +1296,34 @@ void CodeGenerator::AssemblePrologue() {
int stack_slots = frame()->GetSpillSlotCount();
if (descriptor->kind() == CallDescriptor::kCallAddress) {
__ function_descriptor();
- int register_save_area_size = 0;
- RegList frame_saves = fp.bit();
+ RegList frame_saves = 0;
__ mflr(r0);
if (FLAG_enable_embedded_constant_pool) {
__ Push(r0, fp, kConstantPoolRegister);
// Adjust FP to point to saved FP.
__ subi(fp, sp, Operand(StandardFrameConstants::kConstantPoolOffset));
- register_save_area_size += kPointerSize;
frame_saves |= kConstantPoolRegister.bit();
} else {
__ Push(r0, fp);
__ mr(fp, sp);
}
+
// Save callee-saved registers.
const RegList saves = descriptor->CalleeSavedRegisters() & ~frame_saves;
- 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);
+ // register save area does not include the fp.
+ DCHECK(kNumCalleeSaved - 1 ==
+ base::bits::CountPopulation32(saves | frame_saves));
+ int register_save_area_size = (kNumCalleeSaved - 1) * kPointerSize;
+
+ // Save callee-saved Double registers.
+ const RegList double_saves = descriptor->CalleeSavedFPRegisters();
+ __ MultiPushDoubles(double_saves);
+ DCHECK(kNumCalleeSavedDoubles ==
+ base::bits::CountPopulation32(double_saves));
+ register_save_area_size += kNumCalleeSavedDoubles * kDoubleSize;
+
+ frame()->SetRegisterSaveAreaSize(register_save_area_size);
} else if (descriptor->IsJSFunctionCall()) {
CompilationInfo* info = this->info();
__ Prologue(info->IsCodePreAgingActive());
@@ -1359,15 +1366,17 @@ void CodeGenerator::AssembleReturn() {
if (stack_slots > 0) {
__ Add(sp, sp, stack_slots * kPointerSize, r0);
}
+ // Restore double registers.
+ const RegList double_saves = descriptor->CalleeSavedFPRegisters();
+ __ MultiPopDoubles(double_saves);
+
// Restore registers.
- RegList frame_saves = fp.bit();
+ RegList frame_saves = 0;
if (FLAG_enable_embedded_constant_pool) {
frame_saves |= kConstantPoolRegister.bit();
}
const RegList saves = descriptor->CalleeSavedRegisters() & ~frame_saves;
- if (saves != 0) {
- __ MultiPop(saves);
- }
+ __ MultiPop(saves);
}
__ LeaveFrame(StackFrame::MANUAL);
__ Ret();
« no previous file with comments | « src/compiler/c-linkage.cc ('k') | src/ppc/code-stubs-ppc.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698