From 05eb56798e4d4bbd415a4bd369c7e9ffd6884d11 Mon Sep 17 00:00:00 2001 From: ishell Date: Tue, 20 Sep 2016 05:25:30 -0700 Subject: [PATCH] [ic] Reorder parameters of StoreIC_Miss and KeyedStoreIC_Miss runtime functions. This will allow to simplify the miss part of store IC handlers when we decide to pass value/slot/vector on the stack. BUG=v8:5407 Review-Url: https://codereview.chromium.org/2351643005 Cr-Commit-Position: refs/heads/master@{#39549} --- src/builtins/builtins-handler.cc | 4 ++-- src/code-stubs.cc | 20 ++++++++++---------- src/ic/arm/ic-arm.cc | 7 ++++--- src/ic/arm64/ic-arm64.cc | 7 ++++--- src/ic/ia32/ic-ia32.cc | 8 ++++---- src/ic/ic.cc | 27 ++++++++++++++------------- src/ic/mips/ic-mips.cc | 7 ++++--- src/ic/mips64/ic-mips64.cc | 7 ++++--- src/ic/ppc/ic-ppc.cc | 7 ++++--- src/ic/s390/ic-s390.cc | 7 ++++--- src/ic/x64/ic-x64.cc | 21 ++++++++++----------- src/ic/x87/ic-x87.cc | 8 ++++---- 12 files changed, 68 insertions(+), 62 deletions(-) diff --git a/src/builtins/builtins-handler.cc b/src/builtins/builtins-handler.cc index 0b83165338..ebbc9784a1 100644 --- a/src/builtins/builtins-handler.cc +++ b/src/builtins/builtins-handler.cc @@ -120,8 +120,8 @@ void Builtins::Generate_StoreIC_Miss(CodeStubAssembler* assembler) { Node* vector = assembler->Parameter(Descriptor::kVector); Node* context = assembler->Parameter(Descriptor::kContext); - assembler->TailCallRuntime(Runtime::kStoreIC_Miss, context, receiver, name, - value, slot, vector); + assembler->TailCallRuntime(Runtime::kStoreIC_Miss, context, value, slot, + vector, receiver, name); } void Builtins::Generate_StoreIC_Normal(MacroAssembler* masm) { diff --git a/src/code-stubs.cc b/src/code-stubs.cc index 5143cd4bdf..f22e97c3b4 100644 --- a/src/code-stubs.cc +++ b/src/code-stubs.cc @@ -552,8 +552,8 @@ void StoreTransitionStub::GenerateAssembly(CodeStubAssembler* assembler) const { assembler->Bind(&miss); { assembler->Comment("Miss"); - assembler->TailCallRuntime(Runtime::kStoreIC_Miss, context, receiver, - name, value, slot, vector); + assembler->TailCallRuntime(Runtime::kStoreIC_Miss, context, value, slot, + vector, receiver, name); } } } @@ -4566,8 +4566,8 @@ void StoreFieldStub::GenerateAssembly(CodeStubAssembler* assembler) const { assembler->Bind(&miss); { assembler->Comment("Miss"); - assembler->TailCallRuntime(Runtime::kStoreIC_Miss, context, receiver, - name, value, slot, vector); + assembler->TailCallRuntime(Runtime::kStoreIC_Miss, context, value, slot, + vector, receiver, name); } } } @@ -4662,8 +4662,8 @@ void StoreGlobalStub::GenerateAssembly(CodeStubAssembler* assembler) const { assembler->Bind(&miss); { assembler->Comment("Miss"); - assembler->TailCallRuntime(Runtime::kStoreIC_Miss, context, receiver, name, - value, slot, vector); + assembler->TailCallRuntime(Runtime::kStoreIC_Miss, context, value, slot, + vector, receiver, name); } } @@ -4711,8 +4711,8 @@ void KeyedStoreSloppyArgumentsStub::GenerateAssembly( assembler->Bind(&miss); { assembler->Comment("Miss"); - assembler->TailCallRuntime(Runtime::kKeyedStoreIC_Miss, context, receiver, - key, value, slot, vector); + assembler->TailCallRuntime(Runtime::kKeyedStoreIC_Miss, context, value, + slot, vector, receiver, key); } } @@ -5788,8 +5788,8 @@ void StoreFastElementStub::GenerateAssembly( assembler->Bind(&miss); { assembler->Comment("Miss"); - assembler->TailCallRuntime(Runtime::kKeyedStoreIC_Miss, context, receiver, - key, value, slot, vector); + assembler->TailCallRuntime(Runtime::kKeyedStoreIC_Miss, context, value, + slot, vector, receiver, key); } } diff --git a/src/ic/arm/ic-arm.cc b/src/ic/arm/ic-arm.cc index 19381047f3..10ec578f7b 100644 --- a/src/ic/arm/ic-arm.cc +++ b/src/ic/arm/ic-arm.cc @@ -441,10 +441,11 @@ void KeyedLoadIC::GenerateMegamorphic(MacroAssembler* masm) { static void StoreIC_PushArgs(MacroAssembler* masm) { - __ Push(StoreDescriptor::ReceiverRegister(), StoreDescriptor::NameRegister(), - StoreDescriptor::ValueRegister(), + __ Push(StoreWithVectorDescriptor::ValueRegister(), StoreWithVectorDescriptor::SlotRegister(), - StoreWithVectorDescriptor::VectorRegister()); + StoreWithVectorDescriptor::VectorRegister(), + StoreWithVectorDescriptor::ReceiverRegister(), + StoreWithVectorDescriptor::NameRegister()); } diff --git a/src/ic/arm64/ic-arm64.cc b/src/ic/arm64/ic-arm64.cc index 15fee7b88f..fa9d7c16b7 100644 --- a/src/ic/arm64/ic-arm64.cc +++ b/src/ic/arm64/ic-arm64.cc @@ -445,10 +445,11 @@ void KeyedLoadIC::GenerateMegamorphic(MacroAssembler* masm) { static void StoreIC_PushArgs(MacroAssembler* masm) { - __ Push(StoreDescriptor::ReceiverRegister(), StoreDescriptor::NameRegister(), - StoreDescriptor::ValueRegister(), + __ Push(StoreWithVectorDescriptor::ValueRegister(), StoreWithVectorDescriptor::SlotRegister(), - StoreWithVectorDescriptor::VectorRegister()); + StoreWithVectorDescriptor::VectorRegister(), + StoreWithVectorDescriptor::ReceiverRegister(), + StoreWithVectorDescriptor::NameRegister()); } diff --git a/src/ic/ia32/ic-ia32.cc b/src/ic/ia32/ic-ia32.cc index 545f714fa6..fcc2b89b26 100644 --- a/src/ic/ia32/ic-ia32.cc +++ b/src/ic/ia32/ic-ia32.cc @@ -711,12 +711,12 @@ static void StoreIC_PushArgs(MacroAssembler* masm) { Register slot = StoreWithVectorDescriptor::SlotRegister(); Register vector = StoreWithVectorDescriptor::VectorRegister(); - __ xchg(receiver, Operand(esp, 0)); - __ push(name); - __ push(value); + __ xchg(value, Operand(esp, 0)); __ push(slot); __ push(vector); - __ push(receiver); // Contains the return address. + __ push(receiver); + __ push(name); + __ push(value); // Contains the return address. } diff --git a/src/ic/ic.cc b/src/ic/ic.cc index 985f1da99c..012a188c9b 100644 --- a/src/ic/ic.cc +++ b/src/ic/ic.cc @@ -2404,11 +2404,11 @@ RUNTIME_FUNCTION(Runtime_StoreIC_Miss) { HandleScope scope(isolate); DCHECK_EQ(5, args.length()); // Runtime functions don't follow the IC's calling convention. - Handle receiver = args.at(0); - Handle key = args.at(1); - Handle value = args.at(2); - Handle slot = args.at(3); - Handle vector = args.at(4); + Handle value = args.at(0); + Handle slot = args.at(1); + Handle vector = args.at(2); + Handle receiver = args.at(3); + Handle key = args.at(4); FeedbackVectorSlot vector_slot = vector->ToSlot(slot->value()); if (vector->GetKind(vector_slot) == FeedbackVectorSlotKind::STORE_IC) { StoreICNexus nexus(vector, vector_slot); @@ -2460,11 +2460,11 @@ RUNTIME_FUNCTION(Runtime_KeyedStoreIC_Miss) { HandleScope scope(isolate); DCHECK_EQ(5, args.length()); // Runtime functions don't follow the IC's calling convention. - Handle receiver = args.at(0); - Handle key = args.at(1); - Handle value = args.at(2); - Handle slot = args.at(3); - Handle vector = args.at(4); + Handle value = args.at(0); + Handle slot = args.at(1); + Handle vector = args.at(2); + Handle receiver = args.at(3); + Handle key = args.at(4); FeedbackVectorSlot vector_slot = vector->ToSlot(slot->value()); KeyedStoreICNexus nexus(vector, vector_slot); KeyedStoreIC ic(IC::NO_EXTRA_FRAME, isolate, &nexus); @@ -2496,9 +2496,10 @@ RUNTIME_FUNCTION(Runtime_KeyedStoreIC_Slow) { HandleScope scope(isolate); DCHECK_EQ(5, args.length()); // Runtime functions don't follow the IC's calling convention. - Handle object = args.at(0); - Handle key = args.at(1); - Handle value = args.at(2); + Handle value = args.at(0); + // slot and vector parameters are not used. + Handle object = args.at(3); + Handle key = args.at(4); LanguageMode language_mode; KeyedStoreICNexus nexus(isolate); KeyedStoreIC ic(IC::NO_EXTRA_FRAME, isolate, &nexus); diff --git a/src/ic/mips/ic-mips.cc b/src/ic/mips/ic-mips.cc index bc4bc58a44..500a7d7d61 100644 --- a/src/ic/mips/ic-mips.cc +++ b/src/ic/mips/ic-mips.cc @@ -710,10 +710,11 @@ void KeyedStoreIC::GenerateMegamorphic(MacroAssembler* masm, static void StoreIC_PushArgs(MacroAssembler* masm) { - __ Push(StoreDescriptor::ReceiverRegister(), StoreDescriptor::NameRegister(), - StoreDescriptor::ValueRegister(), + __ Push(StoreWithVectorDescriptor::ValueRegister(), StoreWithVectorDescriptor::SlotRegister(), - StoreWithVectorDescriptor::VectorRegister()); + StoreWithVectorDescriptor::VectorRegister(), + StoreWithVectorDescriptor::ReceiverRegister(), + StoreWithVectorDescriptor::NameRegister()); } diff --git a/src/ic/mips64/ic-mips64.cc b/src/ic/mips64/ic-mips64.cc index d3406dd512..98a5c70811 100644 --- a/src/ic/mips64/ic-mips64.cc +++ b/src/ic/mips64/ic-mips64.cc @@ -714,10 +714,11 @@ void KeyedStoreIC::GenerateMegamorphic(MacroAssembler* masm, static void StoreIC_PushArgs(MacroAssembler* masm) { - __ Push(StoreDescriptor::ReceiverRegister(), StoreDescriptor::NameRegister(), - StoreDescriptor::ValueRegister(), + __ Push(StoreWithVectorDescriptor::ValueRegister(), StoreWithVectorDescriptor::SlotRegister(), - StoreWithVectorDescriptor::VectorRegister()); + StoreWithVectorDescriptor::VectorRegister(), + StoreWithVectorDescriptor::ReceiverRegister(), + StoreWithVectorDescriptor::NameRegister()); } diff --git a/src/ic/ppc/ic-ppc.cc b/src/ic/ppc/ic-ppc.cc index 7dc09ca856..6dd788146b 100644 --- a/src/ic/ppc/ic-ppc.cc +++ b/src/ic/ppc/ic-ppc.cc @@ -451,10 +451,11 @@ void KeyedLoadIC::GenerateMegamorphic(MacroAssembler* masm) { static void StoreIC_PushArgs(MacroAssembler* masm) { - __ Push(StoreDescriptor::ReceiverRegister(), StoreDescriptor::NameRegister(), - StoreDescriptor::ValueRegister(), + __ Push(StoreWithVectorDescriptor::ValueRegister(), StoreWithVectorDescriptor::SlotRegister(), - StoreWithVectorDescriptor::VectorRegister()); + StoreWithVectorDescriptor::VectorRegister(), + StoreWithVectorDescriptor::ReceiverRegister(), + StoreWithVectorDescriptor::NameRegister()); } diff --git a/src/ic/s390/ic-s390.cc b/src/ic/s390/ic-s390.cc index 7bb45b13d4..08eb3e4ff1 100644 --- a/src/ic/s390/ic-s390.cc +++ b/src/ic/s390/ic-s390.cc @@ -437,10 +437,11 @@ void KeyedLoadIC::GenerateMegamorphic(MacroAssembler* masm) { } static void StoreIC_PushArgs(MacroAssembler* masm) { - __ Push(StoreDescriptor::ReceiverRegister(), StoreDescriptor::NameRegister(), - StoreDescriptor::ValueRegister(), + __ Push(StoreWithVectorDescriptor::ValueRegister(), StoreWithVectorDescriptor::SlotRegister(), - StoreWithVectorDescriptor::VectorRegister()); + StoreWithVectorDescriptor::VectorRegister(), + StoreWithVectorDescriptor::ReceiverRegister(), + StoreWithVectorDescriptor::NameRegister()); } void KeyedStoreIC::GenerateMiss(MacroAssembler* masm) { diff --git a/src/ic/x64/ic-x64.cc b/src/ic/x64/ic-x64.cc index 61c2cb4ec0..d0445a229a 100644 --- a/src/ic/x64/ic-x64.cc +++ b/src/ic/x64/ic-x64.cc @@ -706,21 +706,20 @@ void KeyedLoadIC::GenerateRuntimeGetProperty(MacroAssembler* masm) { } static void StoreIC_PushArgs(MacroAssembler* masm) { - Register receiver = StoreDescriptor::ReceiverRegister(); - Register name = StoreDescriptor::NameRegister(); - Register value = StoreDescriptor::ValueRegister(); - Register temp = r11; - DCHECK(!temp.is(receiver) && !temp.is(name) && !temp.is(value)); - - __ PopReturnAddressTo(temp); - __ Push(receiver); - __ Push(name); - __ Push(value); + Register receiver = StoreWithVectorDescriptor::ReceiverRegister(); + Register name = StoreWithVectorDescriptor::NameRegister(); + Register value = StoreWithVectorDescriptor::ValueRegister(); Register slot = StoreWithVectorDescriptor::SlotRegister(); Register vector = StoreWithVectorDescriptor::VectorRegister(); - DCHECK(!temp.is(slot) && !temp.is(vector)); + Register temp = r11; + DCHECK(!AreAliased(receiver, name, value, slot, vector, temp)); + + __ PopReturnAddressTo(temp); + __ Push(value); __ Push(slot); __ Push(vector); + __ Push(receiver); + __ Push(name); __ PushReturnAddressFrom(temp); } diff --git a/src/ic/x87/ic-x87.cc b/src/ic/x87/ic-x87.cc index bd699c0ad7..e2bb275f6b 100644 --- a/src/ic/x87/ic-x87.cc +++ b/src/ic/x87/ic-x87.cc @@ -711,12 +711,12 @@ static void StoreIC_PushArgs(MacroAssembler* masm) { Register slot = StoreWithVectorDescriptor::SlotRegister(); Register vector = StoreWithVectorDescriptor::VectorRegister(); - __ xchg(receiver, Operand(esp, 0)); - __ push(name); - __ push(value); + __ xchg(value, Operand(esp, 0)); __ push(slot); __ push(vector); - __ push(receiver); // Contains the return address. + __ push(receiver); + __ push(name); + __ push(value); // Contains the return address. }