Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(185)

Side by Side Diff: src/ic/arm/ic-arm.cc

Issue 584043002: Add MEGAMORPHIC state support for KeyedStoreIC (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: rebased for landing Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/builtins.cc ('k') | src/ic/arm64/ic-arm64.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #if V8_TARGET_ARCH_ARM 7 #if V8_TARGET_ARCH_ARM
8 8
9 #include "src/codegen.h" 9 #include "src/codegen.h"
10 #include "src/ic/ic.h" 10 #include "src/ic/ic.h"
(...skipping 747 matching lines...) Expand 10 before | Expand all | Expand 10 after
758 __ LoadTransitionedArrayMapConditional(FAST_DOUBLE_ELEMENTS, FAST_ELEMENTS, 758 __ LoadTransitionedArrayMapConditional(FAST_DOUBLE_ELEMENTS, FAST_ELEMENTS,
759 receiver_map, r4, slow); 759 receiver_map, r4, slow);
760 mode = AllocationSite::GetMode(FAST_DOUBLE_ELEMENTS, FAST_ELEMENTS); 760 mode = AllocationSite::GetMode(FAST_DOUBLE_ELEMENTS, FAST_ELEMENTS);
761 ElementsTransitionGenerator::GenerateDoubleToObject( 761 ElementsTransitionGenerator::GenerateDoubleToObject(
762 masm, receiver, key, value, receiver_map, mode, slow); 762 masm, receiver, key, value, receiver_map, mode, slow);
763 __ ldr(elements, FieldMemOperand(receiver, JSObject::kElementsOffset)); 763 __ ldr(elements, FieldMemOperand(receiver, JSObject::kElementsOffset));
764 __ jmp(&finish_object_store); 764 __ jmp(&finish_object_store);
765 } 765 }
766 766
767 767
768 void KeyedStoreIC::GenerateGeneric(MacroAssembler* masm, 768 void KeyedStoreIC::GenerateGeneric(
769 StrictMode strict_mode) { 769 MacroAssembler* masm, StrictMode strict_mode,
770 KeyedStoreStubCacheRequirement handler_requirement) {
770 // ---------- S t a t e -------------- 771 // ---------- S t a t e --------------
771 // -- r0 : value 772 // -- r0 : value
772 // -- r1 : key 773 // -- r1 : key
773 // -- r2 : receiver 774 // -- r2 : receiver
774 // -- lr : return address 775 // -- lr : return address
775 // ----------------------------------- 776 // -----------------------------------
776 Label slow, fast_object, fast_object_grow; 777 Label slow, fast_object, fast_object_grow;
777 Label fast_double, fast_double_grow; 778 Label fast_double, fast_double_grow;
778 Label array, extra, check_if_double_array; 779 Label array, extra, check_if_double_array, maybe_name_key, miss;
779 780
780 // Register usage. 781 // Register usage.
781 Register value = StoreDescriptor::ValueRegister(); 782 Register value = StoreDescriptor::ValueRegister();
782 Register key = StoreDescriptor::NameRegister(); 783 Register key = StoreDescriptor::NameRegister();
783 Register receiver = StoreDescriptor::ReceiverRegister(); 784 Register receiver = StoreDescriptor::ReceiverRegister();
784 DCHECK(receiver.is(r1)); 785 DCHECK(receiver.is(r1));
785 DCHECK(key.is(r2)); 786 DCHECK(key.is(r2));
786 DCHECK(value.is(r0)); 787 DCHECK(value.is(r0));
787 Register receiver_map = r3; 788 Register receiver_map = r3;
788 Register elements_map = r6; 789 Register elements_map = r6;
789 Register elements = r9; // Elements array of the receiver. 790 Register elements = r9; // Elements array of the receiver.
790 // r4 and r5 are used as general scratch registers. 791 // r4 and r5 are used as general scratch registers.
791 792
792 // Check that the key is a smi. 793 // Check that the key is a smi.
793 __ JumpIfNotSmi(key, &slow); 794 __ JumpIfNotSmi(key, &maybe_name_key);
794 // Check that the object isn't a smi. 795 // Check that the object isn't a smi.
795 __ JumpIfSmi(receiver, &slow); 796 __ JumpIfSmi(receiver, &slow);
796 // Get the map of the object. 797 // Get the map of the object.
797 __ ldr(receiver_map, FieldMemOperand(receiver, HeapObject::kMapOffset)); 798 __ ldr(receiver_map, FieldMemOperand(receiver, HeapObject::kMapOffset));
798 // Check that the receiver does not require access checks and is not observed. 799 // Check that the receiver does not require access checks and is not observed.
799 // The generic stub does not perform map checks or handle observed objects. 800 // The generic stub does not perform map checks or handle observed objects.
800 __ ldrb(ip, FieldMemOperand(receiver_map, Map::kBitFieldOffset)); 801 __ ldrb(ip, FieldMemOperand(receiver_map, Map::kBitFieldOffset));
801 __ tst(ip, Operand(1 << Map::kIsAccessCheckNeeded | 1 << Map::kIsObserved)); 802 __ tst(ip, Operand(1 << Map::kIsAccessCheckNeeded | 1 << Map::kIsObserved));
802 __ b(ne, &slow); 803 __ b(ne, &slow);
803 // Check if the object is a JS array or not. 804 // Check if the object is a JS array or not.
(...skipping 11 matching lines...) Expand all
815 __ cmp(key, Operand(ip)); 816 __ cmp(key, Operand(ip));
816 __ b(lo, &fast_object); 817 __ b(lo, &fast_object);
817 818
818 // Slow case, handle jump to runtime. 819 // Slow case, handle jump to runtime.
819 __ bind(&slow); 820 __ bind(&slow);
820 // Entry registers are intact. 821 // Entry registers are intact.
821 // r0: value. 822 // r0: value.
822 // r1: key. 823 // r1: key.
823 // r2: receiver. 824 // r2: receiver.
824 PropertyICCompiler::GenerateRuntimeSetProperty(masm, strict_mode); 825 PropertyICCompiler::GenerateRuntimeSetProperty(masm, strict_mode);
826 // Never returns to here.
827
828 __ bind(&maybe_name_key);
829 __ ldr(r4, FieldMemOperand(key, HeapObject::kMapOffset));
830 __ ldrb(r4, FieldMemOperand(r4, Map::kInstanceTypeOffset));
831 __ JumpIfNotUniqueNameInstanceType(r4, &slow);
832 Code::Flags flags = Code::RemoveTypeAndHolderFromFlags(
833 Code::ComputeHandlerFlags(Code::STORE_IC));
834 masm->isolate()->stub_cache()->GenerateProbe(masm, flags, false, receiver,
835 key, r3, r4, r5, r6);
836 // Cache miss.
837 if (handler_requirement == kCallRuntimeOnMissingHandler) {
838 __ b(&slow);
839 } else {
840 DCHECK(handler_requirement == kMissOnMissingHandler);
841 __ b(&miss);
842 }
825 843
826 // Extra capacity case: Check if there is extra capacity to 844 // Extra capacity case: Check if there is extra capacity to
827 // perform the store and update the length. Used for adding one 845 // perform the store and update the length. Used for adding one
828 // element to the array by writing to array[array.length]. 846 // element to the array by writing to array[array.length].
829 __ bind(&extra); 847 __ bind(&extra);
830 // Condition code from comparing key and array length is still available. 848 // Condition code from comparing key and array length is still available.
831 __ b(ne, &slow); // Only support writing to writing to array[array.length]. 849 __ b(ne, &slow); // Only support writing to writing to array[array.length].
832 // Check for room in the elements backing store. 850 // Check for room in the elements backing store.
833 // Both the key and the length of FixedArray are smis. 851 // Both the key and the length of FixedArray are smis.
834 __ ldr(ip, FieldMemOperand(elements, FixedArray::kLengthOffset)); 852 __ ldr(ip, FieldMemOperand(elements, FixedArray::kLengthOffset));
(...skipping 21 matching lines...) Expand all
856 __ cmp(key, Operand(ip)); 874 __ cmp(key, Operand(ip));
857 __ b(hs, &extra); 875 __ b(hs, &extra);
858 876
859 KeyedStoreGenerateGenericHelper( 877 KeyedStoreGenerateGenericHelper(
860 masm, &fast_object, &fast_double, &slow, kCheckMap, kDontIncrementLength, 878 masm, &fast_object, &fast_double, &slow, kCheckMap, kDontIncrementLength,
861 value, key, receiver, receiver_map, elements_map, elements); 879 value, key, receiver, receiver_map, elements_map, elements);
862 KeyedStoreGenerateGenericHelper(masm, &fast_object_grow, &fast_double_grow, 880 KeyedStoreGenerateGenericHelper(masm, &fast_object_grow, &fast_double_grow,
863 &slow, kDontCheckMap, kIncrementLength, value, 881 &slow, kDontCheckMap, kIncrementLength, value,
864 key, receiver, receiver_map, elements_map, 882 key, receiver, receiver_map, elements_map,
865 elements); 883 elements);
884
885 __ bind(&miss);
886 GenerateMiss(masm);
866 } 887 }
867 888
868 889
869 void StoreIC::GenerateMegamorphic(MacroAssembler* masm) { 890 void StoreIC::GenerateMegamorphic(MacroAssembler* masm) {
870 Register receiver = StoreDescriptor::ReceiverRegister(); 891 Register receiver = StoreDescriptor::ReceiverRegister();
871 Register name = StoreDescriptor::NameRegister(); 892 Register name = StoreDescriptor::NameRegister();
872 DCHECK(receiver.is(r1)); 893 DCHECK(receiver.is(r1));
873 DCHECK(name.is(r2)); 894 DCHECK(name.is(r2));
874 DCHECK(StoreDescriptor::ValueRegister().is(r0)); 895 DCHECK(StoreDescriptor::ValueRegister().is(r0));
875 896
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
1010 patcher.EmitCondition(ne); 1031 patcher.EmitCondition(ne);
1011 } else { 1032 } else {
1012 DCHECK(Assembler::GetCondition(branch_instr) == ne); 1033 DCHECK(Assembler::GetCondition(branch_instr) == ne);
1013 patcher.EmitCondition(eq); 1034 patcher.EmitCondition(eq);
1014 } 1035 }
1015 } 1036 }
1016 } 1037 }
1017 } // namespace v8::internal 1038 } // namespace v8::internal
1018 1039
1019 #endif // V8_TARGET_ARCH_ARM 1040 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « src/builtins.cc ('k') | src/ic/arm64/ic-arm64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698