From: verwaest@chromium.org Date: Mon, 25 Aug 2014 11:20:43 +0000 (+0000) Subject: Move "slow handler" compiler code to handler-compiler X-Git-Tag: upstream/4.7.83~7421 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e6995a01f45b076d4cefcb4d7c0bab4fa0e1c9a4;p=platform%2Fupstream%2Fv8.git Move "slow handler" compiler code to handler-compiler BUG= R=yangguo@chromium.org Review URL: https://codereview.chromium.org/496283004 git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@23347 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- diff --git a/src/builtins.cc b/src/builtins.cc index f0f6290..7c64f65 100644 --- a/src/builtins.cc +++ b/src/builtins.cc @@ -1298,11 +1298,6 @@ static void Generate_KeyedLoadIC_SloppyArguments(MacroAssembler* masm) { } -static void Generate_StoreIC_Slow(MacroAssembler* masm) { - StoreIC::GenerateSlow(masm); -} - - static void Generate_StoreIC_Miss(MacroAssembler* masm) { StoreIC::GenerateMiss(masm); } @@ -1313,6 +1308,16 @@ static void Generate_StoreIC_Normal(MacroAssembler* masm) { } +static void Generate_StoreIC_Slow(MacroAssembler* masm) { + NamedStoreHandlerCompiler::GenerateSlow(masm); +} + + +static void Generate_KeyedStoreIC_Slow(MacroAssembler* masm) { + ElementHandlerCompiler::GenerateStoreSlow(masm); +} + + static void Generate_StoreIC_Setter_ForDeopt(MacroAssembler* masm) { NamedStoreHandlerCompiler::GenerateStoreViaSetterForDeopt(masm); } @@ -1333,11 +1338,6 @@ static void Generate_KeyedStoreIC_Miss(MacroAssembler* masm) { } -static void Generate_KeyedStoreIC_Slow(MacroAssembler* masm) { - KeyedStoreIC::GenerateSlow(masm); -} - - static void Generate_KeyedStoreIC_Initialize(MacroAssembler* masm) { KeyedStoreIC::GenerateInitialize(masm); } diff --git a/src/code-stubs.cc b/src/code-stubs.cc index 20bbb47..223f7e3 100644 --- a/src/code-stubs.cc +++ b/src/code-stubs.cc @@ -690,7 +690,7 @@ void StoreElementStub::Generate(MacroAssembler* masm) { UNREACHABLE(); break; case DICTIONARY_ELEMENTS: - ElementHandlerCompiler::GenerateStoreDictionaryElement(masm); + ElementHandlerCompiler::GenerateStoreSlow(masm); break; case SLOPPY_ARGUMENTS_ELEMENTS: UNREACHABLE(); diff --git a/src/ic/arm/handler-compiler-arm.cc b/src/ic/arm/handler-compiler-arm.cc index bdb701c..7722af6 100644 --- a/src/ic/arm/handler-compiler-arm.cc +++ b/src/ic/arm/handler-compiler-arm.cc @@ -314,6 +314,32 @@ void ElementHandlerCompiler::GenerateLoadDictionaryElement( } +void NamedStoreHandlerCompiler::GenerateSlow(MacroAssembler* masm) { + // Push receiver, key and value for runtime call. + __ Push(StoreIC::ReceiverRegister(), StoreIC::NameRegister(), + StoreIC::ValueRegister()); + + // The slow case calls into the runtime to complete the store without causing + // an IC miss that would otherwise cause a transition to the generic stub. + ExternalReference ref = + ExternalReference(IC_Utility(IC::kStoreIC_Slow), masm->isolate()); + __ TailCallExternalReference(ref, 3, 1); +} + + +void ElementHandlerCompiler::GenerateStoreSlow(MacroAssembler* masm) { + // Push receiver, key and value for runtime call. + __ Push(StoreIC::ReceiverRegister(), StoreIC::NameRegister(), + StoreIC::ValueRegister()); + + // The slow case calls into the runtime to complete the store without causing + // an IC miss that would otherwise cause a transition to the generic stub. + ExternalReference ref = + ExternalReference(IC_Utility(IC::kKeyedStoreIC_Slow), masm->isolate()); + __ TailCallExternalReference(ref, 3, 1); +} + + #undef __ #define __ ACCESS_MASM(masm()) diff --git a/src/ic/arm/ic-arm.cc b/src/ic/arm/ic-arm.cc index 9c6b894..57bd5a4 100644 --- a/src/ic/arm/ic-arm.cc +++ b/src/ic/arm/ic-arm.cc @@ -733,30 +733,6 @@ void KeyedStoreIC::GenerateMiss(MacroAssembler* masm) { } -void StoreIC::GenerateSlow(MacroAssembler* masm) { - // Push receiver, key and value for runtime call. - __ Push(ReceiverRegister(), NameRegister(), ValueRegister()); - - // The slow case calls into the runtime to complete the store without causing - // an IC miss that would otherwise cause a transition to the generic stub. - ExternalReference ref = - ExternalReference(IC_Utility(kStoreIC_Slow), masm->isolate()); - __ TailCallExternalReference(ref, 3, 1); -} - - -void KeyedStoreIC::GenerateSlow(MacroAssembler* masm) { - // Push receiver, key and value for runtime call. - __ Push(ReceiverRegister(), NameRegister(), ValueRegister()); - - // The slow case calls into the runtime to complete the store without causing - // an IC miss that would otherwise cause a transition to the generic stub. - ExternalReference ref = - ExternalReference(IC_Utility(kKeyedStoreIC_Slow), masm->isolate()); - __ TailCallExternalReference(ref, 3, 1); -} - - static void KeyedStoreGenerateGenericHelper( MacroAssembler* masm, Label* fast_object, Label* fast_double, Label* slow, KeyedStoreCheckMap check_map, KeyedStoreIncrementLength increment_length, diff --git a/src/ic/arm64/handler-compiler-arm64.cc b/src/ic/arm64/handler-compiler-arm64.cc index e0678db..a5d0bb4 100644 --- a/src/ic/arm64/handler-compiler-arm64.cc +++ b/src/ic/arm64/handler-compiler-arm64.cc @@ -306,6 +306,34 @@ void ElementHandlerCompiler::GenerateLoadDictionaryElement( } +void NamedStoreHandlerCompiler::GenerateSlow(MacroAssembler* masm) { + // Push receiver, name and value for runtime call. + __ Push(StoreIC::ReceiverRegister(), StoreIC::NameRegister(), + StoreIC::ValueRegister()); + + // The slow case calls into the runtime to complete the store without causing + // an IC miss that would otherwise cause a transition to the generic stub. + ExternalReference ref = + ExternalReference(IC_Utility(IC::kStoreIC_Slow), masm->isolate()); + __ TailCallExternalReference(ref, 3, 1); +} + + +void ElementHandlerCompiler::GenerateStoreSlow(MacroAssembler* masm) { + ASM_LOCATION("ElementHandlerCompiler::GenerateStoreSlow"); + + // Push receiver, key and value for runtime call. + __ Push(StoreIC::ReceiverRegister(), StoreIC::NameRegister(), + StoreIC::ValueRegister()); + + // The slow case calls into the runtime to complete the store without causing + // an IC miss that would otherwise cause a transition to the generic stub. + ExternalReference ref = + ExternalReference(IC_Utility(IC::kKeyedStoreIC_Slow), masm->isolate()); + __ TailCallExternalReference(ref, 3, 1); +} + + #undef __ #define __ ACCESS_MASM(masm()) diff --git a/src/ic/arm64/ic-arm64.cc b/src/ic/arm64/ic-arm64.cc index bffa603..6985ea5 100644 --- a/src/ic/arm64/ic-arm64.cc +++ b/src/ic/arm64/ic-arm64.cc @@ -775,20 +775,6 @@ void KeyedStoreIC::GenerateMiss(MacroAssembler* masm) { } -void KeyedStoreIC::GenerateSlow(MacroAssembler* masm) { - ASM_LOCATION("KeyedStoreIC::GenerateSlow"); - - // Push receiver, key and value for runtime call. - __ Push(ReceiverRegister(), NameRegister(), ValueRegister()); - - // The slow case calls into the runtime to complete the store without causing - // an IC miss that would otherwise cause a transition to the generic stub. - ExternalReference ref = - ExternalReference(IC_Utility(kKeyedStoreIC_Slow), masm->isolate()); - __ TailCallExternalReference(ref, 3, 1); -} - - static void KeyedStoreGenerateGenericHelper( MacroAssembler* masm, Label* fast_object, Label* fast_double, Label* slow, KeyedStoreCheckMap check_map, KeyedStoreIncrementLength increment_length, @@ -1069,25 +1055,6 @@ void StoreIC::GenerateNormal(MacroAssembler* masm) { } -void StoreIC::GenerateSlow(MacroAssembler* masm) { - // ---------- S t a t e -------------- - // -- x0 : value - // -- x1 : receiver - // -- x2 : name - // -- lr : return address - // ----------------------------------- - - // Push receiver, name and value for runtime call. - __ Push(ReceiverRegister(), NameRegister(), ValueRegister()); - - // The slow case calls into the runtime to complete the store without causing - // an IC miss that would otherwise cause a transition to the generic stub. - ExternalReference ref = - ExternalReference(IC_Utility(kStoreIC_Slow), masm->isolate()); - __ TailCallExternalReference(ref, 3, 1); -} - - Condition CompareIC::ComputeCondition(Token::Value op) { switch (op) { case Token::EQ_STRICT: diff --git a/src/ic/handler-compiler.cc b/src/ic/handler-compiler.cc index bbc5cd1..5c747c1 100644 --- a/src/ic/handler-compiler.cc +++ b/src/ic/handler-compiler.cc @@ -388,11 +388,5 @@ void ElementHandlerCompiler::CompileElementHandlers( handlers->Add(cached_stub); } } - - -void ElementHandlerCompiler::GenerateStoreDictionaryElement( - MacroAssembler* masm) { - KeyedStoreIC::GenerateSlow(masm); -} } } // namespace v8::internal diff --git a/src/ic/handler-compiler.h b/src/ic/handler-compiler.h index f82e4cc..af54e2c 100644 --- a/src/ic/handler-compiler.h +++ b/src/ic/handler-compiler.h @@ -221,6 +221,8 @@ class NamedStoreHandlerCompiler : public PropertyHandlerCompiler { Handle()); } + static void GenerateSlow(MacroAssembler* masm); + protected: virtual Register FrontendHeader(Register object_reg, Handle name, Label* miss); @@ -267,7 +269,7 @@ class ElementHandlerCompiler : public PropertyHandlerCompiler { CodeHandleList* handlers); static void GenerateLoadDictionaryElement(MacroAssembler* masm); - static void GenerateStoreDictionaryElement(MacroAssembler* masm); + static void GenerateStoreSlow(MacroAssembler* masm); }; } } // namespace v8::internal diff --git a/src/ic/ia32/handler-compiler-ia32.cc b/src/ic/ia32/handler-compiler-ia32.cc index 0db5485..48b8adc 100644 --- a/src/ic/ia32/handler-compiler-ia32.cc +++ b/src/ic/ia32/handler-compiler-ia32.cc @@ -326,6 +326,41 @@ static void CompileCallLoadPropertyWithInterceptor( } +static void StoreIC_PushArgs(MacroAssembler* masm) { + Register receiver = StoreIC::ReceiverRegister(); + Register name = StoreIC::NameRegister(); + Register value = StoreIC::ValueRegister(); + + DCHECK(!ebx.is(receiver) && !ebx.is(name) && !ebx.is(value)); + + __ pop(ebx); + __ push(receiver); + __ push(name); + __ push(value); + __ push(ebx); +} + + +void NamedStoreHandlerCompiler::GenerateSlow(MacroAssembler* masm) { + // Return address is on the stack. + StoreIC_PushArgs(masm); + + // Do tail-call to runtime routine. + ExternalReference ref(IC_Utility(IC::kStoreIC_Slow), masm->isolate()); + __ TailCallExternalReference(ref, 3, 1); +} + + +void ElementHandlerCompiler::GenerateStoreSlow(MacroAssembler* masm) { + // Return address is on the stack. + StoreIC_PushArgs(masm); + + // Do tail-call to runtime routine. + ExternalReference ref(IC_Utility(IC::kKeyedStoreIC_Slow), masm->isolate()); + __ TailCallExternalReference(ref, 3, 1); +} + + #undef __ #define __ ACCESS_MASM(masm()) diff --git a/src/ic/ia32/ic-ia32.cc b/src/ic/ia32/ic-ia32.cc index 4dd1a93..5f13078 100644 --- a/src/ic/ia32/ic-ia32.cc +++ b/src/ic/ia32/ic-ia32.cc @@ -1018,26 +1018,6 @@ void KeyedStoreIC::GenerateMiss(MacroAssembler* masm) { } -void StoreIC::GenerateSlow(MacroAssembler* masm) { - // Return address is on the stack. - StoreIC_PushArgs(masm); - - // Do tail-call to runtime routine. - ExternalReference ref(IC_Utility(kStoreIC_Slow), masm->isolate()); - __ TailCallExternalReference(ref, 3, 1); -} - - -void KeyedStoreIC::GenerateSlow(MacroAssembler* masm) { - // Return address is on the stack. - StoreIC_PushArgs(masm); - - // Do tail-call to runtime routine. - ExternalReference ref(IC_Utility(kKeyedStoreIC_Slow), masm->isolate()); - __ TailCallExternalReference(ref, 3, 1); -} - - #undef __ diff --git a/src/ic/x64/handler-compiler-x64.cc b/src/ic/x64/handler-compiler-x64.cc index 0117a96..d332bb4 100644 --- a/src/ic/x64/handler-compiler-x64.cc +++ b/src/ic/x64/handler-compiler-x64.cc @@ -8,6 +8,7 @@ #include "src/ic/call-optimization.h" #include "src/ic/handler-compiler.h" +#include "src/ic/ic.h" namespace v8 { namespace internal { @@ -319,6 +320,41 @@ void ElementHandlerCompiler::GenerateLoadDictionaryElement( } +static void StoreIC_PushArgs(MacroAssembler* masm) { + Register receiver = StoreIC::ReceiverRegister(); + Register name = StoreIC::NameRegister(); + Register value = StoreIC::ValueRegister(); + + DCHECK(!rbx.is(receiver) && !rbx.is(name) && !rbx.is(value)); + + __ PopReturnAddressTo(rbx); + __ Push(receiver); + __ Push(name); + __ Push(value); + __ PushReturnAddressFrom(rbx); +} + + +void NamedStoreHandlerCompiler::GenerateSlow(MacroAssembler* masm) { + // Return address is on the stack. + StoreIC_PushArgs(masm); + + // Do tail-call to runtime routine. + ExternalReference ref(IC_Utility(IC::kStoreIC_Slow), masm->isolate()); + __ TailCallExternalReference(ref, 3, 1); +} + + +void ElementHandlerCompiler::GenerateStoreSlow(MacroAssembler* masm) { + // Return address is on the stack. + StoreIC_PushArgs(masm); + + // Do tail-call to runtime routine. + ExternalReference ref(IC_Utility(IC::kKeyedStoreIC_Slow), masm->isolate()); + __ TailCallExternalReference(ref, 3, 1); +} + + #undef __ #define __ ACCESS_MASM((masm())) diff --git a/src/ic/x64/ic-x64.cc b/src/ic/x64/ic-x64.cc index 1abb931..7516882 100644 --- a/src/ic/x64/ic-x64.cc +++ b/src/ic/x64/ic-x64.cc @@ -1012,26 +1012,6 @@ void StoreIC::GenerateNormal(MacroAssembler* masm) { } -void StoreIC::GenerateSlow(MacroAssembler* masm) { - // Return address is on the stack. - StoreIC_PushArgs(masm); - - // Do tail-call to runtime routine. - ExternalReference ref(IC_Utility(kStoreIC_Slow), masm->isolate()); - __ TailCallExternalReference(ref, 3, 1); -} - - -void KeyedStoreIC::GenerateSlow(MacroAssembler* masm) { - // Return address is on the stack. - StoreIC_PushArgs(masm); - - // Do tail-call to runtime routine. - ExternalReference ref(IC_Utility(kKeyedStoreIC_Slow), masm->isolate()); - __ TailCallExternalReference(ref, 3, 1); -} - - void KeyedStoreIC::GenerateMiss(MacroAssembler* masm) { // Return address is on the stack. StoreIC_PushArgs(masm);