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