OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 688 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
699 Factory::the_hole_value()); | 699 Factory::the_hole_value()); |
700 __ j(not_equal, miss); | 700 __ j(not_equal, miss); |
701 return cell; | 701 return cell; |
702 } | 702 } |
703 | 703 |
704 | 704 |
705 #undef __ | 705 #undef __ |
706 | 706 |
707 #define __ ACCESS_MASM((masm())) | 707 #define __ ACCESS_MASM((masm())) |
708 | 708 |
| 709 |
| 710 void CallStubCompiler::GenerateNameCheck(String* name, Label* miss) { |
| 711 if (kind_ == Code::KEYED_CALL_IC) { |
| 712 __ Cmp(rcx, Handle<String>(name)); |
| 713 __ j(not_equal, miss); |
| 714 } |
| 715 } |
| 716 |
| 717 |
709 void CallStubCompiler::GenerateMissBranch() { | 718 void CallStubCompiler::GenerateMissBranch() { |
710 Handle<Code> ic = ComputeCallMiss(arguments().immediate(), kind_); | 719 Handle<Code> ic = ComputeCallMiss(arguments().immediate(), kind_); |
711 __ Jump(ic, RelocInfo::CODE_TARGET); | 720 __ Jump(ic, RelocInfo::CODE_TARGET); |
712 } | 721 } |
713 | 722 |
714 | 723 |
715 Object* CallStubCompiler::CompileCallConstant(Object* object, | 724 Object* CallStubCompiler::CompileCallConstant(Object* object, |
716 JSObject* holder, | 725 JSObject* holder, |
717 JSFunction* function, | 726 JSFunction* function, |
718 String* name, | 727 String* name, |
(...skipping 14 matching lines...) Expand all Loading... |
733 Object* result = | 742 Object* result = |
734 CompileCustomCall(id, object, holder, function, name, check); | 743 CompileCustomCall(id, object, holder, function, name, check); |
735 // undefined means bail out to regular compiler. | 744 // undefined means bail out to regular compiler. |
736 if (!result->IsUndefined()) { | 745 if (!result->IsUndefined()) { |
737 return result; | 746 return result; |
738 } | 747 } |
739 } | 748 } |
740 | 749 |
741 Label miss_in_smi_check; | 750 Label miss_in_smi_check; |
742 | 751 |
| 752 GenerateNameCheck(name, &miss_in_smi_check); |
| 753 |
743 // Get the receiver from the stack. | 754 // Get the receiver from the stack. |
744 const int argc = arguments().immediate(); | 755 const int argc = arguments().immediate(); |
745 __ movq(rdx, Operand(rsp, (argc + 1) * kPointerSize)); | 756 __ movq(rdx, Operand(rsp, (argc + 1) * kPointerSize)); |
746 | 757 |
747 // Check that the receiver isn't a smi. | 758 // Check that the receiver isn't a smi. |
748 if (check != NUMBER_CHECK) { | 759 if (check != NUMBER_CHECK) { |
749 __ JumpIfSmi(rdx, &miss_in_smi_check); | 760 __ JumpIfSmi(rdx, &miss_in_smi_check); |
750 } | 761 } |
751 | 762 |
752 // Make sure that it's okay not to patch the on stack receiver | 763 // Make sure that it's okay not to patch the on stack receiver |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
874 // rcx : function name | 885 // rcx : function name |
875 // rsp[0] : return address | 886 // rsp[0] : return address |
876 // rsp[8] : argument argc | 887 // rsp[8] : argument argc |
877 // rsp[16] : argument argc - 1 | 888 // rsp[16] : argument argc - 1 |
878 // ... | 889 // ... |
879 // rsp[argc * 8] : argument 1 | 890 // rsp[argc * 8] : argument 1 |
880 // rsp[(argc + 1) * 8] : argument 0 = receiver | 891 // rsp[(argc + 1) * 8] : argument 0 = receiver |
881 // ----------------------------------- | 892 // ----------------------------------- |
882 Label miss; | 893 Label miss; |
883 | 894 |
| 895 GenerateNameCheck(name, &miss); |
| 896 |
884 // Get the receiver from the stack. | 897 // Get the receiver from the stack. |
885 const int argc = arguments().immediate(); | 898 const int argc = arguments().immediate(); |
886 __ movq(rdx, Operand(rsp, (argc + 1) * kPointerSize)); | 899 __ movq(rdx, Operand(rsp, (argc + 1) * kPointerSize)); |
887 | 900 |
888 // Check that the receiver isn't a smi. | 901 // Check that the receiver isn't a smi. |
889 __ JumpIfSmi(rdx, &miss); | 902 __ JumpIfSmi(rdx, &miss); |
890 | 903 |
891 // Do the right check and compute the holder register. | 904 // Do the right check and compute the holder register. |
892 Register reg = CheckPrototypes(object, rdx, holder, rbx, rax, name, &miss); | 905 Register reg = CheckPrototypes(object, rdx, holder, rbx, rax, name, &miss); |
893 | 906 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
931 // ----------------------------------- | 944 // ----------------------------------- |
932 ASSERT(check == RECEIVER_MAP_CHECK); | 945 ASSERT(check == RECEIVER_MAP_CHECK); |
933 | 946 |
934 // If object is not an array, bail out to regular call. | 947 // If object is not an array, bail out to regular call. |
935 if (!object->IsJSArray()) { | 948 if (!object->IsJSArray()) { |
936 return Heap::undefined_value(); | 949 return Heap::undefined_value(); |
937 } | 950 } |
938 | 951 |
939 Label miss; | 952 Label miss; |
940 | 953 |
| 954 GenerateNameCheck(name, &miss); |
| 955 |
941 // Get the receiver from the stack. | 956 // Get the receiver from the stack. |
942 const int argc = arguments().immediate(); | 957 const int argc = arguments().immediate(); |
943 __ movq(rdx, Operand(rsp, (argc + 1) * kPointerSize)); | 958 __ movq(rdx, Operand(rsp, (argc + 1) * kPointerSize)); |
944 | 959 |
945 // Check that the receiver isn't a smi. | 960 // Check that the receiver isn't a smi. |
946 __ JumpIfSmi(rdx, &miss); | 961 __ JumpIfSmi(rdx, &miss); |
947 | 962 |
948 CheckPrototypes(JSObject::cast(object), | 963 CheckPrototypes(JSObject::cast(object), |
949 rdx, | 964 rdx, |
950 holder, | 965 holder, |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1085 // ----------------------------------- | 1100 // ----------------------------------- |
1086 ASSERT(check == RECEIVER_MAP_CHECK); | 1101 ASSERT(check == RECEIVER_MAP_CHECK); |
1087 | 1102 |
1088 // If object is not an array, bail out to regular call. | 1103 // If object is not an array, bail out to regular call. |
1089 if (!object->IsJSArray()) { | 1104 if (!object->IsJSArray()) { |
1090 return Heap::undefined_value(); | 1105 return Heap::undefined_value(); |
1091 } | 1106 } |
1092 | 1107 |
1093 Label miss, return_undefined, call_builtin; | 1108 Label miss, return_undefined, call_builtin; |
1094 | 1109 |
| 1110 GenerateNameCheck(name, &miss); |
| 1111 |
1095 // Get the receiver from the stack. | 1112 // Get the receiver from the stack. |
1096 const int argc = arguments().immediate(); | 1113 const int argc = arguments().immediate(); |
1097 __ movq(rdx, Operand(rsp, (argc + 1) * kPointerSize)); | 1114 __ movq(rdx, Operand(rsp, (argc + 1) * kPointerSize)); |
1098 | 1115 |
1099 // Check that the receiver isn't a smi. | 1116 // Check that the receiver isn't a smi. |
1100 __ JumpIfSmi(rdx, &miss); | 1117 __ JumpIfSmi(rdx, &miss); |
1101 | 1118 |
1102 CheckPrototypes(JSObject::cast(object), rdx, | 1119 CheckPrototypes(JSObject::cast(object), rdx, |
1103 holder, rbx, | 1120 holder, rbx, |
1104 rax, name, &miss); | 1121 rax, name, &miss); |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1183 // rcx : function name | 1200 // rcx : function name |
1184 // rsp[0] : return address | 1201 // rsp[0] : return address |
1185 // rsp[8] : argument argc | 1202 // rsp[8] : argument argc |
1186 // rsp[16] : argument argc - 1 | 1203 // rsp[16] : argument argc - 1 |
1187 // ... | 1204 // ... |
1188 // rsp[argc * 8] : argument 1 | 1205 // rsp[argc * 8] : argument 1 |
1189 // rsp[(argc + 1) * 8] : argument 0 = receiver | 1206 // rsp[(argc + 1) * 8] : argument 0 = receiver |
1190 // ----------------------------------- | 1207 // ----------------------------------- |
1191 Label miss; | 1208 Label miss; |
1192 | 1209 |
| 1210 GenerateNameCheck(name, &miss); |
| 1211 |
1193 // Get the number of arguments. | 1212 // Get the number of arguments. |
1194 const int argc = arguments().immediate(); | 1213 const int argc = arguments().immediate(); |
1195 | 1214 |
1196 LookupResult lookup; | 1215 LookupResult lookup; |
1197 LookupPostInterceptor(holder, name, &lookup); | 1216 LookupPostInterceptor(holder, name, &lookup); |
1198 | 1217 |
1199 // Get the receiver from the stack. | 1218 // Get the receiver from the stack. |
1200 __ movq(rdx, Operand(rsp, (argc + 1) * kPointerSize)); | 1219 __ movq(rdx, Operand(rsp, (argc + 1) * kPointerSize)); |
1201 | 1220 |
1202 CallInterceptorCompiler compiler(this, arguments(), rcx); | 1221 CallInterceptorCompiler compiler(this, arguments(), rcx); |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1247 // ----------------------------------- | 1266 // ----------------------------------- |
1248 // rcx : function name | 1267 // rcx : function name |
1249 // rsp[0] : return address | 1268 // rsp[0] : return address |
1250 // rsp[8] : argument argc | 1269 // rsp[8] : argument argc |
1251 // rsp[16] : argument argc - 1 | 1270 // rsp[16] : argument argc - 1 |
1252 // ... | 1271 // ... |
1253 // rsp[argc * 8] : argument 1 | 1272 // rsp[argc * 8] : argument 1 |
1254 // rsp[(argc + 1) * 8] : argument 0 = receiver | 1273 // rsp[(argc + 1) * 8] : argument 0 = receiver |
1255 Label miss; | 1274 Label miss; |
1256 | 1275 |
| 1276 GenerateNameCheck(name, &miss); |
| 1277 |
1257 // Get the number of arguments. | 1278 // Get the number of arguments. |
1258 const int argc = arguments().immediate(); | 1279 const int argc = arguments().immediate(); |
1259 | 1280 |
1260 // Get the receiver from the stack. | 1281 // Get the receiver from the stack. |
1261 __ movq(rdx, Operand(rsp, (argc + 1) * kPointerSize)); | 1282 __ movq(rdx, Operand(rsp, (argc + 1) * kPointerSize)); |
1262 | 1283 |
1263 // If the object is the holder then we know that it's a global | 1284 // If the object is the holder then we know that it's a global |
1264 // object which can only happen for contextual calls. In this case, | 1285 // object which can only happen for contextual calls. In this case, |
1265 // the receiver cannot be a smi. | 1286 // the receiver cannot be a smi. |
1266 if (object != holder) { | 1287 if (object != holder) { |
(...skipping 1044 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2311 // Return the generated code. | 2332 // Return the generated code. |
2312 return GetCode(); | 2333 return GetCode(); |
2313 } | 2334 } |
2314 | 2335 |
2315 | 2336 |
2316 #undef __ | 2337 #undef __ |
2317 | 2338 |
2318 } } // namespace v8::internal | 2339 } } // namespace v8::internal |
2319 | 2340 |
2320 #endif // V8_TARGET_ARCH_X64 | 2341 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |