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 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
224 void HookUpInnerGlobal(Handle<GlobalObject> inner_global); | 224 void HookUpInnerGlobal(Handle<GlobalObject> inner_global); |
225 // New context initialization. Used for creating a context from scratch. | 225 // New context initialization. Used for creating a context from scratch. |
226 void InitializeGlobal(Handle<GlobalObject> inner_global, | 226 void InitializeGlobal(Handle<GlobalObject> inner_global, |
227 Handle<JSFunction> empty_function); | 227 Handle<JSFunction> empty_function); |
228 // Installs the contents of the native .js files on the global objects. | 228 // Installs the contents of the native .js files on the global objects. |
229 // Used for creating a context from scratch. | 229 // Used for creating a context from scratch. |
230 void InstallNativeFunctions(); | 230 void InstallNativeFunctions(); |
231 bool InstallNatives(); | 231 bool InstallNatives(); |
232 void InstallCustomCallGenerators(); | 232 void InstallCustomCallGenerators(); |
233 void InstallJSFunctionResultCaches(); | 233 void InstallJSFunctionResultCaches(); |
| 234 void InitializeNormalizedMapCaches(); |
234 // Used both for deserialized and from-scratch contexts to add the extensions | 235 // Used both for deserialized and from-scratch contexts to add the extensions |
235 // provided. | 236 // provided. |
236 static bool InstallExtensions(Handle<Context> global_context, | 237 static bool InstallExtensions(Handle<Context> global_context, |
237 v8::ExtensionConfiguration* extensions); | 238 v8::ExtensionConfiguration* extensions); |
238 static bool InstallExtension(const char* name); | 239 static bool InstallExtension(const char* name); |
239 static bool InstallExtension(v8::RegisteredExtension* current); | 240 static bool InstallExtension(v8::RegisteredExtension* current); |
240 static void InstallSpecialObjects(Handle<Context> global_context); | 241 static void InstallSpecialObjects(Handle<Context> global_context); |
241 bool InstallJSBuiltins(Handle<JSBuiltinsObject> builtins); | 242 bool InstallJSBuiltins(Handle<JSBuiltinsObject> builtins); |
242 bool ConfigureApiObject(Handle<JSObject> object, | 243 bool ConfigureApiObject(Handle<JSObject> object, |
243 Handle<ObjectTemplateInfo> object_template); | 244 Handle<ObjectTemplateInfo> object_template); |
(...skipping 1141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1385 | 1386 |
1386 int index = 0; | 1387 int index = 0; |
1387 #define F(size, func) caches->set(index++, CreateCache(size, func)); | 1388 #define F(size, func) caches->set(index++, CreateCache(size, func)); |
1388 JSFUNCTION_RESULT_CACHE_LIST(F) | 1389 JSFUNCTION_RESULT_CACHE_LIST(F) |
1389 #undef F | 1390 #undef F |
1390 | 1391 |
1391 global_context()->set_jsfunction_result_caches(*caches); | 1392 global_context()->set_jsfunction_result_caches(*caches); |
1392 } | 1393 } |
1393 | 1394 |
1394 | 1395 |
| 1396 void Genesis::InitializeNormalizedMapCaches() { |
| 1397 Handle<FixedArray> array( |
| 1398 Factory::NewFixedArray(NormalizedMapCache::kEntries, TENURED)); |
| 1399 global_context()->set_normalized_map_cache(NormalizedMapCache::cast(*array)); |
| 1400 } |
| 1401 |
| 1402 |
1395 int BootstrapperActive::nesting_ = 0; | 1403 int BootstrapperActive::nesting_ = 0; |
1396 | 1404 |
1397 | 1405 |
1398 bool Bootstrapper::InstallExtensions(Handle<Context> global_context, | 1406 bool Bootstrapper::InstallExtensions(Handle<Context> global_context, |
1399 v8::ExtensionConfiguration* extensions) { | 1407 v8::ExtensionConfiguration* extensions) { |
1400 BootstrapperActive active; | 1408 BootstrapperActive active; |
1401 SaveContext saved_context; | 1409 SaveContext saved_context; |
1402 Top::set_context(*global_context); | 1410 Top::set_context(*global_context); |
1403 if (!Genesis::InstallExtensions(global_context, extensions)) return false; | 1411 if (!Genesis::InstallExtensions(global_context, extensions)) return false; |
1404 Genesis::InstallSpecialObjects(global_context); | 1412 Genesis::InstallSpecialObjects(global_context); |
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1751 } else { | 1759 } else { |
1752 // We get here if there was no context snapshot. | 1760 // We get here if there was no context snapshot. |
1753 CreateRoots(); | 1761 CreateRoots(); |
1754 Handle<JSFunction> empty_function = CreateEmptyFunction(); | 1762 Handle<JSFunction> empty_function = CreateEmptyFunction(); |
1755 Handle<GlobalObject> inner_global; | 1763 Handle<GlobalObject> inner_global; |
1756 Handle<JSGlobalProxy> global_proxy = | 1764 Handle<JSGlobalProxy> global_proxy = |
1757 CreateNewGlobals(global_template, global_object, &inner_global); | 1765 CreateNewGlobals(global_template, global_object, &inner_global); |
1758 HookUpGlobalProxy(inner_global, global_proxy); | 1766 HookUpGlobalProxy(inner_global, global_proxy); |
1759 InitializeGlobal(inner_global, empty_function); | 1767 InitializeGlobal(inner_global, empty_function); |
1760 InstallJSFunctionResultCaches(); | 1768 InstallJSFunctionResultCaches(); |
| 1769 InitializeNormalizedMapCaches(); |
1761 if (!InstallNatives()) return; | 1770 if (!InstallNatives()) return; |
1762 | 1771 |
1763 MakeFunctionInstancePrototypeWritable(); | 1772 MakeFunctionInstancePrototypeWritable(); |
1764 | 1773 |
1765 if (!ConfigureGlobalObjects(global_template)) return; | 1774 if (!ConfigureGlobalObjects(global_template)) return; |
1766 i::Counters::contexts_created_from_scratch.Increment(); | 1775 i::Counters::contexts_created_from_scratch.Increment(); |
1767 } | 1776 } |
1768 | 1777 |
1769 result_ = global_context_; | 1778 result_ = global_context_; |
1770 } | 1779 } |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1810 } | 1819 } |
1811 | 1820 |
1812 | 1821 |
1813 // Restore statics that are thread local. | 1822 // Restore statics that are thread local. |
1814 char* BootstrapperActive::RestoreState(char* from) { | 1823 char* BootstrapperActive::RestoreState(char* from) { |
1815 nesting_ = *reinterpret_cast<int*>(from); | 1824 nesting_ = *reinterpret_cast<int*>(from); |
1816 return from + sizeof(nesting_); | 1825 return from + sizeof(nesting_); |
1817 } | 1826 } |
1818 | 1827 |
1819 } } // namespace v8::internal | 1828 } } // namespace v8::internal |
OLD | NEW |