Commit 701c6e74 authored by balazs.kilvady's avatar balazs.kilvady Committed by Commit bot

MIPS: Use a trampoline stub to load the type feedback vector for CallICs.

Port 2a567faa

BUG=

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

Cr-Commit-Position: refs/heads/master@{#26298}
parent 1e905469
...@@ -2746,10 +2746,9 @@ static void EmitLoadTypeFeedbackVector(MacroAssembler* masm, Register vector) { ...@@ -2746,10 +2746,9 @@ static void EmitLoadTypeFeedbackVector(MacroAssembler* masm, Register vector) {
void CallIC_ArrayStub::Generate(MacroAssembler* masm) { void CallIC_ArrayStub::Generate(MacroAssembler* masm) {
// a1 - function // a1 - function
// a3 - slot id // a3 - slot id
// a2 - vector
Label miss; Label miss;
EmitLoadTypeFeedbackVector(masm, a2);
__ LoadGlobalFunction(Context::ARRAY_FUNCTION_INDEX, at); __ LoadGlobalFunction(Context::ARRAY_FUNCTION_INDEX, at);
__ Branch(&miss, ne, a1, Operand(at)); __ Branch(&miss, ne, a1, Operand(at));
...@@ -2784,6 +2783,7 @@ void CallIC_ArrayStub::Generate(MacroAssembler* masm) { ...@@ -2784,6 +2783,7 @@ void CallIC_ArrayStub::Generate(MacroAssembler* masm) {
void CallICStub::Generate(MacroAssembler* masm) { void CallICStub::Generate(MacroAssembler* masm) {
// a1 - function // a1 - function
// a3 - slot id (Smi) // a3 - slot id (Smi)
// a2 - vector
const int with_types_offset = const int with_types_offset =
FixedArray::OffsetOfElementAt(TypeFeedbackVector::kWithTypesIndex); FixedArray::OffsetOfElementAt(TypeFeedbackVector::kWithTypesIndex);
const int generic_offset = const int generic_offset =
...@@ -2794,8 +2794,6 @@ void CallICStub::Generate(MacroAssembler* masm) { ...@@ -2794,8 +2794,6 @@ void CallICStub::Generate(MacroAssembler* masm) {
int argc = arg_count(); int argc = arg_count();
ParameterCount actual(argc); ParameterCount actual(argc);
EmitLoadTypeFeedbackVector(masm, a2);
// The checks. First, does r1 match the recorded monomorphic target? // The checks. First, does r1 match the recorded monomorphic target?
__ sll(t0, a3, kPointerSizeLog2 - kSmiTagSize); __ sll(t0, a3, kPointerSizeLog2 - kSmiTagSize);
__ Addu(t0, a2, Operand(t0)); __ Addu(t0, a2, Operand(t0));
...@@ -4479,6 +4477,20 @@ void KeyedLoadICTrampolineStub::Generate(MacroAssembler* masm) { ...@@ -4479,6 +4477,20 @@ void KeyedLoadICTrampolineStub::Generate(MacroAssembler* masm) {
} }
void CallICTrampolineStub::Generate(MacroAssembler* masm) {
EmitLoadTypeFeedbackVector(masm, a2);
CallICStub stub(isolate(), state());
__ Jump(stub.GetCode(), RelocInfo::CODE_TARGET);
}
void CallIC_ArrayTrampolineStub::Generate(MacroAssembler* masm) {
EmitLoadTypeFeedbackVector(masm, a2);
CallIC_ArrayStub stub(isolate(), state());
__ Jump(stub.GetCode(), RelocInfo::CODE_TARGET);
}
void ProfileEntryHookStub::MaybeCallEntryHook(MacroAssembler* masm) { void ProfileEntryHookStub::MaybeCallEntryHook(MacroAssembler* masm) {
if (masm->isolate()->function_entry_hook() != NULL) { if (masm->isolate()->function_entry_hook() != NULL) {
ProfileEntryHookStub stub(masm->isolate()); ProfileEntryHookStub stub(masm->isolate());
......
...@@ -2982,8 +2982,7 @@ void FullCodeGenerator::EmitCall(Call* expr, CallICState::CallType call_type) { ...@@ -2982,8 +2982,7 @@ void FullCodeGenerator::EmitCall(Call* expr, CallICState::CallType call_type) {
// Record source position of the IC call. // Record source position of the IC call.
SetSourcePosition(expr->position()); SetSourcePosition(expr->position());
Handle<Code> ic = CallIC::initialize_stub( Handle<Code> ic = CodeFactory::CallIC(isolate(), arg_count, call_type).code();
isolate(), arg_count, call_type);
__ li(a3, Operand(SmiFromSlot(expr->CallFeedbackSlot()))); __ li(a3, Operand(SmiFromSlot(expr->CallFeedbackSlot())));
__ lw(a1, MemOperand(sp, (arg_count + 1) * kPointerSize)); __ lw(a1, MemOperand(sp, (arg_count + 1) * kPointerSize));
// Don't assign a type feedback id to the IC, since type feedback is provided // Don't assign a type feedback id to the IC, since type feedback is provided
......
...@@ -125,6 +125,16 @@ void CallFunctionWithFeedbackDescriptor::Initialize( ...@@ -125,6 +125,16 @@ void CallFunctionWithFeedbackDescriptor::Initialize(
} }
void CallFunctionWithFeedbackAndVectorDescriptor::Initialize(
CallInterfaceDescriptorData* data) {
Register registers[] = {cp, a1, a3, a2};
Representation representations[] = {
Representation::Tagged(), Representation::Tagged(), Representation::Smi(),
Representation::Tagged()};
data->Initialize(arraysize(registers), registers, representations);
}
void CallConstructDescriptor::Initialize(CallInterfaceDescriptorData* data) { void CallConstructDescriptor::Initialize(CallInterfaceDescriptorData* data) {
// a0 : number of arguments // a0 : number of arguments
// a1 : the function to call // a1 : the function to call
......
...@@ -2821,10 +2821,9 @@ static void EmitLoadTypeFeedbackVector(MacroAssembler* masm, Register vector) { ...@@ -2821,10 +2821,9 @@ static void EmitLoadTypeFeedbackVector(MacroAssembler* masm, Register vector) {
void CallIC_ArrayStub::Generate(MacroAssembler* masm) { void CallIC_ArrayStub::Generate(MacroAssembler* masm) {
// a1 - function // a1 - function
// a3 - slot id // a3 - slot id
// a2 - vector
Label miss; Label miss;
EmitLoadTypeFeedbackVector(masm, a2);
__ LoadGlobalFunction(Context::ARRAY_FUNCTION_INDEX, at); __ LoadGlobalFunction(Context::ARRAY_FUNCTION_INDEX, at);
__ Branch(&miss, ne, a1, Operand(at)); __ Branch(&miss, ne, a1, Operand(at));
...@@ -2859,6 +2858,7 @@ void CallIC_ArrayStub::Generate(MacroAssembler* masm) { ...@@ -2859,6 +2858,7 @@ void CallIC_ArrayStub::Generate(MacroAssembler* masm) {
void CallICStub::Generate(MacroAssembler* masm) { void CallICStub::Generate(MacroAssembler* masm) {
// a1 - function // a1 - function
// a3 - slot id (Smi) // a3 - slot id (Smi)
// a2 - vector
const int with_types_offset = const int with_types_offset =
FixedArray::OffsetOfElementAt(TypeFeedbackVector::kWithTypesIndex); FixedArray::OffsetOfElementAt(TypeFeedbackVector::kWithTypesIndex);
const int generic_offset = const int generic_offset =
...@@ -2869,8 +2869,6 @@ void CallICStub::Generate(MacroAssembler* masm) { ...@@ -2869,8 +2869,6 @@ void CallICStub::Generate(MacroAssembler* masm) {
int argc = arg_count(); int argc = arg_count();
ParameterCount actual(argc); ParameterCount actual(argc);
EmitLoadTypeFeedbackVector(masm, a2);
// The checks. First, does r1 match the recorded monomorphic target? // The checks. First, does r1 match the recorded monomorphic target?
__ dsrl(a4, a3, 32 - kPointerSizeLog2); __ dsrl(a4, a3, 32 - kPointerSizeLog2);
__ Daddu(a4, a2, Operand(a4)); __ Daddu(a4, a2, Operand(a4));
...@@ -4519,6 +4517,20 @@ void KeyedLoadICTrampolineStub::Generate(MacroAssembler* masm) { ...@@ -4519,6 +4517,20 @@ void KeyedLoadICTrampolineStub::Generate(MacroAssembler* masm) {
} }
void CallICTrampolineStub::Generate(MacroAssembler* masm) {
EmitLoadTypeFeedbackVector(masm, a2);
CallICStub stub(isolate(), state());
__ Jump(stub.GetCode(), RelocInfo::CODE_TARGET);
}
void CallIC_ArrayTrampolineStub::Generate(MacroAssembler* masm) {
EmitLoadTypeFeedbackVector(masm, a2);
CallIC_ArrayStub stub(isolate(), state());
__ Jump(stub.GetCode(), RelocInfo::CODE_TARGET);
}
void ProfileEntryHookStub::MaybeCallEntryHook(MacroAssembler* masm) { void ProfileEntryHookStub::MaybeCallEntryHook(MacroAssembler* masm) {
if (masm->isolate()->function_entry_hook() != NULL) { if (masm->isolate()->function_entry_hook() != NULL) {
ProfileEntryHookStub stub(masm->isolate()); ProfileEntryHookStub stub(masm->isolate());
......
...@@ -2982,8 +2982,7 @@ void FullCodeGenerator::EmitCall(Call* expr, CallICState::CallType call_type) { ...@@ -2982,8 +2982,7 @@ void FullCodeGenerator::EmitCall(Call* expr, CallICState::CallType call_type) {
// Record source position of the IC call. // Record source position of the IC call.
SetSourcePosition(expr->position()); SetSourcePosition(expr->position());
Handle<Code> ic = CallIC::initialize_stub( Handle<Code> ic = CodeFactory::CallIC(isolate(), arg_count, call_type).code();
isolate(), arg_count, call_type);
__ li(a3, Operand(SmiFromSlot(expr->CallFeedbackSlot()))); __ li(a3, Operand(SmiFromSlot(expr->CallFeedbackSlot())));
__ ld(a1, MemOperand(sp, (arg_count + 1) * kPointerSize)); __ ld(a1, MemOperand(sp, (arg_count + 1) * kPointerSize));
// Don't assign a type feedback id to the IC, since type feedback is provided // Don't assign a type feedback id to the IC, since type feedback is provided
......
...@@ -119,6 +119,16 @@ void CallFunctionWithFeedbackDescriptor::Initialize( ...@@ -119,6 +119,16 @@ void CallFunctionWithFeedbackDescriptor::Initialize(
} }
void CallFunctionWithFeedbackAndVectorDescriptor::Initialize(
CallInterfaceDescriptorData* data) {
Register registers[] = {cp, a1, a3, a2};
Representation representations[] = {
Representation::Tagged(), Representation::Tagged(), Representation::Smi(),
Representation::Tagged()};
data->Initialize(arraysize(registers), registers, representations);
}
void CallFunctionDescriptor::Initialize(CallInterfaceDescriptorData* data) { void CallFunctionDescriptor::Initialize(CallInterfaceDescriptorData* data) {
Register registers[] = {cp, a1}; Register registers[] = {cp, a1};
data->Initialize(arraysize(registers), registers, NULL); data->Initialize(arraysize(registers), registers, NULL);
......
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