[turbofan] Simplifying handling of callee-cleanup stack area.
authortitzer <titzer@chromium.org>
Fri, 31 Jul 2015 15:18:34 +0000 (08:18 -0700)
committerCommit bot <commit-bot@chromium.org>
Fri, 31 Jul 2015 15:18:52 +0000 (15:18 +0000)
R=danno@chromium.org
BUG=

Review URL: https://codereview.chromium.org/1269913002

Cr-Commit-Position: refs/heads/master@{#29957}

12 files changed:
src/compiler/arm/code-generator-arm.cc
src/compiler/arm64/code-generator-arm64.cc
src/compiler/c-linkage.cc
src/compiler/ia32/code-generator-ia32.cc
src/compiler/linkage-impl.h
src/compiler/linkage.h
src/compiler/mips/code-generator-mips.cc
src/compiler/mips64/code-generator-mips64.cc
src/compiler/ppc/code-generator-ppc.cc
src/compiler/x64/code-generator-x64.cc
src/compiler/x87/code-generator-x87.cc
test/cctest/compiler/test-linkage.cc

index 0c97f846f0cff35eaccb09b24a02ca10f81dcca5..b472feb0af08d23f0ab20129cef0fc113ab685fe 100644 (file)
@@ -1049,11 +1049,7 @@ void CodeGenerator::AssembleReturn() {
     } else {
       __ bind(&return_label_);
       __ LeaveFrame(StackFrame::MANUAL);
-      int pop_count = descriptor->IsJSFunctionCall()
-                          ? static_cast<int>(descriptor->JSParameterCount())
-                          : (info()->IsStub()
-                                 ? info()->code_stub()->GetStackParameterCount()
-                                 : 0);
+      int pop_count = static_cast<int>(descriptor->StackParameterCount());
       if (pop_count != 0) {
         __ Drop(pop_count);
       }
index c3e9af6a29e7e6be9931bf1872eebdd96290aa75..58adc2509883c6c5fcd002d1871c680136fae345 100644 (file)
@@ -1178,11 +1178,7 @@ void CodeGenerator::AssembleReturn() {
       __ Bind(&return_label_);
       __ Mov(jssp, fp);
       __ Pop(fp, lr);
-      int pop_count = descriptor->IsJSFunctionCall()
-                          ? static_cast<int>(descriptor->JSParameterCount())
-                          : (info()->IsStub()
-                                 ? info()->code_stub()->GetStackParameterCount()
-                                 : 0);
+      int pop_count = static_cast<int>(descriptor->StackParameterCount());
       if (pop_count != 0) {
         __ Drop(pop_count);
       }
index 613337c908c5d772fbeea148326b0964df3bb91c..d261d78501facfb0edeb58a0bc23df0552794814 100644 (file)
@@ -233,7 +233,7 @@ CallDescriptor* Linkage::GetSimplifiedCDescriptor(
       target_loc,                    // target location
       msig,                          // machine_sig
       locations.Build(),             // location_sig
-      0,                             // js_parameter_count
+      0,                             // stack_parameter_count
       Operator::kNoProperties,       // properties
       kCalleeSaveRegisters,          // callee-saved registers
       kCalleeSaveFPRegisters,        // callee-saved fp regs
index 12eb42448609fad66a009c6d8116812921283bb0..298627b55bd35dfb1ba40d35da6b49fa16eca1f6 100644 (file)
@@ -1340,11 +1340,7 @@ void CodeGenerator::AssembleReturn() {
       __ bind(&return_label_);
       __ mov(esp, ebp);  // Move stack pointer back to frame pointer.
       __ pop(ebp);       // Pop caller's frame pointer.
-      int pop_count = descriptor->IsJSFunctionCall()
-                          ? static_cast<int>(descriptor->JSParameterCount())
-                          : (info()->IsStub()
-                                 ? info()->code_stub()->GetStackParameterCount()
-                                 : 0);
+      int pop_count = static_cast<int>(descriptor->StackParameterCount());
       if (pop_count == 0) {
         __ ret(0);
       } else {
index 7118e24b99229c878fe6605b672c11624131c175..60d6424a238a4884fa943606440922dbbc5aa751 100644 (file)
@@ -67,7 +67,7 @@ class LinkageHelper {
         target_loc,                       // target location
         types.Build(),                    // machine_sig
         locations.Build(),                // location_sig
-        js_parameter_count,               // js_parameter_count
+        js_parameter_count,               // stack_parameter_count
         Operator::kNoProperties,          // properties
         kNoCalleeSaved,                   // callee-saved
         kNoCalleeSaved,                   // callee-saved fp
@@ -129,7 +129,7 @@ class LinkageHelper {
         target_loc,                       // target location
         types.Build(),                    // machine_sig
         locations.Build(),                // location_sig
-        js_parameter_count,               // js_parameter_count
+        js_parameter_count,               // stack_parameter_count
         properties,                       // properties
         kNoCalleeSaved,                   // callee-saved
         kNoCalleeSaved,                   // callee-saved fp
@@ -189,7 +189,7 @@ class LinkageHelper {
         target_loc,                       // target location
         types.Build(),                    // machine_sig
         locations.Build(),                // location_sig
-        js_parameter_count,               // js_parameter_count
+        stack_parameter_count,            // stack_parameter_count
         properties,                       // properties
         kNoCalleeSaved,                   // callee-saved registers
         kNoCalleeSaved,                   // callee-saved fp
@@ -221,7 +221,7 @@ class LinkageHelper {
         target_loc,                            // target location
         types.Build(),                         // machine_sig
         locations.Build(),                     // location_sig
-        0,                                     // js_parameter_count
+        0,                                     // stack_parameter_count
         Operator::kNoProperties,               // properties
         kNoCalleeSaved,                        // callee-saved registers
         kNoCalleeSaved,                        // callee-saved fp regs
index 033a1cfae613715a616ff13a06ae622eba0fa4af..7f94766fb0a12fdddb6a161536429ac685173db5 100644 (file)
@@ -127,7 +127,7 @@ class CallDescriptor final : public ZoneObject {
 
   CallDescriptor(Kind kind, MachineType target_type, LinkageLocation target_loc,
                  const MachineSignature* machine_sig,
-                 LocationSignature* location_sig, size_t js_param_count,
+                 LocationSignature* location_sig, size_t stack_param_count,
                  Operator::Properties properties,
                  RegList callee_saved_registers,
                  RegList callee_saved_fp_registers, Flags flags,
@@ -137,7 +137,7 @@ class CallDescriptor final : public ZoneObject {
         target_loc_(target_loc),
         machine_sig_(machine_sig),
         location_sig_(location_sig),
-        js_param_count_(js_param_count),
+        stack_param_count_(stack_param_count),
         properties_(properties),
         callee_saved_registers_(callee_saved_registers),
         callee_saved_fp_registers_(callee_saved_fp_registers),
@@ -164,9 +164,14 @@ class CallDescriptor final : public ZoneObject {
   // The number of C parameters to this call.
   size_t CParameterCount() const { return machine_sig_->parameter_count(); }
 
-  // The number of JavaScript parameters to this call, including the receiver
-  // object.
-  size_t JSParameterCount() const { return js_param_count_; }
+  // The number of stack parameters to the call.
+  size_t StackParameterCount() const { return stack_param_count_; }
+
+  // The number of parameters to the JS function call.
+  size_t JSParameterCount() const {
+    DCHECK(IsJSFunctionCall());
+    return stack_param_count_;
+  }
 
   // The total number of inputs to this call, which includes the target,
   // receiver, context, etc.
@@ -225,7 +230,7 @@ class CallDescriptor final : public ZoneObject {
   const LinkageLocation target_loc_;
   const MachineSignature* const machine_sig_;
   const LocationSignature* const location_sig_;
-  const size_t js_param_count_;
+  const size_t stack_param_count_;
   const Operator::Properties properties_;
   const RegList callee_saved_registers_;
   const RegList callee_saved_fp_registers_;
index 66ffb6f898f0e718efbbd22b8c8f3543bca6d6f4..e2ae0bd05dca5f063483f5c5dc3fb224b9263722 100644 (file)
@@ -1152,11 +1152,7 @@ void CodeGenerator::AssembleReturn() {
       __ bind(&return_label_);
       __ mov(sp, fp);
       __ Pop(ra, fp);
-      int pop_count = descriptor->IsJSFunctionCall()
-                          ? static_cast<int>(descriptor->JSParameterCount())
-                          : (info()->IsStub()
-                                 ? info()->code_stub()->GetStackParameterCount()
-                                 : 0);
+      int pop_count = static_cast<int>(descriptor->StackParameterCount());
       if (pop_count != 0) {
         __ DropAndRet(pop_count);
       } else {
index 77c9edf80d96e85fc24d5ccaeb741181af737e8c..1c4a789229b4b6b10e1dca922f9d699124b875f5 100644 (file)
@@ -1228,11 +1228,7 @@ void CodeGenerator::AssembleReturn() {
       __ bind(&return_label_);
       __ mov(sp, fp);
       __ Pop(ra, fp);
-      int pop_count = descriptor->IsJSFunctionCall()
-                          ? static_cast<int>(descriptor->JSParameterCount())
-                          : (info()->IsStub()
-                                 ? info()->code_stub()->GetStackParameterCount()
-                                 : 0);
+      int pop_count = static_cast<int>(descriptor->StackParameterCount());
       if (pop_count != 0) {
         __ DropAndRet(pop_count);
       } else {
index cdc1424cc5e72a7f63a8efa2db56911971f95311..3d91e68a83d790198d8bb5817e23e8826060002b 100644 (file)
@@ -1377,11 +1377,7 @@ void CodeGenerator::AssembleReturn() {
       __ b(&return_label_);
     } else {
       __ bind(&return_label_);
-      int pop_count = descriptor->IsJSFunctionCall()
-                          ? static_cast<int>(descriptor->JSParameterCount())
-                          : (info()->IsStub()
-                                 ? info()->code_stub()->GetStackParameterCount()
-                                 : 0);
+      int pop_count = static_cast<int>(descriptor->StackParameterCount());
       __ LeaveFrame(StackFrame::MANUAL, pop_count * kPointerSize);
       __ Ret();
     }
index 56477d66b66c9baa0d527da7ed3554d1d69f4e0a..38c7f2a31c90724b3fd39767c07b3801fde1cbc6 100644 (file)
@@ -1569,11 +1569,7 @@ void CodeGenerator::AssembleReturn() {
       __ bind(&return_label_);
       __ movq(rsp, rbp);  // Move stack pointer back to frame pointer.
       __ popq(rbp);       // Pop caller's frame pointer.
-      int pop_count = descriptor->IsJSFunctionCall()
-                          ? static_cast<int>(descriptor->JSParameterCount())
-                          : (info()->IsStub()
-                                 ? info()->code_stub()->GetStackParameterCount()
-                                 : 0);
+      int pop_count = static_cast<int>(descriptor->StackParameterCount());
       if (pop_count == 0) {
         __ Ret();
       } else {
index 1335d3f56809d832b612e8e3e7d711a0a3b641a3..bd984113f74179496bfccdb6855e5dfd4403fec2 100644 (file)
@@ -1597,11 +1597,7 @@ void CodeGenerator::AssembleReturn() {
       __ bind(&return_label_);
       __ mov(esp, ebp);  // Move stack pointer back to frame pointer.
       __ pop(ebp);       // Pop caller's frame pointer.
-      int pop_count = descriptor->IsJSFunctionCall()
-                          ? static_cast<int>(descriptor->JSParameterCount())
-                          : (info()->IsStub()
-                                 ? info()->code_stub()->GetStackParameterCount()
-                                 : 0);
+      int pop_count = static_cast<int>(descriptor->StackParameterCount());
       if (pop_count == 0) {
         __ ret(0);
       } else {
index 252c43133e204c70fc13821a249b036aaea59e71..cbfde03ca665e75e1ea69dc050b0617a56e7dd10 100644 (file)
@@ -80,7 +80,7 @@ TEST(TestLinkageCodeStubIncoming) {
   CompilationInfo info(&stub, isolate, &zone);
   CallDescriptor* descriptor = Linkage::ComputeIncoming(&zone, &info);
   CHECK(descriptor);
-  CHECK_EQ(1, static_cast<int>(descriptor->JSParameterCount()));
+  CHECK_EQ(0, static_cast<int>(descriptor->StackParameterCount()));
   CHECK_EQ(1, static_cast<int>(descriptor->ReturnCount()));
   CHECK_EQ(Operator::kNoProperties, descriptor->properties());
   CHECK_EQ(false, descriptor->IsJSFunctionCall());