OLD | NEW |
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 1733 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1744 inner_pointer_to_code_cache_ = new InnerPointerToCodeCache(this); | 1744 inner_pointer_to_code_cache_ = new InnerPointerToCodeCache(this); |
1745 write_input_buffer_ = new StringInputBuffer(); | 1745 write_input_buffer_ = new StringInputBuffer(); |
1746 global_handles_ = new GlobalHandles(this); | 1746 global_handles_ = new GlobalHandles(this); |
1747 bootstrapper_ = new Bootstrapper(); | 1747 bootstrapper_ = new Bootstrapper(); |
1748 handle_scope_implementer_ = new HandleScopeImplementer(this); | 1748 handle_scope_implementer_ = new HandleScopeImplementer(this); |
1749 stub_cache_ = new StubCache(this); | 1749 stub_cache_ = new StubCache(this); |
1750 regexp_stack_ = new RegExpStack(); | 1750 regexp_stack_ = new RegExpStack(); |
1751 regexp_stack_->isolate_ = this; | 1751 regexp_stack_->isolate_ = this; |
1752 | 1752 |
1753 // Enable logging before setting up the heap | 1753 // Enable logging before setting up the heap |
1754 logger_->Setup(); | 1754 logger_->SetUp(); |
1755 | 1755 |
1756 CpuProfiler::Setup(); | 1756 CpuProfiler::SetUp(); |
1757 HeapProfiler::Setup(); | 1757 HeapProfiler::SetUp(); |
1758 | 1758 |
1759 // Initialize other runtime facilities | 1759 // Initialize other runtime facilities |
1760 #if defined(USE_SIMULATOR) | 1760 #if defined(USE_SIMULATOR) |
1761 #if defined(V8_TARGET_ARCH_ARM) || defined(V8_TARGET_ARCH_MIPS) | 1761 #if defined(V8_TARGET_ARCH_ARM) || defined(V8_TARGET_ARCH_MIPS) |
1762 Simulator::Initialize(this); | 1762 Simulator::Initialize(this); |
1763 #endif | 1763 #endif |
1764 #endif | 1764 #endif |
1765 | 1765 |
1766 { // NOLINT | 1766 { // NOLINT |
1767 // Ensure that the thread has a valid stack guard. The v8::Locker object | 1767 // Ensure that the thread has a valid stack guard. The v8::Locker object |
1768 // will ensure this too, but we don't have to use lockers if we are only | 1768 // will ensure this too, but we don't have to use lockers if we are only |
1769 // using one thread. | 1769 // using one thread. |
1770 ExecutionAccess lock(this); | 1770 ExecutionAccess lock(this); |
1771 stack_guard_.InitThread(lock); | 1771 stack_guard_.InitThread(lock); |
1772 } | 1772 } |
1773 | 1773 |
1774 // Setup the object heap. | 1774 // SetUp the object heap. |
1775 const bool create_heap_objects = (des == NULL); | 1775 const bool create_heap_objects = (des == NULL); |
1776 ASSERT(!heap_.HasBeenSetup()); | 1776 ASSERT(!heap_.HasBeenSetUp()); |
1777 if (!heap_.Setup(create_heap_objects)) { | 1777 if (!heap_.SetUp(create_heap_objects)) { |
1778 V8::SetFatalError(); | 1778 V8::SetFatalError(); |
1779 return false; | 1779 return false; |
1780 } | 1780 } |
1781 | 1781 |
1782 InitializeThreadLocal(); | 1782 InitializeThreadLocal(); |
1783 | 1783 |
1784 bootstrapper_->Initialize(create_heap_objects); | 1784 bootstrapper_->Initialize(create_heap_objects); |
1785 builtins_.Setup(create_heap_objects); | 1785 builtins_.SetUp(create_heap_objects); |
1786 | 1786 |
1787 // Only preallocate on the first initialization. | 1787 // Only preallocate on the first initialization. |
1788 if (FLAG_preallocate_message_memory && preallocated_message_space_ == NULL) { | 1788 if (FLAG_preallocate_message_memory && preallocated_message_space_ == NULL) { |
1789 // Start the thread which will set aside some memory. | 1789 // Start the thread which will set aside some memory. |
1790 PreallocatedMemoryThreadStart(); | 1790 PreallocatedMemoryThreadStart(); |
1791 preallocated_message_space_ = | 1791 preallocated_message_space_ = |
1792 new NoAllocationStringAllocator( | 1792 new NoAllocationStringAllocator( |
1793 preallocated_memory_thread_->data(), | 1793 preallocated_memory_thread_->data(), |
1794 preallocated_memory_thread_->length()); | 1794 preallocated_memory_thread_->length()); |
1795 PreallocatedStorageInit(preallocated_memory_thread_->length() / 4); | 1795 PreallocatedStorageInit(preallocated_memory_thread_->length() / 4); |
1796 } | 1796 } |
1797 | 1797 |
1798 if (FLAG_preemption) { | 1798 if (FLAG_preemption) { |
1799 v8::Locker locker; | 1799 v8::Locker locker; |
1800 v8::Locker::StartPreemption(100); | 1800 v8::Locker::StartPreemption(100); |
1801 } | 1801 } |
1802 | 1802 |
1803 #ifdef ENABLE_DEBUGGER_SUPPORT | 1803 #ifdef ENABLE_DEBUGGER_SUPPORT |
1804 debug_->Setup(create_heap_objects); | 1804 debug_->SetUp(create_heap_objects); |
1805 #endif | 1805 #endif |
1806 stub_cache_->Initialize(create_heap_objects); | 1806 stub_cache_->Initialize(create_heap_objects); |
1807 | 1807 |
1808 // If we are deserializing, read the state into the now-empty heap. | 1808 // If we are deserializing, read the state into the now-empty heap. |
1809 if (des != NULL) { | 1809 if (des != NULL) { |
1810 des->Deserialize(); | 1810 des->Deserialize(); |
1811 stub_cache_->Initialize(true); | 1811 stub_cache_->Initialize(true); |
1812 } | 1812 } |
1813 | 1813 |
1814 // Finish initialization of ThreadLocal after deserialization is done. | 1814 // Finish initialization of ThreadLocal after deserialization is done. |
1815 clear_pending_exception(); | 1815 clear_pending_exception(); |
1816 clear_pending_message(); | 1816 clear_pending_message(); |
1817 clear_scheduled_exception(); | 1817 clear_scheduled_exception(); |
1818 | 1818 |
1819 // Deserializing may put strange things in the root array's copy of the | 1819 // Deserializing may put strange things in the root array's copy of the |
1820 // stack guard. | 1820 // stack guard. |
1821 heap_.SetStackLimits(); | 1821 heap_.SetStackLimits(); |
1822 | 1822 |
1823 deoptimizer_data_ = new DeoptimizerData; | 1823 deoptimizer_data_ = new DeoptimizerData; |
1824 runtime_profiler_ = new RuntimeProfiler(this); | 1824 runtime_profiler_ = new RuntimeProfiler(this); |
1825 runtime_profiler_->Setup(); | 1825 runtime_profiler_->SetUp(); |
1826 | 1826 |
1827 // If we are deserializing, log non-function code objects and compiled | 1827 // If we are deserializing, log non-function code objects and compiled |
1828 // functions found in the snapshot. | 1828 // functions found in the snapshot. |
1829 if (des != NULL && (FLAG_log_code || FLAG_ll_prof)) { | 1829 if (des != NULL && (FLAG_log_code || FLAG_ll_prof)) { |
1830 HandleScope scope; | 1830 HandleScope scope; |
1831 LOG(this, LogCodeObjects()); | 1831 LOG(this, LogCodeObjects()); |
1832 LOG(this, LogCompiledFunctions()); | 1832 LOG(this, LogCompiledFunctions()); |
1833 } | 1833 } |
1834 | 1834 |
1835 state_ = INITIALIZED; | 1835 state_ = INITIALIZED; |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1918 | 1918 |
1919 #ifdef DEBUG | 1919 #ifdef DEBUG |
1920 #define ISOLATE_FIELD_OFFSET(type, name, ignored) \ | 1920 #define ISOLATE_FIELD_OFFSET(type, name, ignored) \ |
1921 const intptr_t Isolate::name##_debug_offset_ = OFFSET_OF(Isolate, name##_); | 1921 const intptr_t Isolate::name##_debug_offset_ = OFFSET_OF(Isolate, name##_); |
1922 ISOLATE_INIT_LIST(ISOLATE_FIELD_OFFSET) | 1922 ISOLATE_INIT_LIST(ISOLATE_FIELD_OFFSET) |
1923 ISOLATE_INIT_ARRAY_LIST(ISOLATE_FIELD_OFFSET) | 1923 ISOLATE_INIT_ARRAY_LIST(ISOLATE_FIELD_OFFSET) |
1924 #undef ISOLATE_FIELD_OFFSET | 1924 #undef ISOLATE_FIELD_OFFSET |
1925 #endif | 1925 #endif |
1926 | 1926 |
1927 } } // namespace v8::internal | 1927 } } // namespace v8::internal |
OLD | NEW |