| 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 d827dead815eca3e4691160460dcca76fbc8a2a6..5acdcab24d32d729f2733388aab35166da46af7c 100644
|
| --- a/src/compiler/ppc/code-generator-ppc.cc
|
| +++ b/src/compiler/ppc/code-generator-ppc.cc
|
| @@ -187,7 +187,8 @@ class OutOfLineRecordWrite final : public OutOfLineCode {
|
| value_(value),
|
| scratch0_(scratch0),
|
| scratch1_(scratch1),
|
| - mode_(mode) {}
|
| + mode_(mode),
|
| + must_save_lr_(!gen->frame_access_state()->has_frame()) {}
|
|
|
| void Generate() final {
|
| if (mode_ > RecordWriteMode::kValueIsPointer) {
|
| @@ -201,7 +202,7 @@ class OutOfLineRecordWrite final : public OutOfLineCode {
|
| : OMIT_REMEMBERED_SET;
|
| SaveFPRegsMode const save_fp_mode =
|
| frame()->DidAllocateDoubleRegisters() ? kSaveFPRegs : kDontSaveFPRegs;
|
| - if (!frame()->needs_frame()) {
|
| + if (must_save_lr_) {
|
| // We need to save and restore lr if the frame was elided.
|
| __ mflr(scratch1_);
|
| __ Push(scratch1_);
|
| @@ -215,7 +216,7 @@ class OutOfLineRecordWrite final : public OutOfLineCode {
|
| __ add(scratch1_, object_, offset_);
|
| }
|
| __ CallStub(&stub);
|
| - if (!frame()->needs_frame()) {
|
| + if (must_save_lr_) {
|
| // We need to save and restore lr if the frame was elided.
|
| __ Pop(scratch1_);
|
| __ mtlr(scratch1_);
|
| @@ -230,6 +231,7 @@ class OutOfLineRecordWrite final : public OutOfLineCode {
|
| Register const scratch0_;
|
| Register const scratch1_;
|
| RecordWriteMode const mode_;
|
| + bool must_save_lr_;
|
| };
|
|
|
|
|
| @@ -670,6 +672,11 @@ Condition FlagsConditionToCondition(FlagsCondition condition, ArchOpcode op) {
|
| DCHECK_EQ(LeaveRC, i.OutputRCBit()); \
|
| } while (0)
|
|
|
| +void CodeGenerator::AssembleDeconstructFrame() {
|
| + __ LeaveFrame(StackFrame::MANUAL);
|
| +}
|
| +
|
| +void CodeGenerator::AssembleSetupStackPointer() {}
|
|
|
| void CodeGenerator::AssembleDeconstructActivationRecord(int stack_param_delta) {
|
| int sp_slot_delta = TailCallFrameStackSlotDelta(stack_param_delta);
|
| @@ -686,7 +693,7 @@ void CodeGenerator::AssemblePrepareTailCall(int stack_param_delta) {
|
| __ Add(sp, sp, sp_slot_delta * kPointerSize, r0);
|
| frame_access_state()->IncreaseSPDelta(-sp_slot_delta);
|
| }
|
| - if (frame()->needs_frame()) {
|
| + if (frame_access_state()->has_frame()) {
|
| __ RestoreFrameStateForTailCall();
|
| }
|
| frame_access_state()->SetFrameAccessToSP();
|
| @@ -867,7 +874,7 @@ void CodeGenerator::AssembleArchInstruction(Instruction* instr) {
|
| DCHECK_EQ(LeaveRC, i.OutputRCBit());
|
| break;
|
| case kArchParentFramePointer:
|
| - if (frame_access_state()->frame()->needs_frame()) {
|
| + if (frame_access_state()->has_frame()) {
|
| __ LoadP(i.OutputRegister(), MemOperand(fp, 0));
|
| } else {
|
| __ mr(i.OutputRegister(), fp);
|
| @@ -1695,7 +1702,7 @@ void CodeGenerator::AssembleDeoptimizerCall(
|
|
|
| void CodeGenerator::AssemblePrologue() {
|
| CallDescriptor* descriptor = linkage()->GetIncomingDescriptor();
|
| - if (frame()->needs_frame()) {
|
| + if (frame_access_state()->has_frame()) {
|
| if (descriptor->IsCFunctionCall()) {
|
| __ function_descriptor();
|
| __ mflr(r0);
|
| @@ -1711,18 +1718,11 @@ void CodeGenerator::AssemblePrologue() {
|
| __ Prologue(this->info()->GeneratePreagedPrologue(), ip);
|
| } else {
|
| StackFrame::Type type = info()->GetOutputStackFrameType();
|
| - if (!ABI_CALL_VIA_IP &&
|
| - info()->output_code_kind() == Code::WASM_FUNCTION) {
|
| - // TODO(mbrandy): Restrict only to the wasm wrapper case.
|
| - __ StubPrologue(type);
|
| - } else {
|
| - __ StubPrologue(type, ip);
|
| - }
|
| + // TODO(mbrandy): Detect cases where ip is the entrypoint (for
|
| + // efficient intialization of the constant pool pointer register).
|
| + __ StubPrologue(type);
|
| }
|
| - } else {
|
| - frame()->SetElidedFrameSizeInSlots(0);
|
| }
|
| - frame_access_state()->SetFrameAccessToDefault();
|
|
|
| int stack_shrink_slots = frame()->GetSpillSlotCount();
|
| if (info()->is_osr()) {
|
| @@ -1791,20 +1791,18 @@ void CodeGenerator::AssembleReturn() {
|
| }
|
|
|
| if (descriptor->IsCFunctionCall()) {
|
| - __ LeaveFrame(StackFrame::MANUAL, pop_count * kPointerSize);
|
| - } else if (frame()->needs_frame()) {
|
| + AssembleDeconstructFrame();
|
| + } else if (frame_access_state()->has_frame()) {
|
| // Canonicalize JSFunction return sites for now.
|
| if (return_label_.is_bound()) {
|
| __ b(&return_label_);
|
| return;
|
| } else {
|
| __ bind(&return_label_);
|
| - __ LeaveFrame(StackFrame::MANUAL, pop_count * kPointerSize);
|
| + AssembleDeconstructFrame();
|
| }
|
| - } else {
|
| - __ Drop(pop_count);
|
| }
|
| - __ Ret();
|
| + __ Ret(pop_count);
|
| }
|
|
|
|
|
|
|