OLD | NEW |
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 580 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
591 // Push receiver, key and value for runtime call. | 591 // Push receiver, key and value for runtime call. |
592 __ Push(StoreDescriptor::ReceiverRegister(), StoreDescriptor::NameRegister(), | 592 __ Push(StoreDescriptor::ReceiverRegister(), StoreDescriptor::NameRegister(), |
593 StoreDescriptor::ValueRegister()); | 593 StoreDescriptor::ValueRegister()); |
594 | 594 |
595 ExternalReference ref = | 595 ExternalReference ref = |
596 ExternalReference(IC_Utility(kKeyedStoreIC_Miss), masm->isolate()); | 596 ExternalReference(IC_Utility(kKeyedStoreIC_Miss), masm->isolate()); |
597 __ TailCallExternalReference(ref, 3, 1); | 597 __ TailCallExternalReference(ref, 3, 1); |
598 } | 598 } |
599 | 599 |
600 | 600 |
601 static void KeyedStoreGenerateGenericHelper( | 601 static void KeyedStoreGenerateMegamorphicHelper( |
602 MacroAssembler* masm, Label* fast_object, Label* fast_double, Label* slow, | 602 MacroAssembler* masm, Label* fast_object, Label* fast_double, Label* slow, |
603 KeyedStoreCheckMap check_map, KeyedStoreIncrementLength increment_length, | 603 KeyedStoreCheckMap check_map, KeyedStoreIncrementLength increment_length, |
604 Register value, Register key, Register receiver, Register receiver_map, | 604 Register value, Register key, Register receiver, Register receiver_map, |
605 Register elements_map, Register elements) { | 605 Register elements_map, Register elements) { |
606 Label transition_smi_elements; | 606 Label transition_smi_elements; |
607 Label finish_object_store, non_double_value, transition_double_elements; | 607 Label finish_object_store, non_double_value, transition_double_elements; |
608 Label fast_double_without_map_check; | 608 Label fast_double_without_map_check; |
609 | 609 |
610 // Fast case: Do the store, could be either Object or double. | 610 // Fast case: Do the store, could be either Object or double. |
611 __ bind(fast_object); | 611 __ bind(fast_object); |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
732 __ LoadTransitionedArrayMapConditional(FAST_DOUBLE_ELEMENTS, FAST_ELEMENTS, | 732 __ LoadTransitionedArrayMapConditional(FAST_DOUBLE_ELEMENTS, FAST_ELEMENTS, |
733 receiver_map, r4, slow); | 733 receiver_map, r4, slow); |
734 mode = AllocationSite::GetMode(FAST_DOUBLE_ELEMENTS, FAST_ELEMENTS); | 734 mode = AllocationSite::GetMode(FAST_DOUBLE_ELEMENTS, FAST_ELEMENTS); |
735 ElementsTransitionGenerator::GenerateDoubleToObject( | 735 ElementsTransitionGenerator::GenerateDoubleToObject( |
736 masm, receiver, key, value, receiver_map, mode, slow); | 736 masm, receiver, key, value, receiver_map, mode, slow); |
737 __ ldr(elements, FieldMemOperand(receiver, JSObject::kElementsOffset)); | 737 __ ldr(elements, FieldMemOperand(receiver, JSObject::kElementsOffset)); |
738 __ jmp(&finish_object_store); | 738 __ jmp(&finish_object_store); |
739 } | 739 } |
740 | 740 |
741 | 741 |
742 void KeyedStoreIC::GenerateGeneric( | 742 void KeyedStoreIC::GenerateMegamorphic(MacroAssembler* masm, |
743 MacroAssembler* masm, StrictMode strict_mode, | 743 StrictMode strict_mode) { |
744 KeyedStoreStubCacheRequirement handler_requirement) { | |
745 // ---------- S t a t e -------------- | 744 // ---------- S t a t e -------------- |
746 // -- r0 : value | 745 // -- r0 : value |
747 // -- r1 : key | 746 // -- r1 : key |
748 // -- r2 : receiver | 747 // -- r2 : receiver |
749 // -- lr : return address | 748 // -- lr : return address |
750 // ----------------------------------- | 749 // ----------------------------------- |
751 Label slow, fast_object, fast_object_grow; | 750 Label slow, fast_object, fast_object_grow; |
752 Label fast_double, fast_double_grow; | 751 Label fast_double, fast_double_grow; |
753 Label array, extra, check_if_double_array, maybe_name_key, miss; | 752 Label array, extra, check_if_double_array, maybe_name_key, miss; |
754 | 753 |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
801 | 800 |
802 __ bind(&maybe_name_key); | 801 __ bind(&maybe_name_key); |
803 __ ldr(r4, FieldMemOperand(key, HeapObject::kMapOffset)); | 802 __ ldr(r4, FieldMemOperand(key, HeapObject::kMapOffset)); |
804 __ ldrb(r4, FieldMemOperand(r4, Map::kInstanceTypeOffset)); | 803 __ ldrb(r4, FieldMemOperand(r4, Map::kInstanceTypeOffset)); |
805 __ JumpIfNotUniqueNameInstanceType(r4, &slow); | 804 __ JumpIfNotUniqueNameInstanceType(r4, &slow); |
806 Code::Flags flags = Code::RemoveTypeAndHolderFromFlags( | 805 Code::Flags flags = Code::RemoveTypeAndHolderFromFlags( |
807 Code::ComputeHandlerFlags(Code::STORE_IC)); | 806 Code::ComputeHandlerFlags(Code::STORE_IC)); |
808 masm->isolate()->stub_cache()->GenerateProbe(masm, flags, false, receiver, | 807 masm->isolate()->stub_cache()->GenerateProbe(masm, flags, false, receiver, |
809 key, r3, r4, r5, r6); | 808 key, r3, r4, r5, r6); |
810 // Cache miss. | 809 // Cache miss. |
811 if (handler_requirement == kCallRuntimeOnMissingHandler) { | 810 __ b(&miss); |
812 __ b(&slow); | |
813 } else { | |
814 DCHECK(handler_requirement == kMissOnMissingHandler); | |
815 __ b(&miss); | |
816 } | |
817 | 811 |
818 // Extra capacity case: Check if there is extra capacity to | 812 // Extra capacity case: Check if there is extra capacity to |
819 // perform the store and update the length. Used for adding one | 813 // perform the store and update the length. Used for adding one |
820 // element to the array by writing to array[array.length]. | 814 // element to the array by writing to array[array.length]. |
821 __ bind(&extra); | 815 __ bind(&extra); |
822 // Condition code from comparing key and array length is still available. | 816 // Condition code from comparing key and array length is still available. |
823 __ b(ne, &slow); // Only support writing to writing to array[array.length]. | 817 __ b(ne, &slow); // Only support writing to writing to array[array.length]. |
824 // Check for room in the elements backing store. | 818 // Check for room in the elements backing store. |
825 // Both the key and the length of FixedArray are smis. | 819 // Both the key and the length of FixedArray are smis. |
826 __ ldr(ip, FieldMemOperand(elements, FixedArray::kLengthOffset)); | 820 __ ldr(ip, FieldMemOperand(elements, FixedArray::kLengthOffset)); |
(...skipping 14 matching lines...) Expand all Loading... |
841 // array. Check that the array is in fast mode (and writable); if it | 835 // array. Check that the array is in fast mode (and writable); if it |
842 // is the length is always a smi. | 836 // is the length is always a smi. |
843 __ bind(&array); | 837 __ bind(&array); |
844 __ ldr(elements, FieldMemOperand(receiver, JSObject::kElementsOffset)); | 838 __ ldr(elements, FieldMemOperand(receiver, JSObject::kElementsOffset)); |
845 | 839 |
846 // Check the key against the length in the array. | 840 // Check the key against the length in the array. |
847 __ ldr(ip, FieldMemOperand(receiver, JSArray::kLengthOffset)); | 841 __ ldr(ip, FieldMemOperand(receiver, JSArray::kLengthOffset)); |
848 __ cmp(key, Operand(ip)); | 842 __ cmp(key, Operand(ip)); |
849 __ b(hs, &extra); | 843 __ b(hs, &extra); |
850 | 844 |
851 KeyedStoreGenerateGenericHelper( | 845 KeyedStoreGenerateMegamorphicHelper( |
852 masm, &fast_object, &fast_double, &slow, kCheckMap, kDontIncrementLength, | 846 masm, &fast_object, &fast_double, &slow, kCheckMap, kDontIncrementLength, |
853 value, key, receiver, receiver_map, elements_map, elements); | 847 value, key, receiver, receiver_map, elements_map, elements); |
854 KeyedStoreGenerateGenericHelper(masm, &fast_object_grow, &fast_double_grow, | 848 KeyedStoreGenerateMegamorphicHelper(masm, &fast_object_grow, |
855 &slow, kDontCheckMap, kIncrementLength, value, | 849 &fast_double_grow, &slow, kDontCheckMap, |
856 key, receiver, receiver_map, elements_map, | 850 kIncrementLength, value, key, receiver, |
857 elements); | 851 receiver_map, elements_map, elements); |
858 | 852 |
859 __ bind(&miss); | 853 __ bind(&miss); |
860 GenerateMiss(masm); | 854 GenerateMiss(masm); |
861 } | 855 } |
862 | 856 |
863 | 857 |
864 void StoreIC::GenerateMegamorphic(MacroAssembler* masm) { | 858 void StoreIC::GenerateMegamorphic(MacroAssembler* masm) { |
865 Register receiver = StoreDescriptor::ReceiverRegister(); | 859 Register receiver = StoreDescriptor::ReceiverRegister(); |
866 Register name = StoreDescriptor::NameRegister(); | 860 Register name = StoreDescriptor::NameRegister(); |
867 DCHECK(receiver.is(r1)); | 861 DCHECK(receiver.is(r1)); |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1005 patcher.EmitCondition(ne); | 999 patcher.EmitCondition(ne); |
1006 } else { | 1000 } else { |
1007 DCHECK(Assembler::GetCondition(branch_instr) == ne); | 1001 DCHECK(Assembler::GetCondition(branch_instr) == ne); |
1008 patcher.EmitCondition(eq); | 1002 patcher.EmitCondition(eq); |
1009 } | 1003 } |
1010 } | 1004 } |
1011 } | 1005 } |
1012 } // namespace v8::internal | 1006 } // namespace v8::internal |
1013 | 1007 |
1014 #endif // V8_TARGET_ARCH_ARM | 1008 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |