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" |
| 11 #include "src/ic/ic-compiler.h" |
11 #include "src/ic/stub-cache.h" | 12 #include "src/ic/stub-cache.h" |
12 | 13 |
13 namespace v8 { | 14 namespace v8 { |
14 namespace internal { | 15 namespace internal { |
15 | 16 |
16 | 17 |
17 #define __ ACCESS_MASM(masm) | 18 #define __ ACCESS_MASM(masm) |
18 | 19 |
19 | 20 |
20 // "type" holds an instance type on entry and is not clobbered. | 21 // "type" holds an instance type on entry and is not clobbered. |
(...skipping 760 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
781 __ Push(ReceiverRegister(), NameRegister(), ValueRegister()); | 782 __ Push(ReceiverRegister(), NameRegister(), ValueRegister()); |
782 | 783 |
783 // The slow case calls into the runtime to complete the store without causing | 784 // The slow case calls into the runtime to complete the store without causing |
784 // an IC miss that would otherwise cause a transition to the generic stub. | 785 // an IC miss that would otherwise cause a transition to the generic stub. |
785 ExternalReference ref = | 786 ExternalReference ref = |
786 ExternalReference(IC_Utility(kKeyedStoreIC_Slow), masm->isolate()); | 787 ExternalReference(IC_Utility(kKeyedStoreIC_Slow), masm->isolate()); |
787 __ TailCallExternalReference(ref, 3, 1); | 788 __ TailCallExternalReference(ref, 3, 1); |
788 } | 789 } |
789 | 790 |
790 | 791 |
791 void KeyedStoreIC::GenerateRuntimeSetProperty(MacroAssembler* masm, | |
792 StrictMode strict_mode) { | |
793 ASM_LOCATION("KeyedStoreIC::GenerateRuntimeSetProperty"); | |
794 | |
795 // Push receiver, key and value for runtime call. | |
796 __ Push(ReceiverRegister(), NameRegister(), ValueRegister()); | |
797 | |
798 // Push strict_mode for runtime call. | |
799 __ Mov(x10, Smi::FromInt(strict_mode)); | |
800 __ Push(x10); | |
801 | |
802 __ TailCallRuntime(Runtime::kSetProperty, 4, 1); | |
803 } | |
804 | |
805 | |
806 static void KeyedStoreGenerateGenericHelper( | 792 static void KeyedStoreGenerateGenericHelper( |
807 MacroAssembler* masm, Label* fast_object, Label* fast_double, Label* slow, | 793 MacroAssembler* masm, Label* fast_object, Label* fast_double, Label* slow, |
808 KeyedStoreCheckMap check_map, KeyedStoreIncrementLength increment_length, | 794 KeyedStoreCheckMap check_map, KeyedStoreIncrementLength increment_length, |
809 Register value, Register key, Register receiver, Register receiver_map, | 795 Register value, Register key, Register receiver, Register receiver_map, |
810 Register elements_map, Register elements) { | 796 Register elements_map, Register elements) { |
811 DCHECK(!AreAliased(value, key, receiver, receiver_map, elements_map, elements, | 797 DCHECK(!AreAliased(value, key, receiver, receiver_map, elements_map, elements, |
812 x10, x11)); | 798 x10, x11)); |
813 | 799 |
814 Label transition_smi_elements; | 800 Label transition_smi_elements; |
815 Label transition_double_elements; | 801 Label transition_double_elements; |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
982 __ Cmp(x10, Operand::UntagSmi(key)); | 968 __ Cmp(x10, Operand::UntagSmi(key)); |
983 __ B(hi, &fast_object); | 969 __ B(hi, &fast_object); |
984 | 970 |
985 | 971 |
986 __ Bind(&slow); | 972 __ Bind(&slow); |
987 // Slow case, handle jump to runtime. | 973 // Slow case, handle jump to runtime. |
988 // Live values: | 974 // Live values: |
989 // x0: value | 975 // x0: value |
990 // x1: key | 976 // x1: key |
991 // x2: receiver | 977 // x2: receiver |
992 GenerateRuntimeSetProperty(masm, strict_mode); | 978 PropertyICCompiler::GenerateRuntimeSetProperty(masm, strict_mode); |
993 | 979 |
994 | 980 |
995 __ Bind(&extra); | 981 __ Bind(&extra); |
996 // Extra capacity case: Check if there is extra capacity to | 982 // Extra capacity case: Check if there is extra capacity to |
997 // perform the store and update the length. Used for adding one | 983 // perform the store and update the length. Used for adding one |
998 // element to the array by writing to array[array.length]. | 984 // element to the array by writing to array[array.length]. |
999 | 985 |
1000 // Check for room in the elements backing store. | 986 // Check for room in the elements backing store. |
1001 // Both the key and the length of FixedArray are smis. | 987 // Both the key and the length of FixedArray are smis. |
1002 __ Ldrsw(x10, UntagSmiFieldMemOperand(elements, FixedArray::kLengthOffset)); | 988 __ Ldrsw(x10, UntagSmiFieldMemOperand(elements, FixedArray::kLengthOffset)); |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1076 __ IncrementCounter(counters->store_normal_hit(), 1, x4, x5); | 1062 __ IncrementCounter(counters->store_normal_hit(), 1, x4, x5); |
1077 __ Ret(); | 1063 __ Ret(); |
1078 | 1064 |
1079 // Cache miss: Jump to runtime. | 1065 // Cache miss: Jump to runtime. |
1080 __ Bind(&miss); | 1066 __ Bind(&miss); |
1081 __ IncrementCounter(counters->store_normal_miss(), 1, x4, x5); | 1067 __ IncrementCounter(counters->store_normal_miss(), 1, x4, x5); |
1082 GenerateMiss(masm); | 1068 GenerateMiss(masm); |
1083 } | 1069 } |
1084 | 1070 |
1085 | 1071 |
1086 void StoreIC::GenerateRuntimeSetProperty(MacroAssembler* masm, | |
1087 StrictMode strict_mode) { | |
1088 ASM_LOCATION("StoreIC::GenerateRuntimeSetProperty"); | |
1089 | |
1090 __ Push(ReceiverRegister(), NameRegister(), ValueRegister()); | |
1091 | |
1092 __ Mov(x10, Smi::FromInt(strict_mode)); | |
1093 __ Push(x10); | |
1094 | |
1095 // Do tail-call to runtime routine. | |
1096 __ TailCallRuntime(Runtime::kSetProperty, 4, 1); | |
1097 } | |
1098 | |
1099 | |
1100 void StoreIC::GenerateSlow(MacroAssembler* masm) { | 1072 void StoreIC::GenerateSlow(MacroAssembler* masm) { |
1101 // ---------- S t a t e -------------- | 1073 // ---------- S t a t e -------------- |
1102 // -- x0 : value | 1074 // -- x0 : value |
1103 // -- x1 : receiver | 1075 // -- x1 : receiver |
1104 // -- x2 : name | 1076 // -- x2 : name |
1105 // -- lr : return address | 1077 // -- lr : return address |
1106 // ----------------------------------- | 1078 // ----------------------------------- |
1107 | 1079 |
1108 // Push receiver, name and value for runtime call. | 1080 // Push receiver, name and value for runtime call. |
1109 __ Push(ReceiverRegister(), NameRegister(), ValueRegister()); | 1081 __ Push(ReceiverRegister(), NameRegister(), ValueRegister()); |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1198 } else { | 1170 } else { |
1199 DCHECK(to_patch->Mask(TestBranchMask) == TBNZ); | 1171 DCHECK(to_patch->Mask(TestBranchMask) == TBNZ); |
1200 // This is JumpIfSmi(smi_reg, branch_imm). | 1172 // This is JumpIfSmi(smi_reg, branch_imm). |
1201 patcher.tbz(smi_reg, 0, branch_imm); | 1173 patcher.tbz(smi_reg, 0, branch_imm); |
1202 } | 1174 } |
1203 } | 1175 } |
1204 } | 1176 } |
1205 } // namespace v8::internal | 1177 } // namespace v8::internal |
1206 | 1178 |
1207 #endif // V8_TARGET_ARCH_ARM64 | 1179 #endif // V8_TARGET_ARCH_ARM64 |
OLD | NEW |