[stubs] Change CallICStub to utilize the ConvertReceiverMode.

The CallICStub has call-site specific knowledge about the receiver,
which we did not utilize; plus the CallICStub does in some case know
whether it is about to [[Call]] a function or potentially some other
callable. In the common case we actually know that the target is a
function and so we can use the CallFunction builtin directly instead
of redispatching in the Call builtin.

BUG=chromium:555127, v8:4413
LOG=n

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

Cr-Commit-Position: refs/heads/master@{#32163}
This commit is contained in:
bmeurer 2015-11-22 22:42:01 -08:00 committed by Commit bot
parent 8dda6ee726
commit d80fd48e5d
7 changed files with 69 additions and 34 deletions

View File

@ -2461,7 +2461,7 @@ void CallICStub::Generate(MacroAssembler* masm) {
FixedArray::OffsetOfElementAt(TypeFeedbackVector::kWithTypesIndex);
const int generic_offset =
FixedArray::OffsetOfElementAt(TypeFeedbackVector::kGenericCountIndex);
Label extra_checks_or_miss, call;
Label extra_checks_or_miss, call, call_function;
int argc = arg_count();
ParameterCount actual(argc);
@ -2498,9 +2498,10 @@ void CallICStub::Generate(MacroAssembler* masm) {
__ add(r3, r3, Operand(Smi::FromInt(CallICNexus::kCallCountIncrement)));
__ str(r3, FieldMemOperand(r2, 0));
__ bind(&call);
__ bind(&call_function);
__ mov(r0, Operand(argc));
__ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET);
__ Jump(masm->isolate()->builtins()->CallFunction(convert_mode()),
RelocInfo::CODE_TARGET);
__ bind(&extra_checks_or_miss);
Label uninitialized, miss, not_allocation_site;
@ -2542,7 +2543,11 @@ void CallICStub::Generate(MacroAssembler* masm) {
__ ldr(r4, FieldMemOperand(r2, generic_offset));
__ add(r4, r4, Operand(Smi::FromInt(1)));
__ str(r4, FieldMemOperand(r2, generic_offset));
__ jmp(&call);
__ bind(&call);
__ mov(r0, Operand(argc));
__ Jump(masm->isolate()->builtins()->Call(convert_mode()),
RelocInfo::CODE_TARGET);
__ bind(&uninitialized);
@ -2589,7 +2594,7 @@ void CallICStub::Generate(MacroAssembler* masm) {
__ Pop(r1);
}
__ jmp(&call);
__ jmp(&call_function);
// We are here because tracing is on or we encountered a MISS case we can't
// handle here.

View File

@ -2846,7 +2846,7 @@ void CallICStub::Generate(MacroAssembler* masm) {
FixedArray::OffsetOfElementAt(TypeFeedbackVector::kWithTypesIndex);
const int generic_offset =
FixedArray::OffsetOfElementAt(TypeFeedbackVector::kGenericCountIndex);
Label extra_checks_or_miss, call;
Label extra_checks_or_miss, call, call_function;
int argc = arg_count();
ParameterCount actual(argc);
@ -2890,9 +2890,10 @@ void CallICStub::Generate(MacroAssembler* masm) {
__ Add(index, index, Operand(Smi::FromInt(CallICNexus::kCallCountIncrement)));
__ Str(index, FieldMemOperand(feedback_vector, 0));
__ bind(&call);
__ Bind(&call_function);
__ Mov(x0, argc);
__ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET);
__ Jump(masm->isolate()->builtins()->CallFunction(convert_mode()),
RelocInfo::CODE_TARGET);
__ bind(&extra_checks_or_miss);
Label uninitialized, miss, not_allocation_site;
@ -2929,7 +2930,11 @@ void CallICStub::Generate(MacroAssembler* masm) {
__ Ldr(x4, FieldMemOperand(feedback_vector, generic_offset));
__ Adds(x4, x4, Operand(Smi::FromInt(1)));
__ Str(x4, FieldMemOperand(feedback_vector, generic_offset));
__ B(&call);
__ Bind(&call);
__ Mov(x0, argc);
__ Jump(masm->isolate()->builtins()->Call(convert_mode()),
RelocInfo::CODE_TARGET);
__ bind(&uninitialized);
@ -2976,7 +2981,7 @@ void CallICStub::Generate(MacroAssembler* masm) {
__ Pop(function);
}
__ B(&call);
__ B(&call_function);
// We are here because tracing is on or we encountered a MISS case we can't
// handle here.

View File

@ -982,6 +982,7 @@ class CallICStub: public PlatformCodeStub {
protected:
int arg_count() const { return state().argc(); }
ConvertReceiverMode convert_mode() const { return state().convert_mode(); }
CallICState state() const {
return CallICState(static_cast<ExtraICState>(minor_key_));

View File

@ -2121,7 +2121,7 @@ void CallICStub::Generate(MacroAssembler* masm) {
FixedArray::OffsetOfElementAt(TypeFeedbackVector::kWithTypesIndex);
const int generic_offset =
FixedArray::OffsetOfElementAt(TypeFeedbackVector::kGenericCountIndex);
Label extra_checks_or_miss, call;
Label extra_checks_or_miss, call, call_function;
int argc = arg_count();
ParameterCount actual(argc);
@ -2155,9 +2155,10 @@ void CallICStub::Generate(MacroAssembler* masm) {
FixedArray::kHeaderSize + kPointerSize),
Immediate(Smi::FromInt(CallICNexus::kCallCountIncrement)));
__ bind(&call);
__ bind(&call_function);
__ Set(eax, argc);
__ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET);
__ Jump(masm->isolate()->builtins()->CallFunction(convert_mode()),
RelocInfo::CODE_TARGET);
__ bind(&extra_checks_or_miss);
Label uninitialized, miss, not_allocation_site;
@ -2195,7 +2196,11 @@ void CallICStub::Generate(MacroAssembler* masm) {
// We have to update statistics for runtime profiling.
__ sub(FieldOperand(ebx, with_types_offset), Immediate(Smi::FromInt(1)));
__ add(FieldOperand(ebx, generic_offset), Immediate(Smi::FromInt(1)));
__ jmp(&call);
__ bind(&call);
__ Set(eax, argc);
__ Jump(masm->isolate()->builtins()->Call(convert_mode()),
RelocInfo::CODE_TARGET);
__ bind(&uninitialized);
@ -2239,7 +2244,7 @@ void CallICStub::Generate(MacroAssembler* masm) {
__ pop(edi);
}
__ jmp(&call);
__ jmp(&call_function);
// We are here because tracing is on or we encountered a MISS case we can't
// handle here.

View File

@ -2585,7 +2585,7 @@ void CallICStub::Generate(MacroAssembler* masm) {
FixedArray::OffsetOfElementAt(TypeFeedbackVector::kWithTypesIndex);
const int generic_offset =
FixedArray::OffsetOfElementAt(TypeFeedbackVector::kGenericCountIndex);
Label extra_checks_or_miss, call;
Label extra_checks_or_miss, call, call_function;
int argc = arg_count();
ParameterCount actual(argc);
@ -2622,9 +2622,11 @@ void CallICStub::Generate(MacroAssembler* masm) {
__ Addu(a3, a3, Operand(Smi::FromInt(CallICNexus::kCallCountIncrement)));
__ sw(a3, FieldMemOperand(at, FixedArray::kHeaderSize + kPointerSize));
__ bind(&call);
__ li(a0, Operand(argc));
__ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET);
__ bind(&call_function);
__ Jump(masm->isolate()->builtins()->CallFunction(convert_mode()),
RelocInfo::CODE_TARGET, al, zero_reg, Operand(zero_reg),
USE_DELAY_SLOT);
__ li(a0, Operand(argc)); // In delay slot.
__ bind(&extra_checks_or_miss);
Label uninitialized, miss, not_allocation_site;
@ -2665,8 +2667,13 @@ void CallICStub::Generate(MacroAssembler* masm) {
__ sw(t0, FieldMemOperand(a2, with_types_offset));
__ lw(t0, FieldMemOperand(a2, generic_offset));
__ Addu(t0, t0, Operand(Smi::FromInt(1)));
__ Branch(USE_DELAY_SLOT, &call);
__ sw(t0, FieldMemOperand(a2, generic_offset)); // In delay slot.
__ sw(t0, FieldMemOperand(a2, generic_offset));
__ bind(&call);
__ Jump(masm->isolate()->builtins()->Call(convert_mode()),
RelocInfo::CODE_TARGET, al, zero_reg, Operand(zero_reg),
USE_DELAY_SLOT);
__ li(a0, Operand(argc)); // In delay slot.
__ bind(&uninitialized);
@ -2712,7 +2719,7 @@ void CallICStub::Generate(MacroAssembler* masm) {
__ Pop(a1);
}
__ Branch(&call);
__ Branch(&call_function);
// We are here because tracing is on or we encountered a MISS case we can't
// handle here.

View File

@ -2661,7 +2661,7 @@ void CallICStub::Generate(MacroAssembler* masm) {
FixedArray::OffsetOfElementAt(TypeFeedbackVector::kWithTypesIndex);
const int generic_offset =
FixedArray::OffsetOfElementAt(TypeFeedbackVector::kGenericCountIndex);
Label extra_checks_or_miss, call;
Label extra_checks_or_miss, call, call_function;
int argc = arg_count();
ParameterCount actual(argc);
@ -2698,9 +2698,11 @@ void CallICStub::Generate(MacroAssembler* masm) {
__ Daddu(t0, t0, Operand(Smi::FromInt(CallICNexus::kCallCountIncrement)));
__ sd(t0, FieldMemOperand(a3, FixedArray::kHeaderSize + kPointerSize));
__ bind(&call);
__ li(a0, Operand(argc));
__ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET);
__ bind(&call_function);
__ Jump(masm->isolate()->builtins()->CallFunction(convert_mode()),
RelocInfo::CODE_TARGET, al, zero_reg, Operand(zero_reg),
USE_DELAY_SLOT);
__ li(a0, Operand(argc)); // In delay slot.
__ bind(&extra_checks_or_miss);
Label uninitialized, miss, not_allocation_site;
@ -2741,8 +2743,13 @@ void CallICStub::Generate(MacroAssembler* masm) {
__ sd(a4, FieldMemOperand(a2, with_types_offset));
__ ld(a4, FieldMemOperand(a2, generic_offset));
__ Daddu(a4, a4, Operand(Smi::FromInt(1)));
__ Branch(USE_DELAY_SLOT, &call);
__ sd(a4, FieldMemOperand(a2, generic_offset)); // In delay slot.
__ sd(a4, FieldMemOperand(a2, generic_offset));
__ bind(&call);
__ Jump(masm->isolate()->builtins()->Call(convert_mode()),
RelocInfo::CODE_TARGET, al, zero_reg, Operand(zero_reg),
USE_DELAY_SLOT);
__ li(a0, Operand(argc)); // In delay slot.
__ bind(&uninitialized);
@ -2788,7 +2795,7 @@ void CallICStub::Generate(MacroAssembler* masm) {
__ Pop(a1);
}
__ Branch(&call);
__ Branch(&call_function);
// We are here because tracing is on or we encountered a MISS case we can't
// handle here.

View File

@ -1959,7 +1959,7 @@ void CallICStub::Generate(MacroAssembler* masm) {
FixedArray::OffsetOfElementAt(TypeFeedbackVector::kWithTypesIndex);
const int generic_offset =
FixedArray::OffsetOfElementAt(TypeFeedbackVector::kGenericCountIndex);
Label extra_checks_or_miss, call;
Label extra_checks_or_miss, call, call_function;
int argc = arg_count();
StackArgumentsAccessor args(rsp, argc);
ParameterCount actual(argc);
@ -1995,9 +1995,10 @@ void CallICStub::Generate(MacroAssembler* masm) {
FixedArray::kHeaderSize + kPointerSize),
Smi::FromInt(CallICNexus::kCallCountIncrement));
__ bind(&call);
__ bind(&call_function);
__ Set(rax, argc);
__ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET);
__ Jump(masm->isolate()->builtins()->CallFunction(convert_mode()),
RelocInfo::CODE_TARGET);
__ bind(&extra_checks_or_miss);
Label uninitialized, miss, not_allocation_site;
@ -2034,7 +2035,11 @@ void CallICStub::Generate(MacroAssembler* masm) {
// We have to update statistics for runtime profiling.
__ SmiAddConstant(FieldOperand(rbx, with_types_offset), Smi::FromInt(-1));
__ SmiAddConstant(FieldOperand(rbx, generic_offset), Smi::FromInt(1));
__ jmp(&call);
__ bind(&call);
__ Set(rax, argc);
__ Jump(masm->isolate()->builtins()->Call(convert_mode()),
RelocInfo::CODE_TARGET);
__ bind(&uninitialized);
@ -2080,7 +2085,7 @@ void CallICStub::Generate(MacroAssembler* masm) {
__ Pop(rdi);
}
__ jmp(&call);
__ jmp(&call_function);
// We are here because tracing is on or we encountered a MISS case we can't
// handle here.