Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(56)

Side by Side Diff: runtime/vm/heap_profiler.cc

Issue 11880004: - Start adding meta data for fields of VM internal classes. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 504 matching lines...) Expand 10 before | Expand all | Expand 10 after
515 RawField* raw_field = 515 RawField* raw_field =
516 reinterpret_cast<RawField*>(raw_array->ptr()->data()[i]); 516 reinterpret_cast<RawField*>(raw_array->ptr()->data()[i]);
517 if (Field::StaticBit::decode(raw_field->ptr()->kind_bits_)) { 517 if (Field::StaticBit::decode(raw_field->ptr()->kind_bits_)) {
518 ++num_static_fields; 518 ++num_static_fields;
519 } else { 519 } else {
520 ++num_instance_fields; 520 ++num_instance_fields;
521 } 521 }
522 } 522 }
523 } 523 }
524 // instance size (in bytes) 524 // instance size (in bytes)
525 // TODO(cshapiro): properly account for variable sized objects 525 intptr_t instance_size_in_words = raw_class->ptr()->instance_size_in_words_;
526 sub.Write32(raw_class->ptr()->instance_size_in_words_); 526 if (instance_size_in_words == 0) {
527 // TODO(iposva): Better accounting of variable sized VM classes.
528 instance_size_in_words = num_instance_fields;
529 }
530 sub.Write32(instance_size_in_words * kWordSize);
527 // size of constant pool and number of records that follow: 531 // size of constant pool and number of records that follow:
528 sub.Write16(0); 532 sub.Write16(0);
529 // Number of static fields 533 // Number of static fields
530 sub.Write16(num_static_fields); 534 sub.Write16(num_static_fields);
531 // Static fields: 535 // Static fields:
532 if (raw_array != Array::null()) { 536 if (raw_array != Array::null()) {
533 for (intptr_t i = 0; i < Smi::Value(raw_array->ptr()->length_); ++i) { 537 for (intptr_t i = 0; i < Smi::Value(raw_array->ptr()->length_); ++i) {
534 RawField* raw_field = 538 RawField* raw_field =
535 reinterpret_cast<RawField*>(raw_array->ptr()->data()[i]); 539 reinterpret_cast<RawField*>(raw_array->ptr()->data()[i]);
536 if (Field::StaticBit::decode(raw_field->ptr()->kind_bits_)) { 540 if (Field::StaticBit::decode(raw_field->ptr()->kind_bits_)) {
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
715 RawObject* raw_obj = handle->raw(); 719 RawObject* raw_obj = handle->raw();
716 visitor_->VisitPointer(&raw_obj); 720 visitor_->VisitPointer(&raw_obj);
717 } 721 }
718 722
719 723
720 void HeapProfilerObjectVisitor::VisitObject(RawObject* raw_obj) { 724 void HeapProfilerObjectVisitor::VisitObject(RawObject* raw_obj) {
721 profiler_->WriteObject(raw_obj); 725 profiler_->WriteObject(raw_obj);
722 } 726 }
723 727
724 } // namespace dart 728 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/dart.cc ('k') | runtime/vm/object.h » ('j') | runtime/vm/object.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698