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

Side by Side Diff: src/bootstrapper.cc

Issue 12254007: Make the Isolate parameter mandatory for internal HandleScopes. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebased Created 7 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/bootstrapper.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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 if (bootstrapper->delete_these_non_arrays_on_tear_down_ == NULL) { 56 if (bootstrapper->delete_these_non_arrays_on_tear_down_ == NULL) {
57 bootstrapper->delete_these_non_arrays_on_tear_down_ = new List<char*>(2); 57 bootstrapper->delete_these_non_arrays_on_tear_down_ = new List<char*>(2);
58 } 58 }
59 // The resources are small objects and we only make a fixed number of 59 // The resources are small objects and we only make a fixed number of
60 // them, but let's clean them up on exit for neatness. 60 // them, but let's clean them up on exit for neatness.
61 bootstrapper->delete_these_non_arrays_on_tear_down_-> 61 bootstrapper->delete_these_non_arrays_on_tear_down_->
62 Add(reinterpret_cast<char*>(this)); 62 Add(reinterpret_cast<char*>(this));
63 } 63 }
64 64
65 65
66 Bootstrapper::Bootstrapper() 66 Bootstrapper::Bootstrapper(Isolate* isolate)
67 : nesting_(0), 67 : isolate_(isolate),
68 nesting_(0),
68 extensions_cache_(Script::TYPE_EXTENSION), 69 extensions_cache_(Script::TYPE_EXTENSION),
69 delete_these_non_arrays_on_tear_down_(NULL), 70 delete_these_non_arrays_on_tear_down_(NULL),
70 delete_these_arrays_on_tear_down_(NULL) { 71 delete_these_arrays_on_tear_down_(NULL) {
71 } 72 }
72 73
73 74
74 Handle<String> Bootstrapper::NativesSourceLookup(int index) { 75 Handle<String> Bootstrapper::NativesSourceLookup(int index) {
75 ASSERT(0 <= index && index < Natives::GetBuiltinsCount()); 76 ASSERT(0 <= index && index < Natives::GetBuiltinsCount());
76 Isolate* isolate = Isolate::Current(); 77 Heap* heap = isolate_->heap();
77 Factory* factory = isolate->factory();
78 Heap* heap = isolate->heap();
79 if (heap->natives_source_cache()->get(index)->IsUndefined()) { 78 if (heap->natives_source_cache()->get(index)->IsUndefined()) {
80 // We can use external strings for the natives. 79 // We can use external strings for the natives.
81 Vector<const char> source = Natives::GetRawScriptSource(index); 80 Vector<const char> source = Natives::GetRawScriptSource(index);
82 NativesExternalStringResource* resource = 81 NativesExternalStringResource* resource =
83 new NativesExternalStringResource(this, 82 new NativesExternalStringResource(this,
84 source.start(), 83 source.start(),
85 source.length()); 84 source.length());
86 Handle<String> source_code = 85 Handle<String> source_code =
87 factory->NewExternalStringFromAscii(resource); 86 isolate_->factory()->NewExternalStringFromAscii(resource);
88 heap->natives_source_cache()->set(index, *source_code); 87 heap->natives_source_cache()->set(index, *source_code);
89 } 88 }
90 Handle<Object> cached_source(heap->natives_source_cache()->get(index)); 89 Handle<Object> cached_source(heap->natives_source_cache()->get(index));
91 return Handle<String>::cast(cached_source); 90 return Handle<String>::cast(cached_source);
92 } 91 }
93 92
94 93
95 void Bootstrapper::Initialize(bool create_heap_objects) { 94 void Bootstrapper::Initialize(bool create_heap_objects) {
96 extensions_cache_.Initialize(create_heap_objects); 95 extensions_cache_.Initialize(create_heap_objects);
97 GCExtension::Register(); 96 GCExtension::Register();
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 ExtensionTraversalState state); 222 ExtensionTraversalState state);
224 private: 223 private:
225 HashMap map_; 224 HashMap map_;
226 DISALLOW_COPY_AND_ASSIGN(ExtensionStates); 225 DISALLOW_COPY_AND_ASSIGN(ExtensionStates);
227 }; 226 };
228 227
229 // Used both for deserialized and from-scratch contexts to add the extensions 228 // Used both for deserialized and from-scratch contexts to add the extensions
230 // provided. 229 // provided.
231 static bool InstallExtensions(Handle<Context> native_context, 230 static bool InstallExtensions(Handle<Context> native_context,
232 v8::ExtensionConfiguration* extensions); 231 v8::ExtensionConfiguration* extensions);
233 static bool InstallExtension(const char* name, 232 static bool InstallExtension(Isolate* isolate,
233 const char* name,
234 ExtensionStates* extension_states); 234 ExtensionStates* extension_states);
235 static bool InstallExtension(v8::RegisteredExtension* current, 235 static bool InstallExtension(Isolate* isolate,
236 v8::RegisteredExtension* current,
236 ExtensionStates* extension_states); 237 ExtensionStates* extension_states);
237 static void InstallSpecialObjects(Handle<Context> native_context); 238 static void InstallSpecialObjects(Handle<Context> native_context);
238 bool InstallJSBuiltins(Handle<JSBuiltinsObject> builtins); 239 bool InstallJSBuiltins(Handle<JSBuiltinsObject> builtins);
239 bool ConfigureApiObject(Handle<JSObject> object, 240 bool ConfigureApiObject(Handle<JSObject> object,
240 Handle<ObjectTemplateInfo> object_template); 241 Handle<ObjectTemplateInfo> object_template);
241 bool ConfigureGlobalObjects(v8::Handle<v8::ObjectTemplate> global_template); 242 bool ConfigureGlobalObjects(v8::Handle<v8::ObjectTemplate> global_template);
242 243
243 // Migrates all properties from the 'from' object to the 'to' 244 // Migrates all properties from the 'from' object to the 'to'
244 // object and overrides the prototype in 'to' with the one from 245 // object and overrides the prototype in 'to' with the one from
245 // 'from'. 246 // 'from'.
(...skipping 15 matching lines...) Expand all
261 262
262 Handle<Map> CreateStrictModeFunctionMap( 263 Handle<Map> CreateStrictModeFunctionMap(
263 PrototypePropertyMode prototype_mode, 264 PrototypePropertyMode prototype_mode,
264 Handle<JSFunction> empty_function); 265 Handle<JSFunction> empty_function);
265 266
266 void SetStrictFunctionInstanceDescriptor(Handle<Map> map, 267 void SetStrictFunctionInstanceDescriptor(Handle<Map> map,
267 PrototypePropertyMode propertyMode); 268 PrototypePropertyMode propertyMode);
268 269
269 static bool CompileBuiltin(Isolate* isolate, int index); 270 static bool CompileBuiltin(Isolate* isolate, int index);
270 static bool CompileExperimentalBuiltin(Isolate* isolate, int index); 271 static bool CompileExperimentalBuiltin(Isolate* isolate, int index);
271 static bool CompileNative(Vector<const char> name, Handle<String> source); 272 static bool CompileNative(Isolate* isolate,
272 static bool CompileScriptCached(Vector<const char> name, 273 Vector<const char> name,
274 Handle<String> source);
275 static bool CompileScriptCached(Isolate* isolate,
276 Vector<const char> name,
273 Handle<String> source, 277 Handle<String> source,
274 SourceCodeCache* cache, 278 SourceCodeCache* cache,
275 v8::Extension* extension, 279 v8::Extension* extension,
276 Handle<Context> top_context, 280 Handle<Context> top_context,
277 bool use_runtime_context); 281 bool use_runtime_context);
278 282
279 Handle<Context> result_; 283 Handle<Context> result_;
280 284
281 // Function instance maps. Function literal maps are created initially with 285 // Function instance maps. Function literal maps are created initially with
282 // a read only prototype for the processing of JS builtins. Later the function 286 // a read only prototype for the processing of JS builtins. Later the function
283 // instance maps are replaced in order to make prototype writable. 287 // instance maps are replaced in order to make prototype writable.
284 // These are the final, writable prototype, maps. 288 // These are the final, writable prototype, maps.
285 Handle<Map> function_instance_map_writable_prototype_; 289 Handle<Map> function_instance_map_writable_prototype_;
286 Handle<Map> strict_mode_function_instance_map_writable_prototype_; 290 Handle<Map> strict_mode_function_instance_map_writable_prototype_;
287 Handle<JSFunction> throw_type_error_function; 291 Handle<JSFunction> throw_type_error_function;
288 292
289 BootstrapperActive active_; 293 BootstrapperActive active_;
290 friend class Bootstrapper; 294 friend class Bootstrapper;
291 }; 295 };
292 296
293 297
294 void Bootstrapper::Iterate(ObjectVisitor* v) { 298 void Bootstrapper::Iterate(ObjectVisitor* v) {
295 extensions_cache_.Iterate(v); 299 extensions_cache_.Iterate(v);
296 v->Synchronize(VisitorSynchronization::kExtensions); 300 v->Synchronize(VisitorSynchronization::kExtensions);
297 } 301 }
298 302
299 303
300 Handle<Context> Bootstrapper::CreateEnvironment( 304 Handle<Context> Bootstrapper::CreateEnvironment(
301 Isolate* isolate,
302 Handle<Object> global_object, 305 Handle<Object> global_object,
303 v8::Handle<v8::ObjectTemplate> global_template, 306 v8::Handle<v8::ObjectTemplate> global_template,
304 v8::ExtensionConfiguration* extensions) { 307 v8::ExtensionConfiguration* extensions) {
305 HandleScope scope; 308 HandleScope scope(isolate_);
306 Handle<Context> env; 309 Handle<Context> env;
307 Genesis genesis(isolate, global_object, global_template, extensions); 310 Genesis genesis(isolate_, global_object, global_template, extensions);
308 env = genesis.result(); 311 env = genesis.result();
309 if (!env.is_null()) { 312 if (!env.is_null()) {
310 if (InstallExtensions(env, extensions)) { 313 if (InstallExtensions(env, extensions)) {
311 return env; 314 return env;
312 } 315 }
313 } 316 }
314 return Handle<Context>(); 317 return Handle<Context>();
315 } 318 }
316 319
317 320
(...skipping 969 matching lines...) Expand 10 before | Expand all | Expand 10 after
1287 prototype, Builtins::kIllegal, true); 1290 prototype, Builtins::kIllegal, true);
1288 } 1291 }
1289 } 1292 }
1290 } 1293 }
1291 1294
1292 1295
1293 bool Genesis::CompileBuiltin(Isolate* isolate, int index) { 1296 bool Genesis::CompileBuiltin(Isolate* isolate, int index) {
1294 Vector<const char> name = Natives::GetScriptName(index); 1297 Vector<const char> name = Natives::GetScriptName(index);
1295 Handle<String> source_code = 1298 Handle<String> source_code =
1296 isolate->bootstrapper()->NativesSourceLookup(index); 1299 isolate->bootstrapper()->NativesSourceLookup(index);
1297 return CompileNative(name, source_code); 1300 return CompileNative(isolate, name, source_code);
1298 } 1301 }
1299 1302
1300 1303
1301 bool Genesis::CompileExperimentalBuiltin(Isolate* isolate, int index) { 1304 bool Genesis::CompileExperimentalBuiltin(Isolate* isolate, int index) {
1302 Vector<const char> name = ExperimentalNatives::GetScriptName(index); 1305 Vector<const char> name = ExperimentalNatives::GetScriptName(index);
1303 Factory* factory = isolate->factory(); 1306 Factory* factory = isolate->factory();
1304 Handle<String> source_code = 1307 Handle<String> source_code =
1305 factory->NewStringFromAscii( 1308 factory->NewStringFromAscii(
1306 ExperimentalNatives::GetRawScriptSource(index)); 1309 ExperimentalNatives::GetRawScriptSource(index));
1307 return CompileNative(name, source_code); 1310 return CompileNative(isolate, name, source_code);
1308 } 1311 }
1309 1312
1310 1313
1311 bool Genesis::CompileNative(Vector<const char> name, Handle<String> source) { 1314 bool Genesis::CompileNative(Isolate* isolate,
1312 HandleScope scope; 1315 Vector<const char> name,
1313 Isolate* isolate = source->GetIsolate(); 1316 Handle<String> source) {
1317 HandleScope scope(isolate);
1314 #ifdef ENABLE_DEBUGGER_SUPPORT 1318 #ifdef ENABLE_DEBUGGER_SUPPORT
1315 isolate->debugger()->set_compiling_natives(true); 1319 isolate->debugger()->set_compiling_natives(true);
1316 #endif 1320 #endif
1317 // During genesis, the boilerplate for stack overflow won't work until the 1321 // During genesis, the boilerplate for stack overflow won't work until the
1318 // environment has been at least partially initialized. Add a stack check 1322 // environment has been at least partially initialized. Add a stack check
1319 // before entering JS code to catch overflow early. 1323 // before entering JS code to catch overflow early.
1320 StackLimitCheck check(Isolate::Current()); 1324 StackLimitCheck check(isolate);
1321 if (check.HasOverflowed()) return false; 1325 if (check.HasOverflowed()) return false;
1322 1326
1323 bool result = CompileScriptCached(name, 1327 bool result = CompileScriptCached(isolate,
1328 name,
1324 source, 1329 source,
1325 NULL, 1330 NULL,
1326 NULL, 1331 NULL,
1327 Handle<Context>(isolate->context()), 1332 Handle<Context>(isolate->context()),
1328 true); 1333 true);
1329 ASSERT(isolate->has_pending_exception() != result); 1334 ASSERT(isolate->has_pending_exception() != result);
1330 if (!result) isolate->clear_pending_exception(); 1335 if (!result) isolate->clear_pending_exception();
1331 #ifdef ENABLE_DEBUGGER_SUPPORT 1336 #ifdef ENABLE_DEBUGGER_SUPPORT
1332 isolate->debugger()->set_compiling_natives(false); 1337 isolate->debugger()->set_compiling_natives(false);
1333 #endif 1338 #endif
1334 return result; 1339 return result;
1335 } 1340 }
1336 1341
1337 1342
1338 bool Genesis::CompileScriptCached(Vector<const char> name, 1343 bool Genesis::CompileScriptCached(Isolate* isolate,
1344 Vector<const char> name,
1339 Handle<String> source, 1345 Handle<String> source,
1340 SourceCodeCache* cache, 1346 SourceCodeCache* cache,
1341 v8::Extension* extension, 1347 v8::Extension* extension,
1342 Handle<Context> top_context, 1348 Handle<Context> top_context,
1343 bool use_runtime_context) { 1349 bool use_runtime_context) {
1344 Factory* factory = source->GetIsolate()->factory(); 1350 Factory* factory = isolate->factory();
1345 HandleScope scope; 1351 HandleScope scope(isolate);
1346 Handle<SharedFunctionInfo> function_info; 1352 Handle<SharedFunctionInfo> function_info;
1347 1353
1348 // If we can't find the function in the cache, we compile a new 1354 // If we can't find the function in the cache, we compile a new
1349 // function and insert it into the cache. 1355 // function and insert it into the cache.
1350 if (cache == NULL || !cache->Lookup(name, &function_info)) { 1356 if (cache == NULL || !cache->Lookup(name, &function_info)) {
1351 ASSERT(source->IsOneByteRepresentation()); 1357 ASSERT(source->IsOneByteRepresentation());
1352 Handle<String> script_name = factory->NewStringFromUtf8(name); 1358 Handle<String> script_name = factory->NewStringFromUtf8(name);
1353 function_info = Compiler::Compile( 1359 function_info = Compiler::Compile(
1354 source, 1360 source,
1355 script_name, 1361 script_name,
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
1391 #define INSTALL_NATIVE(Type, name, var) \ 1397 #define INSTALL_NATIVE(Type, name, var) \
1392 Handle<String> var##_name = \ 1398 Handle<String> var##_name = \
1393 factory()->LookupOneByteSymbol(STATIC_ASCII_VECTOR(name)); \ 1399 factory()->LookupOneByteSymbol(STATIC_ASCII_VECTOR(name)); \
1394 Object* var##_native = \ 1400 Object* var##_native = \
1395 native_context()->builtins()->GetPropertyNoExceptionThrown( \ 1401 native_context()->builtins()->GetPropertyNoExceptionThrown( \
1396 *var##_name); \ 1402 *var##_name); \
1397 native_context()->set_##var(Type::cast(var##_native)); 1403 native_context()->set_##var(Type::cast(var##_native));
1398 1404
1399 1405
1400 void Genesis::InstallNativeFunctions() { 1406 void Genesis::InstallNativeFunctions() {
1401 HandleScope scope; 1407 HandleScope scope(isolate());
1402 INSTALL_NATIVE(JSFunction, "CreateDate", create_date_fun); 1408 INSTALL_NATIVE(JSFunction, "CreateDate", create_date_fun);
1403 INSTALL_NATIVE(JSFunction, "ToNumber", to_number_fun); 1409 INSTALL_NATIVE(JSFunction, "ToNumber", to_number_fun);
1404 INSTALL_NATIVE(JSFunction, "ToString", to_string_fun); 1410 INSTALL_NATIVE(JSFunction, "ToString", to_string_fun);
1405 INSTALL_NATIVE(JSFunction, "ToDetailString", to_detail_string_fun); 1411 INSTALL_NATIVE(JSFunction, "ToDetailString", to_detail_string_fun);
1406 INSTALL_NATIVE(JSFunction, "ToObject", to_object_fun); 1412 INSTALL_NATIVE(JSFunction, "ToObject", to_object_fun);
1407 INSTALL_NATIVE(JSFunction, "ToInteger", to_integer_fun); 1413 INSTALL_NATIVE(JSFunction, "ToInteger", to_integer_fun);
1408 INSTALL_NATIVE(JSFunction, "ToUint32", to_uint32_fun); 1414 INSTALL_NATIVE(JSFunction, "ToUint32", to_uint32_fun);
1409 INSTALL_NATIVE(JSFunction, "ToInt32", to_int32_fun); 1415 INSTALL_NATIVE(JSFunction, "ToInt32", to_int32_fun);
1410 INSTALL_NATIVE(JSFunction, "GlobalEval", global_eval_fun); 1416 INSTALL_NATIVE(JSFunction, "GlobalEval", global_eval_fun);
1411 INSTALL_NATIVE(JSFunction, "Instantiate", instantiate_fun); 1417 INSTALL_NATIVE(JSFunction, "Instantiate", instantiate_fun);
(...skipping 16 matching lines...) Expand all
1428 INSTALL_NATIVE(JSFunction, "NotifyChange", observers_notify_change); 1434 INSTALL_NATIVE(JSFunction, "NotifyChange", observers_notify_change);
1429 INSTALL_NATIVE(JSFunction, "DeliverChangeRecords", 1435 INSTALL_NATIVE(JSFunction, "DeliverChangeRecords",
1430 observers_deliver_changes); 1436 observers_deliver_changes);
1431 } 1437 }
1432 } 1438 }
1433 1439
1434 #undef INSTALL_NATIVE 1440 #undef INSTALL_NATIVE
1435 1441
1436 1442
1437 bool Genesis::InstallNatives() { 1443 bool Genesis::InstallNatives() {
1438 HandleScope scope; 1444 HandleScope scope(isolate());
1439 1445
1440 // Create a function for the builtins object. Allocate space for the 1446 // Create a function for the builtins object. Allocate space for the
1441 // JavaScript builtins, a reference to the builtins object 1447 // JavaScript builtins, a reference to the builtins object
1442 // (itself) and a reference to the native_context directly in the object. 1448 // (itself) and a reference to the native_context directly in the object.
1443 Handle<Code> code = Handle<Code>( 1449 Handle<Code> code = Handle<Code>(
1444 isolate()->builtins()->builtin(Builtins::kIllegal)); 1450 isolate()->builtins()->builtin(Builtins::kIllegal));
1445 Handle<JSFunction> builtins_fun = 1451 Handle<JSFunction> builtins_fun =
1446 factory()->NewFunction(factory()->empty_symbol(), 1452 factory()->NewFunction(factory()->empty_symbol(),
1447 JS_BUILTINS_OBJECT_TYPE, 1453 JS_BUILTINS_OBJECT_TYPE,
1448 JSBuiltinsObject::kSize, code, true); 1454 JSBuiltinsObject::kSize, code, true);
(...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after
1889 BuiltinFunctionId id) { 1895 BuiltinFunctionId id) {
1890 Factory* factory = holder->GetIsolate()->factory(); 1896 Factory* factory = holder->GetIsolate()->factory();
1891 Handle<String> name = factory->LookupUtf8Symbol(function_name); 1897 Handle<String> name = factory->LookupUtf8Symbol(function_name);
1892 Object* function_object = holder->GetProperty(*name)->ToObjectUnchecked(); 1898 Object* function_object = holder->GetProperty(*name)->ToObjectUnchecked();
1893 Handle<JSFunction> function(JSFunction::cast(function_object)); 1899 Handle<JSFunction> function(JSFunction::cast(function_object));
1894 function->shared()->set_function_data(Smi::FromInt(id)); 1900 function->shared()->set_function_data(Smi::FromInt(id));
1895 } 1901 }
1896 1902
1897 1903
1898 void Genesis::InstallBuiltinFunctionIds() { 1904 void Genesis::InstallBuiltinFunctionIds() {
1899 HandleScope scope; 1905 HandleScope scope(isolate());
1900 #define INSTALL_BUILTIN_ID(holder_expr, fun_name, name) \ 1906 #define INSTALL_BUILTIN_ID(holder_expr, fun_name, name) \
1901 { \ 1907 { \
1902 Handle<JSObject> holder = ResolveBuiltinIdHolder( \ 1908 Handle<JSObject> holder = ResolveBuiltinIdHolder( \
1903 native_context(), #holder_expr); \ 1909 native_context(), #holder_expr); \
1904 BuiltinFunctionId id = k##name; \ 1910 BuiltinFunctionId id = k##name; \
1905 InstallBuiltinFunctionId(holder, #fun_name, id); \ 1911 InstallBuiltinFunctionId(holder, #fun_name, id); \
1906 } 1912 }
1907 FUNCTIONS_WITH_ID_LIST(INSTALL_BUILTIN_ID) 1913 FUNCTIONS_WITH_ID_LIST(INSTALL_BUILTIN_ID)
1908 #undef INSTALL_BUILTIN_ID 1914 #undef INSTALL_BUILTIN_ID
1909 } 1915 }
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
1954 1960
1955 void Genesis::InitializeNormalizedMapCaches() { 1961 void Genesis::InitializeNormalizedMapCaches() {
1956 Handle<FixedArray> array( 1962 Handle<FixedArray> array(
1957 FACTORY->NewFixedArray(NormalizedMapCache::kEntries, TENURED)); 1963 FACTORY->NewFixedArray(NormalizedMapCache::kEntries, TENURED));
1958 native_context()->set_normalized_map_cache(NormalizedMapCache::cast(*array)); 1964 native_context()->set_normalized_map_cache(NormalizedMapCache::cast(*array));
1959 } 1965 }
1960 1966
1961 1967
1962 bool Bootstrapper::InstallExtensions(Handle<Context> native_context, 1968 bool Bootstrapper::InstallExtensions(Handle<Context> native_context,
1963 v8::ExtensionConfiguration* extensions) { 1969 v8::ExtensionConfiguration* extensions) {
1964 Isolate* isolate = native_context->GetIsolate(); 1970 BootstrapperActive active(this);
1965 BootstrapperActive active; 1971 SaveContext saved_context(isolate_);
1966 SaveContext saved_context(isolate); 1972 isolate_->set_context(*native_context);
1967 isolate->set_context(*native_context);
1968 if (!Genesis::InstallExtensions(native_context, extensions)) return false; 1973 if (!Genesis::InstallExtensions(native_context, extensions)) return false;
1969 Genesis::InstallSpecialObjects(native_context); 1974 Genesis::InstallSpecialObjects(native_context);
1970 return true; 1975 return true;
1971 } 1976 }
1972 1977
1973 1978
1974 void Genesis::InstallSpecialObjects(Handle<Context> native_context) { 1979 void Genesis::InstallSpecialObjects(Handle<Context> native_context) {
1975 Isolate* isolate = native_context->GetIsolate(); 1980 Isolate* isolate = native_context->GetIsolate();
1976 Factory* factory = isolate->factory(); 1981 Factory* factory = isolate->factory();
1977 HandleScope scope; 1982 HandleScope scope(isolate);
1978 Handle<JSGlobalObject> global(JSGlobalObject::cast( 1983 Handle<JSGlobalObject> global(JSGlobalObject::cast(
1979 native_context->global_object())); 1984 native_context->global_object()));
1980 // Expose the natives in global if a name for it is specified. 1985 // Expose the natives in global if a name for it is specified.
1981 if (FLAG_expose_natives_as != NULL && strlen(FLAG_expose_natives_as) != 0) { 1986 if (FLAG_expose_natives_as != NULL && strlen(FLAG_expose_natives_as) != 0) {
1982 Handle<String> natives = factory->LookupUtf8Symbol(FLAG_expose_natives_as); 1987 Handle<String> natives = factory->LookupUtf8Symbol(FLAG_expose_natives_as);
1983 CHECK_NOT_EMPTY_HANDLE(isolate, 1988 CHECK_NOT_EMPTY_HANDLE(isolate,
1984 JSObject::SetLocalPropertyIgnoreAttributes( 1989 JSObject::SetLocalPropertyIgnoreAttributes(
1985 global, natives, 1990 global, natives,
1986 Handle<JSObject>(global->builtins()), 1991 Handle<JSObject>(global->builtins()),
1987 DONT_ENUM)); 1992 DONT_ENUM));
1988 } 1993 }
1989 1994
1990 Handle<Object> Error = GetProperty(global, "Error"); 1995 Handle<Object> Error = GetProperty(global, "Error");
1991 if (Error->IsJSObject()) { 1996 if (Error->IsJSObject()) {
1992 Handle<String> name = 1997 Handle<String> name =
1993 factory->LookupOneByteSymbol(STATIC_ASCII_VECTOR("stackTraceLimit")); 1998 factory->LookupOneByteSymbol(STATIC_ASCII_VECTOR("stackTraceLimit"));
1994 Handle<Smi> stack_trace_limit(Smi::FromInt(FLAG_stack_trace_limit)); 1999 Handle<Smi> stack_trace_limit(Smi::FromInt(FLAG_stack_trace_limit));
1995 CHECK_NOT_EMPTY_HANDLE(isolate, 2000 CHECK_NOT_EMPTY_HANDLE(isolate,
1996 JSObject::SetLocalPropertyIgnoreAttributes( 2001 JSObject::SetLocalPropertyIgnoreAttributes(
1997 Handle<JSObject>::cast(Error), name, 2002 Handle<JSObject>::cast(Error), name,
1998 stack_trace_limit, NONE)); 2003 stack_trace_limit, NONE));
1999 } 2004 }
2000 2005
2001 #ifdef ENABLE_DEBUGGER_SUPPORT 2006 #ifdef ENABLE_DEBUGGER_SUPPORT
2002 // Expose the debug global object in global if a name for it is specified. 2007 // Expose the debug global object in global if a name for it is specified.
2003 if (FLAG_expose_debug_as != NULL && strlen(FLAG_expose_debug_as) != 0) { 2008 if (FLAG_expose_debug_as != NULL && strlen(FLAG_expose_debug_as) != 0) {
2004 Debug* debug = Isolate::Current()->debug(); 2009 Debug* debug = isolate->debug();
2005 // If loading fails we just bail out without installing the 2010 // If loading fails we just bail out without installing the
2006 // debugger but without tanking the whole context. 2011 // debugger but without tanking the whole context.
2007 if (!debug->Load()) return; 2012 if (!debug->Load()) return;
2008 // Set the security token for the debugger context to the same as 2013 // Set the security token for the debugger context to the same as
2009 // the shell native context to allow calling between these (otherwise 2014 // the shell native context to allow calling between these (otherwise
2010 // exposing debug global object doesn't make much sense). 2015 // exposing debug global object doesn't make much sense).
2011 debug->debug_context()->set_security_token( 2016 debug->debug_context()->set_security_token(
2012 native_context->security_token()); 2017 native_context->security_token());
2013 2018
2014 Handle<String> debug_string = 2019 Handle<String> debug_string =
(...skipping 28 matching lines...) Expand all
2043 } 2048 }
2044 2049
2045 void Genesis::ExtensionStates::set_state(RegisteredExtension* extension, 2050 void Genesis::ExtensionStates::set_state(RegisteredExtension* extension,
2046 ExtensionTraversalState state) { 2051 ExtensionTraversalState state) {
2047 map_.Lookup(extension, Hash(extension), true)->value = 2052 map_.Lookup(extension, Hash(extension), true)->value =
2048 reinterpret_cast<void*>(static_cast<intptr_t>(state)); 2053 reinterpret_cast<void*>(static_cast<intptr_t>(state));
2049 } 2054 }
2050 2055
2051 bool Genesis::InstallExtensions(Handle<Context> native_context, 2056 bool Genesis::InstallExtensions(Handle<Context> native_context,
2052 v8::ExtensionConfiguration* extensions) { 2057 v8::ExtensionConfiguration* extensions) {
2053 // TODO(isolates): Extensions on multiple isolates may take a little more 2058 Isolate* isolate = native_context->GetIsolate();
2054 // effort. (The external API reads 'ignore'-- does that mean
2055 // we can break the interface?)
2056
2057
2058 ExtensionStates extension_states; // All extensions have state UNVISITED. 2059 ExtensionStates extension_states; // All extensions have state UNVISITED.
2059 // Install auto extensions. 2060 // Install auto extensions.
2060 v8::RegisteredExtension* current = v8::RegisteredExtension::first_extension(); 2061 v8::RegisteredExtension* current = v8::RegisteredExtension::first_extension();
2061 while (current != NULL) { 2062 while (current != NULL) {
2062 if (current->extension()->auto_enable()) 2063 if (current->extension()->auto_enable())
2063 InstallExtension(current, &extension_states); 2064 InstallExtension(isolate, current, &extension_states);
2064 current = current->next(); 2065 current = current->next();
2065 } 2066 }
2066 2067
2067 if (FLAG_expose_gc) InstallExtension("v8/gc", &extension_states); 2068 if (FLAG_expose_gc) InstallExtension(isolate, "v8/gc", &extension_states);
2068 if (FLAG_expose_externalize_string) { 2069 if (FLAG_expose_externalize_string) {
2069 InstallExtension("v8/externalize", &extension_states); 2070 InstallExtension(isolate, "v8/externalize", &extension_states);
2070 } 2071 }
2071 if (FLAG_track_gc_object_stats) { 2072 if (FLAG_track_gc_object_stats) {
2072 InstallExtension("v8/statistics", &extension_states); 2073 InstallExtension(isolate, "v8/statistics", &extension_states);
2073 } 2074 }
2074 2075
2075 if (extensions == NULL) return true; 2076 if (extensions == NULL) return true;
2076 // Install required extensions 2077 // Install required extensions
2077 int count = v8::ImplementationUtilities::GetNameCount(extensions); 2078 int count = v8::ImplementationUtilities::GetNameCount(extensions);
2078 const char** names = v8::ImplementationUtilities::GetNames(extensions); 2079 const char** names = v8::ImplementationUtilities::GetNames(extensions);
2079 for (int i = 0; i < count; i++) { 2080 for (int i = 0; i < count; i++) {
2080 if (!InstallExtension(names[i], &extension_states)) 2081 if (!InstallExtension(isolate, names[i], &extension_states))
2081 return false; 2082 return false;
2082 } 2083 }
2083 2084
2084 return true; 2085 return true;
2085 } 2086 }
2086 2087
2087 2088
2088 // Installs a named extension. This methods is unoptimized and does 2089 // Installs a named extension. This methods is unoptimized and does
2089 // not scale well if we want to support a large number of extensions. 2090 // not scale well if we want to support a large number of extensions.
2090 bool Genesis::InstallExtension(const char* name, 2091 bool Genesis::InstallExtension(Isolate* isolate,
2092 const char* name,
2091 ExtensionStates* extension_states) { 2093 ExtensionStates* extension_states) {
2092 v8::RegisteredExtension* current = v8::RegisteredExtension::first_extension(); 2094 v8::RegisteredExtension* current = v8::RegisteredExtension::first_extension();
2093 // Loop until we find the relevant extension 2095 // Loop until we find the relevant extension
2094 while (current != NULL) { 2096 while (current != NULL) {
2095 if (strcmp(name, current->extension()->name()) == 0) break; 2097 if (strcmp(name, current->extension()->name()) == 0) break;
2096 current = current->next(); 2098 current = current->next();
2097 } 2099 }
2098 // Didn't find the extension; fail. 2100 // Didn't find the extension; fail.
2099 if (current == NULL) { 2101 if (current == NULL) {
2100 v8::Utils::ReportApiFailure( 2102 v8::Utils::ReportApiFailure(
2101 "v8::Context::New()", "Cannot find required extension"); 2103 "v8::Context::New()", "Cannot find required extension");
2102 return false; 2104 return false;
2103 } 2105 }
2104 return InstallExtension(current, extension_states); 2106 return InstallExtension(isolate, current, extension_states);
2105 } 2107 }
2106 2108
2107 2109
2108 bool Genesis::InstallExtension(v8::RegisteredExtension* current, 2110 bool Genesis::InstallExtension(Isolate* isolate,
2111 v8::RegisteredExtension* current,
2109 ExtensionStates* extension_states) { 2112 ExtensionStates* extension_states) {
2110 HandleScope scope; 2113 HandleScope scope(isolate);
2111 2114
2112 if (extension_states->get_state(current) == INSTALLED) return true; 2115 if (extension_states->get_state(current) == INSTALLED) return true;
2113 // The current node has already been visited so there must be a 2116 // The current node has already been visited so there must be a
2114 // cycle in the dependency graph; fail. 2117 // cycle in the dependency graph; fail.
2115 if (extension_states->get_state(current) == VISITED) { 2118 if (extension_states->get_state(current) == VISITED) {
2116 v8::Utils::ReportApiFailure( 2119 v8::Utils::ReportApiFailure(
2117 "v8::Context::New()", "Circular extension dependency"); 2120 "v8::Context::New()", "Circular extension dependency");
2118 return false; 2121 return false;
2119 } 2122 }
2120 ASSERT(extension_states->get_state(current) == UNVISITED); 2123 ASSERT(extension_states->get_state(current) == UNVISITED);
2121 extension_states->set_state(current, VISITED); 2124 extension_states->set_state(current, VISITED);
2122 v8::Extension* extension = current->extension(); 2125 v8::Extension* extension = current->extension();
2123 // Install the extension's dependencies 2126 // Install the extension's dependencies
2124 for (int i = 0; i < extension->dependency_count(); i++) { 2127 for (int i = 0; i < extension->dependency_count(); i++) {
2125 if (!InstallExtension(extension->dependencies()[i], extension_states)) 2128 if (!InstallExtension(isolate,
2129 extension->dependencies()[i],
2130 extension_states)) {
2126 return false; 2131 return false;
2132 }
2127 } 2133 }
2128 Isolate* isolate = Isolate::Current();
2129 Handle<String> source_code = 2134 Handle<String> source_code =
2130 isolate->factory()->NewExternalStringFromAscii(extension->source()); 2135 isolate->factory()->NewExternalStringFromAscii(extension->source());
2131 bool result = CompileScriptCached( 2136 bool result = CompileScriptCached(isolate,
2132 CStrVector(extension->name()), 2137 CStrVector(extension->name()),
2133 source_code, 2138 source_code,
2134 isolate->bootstrapper()->extensions_cache(), 2139 isolate->bootstrapper()->extensions_cache(),
2135 extension, 2140 extension,
2136 Handle<Context>(isolate->context()), 2141 Handle<Context>(isolate->context()),
2137 false); 2142 false);
2138 ASSERT(isolate->has_pending_exception() != result); 2143 ASSERT(isolate->has_pending_exception() != result);
2139 if (!result) { 2144 if (!result) {
2140 // We print out the name of the extension that fail to install. 2145 // We print out the name of the extension that fail to install.
2141 // When an error is thrown during bootstrapping we automatically print 2146 // When an error is thrown during bootstrapping we automatically print
2142 // the line number at which this happened to the console in the isolate 2147 // the line number at which this happened to the console in the isolate
2143 // error throwing functionality. 2148 // error throwing functionality.
2144 OS::PrintError("Error installing extension '%s'.\n", 2149 OS::PrintError("Error installing extension '%s'.\n",
2145 current->extension()->name()); 2150 current->extension()->name());
2146 isolate->clear_pending_exception(); 2151 isolate->clear_pending_exception();
2147 } 2152 }
2148 extension_states->set_state(current, INSTALLED); 2153 extension_states->set_state(current, INSTALLED);
2149 isolate->NotifyExtensionInstalled(); 2154 isolate->NotifyExtensionInstalled();
2150 return result; 2155 return result;
2151 } 2156 }
2152 2157
2153 2158
2154 bool Genesis::InstallJSBuiltins(Handle<JSBuiltinsObject> builtins) { 2159 bool Genesis::InstallJSBuiltins(Handle<JSBuiltinsObject> builtins) {
2155 HandleScope scope; 2160 HandleScope scope(isolate());
2156 Factory* factory = builtins->GetIsolate()->factory();
2157 for (int i = 0; i < Builtins::NumberOfJavaScriptBuiltins(); i++) { 2161 for (int i = 0; i < Builtins::NumberOfJavaScriptBuiltins(); i++) {
2158 Builtins::JavaScript id = static_cast<Builtins::JavaScript>(i); 2162 Builtins::JavaScript id = static_cast<Builtins::JavaScript>(i);
2159 Handle<String> name = factory->LookupUtf8Symbol(Builtins::GetName(id)); 2163 Handle<String> name = factory()->LookupUtf8Symbol(Builtins::GetName(id));
2160 Object* function_object = builtins->GetPropertyNoExceptionThrown(*name); 2164 Object* function_object = builtins->GetPropertyNoExceptionThrown(*name);
2161 Handle<JSFunction> function 2165 Handle<JSFunction> function
2162 = Handle<JSFunction>(JSFunction::cast(function_object)); 2166 = Handle<JSFunction>(JSFunction::cast(function_object));
2163 builtins->set_javascript_builtin(id, *function); 2167 builtins->set_javascript_builtin(id, *function);
2164 if (!JSFunction::CompileLazy(function, CLEAR_EXCEPTION)) { 2168 if (!JSFunction::CompileLazy(function, CLEAR_EXCEPTION)) {
2165 return false; 2169 return false;
2166 } 2170 }
2167 builtins->set_javascript_builtin_code(id, function->shared()->code()); 2171 builtins->set_javascript_builtin_code(id, function->shared()->code());
2168 } 2172 }
2169 return true; 2173 return true;
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
2219 2223
2220 void Genesis::TransferNamedProperties(Handle<JSObject> from, 2224 void Genesis::TransferNamedProperties(Handle<JSObject> from,
2221 Handle<JSObject> to) { 2225 Handle<JSObject> to) {
2222 if (from->HasFastProperties()) { 2226 if (from->HasFastProperties()) {
2223 Handle<DescriptorArray> descs = 2227 Handle<DescriptorArray> descs =
2224 Handle<DescriptorArray>(from->map()->instance_descriptors()); 2228 Handle<DescriptorArray>(from->map()->instance_descriptors());
2225 for (int i = 0; i < descs->number_of_descriptors(); i++) { 2229 for (int i = 0; i < descs->number_of_descriptors(); i++) {
2226 PropertyDetails details = descs->GetDetails(i); 2230 PropertyDetails details = descs->GetDetails(i);
2227 switch (details.type()) { 2231 switch (details.type()) {
2228 case FIELD: { 2232 case FIELD: {
2229 HandleScope inner; 2233 HandleScope inner(isolate());
2230 Handle<String> key = Handle<String>(descs->GetKey(i)); 2234 Handle<String> key = Handle<String>(descs->GetKey(i));
2231 int index = descs->GetFieldIndex(i); 2235 int index = descs->GetFieldIndex(i);
2232 Handle<Object> value = Handle<Object>(from->FastPropertyAt(index)); 2236 Handle<Object> value = Handle<Object>(from->FastPropertyAt(index));
2233 CHECK_NOT_EMPTY_HANDLE(to->GetIsolate(), 2237 CHECK_NOT_EMPTY_HANDLE(to->GetIsolate(),
2234 JSObject::SetLocalPropertyIgnoreAttributes( 2238 JSObject::SetLocalPropertyIgnoreAttributes(
2235 to, key, value, details.attributes())); 2239 to, key, value, details.attributes()));
2236 break; 2240 break;
2237 } 2241 }
2238 case CONSTANT_FUNCTION: { 2242 case CONSTANT_FUNCTION: {
2239 HandleScope inner; 2243 HandleScope inner(isolate());
2240 Handle<String> key = Handle<String>(descs->GetKey(i)); 2244 Handle<String> key = Handle<String>(descs->GetKey(i));
2241 Handle<JSFunction> fun = 2245 Handle<JSFunction> fun =
2242 Handle<JSFunction>(descs->GetConstantFunction(i)); 2246 Handle<JSFunction>(descs->GetConstantFunction(i));
2243 CHECK_NOT_EMPTY_HANDLE(to->GetIsolate(), 2247 CHECK_NOT_EMPTY_HANDLE(to->GetIsolate(),
2244 JSObject::SetLocalPropertyIgnoreAttributes( 2248 JSObject::SetLocalPropertyIgnoreAttributes(
2245 to, key, fun, details.attributes())); 2249 to, key, fun, details.attributes()));
2246 break; 2250 break;
2247 } 2251 }
2248 case CALLBACKS: { 2252 case CALLBACKS: {
2249 LookupResult result(isolate()); 2253 LookupResult result(isolate());
2250 to->LocalLookup(descs->GetKey(i), &result); 2254 to->LocalLookup(descs->GetKey(i), &result);
2251 // If the property is already there we skip it 2255 // If the property is already there we skip it
2252 if (result.IsFound()) continue; 2256 if (result.IsFound()) continue;
2253 HandleScope inner; 2257 HandleScope inner(isolate());
2254 ASSERT(!to->HasFastProperties()); 2258 ASSERT(!to->HasFastProperties());
2255 // Add to dictionary. 2259 // Add to dictionary.
2256 Handle<String> key = Handle<String>(descs->GetKey(i)); 2260 Handle<String> key = Handle<String>(descs->GetKey(i));
2257 Handle<Object> callbacks(descs->GetCallbacksObject(i)); 2261 Handle<Object> callbacks(descs->GetCallbacksObject(i));
2258 PropertyDetails d = PropertyDetails(details.attributes(), 2262 PropertyDetails d = PropertyDetails(details.attributes(),
2259 CALLBACKS, 2263 CALLBACKS,
2260 details.descriptor_index()); 2264 details.descriptor_index());
2261 JSObject::SetNormalizedProperty(to, key, callbacks, d); 2265 JSObject::SetNormalizedProperty(to, key, callbacks, d);
2262 break; 2266 break;
2263 } 2267 }
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
2304 Handle<JSObject> to) { 2308 Handle<JSObject> to) {
2305 // Cloning the elements array is sufficient. 2309 // Cloning the elements array is sufficient.
2306 Handle<FixedArray> from_elements = 2310 Handle<FixedArray> from_elements =
2307 Handle<FixedArray>(FixedArray::cast(from->elements())); 2311 Handle<FixedArray>(FixedArray::cast(from->elements()));
2308 Handle<FixedArray> to_elements = FACTORY->CopyFixedArray(from_elements); 2312 Handle<FixedArray> to_elements = FACTORY->CopyFixedArray(from_elements);
2309 to->set_elements(*to_elements); 2313 to->set_elements(*to_elements);
2310 } 2314 }
2311 2315
2312 2316
2313 void Genesis::TransferObject(Handle<JSObject> from, Handle<JSObject> to) { 2317 void Genesis::TransferObject(Handle<JSObject> from, Handle<JSObject> to) {
2314 HandleScope outer; 2318 HandleScope outer(isolate());
2315 Factory* factory = from->GetIsolate()->factory(); 2319 Factory* factory = isolate()->factory();
2316 2320
2317 ASSERT(!from->IsJSArray()); 2321 ASSERT(!from->IsJSArray());
2318 ASSERT(!to->IsJSArray()); 2322 ASSERT(!to->IsJSArray());
2319 2323
2320 TransferNamedProperties(from, to); 2324 TransferNamedProperties(from, to);
2321 TransferIndexedProperties(from, to); 2325 TransferIndexedProperties(from, to);
2322 2326
2323 // Transfer the prototype (new map is needed). 2327 // Transfer the prototype (new map is needed).
2324 Handle<Map> old_to_map = Handle<Map>(to->map()); 2328 Handle<Map> old_to_map = Handle<Map>(to->map());
2325 Handle<Map> new_to_map = factory->CopyMap(old_to_map); 2329 Handle<Map> new_to_map = factory->CopyMap(old_to_map);
(...skipping 13 matching lines...) Expand all
2339 native_context()->set_function_map( 2343 native_context()->set_function_map(
2340 *function_instance_map_writable_prototype_); 2344 *function_instance_map_writable_prototype_);
2341 native_context()->set_strict_mode_function_map( 2345 native_context()->set_strict_mode_function_map(
2342 *strict_mode_function_instance_map_writable_prototype_); 2346 *strict_mode_function_instance_map_writable_prototype_);
2343 } 2347 }
2344 2348
2345 2349
2346 Genesis::Genesis(Isolate* isolate, 2350 Genesis::Genesis(Isolate* isolate,
2347 Handle<Object> global_object, 2351 Handle<Object> global_object,
2348 v8::Handle<v8::ObjectTemplate> global_template, 2352 v8::Handle<v8::ObjectTemplate> global_template,
2349 v8::ExtensionConfiguration* extensions) : isolate_(isolate) { 2353 v8::ExtensionConfiguration* extensions)
2354 : isolate_(isolate),
2355 active_(isolate->bootstrapper()) {
2350 result_ = Handle<Context>::null(); 2356 result_ = Handle<Context>::null();
2351 // If V8 isn't running and cannot be initialized, just return. 2357 // If V8 isn't running and cannot be initialized, just return.
2352 if (!V8::IsRunning() && !V8::Initialize(NULL)) return; 2358 if (!V8::IsRunning() && !V8::Initialize(NULL)) return;
2353 2359
2354 // Before creating the roots we must save the context and restore it 2360 // Before creating the roots we must save the context and restore it
2355 // on all function exits. 2361 // on all function exits.
2356 HandleScope scope; 2362 HandleScope scope(isolate);
2357 SaveContext saved_context(isolate); 2363 SaveContext saved_context(isolate);
2358 2364
2359 // During genesis, the boilerplate for stack overflow won't work until the 2365 // During genesis, the boilerplate for stack overflow won't work until the
2360 // environment has been at least partially initialized. Add a stack check 2366 // environment has been at least partially initialized. Add a stack check
2361 // before entering JS code to catch overflow early. 2367 // before entering JS code to catch overflow early.
2362 StackLimitCheck check(Isolate::Current()); 2368 StackLimitCheck check(isolate);
2363 if (check.HasOverflowed()) return; 2369 if (check.HasOverflowed()) return;
2364 2370
2365 Handle<Context> new_context = Snapshot::NewContextFromSnapshot(); 2371 Handle<Context> new_context = Snapshot::NewContextFromSnapshot();
2366 if (!new_context.is_null()) { 2372 if (!new_context.is_null()) {
2367 native_context_ = 2373 native_context_ =
2368 Handle<Context>::cast(isolate->global_handles()->Create(*new_context)); 2374 Handle<Context>::cast(isolate->global_handles()->Create(*new_context));
2369 AddToWeakNativeContextList(*native_context_); 2375 AddToWeakNativeContextList(*native_context_);
2370 isolate->set_context(*native_context_); 2376 isolate->set_context(*native_context_);
2371 isolate->counters()->contexts_created_by_snapshot()->Increment(); 2377 isolate->counters()->contexts_created_by_snapshot()->Increment();
2372 Handle<GlobalObject> inner_global; 2378 Handle<GlobalObject> inner_global;
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
2429 return from + sizeof(NestingCounterType); 2435 return from + sizeof(NestingCounterType);
2430 } 2436 }
2431 2437
2432 2438
2433 // Called when the top-level V8 mutex is destroyed. 2439 // Called when the top-level V8 mutex is destroyed.
2434 void Bootstrapper::FreeThreadResources() { 2440 void Bootstrapper::FreeThreadResources() {
2435 ASSERT(!IsActive()); 2441 ASSERT(!IsActive());
2436 } 2442 }
2437 2443
2438 } } // namespace v8::internal 2444 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/bootstrapper.h ('k') | src/builtins.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698