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 1317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1328 | 1328 |
1329 // Do not forget to update macros.py with named constant | 1329 // Do not forget to update macros.py with named constant |
1330 // of cache id. | 1330 // of cache id. |
1331 #define JSFUNCTION_RESULT_CACHE_LIST(F) \ | 1331 #define JSFUNCTION_RESULT_CACHE_LIST(F) \ |
1332 F(16, global_context()->regexp_function()) | 1332 F(16, global_context()->regexp_function()) |
1333 | 1333 |
1334 | 1334 |
1335 static FixedArray* CreateCache(int size, JSFunction* factory) { | 1335 static FixedArray* CreateCache(int size, JSFunction* factory) { |
1336 // Caches are supposed to live for a long time, allocate in old space. | 1336 // Caches are supposed to live for a long time, allocate in old space. |
1337 int array_size = JSFunctionResultCache::kEntriesIndex + 2 * size; | 1337 int array_size = JSFunctionResultCache::kEntriesIndex + 2 * size; |
1338 Handle<FixedArray> cache = | 1338 // Cannot use cast as object is not fully initialized yet. |
1339 Factory::NewFixedArrayWithHoles(array_size, TENURED); | 1339 JSFunctionResultCache* cache = reinterpret_cast<JSFunctionResultCache*>( |
| 1340 *Factory::NewFixedArrayWithHoles(array_size, TENURED)); |
1340 cache->set(JSFunctionResultCache::kFactoryIndex, factory); | 1341 cache->set(JSFunctionResultCache::kFactoryIndex, factory); |
1341 cache->set(JSFunctionResultCache::kFingerIndex, | 1342 cache->MakeZeroSize(); |
1342 Smi::FromInt(JSFunctionResultCache::kEntriesIndex)); | 1343 return cache; |
1343 cache->set(JSFunctionResultCache::kCacheSizeIndex, | |
1344 Smi::FromInt(JSFunctionResultCache::kEntriesIndex)); | |
1345 return *cache; | |
1346 } | 1344 } |
1347 | 1345 |
1348 | 1346 |
1349 void Genesis::InstallJSFunctionResultCaches() { | 1347 void Genesis::InstallJSFunctionResultCaches() { |
1350 const int kNumberOfCaches = 0 + | 1348 const int kNumberOfCaches = 0 + |
1351 #define F(size, func) + 1 | 1349 #define F(size, func) + 1 |
1352 JSFUNCTION_RESULT_CACHE_LIST(F) | 1350 JSFUNCTION_RESULT_CACHE_LIST(F) |
1353 #undef F | 1351 #undef F |
1354 ; | 1352 ; |
1355 | 1353 |
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1781 } | 1779 } |
1782 | 1780 |
1783 | 1781 |
1784 // Restore statics that are thread local. | 1782 // Restore statics that are thread local. |
1785 char* BootstrapperActive::RestoreState(char* from) { | 1783 char* BootstrapperActive::RestoreState(char* from) { |
1786 nesting_ = *reinterpret_cast<int*>(from); | 1784 nesting_ = *reinterpret_cast<int*>(from); |
1787 return from + sizeof(nesting_); | 1785 return from + sizeof(nesting_); |
1788 } | 1786 } |
1789 | 1787 |
1790 } } // namespace v8::internal | 1788 } } // namespace v8::internal |
OLD | NEW |