Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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_index_table.h" | 7 #include "vm/code_index_table.h" |
| 8 #include "vm/flags.h" | 8 #include "vm/flags.h" |
| 9 #include "vm/handles.h" | 9 #include "vm/handles.h" |
| 10 #include "vm/heap.h" | 10 #include "vm/heap.h" |
| 11 #include "vm/isolate.h" | 11 #include "vm/isolate.h" |
| 12 #include "vm/longjump.h" | 12 #include "vm/longjump.h" |
| 13 #include "vm/object.h" | 13 #include "vm/object.h" |
| 14 #include "vm/object_store.h" | 14 #include "vm/object_store.h" |
| 15 #include "vm/port.h" | 15 #include "vm/port.h" |
| 16 #include "vm/snapshot.h" | 16 #include "vm/snapshot.h" |
| 17 #include "vm/stub_code.h" | 17 #include "vm/stub_code.h" |
| 18 #include "vm/virtual_memory.h" | 18 #include "vm/virtual_memory.h" |
| 19 #include "vm/zone.h" | 19 #include "vm/zone.h" |
| 20 | 20 |
| 21 namespace dart { | 21 namespace dart { |
| 22 | 22 |
| 23 Isolate* Dart::vm_isolate_ = NULL; | 23 Isolate* Dart::vm_isolate_ = NULL; |
| 24 DebugInfo* Dart::pprof_symbol_generator_ = NULL; | 24 DebugInfo* Dart::pprof_symbol_generator_ = NULL; |
| 25 | 25 |
| 26 bool Dart::InitOnce(int argc, const char** argv, | 26 bool Dart::InitOnce(Dart_IsolateInitCallback callback) { |
| 27 Dart_IsolateInitCallback callback) { | |
| 28 // TODO(iposva): Fix race condition here. | 27 // TODO(iposva): Fix race condition here. |
| 29 if (vm_isolate_ != NULL) { | 28 if (vm_isolate_ != NULL) { |
|
siva
2011/11/30 19:09:38
if (vm_isolate_ != NULL || !Flags::Initialized())
podivilov
2011/12/01 11:10:22
Done.
| |
| 30 return false; | 29 return false; |
| 31 } | 30 } |
| 32 OS::InitOnce(); | 31 OS::InitOnce(); |
| 33 Flags::ProcessCommandLineFlags(argc, argv); | |
| 34 VirtualMemory::InitOnce(); | 32 VirtualMemory::InitOnce(); |
| 35 Isolate::InitOnce(); | 33 Isolate::InitOnce(); |
| 36 PortMap::InitOnce(); | 34 PortMap::InitOnce(); |
| 37 // Create the VM isolate and finish the VM initialization. | 35 // Create the VM isolate and finish the VM initialization. |
| 38 { | 36 { |
| 39 ASSERT(vm_isolate_ == NULL); | 37 ASSERT(vm_isolate_ == NULL); |
| 38 ASSERT(Flags::Initialized()); | |
| 40 vm_isolate_ = Isolate::Init(); | 39 vm_isolate_ = Isolate::Init(); |
| 41 Zone zone(vm_isolate_); | 40 Zone zone(vm_isolate_); |
| 42 HandleScope handle_scope(vm_isolate_); | 41 HandleScope handle_scope(vm_isolate_); |
| 43 Heap::Init(vm_isolate_); | 42 Heap::Init(vm_isolate_); |
| 44 ObjectStore::Init(vm_isolate_); | 43 ObjectStore::Init(vm_isolate_); |
| 45 Object::InitOnce(); | 44 Object::InitOnce(); |
| 46 StubCode::InitOnce(); | 45 StubCode::InitOnce(); |
| 47 Scanner::InitOnce(); | 46 Scanner::InitOnce(); |
| 48 } | 47 } |
| 49 Isolate::SetCurrent(NULL); // Unregister the VM isolate from this thread. | 48 Isolate::SetCurrent(NULL); // Unregister the VM isolate from this thread. |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 93 } | 92 } |
| 94 | 93 |
| 95 | 94 |
| 96 void Dart::ShutdownIsolate() { | 95 void Dart::ShutdownIsolate() { |
| 97 Isolate* isolate = Isolate::Current(); | 96 Isolate* isolate = Isolate::Current(); |
| 98 isolate->Shutdown(); | 97 isolate->Shutdown(); |
| 99 delete isolate; | 98 delete isolate; |
| 100 } | 99 } |
| 101 | 100 |
| 102 } // namespace dart | 101 } // namespace dart |
| OLD | NEW |