| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "vm/dart.h" | 5 #include "vm/dart.h" |
| 6 | 6 |
| 7 #include "vm/code_observers.h" | 7 #include "vm/code_observers.h" |
| 8 #include "vm/dart_api_state.h" | 8 #include "vm/dart_api_state.h" |
| 9 #include "vm/dart_entry.h" | 9 #include "vm/dart_entry.h" |
| 10 #include "vm/flags.h" | 10 #include "vm/flags.h" |
| 11 #include "vm/freelist.h" | 11 #include "vm/freelist.h" |
| 12 #include "vm/handles.h" | 12 #include "vm/handles.h" |
| 13 #include "vm/heap.h" | 13 #include "vm/heap.h" |
| 14 #include "vm/isolate.h" | 14 #include "vm/isolate.h" |
| 15 #include "vm/object.h" | 15 #include "vm/object.h" |
| 16 #include "vm/object_store.h" | 16 #include "vm/object_store.h" |
| 17 #include "vm/object_id_ring.h" | 17 #include "vm/object_id_ring.h" |
| 18 #include "vm/port.h" | 18 #include "vm/port.h" |
| 19 #include "vm/profiler.h" | 19 #include "vm/profiler.h" |
| 20 #include "vm/simulator.h" | 20 #include "vm/simulator.h" |
| 21 #include "vm/snapshot.h" | 21 #include "vm/snapshot.h" |
| 22 #include "vm/stub_code.h" | 22 #include "vm/stub_code.h" |
| 23 #include "vm/symbols.h" | 23 #include "vm/symbols.h" |
| 24 #include "vm/thread_interrupter.h" |
| 24 #include "vm/thread_pool.h" | 25 #include "vm/thread_pool.h" |
| 25 #include "vm/virtual_memory.h" | 26 #include "vm/virtual_memory.h" |
| 26 #include "vm/zone.h" | 27 #include "vm/zone.h" |
| 27 | 28 |
| 28 namespace dart { | 29 namespace dart { |
| 29 | 30 |
| 30 DEFINE_FLAG(bool, heap_profile_initialize, false, | 31 DEFINE_FLAG(bool, heap_profile_initialize, false, |
| 31 "Writes a heap profile on isolate initialization."); | 32 "Writes a heap profile on isolate initialization."); |
| 32 DECLARE_FLAG(bool, print_class_table); | 33 DECLARE_FLAG(bool, print_class_table); |
| 33 DECLARE_FLAG(bool, trace_isolates); | 34 DECLARE_FLAG(bool, trace_isolates); |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 } | 91 } |
| 91 Isolate::SetFileCallbacks(file_open, file_read, file_write, file_close); | 92 Isolate::SetFileCallbacks(file_open, file_read, file_write, file_close); |
| 92 Isolate::SetEntropySourceCallback(entropy_source); | 93 Isolate::SetEntropySourceCallback(entropy_source); |
| 93 OS::InitOnce(); | 94 OS::InitOnce(); |
| 94 VirtualMemory::InitOnce(); | 95 VirtualMemory::InitOnce(); |
| 95 Isolate::InitOnce(); | 96 Isolate::InitOnce(); |
| 96 PortMap::InitOnce(); | 97 PortMap::InitOnce(); |
| 97 FreeListElement::InitOnce(); | 98 FreeListElement::InitOnce(); |
| 98 Api::InitOnce(); | 99 Api::InitOnce(); |
| 99 CodeObservers::InitOnce(); | 100 CodeObservers::InitOnce(); |
| 100 ProfilerManager::InitOnce(); | 101 Profiler::InitOnce(); |
| 102 ThreadInterrupter::InitOnce(); |
| 101 #if defined(USING_SIMULATOR) | 103 #if defined(USING_SIMULATOR) |
| 102 Simulator::InitOnce(); | 104 Simulator::InitOnce(); |
| 103 #endif | 105 #endif |
| 104 // Create the read-only handles area. | 106 // Create the read-only handles area. |
| 105 ASSERT(predefined_handles_ == NULL); | 107 ASSERT(predefined_handles_ == NULL); |
| 106 predefined_handles_ = new ReadOnlyHandles(); | 108 predefined_handles_ = new ReadOnlyHandles(); |
| 107 // Create the VM isolate and finish the VM initialization. | 109 // Create the VM isolate and finish the VM initialization. |
| 108 ASSERT(thread_pool_ == NULL); | 110 ASSERT(thread_pool_ == NULL); |
| 109 thread_pool_ = new ThreadPool(); | 111 thread_pool_ = new ThreadPool(); |
| 110 { | 112 { |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 Isolate::SetCurrent(vm_isolate_); | 167 Isolate::SetCurrent(vm_isolate_); |
| 166 | 168 |
| 167 // There is a planned and known asymmetry here: We exit one scope for the VM | 169 // There is a planned and known asymmetry here: We exit one scope for the VM |
| 168 // isolate to account for the scope that was entered in Dart_InitOnce. | 170 // isolate to account for the scope that was entered in Dart_InitOnce. |
| 169 Dart_ExitScope(); | 171 Dart_ExitScope(); |
| 170 | 172 |
| 171 ShutdownIsolate(); | 173 ShutdownIsolate(); |
| 172 vm_isolate_ = NULL; | 174 vm_isolate_ = NULL; |
| 173 #endif | 175 #endif |
| 174 | 176 |
| 175 ProfilerManager::Shutdown(); | 177 ThreadInterrupter::Shutdown(); |
| 178 Profiler::Shutdown(); |
| 176 CodeObservers::DeleteAll(); | 179 CodeObservers::DeleteAll(); |
| 177 | 180 |
| 178 return NULL; | 181 return NULL; |
| 179 } | 182 } |
| 180 | 183 |
| 181 | 184 |
| 182 Isolate* Dart::CreateIsolate(const char* name_prefix) { | 185 Isolate* Dart::CreateIsolate(const char* name_prefix) { |
| 183 // Create a new isolate. | 186 // Create a new isolate. |
| 184 Isolate* isolate = Isolate::Init(name_prefix); | 187 Isolate* isolate = Isolate::Init(name_prefix); |
| 185 ASSERT(isolate != NULL); | 188 ASSERT(isolate != NULL); |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 270 return predefined_handles_->handles_.AllocateScopedHandle(); | 273 return predefined_handles_->handles_.AllocateScopedHandle(); |
| 271 } | 274 } |
| 272 | 275 |
| 273 | 276 |
| 274 bool Dart::IsReadOnlyHandle(uword address) { | 277 bool Dart::IsReadOnlyHandle(uword address) { |
| 275 ASSERT(predefined_handles_ != NULL); | 278 ASSERT(predefined_handles_ != NULL); |
| 276 return predefined_handles_->handles_.IsValidScopedHandle(address); | 279 return predefined_handles_->handles_.IsValidScopedHandle(address); |
| 277 } | 280 } |
| 278 | 281 |
| 279 } // namespace dart | 282 } // namespace dart |
| OLD | NEW |