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/isolate.h" | 10 #include "vm/isolate.h" |
(...skipping 507 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
518 max_external_words); | 518 max_external_words); |
519 isolate->set_heap(heap); | 519 isolate->set_heap(heap); |
520 } | 520 } |
521 | 521 |
522 | 522 |
523 void Heap::RegionName(Heap* heap, Space space, char* name, intptr_t name_size) { | 523 void Heap::RegionName(Heap* heap, Space space, char* name, intptr_t name_size) { |
524 const bool no_isolate_name = (heap == NULL) || (heap->isolate() == NULL) || | 524 const bool no_isolate_name = (heap == NULL) || (heap->isolate() == NULL) || |
525 (heap->isolate()->debugger_name() == NULL); | 525 (heap->isolate()->debugger_name() == NULL); |
526 const char* isolate_name = | 526 const char* isolate_name = |
527 no_isolate_name ? "<unknown>" : heap->isolate()->debugger_name(); | 527 no_isolate_name ? "<unknown>" : heap->isolate()->debugger_name(); |
528 const char* space_name = (space == kNew) ? "newspace" : "oldspace"; | 528 const char* space_name = NULL; |
529 const char* type_name = (space == kCode) ? "code" : "data"; | 529 switch (space) { |
530 OS::SNPrint(name, name_size, "%s %s %s", isolate_name, space_name, type_name); | 530 case kNew: |
| 531 space_name = "newspace"; |
| 532 break; |
| 533 case kOld: |
| 534 space_name = "oldspace"; |
| 535 break; |
| 536 case kCode: |
| 537 space_name = "codespace"; |
| 538 break; |
| 539 default: |
| 540 UNREACHABLE(); |
| 541 } |
| 542 OS::SNPrint(name, name_size, "dart-%s %s", space_name, isolate_name); |
531 } | 543 } |
532 | 544 |
533 | 545 |
534 void Heap::AddRegionsToObjectSet(ObjectSet* set) const { | 546 void Heap::AddRegionsToObjectSet(ObjectSet* set) const { |
535 new_space_.AddRegionsToObjectSet(set); | 547 new_space_.AddRegionsToObjectSet(set); |
536 old_space_.AddRegionsToObjectSet(set); | 548 old_space_.AddRegionsToObjectSet(set); |
537 } | 549 } |
538 | 550 |
539 | 551 |
540 ObjectSet* Heap::CreateAllocatedObjectSet( | 552 ObjectSet* Heap::CreateAllocatedObjectSet( |
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
866 Dart::vm_isolate()->heap()->WriteProtect(false); | 878 Dart::vm_isolate()->heap()->WriteProtect(false); |
867 } | 879 } |
868 | 880 |
869 | 881 |
870 WritableVMIsolateScope::~WritableVMIsolateScope() { | 882 WritableVMIsolateScope::~WritableVMIsolateScope() { |
871 ASSERT(Dart::vm_isolate()->heap()->UsedInWords(Heap::kNew) == 0); | 883 ASSERT(Dart::vm_isolate()->heap()->UsedInWords(Heap::kNew) == 0); |
872 Dart::vm_isolate()->heap()->WriteProtect(true); | 884 Dart::vm_isolate()->heap()->WriteProtect(true); |
873 } | 885 } |
874 | 886 |
875 } // namespace dart | 887 } // namespace dart |
OLD | NEW |