| 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 fc9a0394888fea3eaa922ee0281547b2e560e7e9..6d226d0485d5e1285c742565328adec07f1e5968 100644
|
| --- a/src/compiler/ppc/code-generator-ppc.cc
|
| +++ b/src/compiler/ppc/code-generator-ppc.cc
|
| @@ -1090,7 +1090,7 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
|
| break;
|
| }
|
| case kArchRet:
|
| - AssembleReturn();
|
| + AssembleReturn(instr->InputAt(0));
|
| DCHECK_EQ(LeaveRC, i.OutputRCBit());
|
| break;
|
| case kArchStackPointer:
|
| @@ -2174,8 +2174,7 @@ void CodeGenerator::AssembleConstructFrame() {
|
| }
|
| }
|
|
|
| -
|
| -void CodeGenerator::AssembleReturn() {
|
| +void CodeGenerator::AssembleReturn(InstructionOperand* pop) {
|
| CallDescriptor* descriptor = linkage()->GetIncomingDescriptor();
|
| int pop_count = static_cast<int>(descriptor->StackParameterCount());
|
|
|
| @@ -2193,20 +2192,33 @@ void CodeGenerator::AssembleReturn() {
|
| if (double_saves != 0) {
|
| __ MultiPopDoubles(double_saves);
|
| }
|
| + PPCOperandConverter g(this, nullptr);
|
|
|
| if (descriptor->IsCFunctionCall()) {
|
| AssembleDeconstructFrame();
|
| } else if (frame_access_state()->has_frame()) {
|
| - // Canonicalize JSFunction return sites for now.
|
| - if (return_label_.is_bound()) {
|
| - __ b(&return_label_);
|
| - return;
|
| + // Canonicalize JSFunction return sites for now unless they have an variable
|
| + // number of stack slot pops
|
| + if (pop->IsImmediate() && g.ToConstant(pop).ToInt32() == 0) {
|
| + if (return_label_.is_bound()) {
|
| + __ b(&return_label_);
|
| + return;
|
| + } else {
|
| + __ bind(&return_label_);
|
| + AssembleDeconstructFrame();
|
| + }
|
| } else {
|
| - __ bind(&return_label_);
|
| AssembleDeconstructFrame();
|
| }
|
| }
|
| - __ Ret(pop_count);
|
| + if (pop->IsImmediate()) {
|
| + DCHECK_EQ(Constant::kInt32, g.ToConstant(pop).type());
|
| + pop_count += g.ToConstant(pop).ToInt32();
|
| + } else {
|
| + __ Drop(g.ToRegister(pop));
|
| + }
|
| + __ Drop(pop_count);
|
| + __ Ret();
|
| }
|
|
|
|
|
|
|