OLD | NEW |
1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 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 898 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
909 __ movq(rax, rdx); // Return the original value. | 909 __ movq(rax, rdx); // Return the original value. |
910 __ ret(0); | 910 __ ret(0); |
911 } | 911 } |
912 | 912 |
913 // Slow case: call runtime. | 913 // Slow case: call runtime. |
914 __ bind(&slow); | 914 __ bind(&slow); |
915 Generate(masm, ExternalReference(Runtime::kSetProperty)); | 915 Generate(masm, ExternalReference(Runtime::kSetProperty)); |
916 } | 916 } |
917 | 917 |
918 | 918 |
919 void CallIC::Generate(MacroAssembler* masm, | 919 void CallIC::GenerateMiss(MacroAssembler* masm, int argc) { |
920 int argc, | |
921 ExternalReference const& f) { | |
922 // Get the receiver of the function from the stack; 1 ~ return address. | 920 // Get the receiver of the function from the stack; 1 ~ return address. |
923 __ movq(rdx, Operand(rsp, (argc + 1) * kPointerSize)); | 921 __ movq(rdx, Operand(rsp, (argc + 1) * kPointerSize)); |
924 // Get the name of the function to call from the stack. | 922 // Get the name of the function to call from the stack. |
925 // 2 ~ receiver, return address. | 923 // 2 ~ receiver, return address. |
926 __ movq(rbx, Operand(rsp, (argc + 2) * kPointerSize)); | 924 __ movq(rbx, Operand(rsp, (argc + 2) * kPointerSize)); |
927 | 925 |
928 // Enter an internal frame. | 926 // Enter an internal frame. |
929 __ EnterInternalFrame(); | 927 __ EnterInternalFrame(); |
930 | 928 |
931 // Push the receiver and the name of the function. | 929 // Push the receiver and the name of the function. |
932 __ push(rdx); | 930 __ push(rdx); |
933 __ push(rbx); | 931 __ push(rbx); |
934 | 932 |
935 // Call the entry. | 933 // Call the entry. |
936 CEntryStub stub(1); | 934 CEntryStub stub(1); |
937 __ movq(rax, Immediate(2)); | 935 __ movq(rax, Immediate(2)); |
938 __ movq(rbx, f); | 936 __ movq(rbx, ExternalReference(IC_Utility(kCallIC_Miss))); |
939 __ CallStub(&stub); | 937 __ CallStub(&stub); |
940 | 938 |
941 // Move result to rdi and exit the internal frame. | 939 // Move result to rdi and exit the internal frame. |
942 __ movq(rdi, rax); | 940 __ movq(rdi, rax); |
943 __ LeaveInternalFrame(); | 941 __ LeaveInternalFrame(); |
944 | 942 |
945 // Check if the receiver is a global object of some sort. | 943 // Check if the receiver is a global object of some sort. |
946 Label invoke, global; | 944 Label invoke, global; |
947 __ movq(rdx, Operand(rsp, (argc + 1) * kPointerSize)); // receiver | 945 __ movq(rdx, Operand(rsp, (argc + 1) * kPointerSize)); // receiver |
948 __ JumpIfSmi(rdx, &invoke); | 946 __ JumpIfSmi(rdx, &invoke); |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1019 __ bind(&boolean); | 1017 __ bind(&boolean); |
1020 StubCompiler::GenerateLoadGlobalFunctionPrototype( | 1018 StubCompiler::GenerateLoadGlobalFunctionPrototype( |
1021 masm, Context::BOOLEAN_FUNCTION_INDEX, rdx); | 1019 masm, Context::BOOLEAN_FUNCTION_INDEX, rdx); |
1022 | 1020 |
1023 // Probe the stub cache for the value object. | 1021 // Probe the stub cache for the value object. |
1024 __ bind(&probe); | 1022 __ bind(&probe); |
1025 StubCache::GenerateProbe(masm, flags, rdx, rcx, rbx, no_reg); | 1023 StubCache::GenerateProbe(masm, flags, rdx, rcx, rbx, no_reg); |
1026 | 1024 |
1027 // Cache miss: Jump to runtime. | 1025 // Cache miss: Jump to runtime. |
1028 __ bind(&miss); | 1026 __ bind(&miss); |
1029 Generate(masm, argc, ExternalReference(IC_Utility(kCallIC_Miss))); | 1027 GenerateMiss(masm, argc); |
1030 } | 1028 } |
1031 | 1029 |
1032 | 1030 |
1033 static void GenerateNormalHelper(MacroAssembler* masm, | 1031 static void GenerateNormalHelper(MacroAssembler* masm, |
1034 int argc, | 1032 int argc, |
1035 bool is_global_object, | 1033 bool is_global_object, |
1036 Label* miss) { | 1034 Label* miss) { |
1037 // Search dictionary - put result in register rdx. | 1035 // Search dictionary - put result in register rdx. |
1038 GenerateDictionaryLoad(masm, miss, rax, rdx, rbx, rcx, CHECK_DICTIONARY); | 1036 GenerateDictionaryLoad(masm, miss, rax, rdx, rbx, rcx, CHECK_DICTIONARY); |
1039 | 1037 |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1121 __ bind(&invoke); | 1119 __ bind(&invoke); |
1122 GenerateNormalHelper(masm, argc, false, &miss); | 1120 GenerateNormalHelper(masm, argc, false, &miss); |
1123 | 1121 |
1124 // Global object proxy access: Check access rights. | 1122 // Global object proxy access: Check access rights. |
1125 __ bind(&global_proxy); | 1123 __ bind(&global_proxy); |
1126 __ CheckAccessGlobalProxy(rdx, rax, &miss); | 1124 __ CheckAccessGlobalProxy(rdx, rax, &miss); |
1127 __ jmp(&invoke); | 1125 __ jmp(&invoke); |
1128 | 1126 |
1129 // Cache miss: Jump to runtime. | 1127 // Cache miss: Jump to runtime. |
1130 __ bind(&miss); | 1128 __ bind(&miss); |
1131 Generate(masm, argc, ExternalReference(IC_Utility(kCallIC_Miss))); | 1129 GenerateMiss(masm, argc); |
1132 } | 1130 } |
1133 | 1131 |
1134 | 1132 |
1135 // The offset from the inlined patch site to the start of the | 1133 // The offset from the inlined patch site to the start of the |
1136 // inlined load instruction. | 1134 // inlined load instruction. |
1137 const int LoadIC::kOffsetToLoadInstruction = 20; | 1135 const int LoadIC::kOffsetToLoadInstruction = 20; |
1138 | 1136 |
1139 | 1137 |
1140 void LoadIC::ClearInlinedVersion(Address address) { | 1138 void LoadIC::ClearInlinedVersion(Address address) { |
1141 // Reset the map check of the inlined inobject property load (if | 1139 // Reset the map check of the inlined inobject property load (if |
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1375 | 1373 |
1376 // Cache miss: Jump to runtime. | 1374 // Cache miss: Jump to runtime. |
1377 Generate(masm, ExternalReference(IC_Utility(kStoreIC_Miss))); | 1375 Generate(masm, ExternalReference(IC_Utility(kStoreIC_Miss))); |
1378 } | 1376 } |
1379 | 1377 |
1380 | 1378 |
1381 #undef __ | 1379 #undef __ |
1382 | 1380 |
1383 | 1381 |
1384 } } // namespace v8::internal | 1382 } } // namespace v8::internal |
OLD | NEW |