Commit c6f8955e authored by bjaideep's avatar bjaideep Committed by Commit bot

PPC/s390: [stubs] Refactor the CallICStub to pass the number of arguments.

Port c15c5827

Original commit message:

    This is the next step to unify the Call/Construct feedback collection
    and prepare it to be able to collect SharedFunctionInfo feedback. This
    also reduces the CallICStub overhead quite a bit since we only need one
    stub per mode (and tail call mode), not also one per call arity.

R=bmeurer@chromium.org, joransiu@ca.ibm.com, jyan@ca.ibm.com, michael_dawson@ca.ibm.com, mbrandy@us.ibm.com

BUG=
LOG=N

Review-Url: https://codereview.chromium.org/2415583002
Cr-Commit-Position: refs/heads/master@{#40228}
parent d3d64736
......@@ -2387,10 +2387,10 @@ void FullCodeGenerator::EmitCall(Call* expr, ConvertReceiverMode mode) {
EmitProfilingCounterHandlingForReturnSequence(true);
}
Handle<Code> code =
CodeFactory::CallIC(isolate(), arg_count, mode, expr->tail_call_mode())
.code();
CodeFactory::CallIC(isolate(), mode, expr->tail_call_mode()).code();
__ LoadSmiLiteral(r6, SmiFromSlot(expr->CallFeedbackICSlot()));
__ LoadP(r4, MemOperand(sp, (arg_count + 1) * kPointerSize), r0);
__ mov(r3, Operand(arg_count));
__ Call(code, RelocInfo::CODE_TARGET);
OperandStackDepthDecrement(arg_count + 1);
......
......@@ -2332,10 +2332,10 @@ void FullCodeGenerator::EmitCall(Call* expr, ConvertReceiverMode mode) {
EmitProfilingCounterHandlingForReturnSequence(true);
}
Handle<Code> code =
CodeFactory::CallIC(isolate(), arg_count, mode, expr->tail_call_mode())
.code();
CodeFactory::CallIC(isolate(), mode, expr->tail_call_mode()).code();
__ LoadSmiLiteral(r5, SmiFromSlot(expr->CallFeedbackICSlot()));
__ LoadP(r3, MemOperand(sp, (arg_count + 1) * kPointerSize), r0);
__ mov(r2, Operand(arg_count));
__ Call(code, RelocInfo::CODE_TARGET);
OperandStackDepthDecrement(arg_count + 1);
......
......@@ -1873,6 +1873,7 @@ static void IncrementCallCount(MacroAssembler* masm, Register feedback_vector,
}
void CallICStub::HandleArrayCase(MacroAssembler* masm, Label* miss) {
// r3 - number of arguments
// r4 - function
// r6 - slot id
// r5 - vector
......@@ -1886,19 +1887,17 @@ void CallICStub::HandleArrayCase(MacroAssembler* masm, Label* miss) {
__ mr(r5, r7);
__ mr(r6, r4);
__ mov(r3, Operand(arg_count()));
ArrayConstructorStub stub(masm->isolate());
__ TailCallStub(&stub);
}
void CallICStub::Generate(MacroAssembler* masm) {
// r3 - number of arguments
// r4 - function
// r6 - slot id (Smi)
// r5 - vector
Label extra_checks_or_miss, call, call_function, call_count_incremented;
int argc = arg_count();
ParameterCount actual(argc);
// The checks. First, does r4 match the recorded monomorphic target?
__ SmiToPtrArrayOffset(r9, r6);
......@@ -1932,7 +1931,6 @@ void CallICStub::Generate(MacroAssembler* masm) {
// Increment the call count for monomorphic function calls.
IncrementCallCount(masm, r5, r6, r0);
__ mov(r3, Operand(argc));
__ Jump(masm->isolate()->builtins()->CallFunction(convert_mode(),
tail_call_mode()),
RelocInfo::CODE_TARGET);
......@@ -1976,7 +1974,6 @@ void CallICStub::Generate(MacroAssembler* masm) {
IncrementCallCount(masm, r5, r6, r0);
__ bind(&call_count_incremented);
__ mov(r3, Operand(argc));
__ Jump(masm->isolate()->builtins()->Call(convert_mode(), tail_call_mode()),
RelocInfo::CODE_TARGET);
......@@ -2009,13 +2006,12 @@ void CallICStub::Generate(MacroAssembler* masm) {
{
FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL);
CreateWeakCellStub create_stub(masm->isolate());
__ Push(r5);
__ Push(r6);
__ Push(cp, r4);
__ SmiTag(r3);
__ Push(r3, r5, r6, cp, r4);
__ CallStub(&create_stub);
__ Pop(cp, r4);
__ Pop(r6);
__ Pop(r5);
__ Pop(r5, r6, cp, r4);
__ Pop(r3);
__ SmiUntag(r3);
}
__ b(&call_function);
......@@ -2032,14 +2028,21 @@ void CallICStub::Generate(MacroAssembler* masm) {
void CallICStub::GenerateMiss(MacroAssembler* masm) {
FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL);
// Push the function and feedback info.
__ Push(r4, r5, r6);
// Preserve the number of arguments as Smi.
__ SmiTag(r3);
// Push the receiver and the function and feedback info.
__ Push(r3, r4, r5, r6);
// Call the entry.
__ CallRuntime(Runtime::kCallIC_Miss);
// Move result to r4 and exit the internal frame.
__ mr(r4, r3);
// Restore number of arguments.
__ Pop(r3);
__ SmiUntag(r3);
}
......
......@@ -153,7 +153,7 @@ void CallFunctionWithFeedbackDescriptor::InitializePlatformSpecific(
void CallFunctionWithFeedbackAndVectorDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {r4, r6, r5};
Register registers[] = {r4, r3, r6, r5};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
......
......@@ -1874,6 +1874,7 @@ static void IncrementCallCount(MacroAssembler* masm, Register feedback_vector,
}
void CallICStub::HandleArrayCase(MacroAssembler* masm, Label* miss) {
// r2 - number of arguments
// r3 - function
// r5 - slot id
// r4 - vector
......@@ -1887,18 +1888,16 @@ void CallICStub::HandleArrayCase(MacroAssembler* masm, Label* miss) {
__ LoadRR(r4, r6);
__ LoadRR(r5, r3);
__ mov(r2, Operand(arg_count()));
ArrayConstructorStub stub(masm->isolate());
__ TailCallStub(&stub);
}
void CallICStub::Generate(MacroAssembler* masm) {
// r2 - number of arguments
// r3 - function
// r5 - slot id (Smi)
// r4 - vector
Label extra_checks_or_miss, call, call_function, call_count_incremented;
int argc = arg_count();
ParameterCount actual(argc);
// The checks. First, does r3 match the recorded monomorphic target?
__ SmiToPtrArrayOffset(r8, r5);
......@@ -1932,7 +1931,6 @@ void CallICStub::Generate(MacroAssembler* masm) {
// Increment the call count for monomorphic function calls.
IncrementCallCount(masm, r4, r5, r1);
__ mov(r2, Operand(argc));
__ Jump(masm->isolate()->builtins()->CallFunction(convert_mode(),
tail_call_mode()),
RelocInfo::CODE_TARGET);
......@@ -1976,7 +1974,6 @@ void CallICStub::Generate(MacroAssembler* masm) {
IncrementCallCount(masm, r4, r5, r1);
__ bind(&call_count_incremented);
__ mov(r2, Operand(argc));
__ Jump(masm->isolate()->builtins()->Call(convert_mode(), tail_call_mode()),
RelocInfo::CODE_TARGET);
......@@ -2009,13 +2006,12 @@ void CallICStub::Generate(MacroAssembler* masm) {
{
FrameScope scope(masm, StackFrame::INTERNAL);
CreateWeakCellStub create_stub(masm->isolate());
__ Push(r4);
__ Push(r5);
__ Push(cp, r3);
__ SmiTag(r2);
__ Push(r2, r4, r5, cp, r3);
__ CallStub(&create_stub);
__ Pop(cp, r3);
__ Pop(r5);
__ Pop(r4);
__ Pop(r4, r5, cp, r3);
__ Pop(r2);
__ SmiUntag(r2);
}
__ b(&call_function);
......@@ -2031,14 +2027,21 @@ void CallICStub::Generate(MacroAssembler* masm) {
void CallICStub::GenerateMiss(MacroAssembler* masm) {
FrameScope scope(masm, StackFrame::INTERNAL);
// Push the function and feedback info.
__ Push(r3, r4, r5);
// Preserve the number of arguments as Smi.
__ SmiTag(r2);
// Push the receiver and the function and feedback info.
__ Push(r2, r3, r4, r5);
// Call the entry.
__ CallRuntime(Runtime::kCallIC_Miss);
// Move result to r3 and exit the internal frame.
__ LoadRR(r3, r2);
// Restore number of arguments.
__ Pop(r2);
__ SmiUntag(r2);
}
// StringCharCodeAtGenerator
......
......@@ -140,7 +140,7 @@ void CallFunctionWithFeedbackDescriptor::InitializePlatformSpecific(
void CallFunctionWithFeedbackAndVectorDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {r3, r5, r4};
Register registers[] = {r3, r2, r5, r4};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
......
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