Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(179)

Side by Side Diff: src/bootstrapper.cc

Issue 7060010: Merge bleeding edge into the GC branch up to 7948. The asserts (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/gc/
Patch Set: Created 9 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/bootstrapper.h ('k') | src/builtins.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 // Similarly, we want to use the inner global that has been created by the 192 // Similarly, we want to use the inner global that has been created by the
193 // templates passed through the API. The inner global from the snapshot is 193 // templates passed through the API. The inner global from the snapshot is
194 // detached from the other objects in the snapshot. 194 // detached from the other objects in the snapshot.
195 void HookUpInnerGlobal(Handle<GlobalObject> inner_global); 195 void HookUpInnerGlobal(Handle<GlobalObject> inner_global);
196 // New context initialization. Used for creating a context from scratch. 196 // New context initialization. Used for creating a context from scratch.
197 void InitializeGlobal(Handle<GlobalObject> inner_global, 197 void InitializeGlobal(Handle<GlobalObject> inner_global,
198 Handle<JSFunction> empty_function); 198 Handle<JSFunction> empty_function);
199 // Installs the contents of the native .js files on the global objects. 199 // Installs the contents of the native .js files on the global objects.
200 // Used for creating a context from scratch. 200 // Used for creating a context from scratch.
201 void InstallNativeFunctions(); 201 void InstallNativeFunctions();
202 void InstallExperimentalNativeFunctions();
202 bool InstallNatives(); 203 bool InstallNatives();
203 bool InstallExperimentalNatives(); 204 bool InstallExperimentalNatives();
204 void InstallBuiltinFunctionIds(); 205 void InstallBuiltinFunctionIds();
205 void InstallJSFunctionResultCaches(); 206 void InstallJSFunctionResultCaches();
206 void InitializeNormalizedMapCaches(); 207 void InitializeNormalizedMapCaches();
207 // Used both for deserialized and from-scratch contexts to add the extensions 208 // Used both for deserialized and from-scratch contexts to add the extensions
208 // provided. 209 // provided.
209 static bool InstallExtensions(Handle<Context> global_context, 210 static bool InstallExtensions(Handle<Context> global_context,
210 v8::ExtensionConfiguration* extensions); 211 v8::ExtensionConfiguration* extensions);
211 static bool InstallExtension(const char* name); 212 static bool InstallExtension(const char* name);
(...skipping 1034 matching lines...) Expand 10 before | Expand all | Expand 10 after
1246 Handle<JSFunction> fun = 1247 Handle<JSFunction> fun =
1247 factory->NewFunctionFromSharedFunctionInfo(function_info, context); 1248 factory->NewFunctionFromSharedFunctionInfo(function_info, context);
1248 1249
1249 // Call function using either the runtime object or the global 1250 // Call function using either the runtime object or the global
1250 // object as the receiver. Provide no parameters. 1251 // object as the receiver. Provide no parameters.
1251 Handle<Object> receiver = 1252 Handle<Object> receiver =
1252 Handle<Object>(use_runtime_context 1253 Handle<Object>(use_runtime_context
1253 ? top_context->builtins() 1254 ? top_context->builtins()
1254 : top_context->global()); 1255 : top_context->global());
1255 bool has_pending_exception; 1256 bool has_pending_exception;
1256 Handle<Object> result = 1257 Execution::Call(fun, receiver, 0, NULL, &has_pending_exception);
1257 Execution::Call(fun, receiver, 0, NULL, &has_pending_exception);
1258 if (has_pending_exception) return false; 1258 if (has_pending_exception) return false;
1259 return true; 1259 return true;
1260 } 1260 }
1261 1261
1262 1262
1263 #define INSTALL_NATIVE(Type, name, var) \ 1263 #define INSTALL_NATIVE(Type, name, var) \
1264 Handle<String> var##_name = factory()->LookupAsciiSymbol(name); \ 1264 Handle<String> var##_name = factory()->LookupAsciiSymbol(name); \
1265 Object* var##_native = \ 1265 Object* var##_native = \
1266 global_context()->builtins()->GetPropertyNoExceptionThrown( \ 1266 global_context()->builtins()->GetPropertyNoExceptionThrown( \
1267 *var##_name); \ 1267 *var##_name); \
(...skipping 11 matching lines...) Expand all
1279 INSTALL_NATIVE(JSFunction, "ToUint32", to_uint32_fun); 1279 INSTALL_NATIVE(JSFunction, "ToUint32", to_uint32_fun);
1280 INSTALL_NATIVE(JSFunction, "ToInt32", to_int32_fun); 1280 INSTALL_NATIVE(JSFunction, "ToInt32", to_int32_fun);
1281 INSTALL_NATIVE(JSFunction, "GlobalEval", global_eval_fun); 1281 INSTALL_NATIVE(JSFunction, "GlobalEval", global_eval_fun);
1282 INSTALL_NATIVE(JSFunction, "Instantiate", instantiate_fun); 1282 INSTALL_NATIVE(JSFunction, "Instantiate", instantiate_fun);
1283 INSTALL_NATIVE(JSFunction, "ConfigureTemplateInstance", 1283 INSTALL_NATIVE(JSFunction, "ConfigureTemplateInstance",
1284 configure_instance_fun); 1284 configure_instance_fun);
1285 INSTALL_NATIVE(JSFunction, "GetStackTraceLine", get_stack_trace_line_fun); 1285 INSTALL_NATIVE(JSFunction, "GetStackTraceLine", get_stack_trace_line_fun);
1286 INSTALL_NATIVE(JSObject, "functionCache", function_cache); 1286 INSTALL_NATIVE(JSObject, "functionCache", function_cache);
1287 } 1287 }
1288 1288
1289 void Genesis::InstallExperimentalNativeFunctions() {
1290 if (FLAG_harmony_proxies) {
1291 INSTALL_NATIVE(JSFunction, "DerivedGetTrap", derived_get_trap);
1292 }
1293 }
1294
1289 #undef INSTALL_NATIVE 1295 #undef INSTALL_NATIVE
1290 1296
1291 1297
1292 bool Genesis::InstallNatives() { 1298 bool Genesis::InstallNatives() {
1293 HandleScope scope; 1299 HandleScope scope;
1294 1300
1295 // Create a function for the builtins object. Allocate space for the 1301 // Create a function for the builtins object. Allocate space for the
1296 // JavaScript builtins, a reference to the builtins object 1302 // JavaScript builtins, a reference to the builtins object
1297 // (itself) and a reference to the global_context directly in the object. 1303 // (itself) and a reference to the global_context directly in the object.
1298 Handle<Code> code = Handle<Code>( 1304 Handle<Code> code = Handle<Code>(
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after
1632 1638
1633 #ifdef DEBUG 1639 #ifdef DEBUG
1634 builtins->Verify(); 1640 builtins->Verify();
1635 #endif 1641 #endif
1636 1642
1637 return true; 1643 return true;
1638 } 1644 }
1639 1645
1640 1646
1641 bool Genesis::InstallExperimentalNatives() { 1647 bool Genesis::InstallExperimentalNatives() {
1642 if (FLAG_harmony_proxies) { 1648 for (int i = ExperimentalNatives::GetDebuggerCount();
1643 for (int i = ExperimentalNatives::GetDebuggerCount(); 1649 i < ExperimentalNatives::GetBuiltinsCount();
1644 i < ExperimentalNatives::GetBuiltinsCount(); 1650 i++) {
1645 i++) { 1651 if (FLAG_harmony_proxies &&
1652 strcmp(ExperimentalNatives::GetScriptName(i).start(),
1653 "native proxy.js") == 0) {
1646 if (!CompileExperimentalBuiltin(isolate(), i)) return false; 1654 if (!CompileExperimentalBuiltin(isolate(), i)) return false;
1647 } 1655 }
1648 } 1656 }
1657
1658 InstallExperimentalNativeFunctions();
1659
1649 return true; 1660 return true;
1650 } 1661 }
1651 1662
1652 1663
1653 static Handle<JSObject> ResolveBuiltinIdHolder( 1664 static Handle<JSObject> ResolveBuiltinIdHolder(
1654 Handle<Context> global_context, 1665 Handle<Context> global_context,
1655 const char* holder_expr) { 1666 const char* holder_expr) {
1656 Factory* factory = global_context->GetIsolate()->factory(); 1667 Factory* factory = global_context->GetIsolate()->factory();
1657 Handle<GlobalObject> global(global_context->global()); 1668 Handle<GlobalObject> global(global_context->global());
1658 const char* period_pos = strchr(holder_expr, '.'); 1669 const char* period_pos = strchr(holder_expr, '.');
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
1693 #undef INSTALL_BUILTIN_ID 1704 #undef INSTALL_BUILTIN_ID
1694 } 1705 }
1695 1706
1696 1707
1697 // Do not forget to update macros.py with named constant 1708 // Do not forget to update macros.py with named constant
1698 // of cache id. 1709 // of cache id.
1699 #define JSFUNCTION_RESULT_CACHE_LIST(F) \ 1710 #define JSFUNCTION_RESULT_CACHE_LIST(F) \
1700 F(16, global_context()->regexp_function()) 1711 F(16, global_context()->regexp_function())
1701 1712
1702 1713
1703 static FixedArray* CreateCache(int size, JSFunction* factory_function) { 1714 static FixedArray* CreateCache(int size, Handle<JSFunction> factory_function) {
1704 Factory* factory = factory_function->GetIsolate()->factory(); 1715 Factory* factory = factory_function->GetIsolate()->factory();
1705 // Caches are supposed to live for a long time, allocate in old space. 1716 // Caches are supposed to live for a long time, allocate in old space.
1706 int array_size = JSFunctionResultCache::kEntriesIndex + 2 * size; 1717 int array_size = JSFunctionResultCache::kEntriesIndex + 2 * size;
1707 // Cannot use cast as object is not fully initialized yet. 1718 // Cannot use cast as object is not fully initialized yet.
1708 JSFunctionResultCache* cache = reinterpret_cast<JSFunctionResultCache*>( 1719 JSFunctionResultCache* cache = reinterpret_cast<JSFunctionResultCache*>(
1709 *factory->NewFixedArrayWithHoles(array_size, TENURED)); 1720 *factory->NewFixedArrayWithHoles(array_size, TENURED));
1710 cache->set(JSFunctionResultCache::kFactoryIndex, factory_function); 1721 cache->set(JSFunctionResultCache::kFactoryIndex, *factory_function);
1711 cache->MakeZeroSize(); 1722 cache->MakeZeroSize();
1712 return cache; 1723 return cache;
1713 } 1724 }
1714 1725
1715 1726
1716 void Genesis::InstallJSFunctionResultCaches() { 1727 void Genesis::InstallJSFunctionResultCaches() {
1717 const int kNumberOfCaches = 0 + 1728 const int kNumberOfCaches = 0 +
1718 #define F(size, func) + 1 1729 #define F(size, func) + 1
1719 JSFUNCTION_RESULT_CACHE_LIST(F) 1730 JSFUNCTION_RESULT_CACHE_LIST(F)
1720 #undef F 1731 #undef F
1721 ; 1732 ;
1722 1733
1723 Handle<FixedArray> caches = FACTORY->NewFixedArray(kNumberOfCaches, TENURED); 1734 Handle<FixedArray> caches = FACTORY->NewFixedArray(kNumberOfCaches, TENURED);
1724 1735
1725 int index = 0; 1736 int index = 0;
1726 1737
1727 #define F(size, func) do { \ 1738 #define F(size, func) do { \
1728 FixedArray* cache = CreateCache((size), (func)); \ 1739 FixedArray* cache = CreateCache((size), Handle<JSFunction>(func)); \
1729 caches->set(index++, cache); \ 1740 caches->set(index++, cache); \
1730 } while (false) 1741 } while (false)
1731 1742
1732 JSFUNCTION_RESULT_CACHE_LIST(F); 1743 JSFUNCTION_RESULT_CACHE_LIST(F);
1733 1744
1734 #undef F 1745 #undef F
1735 1746
1736 global_context()->set_jsfunction_result_caches(*caches); 1747 global_context()->set_jsfunction_result_caches(*caches);
1737 } 1748 }
1738 1749
1739 1750
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
1998 break; 2009 break;
1999 } 2010 }
2000 case MAP_TRANSITION: 2011 case MAP_TRANSITION:
2001 case EXTERNAL_ARRAY_TRANSITION: 2012 case EXTERNAL_ARRAY_TRANSITION:
2002 case CONSTANT_TRANSITION: 2013 case CONSTANT_TRANSITION:
2003 case NULL_DESCRIPTOR: 2014 case NULL_DESCRIPTOR:
2004 // Ignore non-properties. 2015 // Ignore non-properties.
2005 break; 2016 break;
2006 case NORMAL: 2017 case NORMAL:
2007 // Do not occur since the from object has fast properties. 2018 // Do not occur since the from object has fast properties.
2019 case HANDLER:
2008 case INTERCEPTOR: 2020 case INTERCEPTOR:
2009 // No element in instance descriptors have interceptor type. 2021 // No element in instance descriptors have proxy or interceptor type.
2010 UNREACHABLE(); 2022 UNREACHABLE();
2011 break; 2023 break;
2012 } 2024 }
2013 } 2025 }
2014 } else { 2026 } else {
2015 Handle<StringDictionary> properties = 2027 Handle<StringDictionary> properties =
2016 Handle<StringDictionary>(from->property_dictionary()); 2028 Handle<StringDictionary>(from->property_dictionary());
2017 int capacity = properties->Capacity(); 2029 int capacity = properties->Capacity();
2018 for (int i = 0; i < capacity; i++) { 2030 for (int i = 0; i < capacity; i++) {
2019 Object* raw_key(properties->KeyAt(i)); 2031 Object* raw_key(properties->KeyAt(i));
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
2159 return from + sizeof(NestingCounterType); 2171 return from + sizeof(NestingCounterType);
2160 } 2172 }
2161 2173
2162 2174
2163 // Called when the top-level V8 mutex is destroyed. 2175 // Called when the top-level V8 mutex is destroyed.
2164 void Bootstrapper::FreeThreadResources() { 2176 void Bootstrapper::FreeThreadResources() {
2165 ASSERT(!IsActive()); 2177 ASSERT(!IsActive());
2166 } 2178 }
2167 2179
2168 } } // namespace v8::internal 2180 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/bootstrapper.h ('k') | src/builtins.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698