| 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 622 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 633 SnapshotObjectId max_snapshot_js_object_id_; | 633 SnapshotObjectId max_snapshot_js_object_id_; |
| 634 | 634 |
| 635 friend class HeapSnapshotTester; | 635 friend class HeapSnapshotTester; |
| 636 | 636 |
| 637 DISALLOW_COPY_AND_ASSIGN(HeapSnapshot); | 637 DISALLOW_COPY_AND_ASSIGN(HeapSnapshot); |
| 638 }; | 638 }; |
| 639 | 639 |
| 640 | 640 |
| 641 class HeapObjectsMap { | 641 class HeapObjectsMap { |
| 642 public: | 642 public: |
| 643 HeapObjectsMap(); | 643 explicit HeapObjectsMap(Heap* heap); |
| 644 |
| 645 Heap* heap() const { return heap_; } |
| 644 | 646 |
| 645 void SnapshotGenerationFinished(); | 647 void SnapshotGenerationFinished(); |
| 646 SnapshotObjectId FindEntry(Address addr); | 648 SnapshotObjectId FindEntry(Address addr); |
| 647 SnapshotObjectId FindOrAddEntry(Address addr, unsigned int size); | 649 SnapshotObjectId FindOrAddEntry(Address addr, unsigned int size); |
| 648 void MoveObject(Address from, Address to); | 650 void MoveObject(Address from, Address to); |
| 649 SnapshotObjectId last_assigned_id() const { | 651 SnapshotObjectId last_assigned_id() const { |
| 650 return next_id_ - kObjectIdStep; | 652 return next_id_ - kObjectIdStep; |
| 651 } | 653 } |
| 652 | 654 |
| 653 void StopHeapObjectsTracking(); | 655 void StopHeapObjectsTracking(); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 692 static uint32_t AddressHash(Address addr) { | 694 static uint32_t AddressHash(Address addr) { |
| 693 return ComputeIntegerHash( | 695 return ComputeIntegerHash( |
| 694 static_cast<uint32_t>(reinterpret_cast<uintptr_t>(addr)), | 696 static_cast<uint32_t>(reinterpret_cast<uintptr_t>(addr)), |
| 695 v8::internal::kZeroHashSeed); | 697 v8::internal::kZeroHashSeed); |
| 696 } | 698 } |
| 697 | 699 |
| 698 SnapshotObjectId next_id_; | 700 SnapshotObjectId next_id_; |
| 699 HashMap entries_map_; | 701 HashMap entries_map_; |
| 700 List<EntryInfo> entries_; | 702 List<EntryInfo> entries_; |
| 701 List<TimeInterval> time_intervals_; | 703 List<TimeInterval> time_intervals_; |
| 704 Heap* heap_; |
| 702 | 705 |
| 703 DISALLOW_COPY_AND_ASSIGN(HeapObjectsMap); | 706 DISALLOW_COPY_AND_ASSIGN(HeapObjectsMap); |
| 704 }; | 707 }; |
| 705 | 708 |
| 706 | 709 |
| 707 class HeapSnapshotsCollection { | 710 class HeapSnapshotsCollection { |
| 708 public: | 711 public: |
| 709 HeapSnapshotsCollection(); | 712 explicit HeapSnapshotsCollection(Heap* heap); |
| 710 ~HeapSnapshotsCollection(); | 713 ~HeapSnapshotsCollection(); |
| 711 | 714 |
| 715 Heap* heap() const { return ids_.heap(); } |
| 716 |
| 712 bool is_tracking_objects() { return is_tracking_objects_; } | 717 bool is_tracking_objects() { return is_tracking_objects_; } |
| 713 SnapshotObjectId PushHeapObjectsStats(OutputStream* stream) { | 718 SnapshotObjectId PushHeapObjectsStats(OutputStream* stream) { |
| 714 return ids_.PushHeapObjectsStats(stream); | 719 return ids_.PushHeapObjectsStats(stream); |
| 715 } | 720 } |
| 716 void StartHeapObjectsTracking() { is_tracking_objects_ = true; } | 721 void StartHeapObjectsTracking() { is_tracking_objects_ = true; } |
| 717 void StopHeapObjectsTracking() { ids_.StopHeapObjectsTracking(); } | 722 void StopHeapObjectsTracking() { ids_.StopHeapObjectsTracking(); } |
| 718 | 723 |
| 719 HeapSnapshot* NewSnapshot( | 724 HeapSnapshot* NewSnapshot( |
| 720 HeapSnapshot::Type type, const char* name, unsigned uid); | 725 HeapSnapshot::Type type, const char* name, unsigned uid); |
| 721 void SnapshotGenerationFinished(HeapSnapshot* snapshot); | 726 void SnapshotGenerationFinished(HeapSnapshot* snapshot); |
| (...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1018 friend class GlobalHandlesExtractor; | 1023 friend class GlobalHandlesExtractor; |
| 1019 | 1024 |
| 1020 DISALLOW_COPY_AND_ASSIGN(NativeObjectsExplorer); | 1025 DISALLOW_COPY_AND_ASSIGN(NativeObjectsExplorer); |
| 1021 }; | 1026 }; |
| 1022 | 1027 |
| 1023 | 1028 |
| 1024 class HeapSnapshotGenerator : public SnapshottingProgressReportingInterface { | 1029 class HeapSnapshotGenerator : public SnapshottingProgressReportingInterface { |
| 1025 public: | 1030 public: |
| 1026 HeapSnapshotGenerator(HeapSnapshot* snapshot, | 1031 HeapSnapshotGenerator(HeapSnapshot* snapshot, |
| 1027 v8::ActivityControl* control, | 1032 v8::ActivityControl* control, |
| 1028 v8::HeapProfiler::ObjectNameResolver* resolver); | 1033 v8::HeapProfiler::ObjectNameResolver* resolver, |
| 1034 Heap* heap); |
| 1029 bool GenerateSnapshot(); | 1035 bool GenerateSnapshot(); |
| 1030 | 1036 |
| 1031 private: | 1037 private: |
| 1032 bool FillReferences(); | 1038 bool FillReferences(); |
| 1033 void ProgressStep(); | 1039 void ProgressStep(); |
| 1034 bool ProgressReport(bool force = false); | 1040 bool ProgressReport(bool force = false); |
| 1035 void SetProgressTotal(int iterations_count); | 1041 void SetProgressTotal(int iterations_count); |
| 1036 | 1042 |
| 1037 HeapSnapshot* snapshot_; | 1043 HeapSnapshot* snapshot_; |
| 1038 v8::ActivityControl* control_; | 1044 v8::ActivityControl* control_; |
| 1039 V8HeapExplorer v8_heap_explorer_; | 1045 V8HeapExplorer v8_heap_explorer_; |
| 1040 NativeObjectsExplorer dom_explorer_; | 1046 NativeObjectsExplorer dom_explorer_; |
| 1041 // Mapping from HeapThing pointers to HeapEntry* pointers. | 1047 // Mapping from HeapThing pointers to HeapEntry* pointers. |
| 1042 HeapEntriesMap entries_; | 1048 HeapEntriesMap entries_; |
| 1043 // Used during snapshot generation. | 1049 // Used during snapshot generation. |
| 1044 int progress_counter_; | 1050 int progress_counter_; |
| 1045 int progress_total_; | 1051 int progress_total_; |
| 1052 Heap* heap_; |
| 1046 | 1053 |
| 1047 DISALLOW_COPY_AND_ASSIGN(HeapSnapshotGenerator); | 1054 DISALLOW_COPY_AND_ASSIGN(HeapSnapshotGenerator); |
| 1048 }; | 1055 }; |
| 1049 | 1056 |
| 1050 class OutputStreamWriter; | 1057 class OutputStreamWriter; |
| 1051 | 1058 |
| 1052 class HeapSnapshotJSONSerializer { | 1059 class HeapSnapshotJSONSerializer { |
| 1053 public: | 1060 public: |
| 1054 explicit HeapSnapshotJSONSerializer(HeapSnapshot* snapshot) | 1061 explicit HeapSnapshotJSONSerializer(HeapSnapshot* snapshot) |
| 1055 : snapshot_(snapshot), | 1062 : snapshot_(snapshot), |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1095 | 1102 |
| 1096 friend class HeapSnapshotJSONSerializerEnumerator; | 1103 friend class HeapSnapshotJSONSerializerEnumerator; |
| 1097 friend class HeapSnapshotJSONSerializerIterator; | 1104 friend class HeapSnapshotJSONSerializerIterator; |
| 1098 | 1105 |
| 1099 DISALLOW_COPY_AND_ASSIGN(HeapSnapshotJSONSerializer); | 1106 DISALLOW_COPY_AND_ASSIGN(HeapSnapshotJSONSerializer); |
| 1100 }; | 1107 }; |
| 1101 | 1108 |
| 1102 } } // namespace v8::internal | 1109 } } // namespace v8::internal |
| 1103 | 1110 |
| 1104 #endif // V8_PROFILE_GENERATOR_H_ | 1111 #endif // V8_PROFILE_GENERATOR_H_ |
| OLD | NEW |