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

Side by Side Diff: src/bootstrapper.cc

Issue 6580038: [Isolates] Merge from bleeding_edge, revisions 5934-6100. (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/isolates/
Patch Set: '' Created 9 years, 10 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/ast-inl.h ('k') | src/builtins.cc » ('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 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 20 matching lines...) Expand all
31 #include "api.h" 31 #include "api.h"
32 #include "bootstrapper.h" 32 #include "bootstrapper.h"
33 #include "compiler.h" 33 #include "compiler.h"
34 #include "debug.h" 34 #include "debug.h"
35 #include "execution.h" 35 #include "execution.h"
36 #include "global-handles.h" 36 #include "global-handles.h"
37 #include "macro-assembler.h" 37 #include "macro-assembler.h"
38 #include "natives.h" 38 #include "natives.h"
39 #include "objects-visiting.h" 39 #include "objects-visiting.h"
40 #include "snapshot.h" 40 #include "snapshot.h"
41 #include "stub-cache.h"
42 #include "extensions/externalize-string-extension.h" 41 #include "extensions/externalize-string-extension.h"
43 #include "extensions/gc-extension.h" 42 #include "extensions/gc-extension.h"
44 43
45 namespace v8 { 44 namespace v8 {
46 namespace internal { 45 namespace internal {
47 46
48 47
49 NativesExternalStringResource::NativesExternalStringResource( 48 NativesExternalStringResource::NativesExternalStringResource(
50 Bootstrapper* bootstrapper, 49 Bootstrapper* bootstrapper,
51 const char* source) 50 const char* source)
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 // templates passed through the API. The inner global from the snapshot is 180 // templates passed through the API. The inner global from the snapshot is
182 // detached from the other objects in the snapshot. 181 // detached from the other objects in the snapshot.
183 void HookUpInnerGlobal(Handle<GlobalObject> inner_global); 182 void HookUpInnerGlobal(Handle<GlobalObject> inner_global);
184 // New context initialization. Used for creating a context from scratch. 183 // New context initialization. Used for creating a context from scratch.
185 void InitializeGlobal(Handle<GlobalObject> inner_global, 184 void InitializeGlobal(Handle<GlobalObject> inner_global,
186 Handle<JSFunction> empty_function); 185 Handle<JSFunction> empty_function);
187 // Installs the contents of the native .js files on the global objects. 186 // Installs the contents of the native .js files on the global objects.
188 // Used for creating a context from scratch. 187 // Used for creating a context from scratch.
189 void InstallNativeFunctions(); 188 void InstallNativeFunctions();
190 bool InstallNatives(); 189 bool InstallNatives();
191 void InstallCustomCallGenerators(); 190 void InstallBuiltinFunctionIds();
192 void InstallJSFunctionResultCaches(); 191 void InstallJSFunctionResultCaches();
193 void InitializeNormalizedMapCaches(); 192 void InitializeNormalizedMapCaches();
194 // Used both for deserialized and from-scratch contexts to add the extensions 193 // Used both for deserialized and from-scratch contexts to add the extensions
195 // provided. 194 // provided.
196 static bool InstallExtensions(Handle<Context> global_context, 195 static bool InstallExtensions(Handle<Context> global_context,
197 v8::ExtensionConfiguration* extensions); 196 v8::ExtensionConfiguration* extensions);
198 static bool InstallExtension(const char* name); 197 static bool InstallExtension(const char* name);
199 static bool InstallExtension(v8::RegisteredExtension* current); 198 static bool InstallExtension(v8::RegisteredExtension* current);
200 static void InstallSpecialObjects(Handle<Context> global_context); 199 static void InstallSpecialObjects(Handle<Context> global_context);
201 bool InstallJSBuiltins(Handle<JSBuiltinsObject> builtins); 200 bool InstallJSBuiltins(Handle<JSBuiltinsObject> builtins);
(...skipping 1031 matching lines...) Expand 10 before | Expand all | Expand 10 after
1233 InstallNativeFunctions(); 1232 InstallNativeFunctions();
1234 1233
1235 // Store the map for the string prototype after the natives has been compiled 1234 // Store the map for the string prototype after the natives has been compiled
1236 // and the String function has been setup. 1235 // and the String function has been setup.
1237 Handle<JSFunction> string_function(global_context()->string_function()); 1236 Handle<JSFunction> string_function(global_context()->string_function());
1238 ASSERT(JSObject::cast( 1237 ASSERT(JSObject::cast(
1239 string_function->initial_map()->prototype())->HasFastProperties()); 1238 string_function->initial_map()->prototype())->HasFastProperties());
1240 global_context()->set_string_function_prototype_map( 1239 global_context()->set_string_function_prototype_map(
1241 HeapObject::cast(string_function->initial_map()->prototype())->map()); 1240 HeapObject::cast(string_function->initial_map()->prototype())->map());
1242 1241
1243 InstallCustomCallGenerators(); 1242 InstallBuiltinFunctionIds();
1244 1243
1245 // Install Function.prototype.call and apply. 1244 // Install Function.prototype.call and apply.
1246 { Handle<String> key = FACTORY->function_class_symbol(); 1245 { Handle<String> key = FACTORY->function_class_symbol();
1247 Handle<JSFunction> function = 1246 Handle<JSFunction> function =
1248 Handle<JSFunction>::cast( 1247 Handle<JSFunction>::cast(
1249 GetProperty(Isolate::Current()->global(), key)); 1248 GetProperty(Isolate::Current()->global(), key));
1250 Handle<JSObject> proto = 1249 Handle<JSObject> proto =
1251 Handle<JSObject>(JSObject::cast(function->instance_prototype())); 1250 Handle<JSObject>(JSObject::cast(function->instance_prototype()));
1252 1251
1253 // Install the call and the apply functions. 1252 // Install the call and the apply functions.
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
1333 } 1332 }
1334 1333
1335 #ifdef DEBUG 1334 #ifdef DEBUG
1336 builtins->Verify(); 1335 builtins->Verify();
1337 #endif 1336 #endif
1338 1337
1339 return true; 1338 return true;
1340 } 1339 }
1341 1340
1342 1341
1343 static Handle<JSObject> ResolveCustomCallGeneratorHolder( 1342 static Handle<JSObject> ResolveBuiltinIdHolder(
1344 Handle<Context> global_context, 1343 Handle<Context> global_context,
1345 const char* holder_expr) { 1344 const char* holder_expr) {
1346 Handle<GlobalObject> global(global_context->global()); 1345 Handle<GlobalObject> global(global_context->global());
1347 const char* period_pos = strchr(holder_expr, '.'); 1346 const char* period_pos = strchr(holder_expr, '.');
1348 if (period_pos == NULL) { 1347 if (period_pos == NULL) {
1349 return Handle<JSObject>::cast( 1348 return Handle<JSObject>::cast(
1350 GetProperty(global, FACTORY->LookupAsciiSymbol(holder_expr))); 1349 GetProperty(global, FACTORY->LookupAsciiSymbol(holder_expr)));
1351 } 1350 }
1352 ASSERT_EQ(".prototype", period_pos); 1351 ASSERT_EQ(".prototype", period_pos);
1353 Vector<const char> property(holder_expr, 1352 Vector<const char> property(holder_expr,
1354 static_cast<int>(period_pos - holder_expr)); 1353 static_cast<int>(period_pos - holder_expr));
1355 Handle<JSFunction> function = Handle<JSFunction>::cast( 1354 Handle<JSFunction> function = Handle<JSFunction>::cast(
1356 GetProperty(global, FACTORY->LookupSymbol(property))); 1355 GetProperty(global, FACTORY->LookupSymbol(property)));
1357 return Handle<JSObject>(JSObject::cast(function->prototype())); 1356 return Handle<JSObject>(JSObject::cast(function->prototype()));
1358 } 1357 }
1359 1358
1360 1359
1361 static void InstallCustomCallGenerator(Handle<JSObject> holder, 1360 static void InstallBuiltinFunctionId(Handle<JSObject> holder,
1362 const char* function_name, 1361 const char* function_name,
1363 int id) { 1362 BuiltinFunctionId id) {
1364 Handle<String> name = FACTORY->LookupAsciiSymbol(function_name); 1363 Handle<String> name = FACTORY->LookupAsciiSymbol(function_name);
1365 Object* function_object = holder->GetProperty(*name)->ToObjectUnchecked(); 1364 Object* function_object = holder->GetProperty(*name)->ToObjectUnchecked();
1366 Handle<JSFunction> function(JSFunction::cast(function_object)); 1365 Handle<JSFunction> function(JSFunction::cast(function_object));
1367 function->shared()->set_function_data(Smi::FromInt(id)); 1366 function->shared()->set_function_data(Smi::FromInt(id));
1368 } 1367 }
1369 1368
1370 1369
1371 void Genesis::InstallCustomCallGenerators() { 1370 void Genesis::InstallBuiltinFunctionIds() {
1372 HandleScope scope; 1371 HandleScope scope;
1373 #define INSTALL_CALL_GENERATOR(holder_expr, fun_name, name) \ 1372 #define INSTALL_BUILTIN_ID(holder_expr, fun_name, name) \
1374 { \ 1373 { \
1375 Handle<JSObject> holder = ResolveCustomCallGeneratorHolder( \ 1374 Handle<JSObject> holder = ResolveBuiltinIdHolder( \
1376 global_context(), #holder_expr); \ 1375 global_context(), #holder_expr); \
1377 const int id = CallStubCompiler::k##name##CallGenerator; \ 1376 BuiltinFunctionId id = k##name; \
1378 InstallCustomCallGenerator(holder, #fun_name, id); \ 1377 InstallBuiltinFunctionId(holder, #fun_name, id); \
1379 } 1378 }
1380 CUSTOM_CALL_IC_GENERATORS(INSTALL_CALL_GENERATOR) 1379 FUNCTIONS_WITH_ID_LIST(INSTALL_BUILTIN_ID)
1381 #undef INSTALL_CALL_GENERATOR 1380 #undef INSTALL_BUILTIN_ID
1382 } 1381 }
1383 1382
1384 1383
1385 // Do not forget to update macros.py with named constant 1384 // Do not forget to update macros.py with named constant
1386 // of cache id. 1385 // of cache id.
1387 #define JSFUNCTION_RESULT_CACHE_LIST(F) \ 1386 #define JSFUNCTION_RESULT_CACHE_LIST(F) \
1388 F(16, global_context()->regexp_function()) 1387 F(16, global_context()->regexp_function())
1389 1388
1390 1389
1391 static FixedArray* CreateCache(int size, JSFunction* factory) { 1390 static FixedArray* CreateCache(int size, JSFunction* factory) {
(...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after
1843 return from + sizeof(NestingCounterType); 1842 return from + sizeof(NestingCounterType);
1844 } 1843 }
1845 1844
1846 1845
1847 // Called when the top-level V8 mutex is destroyed. 1846 // Called when the top-level V8 mutex is destroyed.
1848 void Bootstrapper::FreeThreadResources() { 1847 void Bootstrapper::FreeThreadResources() {
1849 ASSERT(!IsActive()); 1848 ASSERT(!IsActive());
1850 } 1849 }
1851 1850
1852 } } // namespace v8::internal 1851 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/ast-inl.h ('k') | src/builtins.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698