| 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 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 406 // ID - class name string ID | 406 // ID - class name string ID |
| 407 void HeapProfiler::WriteLoadClass(const RawClass* raw_class) { | 407 void HeapProfiler::WriteLoadClass(const RawClass* raw_class) { |
| 408 Record record(kLoadClass, this); | 408 Record record(kLoadClass, this); |
| 409 // class serial number (always > 0) | 409 // class serial number (always > 0) |
| 410 record.Write32(1); | 410 record.Write32(1); |
| 411 // class object ID | 411 // class object ID |
| 412 record.WritePointer(raw_class); | 412 record.WritePointer(raw_class); |
| 413 // stack trace serial number | 413 // stack trace serial number |
| 414 record.Write32(0); | 414 record.Write32(0); |
| 415 if (raw_class->ptr()->name_ == String::null()) { | 415 if (raw_class->ptr()->name_ == String::null()) { |
| 416 intptr_t class_index = Object::GetSingletonClassIndex(raw_class); | 416 const char* name = Object::GetSingletonClassName(raw_class->id_); |
| 417 const char* name = Object::GetSingletonClassName(class_index); | |
| 418 record.WritePointer(StringId(name)); | 417 record.WritePointer(StringId(name)); |
| 419 } else { | 418 } else { |
| 420 record.WritePointer(StringId(raw_class->ptr()->name_)); | 419 record.WritePointer(StringId(raw_class->ptr()->name_)); |
| 421 } | 420 } |
| 422 } | 421 } |
| 423 | 422 |
| 424 | 423 |
| 425 // STACK TRACE - 0x05 | 424 // STACK TRACE - 0x05 |
| 426 // | 425 // |
| 427 // u4 - stack trace serial number | 426 // u4 - stack trace serial number |
| (...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 720 RawObject* raw_obj = handle->raw(); | 719 RawObject* raw_obj = handle->raw(); |
| 721 visitor_->VisitPointer(&raw_obj); | 720 visitor_->VisitPointer(&raw_obj); |
| 722 } | 721 } |
| 723 | 722 |
| 724 | 723 |
| 725 void HeapProfilerObjectVisitor::VisitObject(RawObject* raw_obj) { | 724 void HeapProfilerObjectVisitor::VisitObject(RawObject* raw_obj) { |
| 726 profiler_->WriteObject(raw_obj); | 725 profiler_->WriteObject(raw_obj); |
| 727 } | 726 } |
| 728 | 727 |
| 729 } // namespace dart | 728 } // namespace dart |
| OLD | NEW |