| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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/dart_api_state.h" | 7 #include "vm/dart_api_state.h" |
| 8 #include "vm/flags.h" | 8 #include "vm/flags.h" |
| 9 #include "vm/freelist.h" | 9 #include "vm/freelist.h" |
| 10 #include "vm/handles.h" | 10 #include "vm/handles.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 | 26 |
| 27 Isolate* Dart::vm_isolate_ = NULL; | 27 Isolate* Dart::vm_isolate_ = NULL; |
| 28 ThreadPool* Dart::thread_pool_ = NULL; | 28 ThreadPool* Dart::thread_pool_ = NULL; |
| 29 DebugInfo* Dart::pprof_symbol_generator_ = NULL; | 29 DebugInfo* Dart::pprof_symbol_generator_ = NULL; |
| 30 FileWriterFunction Dart::flow_graph_writer_ = NULL; | 30 FileWriterFunction Dart::flow_graph_writer_ = NULL; |
| 31 | 31 |
| 32 // An object visitor which will mark all visited objects. This is used to | 32 // An object visitor which will mark all visited objects. This is used to |
| 33 // premark all objects in the vm_isolate_ heap. | 33 // premark all objects in the vm_isolate_ heap. |
| 34 class PremarkingVisitor : public ObjectVisitor { | 34 class PremarkingVisitor : public ObjectVisitor { |
| 35 public: | 35 public: |
| 36 explicit PremarkingVisitor(Isolate* isolate) : ObjectVisitor(isolate) {} |
| 37 |
| 36 void VisitObject(RawObject* obj) { | 38 void VisitObject(RawObject* obj) { |
| 37 // RawInstruction objects are premarked on allocation. | 39 // RawInstruction objects are premarked on allocation. |
| 38 if (!obj->IsMarked()) { | 40 if (!obj->IsMarked()) { |
| 39 obj->SetMarkBit(); | 41 obj->SetMarkBit(); |
| 40 } | 42 } |
| 41 } | 43 } |
| 42 }; | 44 }; |
| 43 | 45 |
| 44 | 46 |
| 45 // TODO(turnidge): We should add a corresponding Dart::Cleanup. | 47 // TODO(turnidge): We should add a corresponding Dart::Cleanup. |
| (...skipping 16 matching lines...) Expand all Loading... |
| 62 ASSERT(vm_isolate_ == NULL); | 64 ASSERT(vm_isolate_ == NULL); |
| 63 ASSERT(Flags::Initialized()); | 65 ASSERT(Flags::Initialized()); |
| 64 vm_isolate_ = Isolate::Init("vm-isolate"); | 66 vm_isolate_ = Isolate::Init("vm-isolate"); |
| 65 Zone zone(vm_isolate_); | 67 Zone zone(vm_isolate_); |
| 66 HandleScope handle_scope(vm_isolate_); | 68 HandleScope handle_scope(vm_isolate_); |
| 67 Heap::Init(vm_isolate_); | 69 Heap::Init(vm_isolate_); |
| 68 ObjectStore::Init(vm_isolate_); | 70 ObjectStore::Init(vm_isolate_); |
| 69 Object::InitOnce(); | 71 Object::InitOnce(); |
| 70 StubCode::InitOnce(); | 72 StubCode::InitOnce(); |
| 71 Scanner::InitOnce(); | 73 Scanner::InitOnce(); |
| 72 PremarkingVisitor premarker; | 74 PremarkingVisitor premarker(vm_isolate_); |
| 73 vm_isolate_->heap()->IterateOldObjects(&premarker); | 75 vm_isolate_->heap()->IterateOldObjects(&premarker); |
| 74 } | 76 } |
| 75 Isolate::SetCurrent(NULL); // Unregister the VM isolate from this thread. | 77 Isolate::SetCurrent(NULL); // Unregister the VM isolate from this thread. |
| 76 Isolate::SetCreateCallback(create); | 78 Isolate::SetCreateCallback(create); |
| 77 Isolate::SetInterruptCallback(interrupt); | 79 Isolate::SetInterruptCallback(interrupt); |
| 78 return true; | 80 return true; |
| 79 } | 81 } |
| 80 | 82 |
| 81 | 83 |
| 82 Isolate* Dart::CreateIsolate(const char* name_prefix) { | 84 Isolate* Dart::CreateIsolate(const char* name_prefix) { |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 } | 129 } |
| 128 | 130 |
| 129 | 131 |
| 130 void Dart::ShutdownIsolate() { | 132 void Dart::ShutdownIsolate() { |
| 131 Isolate* isolate = Isolate::Current(); | 133 Isolate* isolate = Isolate::Current(); |
| 132 isolate->Shutdown(); | 134 isolate->Shutdown(); |
| 133 delete isolate; | 135 delete isolate; |
| 134 } | 136 } |
| 135 | 137 |
| 136 } // namespace dart | 138 } // namespace dart |
| OLD | NEW |