OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 |
(...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
542 void set_retained_size(int value) { retained_size_ = value; } | 542 void set_retained_size(int value) { retained_size_ = value; } |
543 int ordered_index() { return ordered_index_; } | 543 int ordered_index() { return ordered_index_; } |
544 void set_ordered_index(int value) { ordered_index_ = value; } | 544 void set_ordered_index(int value) { ordered_index_ = value; } |
545 | 545 |
546 Vector<HeapGraphEdge> children() { | 546 Vector<HeapGraphEdge> children() { |
547 return Vector<HeapGraphEdge>(children_arr(), children_count_); } | 547 return Vector<HeapGraphEdge>(children_arr(), children_count_); } |
548 Vector<HeapGraphEdge*> retainers() { | 548 Vector<HeapGraphEdge*> retainers() { |
549 return Vector<HeapGraphEdge*>(retainers_arr(), retainers_count_); } | 549 return Vector<HeapGraphEdge*>(retainers_arr(), retainers_count_); } |
550 List<HeapGraphPath*>* GetRetainingPaths(); | 550 List<HeapGraphPath*>* GetRetainingPaths(); |
551 HeapEntry* dominator() { return dominator_; } | 551 HeapEntry* dominator() { return dominator_; } |
552 void set_dominator(HeapEntry* entry) { dominator_ = entry; } | 552 void set_dominator(HeapEntry* entry) { |
| 553 ASSERT(entry != NULL); |
| 554 dominator_ = entry; |
| 555 } |
553 | 556 |
554 void clear_paint() { painted_ = kUnpainted; } | 557 void clear_paint() { painted_ = kUnpainted; } |
555 bool painted_reachable() { return painted_ == kPainted; } | 558 bool painted_reachable() { return painted_ == kPainted; } |
556 void paint_reachable() { | 559 void paint_reachable() { |
557 ASSERT(painted_ == kUnpainted); | 560 ASSERT(painted_ == kUnpainted); |
558 painted_ = kPainted; | 561 painted_ = kPainted; |
559 } | 562 } |
560 bool not_painted_reachable_from_others() { | 563 bool not_painted_reachable_from_others() { |
561 return painted_ != kPaintedReachableFromOthers; | 564 return painted_ != kPaintedReachableFromOthers; |
562 } | 565 } |
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
994 | 997 |
995 // An implementation of V8 heap graph extractor. | 998 // An implementation of V8 heap graph extractor. |
996 class V8HeapExplorer : public HeapEntriesAllocator { | 999 class V8HeapExplorer : public HeapEntriesAllocator { |
997 public: | 1000 public: |
998 V8HeapExplorer(HeapSnapshot* snapshot, | 1001 V8HeapExplorer(HeapSnapshot* snapshot, |
999 SnapshottingProgressReportingInterface* progress); | 1002 SnapshottingProgressReportingInterface* progress); |
1000 virtual ~V8HeapExplorer(); | 1003 virtual ~V8HeapExplorer(); |
1001 virtual HeapEntry* AllocateEntry( | 1004 virtual HeapEntry* AllocateEntry( |
1002 HeapThing ptr, int children_count, int retainers_count); | 1005 HeapThing ptr, int children_count, int retainers_count); |
1003 void AddRootEntries(SnapshotFillerInterface* filler); | 1006 void AddRootEntries(SnapshotFillerInterface* filler); |
1004 int EstimateObjectsCount(); | 1007 int EstimateObjectsCount(HeapIterator* iterator); |
1005 bool IterateAndExtractReferences(SnapshotFillerInterface* filler); | 1008 bool IterateAndExtractReferences(HeapIterator* iterator, |
| 1009 SnapshotFillerInterface* filler); |
1006 | 1010 |
1007 static HeapObject* const kInternalRootObject; | 1011 static HeapObject* const kInternalRootObject; |
1008 | 1012 |
1009 private: | 1013 private: |
1010 HeapEntry* AddEntry( | 1014 HeapEntry* AddEntry( |
1011 HeapObject* object, int children_count, int retainers_count); | 1015 HeapObject* object, int children_count, int retainers_count); |
1012 HeapEntry* AddEntry(HeapObject* object, | 1016 HeapEntry* AddEntry(HeapObject* object, |
1013 HeapEntry::Type type, | 1017 HeapEntry::Type type, |
1014 const char* name, | 1018 const char* name, |
1015 int children_count, | 1019 int children_count, |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1121 class HeapSnapshotGenerator : public SnapshottingProgressReportingInterface { | 1125 class HeapSnapshotGenerator : public SnapshottingProgressReportingInterface { |
1122 public: | 1126 public: |
1123 HeapSnapshotGenerator(HeapSnapshot* snapshot, | 1127 HeapSnapshotGenerator(HeapSnapshot* snapshot, |
1124 v8::ActivityControl* control); | 1128 v8::ActivityControl* control); |
1125 bool GenerateSnapshot(); | 1129 bool GenerateSnapshot(); |
1126 | 1130 |
1127 private: | 1131 private: |
1128 bool ApproximateRetainedSizes(); | 1132 bool ApproximateRetainedSizes(); |
1129 bool BuildDominatorTree(const Vector<HeapEntry*>& entries, | 1133 bool BuildDominatorTree(const Vector<HeapEntry*>& entries, |
1130 Vector<HeapEntry*>* dominators); | 1134 Vector<HeapEntry*>* dominators); |
1131 bool CountEntriesAndReferences(); | 1135 bool CountEntriesAndReferences(HeapIterator* iterator); |
1132 bool FillReferences(); | 1136 bool FillReferences(HeapIterator* iterator); |
1133 void FillReversePostorderIndexes(Vector<HeapEntry*>* entries); | 1137 void FillReversePostorderIndexes(Vector<HeapEntry*>* entries); |
1134 void ProgressStep(); | 1138 void ProgressStep(); |
1135 bool ProgressReport(bool force = false); | 1139 bool ProgressReport(bool force = false); |
1136 bool SetEntriesDominators(); | 1140 bool SetEntriesDominators(); |
1137 void SetProgressTotal(int iterations_count); | 1141 void SetProgressTotal(HeapIterator* iterator, int iterations_count); |
1138 | 1142 |
1139 HeapSnapshot* snapshot_; | 1143 HeapSnapshot* snapshot_; |
1140 v8::ActivityControl* control_; | 1144 v8::ActivityControl* control_; |
1141 V8HeapExplorer v8_heap_explorer_; | 1145 V8HeapExplorer v8_heap_explorer_; |
1142 NativeObjectsExplorer dom_explorer_; | 1146 NativeObjectsExplorer dom_explorer_; |
1143 // Mapping from HeapThing pointers to HeapEntry* pointers. | 1147 // Mapping from HeapThing pointers to HeapEntry* pointers. |
1144 HeapEntriesMap entries_; | 1148 HeapEntriesMap entries_; |
1145 // Used during snapshot generation. | 1149 // Used during snapshot generation. |
1146 int progress_counter_; | 1150 int progress_counter_; |
1147 int progress_total_; | 1151 int progress_total_; |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1199 }; | 1203 }; |
1200 | 1204 |
1201 | 1205 |
1202 String* GetConstructorNameForHeapProfile(JSObject* object); | 1206 String* GetConstructorNameForHeapProfile(JSObject* object); |
1203 | 1207 |
1204 } } // namespace v8::internal | 1208 } } // namespace v8::internal |
1205 | 1209 |
1206 #endif // ENABLE_LOGGING_AND_PROFILING | 1210 #endif // ENABLE_LOGGING_AND_PROFILING |
1207 | 1211 |
1208 #endif // V8_PROFILE_GENERATOR_H_ | 1212 #endif // V8_PROFILE_GENERATOR_H_ |
OLD | NEW |