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

Side by Side Diff: src/bootstrapper.cc

Issue 6529055: [Isolates] Merge crankshaft (r5922 from bleeding_edge). (Closed)
Patch Set: Win32 port 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
« no previous file with comments | « src/atomicops_internals_x86_msvc.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 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 439 matching lines...) Expand 10 before | Expand all | Expand 10 after
450 Handle<Map> empty_fm = FACTORY->CopyMapDropDescriptors( 450 Handle<Map> empty_fm = FACTORY->CopyMapDropDescriptors(
451 function_without_prototype_map); 451 function_without_prototype_map);
452 empty_fm->set_instance_descriptors( 452 empty_fm->set_instance_descriptors(
453 *function_without_prototype_map_descriptors); 453 *function_without_prototype_map_descriptors);
454 empty_fm->set_prototype(global_context()->object_function()->prototype()); 454 empty_fm->set_prototype(global_context()->object_function()->prototype());
455 empty_function->set_map(*empty_fm); 455 empty_function->set_map(*empty_fm);
456 return empty_function; 456 return empty_function;
457 } 457 }
458 458
459 459
460 static void AddToWeakGlobalContextList(Context* context) {
461 ASSERT(context->IsGlobalContext());
462 Heap* heap = Isolate::Current()->heap();
463 #ifdef DEBUG
464 { // NOLINT
465 ASSERT(context->get(Context::NEXT_CONTEXT_LINK)->IsUndefined());
466 // Check that context is not in the list yet.
467 for (Object* current = heap->global_contexts_list();
468 !current->IsUndefined();
469 current = Context::cast(current)->get(Context::NEXT_CONTEXT_LINK)) {
470 ASSERT(current != context);
471 }
472 }
473 #endif
474 context->set(Context::NEXT_CONTEXT_LINK, heap->global_contexts_list());
475 heap->set_global_contexts_list(context);
476 }
477
478
460 void Genesis::CreateRoots() { 479 void Genesis::CreateRoots() {
461 Isolate* isolate = Isolate::Current(); 480 Isolate* isolate = Isolate::Current();
462 // Allocate the global context FixedArray first and then patch the 481 // Allocate the global context FixedArray first and then patch the
463 // closure and extension object later (we need the empty function 482 // closure and extension object later (we need the empty function
464 // and the global object, but in order to create those, we need the 483 // and the global object, but in order to create those, we need the
465 // global context). 484 // global context).
466 global_context_ = 485 global_context_ = Handle<Context>::cast(isolate->global_handles()->Create(
467 Handle<Context>::cast( 486 *isolate->factory()->NewGlobalContext()));
468 isolate->global_handles()->Create(*FACTORY->NewGlobalContext())); 487 AddToWeakGlobalContextList(*global_context_);
469 isolate->set_context(*global_context()); 488 isolate->set_context(*global_context());
470 489
471 // Allocate the message listeners object. 490 // Allocate the message listeners object.
472 { 491 {
473 v8::NeanderArray listeners; 492 v8::NeanderArray listeners;
474 global_context()->set_message_listeners(*listeners.value()); 493 global_context()->set_message_listeners(*listeners.value());
475 } 494 }
476 } 495 }
477 496
478 497
(...skipping 1086 matching lines...) Expand 10 before | Expand all | Expand 10 after
1565 Builtins::JavaScript id = static_cast<Builtins::JavaScript>(i); 1584 Builtins::JavaScript id = static_cast<Builtins::JavaScript>(i);
1566 Handle<String> name = FACTORY->LookupAsciiSymbol(Builtins::GetName(id)); 1585 Handle<String> name = FACTORY->LookupAsciiSymbol(Builtins::GetName(id));
1567 Object* function_object = builtins->GetPropertyNoExceptionThrown(*name); 1586 Object* function_object = builtins->GetPropertyNoExceptionThrown(*name);
1568 Handle<JSFunction> function 1587 Handle<JSFunction> function
1569 = Handle<JSFunction>(JSFunction::cast(function_object)); 1588 = Handle<JSFunction>(JSFunction::cast(function_object));
1570 builtins->set_javascript_builtin(id, *function); 1589 builtins->set_javascript_builtin(id, *function);
1571 Handle<SharedFunctionInfo> shared 1590 Handle<SharedFunctionInfo> shared
1572 = Handle<SharedFunctionInfo>(function->shared()); 1591 = Handle<SharedFunctionInfo>(function->shared());
1573 if (!EnsureCompiled(shared, CLEAR_EXCEPTION)) return false; 1592 if (!EnsureCompiled(shared, CLEAR_EXCEPTION)) return false;
1574 // Set the code object on the function object. 1593 // Set the code object on the function object.
1575 function->set_code(function->shared()->code()); 1594 function->ReplaceCode(function->shared()->code());
1576 builtins->set_javascript_builtin_code(id, shared->code()); 1595 builtins->set_javascript_builtin_code(id, shared->code());
1577 } 1596 }
1578 return true; 1597 return true;
1579 } 1598 }
1580 1599
1581 1600
1582 bool Genesis::ConfigureGlobalObjects( 1601 bool Genesis::ConfigureGlobalObjects(
1583 v8::Handle<v8::ObjectTemplate> global_proxy_template) { 1602 v8::Handle<v8::ObjectTemplate> global_proxy_template) {
1584 Handle<JSObject> global_proxy( 1603 Handle<JSObject> global_proxy(
1585 JSObject::cast(global_context()->global_proxy())); 1604 JSObject::cast(global_context()->global_proxy()));
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
1754 if (!V8::IsRunning() && !V8::Initialize(NULL)) return; 1773 if (!V8::IsRunning() && !V8::Initialize(NULL)) return;
1755 1774
1756 // Before creating the roots we must save the context and restore it 1775 // Before creating the roots we must save the context and restore it
1757 // on all function exits. 1776 // on all function exits.
1758 HandleScope scope; 1777 HandleScope scope;
1759 SaveContext saved_context(isolate); 1778 SaveContext saved_context(isolate);
1760 1779
1761 Handle<Context> new_context = Snapshot::NewContextFromSnapshot(); 1780 Handle<Context> new_context = Snapshot::NewContextFromSnapshot();
1762 if (!new_context.is_null()) { 1781 if (!new_context.is_null()) {
1763 global_context_ = 1782 global_context_ =
1764 Handle<Context>::cast(isolate->global_handles()->Create(*new_context)); 1783 Handle<Context>::cast(isolate->global_handles()->Create(*new_context));
1784 AddToWeakGlobalContextList(*global_context_);
1765 isolate->set_context(*global_context_); 1785 isolate->set_context(*global_context_);
1766 isolate->counters()->contexts_created_by_snapshot()->Increment(); 1786 isolate->counters()->contexts_created_by_snapshot()->Increment();
1767 result_ = global_context_; 1787 result_ = global_context_;
1768 JSFunction* empty_function = 1788 JSFunction* empty_function =
1769 JSFunction::cast(result_->function_map()->prototype()); 1789 JSFunction::cast(result_->function_map()->prototype());
1770 empty_function_ = Handle<JSFunction>(empty_function); 1790 empty_function_ = Handle<JSFunction>(empty_function);
1771 Handle<GlobalObject> inner_global; 1791 Handle<GlobalObject> inner_global;
1772 Handle<JSGlobalProxy> global_proxy = 1792 Handle<JSGlobalProxy> global_proxy =
1773 CreateNewGlobals(global_template, 1793 CreateNewGlobals(global_template,
1774 global_object, 1794 global_object,
(...skipping 15 matching lines...) Expand all
1790 InstallJSFunctionResultCaches(); 1810 InstallJSFunctionResultCaches();
1791 InitializeNormalizedMapCaches(); 1811 InitializeNormalizedMapCaches();
1792 if (!InstallNatives()) return; 1812 if (!InstallNatives()) return;
1793 1813
1794 MakeFunctionInstancePrototypeWritable(); 1814 MakeFunctionInstancePrototypeWritable();
1795 1815
1796 if (!ConfigureGlobalObjects(global_template)) return; 1816 if (!ConfigureGlobalObjects(global_template)) return;
1797 isolate->counters()->contexts_created_from_scratch()->Increment(); 1817 isolate->counters()->contexts_created_from_scratch()->Increment();
1798 } 1818 }
1799 1819
1800 // Add this context to the weak list of global contexts.
1801 (*global_context_)->set(Context::NEXT_CONTEXT_LINK,
1802 isolate->heap()->global_contexts_list());
1803 isolate->heap()->set_global_contexts_list(*global_context_);
1804
1805 result_ = global_context_; 1820 result_ = global_context_;
1806 } 1821 }
1807 1822
1808 1823
1809 // Support for thread preemption. 1824 // Support for thread preemption.
1810 1825
1811 // Reserve space for statics needing saving and restoring. 1826 // Reserve space for statics needing saving and restoring.
1812 int Bootstrapper::ArchiveSpacePerThread() { 1827 int Bootstrapper::ArchiveSpacePerThread() {
1813 return sizeof(NestingCounterType); 1828 return sizeof(NestingCounterType);
1814 } 1829 }
(...skipping 13 matching lines...) Expand all
1828 return from + sizeof(NestingCounterType); 1843 return from + sizeof(NestingCounterType);
1829 } 1844 }
1830 1845
1831 1846
1832 // Called when the top-level V8 mutex is destroyed. 1847 // Called when the top-level V8 mutex is destroyed.
1833 void Bootstrapper::FreeThreadResources() { 1848 void Bootstrapper::FreeThreadResources() {
1834 ASSERT(!IsActive()); 1849 ASSERT(!IsActive());
1835 } 1850 }
1836 1851
1837 } } // namespace v8::internal 1852 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/atomicops_internals_x86_msvc.h ('k') | src/builtins.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698