Commit 50fa1e50 authored by mbrandy's avatar mbrandy Committed by Commit bot

PPC: On a call to Array(), we patched a call ic. This CL makes do with a...

PPC: On a call to Array(), we patched a call ic. This CL makes do with a single dispatcher which inlines the special handling for the Array() call case, loading the allocation site found in the vector and calling the array constructor stub appropriately.

Port ba7b6413

R=mvstanton@chromium.org, joransiu@ca.ibm.com, jyan@ca.ibm.com, michael_dawson@ca.ibm.com, dstence@us.ibm.com
BUG=

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

Cr-Commit-Position: refs/heads/master@{#30661}
parent 23f7d34d
......@@ -2736,45 +2736,29 @@ static void EmitLoadTypeFeedbackVector(MacroAssembler* masm, Register vector) {
}
void CallIC_ArrayStub::Generate(MacroAssembler* masm) {
void CallICStub::HandleArrayCase(MacroAssembler* masm, Label* miss) {
// r4 - function
// r6 - slot id
// r5 - vector
Label miss;
int argc = arg_count();
ParameterCount actual(argc);
__ LoadGlobalFunction(Context::ARRAY_FUNCTION_INDEX, r7);
__ cmp(r4, r7);
__ bne(&miss);
// r7 - allocation site (loaded from vector[slot])
__ LoadGlobalFunction(Context::ARRAY_FUNCTION_INDEX, r8);
__ cmp(r4, r8);
__ bne(miss);
__ mov(r3, Operand(arg_count()));
__ SmiToPtrArrayOffset(r9, r6);
__ add(r9, r5, r9);
__ LoadP(r7, FieldMemOperand(r9, FixedArray::kHeaderSize));
// Verify that r7 contains an AllocationSite
__ LoadP(r8, FieldMemOperand(r7, HeapObject::kMapOffset));
__ CompareRoot(r8, Heap::kAllocationSiteMapRootIndex);
__ bne(&miss);
// Increment the call count for monomorphic function calls.
const int count_offset = FixedArray::kHeaderSize + kPointerSize;
__ LoadP(r6, FieldMemOperand(r9, count_offset));
__ SmiToPtrArrayOffset(r8, r6);
__ add(r5, r5, r8);
__ LoadP(r6, FieldMemOperand(r5, count_offset));
__ AddSmiLiteral(r6, r6, Smi::FromInt(CallICNexus::kCallCountIncrement), r0);
__ StoreP(r6, FieldMemOperand(r9, count_offset), r0);
__ StoreP(r6, FieldMemOperand(r5, count_offset), r0);
__ mr(r5, r7);
__ mr(r6, r4);
ArrayConstructorStub stub(masm->isolate(), arg_count());
__ TailCallStub(&stub);
__ bind(&miss);
GenerateMiss(masm);
// The slow case, we need this no matter what to complete a call after a miss.
__ mov(r3, Operand(arg_count()));
__ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET);
}
......@@ -2849,11 +2833,21 @@ void CallICStub::Generate(MacroAssembler* masm) {
}
__ bind(&extra_checks_or_miss);
Label uninitialized, miss;
Label uninitialized, miss, not_allocation_site;
__ CompareRoot(r7, Heap::kmegamorphic_symbolRootIndex);
__ beq(&slow_start);
// Verify that r7 contains an AllocationSite
__ LoadP(r8, FieldMemOperand(r7, HeapObject::kMapOffset));
__ CompareRoot(r8, Heap::kAllocationSiteMapRootIndex);
__ bne(&not_allocation_site);
// We have an allocation site.
HandleArrayCase(masm, &miss);
__ bind(&not_allocation_site);
// The following cases attempt to handle MISS cases without going to the
// runtime.
if (FLAG_trace_ic) {
......@@ -2942,10 +2936,7 @@ void CallICStub::GenerateMiss(MacroAssembler* masm) {
__ Push(r4, r5, r6);
// Call the entry.
Runtime::FunctionId id = GetICState() == DEFAULT
? Runtime::kCallIC_Miss
: Runtime::kCallIC_Customization_Miss;
__ CallRuntime(id, 3);
__ CallRuntime(Runtime::kCallIC_Miss, 3);
// Move result to r4 and exit the internal frame.
__ mr(r4, r3);
......@@ -4506,13 +4497,6 @@ void CallICTrampolineStub::Generate(MacroAssembler* masm) {
}
void CallIC_ArrayTrampolineStub::Generate(MacroAssembler* masm) {
EmitLoadTypeFeedbackVector(masm, r5);
CallIC_ArrayStub stub(isolate(), state());
__ Jump(stub.GetCode(), RelocInfo::CODE_TARGET);
}
void LoadICStub::Generate(MacroAssembler* masm) { GenerateImpl(masm, false); }
......
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