| 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/heap.h" | 5 #include "vm/heap.h" |
| 6 | 6 |
| 7 #include "platform/assert.h" | 7 #include "platform/assert.h" |
| 8 #include "platform/utils.h" | 8 #include "platform/utils.h" |
| 9 #include "vm/flags.h" | 9 #include "vm/flags.h" |
| 10 #include "vm/heap_profiler.h" | 10 #include "vm/heap_profiler.h" |
| (...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 279 HeapProfilerWeakRootVisitor weak_root_visitor(&root_visitor); | 279 HeapProfilerWeakRootVisitor weak_root_visitor(&root_visitor); |
| 280 isolate->VisitWeakPersistentHandles(&weak_root_visitor, true); | 280 isolate->VisitWeakPersistentHandles(&weak_root_visitor, true); |
| 281 | 281 |
| 282 // Dump the current and VM isolate heaps. | 282 // Dump the current and VM isolate heaps. |
| 283 HeapProfilerObjectVisitor object_visitor(isolate, &profiler); | 283 HeapProfilerObjectVisitor object_visitor(isolate, &profiler); |
| 284 isolate->heap()->IterateObjects(&object_visitor); | 284 isolate->heap()->IterateObjects(&object_visitor); |
| 285 vm_isolate->heap()->IterateObjects(&object_visitor); | 285 vm_isolate->heap()->IterateObjects(&object_visitor); |
| 286 } | 286 } |
| 287 | 287 |
| 288 | 288 |
| 289 void Heap::ProfileToFile(const char* filename) const { |
| 290 Dart_FileOpenCallback file_open = Isolate::file_open_callback(); |
| 291 ASSERT(file_open != NULL); |
| 292 Dart_FileWriteCallback file_write = Isolate::file_write_callback(); |
| 293 ASSERT(file_write != NULL); |
| 294 Dart_FileCloseCallback file_close = Isolate::file_close_callback(); |
| 295 ASSERT(file_close != NULL); |
| 296 void* file = (*file_open)(filename); |
| 297 if (file != NULL) { |
| 298 Profile(file_write, file); |
| 299 (*file_close)(file); |
| 300 } |
| 301 } |
| 302 |
| 303 |
| 289 const char* Heap::GCReasonToString(GCReason gc_reason) { | 304 const char* Heap::GCReasonToString(GCReason gc_reason) { |
| 290 switch (gc_reason) { | 305 switch (gc_reason) { |
| 291 case kNewSpace: | 306 case kNewSpace: |
| 292 return "new space"; | 307 return "new space"; |
| 293 case kPromotionFailure: | 308 case kPromotionFailure: |
| 294 return "promotion failure"; | 309 return "promotion failure"; |
| 295 case kOldSpace: | 310 case kOldSpace: |
| 296 return "old space"; | 311 return "old space"; |
| 297 case kCodeSpace: | 312 case kCodeSpace: |
| 298 return "code space"; | 313 return "code space"; |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 338 isolate()->IncrementNoGCScopeDepth(); | 353 isolate()->IncrementNoGCScopeDepth(); |
| 339 } | 354 } |
| 340 | 355 |
| 341 | 356 |
| 342 NoGCScope::~NoGCScope() { | 357 NoGCScope::~NoGCScope() { |
| 343 isolate()->DecrementNoGCScopeDepth(); | 358 isolate()->DecrementNoGCScopeDepth(); |
| 344 } | 359 } |
| 345 #endif // defined(DEBUG) | 360 #endif // defined(DEBUG) |
| 346 | 361 |
| 347 } // namespace dart | 362 } // namespace dart |
| OLD | NEW |