Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2006-2010 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2010 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 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 170 | 170 |
| 171 | 171 |
| 172 Isolate* Isolate::default_isolate_ = NULL; | 172 Isolate* Isolate::default_isolate_ = NULL; |
| 173 Thread::LocalStorageKey Isolate::isolate_key_; | 173 Thread::LocalStorageKey Isolate::isolate_key_; |
| 174 Thread::LocalStorageKey Isolate::thread_id_key_; | 174 Thread::LocalStorageKey Isolate::thread_id_key_; |
| 175 Thread::LocalStorageKey Isolate::per_isolate_thread_data_key_; | 175 Thread::LocalStorageKey Isolate::per_isolate_thread_data_key_; |
| 176 Mutex* Isolate::process_wide_mutex_ = OS::CreateMutex(); | 176 Mutex* Isolate::process_wide_mutex_ = OS::CreateMutex(); |
| 177 Isolate::ThreadDataTable* Isolate::thread_data_table_ = NULL; | 177 Isolate::ThreadDataTable* Isolate::thread_data_table_ = NULL; |
| 178 Isolate::ThreadId Isolate::highest_thread_id_ = 0; | 178 Isolate::ThreadId Isolate::highest_thread_id_ = 0; |
| 179 | 179 |
| 180 void Isolate::RunStaticInitializers() { | |
| 181 LAllocator::Setup(); | |
| 182 } | |
| 183 | |
| 180 class IsolateInitializer { | 184 class IsolateInitializer { |
| 181 public: | 185 public: |
| 182 IsolateInitializer() { | 186 IsolateInitializer() { |
| 183 Isolate::EnsureDefaultIsolate(); | 187 Isolate::EnsureDefaultIsolate(); |
| 188 Isolate::RunStaticInitializers(); | |
|
Vitaly Repeshko
2011/03/02 18:27:27
Consider doing this before the default isolate is
| |
| 184 } | 189 } |
| 185 }; | 190 }; |
| 186 | 191 |
| 187 static IsolateInitializer* EnsureDefaultIsolateAllocated() { | 192 static IsolateInitializer* EnsureDefaultIsolateAllocated() { |
| 188 // TODO(isolates): Use the system threading API to do this once? | 193 // TODO(isolates): Use the system threading API to do this once? |
| 189 static IsolateInitializer static_initializer; | 194 static IsolateInitializer static_initializer; |
| 190 return &static_initializer; | 195 return &static_initializer; |
| 191 } | 196 } |
| 192 | 197 |
| 193 // This variable only needed to trigger static intialization. | 198 // This variable only needed to trigger static intialization. |
| (...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 705 // stack guard. | 710 // stack guard. |
| 706 heap_.SetStackLimits(); | 711 heap_.SetStackLimits(); |
| 707 | 712 |
| 708 // Setup the CPU support. Must be done after heap setup and after | 713 // Setup the CPU support. Must be done after heap setup and after |
| 709 // any deserialization because we have to have the initial heap | 714 // any deserialization because we have to have the initial heap |
| 710 // objects in place for creating the code object used for probing. | 715 // objects in place for creating the code object used for probing. |
| 711 CPU::Setup(); | 716 CPU::Setup(); |
| 712 | 717 |
| 713 OProfileAgent::Initialize(); | 718 OProfileAgent::Initialize(); |
| 714 deoptimizer_data_ = new DeoptimizerData; | 719 deoptimizer_data_ = new DeoptimizerData; |
| 715 LAllocator::Setup(); | |
| 716 runtime_profiler_ = new RuntimeProfiler(this); | 720 runtime_profiler_ = new RuntimeProfiler(this); |
| 717 runtime_profiler_->Setup(); | 721 runtime_profiler_->Setup(); |
| 718 | 722 |
| 719 // If we are deserializing, log non-function code objects and compiled | 723 // If we are deserializing, log non-function code objects and compiled |
| 720 // functions found in the snapshot. | 724 // functions found in the snapshot. |
| 721 if (des != NULL && FLAG_log_code) { | 725 if (des != NULL && FLAG_log_code) { |
| 722 HandleScope scope; | 726 HandleScope scope; |
| 723 LOG(LogCodeObjects()); | 727 LOG(LogCodeObjects()); |
| 724 LOG(LogCompiledFunctions()); | 728 LOG(LogCompiledFunctions()); |
| 725 } | 729 } |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 798 // Reinit the current thread for the isolate it was running before this one. | 802 // Reinit the current thread for the isolate it was running before this one. |
| 799 SetIsolateThreadLocals(previous_isolate, previous_thread_data); | 803 SetIsolateThreadLocals(previous_isolate, previous_thread_data); |
| 800 } | 804 } |
| 801 | 805 |
| 802 | 806 |
| 803 void Isolate::ResetEagerOptimizingData() { | 807 void Isolate::ResetEagerOptimizingData() { |
| 804 compilation_cache_->ResetEagerOptimizingData(); | 808 compilation_cache_->ResetEagerOptimizingData(); |
| 805 } | 809 } |
| 806 | 810 |
| 807 } } // namespace v8::internal | 811 } } // namespace v8::internal |
| OLD | NEW |