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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 Thread::EnsureInit(); |
121 vm_isolate_ = Isolate::Init("vm-isolate", is_vm_isolate); | 121 |
| 122 // Setup default flags for the VM isolate. |
| 123 Isolate::Flags vm_flags; |
| 124 Dart_IsolateFlags api_flags; |
| 125 vm_flags.CopyTo(&api_flags); |
| 126 vm_isolate_ = Isolate::Init("vm-isolate", api_flags, is_vm_isolate); |
| 127 |
122 StackZone zone(vm_isolate_); | 128 StackZone zone(vm_isolate_); |
123 HandleScope handle_scope(vm_isolate_); | 129 HandleScope handle_scope(vm_isolate_); |
124 Heap::Init(vm_isolate_, | 130 Heap::Init(vm_isolate_, |
125 0, // New gen size 0; VM isolate should only allocate in old. | 131 0, // New gen size 0; VM isolate should only allocate in old. |
126 FLAG_old_gen_heap_size * MBInWords, | 132 FLAG_old_gen_heap_size * MBInWords, |
127 FLAG_external_max_size * MBInWords); | 133 FLAG_external_max_size * MBInWords); |
128 ObjectStore::Init(vm_isolate_); | 134 ObjectStore::Init(vm_isolate_); |
129 TargetCPUFeatures::InitOnce(); | 135 TargetCPUFeatures::InitOnce(); |
130 Object::InitOnce(vm_isolate_); | 136 Object::InitOnce(vm_isolate_); |
131 ArgumentsDescriptor::InitOnce(); | 137 ArgumentsDescriptor::InitOnce(); |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 TargetCPUFeatures::Cleanup(); | 225 TargetCPUFeatures::Cleanup(); |
220 #endif | 226 #endif |
221 | 227 |
222 Profiler::Shutdown(); | 228 Profiler::Shutdown(); |
223 CodeObservers::DeleteAll(); | 229 CodeObservers::DeleteAll(); |
224 | 230 |
225 return NULL; | 231 return NULL; |
226 } | 232 } |
227 | 233 |
228 | 234 |
229 Isolate* Dart::CreateIsolate(const char* name_prefix) { | 235 Isolate* Dart::CreateIsolate(const char* name_prefix, |
| 236 const Dart_IsolateFlags& api_flags) { |
230 // Create a new isolate. | 237 // Create a new isolate. |
231 Isolate* isolate = Isolate::Init(name_prefix); | 238 Isolate* isolate = Isolate::Init(name_prefix, api_flags); |
232 ASSERT(isolate != NULL); | 239 ASSERT(isolate != NULL); |
233 return isolate; | 240 return isolate; |
234 } | 241 } |
235 | 242 |
236 | 243 |
237 RawError* Dart::InitializeIsolate(const uint8_t* snapshot_buffer, void* data) { | 244 RawError* Dart::InitializeIsolate(const uint8_t* snapshot_buffer, void* data) { |
238 // Initialize the new isolate. | 245 // Initialize the new isolate. |
239 Isolate* isolate = Isolate::Current(); | 246 Isolate* isolate = Isolate::Current(); |
240 TIMERSCOPE(isolate, time_isolate_initialization); | 247 TIMERSCOPE(isolate, time_isolate_initialization); |
241 ASSERT(isolate != NULL); | 248 ASSERT(isolate != NULL); |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
349 return predefined_handles_->handles_.AllocateScopedHandle(); | 356 return predefined_handles_->handles_.AllocateScopedHandle(); |
350 } | 357 } |
351 | 358 |
352 | 359 |
353 bool Dart::IsReadOnlyHandle(uword address) { | 360 bool Dart::IsReadOnlyHandle(uword address) { |
354 ASSERT(predefined_handles_ != NULL); | 361 ASSERT(predefined_handles_ != NULL); |
355 return predefined_handles_->handles_.IsValidScopedHandle(address); | 362 return predefined_handles_->handles_.IsValidScopedHandle(address); |
356 } | 363 } |
357 | 364 |
358 } // namespace dart | 365 } // namespace dart |
OLD | NEW |