OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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_ARM64 | 7 #if V8_TARGET_ARCH_ARM64 |
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 622 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
633 // Push receiver, key and value for runtime call. | 633 // Push receiver, key and value for runtime call. |
634 __ Push(StoreDescriptor::ReceiverRegister(), StoreDescriptor::NameRegister(), | 634 __ Push(StoreDescriptor::ReceiverRegister(), StoreDescriptor::NameRegister(), |
635 StoreDescriptor::ValueRegister()); | 635 StoreDescriptor::ValueRegister()); |
636 | 636 |
637 ExternalReference ref = | 637 ExternalReference ref = |
638 ExternalReference(IC_Utility(kKeyedStoreIC_Miss), masm->isolate()); | 638 ExternalReference(IC_Utility(kKeyedStoreIC_Miss), masm->isolate()); |
639 __ TailCallExternalReference(ref, 3, 1); | 639 __ TailCallExternalReference(ref, 3, 1); |
640 } | 640 } |
641 | 641 |
642 | 642 |
643 static void KeyedStoreGenerateGenericHelper( | 643 static void KeyedStoreGenerateMegamorphicHelper( |
644 MacroAssembler* masm, Label* fast_object, Label* fast_double, Label* slow, | 644 MacroAssembler* masm, Label* fast_object, Label* fast_double, Label* slow, |
645 KeyedStoreCheckMap check_map, KeyedStoreIncrementLength increment_length, | 645 KeyedStoreCheckMap check_map, KeyedStoreIncrementLength increment_length, |
646 Register value, Register key, Register receiver, Register receiver_map, | 646 Register value, Register key, Register receiver, Register receiver_map, |
647 Register elements_map, Register elements) { | 647 Register elements_map, Register elements) { |
648 DCHECK(!AreAliased(value, key, receiver, receiver_map, elements_map, elements, | 648 DCHECK(!AreAliased(value, key, receiver, receiver_map, elements_map, elements, |
649 x10, x11)); | 649 x10, x11)); |
650 | 650 |
651 Label transition_smi_elements; | 651 Label transition_smi_elements; |
652 Label transition_double_elements; | 652 Label transition_double_elements; |
653 Label fast_double_without_map_check; | 653 Label fast_double_without_map_check; |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
765 __ LoadTransitionedArrayMapConditional(FAST_DOUBLE_ELEMENTS, FAST_ELEMENTS, | 765 __ LoadTransitionedArrayMapConditional(FAST_DOUBLE_ELEMENTS, FAST_ELEMENTS, |
766 receiver_map, x10, x11, slow); | 766 receiver_map, x10, x11, slow); |
767 mode = AllocationSite::GetMode(FAST_DOUBLE_ELEMENTS, FAST_ELEMENTS); | 767 mode = AllocationSite::GetMode(FAST_DOUBLE_ELEMENTS, FAST_ELEMENTS); |
768 ElementsTransitionGenerator::GenerateDoubleToObject( | 768 ElementsTransitionGenerator::GenerateDoubleToObject( |
769 masm, receiver, key, value, receiver_map, mode, slow); | 769 masm, receiver, key, value, receiver_map, mode, slow); |
770 __ Ldr(elements, FieldMemOperand(receiver, JSObject::kElementsOffset)); | 770 __ Ldr(elements, FieldMemOperand(receiver, JSObject::kElementsOffset)); |
771 __ B(&finish_store); | 771 __ B(&finish_store); |
772 } | 772 } |
773 | 773 |
774 | 774 |
775 void KeyedStoreIC::GenerateGeneric( | 775 void KeyedStoreIC::GenerateMegamorphic(MacroAssembler* masm, |
776 MacroAssembler* masm, StrictMode strict_mode, | 776 StrictMode strict_mode) { |
777 KeyedStoreStubCacheRequirement handler_requirement) { | 777 ASM_LOCATION("KeyedStoreIC::GenerateMegamorphic"); |
778 ASM_LOCATION("KeyedStoreIC::GenerateGeneric"); | |
779 Label slow; | 778 Label slow; |
780 Label array; | 779 Label array; |
781 Label fast_object; | 780 Label fast_object; |
782 Label extra; | 781 Label extra; |
783 Label fast_object_grow; | 782 Label fast_object_grow; |
784 Label fast_double_grow; | 783 Label fast_double_grow; |
785 Label fast_double; | 784 Label fast_double; |
786 Label maybe_name_key; | 785 Label maybe_name_key; |
787 Label miss; | 786 Label miss; |
788 | 787 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
834 | 833 |
835 __ bind(&maybe_name_key); | 834 __ bind(&maybe_name_key); |
836 __ Ldr(x10, FieldMemOperand(key, HeapObject::kMapOffset)); | 835 __ Ldr(x10, FieldMemOperand(key, HeapObject::kMapOffset)); |
837 __ Ldrb(x10, FieldMemOperand(x10, Map::kInstanceTypeOffset)); | 836 __ Ldrb(x10, FieldMemOperand(x10, Map::kInstanceTypeOffset)); |
838 __ JumpIfNotUniqueNameInstanceType(x10, &slow); | 837 __ JumpIfNotUniqueNameInstanceType(x10, &slow); |
839 Code::Flags flags = Code::RemoveTypeAndHolderFromFlags( | 838 Code::Flags flags = Code::RemoveTypeAndHolderFromFlags( |
840 Code::ComputeHandlerFlags(Code::STORE_IC)); | 839 Code::ComputeHandlerFlags(Code::STORE_IC)); |
841 masm->isolate()->stub_cache()->GenerateProbe(masm, flags, false, receiver, | 840 masm->isolate()->stub_cache()->GenerateProbe(masm, flags, false, receiver, |
842 key, x3, x4, x5, x6); | 841 key, x3, x4, x5, x6); |
843 // Cache miss. | 842 // Cache miss. |
844 if (handler_requirement == kCallRuntimeOnMissingHandler) { | 843 __ B(&miss); |
845 __ B(&slow); | |
846 } else { | |
847 DCHECK(handler_requirement == kMissOnMissingHandler); | |
848 __ B(&miss); | |
849 } | |
850 | 844 |
851 __ Bind(&extra); | 845 __ Bind(&extra); |
852 // Extra capacity case: Check if there is extra capacity to | 846 // Extra capacity case: Check if there is extra capacity to |
853 // perform the store and update the length. Used for adding one | 847 // perform the store and update the length. Used for adding one |
854 // element to the array by writing to array[array.length]. | 848 // element to the array by writing to array[array.length]. |
855 | 849 |
856 // Check for room in the elements backing store. | 850 // Check for room in the elements backing store. |
857 // Both the key and the length of FixedArray are smis. | 851 // Both the key and the length of FixedArray are smis. |
858 __ Ldrsw(x10, UntagSmiFieldMemOperand(elements, FixedArray::kLengthOffset)); | 852 __ Ldrsw(x10, UntagSmiFieldMemOperand(elements, FixedArray::kLengthOffset)); |
859 __ Cmp(x10, Operand::UntagSmi(key)); | 853 __ Cmp(x10, Operand::UntagSmi(key)); |
(...skipping 14 matching lines...) Expand all Loading... |
874 // is the length is always a smi. | 868 // is the length is always a smi. |
875 | 869 |
876 __ Ldr(elements, FieldMemOperand(receiver, JSObject::kElementsOffset)); | 870 __ Ldr(elements, FieldMemOperand(receiver, JSObject::kElementsOffset)); |
877 | 871 |
878 // Check the key against the length in the array. | 872 // Check the key against the length in the array. |
879 __ Ldrsw(x10, UntagSmiFieldMemOperand(receiver, JSArray::kLengthOffset)); | 873 __ Ldrsw(x10, UntagSmiFieldMemOperand(receiver, JSArray::kLengthOffset)); |
880 __ Cmp(x10, Operand::UntagSmi(key)); | 874 __ Cmp(x10, Operand::UntagSmi(key)); |
881 __ B(eq, &extra); // We can handle the case where we are appending 1 element. | 875 __ B(eq, &extra); // We can handle the case where we are appending 1 element. |
882 __ B(lo, &slow); | 876 __ B(lo, &slow); |
883 | 877 |
884 KeyedStoreGenerateGenericHelper( | 878 KeyedStoreGenerateMegamorphicHelper( |
885 masm, &fast_object, &fast_double, &slow, kCheckMap, kDontIncrementLength, | 879 masm, &fast_object, &fast_double, &slow, kCheckMap, kDontIncrementLength, |
886 value, key, receiver, receiver_map, elements_map, elements); | 880 value, key, receiver, receiver_map, elements_map, elements); |
887 KeyedStoreGenerateGenericHelper(masm, &fast_object_grow, &fast_double_grow, | 881 KeyedStoreGenerateMegamorphicHelper(masm, &fast_object_grow, |
888 &slow, kDontCheckMap, kIncrementLength, value, | 882 &fast_double_grow, &slow, kDontCheckMap, |
889 key, receiver, receiver_map, elements_map, | 883 kIncrementLength, value, key, receiver, |
890 elements); | 884 receiver_map, elements_map, elements); |
891 | 885 |
892 if (handler_requirement == kMissOnMissingHandler) { | 886 __ bind(&miss); |
893 __ bind(&miss); | 887 GenerateMiss(masm); |
894 GenerateMiss(masm); | |
895 } | |
896 } | 888 } |
897 | 889 |
898 | 890 |
899 void StoreIC::GenerateMegamorphic(MacroAssembler* masm) { | 891 void StoreIC::GenerateMegamorphic(MacroAssembler* masm) { |
900 Register receiver = StoreDescriptor::ReceiverRegister(); | 892 Register receiver = StoreDescriptor::ReceiverRegister(); |
901 Register name = StoreDescriptor::NameRegister(); | 893 Register name = StoreDescriptor::NameRegister(); |
902 DCHECK(!AreAliased(receiver, name, StoreDescriptor::ValueRegister(), x3, x4, | 894 DCHECK(!AreAliased(receiver, name, StoreDescriptor::ValueRegister(), x3, x4, |
903 x5, x6)); | 895 x5, x6)); |
904 | 896 |
905 // Probe the stub cache. | 897 // Probe the stub cache. |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1028 } else { | 1020 } else { |
1029 DCHECK(to_patch->Mask(TestBranchMask) == TBNZ); | 1021 DCHECK(to_patch->Mask(TestBranchMask) == TBNZ); |
1030 // This is JumpIfSmi(smi_reg, branch_imm). | 1022 // This is JumpIfSmi(smi_reg, branch_imm). |
1031 patcher.tbz(smi_reg, 0, branch_imm); | 1023 patcher.tbz(smi_reg, 0, branch_imm); |
1032 } | 1024 } |
1033 } | 1025 } |
1034 } | 1026 } |
1035 } // namespace v8::internal | 1027 } // namespace v8::internal |
1036 | 1028 |
1037 #endif // V8_TARGET_ARCH_ARM64 | 1029 #endif // V8_TARGET_ARCH_ARM64 |
OLD | NEW |