OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
11 // with the distribution. | 11 // with the distribution. |
(...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
543 void add_retained_size(int size) { retained_size_ += size; } | 543 void add_retained_size(int size) { retained_size_ += size; } |
544 void set_retained_size(int value) { retained_size_ = value; } | 544 void set_retained_size(int value) { retained_size_ = value; } |
545 int ordered_index() { return ordered_index_; } | 545 int ordered_index() { return ordered_index_; } |
546 void set_ordered_index(int value) { ordered_index_ = value; } | 546 void set_ordered_index(int value) { ordered_index_ = value; } |
547 | 547 |
548 Vector<HeapGraphEdge> children() { | 548 Vector<HeapGraphEdge> children() { |
549 return Vector<HeapGraphEdge>(children_arr(), children_count_); } | 549 return Vector<HeapGraphEdge>(children_arr(), children_count_); } |
550 Vector<HeapGraphEdge*> retainers() { | 550 Vector<HeapGraphEdge*> retainers() { |
551 return Vector<HeapGraphEdge*>(retainers_arr(), retainers_count_); } | 551 return Vector<HeapGraphEdge*>(retainers_arr(), retainers_count_); } |
552 HeapEntry* dominator() { return dominator_; } | 552 HeapEntry* dominator() { return dominator_; } |
553 void set_dominator(HeapEntry* entry) { dominator_ = entry; } | 553 void set_dominator(HeapEntry* entry) { |
| 554 ASSERT(entry != NULL); |
| 555 dominator_ = entry; |
| 556 } |
554 | 557 |
555 void clear_paint() { painted_ = kUnpainted; } | 558 void clear_paint() { painted_ = kUnpainted; } |
556 bool painted_reachable() { return painted_ == kPainted; } | 559 bool painted_reachable() { return painted_ == kPainted; } |
557 void paint_reachable() { | 560 void paint_reachable() { |
558 ASSERT(painted_ == kUnpainted); | 561 ASSERT(painted_ == kUnpainted); |
559 painted_ = kPainted; | 562 painted_ = kPainted; |
560 } | 563 } |
561 bool not_painted_reachable_from_others() { | 564 bool not_painted_reachable_from_others() { |
562 return painted_ != kPaintedReachableFromOthers; | 565 return painted_ != kPaintedReachableFromOthers; |
563 } | 566 } |
(...skipping 14 matching lines...) Expand all Loading... |
578 const char* name, | 581 const char* name, |
579 HeapEntry* entry, | 582 HeapEntry* entry, |
580 int retainer_index); | 583 int retainer_index); |
581 void SetUnidirElementReference(int child_index, int index, HeapEntry* entry); | 584 void SetUnidirElementReference(int child_index, int index, HeapEntry* entry); |
582 | 585 |
583 int EntrySize() { return EntriesSize(1, children_count_, retainers_count_); } | 586 int EntrySize() { return EntriesSize(1, children_count_, retainers_count_); } |
584 int RetainedSize(bool exact); | 587 int RetainedSize(bool exact); |
585 | 588 |
586 void Print(int max_depth, int indent); | 589 void Print(int max_depth, int indent); |
587 | 590 |
| 591 Handle<HeapObject> GetHeapObject(); |
| 592 |
588 static int EntriesSize(int entries_count, | 593 static int EntriesSize(int entries_count, |
589 int children_count, | 594 int children_count, |
590 int retainers_count); | 595 int retainers_count); |
591 | 596 |
592 private: | 597 private: |
593 HeapGraphEdge* children_arr() { | 598 HeapGraphEdge* children_arr() { |
594 return reinterpret_cast<HeapGraphEdge*>(this + 1); | 599 return reinterpret_cast<HeapGraphEdge*>(this + 1); |
595 } | 600 } |
596 HeapGraphEdge** retainers_arr() { | 601 HeapGraphEdge** retainers_arr() { |
597 return reinterpret_cast<HeapGraphEdge**>(children_arr() + children_count_); | 602 return reinterpret_cast<HeapGraphEdge**>(children_arr() + children_count_); |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
756 HeapSnapshot::Type type, const char* name, unsigned uid); | 761 HeapSnapshot::Type type, const char* name, unsigned uid); |
757 void SnapshotGenerationFinished(HeapSnapshot* snapshot); | 762 void SnapshotGenerationFinished(HeapSnapshot* snapshot); |
758 List<HeapSnapshot*>* snapshots() { return &snapshots_; } | 763 List<HeapSnapshot*>* snapshots() { return &snapshots_; } |
759 HeapSnapshot* GetSnapshot(unsigned uid); | 764 HeapSnapshot* GetSnapshot(unsigned uid); |
760 void RemoveSnapshot(HeapSnapshot* snapshot); | 765 void RemoveSnapshot(HeapSnapshot* snapshot); |
761 | 766 |
762 StringsStorage* names() { return &names_; } | 767 StringsStorage* names() { return &names_; } |
763 TokenEnumerator* token_enumerator() { return token_enumerator_; } | 768 TokenEnumerator* token_enumerator() { return token_enumerator_; } |
764 | 769 |
765 uint64_t GetObjectId(Address addr) { return ids_.FindObject(addr); } | 770 uint64_t GetObjectId(Address addr) { return ids_.FindObject(addr); } |
| 771 Handle<HeapObject> FindHeapObjectById(uint64_t id); |
766 void ObjectMoveEvent(Address from, Address to) { ids_.MoveObject(from, to); } | 772 void ObjectMoveEvent(Address from, Address to) { ids_.MoveObject(from, to); } |
767 | 773 |
768 private: | 774 private: |
769 INLINE(static bool HeapSnapshotsMatch(void* key1, void* key2)) { | 775 INLINE(static bool HeapSnapshotsMatch(void* key1, void* key2)) { |
770 return key1 == key2; | 776 return key1 == key2; |
771 } | 777 } |
772 | 778 |
773 bool is_tracking_objects_; // Whether tracking object moves is needed. | 779 bool is_tracking_objects_; // Whether tracking object moves is needed. |
774 List<HeapSnapshot*> snapshots_; | 780 List<HeapSnapshot*> snapshots_; |
775 // Mapping from snapshots' uids to HeapSnapshot* pointers. | 781 // Mapping from snapshots' uids to HeapSnapshot* pointers. |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
910 | 916 |
911 // An implementation of V8 heap graph extractor. | 917 // An implementation of V8 heap graph extractor. |
912 class V8HeapExplorer : public HeapEntriesAllocator { | 918 class V8HeapExplorer : public HeapEntriesAllocator { |
913 public: | 919 public: |
914 V8HeapExplorer(HeapSnapshot* snapshot, | 920 V8HeapExplorer(HeapSnapshot* snapshot, |
915 SnapshottingProgressReportingInterface* progress); | 921 SnapshottingProgressReportingInterface* progress); |
916 virtual ~V8HeapExplorer(); | 922 virtual ~V8HeapExplorer(); |
917 virtual HeapEntry* AllocateEntry( | 923 virtual HeapEntry* AllocateEntry( |
918 HeapThing ptr, int children_count, int retainers_count); | 924 HeapThing ptr, int children_count, int retainers_count); |
919 void AddRootEntries(SnapshotFillerInterface* filler); | 925 void AddRootEntries(SnapshotFillerInterface* filler); |
920 int EstimateObjectsCount(); | 926 int EstimateObjectsCount(HeapIterator* iterator); |
921 bool IterateAndExtractReferences(SnapshotFillerInterface* filler); | 927 bool IterateAndExtractReferences(SnapshotFillerInterface* filler); |
922 void TagGlobalObjects(); | 928 void TagGlobalObjects(); |
923 | 929 |
924 static String* GetConstructorName(JSObject* object); | 930 static String* GetConstructorName(JSObject* object); |
925 | 931 |
926 static HeapObject* const kInternalRootObject; | 932 static HeapObject* const kInternalRootObject; |
927 | 933 |
928 private: | 934 private: |
929 HeapEntry* AddEntry( | 935 HeapEntry* AddEntry( |
930 HeapObject* object, int children_count, int retainers_count); | 936 HeapObject* object, int children_count, int retainers_count); |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1120 | 1126 |
1121 friend class HeapSnapshotJSONSerializerEnumerator; | 1127 friend class HeapSnapshotJSONSerializerEnumerator; |
1122 friend class HeapSnapshotJSONSerializerIterator; | 1128 friend class HeapSnapshotJSONSerializerIterator; |
1123 | 1129 |
1124 DISALLOW_COPY_AND_ASSIGN(HeapSnapshotJSONSerializer); | 1130 DISALLOW_COPY_AND_ASSIGN(HeapSnapshotJSONSerializer); |
1125 }; | 1131 }; |
1126 | 1132 |
1127 } } // namespace v8::internal | 1133 } } // namespace v8::internal |
1128 | 1134 |
1129 #endif // V8_PROFILE_GENERATOR_H_ | 1135 #endif // V8_PROFILE_GENERATOR_H_ |
OLD | NEW |