PPC/s390: [deoptimizer] Fill the single precision registers in the deoptimizer entry stub.

Port 798ffc9d67

R=jarin@chromium.org, joransiu@ca.ibm.com, jyan@ca.ibm.com, michael_dawson@ca.ibm.com
BUG=v8:6077
LOG=N

Review-Url: https://codereview.chromium.org/2774883003
Cr-Commit-Position: refs/heads/master@{#44124}
This commit is contained in:
bjaideep 2017-03-24 13:27:09 -07:00 committed by Commit bot
parent 79ac83e121
commit 567577b8b6
2 changed files with 45 additions and 5 deletions

View File

@ -121,6 +121,7 @@ void Deoptimizer::TableEntryGenerator::Generate() {
RegList saved_regs = restored_regs | sp.bit(); RegList saved_regs = restored_regs | sp.bit();
const int kDoubleRegsSize = kDoubleSize * DoubleRegister::kNumRegisters; const int kDoubleRegsSize = kDoubleSize * DoubleRegister::kNumRegisters;
const int kFloatRegsSize = kFloatSize * FloatRegister::kNumRegisters;
// Save all double registers before messing with them. // Save all double registers before messing with them.
__ subi(sp, sp, Operand(kDoubleRegsSize)); __ subi(sp, sp, Operand(kDoubleRegsSize));
@ -131,6 +132,14 @@ void Deoptimizer::TableEntryGenerator::Generate() {
int offset = code * kDoubleSize; int offset = code * kDoubleSize;
__ stfd(dreg, MemOperand(sp, offset)); __ stfd(dreg, MemOperand(sp, offset));
} }
// Save all float registers before messing with them.
__ subi(sp, sp, Operand(kFloatRegsSize));
for (int i = 0; i < config->num_allocatable_float_registers(); ++i) {
int code = config->GetAllocatableFloatCode(i);
const FloatRegister freg = FloatRegister::from_code(code);
int offset = code * kFloatSize;
__ stfs(freg, MemOperand(sp, offset));
}
// Push saved_regs (needed to populate FrameDescription::registers_). // Push saved_regs (needed to populate FrameDescription::registers_).
// Leave gaps for other registers. // Leave gaps for other registers.
@ -145,7 +154,7 @@ void Deoptimizer::TableEntryGenerator::Generate() {
__ StoreP(fp, MemOperand(ip)); __ StoreP(fp, MemOperand(ip));
const int kSavedRegistersAreaSize = const int kSavedRegistersAreaSize =
(kNumberOfRegisters * kPointerSize) + kDoubleRegsSize; (kNumberOfRegisters * kPointerSize) + kDoubleRegsSize + kFloatRegsSize;
// Get the bailout id from the stack. // Get the bailout id from the stack.
__ LoadP(r5, MemOperand(sp, kSavedRegistersAreaSize)); __ LoadP(r5, MemOperand(sp, kSavedRegistersAreaSize));
@ -196,11 +205,21 @@ void Deoptimizer::TableEntryGenerator::Generate() {
for (int i = 0; i < config->num_allocatable_double_registers(); ++i) { for (int i = 0; i < config->num_allocatable_double_registers(); ++i) {
int code = config->GetAllocatableDoubleCode(i); int code = config->GetAllocatableDoubleCode(i);
int dst_offset = code * kDoubleSize + double_regs_offset; int dst_offset = code * kDoubleSize + double_regs_offset;
int src_offset = code * kDoubleSize + kNumberOfRegisters * kPointerSize; int src_offset =
code * kDoubleSize + kNumberOfRegisters * kPointerSize + kFloatRegsSize;
__ lfd(d0, MemOperand(sp, src_offset)); __ lfd(d0, MemOperand(sp, src_offset));
__ stfd(d0, MemOperand(r4, dst_offset)); __ stfd(d0, MemOperand(r4, dst_offset));
} }
int float_regs_offset = FrameDescription::float_registers_offset();
// Copy float registers to
// float_registers_[FloatRegister::kNumRegisters]
for (int i = 0; i < config->num_allocatable_float_registers(); ++i) {
int code = config->GetAllocatableFloatCode(i);
int dst_offset = code * kFloatSize + float_regs_offset;
int src_offset = code * kFloatSize + kNumberOfRegisters * kPointerSize;
__ lfs(d0, MemOperand(sp, src_offset));
__ stfs(d0, MemOperand(r4, dst_offset));
}
// Remove the bailout id and the saved registers from the stack. // Remove the bailout id and the saved registers from the stack.
__ addi(sp, sp, Operand(kSavedRegistersAreaSize + (1 * kPointerSize))); __ addi(sp, sp, Operand(kSavedRegistersAreaSize + (1 * kPointerSize)));

View File

@ -113,6 +113,7 @@ void Deoptimizer::TableEntryGenerator::Generate() {
RegList restored_regs = kJSCallerSaved | kCalleeSaved; RegList restored_regs = kJSCallerSaved | kCalleeSaved;
const int kDoubleRegsSize = kDoubleSize * DoubleRegister::kNumRegisters; const int kDoubleRegsSize = kDoubleSize * DoubleRegister::kNumRegisters;
const int kFloatRegsSize = kFloatSize * FloatRegister::kNumRegisters;
// Save all double registers before messing with them. // Save all double registers before messing with them.
__ lay(sp, MemOperand(sp, -kDoubleRegsSize)); __ lay(sp, MemOperand(sp, -kDoubleRegsSize));
@ -123,6 +124,14 @@ void Deoptimizer::TableEntryGenerator::Generate() {
int offset = code * kDoubleSize; int offset = code * kDoubleSize;
__ StoreDouble(dreg, MemOperand(sp, offset)); __ StoreDouble(dreg, MemOperand(sp, offset));
} }
// Save all float registers before messing with them.
__ lay(sp, MemOperand(sp, -kFloatRegsSize));
for (int i = 0; i < config->num_allocatable_float_registers(); ++i) {
int code = config->GetAllocatableFloatCode(i);
const FloatRegister dreg = FloatRegister::from_code(code);
int offset = code * kFloatSize;
__ StoreFloat32(dreg, MemOperand(sp, offset));
}
// Push all GPRs onto the stack // Push all GPRs onto the stack
__ lay(sp, MemOperand(sp, -kNumberOfRegisters * kPointerSize)); __ lay(sp, MemOperand(sp, -kNumberOfRegisters * kPointerSize));
@ -132,7 +141,7 @@ void Deoptimizer::TableEntryGenerator::Generate() {
__ StoreP(fp, MemOperand(ip)); __ StoreP(fp, MemOperand(ip));
const int kSavedRegistersAreaSize = const int kSavedRegistersAreaSize =
(kNumberOfRegisters * kPointerSize) + kDoubleRegsSize; (kNumberOfRegisters * kPointerSize) + kDoubleRegsSize + kFloatRegsSize;
// Get the bailout id from the stack. // Get the bailout id from the stack.
__ LoadP(r4, MemOperand(sp, kSavedRegistersAreaSize)); __ LoadP(r4, MemOperand(sp, kSavedRegistersAreaSize));
@ -193,12 +202,24 @@ void Deoptimizer::TableEntryGenerator::Generate() {
for (int i = 0; i < config->num_allocatable_double_registers(); ++i) { for (int i = 0; i < config->num_allocatable_double_registers(); ++i) {
int code = config->GetAllocatableDoubleCode(i); int code = config->GetAllocatableDoubleCode(i);
int dst_offset = code * kDoubleSize + double_regs_offset; int dst_offset = code * kDoubleSize + double_regs_offset;
int src_offset = code * kDoubleSize + kNumberOfRegisters * kPointerSize; int src_offset =
code * kDoubleSize + kNumberOfRegisters * kPointerSize + kFloatRegsSize;
// TODO(joransiu): MVC opportunity // TODO(joransiu): MVC opportunity
__ LoadDouble(d0, MemOperand(sp, src_offset)); __ LoadDouble(d0, MemOperand(sp, src_offset));
__ StoreDouble(d0, MemOperand(r3, dst_offset)); __ StoreDouble(d0, MemOperand(r3, dst_offset));
} }
int float_regs_offset = FrameDescription::float_registers_offset();
// Copy float registers to
// float_registers_[FloatRegister::kNumRegisters]
for (int i = 0; i < config->num_allocatable_float_registers(); ++i) {
int code = config->GetAllocatableFloatCode(i);
int dst_offset = code * kFloatSize + float_regs_offset;
int src_offset = code * kFloatSize + kNumberOfRegisters * kPointerSize;
// TODO(joransiu): MVC opportunity
__ LoadFloat32(d0, MemOperand(sp, src_offset));
__ StoreFloat32(d0, MemOperand(r3, dst_offset));
}
// Remove the bailout id and the saved registers from the stack. // Remove the bailout id and the saved registers from the stack.
__ la(sp, MemOperand(sp, kSavedRegistersAreaSize + (1 * kPointerSize))); __ la(sp, MemOperand(sp, kSavedRegistersAreaSize + (1 * kPointerSize)));