Commit 6335989f authored by Junliang Yan's avatar Junliang Yan Committed by Commit Bot

PPC/s390: [turbofan] Remove remnants of deferred frame building.

Port 476a8853

R=mstarzinger@chromium.org, joransiu@ca.ibm.com, michael_dawson@ca.ibm.com
BUG=
LOG=N

Change-Id: Ia34b1829db73502b9d5780866e9b00ac236dd2e1
Reviewed-on: https://chromium-review.googlesource.com/1129333Reviewed-by: 's avatarMichael Dawson <michael_dawson@ca.ibm.com>
Commit-Queue: Junliang Yan <jyan@ca.ibm.com>
Cr-Commit-Position: refs/heads/master@{#54335}
parent 45b622d9
......@@ -2346,33 +2346,87 @@ void CodeGenerator::AssembleConstructFrame() {
ResetSpeculationPoison();
}
const RegList double_saves = call_descriptor->CalleeSavedFPRegisters();
const RegList saves_fp = call_descriptor->CalleeSavedFPRegisters();
const RegList saves = FLAG_enable_embedded_constant_pool
? call_descriptor->CalleeSavedRegisters() &
~kConstantPoolRegister.bit()
: call_descriptor->CalleeSavedRegisters();
if (shrink_slots > 0) {
if (info()->IsWasm() && shrink_slots > 128) {
// For WebAssembly functions with big frames we have to do the stack
// overflow check before we construct the frame. Otherwise we may not
// have enough space on the stack to call the runtime for the stack
// overflow.
Label done;
// If the frame is bigger than the stack, we throw the stack overflow
// exception unconditionally. Thereby we can avoid the integer overflow
// check in the condition code.
if ((shrink_slots * kPointerSize) < (FLAG_stack_size * 1024)) {
Register scratch = ip;
__ Move(scratch,
ExternalReference::address_of_real_stack_limit(__ isolate()));
__ LoadP(scratch, MemOperand(scratch), r0);
__ Add(scratch, scratch, shrink_slots * kPointerSize, r0);
__ cmpl(sp, scratch);
__ bge(&done);
}
__ LoadP(r3,
FieldMemOperand(kWasmInstanceRegister,
WasmInstanceObject::kCEntryStubOffset),
r0);
__ Move(cp, Smi::kZero);
__ CallRuntimeWithCEntry(Runtime::kThrowWasmStackOverflow, r3);
// We come from WebAssembly, there are no references for the GC.
ReferenceMap* reference_map = new (zone()) ReferenceMap(zone());
RecordSafepoint(reference_map, Safepoint::kSimple, 0,
Safepoint::kNoLazyDeopt);
if (FLAG_debug_code) {
__ stop(GetAbortReason(AbortReason::kUnexpectedReturnFromThrow));
}
__ bind(&done);
}
// Skip callee-saved and return slots, which are pushed below.
shrink_slots -= base::bits::CountPopulation(saves);
shrink_slots -= frame()->GetReturnSlotCount();
shrink_slots -=
(kDoubleSize / kPointerSize) * base::bits::CountPopulation(saves_fp);
__ Add(sp, sp, -shrink_slots * kPointerSize, r0);
}
// Save callee-saved Double registers.
if (double_saves != 0) {
__ MultiPushDoubles(double_saves);
DCHECK_EQ(kNumCalleeSavedDoubles,
base::bits::CountPopulation(double_saves));
if (saves_fp != 0) {
__ MultiPushDoubles(saves_fp);
DCHECK_EQ(kNumCalleeSavedDoubles, base::bits::CountPopulation(saves_fp));
}
// Save callee-saved registers.
const RegList saves = FLAG_enable_embedded_constant_pool
? call_descriptor->CalleeSavedRegisters() &
~kConstantPoolRegister.bit()
: call_descriptor->CalleeSavedRegisters();
if (saves != 0) {
__ MultiPush(saves);
// register save area does not include the fp or constant pool pointer.
}
const int returns = frame()->GetReturnSlotCount();
if (returns != 0) {
// Create space for returns.
__ Add(sp, sp, -returns * kPointerSize, r0);
}
}
void CodeGenerator::AssembleReturn(InstructionOperand* pop) {
auto call_descriptor = linkage()->GetIncomingDescriptor();
int pop_count = static_cast<int>(call_descriptor->StackParameterCount());
const int returns = frame()->GetReturnSlotCount();
if (returns != 0) {
// Create space for returns.
__ Add(sp, sp, returns * kPointerSize, r0);
}
// Restore registers.
const RegList saves = FLAG_enable_embedded_constant_pool
? call_descriptor->CalleeSavedRegisters() &
......
......@@ -2989,30 +2989,82 @@ void CodeGenerator::AssembleConstructFrame() {
ResetSpeculationPoison();
}
const RegList double_saves = call_descriptor->CalleeSavedFPRegisters();
const RegList saves_fp = call_descriptor->CalleeSavedFPRegisters();
const RegList saves = call_descriptor->CalleeSavedRegisters();
if (shrink_slots > 0) {
if (info()->IsWasm() && shrink_slots > 128) {
// For WebAssembly functions with big frames we have to do the stack
// overflow check before we construct the frame. Otherwise we may not
// have enough space on the stack to call the runtime for the stack
// overflow.
Label done;
// If the frame is bigger than the stack, we throw the stack overflow
// exception unconditionally. Thereby we can avoid the integer overflow
// check in the condition code.
if ((shrink_slots * kPointerSize) < (FLAG_stack_size * 1024)) {
Register scratch = r1;
__ Move(scratch,
ExternalReference::address_of_real_stack_limit(__ isolate()));
__ LoadP(scratch, MemOperand(scratch));
__ AddP(scratch, scratch, Operand(shrink_slots * kPointerSize));
__ CmpLogicalP(sp, scratch);
__ bge(&done);
}
__ LoadP(r2, FieldMemOperand(kWasmInstanceRegister,
WasmInstanceObject::kCEntryStubOffset));
__ Move(cp, Smi::kZero);
__ CallRuntimeWithCEntry(Runtime::kThrowWasmStackOverflow, r2);
// We come from WebAssembly, there are no references for the GC.
ReferenceMap* reference_map = new (zone()) ReferenceMap(zone());
RecordSafepoint(reference_map, Safepoint::kSimple, 0,
Safepoint::kNoLazyDeopt);
if (FLAG_debug_code) {
__ stop(GetAbortReason(AbortReason::kUnexpectedReturnFromThrow));
}
__ bind(&done);
}
// Skip callee-saved and return slots, which are pushed below.
shrink_slots -= base::bits::CountPopulation(saves);
shrink_slots -= frame()->GetReturnSlotCount();
shrink_slots -=
(kDoubleSize / kPointerSize) * base::bits::CountPopulation(saves_fp);
__ lay(sp, MemOperand(sp, -shrink_slots * kPointerSize));
}
// Save callee-saved Double registers.
if (double_saves != 0) {
__ MultiPushDoubles(double_saves);
DCHECK_EQ(kNumCalleeSavedDoubles,
base::bits::CountPopulation(double_saves));
if (saves_fp != 0) {
__ MultiPushDoubles(saves_fp);
DCHECK_EQ(kNumCalleeSavedDoubles, base::bits::CountPopulation(saves_fp));
}
// Save callee-saved registers.
const RegList saves = call_descriptor->CalleeSavedRegisters();
if (saves != 0) {
__ MultiPush(saves);
// register save area does not include the fp or constant pool pointer.
}
const int returns = frame()->GetReturnSlotCount();
if (returns != 0) {
// Create space for returns.
__ lay(sp, MemOperand(sp, -returns * kPointerSize));
}
}
void CodeGenerator::AssembleReturn(InstructionOperand* pop) {
auto call_descriptor = linkage()->GetIncomingDescriptor();
int pop_count = static_cast<int>(call_descriptor->StackParameterCount());
const int returns = frame()->GetReturnSlotCount();
if (returns != 0) {
// Create space for returns.
__ lay(sp, MemOperand(sp, returns * kPointerSize));
}
// Restore registers.
const RegList saves = call_descriptor->CalleeSavedRegisters();
if (saves != 0) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment