| OLD | NEW |
| 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 1601 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1612 inner_pointer_to_code_cache_(NULL), | 1612 inner_pointer_to_code_cache_(NULL), |
| 1613 write_input_buffer_(NULL), | 1613 write_input_buffer_(NULL), |
| 1614 global_handles_(NULL), | 1614 global_handles_(NULL), |
| 1615 context_switcher_(NULL), | 1615 context_switcher_(NULL), |
| 1616 thread_manager_(NULL), | 1616 thread_manager_(NULL), |
| 1617 fp_stubs_generated_(false), | 1617 fp_stubs_generated_(false), |
| 1618 has_installed_extensions_(false), | 1618 has_installed_extensions_(false), |
| 1619 string_tracker_(NULL), | 1619 string_tracker_(NULL), |
| 1620 regexp_stack_(NULL), | 1620 regexp_stack_(NULL), |
| 1621 date_cache_(NULL), | 1621 date_cache_(NULL), |
| 1622 code_stub_interface_descriptors_(NULL), | |
| 1623 context_exit_happened_(false), | 1622 context_exit_happened_(false), |
| 1624 deferred_handles_head_(NULL), | 1623 deferred_handles_head_(NULL), |
| 1625 optimizing_compiler_thread_(this) { | 1624 optimizing_compiler_thread_(this) { |
| 1626 TRACE_ISOLATE(constructor); | 1625 TRACE_ISOLATE(constructor); |
| 1627 | 1626 |
| 1628 memset(isolate_addresses_, 0, | 1627 memset(isolate_addresses_, 0, |
| 1629 sizeof(isolate_addresses_[0]) * (kIsolateAddressCount + 1)); | 1628 sizeof(isolate_addresses_[0]) * (kIsolateAddressCount + 1)); |
| 1630 | 1629 |
| 1631 heap_.isolate_ = this; | 1630 heap_.isolate_ = this; |
| 1632 stack_guard_.isolate_ = this; | 1631 stack_guard_.isolate_ = this; |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1775 | 1774 |
| 1776 delete[] assembler_spare_buffer_; | 1775 delete[] assembler_spare_buffer_; |
| 1777 assembler_spare_buffer_ = NULL; | 1776 assembler_spare_buffer_ = NULL; |
| 1778 | 1777 |
| 1779 delete unicode_cache_; | 1778 delete unicode_cache_; |
| 1780 unicode_cache_ = NULL; | 1779 unicode_cache_ = NULL; |
| 1781 | 1780 |
| 1782 delete date_cache_; | 1781 delete date_cache_; |
| 1783 date_cache_ = NULL; | 1782 date_cache_ = NULL; |
| 1784 | 1783 |
| 1785 delete[] code_stub_interface_descriptors_; | |
| 1786 code_stub_interface_descriptors_ = NULL; | |
| 1787 | |
| 1788 delete regexp_stack_; | 1784 delete regexp_stack_; |
| 1789 regexp_stack_ = NULL; | 1785 regexp_stack_ = NULL; |
| 1790 | 1786 |
| 1791 delete descriptor_lookup_cache_; | 1787 delete descriptor_lookup_cache_; |
| 1792 descriptor_lookup_cache_ = NULL; | 1788 descriptor_lookup_cache_ = NULL; |
| 1793 delete context_slot_cache_; | 1789 delete context_slot_cache_; |
| 1794 context_slot_cache_ = NULL; | 1790 context_slot_cache_ = NULL; |
| 1795 delete keyed_lookup_cache_; | 1791 delete keyed_lookup_cache_; |
| 1796 keyed_lookup_cache_ = NULL; | 1792 keyed_lookup_cache_ = NULL; |
| 1797 | 1793 |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1941 unicode_cache_ = new UnicodeCache(); | 1937 unicode_cache_ = new UnicodeCache(); |
| 1942 inner_pointer_to_code_cache_ = new InnerPointerToCodeCache(this); | 1938 inner_pointer_to_code_cache_ = new InnerPointerToCodeCache(this); |
| 1943 write_input_buffer_ = new StringInputBuffer(); | 1939 write_input_buffer_ = new StringInputBuffer(); |
| 1944 global_handles_ = new GlobalHandles(this); | 1940 global_handles_ = new GlobalHandles(this); |
| 1945 bootstrapper_ = new Bootstrapper(); | 1941 bootstrapper_ = new Bootstrapper(); |
| 1946 handle_scope_implementer_ = new HandleScopeImplementer(this); | 1942 handle_scope_implementer_ = new HandleScopeImplementer(this); |
| 1947 stub_cache_ = new StubCache(this, runtime_zone()); | 1943 stub_cache_ = new StubCache(this, runtime_zone()); |
| 1948 regexp_stack_ = new RegExpStack(); | 1944 regexp_stack_ = new RegExpStack(); |
| 1949 regexp_stack_->isolate_ = this; | 1945 regexp_stack_->isolate_ = this; |
| 1950 date_cache_ = new DateCache(); | 1946 date_cache_ = new DateCache(); |
| 1951 code_stub_interface_descriptors_ = | |
| 1952 new CodeStubInterfaceDescriptor*[CodeStub::NUMBER_OF_IDS]; | |
| 1953 memset(code_stub_interface_descriptors_, 0, | |
| 1954 kPointerSize * CodeStub::NUMBER_OF_IDS); | |
| 1955 | 1947 |
| 1956 // Enable logging before setting up the heap | 1948 // Enable logging before setting up the heap |
| 1957 logger_->SetUp(); | 1949 logger_->SetUp(); |
| 1958 | 1950 |
| 1959 CpuProfiler::SetUp(); | 1951 CpuProfiler::SetUp(); |
| 1960 HeapProfiler::SetUp(); | 1952 HeapProfiler::SetUp(); |
| 1961 | 1953 |
| 1962 // Initialize other runtime facilities | 1954 // Initialize other runtime facilities |
| 1963 #if defined(USE_SIMULATOR) | 1955 #if defined(USE_SIMULATOR) |
| 1964 #if defined(V8_TARGET_ARCH_ARM) || defined(V8_TARGET_ARCH_MIPS) | 1956 #if defined(V8_TARGET_ARCH_ARM) || defined(V8_TARGET_ARCH_MIPS) |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2005 | 1997 |
| 2006 if (FLAG_preemption) { | 1998 if (FLAG_preemption) { |
| 2007 v8::Locker locker; | 1999 v8::Locker locker; |
| 2008 v8::Locker::StartPreemption(100); | 2000 v8::Locker::StartPreemption(100); |
| 2009 } | 2001 } |
| 2010 | 2002 |
| 2011 #ifdef ENABLE_DEBUGGER_SUPPORT | 2003 #ifdef ENABLE_DEBUGGER_SUPPORT |
| 2012 debug_->SetUp(create_heap_objects); | 2004 debug_->SetUp(create_heap_objects); |
| 2013 #endif | 2005 #endif |
| 2014 | 2006 |
| 2015 deoptimizer_data_ = new DeoptimizerData; | |
| 2016 | |
| 2017 // If we are deserializing, read the state into the now-empty heap. | 2007 // If we are deserializing, read the state into the now-empty heap. |
| 2018 if (!create_heap_objects) { | 2008 if (!create_heap_objects) { |
| 2019 des->Deserialize(); | 2009 des->Deserialize(); |
| 2020 } | 2010 } |
| 2021 stub_cache_->Initialize(); | 2011 stub_cache_->Initialize(); |
| 2022 | 2012 |
| 2023 // Finish initialization of ThreadLocal after deserialization is done. | 2013 // Finish initialization of ThreadLocal after deserialization is done. |
| 2024 clear_pending_exception(); | 2014 clear_pending_exception(); |
| 2025 clear_pending_message(); | 2015 clear_pending_message(); |
| 2026 clear_scheduled_exception(); | 2016 clear_scheduled_exception(); |
| 2027 | 2017 |
| 2028 // Deserializing may put strange things in the root array's copy of the | 2018 // Deserializing may put strange things in the root array's copy of the |
| 2029 // stack guard. | 2019 // stack guard. |
| 2030 heap_.SetStackLimits(); | 2020 heap_.SetStackLimits(); |
| 2031 | 2021 |
| 2032 // Quiet the heap NaN if needed on target platform. | 2022 // Quiet the heap NaN if needed on target platform. |
| 2033 if (!create_heap_objects) Assembler::QuietNaN(heap_.nan_value()); | 2023 if (!create_heap_objects) Assembler::QuietNaN(heap_.nan_value()); |
| 2034 | 2024 |
| 2025 deoptimizer_data_ = new DeoptimizerData; |
| 2035 runtime_profiler_ = new RuntimeProfiler(this); | 2026 runtime_profiler_ = new RuntimeProfiler(this); |
| 2036 runtime_profiler_->SetUp(); | 2027 runtime_profiler_->SetUp(); |
| 2037 | 2028 |
| 2038 // If we are deserializing, log non-function code objects and compiled | 2029 // If we are deserializing, log non-function code objects and compiled |
| 2039 // functions found in the snapshot. | 2030 // functions found in the snapshot. |
| 2040 if (!create_heap_objects && | 2031 if (!create_heap_objects && |
| 2041 (FLAG_log_code || FLAG_ll_prof || logger_->is_logging_code_events())) { | 2032 (FLAG_log_code || FLAG_ll_prof || logger_->is_logging_code_events())) { |
| 2042 HandleScope scope; | 2033 HandleScope scope; |
| 2043 LOG(this, LogCodeObjects()); | 2034 LOG(this, LogCodeObjects()); |
| 2044 LOG(this, LogCompiledFunctions()); | 2035 LOG(this, LogCompiledFunctions()); |
| 2045 } | 2036 } |
| 2046 | 2037 |
| 2047 CHECK_EQ(static_cast<int>(OFFSET_OF(Isolate, state_)), | 2038 CHECK_EQ(static_cast<int>(OFFSET_OF(Isolate, state_)), |
| 2048 Internals::kIsolateStateOffset); | 2039 Internals::kIsolateStateOffset); |
| 2049 CHECK_EQ(static_cast<int>(OFFSET_OF(Isolate, embedder_data_)), | 2040 CHECK_EQ(static_cast<int>(OFFSET_OF(Isolate, embedder_data_)), |
| 2050 Internals::kIsolateEmbedderDataOffset); | 2041 Internals::kIsolateEmbedderDataOffset); |
| 2051 CHECK_EQ(static_cast<int>(OFFSET_OF(Isolate, heap_.roots_)), | 2042 CHECK_EQ(static_cast<int>(OFFSET_OF(Isolate, heap_.roots_)), |
| 2052 Internals::kIsolateRootsOffset); | 2043 Internals::kIsolateRootsOffset); |
| 2053 | 2044 |
| 2054 state_ = INITIALIZED; | 2045 state_ = INITIALIZED; |
| 2055 time_millis_at_init_ = OS::TimeCurrentMillis(); | 2046 time_millis_at_init_ = OS::TimeCurrentMillis(); |
| 2056 | |
| 2057 if (!create_heap_objects) { | |
| 2058 // Now that the heap is consistent, it's OK to generate the code for the | |
| 2059 // deopt entry table that might have been referred to by optimized code in | |
| 2060 // the snapshot. | |
| 2061 HandleScope scope(this); | |
| 2062 Deoptimizer::EnsureCodeForDeoptimizationEntry( | |
| 2063 Deoptimizer::LAZY, | |
| 2064 kDeoptTableSerializeEntryCount - 1); | |
| 2065 } | |
| 2066 | |
| 2067 if (FLAG_parallel_recompilation) optimizing_compiler_thread_.Start(); | 2047 if (FLAG_parallel_recompilation) optimizing_compiler_thread_.Start(); |
| 2068 return true; | 2048 return true; |
| 2069 } | 2049 } |
| 2070 | 2050 |
| 2071 | 2051 |
| 2072 // Initialized lazily to allow early | 2052 // Initialized lazily to allow early |
| 2073 // v8::V8::SetAddHistogramSampleFunction calls. | 2053 // v8::V8::SetAddHistogramSampleFunction calls. |
| 2074 StatsTable* Isolate::stats_table() { | 2054 StatsTable* Isolate::stats_table() { |
| 2075 if (stats_table_ == NULL) { | 2055 if (stats_table_ == NULL) { |
| 2076 stats_table_ = new StatsTable; | 2056 stats_table_ = new StatsTable; |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2180 | 2160 |
| 2181 #ifdef DEBUG | 2161 #ifdef DEBUG |
| 2182 #define ISOLATE_FIELD_OFFSET(type, name, ignored) \ | 2162 #define ISOLATE_FIELD_OFFSET(type, name, ignored) \ |
| 2183 const intptr_t Isolate::name##_debug_offset_ = OFFSET_OF(Isolate, name##_); | 2163 const intptr_t Isolate::name##_debug_offset_ = OFFSET_OF(Isolate, name##_); |
| 2184 ISOLATE_INIT_LIST(ISOLATE_FIELD_OFFSET) | 2164 ISOLATE_INIT_LIST(ISOLATE_FIELD_OFFSET) |
| 2185 ISOLATE_INIT_ARRAY_LIST(ISOLATE_FIELD_OFFSET) | 2165 ISOLATE_INIT_ARRAY_LIST(ISOLATE_FIELD_OFFSET) |
| 2186 #undef ISOLATE_FIELD_OFFSET | 2166 #undef ISOLATE_FIELD_OFFSET |
| 2187 #endif | 2167 #endif |
| 2188 | 2168 |
| 2189 } } // namespace v8::internal | 2169 } } // namespace v8::internal |
| OLD | NEW |