Commit cfbe3f64 authored by chunyang.dai's avatar chunyang.dai Committed by Commit bot

X87: On a call to Array(), we patched a call ic.

port ba7b6413 (r30649)

original commit message:

   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 c

BUG=

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

Cr-Commit-Position: refs/heads/master@{#30672}
parent 6b3c070d
......@@ -1916,28 +1916,19 @@ static void EmitLoadTypeFeedbackVector(MacroAssembler* masm, Register vector) {
}
void CallIC_ArrayStub::Generate(MacroAssembler* masm) {
void CallICStub::HandleArrayCase(MacroAssembler* masm, Label* miss) {
// edi - function
// edx - slot id
// ebx - vector
Label miss;
int argc = arg_count();
ParameterCount actual(argc);
__ LoadGlobalFunction(Context::ARRAY_FUNCTION_INDEX, ecx);
__ cmp(edi, ecx);
__ j(not_equal, &miss);
__ j(not_equal, miss);
__ mov(eax, arg_count());
// Reload ecx.
__ mov(ecx, FieldOperand(ebx, edx, times_half_pointer_size,
FixedArray::kHeaderSize));
// Verify that ecx contains an AllocationSite
Factory* factory = masm->isolate()->factory();
__ cmp(FieldOperand(ecx, HeapObject::kMapOffset),
factory->allocation_site_map());
__ j(not_equal, &miss);
// Increment the call count for monomorphic function calls.
__ add(FieldOperand(ebx, edx, times_half_pointer_size,
FixedArray::kHeaderSize + kPointerSize),
......@@ -1948,12 +1939,7 @@ void CallIC_ArrayStub::Generate(MacroAssembler* masm) {
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.
__ Set(eax, arg_count());
__ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET);
// Unreachable.
}
......@@ -2028,11 +2014,21 @@ void CallICStub::Generate(MacroAssembler* masm) {
}
__ bind(&extra_checks_or_miss);
Label uninitialized, miss;
Label uninitialized, miss, not_allocation_site;
__ cmp(ecx, Immediate(TypeFeedbackVector::MegamorphicSentinel(isolate)));
__ j(equal, &slow_start);
// Check if we have an allocation site.
__ CompareRoot(FieldOperand(ecx, HeapObject::kMapOffset),
Heap::kAllocationSiteMapRootIndex);
__ j(not_equal, &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) {
......@@ -2116,16 +2112,13 @@ void CallICStub::Generate(MacroAssembler* masm) {
void CallICStub::GenerateMiss(MacroAssembler* masm) {
FrameScope scope(masm, StackFrame::INTERNAL);
// Push the receiver and the function and feedback info.
// Push the function and feedback info.
__ push(edi);
__ push(ebx);
__ push(edx);
// 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 edi and exit the internal frame.
__ mov(edi, eax);
......@@ -4572,13 +4565,6 @@ void CallICTrampolineStub::Generate(MacroAssembler* masm) {
}
void CallIC_ArrayTrampolineStub::Generate(MacroAssembler* masm) {
EmitLoadTypeFeedbackVector(masm, ebx);
CallIC_ArrayStub stub(isolate(), state());
__ jmp(stub.GetCode(), RelocInfo::CODE_TARGET);
}
void ProfileEntryHookStub::MaybeCallEntryHook(MacroAssembler* masm) {
if (masm->isolate()->function_entry_hook() != NULL) {
ProfileEntryHookStub stub(masm->isolate());
......
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