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 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
314 ASSERT(file_open != NULL); | 314 ASSERT(file_open != NULL); |
315 Dart_FileWriteCallback file_write = Isolate::file_write_callback(); | 315 Dart_FileWriteCallback file_write = Isolate::file_write_callback(); |
316 ASSERT(file_write != NULL); | 316 ASSERT(file_write != NULL); |
317 Dart_FileCloseCallback file_close = Isolate::file_close_callback(); | 317 Dart_FileCloseCallback file_close = Isolate::file_close_callback(); |
318 ASSERT(file_close != NULL); | 318 ASSERT(file_close != NULL); |
319 Isolate* isolate = Isolate::Current(); | 319 Isolate* isolate = Isolate::Current(); |
320 const char* format = "%s-%s.hprof"; | 320 const char* format = "%s-%s.hprof"; |
321 intptr_t len = OS::SNPrint(NULL, 0, format, isolate->name(), reason); | 321 intptr_t len = OS::SNPrint(NULL, 0, format, isolate->name(), reason); |
322 char* filename = isolate->current_zone()->Alloc<char>(len + 1); | 322 char* filename = isolate->current_zone()->Alloc<char>(len + 1); |
323 OS::SNPrint(filename, len + 1, format, isolate->name(), reason); | 323 OS::SNPrint(filename, len + 1, format, isolate->name(), reason); |
324 void* file = (*file_open)(filename, true); | 324 void* file = (*file_open)(filename); |
325 if (file != NULL) { | 325 if (file != NULL) { |
326 Profile(file_write, file); | 326 Profile(file_write, file); |
327 (*file_close)(file); | 327 (*file_close)(file); |
328 } | 328 } |
329 } | 329 } |
330 | 330 |
331 | 331 |
332 const char* Heap::GCReasonToString(GCReason gc_reason) { | 332 const char* Heap::GCReasonToString(GCReason gc_reason) { |
333 switch (gc_reason) { | 333 switch (gc_reason) { |
334 case kNewSpace: | 334 case kNewSpace: |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
487 heap->DisableGrowthControl(); | 487 heap->DisableGrowthControl(); |
488 } | 488 } |
489 | 489 |
490 | 490 |
491 NoHeapGrowthControlScope::~NoHeapGrowthControlScope() { | 491 NoHeapGrowthControlScope::~NoHeapGrowthControlScope() { |
492 Heap* heap = reinterpret_cast<Isolate*>(isolate())->heap(); | 492 Heap* heap = reinterpret_cast<Isolate*>(isolate())->heap(); |
493 heap->SetGrowthControlState(current_growth_controller_state_); | 493 heap->SetGrowthControlState(current_growth_controller_state_); |
494 } | 494 } |
495 | 495 |
496 } // namespace dart | 496 } // namespace dart |
OLD | NEW |