| 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 623 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 634 class HeapSnapshotsCollection; | 634 class HeapSnapshotsCollection; |
| 635 | 635 |
| 636 // HeapSnapshot represents a single heap snapshot. It is stored in | 636 // HeapSnapshot represents a single heap snapshot. It is stored in |
| 637 // HeapSnapshotsCollection, which is also a factory for | 637 // HeapSnapshotsCollection, which is also a factory for |
| 638 // HeapSnapshots. All HeapSnapshots share strings copied from JS heap | 638 // HeapSnapshots. All HeapSnapshots share strings copied from JS heap |
| 639 // to be able to return them even if they were collected. | 639 // to be able to return them even if they were collected. |
| 640 // HeapSnapshotGenerator fills in a HeapSnapshot. | 640 // HeapSnapshotGenerator fills in a HeapSnapshot. |
| 641 class HeapSnapshot { | 641 class HeapSnapshot { |
| 642 public: | 642 public: |
| 643 enum Type { | 643 enum Type { |
| 644 kFull = v8::HeapSnapshot::kFull, | 644 kFull = v8::HeapSnapshot::kFull |
| 645 kAggregated = v8::HeapSnapshot::kAggregated | |
| 646 }; | 645 }; |
| 647 | 646 |
| 648 HeapSnapshot(HeapSnapshotsCollection* collection, | 647 HeapSnapshot(HeapSnapshotsCollection* collection, |
| 649 Type type, | 648 Type type, |
| 650 const char* title, | 649 const char* title, |
| 651 unsigned uid); | 650 unsigned uid); |
| 652 ~HeapSnapshot(); | 651 ~HeapSnapshot(); |
| 653 void Delete(); | 652 void Delete(); |
| 654 | 653 |
| 655 HeapSnapshotsCollection* collection() { return collection_; } | 654 HeapSnapshotsCollection* collection() { return collection_; } |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 855 DISALLOW_COPY_AND_ASSIGN(HeapEntriesMap); | 854 DISALLOW_COPY_AND_ASSIGN(HeapEntriesMap); |
| 856 }; | 855 }; |
| 857 | 856 |
| 858 | 857 |
| 859 class HeapObjectsSet { | 858 class HeapObjectsSet { |
| 860 public: | 859 public: |
| 861 HeapObjectsSet(); | 860 HeapObjectsSet(); |
| 862 void Clear(); | 861 void Clear(); |
| 863 bool Contains(Object* object); | 862 bool Contains(Object* object); |
| 864 void Insert(Object* obj); | 863 void Insert(Object* obj); |
| 864 const char* GetTag(Object* obj); |
| 865 void SetTag(Object* obj, const char* tag); |
| 865 | 866 |
| 866 private: | 867 private: |
| 867 HashMap entries_; | 868 HashMap entries_; |
| 868 | 869 |
| 869 DISALLOW_COPY_AND_ASSIGN(HeapObjectsSet); | 870 DISALLOW_COPY_AND_ASSIGN(HeapObjectsSet); |
| 870 }; | 871 }; |
| 871 | 872 |
| 872 | 873 |
| 873 // An interface used to populate a snapshot with nodes and edges. | 874 // An interface used to populate a snapshot with nodes and edges. |
| 874 class SnapshotFillerInterface { | 875 class SnapshotFillerInterface { |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 917 public: | 918 public: |
| 918 V8HeapExplorer(HeapSnapshot* snapshot, | 919 V8HeapExplorer(HeapSnapshot* snapshot, |
| 919 SnapshottingProgressReportingInterface* progress); | 920 SnapshottingProgressReportingInterface* progress); |
| 920 virtual ~V8HeapExplorer(); | 921 virtual ~V8HeapExplorer(); |
| 921 virtual HeapEntry* AllocateEntry( | 922 virtual HeapEntry* AllocateEntry( |
| 922 HeapThing ptr, int children_count, int retainers_count); | 923 HeapThing ptr, int children_count, int retainers_count); |
| 923 void AddRootEntries(SnapshotFillerInterface* filler); | 924 void AddRootEntries(SnapshotFillerInterface* filler); |
| 924 int EstimateObjectsCount(HeapIterator* iterator); | 925 int EstimateObjectsCount(HeapIterator* iterator); |
| 925 bool IterateAndExtractReferences(HeapIterator* iterator, | 926 bool IterateAndExtractReferences(HeapIterator* iterator, |
| 926 SnapshotFillerInterface* filler); | 927 SnapshotFillerInterface* filler); |
| 928 void TagGlobalObjects(); |
| 927 | 929 |
| 928 static HeapObject* const kInternalRootObject; | 930 static HeapObject* const kInternalRootObject; |
| 929 | 931 |
| 930 private: | 932 private: |
| 931 HeapEntry* AddEntry( | 933 HeapEntry* AddEntry( |
| 932 HeapObject* object, int children_count, int retainers_count); | 934 HeapObject* object, int children_count, int retainers_count); |
| 933 HeapEntry* AddEntry(HeapObject* object, | 935 HeapEntry* AddEntry(HeapObject* object, |
| 934 HeapEntry::Type type, | 936 HeapEntry::Type type, |
| 935 const char* name, | 937 const char* name, |
| 936 int children_count, | 938 int children_count, |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 968 String* reference_name, | 970 String* reference_name, |
| 969 Object* child, | 971 Object* child, |
| 970 int field_offset = -1); | 972 int field_offset = -1); |
| 971 void SetPropertyShortcutReference(HeapObject* parent_obj, | 973 void SetPropertyShortcutReference(HeapObject* parent_obj, |
| 972 HeapEntry* parent, | 974 HeapEntry* parent, |
| 973 String* reference_name, | 975 String* reference_name, |
| 974 Object* child); | 976 Object* child); |
| 975 void SetRootShortcutReference(Object* child); | 977 void SetRootShortcutReference(Object* child); |
| 976 void SetRootGcRootsReference(); | 978 void SetRootGcRootsReference(); |
| 977 void SetGcRootsReference(Object* child); | 979 void SetGcRootsReference(Object* child); |
| 980 void TagObject(Object* obj, const char* tag); |
| 978 | 981 |
| 979 HeapEntry* GetEntry(Object* obj); | 982 HeapEntry* GetEntry(Object* obj); |
| 980 | 983 |
| 984 Heap* heap_; |
| 981 HeapSnapshot* snapshot_; | 985 HeapSnapshot* snapshot_; |
| 982 HeapSnapshotsCollection* collection_; | 986 HeapSnapshotsCollection* collection_; |
| 983 SnapshottingProgressReportingInterface* progress_; | 987 SnapshottingProgressReportingInterface* progress_; |
| 984 SnapshotFillerInterface* filler_; | 988 SnapshotFillerInterface* filler_; |
| 989 HeapObjectsSet objects_tags_; |
| 985 | 990 |
| 986 static HeapObject* const kGcRootsObject; | 991 static HeapObject* const kGcRootsObject; |
| 987 | 992 |
| 988 friend class IndexedReferencesExtractor; | 993 friend class IndexedReferencesExtractor; |
| 989 friend class RootsReferencesExtractor; | 994 friend class RootsReferencesExtractor; |
| 990 | 995 |
| 991 DISALLOW_COPY_AND_ASSIGN(V8HeapExplorer); | 996 DISALLOW_COPY_AND_ASSIGN(V8HeapExplorer); |
| 992 }; | 997 }; |
| 993 | 998 |
| 994 | 999 |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1121 }; | 1126 }; |
| 1122 | 1127 |
| 1123 | 1128 |
| 1124 String* GetConstructorNameForHeapProfile(JSObject* object); | 1129 String* GetConstructorNameForHeapProfile(JSObject* object); |
| 1125 | 1130 |
| 1126 } } // namespace v8::internal | 1131 } } // namespace v8::internal |
| 1127 | 1132 |
| 1128 #endif // ENABLE_LOGGING_AND_PROFILING | 1133 #endif // ENABLE_LOGGING_AND_PROFILING |
| 1129 | 1134 |
| 1130 #endif // V8_PROFILE_GENERATOR_H_ | 1135 #endif // V8_PROFILE_GENERATOR_H_ |
| OLD | NEW |