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 1008 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1019 static HeapObject* const kFirstGcSubrootObject; | 1019 static HeapObject* const kFirstGcSubrootObject; |
1020 static HeapObject* const kLastGcSubrootObject; | 1020 static HeapObject* const kLastGcSubrootObject; |
1021 | 1021 |
1022 friend class IndexedReferencesExtractor; | 1022 friend class IndexedReferencesExtractor; |
1023 friend class GcSubrootsEnumerator; | 1023 friend class GcSubrootsEnumerator; |
1024 friend class RootsReferencesExtractor; | 1024 friend class RootsReferencesExtractor; |
1025 | 1025 |
1026 DISALLOW_COPY_AND_ASSIGN(V8HeapExplorer); | 1026 DISALLOW_COPY_AND_ASSIGN(V8HeapExplorer); |
1027 }; | 1027 }; |
1028 | 1028 |
| 1029 class NativeGroupRetainedObjectInfo; |
1029 | 1030 |
1030 // An implementation of retained native objects extractor. | 1031 // An implementation of retained native objects extractor. |
1031 class NativeObjectsExplorer : public HeapEntriesAllocator { | 1032 class NativeObjectsExplorer : public HeapEntriesAllocator { |
1032 public: | 1033 public: |
1033 NativeObjectsExplorer(HeapSnapshot* snapshot, | 1034 NativeObjectsExplorer(HeapSnapshot* snapshot, |
1034 SnapshottingProgressReportingInterface* progress); | 1035 SnapshottingProgressReportingInterface* progress); |
1035 virtual ~NativeObjectsExplorer(); | 1036 virtual ~NativeObjectsExplorer(); |
1036 virtual HeapEntry* AllocateEntry( | 1037 virtual HeapEntry* AllocateEntry( |
1037 HeapThing ptr, int children_count, int retainers_count); | 1038 HeapThing ptr, int children_count, int retainers_count); |
1038 void AddRootEntries(SnapshotFillerInterface* filler); | 1039 void AddRootEntries(SnapshotFillerInterface* filler); |
(...skipping 11 matching lines...) Expand all Loading... |
1050 | 1051 |
1051 static uint32_t InfoHash(v8::RetainedObjectInfo* info) { | 1052 static uint32_t InfoHash(v8::RetainedObjectInfo* info) { |
1052 return ComputeIntegerHash(static_cast<uint32_t>(info->GetHash()), | 1053 return ComputeIntegerHash(static_cast<uint32_t>(info->GetHash()), |
1053 v8::internal::kZeroHashSeed); | 1054 v8::internal::kZeroHashSeed); |
1054 } | 1055 } |
1055 static bool RetainedInfosMatch(void* key1, void* key2) { | 1056 static bool RetainedInfosMatch(void* key1, void* key2) { |
1056 return key1 == key2 || | 1057 return key1 == key2 || |
1057 (reinterpret_cast<v8::RetainedObjectInfo*>(key1))->IsEquivalent( | 1058 (reinterpret_cast<v8::RetainedObjectInfo*>(key1))->IsEquivalent( |
1058 reinterpret_cast<v8::RetainedObjectInfo*>(key2)); | 1059 reinterpret_cast<v8::RetainedObjectInfo*>(key2)); |
1059 } | 1060 } |
| 1061 INLINE(static bool StringsMatch(void* key1, void* key2)) { |
| 1062 return strcmp(reinterpret_cast<char*>(key1), |
| 1063 reinterpret_cast<char*>(key2)) == 0; |
| 1064 } |
| 1065 |
| 1066 NativeGroupRetainedObjectInfo* FindOrAddGroupInfo(const char* label); |
1060 | 1067 |
1061 HeapSnapshot* snapshot_; | 1068 HeapSnapshot* snapshot_; |
1062 HeapSnapshotsCollection* collection_; | 1069 HeapSnapshotsCollection* collection_; |
1063 SnapshottingProgressReportingInterface* progress_; | 1070 SnapshottingProgressReportingInterface* progress_; |
1064 bool embedder_queried_; | 1071 bool embedder_queried_; |
1065 HeapObjectsSet in_groups_; | 1072 HeapObjectsSet in_groups_; |
1066 // RetainedObjectInfo* -> List<HeapObject*>* | 1073 // RetainedObjectInfo* -> List<HeapObject*>* |
1067 HashMap objects_by_info_; | 1074 HashMap objects_by_info_; |
| 1075 HashMap native_groups_; |
1068 // Used during references extraction. | 1076 // Used during references extraction. |
1069 SnapshotFillerInterface* filler_; | 1077 SnapshotFillerInterface* filler_; |
1070 | 1078 |
1071 static HeapThing const kNativesRootObject; | 1079 static HeapThing const kNativesRootObject; |
1072 | 1080 |
1073 friend class GlobalHandlesExtractor; | 1081 friend class GlobalHandlesExtractor; |
1074 | 1082 |
1075 DISALLOW_COPY_AND_ASSIGN(NativeObjectsExplorer); | 1083 DISALLOW_COPY_AND_ASSIGN(NativeObjectsExplorer); |
1076 }; | 1084 }; |
1077 | 1085 |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1156 | 1164 |
1157 friend class HeapSnapshotJSONSerializerEnumerator; | 1165 friend class HeapSnapshotJSONSerializerEnumerator; |
1158 friend class HeapSnapshotJSONSerializerIterator; | 1166 friend class HeapSnapshotJSONSerializerIterator; |
1159 | 1167 |
1160 DISALLOW_COPY_AND_ASSIGN(HeapSnapshotJSONSerializer); | 1168 DISALLOW_COPY_AND_ASSIGN(HeapSnapshotJSONSerializer); |
1161 }; | 1169 }; |
1162 | 1170 |
1163 } } // namespace v8::internal | 1171 } } // namespace v8::internal |
1164 | 1172 |
1165 #endif // V8_PROFILE_GENERATOR_H_ | 1173 #endif // V8_PROFILE_GENERATOR_H_ |
OLD | NEW |