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 694 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
705 mode = AllocationSiteInfo::GetMode(FAST_DOUBLE_ELEMENTS, FAST_ELEMENTS); | 705 mode = AllocationSiteInfo::GetMode(FAST_DOUBLE_ELEMENTS, FAST_ELEMENTS); |
706 ElementsTransitionGenerator::GenerateDoubleToObject(masm, mode, slow); | 706 ElementsTransitionGenerator::GenerateDoubleToObject(masm, mode, slow); |
707 __ movq(rbx, FieldOperand(rdx, JSObject::kElementsOffset)); | 707 __ movq(rbx, FieldOperand(rdx, JSObject::kElementsOffset)); |
708 __ jmp(&finish_object_store); | 708 __ jmp(&finish_object_store); |
709 } | 709 } |
710 | 710 |
711 | 711 |
712 void KeyedStoreIC::GenerateGeneric(MacroAssembler* masm, | 712 void KeyedStoreIC::GenerateGeneric(MacroAssembler* masm, |
713 StrictModeFlag strict_mode) { | 713 StrictModeFlag strict_mode) { |
714 // ----------- S t a t e ------------- | 714 // ----------- S t a t e ------------- |
715 // -- rax : value | 715 // -- rax : value |
716 // -- rcx : key | 716 // -- rcx : key |
717 // -- rdx : receiver | 717 // -- rdx : receiver |
718 // -- rsp[0] : return address | 718 // -- rsp[0] : return address |
719 // ----------------------------------- | 719 // ----------------------------------- |
720 Label slow, slow_with_tagged_index, fast_object, fast_object_grow; | 720 Label slow, slow_with_tagged_index, fast_object, fast_object_grow; |
721 Label fast_double, fast_double_grow; | 721 Label fast_double, fast_double_grow; |
722 Label array, extra, check_if_double_array; | 722 Label array, extra, check_if_double_array; |
723 | 723 |
724 // Check that the object isn't a smi. | 724 // Check that the object isn't a smi. |
725 __ JumpIfSmi(rdx, &slow_with_tagged_index); | 725 __ JumpIfSmi(rdx, &slow_with_tagged_index); |
726 // Get the map from the receiver. | 726 // Get the map from the receiver. |
727 __ movq(r9, FieldOperand(rdx, HeapObject::kMapOffset)); | 727 __ movq(r9, FieldOperand(rdx, HeapObject::kMapOffset)); |
728 // Check that the receiver does not require access checks. We need | 728 // Check that the receiver does not require access checks. We need |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
863 no_reg); | 863 no_reg); |
864 | 864 |
865 __ bind(&miss); | 865 __ bind(&miss); |
866 } | 866 } |
867 | 867 |
868 | 868 |
869 static void GenerateFunctionTailCall(MacroAssembler* masm, | 869 static void GenerateFunctionTailCall(MacroAssembler* masm, |
870 int argc, | 870 int argc, |
871 Label* miss) { | 871 Label* miss) { |
872 // ----------- S t a t e ------------- | 872 // ----------- S t a t e ------------- |
873 // rcx : function name | 873 // rcx : function name |
874 // rdi : function | 874 // rdi : function |
875 // rsp[0] : return address | 875 // rsp[0] : return address |
876 // rsp[8] : argument argc | 876 // rsp[8] : argument argc |
877 // rsp[16] : argument argc - 1 | 877 // rsp[16] : argument argc - 1 |
878 // ... | 878 // ... |
879 // rsp[argc * 8] : argument 1 | 879 // rsp[argc * 8] : argument 1 |
880 // rsp[(argc + 1) * 8] : argument 0 = receiver | 880 // rsp[(argc + 1) * 8] : argument 0 = receiver |
881 // ----------------------------------- | 881 // ----------------------------------- |
882 __ JumpIfSmi(rdi, miss); | 882 __ JumpIfSmi(rdi, miss); |
883 // Check that the value is a JavaScript function. | 883 // Check that the value is a JavaScript function. |
884 __ CmpObjectType(rdi, JS_FUNCTION_TYPE, rdx); | 884 __ CmpObjectType(rdi, JS_FUNCTION_TYPE, rdx); |
885 __ j(not_equal, miss); | 885 __ j(not_equal, miss); |
886 | 886 |
887 // Invoke the function. | 887 // Invoke the function. |
888 ParameterCount actual(argc); | 888 ParameterCount actual(argc); |
889 __ InvokeFunction(rdi, actual, JUMP_FUNCTION, | 889 __ InvokeFunction(rdi, actual, JUMP_FUNCTION, |
890 NullCallWrapper(), CALL_AS_METHOD); | 890 NullCallWrapper(), CALL_AS_METHOD); |
891 } | 891 } |
892 | 892 |
893 | 893 |
894 // The generated code falls through if the call should be handled by runtime. | 894 // The generated code falls through if the call should be handled by runtime. |
895 void CallICBase::GenerateNormal(MacroAssembler* masm, int argc) { | 895 void CallICBase::GenerateNormal(MacroAssembler* masm, int argc) { |
896 // ----------- S t a t e ------------- | 896 // ----------- S t a t e ------------- |
897 // rcx : function name | 897 // rcx : function name |
898 // rsp[0] : return address | 898 // rsp[0] : return address |
899 // rsp[8] : argument argc | 899 // rsp[8] : argument argc |
900 // rsp[16] : argument argc - 1 | 900 // rsp[16] : argument argc - 1 |
901 // ... | 901 // ... |
902 // rsp[argc * 8] : argument 1 | 902 // rsp[argc * 8] : argument 1 |
903 // rsp[(argc + 1) * 8] : argument 0 = receiver | 903 // rsp[(argc + 1) * 8] : argument 0 = receiver |
904 // ----------------------------------- | 904 // ----------------------------------- |
905 Label miss; | 905 Label miss; |
906 | 906 |
907 // Get the receiver of the function from the stack. | 907 // Get the receiver of the function from the stack. |
908 __ movq(rdx, Operand(rsp, (argc + 1) * kPointerSize)); | 908 __ movq(rdx, Operand(rsp, (argc + 1) * kPointerSize)); |
909 | 909 |
910 GenerateNameDictionaryReceiverCheck(masm, rdx, rax, rbx, &miss); | 910 GenerateNameDictionaryReceiverCheck(masm, rdx, rax, rbx, &miss); |
911 | 911 |
912 // rax: elements | 912 // rax: elements |
913 // Search the dictionary placing the result in rdi. | 913 // Search the dictionary placing the result in rdi. |
914 GenerateDictionaryLoad(masm, &miss, rax, rcx, rbx, rdi, rdi); | 914 GenerateDictionaryLoad(masm, &miss, rax, rcx, rbx, rdi, rdi); |
915 | 915 |
916 GenerateFunctionTailCall(masm, argc, &miss); | 916 GenerateFunctionTailCall(masm, argc, &miss); |
917 | 917 |
918 __ bind(&miss); | 918 __ bind(&miss); |
919 } | 919 } |
920 | 920 |
921 | 921 |
922 void CallICBase::GenerateMiss(MacroAssembler* masm, | 922 void CallICBase::GenerateMiss(MacroAssembler* masm, |
923 int argc, | 923 int argc, |
924 IC::UtilityId id, | 924 IC::UtilityId id, |
925 Code::ExtraICState extra_state) { | 925 Code::ExtraICState extra_state) { |
926 // ----------- S t a t e ------------- | 926 // ----------- S t a t e ------------- |
927 // rcx : function name | 927 // rcx : function name |
928 // rsp[0] : return address | 928 // rsp[0] : return address |
929 // rsp[8] : argument argc | 929 // rsp[8] : argument argc |
930 // rsp[16] : argument argc - 1 | 930 // rsp[16] : argument argc - 1 |
931 // ... | 931 // ... |
932 // rsp[argc * 8] : argument 1 | 932 // rsp[argc * 8] : argument 1 |
933 // rsp[(argc + 1) * 8] : argument 0 = receiver | 933 // rsp[(argc + 1) * 8] : argument 0 = receiver |
934 // ----------------------------------- | 934 // ----------------------------------- |
935 | 935 |
936 Counters* counters = masm->isolate()->counters(); | 936 Counters* counters = masm->isolate()->counters(); |
937 if (id == IC::kCallIC_Miss) { | 937 if (id == IC::kCallIC_Miss) { |
938 __ IncrementCounter(counters->call_miss(), 1); | 938 __ IncrementCounter(counters->call_miss(), 1); |
939 } else { | 939 } else { |
940 __ IncrementCounter(counters->keyed_call_miss(), 1); | 940 __ IncrementCounter(counters->keyed_call_miss(), 1); |
941 } | 941 } |
942 | 942 |
943 // Get the receiver of the function from the stack; 1 ~ return address. | 943 // Get the receiver of the function from the stack; 1 ~ return address. |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
989 JUMP_FUNCTION, | 989 JUMP_FUNCTION, |
990 NullCallWrapper(), | 990 NullCallWrapper(), |
991 call_kind); | 991 call_kind); |
992 } | 992 } |
993 | 993 |
994 | 994 |
995 void CallIC::GenerateMegamorphic(MacroAssembler* masm, | 995 void CallIC::GenerateMegamorphic(MacroAssembler* masm, |
996 int argc, | 996 int argc, |
997 Code::ExtraICState extra_ic_state) { | 997 Code::ExtraICState extra_ic_state) { |
998 // ----------- S t a t e ------------- | 998 // ----------- S t a t e ------------- |
999 // rcx : function name | 999 // rcx : function name |
1000 // rsp[0] : return address | 1000 // rsp[0] : return address |
1001 // rsp[8] : argument argc | 1001 // rsp[8] : argument argc |
1002 // rsp[16] : argument argc - 1 | 1002 // rsp[16] : argument argc - 1 |
1003 // ... | 1003 // ... |
1004 // rsp[argc * 8] : argument 1 | 1004 // rsp[argc * 8] : argument 1 |
1005 // rsp[(argc + 1) * 8] : argument 0 = receiver | 1005 // rsp[(argc + 1) * 8] : argument 0 = receiver |
1006 // ----------------------------------- | 1006 // ----------------------------------- |
1007 | 1007 |
1008 // Get the receiver of the function from the stack; 1 ~ return address. | 1008 // Get the receiver of the function from the stack; 1 ~ return address. |
1009 __ movq(rdx, Operand(rsp, (argc + 1) * kPointerSize)); | 1009 __ movq(rdx, Operand(rsp, (argc + 1) * kPointerSize)); |
1010 GenerateMonomorphicCacheProbe(masm, argc, Code::CALL_IC, extra_ic_state); | 1010 GenerateMonomorphicCacheProbe(masm, argc, Code::CALL_IC, extra_ic_state); |
1011 GenerateMiss(masm, argc, extra_ic_state); | 1011 GenerateMiss(masm, argc, extra_ic_state); |
1012 } | 1012 } |
1013 | 1013 |
1014 | 1014 |
1015 void KeyedCallIC::GenerateMegamorphic(MacroAssembler* masm, int argc) { | 1015 void KeyedCallIC::GenerateMegamorphic(MacroAssembler* masm, int argc) { |
1016 // ----------- S t a t e ------------- | 1016 // ----------- S t a t e ------------- |
1017 // rcx : function name | 1017 // rcx : function name |
1018 // rsp[0] : return address | 1018 // rsp[0] : return address |
1019 // rsp[8] : argument argc | 1019 // rsp[8] : argument argc |
1020 // rsp[16] : argument argc - 1 | 1020 // rsp[16] : argument argc - 1 |
1021 // ... | 1021 // ... |
1022 // rsp[argc * 8] : argument 1 | 1022 // rsp[argc * 8] : argument 1 |
1023 // rsp[(argc + 1) * 8] : argument 0 = receiver | 1023 // rsp[(argc + 1) * 8] : argument 0 = receiver |
1024 // ----------------------------------- | 1024 // ----------------------------------- |
1025 | 1025 |
1026 // Get the receiver of the function from the stack; 1 ~ return address. | 1026 // Get the receiver of the function from the stack; 1 ~ return address. |
1027 __ movq(rdx, Operand(rsp, (argc + 1) * kPointerSize)); | 1027 __ movq(rdx, Operand(rsp, (argc + 1) * kPointerSize)); |
1028 | 1028 |
1029 Label do_call, slow_call, slow_load; | 1029 Label do_call, slow_call, slow_load; |
1030 Label check_number_dictionary, check_name, lookup_monomorphic_cache; | 1030 Label check_number_dictionary, check_name, lookup_monomorphic_cache; |
1031 Label index_smi, index_name; | 1031 Label index_smi, index_name; |
1032 | 1032 |
1033 // Check that the key is a smi. | 1033 // Check that the key is a smi. |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1118 | 1118 |
1119 __ bind(&index_name); | 1119 __ bind(&index_name); |
1120 __ IndexFromHash(rbx, rcx); | 1120 __ IndexFromHash(rbx, rcx); |
1121 // Now jump to the place where smi keys are handled. | 1121 // Now jump to the place where smi keys are handled. |
1122 __ jmp(&index_smi); | 1122 __ jmp(&index_smi); |
1123 } | 1123 } |
1124 | 1124 |
1125 | 1125 |
1126 void KeyedCallIC::GenerateNormal(MacroAssembler* masm, int argc) { | 1126 void KeyedCallIC::GenerateNormal(MacroAssembler* masm, int argc) { |
1127 // ----------- S t a t e ------------- | 1127 // ----------- S t a t e ------------- |
1128 // rcx : function name | 1128 // rcx : function name |
1129 // rsp[0] : return address | 1129 // rsp[0] : return address |
1130 // rsp[8] : argument argc | 1130 // rsp[8] : argument argc |
1131 // rsp[16] : argument argc - 1 | 1131 // rsp[16] : argument argc - 1 |
1132 // ... | 1132 // ... |
1133 // rsp[argc * 8] : argument 1 | 1133 // rsp[argc * 8] : argument 1 |
1134 // rsp[(argc + 1) * 8] : argument 0 = receiver | 1134 // rsp[(argc + 1) * 8] : argument 0 = receiver |
1135 // ----------------------------------- | 1135 // ----------------------------------- |
1136 | 1136 |
1137 // Check if the name is really a name. | 1137 // Check if the name is really a name. |
1138 Label miss; | 1138 Label miss; |
1139 __ JumpIfSmi(rcx, &miss); | 1139 __ JumpIfSmi(rcx, &miss); |
1140 Condition cond = masm->IsObjectNameType(rcx, rax, rax); | 1140 Condition cond = masm->IsObjectNameType(rcx, rax, rax); |
1141 __ j(NegateCondition(cond), &miss); | 1141 __ j(NegateCondition(cond), &miss); |
1142 CallICBase::GenerateNormal(masm, argc); | 1142 CallICBase::GenerateNormal(masm, argc); |
1143 __ bind(&miss); | 1143 __ bind(&miss); |
1144 GenerateMiss(masm, argc); | 1144 GenerateMiss(masm, argc); |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1223 scratch, | 1223 scratch, |
1224 times_pointer_size, | 1224 times_pointer_size, |
1225 FixedArray::kHeaderSize); | 1225 FixedArray::kHeaderSize); |
1226 } | 1226 } |
1227 | 1227 |
1228 | 1228 |
1229 void KeyedLoadIC::GenerateNonStrictArguments(MacroAssembler* masm) { | 1229 void KeyedLoadIC::GenerateNonStrictArguments(MacroAssembler* masm) { |
1230 // ----------- S t a t e ------------- | 1230 // ----------- S t a t e ------------- |
1231 // -- rax : key | 1231 // -- rax : key |
1232 // -- rdx : receiver | 1232 // -- rdx : receiver |
1233 // -- rsp[0] : return address | 1233 // -- rsp[0] : return address |
1234 // ----------------------------------- | 1234 // ----------------------------------- |
1235 Label slow, notin; | 1235 Label slow, notin; |
1236 Operand mapped_location = | 1236 Operand mapped_location = |
1237 GenerateMappedArgumentsLookup( | 1237 GenerateMappedArgumentsLookup( |
1238 masm, rdx, rax, rbx, rcx, rdi, ¬in, &slow); | 1238 masm, rdx, rax, rbx, rcx, rdi, ¬in, &slow); |
1239 __ movq(rax, mapped_location); | 1239 __ movq(rax, mapped_location); |
1240 __ Ret(); | 1240 __ Ret(); |
1241 __ bind(¬in); | 1241 __ bind(¬in); |
1242 // The unmapped lookup expects that the parameter map is in rbx. | 1242 // The unmapped lookup expects that the parameter map is in rbx. |
1243 Operand unmapped_location = | 1243 Operand unmapped_location = |
1244 GenerateUnmappedArgumentsLookup(masm, rax, rbx, rcx, &slow); | 1244 GenerateUnmappedArgumentsLookup(masm, rax, rbx, rcx, &slow); |
1245 __ CompareRoot(unmapped_location, Heap::kTheHoleValueRootIndex); | 1245 __ CompareRoot(unmapped_location, Heap::kTheHoleValueRootIndex); |
1246 __ j(equal, &slow); | 1246 __ j(equal, &slow); |
1247 __ movq(rax, unmapped_location); | 1247 __ movq(rax, unmapped_location); |
1248 __ Ret(); | 1248 __ Ret(); |
1249 __ bind(&slow); | 1249 __ bind(&slow); |
1250 GenerateMiss(masm, MISS); | 1250 GenerateMiss(masm, MISS); |
1251 } | 1251 } |
1252 | 1252 |
1253 | 1253 |
1254 void KeyedStoreIC::GenerateNonStrictArguments(MacroAssembler* masm) { | 1254 void KeyedStoreIC::GenerateNonStrictArguments(MacroAssembler* masm) { |
1255 // ----------- S t a t e ------------- | 1255 // ----------- S t a t e ------------- |
1256 // -- rax : value | 1256 // -- rax : value |
1257 // -- rcx : key | 1257 // -- rcx : key |
1258 // -- rdx : receiver | 1258 // -- rdx : receiver |
1259 // -- rsp[0] : return address | 1259 // -- rsp[0] : return address |
1260 // ----------------------------------- | 1260 // ----------------------------------- |
1261 Label slow, notin; | 1261 Label slow, notin; |
1262 Operand mapped_location = GenerateMappedArgumentsLookup( | 1262 Operand mapped_location = GenerateMappedArgumentsLookup( |
1263 masm, rdx, rcx, rbx, rdi, r8, ¬in, &slow); | 1263 masm, rdx, rcx, rbx, rdi, r8, ¬in, &slow); |
1264 __ movq(mapped_location, rax); | 1264 __ movq(mapped_location, rax); |
1265 __ lea(r9, mapped_location); | 1265 __ lea(r9, mapped_location); |
1266 __ movq(r8, rax); | 1266 __ movq(r8, rax); |
1267 __ RecordWrite(rbx, | 1267 __ RecordWrite(rbx, |
1268 r9, | 1268 r9, |
1269 r8, | 1269 r8, |
(...skipping 16 matching lines...) Expand all Loading... |
1286 INLINE_SMI_CHECK); | 1286 INLINE_SMI_CHECK); |
1287 __ Ret(); | 1287 __ Ret(); |
1288 __ bind(&slow); | 1288 __ bind(&slow); |
1289 GenerateMiss(masm, MISS); | 1289 GenerateMiss(masm, MISS); |
1290 } | 1290 } |
1291 | 1291 |
1292 | 1292 |
1293 void KeyedCallIC::GenerateNonStrictArguments(MacroAssembler* masm, | 1293 void KeyedCallIC::GenerateNonStrictArguments(MacroAssembler* masm, |
1294 int argc) { | 1294 int argc) { |
1295 // ----------- S t a t e ------------- | 1295 // ----------- S t a t e ------------- |
1296 // rcx : function name | 1296 // rcx : function name |
1297 // rsp[0] : return address | 1297 // rsp[0] : return address |
1298 // rsp[8] : argument argc | 1298 // rsp[8] : argument argc |
1299 // rsp[16] : argument argc - 1 | 1299 // rsp[16] : argument argc - 1 |
1300 // ... | 1300 // ... |
1301 // rsp[argc * 8] : argument 1 | 1301 // rsp[argc * 8] : argument 1 |
1302 // rsp[(argc + 1) * 8] : argument 0 = receiver | 1302 // rsp[(argc + 1) * 8] : argument 0 = receiver |
1303 // ----------------------------------- | 1303 // ----------------------------------- |
1304 Label slow, notin; | 1304 Label slow, notin; |
1305 __ movq(rdx, Operand(rsp, (argc + 1) * kPointerSize)); | 1305 __ movq(rdx, Operand(rsp, (argc + 1) * kPointerSize)); |
1306 Operand mapped_location = GenerateMappedArgumentsLookup( | 1306 Operand mapped_location = GenerateMappedArgumentsLookup( |
1307 masm, rdx, rcx, rbx, rax, r8, ¬in, &slow); | 1307 masm, rdx, rcx, rbx, rax, r8, ¬in, &slow); |
1308 __ movq(rdi, mapped_location); | 1308 __ movq(rdi, mapped_location); |
1309 GenerateFunctionTailCall(masm, argc, &slow); | 1309 GenerateFunctionTailCall(masm, argc, &slow); |
1310 __ bind(¬in); | 1310 __ bind(¬in); |
1311 // The unmapped lookup expects that the parameter map is in rbx. | 1311 // The unmapped lookup expects that the parameter map is in rbx. |
1312 Operand unmapped_location = | 1312 Operand unmapped_location = |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1378 ExternalReference ref = | 1378 ExternalReference ref = |
1379 ExternalReference(IC_Utility(kLoadIC_Miss), masm->isolate()); | 1379 ExternalReference(IC_Utility(kLoadIC_Miss), masm->isolate()); |
1380 __ TailCallExternalReference(ref, 2, 1); | 1380 __ TailCallExternalReference(ref, 2, 1); |
1381 } | 1381 } |
1382 | 1382 |
1383 | 1383 |
1384 void LoadIC::GenerateRuntimeGetProperty(MacroAssembler* masm) { | 1384 void LoadIC::GenerateRuntimeGetProperty(MacroAssembler* masm) { |
1385 // ----------- S t a t e ------------- | 1385 // ----------- S t a t e ------------- |
1386 // -- rax : receiver | 1386 // -- rax : receiver |
1387 // -- rcx : name | 1387 // -- rcx : name |
1388 // -- rsp[0] : return address | 1388 // -- rsp[0] : return address |
1389 // ----------------------------------- | 1389 // ----------------------------------- |
1390 | 1390 |
1391 __ pop(rbx); | 1391 __ pop(rbx); |
1392 __ push(rax); // receiver | 1392 __ push(rax); // receiver |
1393 __ push(rcx); // name | 1393 __ push(rcx); // name |
1394 __ push(rbx); // return address | 1394 __ push(rbx); // return address |
1395 | 1395 |
1396 // Perform tail call to the entry. | 1396 // Perform tail call to the entry. |
1397 __ TailCallRuntime(Runtime::kGetProperty, 2, 1); | 1397 __ TailCallRuntime(Runtime::kGetProperty, 2, 1); |
1398 } | 1398 } |
1399 | 1399 |
1400 | 1400 |
1401 void KeyedLoadIC::GenerateMiss(MacroAssembler* masm, ICMissMode miss_mode) { | 1401 void KeyedLoadIC::GenerateMiss(MacroAssembler* masm, ICMissMode miss_mode) { |
1402 // ----------- S t a t e ------------- | 1402 // ----------- S t a t e ------------- |
1403 // -- rax : key | 1403 // -- rax : key |
1404 // -- rdx : receiver | 1404 // -- rdx : receiver |
1405 // -- rsp[0] : return address | 1405 // -- rsp[0] : return address |
1406 // ----------------------------------- | 1406 // ----------------------------------- |
1407 | 1407 |
1408 Counters* counters = masm->isolate()->counters(); | 1408 Counters* counters = masm->isolate()->counters(); |
1409 __ IncrementCounter(counters->keyed_load_miss(), 1); | 1409 __ IncrementCounter(counters->keyed_load_miss(), 1); |
1410 | 1410 |
1411 __ pop(rbx); | 1411 __ pop(rbx); |
1412 __ push(rdx); // receiver | 1412 __ push(rdx); // receiver |
1413 __ push(rax); // name | 1413 __ push(rax); // name |
1414 __ push(rbx); // return address | 1414 __ push(rbx); // return address |
1415 | 1415 |
1416 // Perform tail call to the entry. | 1416 // Perform tail call to the entry. |
1417 ExternalReference ref = miss_mode == MISS_FORCE_GENERIC | 1417 ExternalReference ref = miss_mode == MISS_FORCE_GENERIC |
1418 ? ExternalReference(IC_Utility(kKeyedLoadIC_MissForceGeneric), | 1418 ? ExternalReference(IC_Utility(kKeyedLoadIC_MissForceGeneric), |
1419 masm->isolate()) | 1419 masm->isolate()) |
1420 : ExternalReference(IC_Utility(kKeyedLoadIC_Miss), masm->isolate()); | 1420 : ExternalReference(IC_Utility(kKeyedLoadIC_Miss), masm->isolate()); |
1421 __ TailCallExternalReference(ref, 2, 1); | 1421 __ TailCallExternalReference(ref, 2, 1); |
1422 } | 1422 } |
1423 | 1423 |
1424 | 1424 |
1425 void KeyedLoadIC::GenerateRuntimeGetProperty(MacroAssembler* masm) { | 1425 void KeyedLoadIC::GenerateRuntimeGetProperty(MacroAssembler* masm) { |
1426 // ----------- S t a t e ------------- | 1426 // ----------- S t a t e ------------- |
1427 // -- rax : key | 1427 // -- rax : key |
1428 // -- rdx : receiver | 1428 // -- rdx : receiver |
1429 // -- rsp[0] : return address | 1429 // -- rsp[0] : return address |
1430 // ----------------------------------- | 1430 // ----------------------------------- |
1431 | 1431 |
1432 __ pop(rbx); | 1432 __ pop(rbx); |
1433 __ push(rdx); // receiver | 1433 __ push(rdx); // receiver |
1434 __ push(rax); // name | 1434 __ push(rax); // name |
1435 __ push(rbx); // return address | 1435 __ push(rbx); // return address |
1436 | 1436 |
1437 // Perform tail call to the entry. | 1437 // Perform tail call to the entry. |
1438 __ TailCallRuntime(Runtime::kKeyedGetProperty, 2, 1); | 1438 __ TailCallRuntime(Runtime::kKeyedGetProperty, 2, 1); |
1439 } | 1439 } |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1520 __ push(rbx); // return address | 1520 __ push(rbx); // return address |
1521 | 1521 |
1522 // Do tail-call to runtime routine. | 1522 // Do tail-call to runtime routine. |
1523 __ TailCallRuntime(Runtime::kSetProperty, 5, 1); | 1523 __ TailCallRuntime(Runtime::kSetProperty, 5, 1); |
1524 } | 1524 } |
1525 | 1525 |
1526 | 1526 |
1527 void KeyedStoreIC::GenerateRuntimeSetProperty(MacroAssembler* masm, | 1527 void KeyedStoreIC::GenerateRuntimeSetProperty(MacroAssembler* masm, |
1528 StrictModeFlag strict_mode) { | 1528 StrictModeFlag strict_mode) { |
1529 // ----------- S t a t e ------------- | 1529 // ----------- S t a t e ------------- |
1530 // -- rax : value | 1530 // -- rax : value |
1531 // -- rcx : key | 1531 // -- rcx : key |
1532 // -- rdx : receiver | 1532 // -- rdx : receiver |
1533 // -- rsp[0] : return address | 1533 // -- rsp[0] : return address |
1534 // ----------------------------------- | 1534 // ----------------------------------- |
1535 | 1535 |
1536 __ pop(rbx); | 1536 __ pop(rbx); |
1537 __ push(rdx); // receiver | 1537 __ push(rdx); // receiver |
1538 __ push(rcx); // key | 1538 __ push(rcx); // key |
1539 __ push(rax); // value | 1539 __ push(rax); // value |
1540 __ Push(Smi::FromInt(NONE)); // PropertyAttributes | 1540 __ Push(Smi::FromInt(NONE)); // PropertyAttributes |
1541 __ Push(Smi::FromInt(strict_mode)); // Strict mode. | 1541 __ Push(Smi::FromInt(strict_mode)); // Strict mode. |
1542 __ push(rbx); // return address | 1542 __ push(rbx); // return address |
1543 | 1543 |
1544 // Do tail-call to runtime routine. | 1544 // Do tail-call to runtime routine. |
1545 __ TailCallRuntime(Runtime::kSetProperty, 5, 1); | 1545 __ TailCallRuntime(Runtime::kSetProperty, 5, 1); |
1546 } | 1546 } |
1547 | 1547 |
1548 | 1548 |
1549 void StoreIC::GenerateSlow(MacroAssembler* masm) { | 1549 void StoreIC::GenerateSlow(MacroAssembler* masm) { |
1550 // ----------- S t a t e ------------- | 1550 // ----------- S t a t e ------------- |
1551 // -- rax : value | 1551 // -- rax : value |
1552 // -- rcx : key | 1552 // -- rcx : key |
1553 // -- rdx : receiver | 1553 // -- rdx : receiver |
1554 // -- rsp[0] : return address | 1554 // -- rsp[0] : return address |
1555 // ----------------------------------- | 1555 // ----------------------------------- |
1556 | 1556 |
1557 __ pop(rbx); | 1557 __ pop(rbx); |
1558 __ push(rdx); // receiver | 1558 __ push(rdx); // receiver |
1559 __ push(rcx); // key | 1559 __ push(rcx); // key |
1560 __ push(rax); // value | 1560 __ push(rax); // value |
1561 __ push(rbx); // return address | 1561 __ push(rbx); // return address |
1562 | 1562 |
1563 // Do tail-call to runtime routine. | 1563 // Do tail-call to runtime routine. |
1564 ExternalReference ref(IC_Utility(kStoreIC_Slow), masm->isolate()); | 1564 ExternalReference ref(IC_Utility(kStoreIC_Slow), masm->isolate()); |
1565 __ TailCallExternalReference(ref, 3, 1); | 1565 __ TailCallExternalReference(ref, 3, 1); |
1566 } | 1566 } |
1567 | 1567 |
1568 | 1568 |
1569 void KeyedStoreIC::GenerateSlow(MacroAssembler* masm) { | 1569 void KeyedStoreIC::GenerateSlow(MacroAssembler* masm) { |
1570 // ----------- S t a t e ------------- | 1570 // ----------- S t a t e ------------- |
1571 // -- rax : value | 1571 // -- rax : value |
1572 // -- rcx : key | 1572 // -- rcx : key |
1573 // -- rdx : receiver | 1573 // -- rdx : receiver |
1574 // -- rsp[0] : return address | 1574 // -- rsp[0] : return address |
1575 // ----------------------------------- | 1575 // ----------------------------------- |
1576 | 1576 |
1577 __ pop(rbx); | 1577 __ pop(rbx); |
1578 __ push(rdx); // receiver | 1578 __ push(rdx); // receiver |
1579 __ push(rcx); // key | 1579 __ push(rcx); // key |
1580 __ push(rax); // value | 1580 __ push(rax); // value |
1581 __ push(rbx); // return address | 1581 __ push(rbx); // return address |
1582 | 1582 |
1583 // Do tail-call to runtime routine. | 1583 // Do tail-call to runtime routine. |
1584 ExternalReference ref(IC_Utility(kKeyedStoreIC_Slow), masm->isolate()); | 1584 ExternalReference ref(IC_Utility(kKeyedStoreIC_Slow), masm->isolate()); |
1585 __ TailCallExternalReference(ref, 3, 1); | 1585 __ TailCallExternalReference(ref, 3, 1); |
1586 } | 1586 } |
1587 | 1587 |
1588 | 1588 |
1589 void KeyedStoreIC::GenerateMiss(MacroAssembler* masm, ICMissMode miss_mode) { | 1589 void KeyedStoreIC::GenerateMiss(MacroAssembler* masm, ICMissMode miss_mode) { |
1590 // ----------- S t a t e ------------- | 1590 // ----------- S t a t e ------------- |
1591 // -- rax : value | 1591 // -- rax : value |
1592 // -- rcx : key | 1592 // -- rcx : key |
1593 // -- rdx : receiver | 1593 // -- rdx : receiver |
1594 // -- rsp[0] : return address | 1594 // -- rsp[0] : return address |
1595 // ----------------------------------- | 1595 // ----------------------------------- |
1596 | 1596 |
1597 __ pop(rbx); | 1597 __ pop(rbx); |
1598 __ push(rdx); // receiver | 1598 __ push(rdx); // receiver |
1599 __ push(rcx); // key | 1599 __ push(rcx); // key |
1600 __ push(rax); // value | 1600 __ push(rax); // value |
1601 __ push(rbx); // return address | 1601 __ push(rbx); // return address |
1602 | 1602 |
1603 // Do tail-call to runtime routine. | 1603 // Do tail-call to runtime routine. |
1604 ExternalReference ref = miss_mode == MISS_FORCE_GENERIC | 1604 ExternalReference ref = miss_mode == MISS_FORCE_GENERIC |
1605 ? ExternalReference(IC_Utility(kKeyedStoreIC_MissForceGeneric), | 1605 ? ExternalReference(IC_Utility(kKeyedStoreIC_MissForceGeneric), |
1606 masm->isolate()) | 1606 masm->isolate()) |
1607 : ExternalReference(IC_Utility(kKeyedStoreIC_Miss), masm->isolate()); | 1607 : ExternalReference(IC_Utility(kKeyedStoreIC_Miss), masm->isolate()); |
1608 __ TailCallExternalReference(ref, 3, 1); | 1608 __ TailCallExternalReference(ref, 3, 1); |
1609 } | 1609 } |
1610 | 1610 |
1611 | 1611 |
1612 void KeyedStoreIC::GenerateTransitionElementsSmiToDouble(MacroAssembler* masm) { | 1612 void KeyedStoreIC::GenerateTransitionElementsSmiToDouble(MacroAssembler* masm) { |
1613 // ----------- S t a t e ------------- | 1613 // ----------- S t a t e ------------- |
1614 // -- rbx : target map | 1614 // -- rbx : target map |
1615 // -- rdx : receiver | 1615 // -- rdx : receiver |
1616 // -- rsp[0] : return address | 1616 // -- rsp[0] : return address |
1617 // ----------------------------------- | 1617 // ----------------------------------- |
1618 // Must return the modified receiver in eax. | 1618 // Must return the modified receiver in eax. |
1619 if (!FLAG_trace_elements_transitions) { | 1619 if (!FLAG_trace_elements_transitions) { |
1620 Label fail; | 1620 Label fail; |
1621 AllocationSiteMode mode = AllocationSiteInfo::GetMode(FAST_SMI_ELEMENTS, | 1621 AllocationSiteMode mode = AllocationSiteInfo::GetMode(FAST_SMI_ELEMENTS, |
1622 FAST_DOUBLE_ELEMENTS); | 1622 FAST_DOUBLE_ELEMENTS); |
1623 ElementsTransitionGenerator::GenerateSmiToDouble(masm, mode, &fail); | 1623 ElementsTransitionGenerator::GenerateSmiToDouble(masm, mode, &fail); |
1624 __ movq(rax, rdx); | 1624 __ movq(rax, rdx); |
1625 __ Ret(); | 1625 __ Ret(); |
1626 __ bind(&fail); | 1626 __ bind(&fail); |
1627 } | 1627 } |
1628 | 1628 |
1629 __ pop(rbx); | 1629 __ pop(rbx); |
1630 __ push(rdx); | 1630 __ push(rdx); |
1631 __ push(rbx); // return address | 1631 __ push(rbx); // return address |
1632 __ TailCallRuntime(Runtime::kTransitionElementsSmiToDouble, 1, 1); | 1632 __ TailCallRuntime(Runtime::kTransitionElementsSmiToDouble, 1, 1); |
1633 } | 1633 } |
1634 | 1634 |
1635 | 1635 |
1636 void KeyedStoreIC::GenerateTransitionElementsDoubleToObject( | 1636 void KeyedStoreIC::GenerateTransitionElementsDoubleToObject( |
1637 MacroAssembler* masm) { | 1637 MacroAssembler* masm) { |
1638 // ----------- S t a t e ------------- | 1638 // ----------- S t a t e ------------- |
1639 // -- rbx : target map | 1639 // -- rbx : target map |
1640 // -- rdx : receiver | 1640 // -- rdx : receiver |
1641 // -- rsp[0] : return address | 1641 // -- rsp[0] : return address |
1642 // ----------------------------------- | 1642 // ----------------------------------- |
1643 // Must return the modified receiver in eax. | 1643 // Must return the modified receiver in eax. |
1644 if (!FLAG_trace_elements_transitions) { | 1644 if (!FLAG_trace_elements_transitions) { |
1645 Label fail; | 1645 Label fail; |
1646 AllocationSiteMode mode = AllocationSiteInfo::GetMode(FAST_DOUBLE_ELEMENTS, | 1646 AllocationSiteMode mode = AllocationSiteInfo::GetMode(FAST_DOUBLE_ELEMENTS, |
1647 FAST_ELEMENTS); | 1647 FAST_ELEMENTS); |
1648 ElementsTransitionGenerator::GenerateDoubleToObject(masm, mode, &fail); | 1648 ElementsTransitionGenerator::GenerateDoubleToObject(masm, mode, &fail); |
1649 __ movq(rax, rdx); | 1649 __ movq(rax, rdx); |
1650 __ Ret(); | 1650 __ Ret(); |
1651 __ bind(&fail); | 1651 __ bind(&fail); |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1725 Condition cc = (check == ENABLE_INLINED_SMI_CHECK) | 1725 Condition cc = (check == ENABLE_INLINED_SMI_CHECK) |
1726 ? (*jmp_address == Assembler::kJncShortOpcode ? not_zero : zero) | 1726 ? (*jmp_address == Assembler::kJncShortOpcode ? not_zero : zero) |
1727 : (*jmp_address == Assembler::kJnzShortOpcode ? not_carry : carry); | 1727 : (*jmp_address == Assembler::kJnzShortOpcode ? not_carry : carry); |
1728 *jmp_address = static_cast<byte>(Assembler::kJccShortPrefix | cc); | 1728 *jmp_address = static_cast<byte>(Assembler::kJccShortPrefix | cc); |
1729 } | 1729 } |
1730 | 1730 |
1731 | 1731 |
1732 } } // namespace v8::internal | 1732 } } // namespace v8::internal |
1733 | 1733 |
1734 #endif // V8_TARGET_ARCH_X64 | 1734 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |