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 507 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
518 public: | 518 public: |
519 enum Type { | 519 enum Type { |
520 kHidden = v8::HeapGraphNode::kHidden, | 520 kHidden = v8::HeapGraphNode::kHidden, |
521 kArray = v8::HeapGraphNode::kArray, | 521 kArray = v8::HeapGraphNode::kArray, |
522 kString = v8::HeapGraphNode::kString, | 522 kString = v8::HeapGraphNode::kString, |
523 kObject = v8::HeapGraphNode::kObject, | 523 kObject = v8::HeapGraphNode::kObject, |
524 kCode = v8::HeapGraphNode::kCode, | 524 kCode = v8::HeapGraphNode::kCode, |
525 kClosure = v8::HeapGraphNode::kClosure, | 525 kClosure = v8::HeapGraphNode::kClosure, |
526 kRegExp = v8::HeapGraphNode::kRegExp, | 526 kRegExp = v8::HeapGraphNode::kRegExp, |
527 kHeapNumber = v8::HeapGraphNode::kHeapNumber, | 527 kHeapNumber = v8::HeapGraphNode::kHeapNumber, |
528 kNative = v8::HeapGraphNode::kNative | 528 kNative = v8::HeapGraphNode::kNative, |
529 kArtificial = v8::HeapGraphNode::kArtificial | |
529 }; | 530 }; |
530 | 531 |
531 HeapEntry() { } | 532 HeapEntry() { } |
532 void Init(HeapSnapshot* snapshot, | 533 void Init(HeapSnapshot* snapshot, |
533 Type type, | 534 Type type, |
534 const char* name, | 535 const char* name, |
535 uint64_t id, | 536 uint64_t id, |
536 int self_size, | 537 int self_size, |
537 int children_count, | 538 int children_count, |
538 int retainers_count); | 539 int retainers_count); |
(...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1019 static HeapObject* const kFirstGcSubrootObject; | 1020 static HeapObject* const kFirstGcSubrootObject; |
1020 static HeapObject* const kLastGcSubrootObject; | 1021 static HeapObject* const kLastGcSubrootObject; |
1021 | 1022 |
1022 friend class IndexedReferencesExtractor; | 1023 friend class IndexedReferencesExtractor; |
1023 friend class GcSubrootsEnumerator; | 1024 friend class GcSubrootsEnumerator; |
1024 friend class RootsReferencesExtractor; | 1025 friend class RootsReferencesExtractor; |
1025 | 1026 |
1026 DISALLOW_COPY_AND_ASSIGN(V8HeapExplorer); | 1027 DISALLOW_COPY_AND_ASSIGN(V8HeapExplorer); |
1027 }; | 1028 }; |
1028 | 1029 |
1030 | |
1029 class NativeGroupRetainedObjectInfo; | 1031 class NativeGroupRetainedObjectInfo; |
1030 | 1032 |
1033 | |
1031 // An implementation of retained native objects extractor. | 1034 // An implementation of retained native objects extractor. |
1032 class NativeObjectsExplorer : public HeapEntriesAllocator { | 1035 class NativeObjectsExplorer { |
1033 public: | 1036 public: |
1034 NativeObjectsExplorer(HeapSnapshot* snapshot, | 1037 NativeObjectsExplorer(HeapSnapshot* snapshot, |
1035 SnapshottingProgressReportingInterface* progress); | 1038 SnapshottingProgressReportingInterface* progress); |
1036 virtual ~NativeObjectsExplorer(); | 1039 virtual ~NativeObjectsExplorer(); |
1037 virtual HeapEntry* AllocateEntry( | |
1038 HeapThing ptr, int children_count, int retainers_count); | |
1039 void AddRootEntries(SnapshotFillerInterface* filler); | 1040 void AddRootEntries(SnapshotFillerInterface* filler); |
1040 int EstimateObjectsCount(); | 1041 int EstimateObjectsCount(); |
1041 bool IterateAndExtractReferences(SnapshotFillerInterface* filler); | 1042 bool IterateAndExtractReferences(SnapshotFillerInterface* filler); |
1042 | 1043 |
1043 private: | 1044 private: |
1044 void FillRetainedObjects(); | 1045 void FillRetainedObjects(); |
1045 void FillImplicitReferences(); | 1046 void FillImplicitReferences(); |
1046 List<HeapObject*>* GetListMaybeDisposeInfo(v8::RetainedObjectInfo* info); | 1047 List<HeapObject*>* GetListMaybeDisposeInfo(v8::RetainedObjectInfo* info); |
1047 void SetNativeRootReference(v8::RetainedObjectInfo* info); | 1048 void SetNativeRootReference(v8::RetainedObjectInfo* info); |
1048 void SetRootNativeRootsReference(); | 1049 void SetRootNativeRootsReference(); |
(...skipping 18 matching lines...) Expand all Loading... | |
1067 NativeGroupRetainedObjectInfo* FindOrAddGroupInfo(const char* label); | 1068 NativeGroupRetainedObjectInfo* FindOrAddGroupInfo(const char* label); |
1068 | 1069 |
1069 HeapSnapshot* snapshot_; | 1070 HeapSnapshot* snapshot_; |
1070 HeapSnapshotsCollection* collection_; | 1071 HeapSnapshotsCollection* collection_; |
1071 SnapshottingProgressReportingInterface* progress_; | 1072 SnapshottingProgressReportingInterface* progress_; |
1072 bool embedder_queried_; | 1073 bool embedder_queried_; |
1073 HeapObjectsSet in_groups_; | 1074 HeapObjectsSet in_groups_; |
1074 // RetainedObjectInfo* -> List<HeapObject*>* | 1075 // RetainedObjectInfo* -> List<HeapObject*>* |
1075 HashMap objects_by_info_; | 1076 HashMap objects_by_info_; |
1076 HashMap native_groups_; | 1077 HashMap native_groups_; |
1078 HeapEntriesAllocator* artificial_entries_allocator_; | |
mnaganov (inactive)
2012/02/06 15:37:22
I'm against manual dynamic object allocation unles
| |
1079 HeapEntriesAllocator* native_entries_allocator_; | |
1077 // Used during references extraction. | 1080 // Used during references extraction. |
1078 SnapshotFillerInterface* filler_; | 1081 SnapshotFillerInterface* filler_; |
1079 | 1082 |
1080 static HeapThing const kNativesRootObject; | 1083 static HeapThing const kNativesRootObject; |
1081 | 1084 |
1082 friend class GlobalHandlesExtractor; | 1085 friend class GlobalHandlesExtractor; |
1083 | 1086 |
1084 DISALLOW_COPY_AND_ASSIGN(NativeObjectsExplorer); | 1087 DISALLOW_COPY_AND_ASSIGN(NativeObjectsExplorer); |
1085 }; | 1088 }; |
1086 | 1089 |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1165 | 1168 |
1166 friend class HeapSnapshotJSONSerializerEnumerator; | 1169 friend class HeapSnapshotJSONSerializerEnumerator; |
1167 friend class HeapSnapshotJSONSerializerIterator; | 1170 friend class HeapSnapshotJSONSerializerIterator; |
1168 | 1171 |
1169 DISALLOW_COPY_AND_ASSIGN(HeapSnapshotJSONSerializer); | 1172 DISALLOW_COPY_AND_ASSIGN(HeapSnapshotJSONSerializer); |
1170 }; | 1173 }; |
1171 | 1174 |
1172 } } // namespace v8::internal | 1175 } } // namespace v8::internal |
1173 | 1176 |
1174 #endif // V8_PROFILE_GENERATOR_H_ | 1177 #endif // V8_PROFILE_GENERATOR_H_ |
OLD | NEW |