From: akos.palfi@imgtec.com Date: Tue, 15 Jul 2014 19:00:02 +0000 (+0000) Subject: MIPS: Drop unnecessary receiver validity checks from {Load,Store}IC_Normal. X-Git-Tag: upstream/4.7.83~8213 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1578cfee1da4fccb54377cb61c9b74c7da46d63c;p=platform%2Fupstream%2Fv8.git MIPS: Drop unnecessary receiver validity checks from {Load,Store}IC_Normal. Port r22391 (fe86010) Original commit message: Since these builtins are used as handlers after a map check/dispatch, they don't need to check the receiver again. BUG= R=akos.palfi@imgtec.com Review URL: https://codereview.chromium.org/396663004 Patch from Balazs Kilvady . git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@22411 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- diff --git a/src/mips/ic-mips.cc b/src/mips/ic-mips.cc index 4683502..23ad6de 100644 --- a/src/mips/ic-mips.cc +++ b/src/mips/ic-mips.cc @@ -36,47 +36,6 @@ static void GenerateGlobalInstanceTypeCheck(MacroAssembler* masm, } -// Generated code falls through if the receiver is a regular non-global -// JS object with slow properties and no interceptors. -static void GenerateNameDictionaryReceiverCheck(MacroAssembler* masm, - Register receiver, - Register elements, - Register scratch0, - Register scratch1, - Label* miss) { - // Register usage: - // receiver: holds the receiver on entry and is unchanged. - // elements: holds the property dictionary on fall through. - // Scratch registers: - // scratch0: used to holds the receiver map. - // scratch1: used to holds the receiver instance type, receiver bit mask - // and elements map. - - // Check that the receiver isn't a smi. - __ JumpIfSmi(receiver, miss); - - // Check that the receiver is a valid JS object. - __ GetObjectType(receiver, scratch0, scratch1); - __ Branch(miss, lt, scratch1, Operand(FIRST_SPEC_OBJECT_TYPE)); - - // If this assert fails, we have to check upper bound too. - STATIC_ASSERT(LAST_TYPE == LAST_SPEC_OBJECT_TYPE); - - GenerateGlobalInstanceTypeCheck(masm, scratch1, miss); - - // Check that the global object does not require access checks. - __ lbu(scratch1, FieldMemOperand(scratch0, Map::kBitFieldOffset)); - __ And(scratch1, scratch1, Operand((1 << Map::kIsAccessCheckNeeded) | - (1 << Map::kHasNamedInterceptor))); - __ Branch(miss, ne, scratch1, Operand(zero_reg)); - - __ lw(elements, FieldMemOperand(receiver, JSObject::kPropertiesOffset)); - __ lw(scratch1, FieldMemOperand(elements, HeapObject::kMapOffset)); - __ LoadRoot(scratch0, Heap::kHashTableMapRootIndex); - __ Branch(miss, ne, scratch1, Operand(scratch0)); -} - - // Helper function used from LoadIC GenerateNormal. // // elements: Property dictionary. It is not clobbered if a jump to the miss @@ -334,29 +293,20 @@ void LoadIC::GenerateMegamorphic(MacroAssembler* masm) { void LoadIC::GenerateNormal(MacroAssembler* masm) { - // ----------- S t a t e ------------- - // -- a2 : name - // -- lr : return address - // -- a1 : receiver - // ----------------------------------- - ASSERT(a1.is(ReceiverRegister())); - ASSERT(a2.is(NameRegister())); - - Label miss, slow; + Register dictionary = a0; + ASSERT(!dictionary.is(ReceiverRegister())); + ASSERT(!dictionary.is(NameRegister())); - GenerateNameDictionaryReceiverCheck(masm, a1, a0, a3, t0, &miss); + Label slow; - // a0: elements - GenerateDictionaryLoad(masm, &slow, a0, a2, v0, a3, t0); + __ lw(dictionary, + FieldMemOperand(ReceiverRegister(), JSObject::kPropertiesOffset)); + GenerateDictionaryLoad(masm, &slow, dictionary, NameRegister(), v0, a3, t0); __ Ret(); // Dictionary load failed, go slow (but don't miss). __ bind(&slow); GenerateRuntimeGetProperty(masm); - - // Cache miss: Jump to runtime. - __ bind(&miss); - GenerateMiss(masm); } @@ -1178,13 +1128,14 @@ void StoreIC::GenerateNormal(MacroAssembler* masm) { Register receiver = ReceiverRegister(); Register name = NameRegister(); Register value = ValueRegister(); + Register dictionary = a3; ASSERT(receiver.is(a1)); ASSERT(name.is(a2)); ASSERT(value.is(a0)); - GenerateNameDictionaryReceiverCheck(masm, receiver, a3, t0, t1, &miss); + __ lw(dictionary, FieldMemOperand(receiver, JSObject::kPropertiesOffset)); - GenerateDictionaryStore(masm, &miss, a3, name, value, t0, t1); + GenerateDictionaryStore(masm, &miss, dictionary, name, value, t0, t1); Counters* counters = masm->isolate()->counters(); __ IncrementCounter(counters->store_normal_hit(), 1, t0, t1); __ Ret(); diff --git a/src/mips64/ic-mips64.cc b/src/mips64/ic-mips64.cc index 1a13365..17241d6 100644 --- a/src/mips64/ic-mips64.cc +++ b/src/mips64/ic-mips64.cc @@ -36,47 +36,6 @@ static void GenerateGlobalInstanceTypeCheck(MacroAssembler* masm, } -// Generated code falls through if the receiver is a regular non-global -// JS object with slow properties and no interceptors. -static void GenerateNameDictionaryReceiverCheck(MacroAssembler* masm, - Register receiver, - Register elements, - Register scratch0, - Register scratch1, - Label* miss) { - // Register usage: - // receiver: holds the receiver on entry and is unchanged. - // elements: holds the property dictionary on fall through. - // Scratch registers: - // scratch0: used to holds the receiver map. - // scratch1: used to holds the receiver instance type, receiver bit mask - // and elements map. - - // Check that the receiver isn't a smi. - __ JumpIfSmi(receiver, miss); - - // Check that the receiver is a valid JS object. - __ GetObjectType(receiver, scratch0, scratch1); - __ Branch(miss, lt, scratch1, Operand(FIRST_SPEC_OBJECT_TYPE)); - - // If this assert fails, we have to check upper bound too. - STATIC_ASSERT(LAST_TYPE == LAST_SPEC_OBJECT_TYPE); - - GenerateGlobalInstanceTypeCheck(masm, scratch1, miss); - - // Check that the global object does not require access checks. - __ lbu(scratch1, FieldMemOperand(scratch0, Map::kBitFieldOffset)); - __ And(scratch1, scratch1, Operand((1 << Map::kIsAccessCheckNeeded) | - (1 << Map::kHasNamedInterceptor))); - __ Branch(miss, ne, scratch1, Operand(zero_reg)); - - __ ld(elements, FieldMemOperand(receiver, JSObject::kPropertiesOffset)); - __ ld(scratch1, FieldMemOperand(elements, HeapObject::kMapOffset)); - __ LoadRoot(scratch0, Heap::kHashTableMapRootIndex); - __ Branch(miss, ne, scratch1, Operand(scratch0)); -} - - // Helper function used from LoadIC GenerateNormal. // // elements: Property dictionary. It is not clobbered if a jump to the miss @@ -334,29 +293,19 @@ void LoadIC::GenerateMegamorphic(MacroAssembler* masm) { void LoadIC::GenerateNormal(MacroAssembler* masm) { - // ----------- S t a t e ------------- - // -- a2 : name - // -- lr : return address - // -- a1 : receiver - // ----------------------------------- - ASSERT(a1.is(ReceiverRegister())); - ASSERT(a2.is(NameRegister())); - - Label miss, slow; - - GenerateNameDictionaryReceiverCheck(masm, a1, a0, a3, a4, &miss); + Register dictionary = a0; + ASSERT(!dictionary.is(ReceiverRegister())); + ASSERT(!dictionary.is(NameRegister())); + Label slow; - // a0: elements - GenerateDictionaryLoad(masm, &slow, a0, a2, v0, a3, a4); + __ ld(dictionary, + FieldMemOperand(ReceiverRegister(), JSObject::kPropertiesOffset)); + GenerateDictionaryLoad(masm, &slow, dictionary, NameRegister(), v0, a3, a4); __ Ret(); // Dictionary load failed, go slow (but don't miss). __ bind(&slow); GenerateRuntimeGetProperty(masm); - - // Cache miss: Jump to runtime. - __ bind(&miss); - GenerateMiss(masm); } @@ -1188,11 +1137,10 @@ void StoreIC::GenerateNormal(MacroAssembler* masm) { Register receiver = ReceiverRegister(); Register name = NameRegister(); Register value = ValueRegister(); - ASSERT(receiver.is(a1)); - ASSERT(name.is(a2)); - ASSERT(value.is(a0)); + Register dictionary = a3; + ASSERT(!AreAliased(value, receiver, name, dictionary, a4, a5)); - GenerateNameDictionaryReceiverCheck(masm, receiver, a3, a4, a5, &miss); + __ ld(dictionary, FieldMemOperand(receiver, JSObject::kPropertiesOffset)); GenerateDictionaryStore(masm, &miss, a3, name, value, a4, a5); Counters* counters = masm->isolate()->counters();