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

Side by Side Diff: src/bootstrapper.cc

Issue 3788008: [Isolates] Fix auto extraction of isolate from heap objects in handle constructor. (Closed)
Patch Set: Created 10 years, 2 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
« no previous file with comments | « no previous file | src/debug.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 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 1381 matching lines...) Expand 10 before | Expand all | Expand 10 after
1392 caches->set(index++, cache); \ 1392 caches->set(index++, cache); \
1393 } while (false) 1393 } while (false)
1394 1394
1395 JSFUNCTION_RESULT_CACHE_LIST(F); 1395 JSFUNCTION_RESULT_CACHE_LIST(F);
1396 1396
1397 #undef F 1397 #undef F
1398 1398
1399 global_context()->set_jsfunction_result_caches(*caches); 1399 global_context()->set_jsfunction_result_caches(*caches);
1400 } 1400 }
1401 1401
1402
1402 void Genesis::InitializeNormalizedMapCaches() { 1403 void Genesis::InitializeNormalizedMapCaches() {
1403 Handle<FixedArray> array( 1404 Handle<FixedArray> array(
1404 FACTORY->NewFixedArray(NormalizedMapCache::kEntries, TENURED)); 1405 FACTORY->NewFixedArray(NormalizedMapCache::kEntries, TENURED));
1405 global_context()->set_normalized_map_cache(NormalizedMapCache::cast(*array)); 1406 global_context()->set_normalized_map_cache(NormalizedMapCache::cast(*array));
1406 } 1407 }
1407 1408
1408 1409
1409
1410 bool Bootstrapper::InstallExtensions(Handle<Context> global_context, 1410 bool Bootstrapper::InstallExtensions(Handle<Context> global_context,
1411 v8::ExtensionConfiguration* extensions) { 1411 v8::ExtensionConfiguration* extensions) {
1412 Isolate* isolate = Isolate::Current();
1412 BootstrapperActive active; 1413 BootstrapperActive active;
1413 SaveContext saved_context; 1414 SaveContext saved_context(isolate);
1414 Isolate::Current()->set_context(*global_context); 1415 isolate->set_context(*global_context);
1415 if (!Genesis::InstallExtensions(global_context, extensions)) return false; 1416 if (!Genesis::InstallExtensions(global_context, extensions)) return false;
1416 Genesis::InstallSpecialObjects(global_context); 1417 Genesis::InstallSpecialObjects(global_context);
1417 return true; 1418 return true;
1418 } 1419 }
1419 1420
1420 1421
1421 void Genesis::InstallSpecialObjects(Handle<Context> global_context) { 1422 void Genesis::InstallSpecialObjects(Handle<Context> global_context) {
1422 HandleScope scope; 1423 HandleScope scope;
1423 Handle<JSGlobalObject> js_global( 1424 Handle<JSGlobalObject> js_global(
1424 JSGlobalObject::cast(global_context->global())); 1425 JSGlobalObject::cast(global_context->global()));
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after
1742 v8::Handle<v8::ObjectTemplate> global_template, 1743 v8::Handle<v8::ObjectTemplate> global_template,
1743 v8::ExtensionConfiguration* extensions) { 1744 v8::ExtensionConfiguration* extensions) {
1744 Isolate* isolate = Isolate::Current(); 1745 Isolate* isolate = Isolate::Current();
1745 result_ = Handle<Context>::null(); 1746 result_ = Handle<Context>::null();
1746 // If V8 isn't running and cannot be initialized, just return. 1747 // If V8 isn't running and cannot be initialized, just return.
1747 if (!V8::IsRunning() && !V8::Initialize(NULL)) return; 1748 if (!V8::IsRunning() && !V8::Initialize(NULL)) return;
1748 1749
1749 // Before creating the roots we must save the context and restore it 1750 // Before creating the roots we must save the context and restore it
1750 // on all function exits. 1751 // on all function exits.
1751 HandleScope scope; 1752 HandleScope scope;
1752 SaveContext saved_context; 1753 SaveContext saved_context(isolate);
1753 1754
1754 Handle<Context> new_context = Snapshot::NewContextFromSnapshot(); 1755 Handle<Context> new_context = Snapshot::NewContextFromSnapshot();
1755 if (!new_context.is_null()) { 1756 if (!new_context.is_null()) {
1756 global_context_ = 1757 global_context_ =
1757 Handle<Context>::cast(isolate->global_handles()->Create(*new_context)); 1758 Handle<Context>::cast(isolate->global_handles()->Create(*new_context));
1758 isolate->set_context(*global_context_); 1759 isolate->set_context(*global_context_);
1759 isolate->counters()->contexts_created_by_snapshot()->Increment(); 1760 isolate->counters()->contexts_created_by_snapshot()->Increment();
1760 result_ = global_context_; 1761 result_ = global_context_;
1761 JSFunction* empty_function = 1762 JSFunction* empty_function =
1762 JSFunction::cast(result_->function_map()->prototype()); 1763 JSFunction::cast(result_->function_map()->prototype());
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
1816 return from + sizeof(NestingCounterType); 1817 return from + sizeof(NestingCounterType);
1817 } 1818 }
1818 1819
1819 1820
1820 // Called when the top-level V8 mutex is destroyed. 1821 // Called when the top-level V8 mutex is destroyed.
1821 void Bootstrapper::FreeThreadResources() { 1822 void Bootstrapper::FreeThreadResources() {
1822 ASSERT(!IsActive()); 1823 ASSERT(!IsActive());
1823 } 1824 }
1824 1825
1825 } } // namespace v8::internal 1826 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/debug.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698