OLD | NEW |
---|---|
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 1683 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1694 #undef INSTALL_BUILTIN_ID | 1694 #undef INSTALL_BUILTIN_ID |
1695 } | 1695 } |
1696 | 1696 |
1697 | 1697 |
1698 // Do not forget to update macros.py with named constant | 1698 // Do not forget to update macros.py with named constant |
1699 // of cache id. | 1699 // of cache id. |
1700 #define JSFUNCTION_RESULT_CACHE_LIST(F) \ | 1700 #define JSFUNCTION_RESULT_CACHE_LIST(F) \ |
1701 F(16, global_context()->regexp_function()) | 1701 F(16, global_context()->regexp_function()) |
1702 | 1702 |
1703 | 1703 |
1704 static FixedArray* CreateCache(int size, JSFunction* factory_function) { | 1704 static FixedArray* CreateCache(int size, Handle<JSFunction> factory_function) { |
1705 Factory* factory = factory_function->GetIsolate()->factory(); | 1705 Factory* factory = factory_function->GetIsolate()->factory(); |
1706 // Caches are supposed to live for a long time, allocate in old space. | 1706 // Caches are supposed to live for a long time, allocate in old space. |
1707 int array_size = JSFunctionResultCache::kEntriesIndex + 2 * size; | 1707 int array_size = JSFunctionResultCache::kEntriesIndex + 2 * size; |
1708 // Cannot use cast as object is not fully initialized yet. | 1708 // Cannot use cast as object is not fully initialized yet. |
1709 JSFunctionResultCache* cache = reinterpret_cast<JSFunctionResultCache*>( | 1709 JSFunctionResultCache* cache = reinterpret_cast<JSFunctionResultCache*>( |
1710 *factory->NewFixedArrayWithHoles(array_size, TENURED)); | 1710 *factory->NewFixedArrayWithHoles(array_size, TENURED)); |
1711 cache->set(JSFunctionResultCache::kFactoryIndex, factory_function); | 1711 cache->set(JSFunctionResultCache::kFactoryIndex, *factory_function); |
1712 cache->MakeZeroSize(); | 1712 cache->MakeZeroSize(); |
1713 return cache; | 1713 return cache; |
1714 } | 1714 } |
1715 | 1715 |
1716 | 1716 |
1717 void Genesis::InstallJSFunctionResultCaches() { | 1717 void Genesis::InstallJSFunctionResultCaches() { |
1718 const int kNumberOfCaches = 0 + | 1718 const int kNumberOfCaches = 0 + |
1719 #define F(size, func) + 1 | 1719 #define F(size, func) + 1 |
1720 JSFUNCTION_RESULT_CACHE_LIST(F) | 1720 JSFUNCTION_RESULT_CACHE_LIST(F) |
1721 #undef F | 1721 #undef F |
1722 ; | 1722 ; |
1723 | 1723 |
1724 Handle<FixedArray> caches = FACTORY->NewFixedArray(kNumberOfCaches, TENURED); | 1724 Handle<FixedArray> caches = FACTORY->NewFixedArray(kNumberOfCaches, TENURED); |
1725 | 1725 |
1726 int index = 0; | 1726 int index = 0; |
1727 | 1727 |
1728 #define F(size, func) do { \ | 1728 #define F(size, func) do { \ |
Mads Ager (chromium)
2011/05/16 06:10:27
Restore alignment of '\'
| |
1729 FixedArray* cache = CreateCache((size), (func)); \ | 1729 FixedArray* cache = CreateCache((size), Handle<JSFunction>(func)); \ |
1730 caches->set(index++, cache); \ | 1730 caches->set(index++, cache); \ |
1731 } while (false) | 1731 } while (false) |
1732 | 1732 |
1733 JSFUNCTION_RESULT_CACHE_LIST(F); | 1733 JSFUNCTION_RESULT_CACHE_LIST(F); |
1734 | 1734 |
1735 #undef F | 1735 #undef F |
1736 | 1736 |
1737 global_context()->set_jsfunction_result_caches(*caches); | 1737 global_context()->set_jsfunction_result_caches(*caches); |
1738 } | 1738 } |
1739 | 1739 |
(...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2160 return from + sizeof(NestingCounterType); | 2160 return from + sizeof(NestingCounterType); |
2161 } | 2161 } |
2162 | 2162 |
2163 | 2163 |
2164 // Called when the top-level V8 mutex is destroyed. | 2164 // Called when the top-level V8 mutex is destroyed. |
2165 void Bootstrapper::FreeThreadResources() { | 2165 void Bootstrapper::FreeThreadResources() { |
2166 ASSERT(!IsActive()); | 2166 ASSERT(!IsActive()); |
2167 } | 2167 } |
2168 | 2168 |
2169 } } // namespace v8::internal | 2169 } } // namespace v8::internal |
OLD | NEW |