Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(586)

Side by Side Diff: runtime/vm/dart.cc

Issue 11428067: Merge the Merlin heap tracing to top-of-trunk. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: address review comments Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/vm/code_generator.cc ('k') | runtime/vm/gc_sweeper.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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, 26 DEFINE_FLAG(bool, heap_profile_initialize, false,
27 "Writes a heap profile on isolate initialization."); 27 "Writes a heap profile on isolate initialization.");
28 DECLARE_FLAG(bool, heap_trace);
28 DECLARE_FLAG(bool, print_bootstrap); 29 DECLARE_FLAG(bool, print_bootstrap);
29 DECLARE_FLAG(bool, print_class_table); 30 DECLARE_FLAG(bool, print_class_table);
30 DECLARE_FLAG(bool, trace_isolates); 31 DECLARE_FLAG(bool, trace_isolates);
31 32
32 Isolate* Dart::vm_isolate_ = NULL; 33 Isolate* Dart::vm_isolate_ = NULL;
33 ThreadPool* Dart::thread_pool_ = NULL; 34 ThreadPool* Dart::thread_pool_ = NULL;
34 DebugInfo* Dart::pprof_symbol_generator_ = NULL; 35 DebugInfo* Dart::pprof_symbol_generator_ = NULL;
35 36
36 // 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
37 // premark all objects in the vm_isolate_ heap. 38 // premark all objects in the vm_isolate_ heap.
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 #endif 93 #endif
93 PremarkingVisitor premarker(vm_isolate_); 94 PremarkingVisitor premarker(vm_isolate_);
94 vm_isolate_->heap()->IterateOldObjects(&premarker); 95 vm_isolate_->heap()->IterateOldObjects(&premarker);
95 vm_isolate_->heap()->WriteProtect(true); 96 vm_isolate_->heap()->WriteProtect(true);
96 } 97 }
97 Isolate::SetCurrent(NULL); // Unregister the VM isolate from this thread. 98 Isolate::SetCurrent(NULL); // Unregister the VM isolate from this thread.
98 Isolate::SetCreateCallback(create); 99 Isolate::SetCreateCallback(create);
99 Isolate::SetInterruptCallback(interrupt); 100 Isolate::SetInterruptCallback(interrupt);
100 Isolate::SetUnhandledExceptionCallback(unhandled); 101 Isolate::SetUnhandledExceptionCallback(unhandled);
101 Isolate::SetShutdownCallback(shutdown); 102 Isolate::SetShutdownCallback(shutdown);
103 if (FLAG_heap_trace) {
104 HeapTrace::InitOnce(file_open, file_write, file_close);
105 }
102 return NULL; 106 return NULL;
103 } 107 }
104 108
105 109
106 Isolate* Dart::CreateIsolate(const char* name_prefix) { 110 Isolate* Dart::CreateIsolate(const char* name_prefix) {
107 // Create a new isolate. 111 // Create a new isolate.
108 Isolate* isolate = Isolate::Init(name_prefix); 112 Isolate* isolate = Isolate::Init(name_prefix);
109 ASSERT(isolate != NULL); 113 ASSERT(isolate != NULL);
110 return isolate; 114 return isolate;
111 } 115 }
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 PrintLibrarySources(isolate); 178 PrintLibrarySources(isolate);
175 } 179 }
176 } 180 }
177 181
178 if (FLAG_heap_profile_initialize) { 182 if (FLAG_heap_profile_initialize) {
179 isolate->heap()->ProfileToFile("initialize"); 183 isolate->heap()->ProfileToFile("initialize");
180 } 184 }
181 185
182 StubCode::Init(isolate); 186 StubCode::Init(isolate);
183 isolate->megamorphic_cache_table()->InitMissHandler(); 187 isolate->megamorphic_cache_table()->InitMissHandler();
188 if (FLAG_heap_trace) {
189 isolate->heap()->trace()->Init(isolate);
190 }
184 isolate->heap()->EnableGrowthControl(); 191 isolate->heap()->EnableGrowthControl();
185 isolate->set_init_callback_data(data); 192 isolate->set_init_callback_data(data);
186 if (FLAG_print_class_table) { 193 if (FLAG_print_class_table) {
187 isolate->class_table()->Print(); 194 isolate->class_table()->Print();
188 } 195 }
189 return Error::null(); 196 return Error::null();
190 } 197 }
191 198
192 199
193 void Dart::ShutdownIsolate() { 200 void Dart::ShutdownIsolate() {
194 Isolate* isolate = Isolate::Current(); 201 Isolate* isolate = Isolate::Current();
195 void* callback_data = isolate->init_callback_data(); 202 void* callback_data = isolate->init_callback_data();
196 isolate->Shutdown(); 203 isolate->Shutdown();
197 delete isolate; 204 delete isolate;
198 205
199 Dart_IsolateShutdownCallback callback = Isolate::ShutdownCallback(); 206 Dart_IsolateShutdownCallback callback = Isolate::ShutdownCallback();
200 if (callback != NULL) { 207 if (callback != NULL) {
201 (callback)(callback_data); 208 (callback)(callback_data);
202 } 209 }
203 } 210 }
204 211
205 212
206 } // namespace dart 213 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/code_generator.cc ('k') | runtime/vm/gc_sweeper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698