| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 716 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 727 rdi, | 727 rdi, |
| 728 slow); | 728 slow); |
| 729 mode = AllocationSite::GetMode(FAST_DOUBLE_ELEMENTS, FAST_ELEMENTS); | 729 mode = AllocationSite::GetMode(FAST_DOUBLE_ELEMENTS, FAST_ELEMENTS); |
| 730 ElementsTransitionGenerator::GenerateDoubleToObject(masm, mode, slow); | 730 ElementsTransitionGenerator::GenerateDoubleToObject(masm, mode, slow); |
| 731 __ movp(rbx, FieldOperand(rdx, JSObject::kElementsOffset)); | 731 __ movp(rbx, FieldOperand(rdx, JSObject::kElementsOffset)); |
| 732 __ jmp(&finish_object_store); | 732 __ jmp(&finish_object_store); |
| 733 } | 733 } |
| 734 | 734 |
| 735 | 735 |
| 736 void KeyedStoreIC::GenerateGeneric(MacroAssembler* masm, | 736 void KeyedStoreIC::GenerateGeneric(MacroAssembler* masm, |
| 737 StrictModeFlag strict_mode) { | 737 StrictMode strict_mode) { |
| 738 // ----------- S t a t e ------------- | 738 // ----------- S t a t e ------------- |
| 739 // -- rax : value | 739 // -- rax : value |
| 740 // -- rcx : key | 740 // -- rcx : key |
| 741 // -- rdx : receiver | 741 // -- rdx : receiver |
| 742 // -- rsp[0] : return address | 742 // -- rsp[0] : return address |
| 743 // ----------------------------------- | 743 // ----------------------------------- |
| 744 Label slow, slow_with_tagged_index, fast_object, fast_object_grow; | 744 Label slow, slow_with_tagged_index, fast_object, fast_object_grow; |
| 745 Label fast_double, fast_double_grow; | 745 Label fast_double, fast_double_grow; |
| 746 Label array, extra, check_if_double_array; | 746 Label array, extra, check_if_double_array; |
| 747 | 747 |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 845 // Check that the object is some kind of JSObject. | 845 // Check that the object is some kind of JSObject. |
| 846 __ CmpObjectType(object, FIRST_JS_RECEIVER_TYPE, scratch1); | 846 __ CmpObjectType(object, FIRST_JS_RECEIVER_TYPE, scratch1); |
| 847 __ j(below, slow_case); | 847 __ j(below, slow_case); |
| 848 | 848 |
| 849 // Check that the key is a positive smi. | 849 // Check that the key is a positive smi. |
| 850 Condition check = masm->CheckNonNegativeSmi(key); | 850 Condition check = masm->CheckNonNegativeSmi(key); |
| 851 __ j(NegateCondition(check), slow_case); | 851 __ j(NegateCondition(check), slow_case); |
| 852 | 852 |
| 853 // Load the elements into scratch1 and check its map. If not, jump | 853 // Load the elements into scratch1 and check its map. If not, jump |
| 854 // to the unmapped lookup with the parameter map in scratch1. | 854 // to the unmapped lookup with the parameter map in scratch1. |
| 855 Handle<Map> arguments_map(heap->non_strict_arguments_elements_map()); | 855 Handle<Map> arguments_map(heap->sloppy_arguments_elements_map()); |
| 856 __ movp(scratch1, FieldOperand(object, JSObject::kElementsOffset)); | 856 __ movp(scratch1, FieldOperand(object, JSObject::kElementsOffset)); |
| 857 __ CheckMap(scratch1, arguments_map, slow_case, DONT_DO_SMI_CHECK); | 857 __ CheckMap(scratch1, arguments_map, slow_case, DONT_DO_SMI_CHECK); |
| 858 | 858 |
| 859 // Check if element is in the range of mapped arguments. | 859 // Check if element is in the range of mapped arguments. |
| 860 __ movp(scratch2, FieldOperand(scratch1, FixedArray::kLengthOffset)); | 860 __ movp(scratch2, FieldOperand(scratch1, FixedArray::kLengthOffset)); |
| 861 __ SmiSubConstant(scratch2, scratch2, Smi::FromInt(2)); | 861 __ SmiSubConstant(scratch2, scratch2, Smi::FromInt(2)); |
| 862 __ cmpq(key, scratch2); | 862 __ cmpq(key, scratch2); |
| 863 __ j(greater_equal, unmapped_case); | 863 __ j(greater_equal, unmapped_case); |
| 864 | 864 |
| 865 // Load element index and check whether it is the hole. | 865 // Load element index and check whether it is the hole. |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 902 __ cmpq(key, scratch); | 902 __ cmpq(key, scratch); |
| 903 __ j(greater_equal, slow_case); | 903 __ j(greater_equal, slow_case); |
| 904 __ SmiToInteger64(scratch, key); | 904 __ SmiToInteger64(scratch, key); |
| 905 return FieldOperand(backing_store, | 905 return FieldOperand(backing_store, |
| 906 scratch, | 906 scratch, |
| 907 times_pointer_size, | 907 times_pointer_size, |
| 908 FixedArray::kHeaderSize); | 908 FixedArray::kHeaderSize); |
| 909 } | 909 } |
| 910 | 910 |
| 911 | 911 |
| 912 void KeyedLoadIC::GenerateNonStrictArguments(MacroAssembler* masm) { | 912 void KeyedLoadIC::GenerateSloppyArguments(MacroAssembler* masm) { |
| 913 // ----------- S t a t e ------------- | 913 // ----------- S t a t e ------------- |
| 914 // -- rax : key | 914 // -- rax : key |
| 915 // -- rdx : receiver | 915 // -- rdx : receiver |
| 916 // -- rsp[0] : return address | 916 // -- rsp[0] : return address |
| 917 // ----------------------------------- | 917 // ----------------------------------- |
| 918 Label slow, notin; | 918 Label slow, notin; |
| 919 Operand mapped_location = | 919 Operand mapped_location = |
| 920 GenerateMappedArgumentsLookup( | 920 GenerateMappedArgumentsLookup( |
| 921 masm, rdx, rax, rbx, rcx, rdi, ¬in, &slow); | 921 masm, rdx, rax, rbx, rcx, rdi, ¬in, &slow); |
| 922 __ movp(rax, mapped_location); | 922 __ movp(rax, mapped_location); |
| 923 __ Ret(); | 923 __ Ret(); |
| 924 __ bind(¬in); | 924 __ bind(¬in); |
| 925 // The unmapped lookup expects that the parameter map is in rbx. | 925 // The unmapped lookup expects that the parameter map is in rbx. |
| 926 Operand unmapped_location = | 926 Operand unmapped_location = |
| 927 GenerateUnmappedArgumentsLookup(masm, rax, rbx, rcx, &slow); | 927 GenerateUnmappedArgumentsLookup(masm, rax, rbx, rcx, &slow); |
| 928 __ CompareRoot(unmapped_location, Heap::kTheHoleValueRootIndex); | 928 __ CompareRoot(unmapped_location, Heap::kTheHoleValueRootIndex); |
| 929 __ j(equal, &slow); | 929 __ j(equal, &slow); |
| 930 __ movp(rax, unmapped_location); | 930 __ movp(rax, unmapped_location); |
| 931 __ Ret(); | 931 __ Ret(); |
| 932 __ bind(&slow); | 932 __ bind(&slow); |
| 933 GenerateMiss(masm); | 933 GenerateMiss(masm); |
| 934 } | 934 } |
| 935 | 935 |
| 936 | 936 |
| 937 void KeyedStoreIC::GenerateNonStrictArguments(MacroAssembler* masm) { | 937 void KeyedStoreIC::GenerateSloppyArguments(MacroAssembler* masm) { |
| 938 // ----------- S t a t e ------------- | 938 // ----------- S t a t e ------------- |
| 939 // -- rax : value | 939 // -- rax : value |
| 940 // -- rcx : key | 940 // -- rcx : key |
| 941 // -- rdx : receiver | 941 // -- rdx : receiver |
| 942 // -- rsp[0] : return address | 942 // -- rsp[0] : return address |
| 943 // ----------------------------------- | 943 // ----------------------------------- |
| 944 Label slow, notin; | 944 Label slow, notin; |
| 945 Operand mapped_location = GenerateMappedArgumentsLookup( | 945 Operand mapped_location = GenerateMappedArgumentsLookup( |
| 946 masm, rdx, rcx, rbx, rdi, r8, ¬in, &slow); | 946 masm, rdx, rcx, rbx, rdi, r8, ¬in, &slow); |
| 947 __ movp(mapped_location, rax); | 947 __ movp(mapped_location, rax); |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1144 __ IncrementCounter(counters->store_normal_hit(), 1); | 1144 __ IncrementCounter(counters->store_normal_hit(), 1); |
| 1145 __ ret(0); | 1145 __ ret(0); |
| 1146 | 1146 |
| 1147 __ bind(&miss); | 1147 __ bind(&miss); |
| 1148 __ IncrementCounter(counters->store_normal_miss(), 1); | 1148 __ IncrementCounter(counters->store_normal_miss(), 1); |
| 1149 GenerateMiss(masm); | 1149 GenerateMiss(masm); |
| 1150 } | 1150 } |
| 1151 | 1151 |
| 1152 | 1152 |
| 1153 void StoreIC::GenerateRuntimeSetProperty(MacroAssembler* masm, | 1153 void StoreIC::GenerateRuntimeSetProperty(MacroAssembler* masm, |
| 1154 StrictModeFlag strict_mode) { | 1154 StrictMode strict_mode) { |
| 1155 // ----------- S t a t e ------------- | 1155 // ----------- S t a t e ------------- |
| 1156 // -- rax : value | 1156 // -- rax : value |
| 1157 // -- rcx : name | 1157 // -- rcx : name |
| 1158 // -- rdx : receiver | 1158 // -- rdx : receiver |
| 1159 // -- rsp[0] : return address | 1159 // -- rsp[0] : return address |
| 1160 // ----------------------------------- | 1160 // ----------------------------------- |
| 1161 __ PopReturnAddressTo(rbx); | 1161 __ PopReturnAddressTo(rbx); |
| 1162 __ push(rdx); | 1162 __ push(rdx); |
| 1163 __ push(rcx); | 1163 __ push(rcx); |
| 1164 __ push(rax); | 1164 __ push(rax); |
| 1165 __ Push(Smi::FromInt(NONE)); // PropertyAttributes | 1165 __ Push(Smi::FromInt(NONE)); // PropertyAttributes |
| 1166 __ Push(Smi::FromInt(strict_mode)); | 1166 __ Push(Smi::FromInt(strict_mode)); |
| 1167 __ PushReturnAddressFrom(rbx); | 1167 __ PushReturnAddressFrom(rbx); |
| 1168 | 1168 |
| 1169 // Do tail-call to runtime routine. | 1169 // Do tail-call to runtime routine. |
| 1170 __ TailCallRuntime(Runtime::kSetProperty, 5, 1); | 1170 __ TailCallRuntime(Runtime::kSetProperty, 5, 1); |
| 1171 } | 1171 } |
| 1172 | 1172 |
| 1173 | 1173 |
| 1174 void KeyedStoreIC::GenerateRuntimeSetProperty(MacroAssembler* masm, | 1174 void KeyedStoreIC::GenerateRuntimeSetProperty(MacroAssembler* masm, |
| 1175 StrictModeFlag strict_mode) { | 1175 StrictMode strict_mode) { |
| 1176 // ----------- S t a t e ------------- | 1176 // ----------- S t a t e ------------- |
| 1177 // -- rax : value | 1177 // -- rax : value |
| 1178 // -- rcx : key | 1178 // -- rcx : key |
| 1179 // -- rdx : receiver | 1179 // -- rdx : receiver |
| 1180 // -- rsp[0] : return address | 1180 // -- rsp[0] : return address |
| 1181 // ----------------------------------- | 1181 // ----------------------------------- |
| 1182 | 1182 |
| 1183 __ PopReturnAddressTo(rbx); | 1183 __ PopReturnAddressTo(rbx); |
| 1184 __ push(rdx); // receiver | 1184 __ push(rdx); // receiver |
| 1185 __ push(rcx); // key | 1185 __ push(rcx); // key |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1321 Condition cc = (check == ENABLE_INLINED_SMI_CHECK) | 1321 Condition cc = (check == ENABLE_INLINED_SMI_CHECK) |
| 1322 ? (*jmp_address == Assembler::kJncShortOpcode ? not_zero : zero) | 1322 ? (*jmp_address == Assembler::kJncShortOpcode ? not_zero : zero) |
| 1323 : (*jmp_address == Assembler::kJnzShortOpcode ? not_carry : carry); | 1323 : (*jmp_address == Assembler::kJnzShortOpcode ? not_carry : carry); |
| 1324 *jmp_address = static_cast<byte>(Assembler::kJccShortPrefix | cc); | 1324 *jmp_address = static_cast<byte>(Assembler::kJccShortPrefix | cc); |
| 1325 } | 1325 } |
| 1326 | 1326 |
| 1327 | 1327 |
| 1328 } } // namespace v8::internal | 1328 } } // namespace v8::internal |
| 1329 | 1329 |
| 1330 #endif // V8_TARGET_ARCH_X64 | 1330 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |