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" |
| 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 // ---------------------------------------------------------------------------- | 18 // ---------------------------------------------------------------------------- |
18 // Static IC stub generators. | 19 // Static IC stub generators. |
19 // | 20 // |
20 | 21 |
(...skipping 728 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
749 __ Push(ReceiverRegister(), NameRegister(), ValueRegister()); | 750 __ Push(ReceiverRegister(), NameRegister(), ValueRegister()); |
750 | 751 |
751 // The slow case calls into the runtime to complete the store without causing | 752 // The slow case calls into the runtime to complete the store without causing |
752 // an IC miss that would otherwise cause a transition to the generic stub. | 753 // an IC miss that would otherwise cause a transition to the generic stub. |
753 ExternalReference ref = | 754 ExternalReference ref = |
754 ExternalReference(IC_Utility(kKeyedStoreIC_Slow), masm->isolate()); | 755 ExternalReference(IC_Utility(kKeyedStoreIC_Slow), masm->isolate()); |
755 __ TailCallExternalReference(ref, 3, 1); | 756 __ TailCallExternalReference(ref, 3, 1); |
756 } | 757 } |
757 | 758 |
758 | 759 |
759 void KeyedStoreIC::GenerateRuntimeSetProperty(MacroAssembler* masm, | |
760 StrictMode strict_mode) { | |
761 // Push receiver, key and value for runtime call. | |
762 __ Push(ReceiverRegister(), NameRegister(), ValueRegister()); | |
763 | |
764 __ mov(r0, Operand(Smi::FromInt(strict_mode))); // Strict mode. | |
765 __ Push(r0); | |
766 | |
767 __ TailCallRuntime(Runtime::kSetProperty, 4, 1); | |
768 } | |
769 | |
770 | |
771 static void KeyedStoreGenerateGenericHelper( | 760 static void KeyedStoreGenerateGenericHelper( |
772 MacroAssembler* masm, Label* fast_object, Label* fast_double, Label* slow, | 761 MacroAssembler* masm, Label* fast_object, Label* fast_double, Label* slow, |
773 KeyedStoreCheckMap check_map, KeyedStoreIncrementLength increment_length, | 762 KeyedStoreCheckMap check_map, KeyedStoreIncrementLength increment_length, |
774 Register value, Register key, Register receiver, Register receiver_map, | 763 Register value, Register key, Register receiver, Register receiver_map, |
775 Register elements_map, Register elements) { | 764 Register elements_map, Register elements) { |
776 Label transition_smi_elements; | 765 Label transition_smi_elements; |
777 Label finish_object_store, non_double_value, transition_double_elements; | 766 Label finish_object_store, non_double_value, transition_double_elements; |
778 Label fast_double_without_map_check; | 767 Label fast_double_without_map_check; |
779 | 768 |
780 // Fast case: Do the store, could be either Object or double. | 769 // Fast case: Do the store, could be either Object or double. |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
958 __ ldr(ip, FieldMemOperand(elements, FixedArray::kLengthOffset)); | 947 __ ldr(ip, FieldMemOperand(elements, FixedArray::kLengthOffset)); |
959 __ cmp(key, Operand(ip)); | 948 __ cmp(key, Operand(ip)); |
960 __ b(lo, &fast_object); | 949 __ b(lo, &fast_object); |
961 | 950 |
962 // Slow case, handle jump to runtime. | 951 // Slow case, handle jump to runtime. |
963 __ bind(&slow); | 952 __ bind(&slow); |
964 // Entry registers are intact. | 953 // Entry registers are intact. |
965 // r0: value. | 954 // r0: value. |
966 // r1: key. | 955 // r1: key. |
967 // r2: receiver. | 956 // r2: receiver. |
968 GenerateRuntimeSetProperty(masm, strict_mode); | 957 PropertyICCompiler::GenerateRuntimeSetProperty(masm, strict_mode); |
969 | 958 |
970 // Extra capacity case: Check if there is extra capacity to | 959 // Extra capacity case: Check if there is extra capacity to |
971 // perform the store and update the length. Used for adding one | 960 // perform the store and update the length. Used for adding one |
972 // element to the array by writing to array[array.length]. | 961 // element to the array by writing to array[array.length]. |
973 __ bind(&extra); | 962 __ bind(&extra); |
974 // Condition code from comparing key and array length is still available. | 963 // Condition code from comparing key and array length is still available. |
975 __ b(ne, &slow); // Only support writing to writing to array[array.length]. | 964 __ b(ne, &slow); // Only support writing to writing to array[array.length]. |
976 // Check for room in the elements backing store. | 965 // Check for room in the elements backing store. |
977 // Both the key and the length of FixedArray are smis. | 966 // Both the key and the length of FixedArray are smis. |
978 __ ldr(ip, FieldMemOperand(elements, FixedArray::kLengthOffset)); | 967 __ ldr(ip, FieldMemOperand(elements, FixedArray::kLengthOffset)); |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1055 Counters* counters = masm->isolate()->counters(); | 1044 Counters* counters = masm->isolate()->counters(); |
1056 __ IncrementCounter(counters->store_normal_hit(), 1, r4, r5); | 1045 __ IncrementCounter(counters->store_normal_hit(), 1, r4, r5); |
1057 __ Ret(); | 1046 __ Ret(); |
1058 | 1047 |
1059 __ bind(&miss); | 1048 __ bind(&miss); |
1060 __ IncrementCounter(counters->store_normal_miss(), 1, r4, r5); | 1049 __ IncrementCounter(counters->store_normal_miss(), 1, r4, r5); |
1061 GenerateMiss(masm); | 1050 GenerateMiss(masm); |
1062 } | 1051 } |
1063 | 1052 |
1064 | 1053 |
1065 void StoreIC::GenerateRuntimeSetProperty(MacroAssembler* masm, | |
1066 StrictMode strict_mode) { | |
1067 __ Push(ReceiverRegister(), NameRegister(), ValueRegister()); | |
1068 | |
1069 __ mov(r0, Operand(Smi::FromInt(strict_mode))); | |
1070 __ Push(r0); | |
1071 | |
1072 // Do tail-call to runtime routine. | |
1073 __ TailCallRuntime(Runtime::kSetProperty, 4, 1); | |
1074 } | |
1075 | |
1076 | |
1077 #undef __ | 1054 #undef __ |
1078 | 1055 |
1079 | 1056 |
1080 Condition CompareIC::ComputeCondition(Token::Value op) { | 1057 Condition CompareIC::ComputeCondition(Token::Value op) { |
1081 switch (op) { | 1058 switch (op) { |
1082 case Token::EQ_STRICT: | 1059 case Token::EQ_STRICT: |
1083 case Token::EQ: | 1060 case Token::EQ: |
1084 return eq; | 1061 return eq; |
1085 case Token::LT: | 1062 case Token::LT: |
1086 return lt; | 1063 return lt; |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1165 patcher.EmitCondition(ne); | 1142 patcher.EmitCondition(ne); |
1166 } else { | 1143 } else { |
1167 DCHECK(Assembler::GetCondition(branch_instr) == ne); | 1144 DCHECK(Assembler::GetCondition(branch_instr) == ne); |
1168 patcher.EmitCondition(eq); | 1145 patcher.EmitCondition(eq); |
1169 } | 1146 } |
1170 } | 1147 } |
1171 } | 1148 } |
1172 } // namespace v8::internal | 1149 } // namespace v8::internal |
1173 | 1150 |
1174 #endif // V8_TARGET_ARCH_ARM | 1151 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |