| 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/port.h" | 18 #include "vm/port.h" |
| 18 #include "vm/simulator.h" | 19 #include "vm/simulator.h" |
| 19 #include "vm/snapshot.h" | 20 #include "vm/snapshot.h" |
| 20 #include "vm/stub_code.h" | 21 #include "vm/stub_code.h" |
| 21 #include "vm/symbols.h" | 22 #include "vm/symbols.h" |
| 22 #include "vm/thread_pool.h" | 23 #include "vm/thread_pool.h" |
| 23 #include "vm/virtual_memory.h" | 24 #include "vm/virtual_memory.h" |
| 24 #include "vm/zone.h" | 25 #include "vm/zone.h" |
| 25 | 26 |
| 26 namespace dart { | 27 namespace dart { |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 // Create the VM isolate and finish the VM initialization. | 104 // Create the VM isolate and finish the VM initialization. |
| 104 ASSERT(thread_pool_ == NULL); | 105 ASSERT(thread_pool_ == NULL); |
| 105 thread_pool_ = new ThreadPool(); | 106 thread_pool_ = new ThreadPool(); |
| 106 { | 107 { |
| 107 ASSERT(vm_isolate_ == NULL); | 108 ASSERT(vm_isolate_ == NULL); |
| 108 ASSERT(Flags::Initialized()); | 109 ASSERT(Flags::Initialized()); |
| 109 vm_isolate_ = Isolate::Init("vm-isolate"); | 110 vm_isolate_ = Isolate::Init("vm-isolate"); |
| 110 StackZone zone(vm_isolate_); | 111 StackZone zone(vm_isolate_); |
| 111 HandleScope handle_scope(vm_isolate_); | 112 HandleScope handle_scope(vm_isolate_); |
| 112 Heap::Init(vm_isolate_); | 113 Heap::Init(vm_isolate_); |
| 114 ObjectIdRing::Init(vm_isolate_); |
| 113 ObjectStore::Init(vm_isolate_); | 115 ObjectStore::Init(vm_isolate_); |
| 114 Object::InitOnce(); | 116 Object::InitOnce(); |
| 115 ArgumentsDescriptor::InitOnce(); | 117 ArgumentsDescriptor::InitOnce(); |
| 116 StubCode::InitOnce(); | 118 StubCode::InitOnce(); |
| 117 Scanner::InitOnce(); | 119 Scanner::InitOnce(); |
| 118 Symbols::InitOnce(vm_isolate_); | 120 Symbols::InitOnce(vm_isolate_); |
| 119 Object::CreateInternalMetaData(); | 121 Object::CreateInternalMetaData(); |
| 120 CPUFeatures::InitOnce(); | 122 CPUFeatures::InitOnce(); |
| 121 #if defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64) | 123 #if defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64) |
| 122 // Dart VM requires at least SSE2. | 124 // Dart VM requires at least SSE2. |
| (...skipping 29 matching lines...) Expand all Loading... |
| 152 | 154 |
| 153 | 155 |
| 154 RawError* Dart::InitializeIsolate(const uint8_t* snapshot_buffer, void* data) { | 156 RawError* Dart::InitializeIsolate(const uint8_t* snapshot_buffer, void* data) { |
| 155 // Initialize the new isolate. | 157 // Initialize the new isolate. |
| 156 TIMERSCOPE(time_isolate_initialization); | 158 TIMERSCOPE(time_isolate_initialization); |
| 157 Isolate* isolate = Isolate::Current(); | 159 Isolate* isolate = Isolate::Current(); |
| 158 ASSERT(isolate != NULL); | 160 ASSERT(isolate != NULL); |
| 159 StackZone zone(isolate); | 161 StackZone zone(isolate); |
| 160 HandleScope handle_scope(isolate); | 162 HandleScope handle_scope(isolate); |
| 161 Heap::Init(isolate); | 163 Heap::Init(isolate); |
| 164 ObjectIdRing::Init(isolate); |
| 162 ObjectStore::Init(isolate); | 165 ObjectStore::Init(isolate); |
| 163 | 166 |
| 164 if (snapshot_buffer == NULL) { | 167 if (snapshot_buffer == NULL) { |
| 165 const Error& error = Error::Handle(Object::Init(isolate)); | 168 const Error& error = Error::Handle(Object::Init(isolate)); |
| 166 if (!error.IsNull()) { | 169 if (!error.IsNull()) { |
| 167 return error.raw(); | 170 return error.raw(); |
| 168 } | 171 } |
| 169 } else { | 172 } else { |
| 170 // Initialize from snapshot (this should replicate the functionality | 173 // Initialize from snapshot (this should replicate the functionality |
| 171 // of Object::Init(..) in a regular isolate creation path. | 174 // of Object::Init(..) in a regular isolate creation path. |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 return predefined_handles_->handles_.AllocateScopedHandle(); | 232 return predefined_handles_->handles_.AllocateScopedHandle(); |
| 230 } | 233 } |
| 231 | 234 |
| 232 | 235 |
| 233 bool Dart::IsReadOnlyHandle(uword address) { | 236 bool Dart::IsReadOnlyHandle(uword address) { |
| 234 ASSERT(predefined_handles_ != NULL); | 237 ASSERT(predefined_handles_ != NULL); |
| 235 return predefined_handles_->handles_.IsValidScopedHandle(address); | 238 return predefined_handles_->handles_.IsValidScopedHandle(address); |
| 236 } | 239 } |
| 237 | 240 |
| 238 } // namespace dart | 241 } // namespace dart |
| OLD | NEW |