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

Unified Diff: src/ppc/macro-assembler-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/ppc/macro-assembler-ppc.h ('k') | src/ppc/regexp-macro-assembler-ppc.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ppc/macro-assembler-ppc.cc
diff --git a/src/ppc/macro-assembler-ppc.cc b/src/ppc/macro-assembler-ppc.cc
index 1598f8fee763d28659dc734deb0571360607754d..4ee6323e6616d2384f9c065020c56fe71b23f96c 100644
--- a/src/ppc/macro-assembler-ppc.cc
+++ b/src/ppc/macro-assembler-ppc.cc
@@ -224,30 +224,59 @@ void MacroAssembler::Move(DoubleRegister dst, DoubleRegister src) {
}
-void MacroAssembler::MultiPush(RegList regs) {
+void MacroAssembler::MultiPush(RegList regs, Register location) {
int16_t num_to_push = NumberOfBitsSet(regs);
int16_t stack_offset = num_to_push * kPointerSize;
- subi(sp, sp, Operand(stack_offset));
- for (int16_t i = kNumRegisters - 1; i >= 0; i--) {
+ subi(location, location, Operand(stack_offset));
+ for (int16_t i = Register::kNumRegisters - 1; i >= 0; i--) {
if ((regs & (1 << i)) != 0) {
stack_offset -= kPointerSize;
- StoreP(ToRegister(i), MemOperand(sp, stack_offset));
+ StoreP(ToRegister(i), MemOperand(location, stack_offset));
}
}
}
-void MacroAssembler::MultiPop(RegList regs) {
+void MacroAssembler::MultiPop(RegList regs, Register location) {
int16_t stack_offset = 0;
- for (int16_t i = 0; i < kNumRegisters; i++) {
+ for (int16_t i = 0; i < Register::kNumRegisters; i++) {
if ((regs & (1 << i)) != 0) {
- LoadP(ToRegister(i), MemOperand(sp, stack_offset));
+ LoadP(ToRegister(i), MemOperand(location, stack_offset));
stack_offset += kPointerSize;
}
}
- addi(sp, sp, Operand(stack_offset));
+ addi(location, location, Operand(stack_offset));
+}
+
+
+void MacroAssembler::MultiPushDoubles(RegList dregs, Register location) {
+ int16_t num_to_push = NumberOfBitsSet(dregs);
+ int16_t stack_offset = num_to_push * kDoubleSize;
+
+ subi(location, location, Operand(stack_offset));
+ for (int16_t i = DoubleRegister::kNumRegisters - 1; i >= 0; i--) {
+ if ((dregs & (1 << i)) != 0) {
+ DoubleRegister dreg = DoubleRegister::from_code(i);
+ stack_offset -= kDoubleSize;
+ stfd(dreg, MemOperand(location, stack_offset));
+ }
+ }
+}
+
+
+void MacroAssembler::MultiPopDoubles(RegList dregs, Register location) {
+ int16_t stack_offset = 0;
+
+ for (int16_t i = 0; i < DoubleRegister::kNumRegisters; i++) {
+ if ((dregs & (1 << i)) != 0) {
+ DoubleRegister dreg = DoubleRegister::from_code(i);
+ lfd(dreg, MemOperand(location, stack_offset));
+ stack_offset += kDoubleSize;
+ }
+ }
+ addi(location, location, Operand(stack_offset));
}
@@ -825,7 +854,7 @@ void MacroAssembler::EnterExitFrame(bool save_doubles, int stack_space) {
// Optionally save all volatile double registers.
if (save_doubles) {
- SaveFPRegs(sp, 0, DoubleRegister::kNumVolatileRegisters);
+ MultiPushDoubles(kCallerSavedDoubles);
// Note that d0 will be accessible at
// fp - ExitFrameConstants::kFrameSize -
// kNumVolatileRegisters * kDoubleSize,
@@ -891,7 +920,7 @@ void MacroAssembler::LeaveExitFrame(bool save_doubles, Register argument_count,
const int offset =
(ExitFrameConstants::kFrameSize + kNumRegs * kDoubleSize);
addi(r6, fp, Operand(-offset));
- RestoreFPRegs(r6, 0, kNumRegs);
+ MultiPopDoubles(kCallerSavedDoubles, r6);
}
// Clear top frame.
@@ -2955,28 +2984,6 @@ void MacroAssembler::InitializeFieldsWithFiller(Register start_offset,
}
-void MacroAssembler::SaveFPRegs(Register location, int first, int count) {
- DCHECK(count > 0);
- int cur = first;
- subi(location, location, Operand(count * kDoubleSize));
- for (int i = 0; i < count; i++) {
- DoubleRegister reg = DoubleRegister::from_code(cur++);
- stfd(reg, MemOperand(location, i * kDoubleSize));
- }
-}
-
-
-void MacroAssembler::RestoreFPRegs(Register location, int first, int count) {
- DCHECK(count > 0);
- int cur = first + count - 1;
- for (int i = count - 1; i >= 0; i--) {
- DoubleRegister reg = DoubleRegister::from_code(cur--);
- lfd(reg, MemOperand(location, i * kDoubleSize));
- }
- addi(location, location, Operand(count * kDoubleSize));
-}
-
-
void MacroAssembler::JumpIfBothInstanceTypesAreNotSequentialOneByte(
Register first, Register second, Register scratch1, Register scratch2,
Label* failure) {
« no previous file with comments | « src/ppc/macro-assembler-ppc.h ('k') | src/ppc/regexp-macro-assembler-ppc.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698