| 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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 // Create the read-only handles area. | 110 // Create the read-only handles area. |
| 111 ASSERT(predefined_handles_ == NULL); | 111 ASSERT(predefined_handles_ == NULL); |
| 112 predefined_handles_ = new ReadOnlyHandles(); | 112 predefined_handles_ = new ReadOnlyHandles(); |
| 113 // Create the VM isolate and finish the VM initialization. | 113 // Create the VM isolate and finish the VM initialization. |
| 114 ASSERT(thread_pool_ == NULL); | 114 ASSERT(thread_pool_ == NULL); |
| 115 thread_pool_ = new ThreadPool(); | 115 thread_pool_ = new ThreadPool(); |
| 116 { | 116 { |
| 117 ASSERT(vm_isolate_ == NULL); | 117 ASSERT(vm_isolate_ == NULL); |
| 118 ASSERT(Flags::Initialized()); | 118 ASSERT(Flags::Initialized()); |
| 119 const bool is_vm_isolate = true; | 119 const bool is_vm_isolate = true; |
| 120 Thread::EnsureInit(); |
| 120 vm_isolate_ = Isolate::Init("vm-isolate", is_vm_isolate); | 121 vm_isolate_ = Isolate::Init("vm-isolate", is_vm_isolate); |
| 121 StackZone zone(vm_isolate_); | 122 StackZone zone(vm_isolate_); |
| 122 HandleScope handle_scope(vm_isolate_); | 123 HandleScope handle_scope(vm_isolate_); |
| 123 Heap::Init(vm_isolate_, | 124 Heap::Init(vm_isolate_, |
| 124 0, // New gen size 0; VM isolate should only allocate in old. | 125 0, // New gen size 0; VM isolate should only allocate in old. |
| 125 FLAG_old_gen_heap_size * MBInWords, | 126 FLAG_old_gen_heap_size * MBInWords, |
| 126 FLAG_external_max_size * MBInWords); | 127 FLAG_external_max_size * MBInWords); |
| 127 ObjectStore::Init(vm_isolate_); | 128 ObjectStore::Init(vm_isolate_); |
| 128 TargetCPUFeatures::InitOnce(); | 129 TargetCPUFeatures::InitOnce(); |
| 129 Object::InitOnce(vm_isolate_); | 130 Object::InitOnce(vm_isolate_); |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 if (vm_isolate_ == NULL) { | 200 if (vm_isolate_ == NULL) { |
| 200 return "VM already terminated."; | 201 return "VM already terminated."; |
| 201 } | 202 } |
| 202 | 203 |
| 203 ASSERT(Isolate::Current() == NULL); | 204 ASSERT(Isolate::Current() == NULL); |
| 204 | 205 |
| 205 delete thread_pool_; | 206 delete thread_pool_; |
| 206 thread_pool_ = NULL; | 207 thread_pool_ = NULL; |
| 207 | 208 |
| 208 // Set the VM isolate as current isolate. | 209 // Set the VM isolate as current isolate. |
| 210 Thread::EnsureInit(); |
| 209 Thread::EnterIsolate(vm_isolate_); | 211 Thread::EnterIsolate(vm_isolate_); |
| 210 | 212 |
| 211 // 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 |
| 212 // 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. |
| 213 Dart_ExitScope(); | 215 Dart_ExitScope(); |
| 214 | 216 |
| 215 ShutdownIsolate(); | 217 ShutdownIsolate(); |
| 216 vm_isolate_ = NULL; | 218 vm_isolate_ = NULL; |
| 217 | 219 |
| 218 TargetCPUFeatures::Cleanup(); | 220 TargetCPUFeatures::Cleanup(); |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 348 return predefined_handles_->handles_.AllocateScopedHandle(); | 350 return predefined_handles_->handles_.AllocateScopedHandle(); |
| 349 } | 351 } |
| 350 | 352 |
| 351 | 353 |
| 352 bool Dart::IsReadOnlyHandle(uword address) { | 354 bool Dart::IsReadOnlyHandle(uword address) { |
| 353 ASSERT(predefined_handles_ != NULL); | 355 ASSERT(predefined_handles_ != NULL); |
| 354 return predefined_handles_->handles_.IsValidScopedHandle(address); | 356 return predefined_handles_->handles_.IsValidScopedHandle(address); |
| 355 } | 357 } |
| 356 | 358 |
| 357 } // namespace dart | 359 } // namespace dart |
| OLD | NEW |