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