| 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 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 405 // u4 - stack trace serial number | 405 // u4 - stack trace serial number |
| 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 ASSERT(raw_class->ptr()->name_ != String::null()); |
| 416 intptr_t class_id = raw_class->ptr()->id_; | 416 record.WritePointer(StringId(raw_class->ptr()->name_)); |
| 417 const char* name = Object::GetSingletonClassName(class_id); | |
| 418 record.WritePointer(StringId(name)); | |
| 419 } else { | |
| 420 record.WritePointer(StringId(raw_class->ptr()->name_)); | |
| 421 } | |
| 422 } | 417 } |
| 423 | 418 |
| 424 | 419 |
| 425 // STACK TRACE - 0x05 | 420 // STACK TRACE - 0x05 |
| 426 // | 421 // |
| 427 // u4 - stack trace serial number | 422 // u4 - stack trace serial number |
| 428 // u4 - thread serial number | 423 // u4 - thread serial number |
| 429 // u4 - number of frames | 424 // u4 - number of frames |
| 430 // [ID]* - series of stack frame ID's | 425 // [ID]* - series of stack frame ID's |
| 431 void HeapProfiler::WriteStackTrace() { | 426 void HeapProfiler::WriteStackTrace() { |
| (...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 720 RawObject* raw_obj = handle->raw(); | 715 RawObject* raw_obj = handle->raw(); |
| 721 visitor_->VisitPointer(&raw_obj); | 716 visitor_->VisitPointer(&raw_obj); |
| 722 } | 717 } |
| 723 | 718 |
| 724 | 719 |
| 725 void HeapProfilerObjectVisitor::VisitObject(RawObject* raw_obj) { | 720 void HeapProfilerObjectVisitor::VisitObject(RawObject* raw_obj) { |
| 726 profiler_->WriteObject(raw_obj); | 721 profiler_->WriteObject(raw_obj); |
| 727 } | 722 } |
| 728 | 723 |
| 729 } // namespace dart | 724 } // namespace dart |
| OLD | NEW |