| 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" |
| 20 #include "vm/signal_handler.h" |
| 19 #include "vm/simulator.h" | 21 #include "vm/simulator.h" |
| 20 #include "vm/snapshot.h" | 22 #include "vm/snapshot.h" |
| 21 #include "vm/stub_code.h" | 23 #include "vm/stub_code.h" |
| 22 #include "vm/symbols.h" | 24 #include "vm/symbols.h" |
| 23 #include "vm/thread_pool.h" | 25 #include "vm/thread_pool.h" |
| 24 #include "vm/virtual_memory.h" | 26 #include "vm/virtual_memory.h" |
| 25 #include "vm/zone.h" | 27 #include "vm/zone.h" |
| 26 | 28 |
| 27 namespace dart { | 29 namespace dart { |
| 28 | 30 |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 return "VM already initialized."; | 89 return "VM already initialized."; |
| 88 } | 90 } |
| 89 Isolate::SetFileCallbacks(file_open, file_read, file_write, file_close); | 91 Isolate::SetFileCallbacks(file_open, file_read, file_write, file_close); |
| 90 OS::InitOnce(); | 92 OS::InitOnce(); |
| 91 VirtualMemory::InitOnce(); | 93 VirtualMemory::InitOnce(); |
| 92 Isolate::InitOnce(); | 94 Isolate::InitOnce(); |
| 93 PortMap::InitOnce(); | 95 PortMap::InitOnce(); |
| 94 FreeListElement::InitOnce(); | 96 FreeListElement::InitOnce(); |
| 95 Api::InitOnce(); | 97 Api::InitOnce(); |
| 96 CodeObservers::InitOnce(); | 98 CodeObservers::InitOnce(); |
| 99 ProfilerManager::InitOnce(); |
| 97 #if defined(USING_SIMULATOR) | 100 #if defined(USING_SIMULATOR) |
| 98 Simulator::InitOnce(); | 101 Simulator::InitOnce(); |
| 99 #endif | 102 #endif |
| 100 // Create the read-only handles area. | 103 // Create the read-only handles area. |
| 101 ASSERT(predefined_handles_ == NULL); | 104 ASSERT(predefined_handles_ == NULL); |
| 102 predefined_handles_ = new ReadOnlyHandles(); | 105 predefined_handles_ = new ReadOnlyHandles(); |
| 103 // Create the VM isolate and finish the VM initialization. | 106 // Create the VM isolate and finish the VM initialization. |
| 104 ASSERT(thread_pool_ == NULL); | 107 ASSERT(thread_pool_ == NULL); |
| 105 thread_pool_ = new ThreadPool(); | 108 thread_pool_ = new ThreadPool(); |
| 106 { | 109 { |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 Isolate::SetCurrent(vm_isolate_); | 164 Isolate::SetCurrent(vm_isolate_); |
| 162 | 165 |
| 163 // There is a planned and known asymmetry here: We exit one scope for the VM | 166 // There is a planned and known asymmetry here: We exit one scope for the VM |
| 164 // isolate to account for the scope that was entered in Dart_InitOnce. | 167 // isolate to account for the scope that was entered in Dart_InitOnce. |
| 165 Dart_ExitScope(); | 168 Dart_ExitScope(); |
| 166 | 169 |
| 167 ShutdownIsolate(); | 170 ShutdownIsolate(); |
| 168 vm_isolate_ = NULL; | 171 vm_isolate_ = NULL; |
| 169 #endif | 172 #endif |
| 170 | 173 |
| 174 ScopedSignalBlocker ssb; |
| 175 ProfilerManager::Shutdown(); |
| 171 CodeObservers::DeleteAll(); | 176 CodeObservers::DeleteAll(); |
| 172 | 177 |
| 173 return NULL; | 178 return NULL; |
| 174 } | 179 } |
| 175 | 180 |
| 176 | 181 |
| 177 Isolate* Dart::CreateIsolate(const char* name_prefix) { | 182 Isolate* Dart::CreateIsolate(const char* name_prefix) { |
| 178 // Create a new isolate. | 183 // Create a new isolate. |
| 179 Isolate* isolate = Isolate::Init(name_prefix); | 184 Isolate* isolate = Isolate::Init(name_prefix); |
| 180 ASSERT(isolate != NULL); | 185 ASSERT(isolate != NULL); |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 265 return predefined_handles_->handles_.AllocateScopedHandle(); | 270 return predefined_handles_->handles_.AllocateScopedHandle(); |
| 266 } | 271 } |
| 267 | 272 |
| 268 | 273 |
| 269 bool Dart::IsReadOnlyHandle(uword address) { | 274 bool Dart::IsReadOnlyHandle(uword address) { |
| 270 ASSERT(predefined_handles_ != NULL); | 275 ASSERT(predefined_handles_ != NULL); |
| 271 return predefined_handles_->handles_.IsValidScopedHandle(address); | 276 return predefined_handles_->handles_.IsValidScopedHandle(address); |
| 272 } | 277 } |
| 273 | 278 |
| 274 } // namespace dart | 279 } // namespace dart |
| OLD | NEW |