Commit 44bfb4b5 authored by titzer's avatar titzer Committed by Commit bot

[turbofan] Simplifying handling of callee-cleanup stack area.

R=danno@chromium.org
BUG=

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

Cr-Commit-Position: refs/heads/master@{#29957}
parent 1a5751f9
...@@ -1049,11 +1049,7 @@ void CodeGenerator::AssembleReturn() { ...@@ -1049,11 +1049,7 @@ void CodeGenerator::AssembleReturn() {
} else { } else {
__ bind(&return_label_); __ bind(&return_label_);
__ LeaveFrame(StackFrame::MANUAL); __ LeaveFrame(StackFrame::MANUAL);
int pop_count = descriptor->IsJSFunctionCall() int pop_count = static_cast<int>(descriptor->StackParameterCount());
? static_cast<int>(descriptor->JSParameterCount())
: (info()->IsStub()
? info()->code_stub()->GetStackParameterCount()
: 0);
if (pop_count != 0) { if (pop_count != 0) {
__ Drop(pop_count); __ Drop(pop_count);
} }
......
...@@ -1178,11 +1178,7 @@ void CodeGenerator::AssembleReturn() { ...@@ -1178,11 +1178,7 @@ void CodeGenerator::AssembleReturn() {
__ Bind(&return_label_); __ Bind(&return_label_);
__ Mov(jssp, fp); __ Mov(jssp, fp);
__ Pop(fp, lr); __ Pop(fp, lr);
int pop_count = descriptor->IsJSFunctionCall() int pop_count = static_cast<int>(descriptor->StackParameterCount());
? static_cast<int>(descriptor->JSParameterCount())
: (info()->IsStub()
? info()->code_stub()->GetStackParameterCount()
: 0);
if (pop_count != 0) { if (pop_count != 0) {
__ Drop(pop_count); __ Drop(pop_count);
} }
......
...@@ -233,7 +233,7 @@ CallDescriptor* Linkage::GetSimplifiedCDescriptor( ...@@ -233,7 +233,7 @@ CallDescriptor* Linkage::GetSimplifiedCDescriptor(
target_loc, // target location target_loc, // target location
msig, // machine_sig msig, // machine_sig
locations.Build(), // location_sig locations.Build(), // location_sig
0, // js_parameter_count 0, // stack_parameter_count
Operator::kNoProperties, // properties Operator::kNoProperties, // properties
kCalleeSaveRegisters, // callee-saved registers kCalleeSaveRegisters, // callee-saved registers
kCalleeSaveFPRegisters, // callee-saved fp regs kCalleeSaveFPRegisters, // callee-saved fp regs
......
...@@ -1340,11 +1340,7 @@ void CodeGenerator::AssembleReturn() { ...@@ -1340,11 +1340,7 @@ void CodeGenerator::AssembleReturn() {
__ bind(&return_label_); __ bind(&return_label_);
__ mov(esp, ebp); // Move stack pointer back to frame pointer. __ mov(esp, ebp); // Move stack pointer back to frame pointer.
__ pop(ebp); // Pop caller's frame pointer. __ pop(ebp); // Pop caller's frame pointer.
int pop_count = descriptor->IsJSFunctionCall() int pop_count = static_cast<int>(descriptor->StackParameterCount());
? static_cast<int>(descriptor->JSParameterCount())
: (info()->IsStub()
? info()->code_stub()->GetStackParameterCount()
: 0);
if (pop_count == 0) { if (pop_count == 0) {
__ ret(0); __ ret(0);
} else { } else {
......
...@@ -67,7 +67,7 @@ class LinkageHelper { ...@@ -67,7 +67,7 @@ class LinkageHelper {
target_loc, // target location target_loc, // target location
types.Build(), // machine_sig types.Build(), // machine_sig
locations.Build(), // location_sig locations.Build(), // location_sig
js_parameter_count, // js_parameter_count js_parameter_count, // stack_parameter_count
Operator::kNoProperties, // properties Operator::kNoProperties, // properties
kNoCalleeSaved, // callee-saved kNoCalleeSaved, // callee-saved
kNoCalleeSaved, // callee-saved fp kNoCalleeSaved, // callee-saved fp
...@@ -129,7 +129,7 @@ class LinkageHelper { ...@@ -129,7 +129,7 @@ class LinkageHelper {
target_loc, // target location target_loc, // target location
types.Build(), // machine_sig types.Build(), // machine_sig
locations.Build(), // location_sig locations.Build(), // location_sig
js_parameter_count, // js_parameter_count js_parameter_count, // stack_parameter_count
properties, // properties properties, // properties
kNoCalleeSaved, // callee-saved kNoCalleeSaved, // callee-saved
kNoCalleeSaved, // callee-saved fp kNoCalleeSaved, // callee-saved fp
...@@ -189,7 +189,7 @@ class LinkageHelper { ...@@ -189,7 +189,7 @@ class LinkageHelper {
target_loc, // target location target_loc, // target location
types.Build(), // machine_sig types.Build(), // machine_sig
locations.Build(), // location_sig locations.Build(), // location_sig
js_parameter_count, // js_parameter_count stack_parameter_count, // stack_parameter_count
properties, // properties properties, // properties
kNoCalleeSaved, // callee-saved registers kNoCalleeSaved, // callee-saved registers
kNoCalleeSaved, // callee-saved fp kNoCalleeSaved, // callee-saved fp
...@@ -221,7 +221,7 @@ class LinkageHelper { ...@@ -221,7 +221,7 @@ class LinkageHelper {
target_loc, // target location target_loc, // target location
types.Build(), // machine_sig types.Build(), // machine_sig
locations.Build(), // location_sig locations.Build(), // location_sig
0, // js_parameter_count 0, // stack_parameter_count
Operator::kNoProperties, // properties Operator::kNoProperties, // properties
kNoCalleeSaved, // callee-saved registers kNoCalleeSaved, // callee-saved registers
kNoCalleeSaved, // callee-saved fp regs kNoCalleeSaved, // callee-saved fp regs
......
...@@ -127,7 +127,7 @@ class CallDescriptor final : public ZoneObject { ...@@ -127,7 +127,7 @@ class CallDescriptor final : public ZoneObject {
CallDescriptor(Kind kind, MachineType target_type, LinkageLocation target_loc, CallDescriptor(Kind kind, MachineType target_type, LinkageLocation target_loc,
const MachineSignature* machine_sig, const MachineSignature* machine_sig,
LocationSignature* location_sig, size_t js_param_count, LocationSignature* location_sig, size_t stack_param_count,
Operator::Properties properties, Operator::Properties properties,
RegList callee_saved_registers, RegList callee_saved_registers,
RegList callee_saved_fp_registers, Flags flags, RegList callee_saved_fp_registers, Flags flags,
...@@ -137,7 +137,7 @@ class CallDescriptor final : public ZoneObject { ...@@ -137,7 +137,7 @@ class CallDescriptor final : public ZoneObject {
target_loc_(target_loc), target_loc_(target_loc),
machine_sig_(machine_sig), machine_sig_(machine_sig),
location_sig_(location_sig), location_sig_(location_sig),
js_param_count_(js_param_count), stack_param_count_(stack_param_count),
properties_(properties), properties_(properties),
callee_saved_registers_(callee_saved_registers), callee_saved_registers_(callee_saved_registers),
callee_saved_fp_registers_(callee_saved_fp_registers), callee_saved_fp_registers_(callee_saved_fp_registers),
...@@ -164,9 +164,14 @@ class CallDescriptor final : public ZoneObject { ...@@ -164,9 +164,14 @@ class CallDescriptor final : public ZoneObject {
// The number of C parameters to this call. // The number of C parameters to this call.
size_t CParameterCount() const { return machine_sig_->parameter_count(); } size_t CParameterCount() const { return machine_sig_->parameter_count(); }
// The number of JavaScript parameters to this call, including the receiver // The number of stack parameters to the call.
// object. size_t StackParameterCount() const { return stack_param_count_; }
size_t JSParameterCount() const { return js_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, // The total number of inputs to this call, which includes the target,
// receiver, context, etc. // receiver, context, etc.
...@@ -225,7 +230,7 @@ class CallDescriptor final : public ZoneObject { ...@@ -225,7 +230,7 @@ class CallDescriptor final : public ZoneObject {
const LinkageLocation target_loc_; const LinkageLocation target_loc_;
const MachineSignature* const machine_sig_; const MachineSignature* const machine_sig_;
const LocationSignature* const location_sig_; const LocationSignature* const location_sig_;
const size_t js_param_count_; const size_t stack_param_count_;
const Operator::Properties properties_; const Operator::Properties properties_;
const RegList callee_saved_registers_; const RegList callee_saved_registers_;
const RegList callee_saved_fp_registers_; const RegList callee_saved_fp_registers_;
......
...@@ -1152,11 +1152,7 @@ void CodeGenerator::AssembleReturn() { ...@@ -1152,11 +1152,7 @@ void CodeGenerator::AssembleReturn() {
__ bind(&return_label_); __ bind(&return_label_);
__ mov(sp, fp); __ mov(sp, fp);
__ Pop(ra, fp); __ Pop(ra, fp);
int pop_count = descriptor->IsJSFunctionCall() int pop_count = static_cast<int>(descriptor->StackParameterCount());
? static_cast<int>(descriptor->JSParameterCount())
: (info()->IsStub()
? info()->code_stub()->GetStackParameterCount()
: 0);
if (pop_count != 0) { if (pop_count != 0) {
__ DropAndRet(pop_count); __ DropAndRet(pop_count);
} else { } else {
......
...@@ -1228,11 +1228,7 @@ void CodeGenerator::AssembleReturn() { ...@@ -1228,11 +1228,7 @@ void CodeGenerator::AssembleReturn() {
__ bind(&return_label_); __ bind(&return_label_);
__ mov(sp, fp); __ mov(sp, fp);
__ Pop(ra, fp); __ Pop(ra, fp);
int pop_count = descriptor->IsJSFunctionCall() int pop_count = static_cast<int>(descriptor->StackParameterCount());
? static_cast<int>(descriptor->JSParameterCount())
: (info()->IsStub()
? info()->code_stub()->GetStackParameterCount()
: 0);
if (pop_count != 0) { if (pop_count != 0) {
__ DropAndRet(pop_count); __ DropAndRet(pop_count);
} else { } else {
......
...@@ -1377,11 +1377,7 @@ void CodeGenerator::AssembleReturn() { ...@@ -1377,11 +1377,7 @@ void CodeGenerator::AssembleReturn() {
__ b(&return_label_); __ b(&return_label_);
} else { } else {
__ bind(&return_label_); __ bind(&return_label_);
int pop_count = descriptor->IsJSFunctionCall() int pop_count = static_cast<int>(descriptor->StackParameterCount());
? static_cast<int>(descriptor->JSParameterCount())
: (info()->IsStub()
? info()->code_stub()->GetStackParameterCount()
: 0);
__ LeaveFrame(StackFrame::MANUAL, pop_count * kPointerSize); __ LeaveFrame(StackFrame::MANUAL, pop_count * kPointerSize);
__ Ret(); __ Ret();
} }
......
...@@ -1569,11 +1569,7 @@ void CodeGenerator::AssembleReturn() { ...@@ -1569,11 +1569,7 @@ void CodeGenerator::AssembleReturn() {
__ bind(&return_label_); __ bind(&return_label_);
__ movq(rsp, rbp); // Move stack pointer back to frame pointer. __ movq(rsp, rbp); // Move stack pointer back to frame pointer.
__ popq(rbp); // Pop caller's frame pointer. __ popq(rbp); // Pop caller's frame pointer.
int pop_count = descriptor->IsJSFunctionCall() int pop_count = static_cast<int>(descriptor->StackParameterCount());
? static_cast<int>(descriptor->JSParameterCount())
: (info()->IsStub()
? info()->code_stub()->GetStackParameterCount()
: 0);
if (pop_count == 0) { if (pop_count == 0) {
__ Ret(); __ Ret();
} else { } else {
......
...@@ -1597,11 +1597,7 @@ void CodeGenerator::AssembleReturn() { ...@@ -1597,11 +1597,7 @@ void CodeGenerator::AssembleReturn() {
__ bind(&return_label_); __ bind(&return_label_);
__ mov(esp, ebp); // Move stack pointer back to frame pointer. __ mov(esp, ebp); // Move stack pointer back to frame pointer.
__ pop(ebp); // Pop caller's frame pointer. __ pop(ebp); // Pop caller's frame pointer.
int pop_count = descriptor->IsJSFunctionCall() int pop_count = static_cast<int>(descriptor->StackParameterCount());
? static_cast<int>(descriptor->JSParameterCount())
: (info()->IsStub()
? info()->code_stub()->GetStackParameterCount()
: 0);
if (pop_count == 0) { if (pop_count == 0) {
__ ret(0); __ ret(0);
} else { } else {
......
...@@ -80,7 +80,7 @@ TEST(TestLinkageCodeStubIncoming) { ...@@ -80,7 +80,7 @@ TEST(TestLinkageCodeStubIncoming) {
CompilationInfo info(&stub, isolate, &zone); CompilationInfo info(&stub, isolate, &zone);
CallDescriptor* descriptor = Linkage::ComputeIncoming(&zone, &info); CallDescriptor* descriptor = Linkage::ComputeIncoming(&zone, &info);
CHECK(descriptor); 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(1, static_cast<int>(descriptor->ReturnCount()));
CHECK_EQ(Operator::kNoProperties, descriptor->properties()); CHECK_EQ(Operator::kNoProperties, descriptor->properties());
CHECK_EQ(false, descriptor->IsJSFunctionCall()); CHECK_EQ(false, descriptor->IsJSFunctionCall());
......
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