| 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_profiler.h" | 5 #include "vm/heap_profiler.h" |
| 6 | 6 |
| 7 #include "vm/dart_api_state.h" | 7 #include "vm/dart_api_state.h" |
| 8 #include "vm/object.h" | 8 #include "vm/object.h" |
| 9 #include "vm/raw_object.h" | 9 #include "vm/raw_object.h" |
| 10 #include "vm/stack_frame.h" | 10 #include "vm/stack_frame.h" |
| (...skipping 766 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 777 if (raw_obj->IsHeapObject()) { | 777 if (raw_obj->IsHeapObject()) { |
| 778 // Skip visits of FreeListElements. | 778 // Skip visits of FreeListElements. |
| 779 if (raw_obj->GetClassId() == kFreeListElement) { | 779 if (raw_obj->GetClassId() == kFreeListElement) { |
| 780 // Only the class of the free list element should ever be visited. | 780 // Only the class of the free list element should ever be visited. |
| 781 ASSERT(first == last); | 781 ASSERT(first == last); |
| 782 return; | 782 return; |
| 783 } | 783 } |
| 784 uword obj_addr = RawObject::ToAddr(raw_obj); | 784 uword obj_addr = RawObject::ToAddr(raw_obj); |
| 785 if (!Isolate::Current()->heap()->Contains(obj_addr) && | 785 if (!Isolate::Current()->heap()->Contains(obj_addr) && |
| 786 !Dart::vm_isolate()->heap()->Contains(obj_addr)) { | 786 !Dart::vm_isolate()->heap()->Contains(obj_addr)) { |
| 787 FATAL1("Invalid object pointer encountered %#"Px"\n", obj_addr); | 787 FATAL1("Invalid object pointer encountered %#" Px "\n", obj_addr); |
| 788 } | 788 } |
| 789 } | 789 } |
| 790 profiler_->WriteRoot(raw_obj); | 790 profiler_->WriteRoot(raw_obj); |
| 791 } | 791 } |
| 792 } | 792 } |
| 793 | 793 |
| 794 | 794 |
| 795 void HeapProfilerWeakRootVisitor::VisitHandle(uword addr) { | 795 void HeapProfilerWeakRootVisitor::VisitHandle(uword addr) { |
| 796 FinalizablePersistentHandle* handle = | 796 FinalizablePersistentHandle* handle = |
| 797 reinterpret_cast<FinalizablePersistentHandle*>(addr); | 797 reinterpret_cast<FinalizablePersistentHandle*>(addr); |
| 798 RawObject* raw_obj = handle->raw(); | 798 RawObject* raw_obj = handle->raw(); |
| 799 visitor_->VisitPointer(&raw_obj); | 799 visitor_->VisitPointer(&raw_obj); |
| 800 } | 800 } |
| 801 | 801 |
| 802 | 802 |
| 803 void HeapProfilerObjectVisitor::VisitObject(RawObject* raw_obj) { | 803 void HeapProfilerObjectVisitor::VisitObject(RawObject* raw_obj) { |
| 804 profiler_->WriteObject(raw_obj); | 804 profiler_->WriteObject(raw_obj); |
| 805 } | 805 } |
| 806 | 806 |
| 807 } // namespace dart | 807 } // namespace dart |
| OLD | NEW |