OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 1326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1337 } | 1337 } |
1338 | 1338 |
1339 #ifdef DEBUG | 1339 #ifdef DEBUG |
1340 builtins->Verify(); | 1340 builtins->Verify(); |
1341 #endif | 1341 #endif |
1342 | 1342 |
1343 return true; | 1343 return true; |
1344 } | 1344 } |
1345 | 1345 |
1346 | 1346 |
1347 static void InstallCustomCallGenerator(Handle<JSFunction> holder_function, | 1347 static void InstallCustomCallGenerator( |
1348 const char* function_name, | 1348 Handle<JSFunction> holder_function, |
1349 int id) { | 1349 CallStubCompiler::CustomGeneratorOwner owner_flag, |
1350 Handle<JSObject> proto(JSObject::cast(holder_function->instance_prototype())); | 1350 const char* function_name, |
| 1351 int id) { |
| 1352 Handle<JSObject> owner; |
| 1353 if (owner_flag == CallStubCompiler::FUNCTION) { |
| 1354 owner = Handle<JSObject>::cast(holder_function); |
| 1355 } else { |
| 1356 ASSERT(owner_flag == CallStubCompiler::INSTANCE_PROTOTYPE); |
| 1357 owner = Handle<JSObject>( |
| 1358 JSObject::cast(holder_function->instance_prototype())); |
| 1359 } |
1351 Handle<String> name = Factory::LookupAsciiSymbol(function_name); | 1360 Handle<String> name = Factory::LookupAsciiSymbol(function_name); |
1352 Handle<JSFunction> function(JSFunction::cast(proto->GetProperty(*name))); | 1361 Handle<JSFunction> function(JSFunction::cast(owner->GetProperty(*name))); |
1353 function->shared()->set_function_data(Smi::FromInt(id)); | 1362 function->shared()->set_function_data(Smi::FromInt(id)); |
1354 } | 1363 } |
1355 | 1364 |
1356 | 1365 |
1357 void Genesis::InstallCustomCallGenerators() { | 1366 void Genesis::InstallCustomCallGenerators() { |
1358 HandleScope scope; | 1367 HandleScope scope; |
1359 #define INSTALL_CALL_GENERATOR(holder_fun, fun_name, name) \ | 1368 #define INSTALL_CALL_GENERATOR(holder_fun, owner_flag, fun_name, name) \ |
1360 { \ | 1369 { \ |
1361 Handle<JSFunction> holder(global_context()->holder_fun##_function()); \ | 1370 Handle<JSFunction> holder(global_context()->holder_fun##_function()); \ |
1362 const int id = CallStubCompiler::k##name##CallGenerator; \ | 1371 const int id = CallStubCompiler::k##name##CallGenerator; \ |
1363 InstallCustomCallGenerator(holder, #fun_name, id); \ | 1372 InstallCustomCallGenerator(holder, CallStubCompiler::owner_flag, \ |
| 1373 #fun_name, id); \ |
1364 } | 1374 } |
1365 CUSTOM_CALL_IC_GENERATORS(INSTALL_CALL_GENERATOR) | 1375 CUSTOM_CALL_IC_GENERATORS(INSTALL_CALL_GENERATOR) |
1366 #undef INSTALL_CALL_GENERATOR | 1376 #undef INSTALL_CALL_GENERATOR |
1367 } | 1377 } |
1368 | 1378 |
1369 | 1379 |
1370 // Do not forget to update macros.py with named constant | 1380 // Do not forget to update macros.py with named constant |
1371 // of cache id. | 1381 // of cache id. |
1372 #define JSFUNCTION_RESULT_CACHE_LIST(F) \ | 1382 #define JSFUNCTION_RESULT_CACHE_LIST(F) \ |
1373 F(16, global_context()->regexp_function()) | 1383 F(16, global_context()->regexp_function()) |
(...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1831 } | 1841 } |
1832 | 1842 |
1833 | 1843 |
1834 // Restore statics that are thread local. | 1844 // Restore statics that are thread local. |
1835 char* BootstrapperActive::RestoreState(char* from) { | 1845 char* BootstrapperActive::RestoreState(char* from) { |
1836 nesting_ = *reinterpret_cast<int*>(from); | 1846 nesting_ = *reinterpret_cast<int*>(from); |
1837 return from + sizeof(nesting_); | 1847 return from + sizeof(nesting_); |
1838 } | 1848 } |
1839 | 1849 |
1840 } } // namespace v8::internal | 1850 } } // namespace v8::internal |
OLD | NEW |