X87: Refactor CallICStub to use a different stub for each customization.

port r21564 (a39968c)

Original commit message:
This gives us much more room to customize on different functions, by
using MajorKey to differentiate them.

BUG=
R=danno@chromium.org

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

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@21601 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent eab27d69
......@@ -2142,13 +2142,18 @@ static void EmitLoadTypeFeedbackVector(MacroAssembler* masm, Register vector) {
}
void CallICStub::Generate_MonomorphicArray(MacroAssembler* masm, Label* miss) {
void CallIC_ArrayStub::Generate(MacroAssembler* masm) {
// edi - function
// ebx - feedback vector
// edx - slot id
Label miss;
int argc = state_.arg_count();
ParameterCount actual(argc);
EmitLoadTypeFeedbackVector(masm, ebx);
__ LoadGlobalFunction(Context::ARRAY_FUNCTION_INDEX, ecx);
__ cmp(edi, ecx);
__ j(not_equal, miss);
__ j(not_equal, &miss);
__ mov(eax, arg_count());
__ mov(ebx, FieldOperand(ebx, edx, times_half_pointer_size,
......@@ -2157,24 +2162,9 @@ void CallICStub::Generate_MonomorphicArray(MacroAssembler* masm, Label* miss) {
__ AssertUndefinedOrAllocationSite(ebx);
ArrayConstructorStub stub(masm->isolate(), arg_count());
__ TailCallStub(&stub);
}
void CallICStub::Generate_CustomFeedbackCall(MacroAssembler* masm) {
// edi - function
// ebx - feedback vector
// edx - slot id
Label miss;
if (state_.stub_type() == CallIC::MONOMORPHIC_ARRAY) {
Generate_MonomorphicArray(masm, &miss);
} else {
// So far there is only one customer for our custom feedback scheme.
UNREACHABLE();
}
__ bind(&miss);
GenerateMiss(masm);
GenerateMiss(masm, IC::kCallIC_Customization_Miss);
// The slow case, we need this no matter what to complete a call after a miss.
CallFunctionNoFeedback(masm,
......@@ -2199,11 +2189,6 @@ void CallICStub::Generate(MacroAssembler* masm) {
EmitLoadTypeFeedbackVector(masm, ebx);
if (state_.stub_type() != CallIC::DEFAULT) {
Generate_CustomFeedbackCall(masm);
return;
}
// The checks. First, does edi match the recorded monomorphic target?
__ cmp(edi, FieldOperand(ebx, edx, times_half_pointer_size,
FixedArray::kHeaderSize));
......@@ -2254,7 +2239,7 @@ void CallICStub::Generate(MacroAssembler* masm) {
// We are here because tracing is on or we are going monomorphic.
__ bind(&miss);
GenerateMiss(masm);
GenerateMiss(masm, IC::kCallIC_Miss);
// the slow case
__ bind(&slow_start);
......@@ -2272,7 +2257,7 @@ void CallICStub::Generate(MacroAssembler* masm) {
}
void CallICStub::GenerateMiss(MacroAssembler* masm) {
void CallICStub::GenerateMiss(MacroAssembler* masm, IC::UtilityId id) {
// Get the receiver of the function from the stack; 1 ~ return address.
__ mov(ecx, Operand(esp, (state_.arg_count() + 1) * kPointerSize));
......@@ -2286,7 +2271,7 @@ void CallICStub::GenerateMiss(MacroAssembler* masm) {
__ push(edx);
// Call the entry.
ExternalReference miss = ExternalReference(IC_Utility(IC::kCallIC_Miss),
ExternalReference miss = ExternalReference(IC_Utility(id),
masm->isolate());
__ CallExternalReference(miss, 4);
......
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