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 852 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
863 // rsp[0] : return address | 863 // rsp[0] : return address |
864 // rsp[8] : argument argc | 864 // rsp[8] : argument argc |
865 // rsp[16] : argument argc - 1 | 865 // rsp[16] : argument argc - 1 |
866 // ... | 866 // ... |
867 // rsp[argc * 8] : argument 1 | 867 // rsp[argc * 8] : argument 1 |
868 // rsp[(argc + 1) * 8] : argument 0 = receiver | 868 // rsp[(argc + 1) * 8] : argument 0 = receiver |
869 // ----------------------------------- | 869 // ----------------------------------- |
870 | 870 |
871 SharedFunctionInfo* function_info = function->shared(); | 871 SharedFunctionInfo* function_info = function->shared(); |
872 if (function_info->HasCustomCallGenerator()) { | 872 if (function_info->HasCustomCallGenerator()) { |
873 CustomCallGenerator generator = | 873 const int id = function_info->custom_call_generator_id(); |
874 ToCData<CustomCallGenerator>(function_info->function_data()); | 874 Object* result = |
875 Object* result = generator(this, object, holder, function, name, check); | 875 CompileCustomCall(id, object, holder, function, name, check); |
876 // undefined means bail out to regular compiler. | 876 // undefined means bail out to regular compiler. |
877 if (!result->IsUndefined()) { | 877 if (!result->IsUndefined()) { |
878 return result; | 878 return result; |
879 } | 879 } |
880 } | 880 } |
881 | 881 |
882 Label miss_in_smi_check; | 882 Label miss_in_smi_check; |
883 | 883 |
884 // Get the receiver from the stack. | 884 // Get the receiver from the stack. |
885 const int argc = arguments().immediate(); | 885 const int argc = arguments().immediate(); |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1000 if (depth != kInvalidProtoDepth) { | 1000 if (depth != kInvalidProtoDepth) { |
1001 FreeSpaceForFastApiCall(masm(), rax); | 1001 FreeSpaceForFastApiCall(masm(), rax); |
1002 } | 1002 } |
1003 | 1003 |
1004 // Handle call cache miss. | 1004 // Handle call cache miss. |
1005 __ bind(&miss_in_smi_check); | 1005 __ bind(&miss_in_smi_check); |
1006 Handle<Code> ic = ComputeCallMiss(arguments().immediate()); | 1006 Handle<Code> ic = ComputeCallMiss(arguments().immediate()); |
1007 __ Jump(ic, RelocInfo::CODE_TARGET); | 1007 __ Jump(ic, RelocInfo::CODE_TARGET); |
1008 | 1008 |
1009 // Return the generated code. | 1009 // Return the generated code. |
1010 String* function_name = NULL; | 1010 return GetCode(function); |
1011 if (function->shared()->name()->IsString()) { | |
1012 function_name = String::cast(function->shared()->name()); | |
1013 } | |
1014 return GetCode(CONSTANT_FUNCTION, function_name); | |
1015 } | 1011 } |
1016 | 1012 |
1017 | 1013 |
1018 Object* CallStubCompiler::CompileCallField(JSObject* object, | 1014 Object* CallStubCompiler::CompileCallField(JSObject* object, |
1019 JSObject* holder, | 1015 JSObject* holder, |
1020 int index, | 1016 int index, |
1021 String* name) { | 1017 String* name) { |
1022 // ----------- S t a t e ------------- | 1018 // ----------- S t a t e ------------- |
1023 // rcx : function name | 1019 // rcx : function name |
1024 // rsp[0] : return address | 1020 // rsp[0] : return address |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1212 argc + 1, | 1208 argc + 1, |
1213 1); | 1209 1); |
1214 } | 1210 } |
1215 | 1211 |
1216 __ bind(&miss); | 1212 __ bind(&miss); |
1217 | 1213 |
1218 Handle<Code> ic = ComputeCallMiss(arguments().immediate()); | 1214 Handle<Code> ic = ComputeCallMiss(arguments().immediate()); |
1219 __ jmp(ic, RelocInfo::CODE_TARGET); | 1215 __ jmp(ic, RelocInfo::CODE_TARGET); |
1220 | 1216 |
1221 // Return the generated code. | 1217 // Return the generated code. |
1222 String* function_name = NULL; | 1218 return GetCode(function); |
1223 if (function->shared()->name()->IsString()) { | |
1224 function_name = String::cast(function->shared()->name()); | |
1225 } | |
1226 return GetCode(CONSTANT_FUNCTION, function_name); | |
1227 } | 1219 } |
1228 | 1220 |
1229 | 1221 |
1230 Object* CallStubCompiler::CompileArrayPopCall(Object* object, | 1222 Object* CallStubCompiler::CompileArrayPopCall(Object* object, |
1231 JSObject* holder, | 1223 JSObject* holder, |
1232 JSFunction* function, | 1224 JSFunction* function, |
1233 String* name, | 1225 String* name, |
1234 CheckType check) { | 1226 CheckType check) { |
1235 // ----------- S t a t e ------------- | 1227 // ----------- S t a t e ------------- |
1236 // -- ecx : name | 1228 // -- ecx : name |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1301 __ bind(&call_builtin); | 1293 __ bind(&call_builtin); |
1302 __ TailCallExternalReference(ExternalReference(Builtins::c_ArrayPop), | 1294 __ TailCallExternalReference(ExternalReference(Builtins::c_ArrayPop), |
1303 argc + 1, | 1295 argc + 1, |
1304 1); | 1296 1); |
1305 __ bind(&miss); | 1297 __ bind(&miss); |
1306 | 1298 |
1307 Handle<Code> ic = ComputeCallMiss(arguments().immediate()); | 1299 Handle<Code> ic = ComputeCallMiss(arguments().immediate()); |
1308 __ jmp(ic, RelocInfo::CODE_TARGET); | 1300 __ jmp(ic, RelocInfo::CODE_TARGET); |
1309 | 1301 |
1310 // Return the generated code. | 1302 // Return the generated code. |
1311 String* function_name = NULL; | 1303 return GetCode(function); |
1312 if (function->shared()->name()->IsString()) { | |
1313 function_name = String::cast(function->shared()->name()); | |
1314 } | |
1315 return GetCode(CONSTANT_FUNCTION, function_name); | |
1316 } | 1304 } |
1317 | 1305 |
1318 | 1306 |
1319 | 1307 |
1320 | 1308 |
1321 Object* CallStubCompiler::CompileCallInterceptor(JSObject* object, | 1309 Object* CallStubCompiler::CompileCallInterceptor(JSObject* object, |
1322 JSObject* holder, | 1310 JSObject* holder, |
1323 String* name) { | 1311 String* name) { |
1324 // ----------- S t a t e ------------- | 1312 // ----------- S t a t e ------------- |
1325 // rcx : function name | 1313 // rcx : function name |
(...skipping 1046 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2372 __ Jump(generic_construct_stub, RelocInfo::CODE_TARGET); | 2360 __ Jump(generic_construct_stub, RelocInfo::CODE_TARGET); |
2373 | 2361 |
2374 // Return the generated code. | 2362 // Return the generated code. |
2375 return GetCode(); | 2363 return GetCode(); |
2376 } | 2364 } |
2377 | 2365 |
2378 | 2366 |
2379 #undef __ | 2367 #undef __ |
2380 | 2368 |
2381 } } // namespace v8::internal | 2369 } } // namespace v8::internal |
OLD | NEW |