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 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 break; | 245 break; |
246 } | 246 } |
247 WriteClassDump(raw_class); | 247 WriteClassDump(raw_class); |
248 break; | 248 break; |
249 } | 249 } |
250 case kArrayCid: | 250 case kArrayCid: |
251 case kImmutableArrayCid: { | 251 case kImmutableArrayCid: { |
252 WriteObjectArrayDump(reinterpret_cast<const RawArray*>(raw_obj)); | 252 WriteObjectArrayDump(reinterpret_cast<const RawArray*>(raw_obj)); |
253 break; | 253 break; |
254 } | 254 } |
255 case kInt8ArrayCid: | 255 case kTypedDataInt8ArrayCid: |
256 case kUint8ArrayCid: | 256 case kTypedDataUint8ArrayCid: |
257 case kUint8ClampedArrayCid: { | 257 case kTypedDataUint8ClampedArrayCid: { |
258 const RawInt8Array* raw_int8_array = | 258 const RawTypedData* raw_int8_array = |
259 reinterpret_cast<const RawInt8Array*>(raw_obj); | 259 reinterpret_cast<const RawTypedData*>(raw_obj); |
260 WritePrimitiveArrayDump(raw_int8_array, | 260 WritePrimitiveArrayDump(raw_int8_array, |
261 kByte, | 261 kByte, |
262 &raw_int8_array->data_[0]); | 262 &raw_int8_array->data_[0]); |
263 break; | 263 break; |
264 } | 264 } |
265 case kInt16ArrayCid: | 265 case kTypedDataInt16ArrayCid: |
266 case kUint16ArrayCid: { | 266 case kTypedDataUint16ArrayCid: { |
267 const RawInt16Array* raw_int16_array = | 267 const RawTypedData* raw_int16_array = |
268 reinterpret_cast<const RawInt16Array*>(raw_obj); | 268 reinterpret_cast<const RawTypedData*>(raw_obj); |
269 WritePrimitiveArrayDump(raw_int16_array, | 269 WritePrimitiveArrayDump(raw_int16_array, |
270 kShort, | 270 kShort, |
271 &raw_int16_array->data_[0]); | 271 &raw_int16_array->data_[0]); |
272 break; | 272 break; |
273 } | 273 } |
274 case kInt32ArrayCid: | 274 case kTypedDataInt32ArrayCid: |
275 case kUint32ArrayCid: { | 275 case kTypedDataUint32ArrayCid: { |
276 const RawInt32Array* raw_int32_array = | 276 const RawTypedData* raw_int32_array = |
277 reinterpret_cast<const RawInt32Array*>(raw_obj); | 277 reinterpret_cast<const RawTypedData*>(raw_obj); |
278 WritePrimitiveArrayDump(raw_int32_array, | 278 WritePrimitiveArrayDump(raw_int32_array, |
279 kInt, | 279 kInt, |
280 &raw_int32_array->data_[0]); | 280 &raw_int32_array->data_[0]); |
281 break; | 281 break; |
282 } | 282 } |
283 case kInt64ArrayCid: | 283 case kTypedDataInt64ArrayCid: |
284 case kUint64ArrayCid: { | 284 case kTypedDataUint64ArrayCid: { |
285 const RawInt64Array* raw_int64_array = | 285 const RawTypedData* raw_int64_array = |
286 reinterpret_cast<const RawInt64Array*>(raw_obj); | 286 reinterpret_cast<const RawTypedData*>(raw_obj); |
287 WritePrimitiveArrayDump(raw_int64_array, | 287 WritePrimitiveArrayDump(raw_int64_array, |
288 kLong, | 288 kLong, |
289 &raw_int64_array->data_[0]); | 289 &raw_int64_array->data_[0]); |
290 break; | 290 break; |
291 } | 291 } |
292 case kFloat32ArrayCid: { | 292 case kTypedDataFloat32ArrayCid: { |
293 const RawFloat32Array* raw_float32_array = | 293 const RawTypedData* raw_float32_array = |
294 reinterpret_cast<const RawFloat32Array*>(raw_obj); | 294 reinterpret_cast<const RawTypedData*>(raw_obj); |
295 WritePrimitiveArrayDump(raw_float32_array, | 295 WritePrimitiveArrayDump(raw_float32_array, |
296 kFloat, | 296 kFloat, |
297 &raw_float32_array->data_[0]); | 297 &raw_float32_array->data_[0]); |
298 break; | 298 break; |
299 } | 299 } |
300 case kFloat64ArrayCid: { | 300 case kTypedDataFloat64ArrayCid: { |
301 const RawFloat64Array* raw_float64_array = | 301 const RawTypedData* raw_float64_array = |
302 reinterpret_cast<const RawFloat64Array*>(raw_obj); | 302 reinterpret_cast<const RawTypedData*>(raw_obj); |
303 WritePrimitiveArrayDump(raw_float64_array, | 303 WritePrimitiveArrayDump(raw_float64_array, |
304 kDouble, | 304 kDouble, |
305 &raw_float64_array->data_[0]); | 305 &raw_float64_array->data_[0]); |
306 break; | 306 break; |
307 } | 307 } |
308 case kOneByteStringCid: | 308 case kOneByteStringCid: |
309 case kTwoByteStringCid: | 309 case kTwoByteStringCid: |
310 case kExternalOneByteStringCid: | 310 case kExternalOneByteStringCid: |
311 case kExternalTwoByteStringCid: { | 311 case kExternalTwoByteStringCid: { |
312 WriteInstanceDump(StringId(reinterpret_cast<const RawString*>(raw_obj))); | 312 WriteInstanceDump(StringId(reinterpret_cast<const RawString*>(raw_obj))); |
(...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
742 | 742 |
743 | 743 |
744 // PRIMITIVE ARRAY DUMP - 0x23 | 744 // PRIMITIVE ARRAY DUMP - 0x23 |
745 // | 745 // |
746 // Format: | 746 // Format: |
747 // ID - array object ID | 747 // ID - array object ID |
748 // u4 - stack trace serial number | 748 // u4 - stack trace serial number |
749 // u4 - number of elements | 749 // u4 - number of elements |
750 // u1 - element type | 750 // u1 - element type |
751 // [u1]* - elements | 751 // [u1]* - elements |
752 void HeapProfiler::WritePrimitiveArrayDump(const RawByteArray* raw_byte_array, | 752 void HeapProfiler::WritePrimitiveArrayDump(const RawTypedData* raw_byte_array, |
753 uint8_t tag, | 753 uint8_t tag, |
754 const void* data) { | 754 const void* data) { |
755 SubRecord sub(kPrimitiveArrayDump, this); | 755 SubRecord sub(kPrimitiveArrayDump, this); |
756 // array object ID | 756 // array object ID |
757 sub.WriteObjectId(raw_byte_array); | 757 sub.WriteObjectId(raw_byte_array); |
758 // stack trace serial number | 758 // stack trace serial number |
759 sub.Write32(0); | 759 sub.Write32(0); |
760 // number of elements | 760 // number of elements |
761 intptr_t length = Smi::Value(raw_byte_array->ptr()->length_); | 761 intptr_t length = Smi::Value(raw_byte_array->ptr()->length_); |
762 sub.Write32(length); | 762 sub.Write32(length); |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
807 RawObject* raw_obj = handle->raw(); | 807 RawObject* raw_obj = handle->raw(); |
808 visitor_->VisitPointer(&raw_obj); | 808 visitor_->VisitPointer(&raw_obj); |
809 } | 809 } |
810 | 810 |
811 | 811 |
812 void HeapProfilerObjectVisitor::VisitObject(RawObject* raw_obj) { | 812 void HeapProfilerObjectVisitor::VisitObject(RawObject* raw_obj) { |
813 profiler_->WriteObject(raw_obj); | 813 profiler_->WriteObject(raw_obj); |
814 } | 814 } |
815 | 815 |
816 } // namespace dart | 816 } // namespace dart |
OLD | NEW |