OLD | NEW |
1 // Copyright 2006-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2006-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 1246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1257 | 1257 |
1258 __ bind(&call_builtin); | 1258 __ bind(&call_builtin); |
1259 } | 1259 } |
1260 | 1260 |
1261 __ TailCallExternalReference(ExternalReference(Builtins::c_ArrayPush), | 1261 __ TailCallExternalReference(ExternalReference(Builtins::c_ArrayPush), |
1262 argc + 1, | 1262 argc + 1, |
1263 1); | 1263 1); |
1264 } | 1264 } |
1265 | 1265 |
1266 __ bind(&miss); | 1266 __ bind(&miss); |
1267 | |
1268 Handle<Code> ic = ComputeCallMiss(arguments().immediate()); | 1267 Handle<Code> ic = ComputeCallMiss(arguments().immediate()); |
1269 __ jmp(ic, RelocInfo::CODE_TARGET); | 1268 __ jmp(ic, RelocInfo::CODE_TARGET); |
1270 | 1269 |
1271 // Return the generated code. | 1270 // Return the generated code. |
1272 String* function_name = NULL; | 1271 return GetCode(function); |
1273 if (function->shared()->name()->IsString()) { | |
1274 function_name = String::cast(function->shared()->name()); | |
1275 } | |
1276 return GetCode(CONSTANT_FUNCTION, function_name); | |
1277 } | 1272 } |
1278 | 1273 |
1279 | 1274 |
1280 Object* CallStubCompiler::CompileArrayPopCall(Object* object, | 1275 Object* CallStubCompiler::CompileArrayPopCall(Object* object, |
1281 JSObject* holder, | 1276 JSObject* holder, |
1282 JSFunction* function, | 1277 JSFunction* function, |
1283 String* name, | 1278 String* name, |
1284 CheckType check) { | 1279 CheckType check) { |
1285 // ----------- S t a t e ------------- | 1280 // ----------- S t a t e ------------- |
1286 // -- ecx : name | 1281 // -- ecx : name |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1344 __ bind(&return_undefined); | 1339 __ bind(&return_undefined); |
1345 __ mov(eax, Immediate(Factory::undefined_value())); | 1340 __ mov(eax, Immediate(Factory::undefined_value())); |
1346 __ ret((argc + 1) * kPointerSize); | 1341 __ ret((argc + 1) * kPointerSize); |
1347 | 1342 |
1348 __ bind(&call_builtin); | 1343 __ bind(&call_builtin); |
1349 __ TailCallExternalReference(ExternalReference(Builtins::c_ArrayPop), | 1344 __ TailCallExternalReference(ExternalReference(Builtins::c_ArrayPop), |
1350 argc + 1, | 1345 argc + 1, |
1351 1); | 1346 1); |
1352 | 1347 |
1353 __ bind(&miss); | 1348 __ bind(&miss); |
1354 | |
1355 Handle<Code> ic = ComputeCallMiss(arguments().immediate()); | 1349 Handle<Code> ic = ComputeCallMiss(arguments().immediate()); |
1356 __ jmp(ic, RelocInfo::CODE_TARGET); | 1350 __ jmp(ic, RelocInfo::CODE_TARGET); |
1357 | 1351 |
1358 // Return the generated code. | 1352 // Return the generated code. |
1359 String* function_name = NULL; | 1353 return GetCode(function); |
1360 if (function->shared()->name()->IsString()) { | |
1361 function_name = String::cast(function->shared()->name()); | |
1362 } | |
1363 return GetCode(CONSTANT_FUNCTION, function_name); | |
1364 } | 1354 } |
1365 | 1355 |
1366 | 1356 |
1367 Object* CallStubCompiler::CompileCallConstant(Object* object, | 1357 Object* CallStubCompiler::CompileCallConstant(Object* object, |
1368 JSObject* holder, | 1358 JSObject* holder, |
1369 JSFunction* function, | 1359 JSFunction* function, |
1370 String* name, | 1360 String* name, |
1371 CheckType check) { | 1361 CheckType check) { |
1372 // ----------- S t a t e ------------- | 1362 // ----------- S t a t e ------------- |
1373 // -- ecx : name | 1363 // -- ecx : name |
1374 // -- esp[0] : return address | 1364 // -- esp[0] : return address |
1375 // -- esp[(argc - n) * 4] : arg[n] (zero-based) | 1365 // -- esp[(argc - n) * 4] : arg[n] (zero-based) |
1376 // -- ... | 1366 // -- ... |
1377 // -- esp[(argc + 1) * 4] : receiver | 1367 // -- esp[(argc + 1) * 4] : receiver |
1378 // ----------------------------------- | 1368 // ----------------------------------- |
1379 | 1369 |
1380 SharedFunctionInfo* function_info = function->shared(); | 1370 SharedFunctionInfo* function_info = function->shared(); |
1381 if (function_info->HasCustomCallGenerator()) { | 1371 if (function_info->HasCustomCallGenerator()) { |
1382 CustomCallGenerator generator = | 1372 const int id = function_info->custom_call_generator_id(); |
1383 ToCData<CustomCallGenerator>(function_info->function_data()); | 1373 Object* result = |
1384 Object* result = generator(this, object, holder, function, name, check); | 1374 CompileCustomCall(id, object, holder, function, name, check); |
1385 // undefined means bail out to regular compiler. | 1375 // undefined means bail out to regular compiler. |
1386 if (!result->IsUndefined()) { | 1376 if (!result->IsUndefined()) { |
1387 return result; | 1377 return result; |
1388 } | 1378 } |
1389 } | 1379 } |
1390 | 1380 |
1391 Label miss_in_smi_check; | 1381 Label miss_in_smi_check; |
1392 | 1382 |
1393 // Get the receiver from the stack. | 1383 // Get the receiver from the stack. |
1394 const int argc = arguments().immediate(); | 1384 const int argc = arguments().immediate(); |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1511 // Handle call cache miss. | 1501 // Handle call cache miss. |
1512 __ bind(&miss); | 1502 __ bind(&miss); |
1513 if (depth != kInvalidProtoDepth) { | 1503 if (depth != kInvalidProtoDepth) { |
1514 FreeSpaceForFastApiCall(masm(), eax); | 1504 FreeSpaceForFastApiCall(masm(), eax); |
1515 } | 1505 } |
1516 __ bind(&miss_in_smi_check); | 1506 __ bind(&miss_in_smi_check); |
1517 Handle<Code> ic = ComputeCallMiss(arguments().immediate()); | 1507 Handle<Code> ic = ComputeCallMiss(arguments().immediate()); |
1518 __ jmp(ic, RelocInfo::CODE_TARGET); | 1508 __ jmp(ic, RelocInfo::CODE_TARGET); |
1519 | 1509 |
1520 // Return the generated code. | 1510 // Return the generated code. |
1521 String* function_name = NULL; | 1511 return GetCode(function); |
1522 if (function->shared()->name()->IsString()) { | |
1523 function_name = String::cast(function->shared()->name()); | |
1524 } | |
1525 return GetCode(CONSTANT_FUNCTION, function_name); | |
1526 } | 1512 } |
1527 | 1513 |
1528 | 1514 |
1529 Object* CallStubCompiler::CompileCallInterceptor(JSObject* object, | 1515 Object* CallStubCompiler::CompileCallInterceptor(JSObject* object, |
1530 JSObject* holder, | 1516 JSObject* holder, |
1531 String* name) { | 1517 String* name) { |
1532 // ----------- S t a t e ------------- | 1518 // ----------- S t a t e ------------- |
1533 // -- ecx : name | 1519 // -- ecx : name |
1534 // -- esp[0] : return address | 1520 // -- esp[0] : return address |
1535 // -- esp[(argc - n) * 4] : arg[n] (zero-based) | 1521 // -- esp[(argc - n) * 4] : arg[n] (zero-based) |
(...skipping 858 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2394 __ jmp(generic_construct_stub, RelocInfo::CODE_TARGET); | 2380 __ jmp(generic_construct_stub, RelocInfo::CODE_TARGET); |
2395 | 2381 |
2396 // Return the generated code. | 2382 // Return the generated code. |
2397 return GetCode(); | 2383 return GetCode(); |
2398 } | 2384 } |
2399 | 2385 |
2400 | 2386 |
2401 #undef __ | 2387 #undef __ |
2402 | 2388 |
2403 } } // namespace v8::internal | 2389 } } // namespace v8::internal |
OLD | NEW |