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 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 void HookUpInnerGlobal(Handle<GlobalObject> inner_global); | 225 void HookUpInnerGlobal(Handle<GlobalObject> inner_global); |
226 // New context initialization. Used for creating a context from scratch. | 226 // New context initialization. Used for creating a context from scratch. |
227 void InitializeGlobal(Handle<GlobalObject> inner_global, | 227 void InitializeGlobal(Handle<GlobalObject> inner_global, |
228 Handle<JSFunction> empty_function); | 228 Handle<JSFunction> empty_function); |
229 // Installs the contents of the native .js files on the global objects. | 229 // Installs the contents of the native .js files on the global objects. |
230 // Used for creating a context from scratch. | 230 // Used for creating a context from scratch. |
231 void InstallNativeFunctions(); | 231 void InstallNativeFunctions(); |
232 bool InstallNatives(); | 232 bool InstallNatives(); |
233 void InstallCustomCallGenerators(); | 233 void InstallCustomCallGenerators(); |
234 void InstallJSFunctionResultCaches(); | 234 void InstallJSFunctionResultCaches(); |
| 235 void InitializeNormalizedMapCaches(); |
235 // Used both for deserialized and from-scratch contexts to add the extensions | 236 // Used both for deserialized and from-scratch contexts to add the extensions |
236 // provided. | 237 // provided. |
237 static bool InstallExtensions(Handle<Context> global_context, | 238 static bool InstallExtensions(Handle<Context> global_context, |
238 v8::ExtensionConfiguration* extensions); | 239 v8::ExtensionConfiguration* extensions); |
239 static bool InstallExtension(const char* name); | 240 static bool InstallExtension(const char* name); |
240 static bool InstallExtension(v8::RegisteredExtension* current); | 241 static bool InstallExtension(v8::RegisteredExtension* current); |
241 static void InstallSpecialObjects(Handle<Context> global_context); | 242 static void InstallSpecialObjects(Handle<Context> global_context); |
242 bool InstallJSBuiltins(Handle<JSBuiltinsObject> builtins); | 243 bool InstallJSBuiltins(Handle<JSBuiltinsObject> builtins); |
243 bool ConfigureApiObject(Handle<JSObject> object, | 244 bool ConfigureApiObject(Handle<JSObject> object, |
244 Handle<ObjectTemplateInfo> object_template); | 245 Handle<ObjectTemplateInfo> object_template); |
(...skipping 1148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1393 | 1394 |
1394 int index = 0; | 1395 int index = 0; |
1395 #define F(size, func) caches->set(index++, CreateCache(size, func)); | 1396 #define F(size, func) caches->set(index++, CreateCache(size, func)); |
1396 JSFUNCTION_RESULT_CACHE_LIST(F) | 1397 JSFUNCTION_RESULT_CACHE_LIST(F) |
1397 #undef F | 1398 #undef F |
1398 | 1399 |
1399 global_context()->set_jsfunction_result_caches(*caches); | 1400 global_context()->set_jsfunction_result_caches(*caches); |
1400 } | 1401 } |
1401 | 1402 |
1402 | 1403 |
| 1404 void Genesis::InitializeNormalizedMapCaches() { |
| 1405 Handle<FixedArray> array( |
| 1406 Factory::NewFixedArray(NormalizedMapCache::kEntries, TENURED)); |
| 1407 global_context()->set_normalized_map_cache(NormalizedMapCache::cast(*array)); |
| 1408 } |
| 1409 |
| 1410 |
1403 int BootstrapperActive::nesting_ = 0; | 1411 int BootstrapperActive::nesting_ = 0; |
1404 | 1412 |
1405 | 1413 |
1406 bool Bootstrapper::InstallExtensions(Handle<Context> global_context, | 1414 bool Bootstrapper::InstallExtensions(Handle<Context> global_context, |
1407 v8::ExtensionConfiguration* extensions) { | 1415 v8::ExtensionConfiguration* extensions) { |
1408 BootstrapperActive active; | 1416 BootstrapperActive active; |
1409 SaveContext saved_context; | 1417 SaveContext saved_context; |
1410 Top::set_context(*global_context); | 1418 Top::set_context(*global_context); |
1411 if (!Genesis::InstallExtensions(global_context, extensions)) return false; | 1419 if (!Genesis::InstallExtensions(global_context, extensions)) return false; |
1412 Genesis::InstallSpecialObjects(global_context); | 1420 Genesis::InstallSpecialObjects(global_context); |
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1761 } else { | 1769 } else { |
1762 // We get here if there was no context snapshot. | 1770 // We get here if there was no context snapshot. |
1763 CreateRoots(); | 1771 CreateRoots(); |
1764 Handle<JSFunction> empty_function = CreateEmptyFunction(); | 1772 Handle<JSFunction> empty_function = CreateEmptyFunction(); |
1765 Handle<GlobalObject> inner_global; | 1773 Handle<GlobalObject> inner_global; |
1766 Handle<JSGlobalProxy> global_proxy = | 1774 Handle<JSGlobalProxy> global_proxy = |
1767 CreateNewGlobals(global_template, global_object, &inner_global); | 1775 CreateNewGlobals(global_template, global_object, &inner_global); |
1768 HookUpGlobalProxy(inner_global, global_proxy); | 1776 HookUpGlobalProxy(inner_global, global_proxy); |
1769 InitializeGlobal(inner_global, empty_function); | 1777 InitializeGlobal(inner_global, empty_function); |
1770 InstallJSFunctionResultCaches(); | 1778 InstallJSFunctionResultCaches(); |
| 1779 InitializeNormalizedMapCaches(); |
1771 if (!InstallNatives()) return; | 1780 if (!InstallNatives()) return; |
1772 | 1781 |
1773 MakeFunctionInstancePrototypeWritable(); | 1782 MakeFunctionInstancePrototypeWritable(); |
1774 | 1783 |
1775 if (!ConfigureGlobalObjects(global_template)) return; | 1784 if (!ConfigureGlobalObjects(global_template)) return; |
1776 i::Counters::contexts_created_from_scratch.Increment(); | 1785 i::Counters::contexts_created_from_scratch.Increment(); |
1777 } | 1786 } |
1778 | 1787 |
1779 result_ = global_context_; | 1788 result_ = global_context_; |
1780 } | 1789 } |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1820 } | 1829 } |
1821 | 1830 |
1822 | 1831 |
1823 // Restore statics that are thread local. | 1832 // Restore statics that are thread local. |
1824 char* BootstrapperActive::RestoreState(char* from) { | 1833 char* BootstrapperActive::RestoreState(char* from) { |
1825 nesting_ = *reinterpret_cast<int*>(from); | 1834 nesting_ = *reinterpret_cast<int*>(from); |
1826 return from + sizeof(nesting_); | 1835 return from + sizeof(nesting_); |
1827 } | 1836 } |
1828 | 1837 |
1829 } } // namespace v8::internal | 1838 } } // namespace v8::internal |
OLD | NEW |