| 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 17 matching lines...) Expand all Loading... |
| 63 ASSERT(vm_isolate_ == NULL); | 65 ASSERT(vm_isolate_ == NULL); |
| 64 ASSERT(Flags::Initialized()); | 66 ASSERT(Flags::Initialized()); |
| 65 vm_isolate_ = Isolate::Init("vm-isolate"); | 67 vm_isolate_ = Isolate::Init("vm-isolate"); |
| 66 Zone zone(vm_isolate_); | 68 Zone zone(vm_isolate_); |
| 67 HandleScope handle_scope(vm_isolate_); | 69 HandleScope handle_scope(vm_isolate_); |
| 68 Heap::Init(vm_isolate_); | 70 Heap::Init(vm_isolate_); |
| 69 ObjectStore::Init(vm_isolate_); | 71 ObjectStore::Init(vm_isolate_); |
| 70 Object::InitOnce(); | 72 Object::InitOnce(); |
| 71 StubCode::InitOnce(); | 73 StubCode::InitOnce(); |
| 72 Scanner::InitOnce(); | 74 Scanner::InitOnce(); |
| 73 PremarkingVisitor premarker; | 75 PremarkingVisitor premarker(vm_isolate_); |
| 74 vm_isolate_->heap()->IterateOldObjects(&premarker); | 76 vm_isolate_->heap()->IterateOldObjects(&premarker); |
| 75 } | 77 } |
| 76 Isolate::SetCurrent(NULL); // Unregister the VM isolate from this thread. | 78 Isolate::SetCurrent(NULL); // Unregister the VM isolate from this thread. |
| 77 Isolate::SetCreateCallback(create); | 79 Isolate::SetCreateCallback(create); |
| 78 Isolate::SetInterruptCallback(interrupt); | 80 Isolate::SetInterruptCallback(interrupt); |
| 79 Isolate::SetShutdownCallback(shutdown); | 81 Isolate::SetShutdownCallback(shutdown); |
| 80 return true; | 82 return true; |
| 81 } | 83 } |
| 82 | 84 |
| 83 | 85 |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 isolate->Shutdown(); | 137 isolate->Shutdown(); |
| 136 delete isolate; | 138 delete isolate; |
| 137 | 139 |
| 138 Dart_IsolateShutdownCallback callback = Isolate::ShutdownCallback(); | 140 Dart_IsolateShutdownCallback callback = Isolate::ShutdownCallback(); |
| 139 if (callback != NULL) { | 141 if (callback != NULL) { |
| 140 (callback)(callback_data); | 142 (callback)(callback_data); |
| 141 } | 143 } |
| 142 } | 144 } |
| 143 | 145 |
| 144 } // namespace dart | 146 } // namespace dart |
| OLD | NEW |