Chromium Code Reviews| Index: runtime/vm/heap_profiler.cc |
| =================================================================== |
| --- runtime/vm/heap_profiler.cc (revision 16999) |
| +++ runtime/vm/heap_profiler.cc (working copy) |
| @@ -124,6 +124,11 @@ |
| HeapProfiler::~HeapProfiler() { |
| + for (std::set<const RawSmi*>::iterator it = smi_table_.begin(); |
|
cshapiro
2013/01/12 02:52:26
You might consider using this idiom...
for_each
|
| + it != smi_table_.end(); |
| + ++it) { |
| + WriteSmiDump(*it); |
| + } |
| delete heap_dump_record_; |
| } |
| @@ -566,7 +571,28 @@ |
| } |
| } |
| +// INSTANCE DUMP - 0x21 |
|
cshapiro
2013/01/12 02:52:26
We probably do not need to repeat this documentati
Ivan Posva
2013/01/14 23:38:42
Done.
|
| +// |
| +// Format: |
| +// ID - object ID |
| +// u4 - stack trace serial number |
| +// ID - class object ID |
| +// u4 - number of bytes that follow |
| +// [value]* - instance field values (this class, followed by super class, etc) |
| +void HeapProfiler::WriteSmiDump(const RawSmi* raw_smi) { |
| + ASSERT(!raw_smi->IsHeapObject()); |
| + SubRecord sub(kInstanceDump, this); |
| + // object ID |
| + sub.WriteObjectId(raw_smi); |
|
siva
2013/01/14 23:50:13
Since we are writing out smi values as an object i
Ivan Posva
2013/01/14 23:53:38
IDs from the heap profiler dump perspective are th
cshapiro
2013/01/14 23:55:22
It should not. We use an object's address as its
|
| + // stack trace serial number |
| + sub.Write32(0); |
| + // class object ID |
| + sub.WriteObjectId(Isolate::Current()->class_table()->At(kSmiCid)); |
| + // number of bytes that follow |
| + sub.Write32(0); |
| +} |
| + |
| // INSTANCE DUMP - 0x21 |
| // |
| // Format: |
| @@ -576,6 +602,7 @@ |
| // u4 - number of bytes that follow |
| // [value]* - instance field values (this class, followed by super class, etc) |
| void HeapProfiler::WriteInstanceDump(const RawObject* raw_obj) { |
| + ASSERT(raw_obj->IsHeapObject()); |
| SubRecord sub(kInstanceDump, this); |
| // object ID |
| sub.WriteObjectId(raw_obj); |