| 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/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/flags.h" | 9 #include "vm/flags.h" |
| 10 #include "vm/freelist.h" | 10 #include "vm/freelist.h" |
| 11 #include "vm/handles.h" | 11 #include "vm/handles.h" |
| 12 #include "vm/heap.h" | 12 #include "vm/heap.h" |
| 13 #include "vm/isolate.h" | 13 #include "vm/isolate.h" |
| 14 #include "vm/object.h" | 14 #include "vm/object.h" |
| 15 #include "vm/object_store.h" | 15 #include "vm/object_store.h" |
| 16 #include "vm/port.h" | 16 #include "vm/port.h" |
| 17 #include "vm/snapshot.h" | 17 #include "vm/snapshot.h" |
| 18 #include "vm/stub_code.h" | 18 #include "vm/stub_code.h" |
| 19 #include "vm/symbols.h" | 19 #include "vm/symbols.h" |
| 20 #include "vm/thread_pool.h" | 20 #include "vm/thread_pool.h" |
| 21 #include "vm/virtual_memory.h" | 21 #include "vm/virtual_memory.h" |
| 22 #include "vm/zone.h" | 22 #include "vm/zone.h" |
| 23 | 23 |
| 24 namespace dart { | 24 namespace dart { |
| 25 | 25 |
| 26 DEFINE_FLAG(bool, heap_profile_initialize, false, |
| 27 "Writes a heap profile on isolate initialization."); |
| 26 DECLARE_FLAG(bool, print_bootstrap); | 28 DECLARE_FLAG(bool, print_bootstrap); |
| 27 DECLARE_FLAG(bool, print_class_table); | 29 DECLARE_FLAG(bool, print_class_table); |
| 28 DECLARE_FLAG(bool, trace_isolates); | 30 DECLARE_FLAG(bool, trace_isolates); |
| 29 | 31 |
| 30 Isolate* Dart::vm_isolate_ = NULL; | 32 Isolate* Dart::vm_isolate_ = NULL; |
| 31 ThreadPool* Dart::thread_pool_ = NULL; | 33 ThreadPool* Dart::thread_pool_ = NULL; |
| 32 void* Dart::perf_events_file_ = NULL; | 34 void* Dart::perf_events_file_ = NULL; |
| 33 DebugInfo* Dart::pprof_symbol_generator_ = NULL; | 35 DebugInfo* Dart::pprof_symbol_generator_ = NULL; |
| 34 | 36 |
| 35 // An object visitor which will mark all visited objects. This is used to | 37 // An object visitor which will mark all visited objects. This is used to |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 Snapshot::kFull, isolate); | 168 Snapshot::kFull, isolate); |
| 167 reader.ReadFullSnapshot(); | 169 reader.ReadFullSnapshot(); |
| 168 if (FLAG_trace_isolates) { | 170 if (FLAG_trace_isolates) { |
| 169 isolate->heap()->PrintSizes(); | 171 isolate->heap()->PrintSizes(); |
| 170 } | 172 } |
| 171 if (FLAG_print_bootstrap) { | 173 if (FLAG_print_bootstrap) { |
| 172 PrintLibrarySources(isolate); | 174 PrintLibrarySources(isolate); |
| 173 } | 175 } |
| 174 } | 176 } |
| 175 | 177 |
| 178 if (FLAG_heap_profile_initialize) { |
| 179 isolate->heap()->ProfileToFile("initialize"); |
| 180 } |
| 181 |
| 176 StubCode::Init(isolate); | 182 StubCode::Init(isolate); |
| 177 isolate->heap()->EnableGrowthControl(); | 183 isolate->heap()->EnableGrowthControl(); |
| 178 isolate->set_init_callback_data(data); | 184 isolate->set_init_callback_data(data); |
| 179 if (FLAG_print_class_table) { | 185 if (FLAG_print_class_table) { |
| 180 isolate->class_table()->Print(); | 186 isolate->class_table()->Print(); |
| 181 } | 187 } |
| 182 return Error::null(); | 188 return Error::null(); |
| 183 } | 189 } |
| 184 | 190 |
| 185 | 191 |
| 186 void Dart::ShutdownIsolate() { | 192 void Dart::ShutdownIsolate() { |
| 187 Isolate* isolate = Isolate::Current(); | 193 Isolate* isolate = Isolate::Current(); |
| 188 if (FLAG_trace_isolates) { | 194 if (FLAG_trace_isolates) { |
| 189 isolate->heap()->PrintSizes(); | 195 isolate->heap()->PrintSizes(); |
| 190 } | 196 } |
| 191 void* callback_data = isolate->init_callback_data(); | 197 void* callback_data = isolate->init_callback_data(); |
| 192 isolate->Shutdown(); | 198 isolate->Shutdown(); |
| 193 delete isolate; | 199 delete isolate; |
| 194 | 200 |
| 195 Dart_IsolateShutdownCallback callback = Isolate::ShutdownCallback(); | 201 Dart_IsolateShutdownCallback callback = Isolate::ShutdownCallback(); |
| 196 if (callback != NULL) { | 202 if (callback != NULL) { |
| 197 (callback)(callback_data); | 203 (callback)(callback_data); |
| 198 } | 204 } |
| 199 } | 205 } |
| 200 | 206 |
| 201 | 207 |
| 202 } // namespace dart | 208 } // namespace dart |
| OLD | NEW |