| 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 1044 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1055 builtins->set_builtins(*builtins); | 1055 builtins->set_builtins(*builtins); |
| 1056 builtins->set_global_context(*global_context()); | 1056 builtins->set_global_context(*global_context()); |
| 1057 builtins->set_global_receiver(*builtins); | 1057 builtins->set_global_receiver(*builtins); |
| 1058 | 1058 |
| 1059 // Setup the 'global' properties of the builtins object. The | 1059 // Setup the 'global' properties of the builtins object. The |
| 1060 // 'global' property that refers to the global object is the only | 1060 // 'global' property that refers to the global object is the only |
| 1061 // way to get from code running in the builtins context to the | 1061 // way to get from code running in the builtins context to the |
| 1062 // global object. | 1062 // global object. |
| 1063 static const PropertyAttributes attributes = | 1063 static const PropertyAttributes attributes = |
| 1064 static_cast<PropertyAttributes>(READ_ONLY | DONT_DELETE); | 1064 static_cast<PropertyAttributes>(READ_ONLY | DONT_DELETE); |
| 1065 SetProperty(builtins, Factory::LookupAsciiSymbol("global"), | 1065 Handle<String> global_symbol = Factory::LookupAsciiSymbol("global"); |
| 1066 Handle<Object>(global_context()->global()), attributes); | 1066 SetProperty(builtins, |
| 1067 global_symbol, |
| 1068 Handle<Object>(global_context()->global()), |
| 1069 attributes); |
| 1067 | 1070 |
| 1068 // Setup the reference from the global object to the builtins object. | 1071 // Setup the reference from the global object to the builtins object. |
| 1069 JSGlobalObject::cast(global_context()->global())->set_builtins(*builtins); | 1072 JSGlobalObject::cast(global_context()->global())->set_builtins(*builtins); |
| 1070 | 1073 |
| 1071 // Create a bridge function that has context in the global context. | 1074 // Create a bridge function that has context in the global context. |
| 1072 Handle<JSFunction> bridge = | 1075 Handle<JSFunction> bridge = |
| 1073 Factory::NewFunction(Factory::empty_symbol(), Factory::undefined_value()); | 1076 Factory::NewFunction(Factory::empty_symbol(), Factory::undefined_value()); |
| 1074 ASSERT(bridge->context() == *Top::global_context()); | 1077 ASSERT(bridge->context() == *Top::global_context()); |
| 1075 | 1078 |
| 1076 // Allocate the builtins context. | 1079 // Allocate the builtins context. |
| (...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1386 void Genesis::InstallJSFunctionResultCaches() { | 1389 void Genesis::InstallJSFunctionResultCaches() { |
| 1387 const int kNumberOfCaches = 0 + | 1390 const int kNumberOfCaches = 0 + |
| 1388 #define F(size, func) + 1 | 1391 #define F(size, func) + 1 |
| 1389 JSFUNCTION_RESULT_CACHE_LIST(F) | 1392 JSFUNCTION_RESULT_CACHE_LIST(F) |
| 1390 #undef F | 1393 #undef F |
| 1391 ; | 1394 ; |
| 1392 | 1395 |
| 1393 Handle<FixedArray> caches = Factory::NewFixedArray(kNumberOfCaches, TENURED); | 1396 Handle<FixedArray> caches = Factory::NewFixedArray(kNumberOfCaches, TENURED); |
| 1394 | 1397 |
| 1395 int index = 0; | 1398 int index = 0; |
| 1396 #define F(size, func) caches->set(index++, CreateCache(size, func)); | 1399 |
| 1397 JSFUNCTION_RESULT_CACHE_LIST(F) | 1400 #define F(size, func) do { \ |
| 1401 FixedArray* cache = CreateCache((size), (func)); \ |
| 1402 caches->set(index++, cache); \ |
| 1403 } while (false) |
| 1404 |
| 1405 JSFUNCTION_RESULT_CACHE_LIST(F); |
| 1406 |
| 1398 #undef F | 1407 #undef F |
| 1399 | 1408 |
| 1400 global_context()->set_jsfunction_result_caches(*caches); | 1409 global_context()->set_jsfunction_result_caches(*caches); |
| 1401 } | 1410 } |
| 1402 | 1411 |
| 1403 | 1412 |
| 1404 void Genesis::InitializeNormalizedMapCaches() { | 1413 void Genesis::InitializeNormalizedMapCaches() { |
| 1405 Handle<FixedArray> array( | 1414 Handle<FixedArray> array( |
| 1406 Factory::NewFixedArray(NormalizedMapCache::kEntries, TENURED)); | 1415 Factory::NewFixedArray(NormalizedMapCache::kEntries, TENURED)); |
| 1407 global_context()->set_normalized_map_cache(NormalizedMapCache::cast(*array)); | 1416 global_context()->set_normalized_map_cache(NormalizedMapCache::cast(*array)); |
| (...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1829 } | 1838 } |
| 1830 | 1839 |
| 1831 | 1840 |
| 1832 // Restore statics that are thread local. | 1841 // Restore statics that are thread local. |
| 1833 char* BootstrapperActive::RestoreState(char* from) { | 1842 char* BootstrapperActive::RestoreState(char* from) { |
| 1834 nesting_ = *reinterpret_cast<int*>(from); | 1843 nesting_ = *reinterpret_cast<int*>(from); |
| 1835 return from + sizeof(nesting_); | 1844 return from + sizeof(nesting_); |
| 1836 } | 1845 } |
| 1837 | 1846 |
| 1838 } } // namespace v8::internal | 1847 } } // namespace v8::internal |
| OLD | NEW |