OLD | NEW |
1 // Copyright 2011 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 |
(...skipping 833 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
844 virtual ~SnapshottingProgressReportingInterface() { } | 844 virtual ~SnapshottingProgressReportingInterface() { } |
845 virtual void ProgressStep() = 0; | 845 virtual void ProgressStep() = 0; |
846 virtual bool ProgressReport(bool force) = 0; | 846 virtual bool ProgressReport(bool force) = 0; |
847 }; | 847 }; |
848 | 848 |
849 | 849 |
850 // An implementation of V8 heap graph extractor. | 850 // An implementation of V8 heap graph extractor. |
851 class V8HeapExplorer : public HeapEntriesAllocator { | 851 class V8HeapExplorer : public HeapEntriesAllocator { |
852 public: | 852 public: |
853 V8HeapExplorer(HeapSnapshot* snapshot, | 853 V8HeapExplorer(HeapSnapshot* snapshot, |
854 SnapshottingProgressReportingInterface* progress); | 854 SnapshottingProgressReportingInterface* progress, |
| 855 v8::HeapProfiler::ObjectNameResolver* resolver); |
855 virtual ~V8HeapExplorer(); | 856 virtual ~V8HeapExplorer(); |
856 virtual HeapEntry* AllocateEntry(HeapThing ptr); | 857 virtual HeapEntry* AllocateEntry(HeapThing ptr); |
857 void AddRootEntries(SnapshotFillerInterface* filler); | 858 void AddRootEntries(SnapshotFillerInterface* filler); |
858 int EstimateObjectsCount(HeapIterator* iterator); | 859 int EstimateObjectsCount(HeapIterator* iterator); |
859 bool IterateAndExtractReferences(SnapshotFillerInterface* filler); | 860 bool IterateAndExtractReferences(SnapshotFillerInterface* filler); |
860 void TagGlobalObjects(); | 861 void TagGlobalObjects(); |
861 | 862 |
862 static String* GetConstructorName(JSObject* object); | 863 static String* GetConstructorName(JSObject* object); |
863 | 864 |
864 static HeapObject* const kInternalRootObject; | 865 static HeapObject* const kInternalRootObject; |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
938 static inline HeapObject* GetNthGcSubrootObject(int delta); | 939 static inline HeapObject* GetNthGcSubrootObject(int delta); |
939 static inline int GetGcSubrootOrder(HeapObject* subroot); | 940 static inline int GetGcSubrootOrder(HeapObject* subroot); |
940 | 941 |
941 Heap* heap_; | 942 Heap* heap_; |
942 HeapSnapshot* snapshot_; | 943 HeapSnapshot* snapshot_; |
943 HeapSnapshotsCollection* collection_; | 944 HeapSnapshotsCollection* collection_; |
944 SnapshottingProgressReportingInterface* progress_; | 945 SnapshottingProgressReportingInterface* progress_; |
945 SnapshotFillerInterface* filler_; | 946 SnapshotFillerInterface* filler_; |
946 HeapObjectsSet objects_tags_; | 947 HeapObjectsSet objects_tags_; |
947 HeapObjectsSet strong_gc_subroot_names_; | 948 HeapObjectsSet strong_gc_subroot_names_; |
| 949 v8::HeapProfiler::ObjectNameResolver* global_object_name_resolver_; |
948 | 950 |
949 static HeapObject* const kGcRootsObject; | 951 static HeapObject* const kGcRootsObject; |
950 static HeapObject* const kFirstGcSubrootObject; | 952 static HeapObject* const kFirstGcSubrootObject; |
951 static HeapObject* const kLastGcSubrootObject; | 953 static HeapObject* const kLastGcSubrootObject; |
952 | 954 |
953 friend class IndexedReferencesExtractor; | 955 friend class IndexedReferencesExtractor; |
954 friend class GcSubrootsEnumerator; | 956 friend class GcSubrootsEnumerator; |
955 friend class RootsReferencesExtractor; | 957 friend class RootsReferencesExtractor; |
956 | 958 |
957 DISALLOW_COPY_AND_ASSIGN(V8HeapExplorer); | 959 DISALLOW_COPY_AND_ASSIGN(V8HeapExplorer); |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1014 | 1016 |
1015 friend class GlobalHandlesExtractor; | 1017 friend class GlobalHandlesExtractor; |
1016 | 1018 |
1017 DISALLOW_COPY_AND_ASSIGN(NativeObjectsExplorer); | 1019 DISALLOW_COPY_AND_ASSIGN(NativeObjectsExplorer); |
1018 }; | 1020 }; |
1019 | 1021 |
1020 | 1022 |
1021 class HeapSnapshotGenerator : public SnapshottingProgressReportingInterface { | 1023 class HeapSnapshotGenerator : public SnapshottingProgressReportingInterface { |
1022 public: | 1024 public: |
1023 HeapSnapshotGenerator(HeapSnapshot* snapshot, | 1025 HeapSnapshotGenerator(HeapSnapshot* snapshot, |
1024 v8::ActivityControl* control); | 1026 v8::ActivityControl* control, |
| 1027 v8::HeapProfiler::ObjectNameResolver* resolver); |
1025 bool GenerateSnapshot(); | 1028 bool GenerateSnapshot(); |
1026 | 1029 |
1027 private: | 1030 private: |
1028 bool FillReferences(); | 1031 bool FillReferences(); |
1029 void ProgressStep(); | 1032 void ProgressStep(); |
1030 bool ProgressReport(bool force = false); | 1033 bool ProgressReport(bool force = false); |
1031 void SetProgressTotal(int iterations_count); | 1034 void SetProgressTotal(int iterations_count); |
1032 | 1035 |
1033 HeapSnapshot* snapshot_; | 1036 HeapSnapshot* snapshot_; |
1034 v8::ActivityControl* control_; | 1037 v8::ActivityControl* control_; |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1091 | 1094 |
1092 friend class HeapSnapshotJSONSerializerEnumerator; | 1095 friend class HeapSnapshotJSONSerializerEnumerator; |
1093 friend class HeapSnapshotJSONSerializerIterator; | 1096 friend class HeapSnapshotJSONSerializerIterator; |
1094 | 1097 |
1095 DISALLOW_COPY_AND_ASSIGN(HeapSnapshotJSONSerializer); | 1098 DISALLOW_COPY_AND_ASSIGN(HeapSnapshotJSONSerializer); |
1096 }; | 1099 }; |
1097 | 1100 |
1098 } } // namespace v8::internal | 1101 } } // namespace v8::internal |
1099 | 1102 |
1100 #endif // V8_PROFILE_GENERATOR_H_ | 1103 #endif // V8_PROFILE_GENERATOR_H_ |
OLD | NEW |