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