Reviewers: dstence, joransiu, john.yan, titzer,

Description:
PPC: Fix "[turbofan] Support unboxed float and double stack parameters."

[email protected], [email protected], [email protected], [email protected]
BUG=

Please review this at https://codereview.chromium.org/1315183002/

Base URL: https://chromium.googlesource.com/v8/v8.git@master

Affected files (+30, -9 lines):
  M src/compiler/ppc/code-generator-ppc.cc
  M src/compiler/ppc/instruction-selector-ppc.cc


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 bf13c4bf9d61371ff41949b745b44dfc1f9a807b..3baf621028d8fd60bfcef31d09ea050c419996f1 100644
--- a/src/compiler/ppc/code-generator-ppc.cc
+++ b/src/compiler/ppc/code-generator-ppc.cc
@@ -981,7 +981,13 @@ void CodeGenerator::AssembleArchInstruction(Instruction* instr) {
       break;
     case kPPC_PushFrame: {
       int num_slots = i.InputInt32(1);
- __ StorePU(i.InputRegister(0), MemOperand(sp, -num_slots * kPointerSize));
+      if (instr->InputAt(0)->IsDoubleRegister()) {
+        __ stfdu(i.InputDoubleRegister(0),
+                 MemOperand(sp, -num_slots * kPointerSize));
+      } else {
+        __ StorePU(i.InputRegister(0),
+                   MemOperand(sp, -num_slots * kPointerSize));
+      }
       break;
     }
     case kPPC_StoreToStackSlot: {
@@ -1338,6 +1344,8 @@ void CodeGenerator::AssemblePrologue() {
     __ StubPrologue();
     frame()->SetRegisterSaveAreaSize(
         StandardFrameConstants::kFixedFrameSizeFromFp);
+  } else {
+    frame()->SetPCOnStack(false);
   }

   if (info()->is_osr()) {
@@ -1384,6 +1392,7 @@ void CodeGenerator::AssembleReturn() {
const RegList saves = descriptor->CalleeSavedRegisters() & ~frame_saves;
       __ MultiPop(saves);
     }
+    __ LeaveFrame(StackFrame::MANUAL, pop_count * kPointerSize);
   } else if (descriptor->IsJSFunctionCall() || needs_frame_) {
     // Canonicalize JSFunction return sites for now.
     if (return_label_.is_bound()) {
@@ -1391,9 +1400,11 @@ void CodeGenerator::AssembleReturn() {
       return;
     } else {
       __ bind(&return_label_);
+      __ LeaveFrame(StackFrame::MANUAL, pop_count * kPointerSize);
     }
+  } else {
+    __ Drop(pop_count);
   }
-  __ LeaveFrame(StackFrame::MANUAL, pop_count * kPointerSize);
   __ Ret();
 }

Index: src/compiler/ppc/instruction-selector-ppc.cc
diff --git a/src/compiler/ppc/instruction-selector-ppc.cc b/src/compiler/ppc/instruction-selector-ppc.cc index 194b95f90ddf03159837f7728851df3cecdc5421..197dcc13ea688e8cef0268bab731a6f395a96b89 100644
--- a/src/compiler/ppc/instruction-selector-ppc.cc
+++ b/src/compiler/ppc/instruction-selector-ppc.cc
@@ -1477,14 +1477,16 @@ void InstructionSelector::VisitCall(Node* node, BasicBlock* handler) {
     int num_slots = static_cast<int>(descriptor->StackParameterCount());
     int slot = 0;
     for (Node* input : buffer.pushed_nodes) {
-      // Skip any alignment holes in pushed nodes.
-      if (input == nullptr) continue;
       if (slot == 0) {
+        DCHECK(input);
         Emit(kPPC_PushFrame, g.NoOutput(), g.UseRegister(input),
              g.TempImmediate(num_slots));
       } else {
-        Emit(kPPC_StoreToStackSlot, g.NoOutput(), g.UseRegister(input),
-             g.TempImmediate(slot));
+        // Skip any alignment holes in pushed nodes.
+        if (input) {
+          Emit(kPPC_StoreToStackSlot, g.NoOutput(), g.UseRegister(input),
+               g.TempImmediate(slot));
+        }
       }
       ++slot;
     }
@@ -1580,9 +1582,17 @@ void InstructionSelector::VisitTailCall(Node* node) {
     InitializeCallBuffer(node, &buffer, true, false);

     // Push any stack arguments.
-    for (Node* input : base::Reversed(buffer.pushed_nodes)) {
-      if (input == nullptr) continue;
-      Emit(kPPC_Push, g.NoOutput(), g.UseRegister(input));
+    int num_slots = static_cast<int>(descriptor->StackParameterCount());
+    int slot = 0;
+    for (Node* input : buffer.pushed_nodes) {
+      if (slot == 0) {
+        Emit(kPPC_PushFrame, g.NoOutput(), g.UseRegister(input),
+             g.TempImmediate(num_slots));
+      } else {
+        Emit(kPPC_StoreToStackSlot, g.NoOutput(), g.UseRegister(input),
+             g.TempImmediate(slot));
+      }
+      ++slot;
     }

     // Select the appropriate opcode based on the call type.


--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to