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 677 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
688 Factory::the_hole_value()); | 688 Factory::the_hole_value()); |
689 __ j(not_equal, miss); | 689 __ j(not_equal, miss); |
690 return cell; | 690 return cell; |
691 } | 691 } |
692 | 692 |
693 | 693 |
694 #undef __ | 694 #undef __ |
695 | 695 |
696 #define __ ACCESS_MASM((masm())) | 696 #define __ ACCESS_MASM((masm())) |
697 | 697 |
| 698 void CallStubCompiler::GenerateMissBranch() { |
| 699 Handle<Code> ic = ComputeCallMiss(arguments().immediate(), kind_); |
| 700 __ Jump(ic, RelocInfo::CODE_TARGET); |
| 701 } |
| 702 |
| 703 |
698 Object* CallStubCompiler::CompileCallConstant(Object* object, | 704 Object* CallStubCompiler::CompileCallConstant(Object* object, |
699 JSObject* holder, | 705 JSObject* holder, |
700 JSFunction* function, | 706 JSFunction* function, |
701 String* name, | 707 String* name, |
702 StubCompiler::CheckType check) { | 708 StubCompiler::CheckType check) { |
703 // ----------- S t a t e ------------- | 709 // ----------- S t a t e ------------- |
704 // rcx : function name | 710 // rcx : function name |
705 // rsp[0] : return address | 711 // rsp[0] : return address |
706 // rsp[8] : argument argc | 712 // rsp[8] : argument argc |
707 // rsp[16] : argument argc - 1 | 713 // rsp[16] : argument argc - 1 |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
838 } | 844 } |
839 | 845 |
840 // Handle call cache miss. | 846 // Handle call cache miss. |
841 __ bind(&miss); | 847 __ bind(&miss); |
842 if (depth != kInvalidProtoDepth) { | 848 if (depth != kInvalidProtoDepth) { |
843 FreeSpaceForFastApiCall(masm(), rax); | 849 FreeSpaceForFastApiCall(masm(), rax); |
844 } | 850 } |
845 | 851 |
846 // Handle call cache miss. | 852 // Handle call cache miss. |
847 __ bind(&miss_in_smi_check); | 853 __ bind(&miss_in_smi_check); |
848 Handle<Code> ic = ComputeCallMiss(arguments().immediate()); | 854 GenerateMissBranch(); |
849 __ Jump(ic, RelocInfo::CODE_TARGET); | |
850 | 855 |
851 // Return the generated code. | 856 // Return the generated code. |
852 return GetCode(function); | 857 return GetCode(function); |
853 } | 858 } |
854 | 859 |
855 | 860 |
856 Object* CallStubCompiler::CompileCallField(JSObject* object, | 861 Object* CallStubCompiler::CompileCallField(JSObject* object, |
857 JSObject* holder, | 862 JSObject* holder, |
858 int index, | 863 int index, |
859 String* name) { | 864 String* name) { |
(...skipping 30 matching lines...) Expand all Loading... |
890 if (object->IsGlobalObject()) { | 895 if (object->IsGlobalObject()) { |
891 __ movq(rdx, FieldOperand(rdx, GlobalObject::kGlobalReceiverOffset)); | 896 __ movq(rdx, FieldOperand(rdx, GlobalObject::kGlobalReceiverOffset)); |
892 __ movq(Operand(rsp, (argc + 1) * kPointerSize), rdx); | 897 __ movq(Operand(rsp, (argc + 1) * kPointerSize), rdx); |
893 } | 898 } |
894 | 899 |
895 // Invoke the function. | 900 // Invoke the function. |
896 __ InvokeFunction(rdi, arguments(), JUMP_FUNCTION); | 901 __ InvokeFunction(rdi, arguments(), JUMP_FUNCTION); |
897 | 902 |
898 // Handle call cache miss. | 903 // Handle call cache miss. |
899 __ bind(&miss); | 904 __ bind(&miss); |
900 Handle<Code> ic = ComputeCallMiss(arguments().immediate()); | 905 GenerateMissBranch(); |
901 __ Jump(ic, RelocInfo::CODE_TARGET); | |
902 | 906 |
903 // Return the generated code. | 907 // Return the generated code. |
904 return GetCode(FIELD, name); | 908 return GetCode(FIELD, name); |
905 } | 909 } |
906 | 910 |
907 | 911 |
908 Object* CallStubCompiler::CompileArrayPushCall(Object* object, | 912 Object* CallStubCompiler::CompileArrayPushCall(Object* object, |
909 JSObject* holder, | 913 JSObject* holder, |
910 JSFunction* function, | 914 JSFunction* function, |
911 String* name, | 915 String* name, |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1045 __ bind(&call_builtin); | 1049 __ bind(&call_builtin); |
1046 } | 1050 } |
1047 | 1051 |
1048 __ TailCallExternalReference(ExternalReference(Builtins::c_ArrayPush), | 1052 __ TailCallExternalReference(ExternalReference(Builtins::c_ArrayPush), |
1049 argc + 1, | 1053 argc + 1, |
1050 1); | 1054 1); |
1051 } | 1055 } |
1052 | 1056 |
1053 __ bind(&miss); | 1057 __ bind(&miss); |
1054 | 1058 |
1055 Handle<Code> ic = ComputeCallMiss(arguments().immediate()); | 1059 GenerateMissBranch(); |
1056 __ jmp(ic, RelocInfo::CODE_TARGET); | |
1057 | 1060 |
1058 // Return the generated code. | 1061 // Return the generated code. |
1059 return GetCode(function); | 1062 return GetCode(function); |
1060 } | 1063 } |
1061 | 1064 |
1062 | 1065 |
1063 Object* CallStubCompiler::CompileArrayPopCall(Object* object, | 1066 Object* CallStubCompiler::CompileArrayPopCall(Object* object, |
1064 JSObject* holder, | 1067 JSObject* holder, |
1065 JSFunction* function, | 1068 JSFunction* function, |
1066 String* name, | 1069 String* name, |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1130 | 1133 |
1131 __ Move(rax, Factory::undefined_value()); | 1134 __ Move(rax, Factory::undefined_value()); |
1132 __ ret((argc + 1) * kPointerSize); | 1135 __ ret((argc + 1) * kPointerSize); |
1133 | 1136 |
1134 __ bind(&call_builtin); | 1137 __ bind(&call_builtin); |
1135 __ TailCallExternalReference(ExternalReference(Builtins::c_ArrayPop), | 1138 __ TailCallExternalReference(ExternalReference(Builtins::c_ArrayPop), |
1136 argc + 1, | 1139 argc + 1, |
1137 1); | 1140 1); |
1138 __ bind(&miss); | 1141 __ bind(&miss); |
1139 | 1142 |
1140 Handle<Code> ic = ComputeCallMiss(arguments().immediate()); | 1143 GenerateMissBranch(); |
1141 __ jmp(ic, RelocInfo::CODE_TARGET); | |
1142 | 1144 |
1143 // Return the generated code. | 1145 // Return the generated code. |
1144 return GetCode(function); | 1146 return GetCode(function); |
1145 } | 1147 } |
1146 | 1148 |
1147 | 1149 |
1148 Object* CallStubCompiler::CompileStringCharAtCall(Object* object, | 1150 Object* CallStubCompiler::CompileStringCharAtCall(Object* object, |
1149 JSObject* holder, | 1151 JSObject* holder, |
1150 JSFunction* function, | 1152 JSFunction* function, |
1151 String* name, | 1153 String* name, |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1214 __ movq(rdx, FieldOperand(rdx, GlobalObject::kGlobalReceiverOffset)); | 1216 __ movq(rdx, FieldOperand(rdx, GlobalObject::kGlobalReceiverOffset)); |
1215 __ movq(Operand(rsp, (argc + 1) * kPointerSize), rdx); | 1217 __ movq(Operand(rsp, (argc + 1) * kPointerSize), rdx); |
1216 } | 1218 } |
1217 | 1219 |
1218 // Invoke the function. | 1220 // Invoke the function. |
1219 __ movq(rdi, rax); | 1221 __ movq(rdi, rax); |
1220 __ InvokeFunction(rdi, arguments(), JUMP_FUNCTION); | 1222 __ InvokeFunction(rdi, arguments(), JUMP_FUNCTION); |
1221 | 1223 |
1222 // Handle load cache miss. | 1224 // Handle load cache miss. |
1223 __ bind(&miss); | 1225 __ bind(&miss); |
1224 Handle<Code> ic = ComputeCallMiss(argc); | 1226 GenerateMissBranch(); |
1225 __ Jump(ic, RelocInfo::CODE_TARGET); | |
1226 | 1227 |
1227 // Return the generated code. | 1228 // Return the generated code. |
1228 return GetCode(INTERCEPTOR, name); | 1229 return GetCode(INTERCEPTOR, name); |
1229 } | 1230 } |
1230 | 1231 |
1231 | 1232 |
1232 Object* CallStubCompiler::CompileCallGlobal(JSObject* object, | 1233 Object* CallStubCompiler::CompileCallGlobal(JSObject* object, |
1233 GlobalObject* holder, | 1234 GlobalObject* holder, |
1234 JSGlobalPropertyCell* cell, | 1235 JSGlobalPropertyCell* cell, |
1235 JSFunction* function, | 1236 JSFunction* function, |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1298 __ IncrementCounter(&Counters::call_global_inline, 1); | 1299 __ IncrementCounter(&Counters::call_global_inline, 1); |
1299 ASSERT(function->is_compiled()); | 1300 ASSERT(function->is_compiled()); |
1300 Handle<Code> code(function->code()); | 1301 Handle<Code> code(function->code()); |
1301 ParameterCount expected(function->shared()->formal_parameter_count()); | 1302 ParameterCount expected(function->shared()->formal_parameter_count()); |
1302 __ InvokeCode(code, expected, arguments(), | 1303 __ InvokeCode(code, expected, arguments(), |
1303 RelocInfo::CODE_TARGET, JUMP_FUNCTION); | 1304 RelocInfo::CODE_TARGET, JUMP_FUNCTION); |
1304 | 1305 |
1305 // Handle call cache miss. | 1306 // Handle call cache miss. |
1306 __ bind(&miss); | 1307 __ bind(&miss); |
1307 __ IncrementCounter(&Counters::call_global_inline_miss, 1); | 1308 __ IncrementCounter(&Counters::call_global_inline_miss, 1); |
1308 Handle<Code> ic = ComputeCallMiss(arguments().immediate()); | 1309 GenerateMissBranch(); |
1309 __ Jump(ic, RelocInfo::CODE_TARGET); | |
1310 | 1310 |
1311 // Return the generated code. | 1311 // Return the generated code. |
1312 return GetCode(NORMAL, name); | 1312 return GetCode(NORMAL, name); |
1313 } | 1313 } |
1314 | 1314 |
1315 | 1315 |
1316 Object* LoadStubCompiler::CompileLoadCallback(String* name, | 1316 Object* LoadStubCompiler::CompileLoadCallback(String* name, |
1317 JSObject* object, | 1317 JSObject* object, |
1318 JSObject* holder, | 1318 JSObject* holder, |
1319 AccessorInfo* callback) { | 1319 AccessorInfo* callback) { |
(...skipping 983 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2303 // Return the generated code. | 2303 // Return the generated code. |
2304 return GetCode(); | 2304 return GetCode(); |
2305 } | 2305 } |
2306 | 2306 |
2307 | 2307 |
2308 #undef __ | 2308 #undef __ |
2309 | 2309 |
2310 } } // namespace v8::internal | 2310 } } // namespace v8::internal |
2311 | 2311 |
2312 #endif // V8_TARGET_ARCH_X64 | 2312 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |