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/cpu.h" | 8 #include "vm/cpu.h" |
9 #include "vm/dart_api_state.h" | 9 #include "vm/dart_api_state.h" |
10 #include "vm/dart_entry.h" | 10 #include "vm/dart_entry.h" |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 | 186 |
187 ServiceIsolate::Run(); | 187 ServiceIsolate::Run(); |
188 | 188 |
189 return NULL; | 189 return NULL; |
190 } | 190 } |
191 | 191 |
192 | 192 |
193 const char* Dart::Cleanup() { | 193 const char* Dart::Cleanup() { |
194 // Shutdown the service isolate before shutting down the thread pool. | 194 // Shutdown the service isolate before shutting down the thread pool. |
195 ServiceIsolate::Shutdown(); | 195 ServiceIsolate::Shutdown(); |
196 #if 0 | 196 |
197 // Ideally we should shutdown the VM isolate here, but the thread pool | 197 // Ideally we should shutdown the VM isolate here, but the thread pool |
198 // shutdown does not seem to ensure that all the threads have stopped | 198 // shutdown does not seem to ensure that all the threads have stopped |
199 // execution before it terminates, this results in racing isolates. | 199 // execution before it terminates, this results in racing isolates. |
200 if (vm_isolate_ == NULL) { | 200 if (vm_isolate_ == NULL) { |
201 return "VM already terminated."; | 201 return "VM already terminated."; |
202 } | 202 } |
203 | 203 |
204 ASSERT(Isolate::Current() == NULL); | 204 ASSERT(Isolate::Current() == NULL); |
205 | 205 |
206 delete thread_pool_; | 206 delete thread_pool_; |
207 thread_pool_ = NULL; | 207 thread_pool_ = NULL; |
208 | 208 |
209 // Set the VM isolate as current isolate. | 209 // Set the VM isolate as current isolate. |
210 Thread::EnsureInit(); | 210 Thread::EnsureInit(); |
211 Thread::EnterIsolate(vm_isolate_); | 211 Thread::EnterIsolate(vm_isolate_); |
212 | 212 |
213 // There is a planned and known asymmetry here: We exit one scope for the VM | 213 // There is a planned and known asymmetry here: We exit one scope for the VM |
214 // isolate to account for the scope that was entered in Dart_InitOnce. | 214 // isolate to account for the scope that was entered in Dart_InitOnce. |
215 Dart_ExitScope(); | 215 Dart_ExitScope(); |
216 | 216 |
217 ShutdownIsolate(); | 217 ShutdownIsolate(); |
218 vm_isolate_ = NULL; | 218 vm_isolate_ = NULL; |
219 | 219 |
220 TargetCPUFeatures::Cleanup(); | 220 TargetCPUFeatures::Cleanup(); |
221 #endif | |
222 | 221 |
223 Profiler::Shutdown(); | 222 Profiler::Shutdown(); |
224 CodeObservers::DeleteAll(); | 223 CodeObservers::DeleteAll(); |
225 | 224 |
226 return NULL; | 225 return NULL; |
227 } | 226 } |
228 | 227 |
229 | 228 |
230 Isolate* Dart::CreateIsolate(const char* name_prefix) { | 229 Isolate* Dart::CreateIsolate(const char* name_prefix) { |
231 // Create a new isolate. | 230 // Create a new isolate. |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
350 return predefined_handles_->handles_.AllocateScopedHandle(); | 349 return predefined_handles_->handles_.AllocateScopedHandle(); |
351 } | 350 } |
352 | 351 |
353 | 352 |
354 bool Dart::IsReadOnlyHandle(uword address) { | 353 bool Dart::IsReadOnlyHandle(uword address) { |
355 ASSERT(predefined_handles_ != NULL); | 354 ASSERT(predefined_handles_ != NULL); |
356 return predefined_handles_->handles_.IsValidScopedHandle(address); | 355 return predefined_handles_->handles_.IsValidScopedHandle(address); |
357 } | 356 } |
358 | 357 |
359 } // namespace dart | 358 } // namespace dart |
OLD | NEW |