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 716 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
727 void Heap::SetWeakEntry(RawObject* raw_obj, WeakSelector sel, intptr_t val) { | 727 void Heap::SetWeakEntry(RawObject* raw_obj, WeakSelector sel, intptr_t val) { |
728 if (raw_obj->IsNewObject()) { | 728 if (raw_obj->IsNewObject()) { |
729 new_weak_tables_[sel]->SetValue(raw_obj, val); | 729 new_weak_tables_[sel]->SetValue(raw_obj, val); |
730 } else { | 730 } else { |
731 ASSERT(raw_obj->IsOldObject()); | 731 ASSERT(raw_obj->IsOldObject()); |
732 old_weak_tables_[sel]->SetValue(raw_obj, val); | 732 old_weak_tables_[sel]->SetValue(raw_obj, val); |
733 } | 733 } |
734 } | 734 } |
735 | 735 |
736 | 736 |
| 737 #ifndef PRODUCT |
737 void Heap::PrintToJSONObject(Space space, JSONObject* object) const { | 738 void Heap::PrintToJSONObject(Space space, JSONObject* object) const { |
738 if (space == kNew) { | 739 if (space == kNew) { |
739 new_space_.PrintToJSONObject(object); | 740 new_space_.PrintToJSONObject(object); |
740 } else { | 741 } else { |
741 old_space_.PrintToJSONObject(object); | 742 old_space_.PrintToJSONObject(object); |
742 } | 743 } |
743 } | 744 } |
| 745 #endif // PRODUCT |
744 | 746 |
745 | 747 |
746 void Heap::RecordBeforeGC(Space space, GCReason reason) { | 748 void Heap::RecordBeforeGC(Space space, GCReason reason) { |
747 ASSERT((space == kNew && gc_new_space_in_progress_) || | 749 ASSERT((space == kNew && gc_new_space_in_progress_) || |
748 (space == kOld && gc_old_space_in_progress_)); | 750 (space == kOld && gc_old_space_in_progress_)); |
749 stats_.num_++; | 751 stats_.num_++; |
750 stats_.space_ = space; | 752 stats_.space_ = space; |
751 stats_.reason_ = reason; | 753 stats_.reason_ = reason; |
752 stats_.before_.micros_ = OS::GetCurrentTimeMicros(); | 754 stats_.before_.micros_ = OS::GetCurrentTimeMicros(); |
753 stats_.before_.new_ = new_space_.GetCurrentUsage(); | 755 stats_.before_.new_ = new_space_.GetCurrentUsage(); |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
918 Dart::vm_isolate()->heap()->WriteProtect(false); | 920 Dart::vm_isolate()->heap()->WriteProtect(false); |
919 } | 921 } |
920 | 922 |
921 | 923 |
922 WritableVMIsolateScope::~WritableVMIsolateScope() { | 924 WritableVMIsolateScope::~WritableVMIsolateScope() { |
923 ASSERT(Dart::vm_isolate()->heap()->UsedInWords(Heap::kNew) == 0); | 925 ASSERT(Dart::vm_isolate()->heap()->UsedInWords(Heap::kNew) == 0); |
924 Dart::vm_isolate()->heap()->WriteProtect(true); | 926 Dart::vm_isolate()->heap()->WriteProtect(true); |
925 } | 927 } |
926 | 928 |
927 } // namespace dart | 929 } // namespace dart |
OLD | NEW |