| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef V8_HEAP_SNAPSHOT_GENERATOR_H_ | 5 #ifndef V8_HEAP_SNAPSHOT_GENERATOR_H_ |
| 6 #define V8_HEAP_SNAPSHOT_GENERATOR_H_ | 6 #define V8_HEAP_SNAPSHOT_GENERATOR_H_ |
| 7 | 7 |
| 8 #include "src/profile-generator-inl.h" | 8 #include "src/profile-generator-inl.h" |
| 9 | 9 |
| 10 namespace v8 { | 10 namespace v8 { |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 const char* name, | 169 const char* name, |
| 170 SnapshotObjectId id, | 170 SnapshotObjectId id, |
| 171 size_t size, | 171 size_t size, |
| 172 unsigned trace_node_id); | 172 unsigned trace_node_id); |
| 173 void AddSyntheticRootEntries(); | 173 void AddSyntheticRootEntries(); |
| 174 HeapEntry* GetEntryById(SnapshotObjectId id); | 174 HeapEntry* GetEntryById(SnapshotObjectId id); |
| 175 List<HeapEntry*>* GetSortedEntriesList(); | 175 List<HeapEntry*>* GetSortedEntriesList(); |
| 176 void FillChildren(); | 176 void FillChildren(); |
| 177 | 177 |
| 178 void Print(int max_depth); | 178 void Print(int max_depth); |
| 179 void PrintEntriesSize(); | |
| 180 | 179 |
| 181 private: | 180 private: |
| 182 HeapEntry* AddRootEntry(); | 181 HeapEntry* AddRootEntry(); |
| 183 HeapEntry* AddGcRootsEntry(); | 182 HeapEntry* AddGcRootsEntry(); |
| 184 HeapEntry* AddGcSubrootEntry(int tag, SnapshotObjectId id); | 183 HeapEntry* AddGcSubrootEntry(int tag, SnapshotObjectId id); |
| 185 | 184 |
| 186 HeapProfiler* profiler_; | 185 HeapProfiler* profiler_; |
| 187 const char* title_; | 186 const char* title_; |
| 188 unsigned uid_; | 187 unsigned uid_; |
| 189 int root_index_; | 188 int root_index_; |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 325 | 324 |
| 326 | 325 |
| 327 // An implementation of V8 heap graph extractor. | 326 // An implementation of V8 heap graph extractor. |
| 328 class V8HeapExplorer : public HeapEntriesAllocator { | 327 class V8HeapExplorer : public HeapEntriesAllocator { |
| 329 public: | 328 public: |
| 330 V8HeapExplorer(HeapSnapshot* snapshot, | 329 V8HeapExplorer(HeapSnapshot* snapshot, |
| 331 SnapshottingProgressReportingInterface* progress, | 330 SnapshottingProgressReportingInterface* progress, |
| 332 v8::HeapProfiler::ObjectNameResolver* resolver); | 331 v8::HeapProfiler::ObjectNameResolver* resolver); |
| 333 virtual ~V8HeapExplorer(); | 332 virtual ~V8HeapExplorer(); |
| 334 virtual HeapEntry* AllocateEntry(HeapThing ptr); | 333 virtual HeapEntry* AllocateEntry(HeapThing ptr); |
| 335 void AddRootEntries(SnapshotFiller* filler); | |
| 336 int EstimateObjectsCount(HeapIterator* iterator); | 334 int EstimateObjectsCount(HeapIterator* iterator); |
| 337 bool IterateAndExtractReferences(SnapshotFiller* filler); | 335 bool IterateAndExtractReferences(SnapshotFiller* filler); |
| 338 void TagGlobalObjects(); | 336 void TagGlobalObjects(); |
| 339 void TagCodeObject(Code* code); | 337 void TagCodeObject(Code* code); |
| 340 void TagBuiltinCodeObject(Code* code, const char* name); | 338 void TagBuiltinCodeObject(Code* code, const char* name); |
| 341 HeapEntry* AddEntry(Address address, | 339 HeapEntry* AddEntry(Address address, |
| 342 HeapEntry::Type type, | 340 HeapEntry::Type type, |
| 343 const char* name, | 341 const char* name, |
| 344 size_t size); | 342 size_t size); |
| 345 | 343 |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 466 | 464 |
| 467 class NativeGroupRetainedObjectInfo; | 465 class NativeGroupRetainedObjectInfo; |
| 468 | 466 |
| 469 | 467 |
| 470 // An implementation of retained native objects extractor. | 468 // An implementation of retained native objects extractor. |
| 471 class NativeObjectsExplorer { | 469 class NativeObjectsExplorer { |
| 472 public: | 470 public: |
| 473 NativeObjectsExplorer(HeapSnapshot* snapshot, | 471 NativeObjectsExplorer(HeapSnapshot* snapshot, |
| 474 SnapshottingProgressReportingInterface* progress); | 472 SnapshottingProgressReportingInterface* progress); |
| 475 virtual ~NativeObjectsExplorer(); | 473 virtual ~NativeObjectsExplorer(); |
| 476 void AddRootEntries(SnapshotFiller* filler); | |
| 477 int EstimateObjectsCount(); | 474 int EstimateObjectsCount(); |
| 478 bool IterateAndExtractReferences(SnapshotFiller* filler); | 475 bool IterateAndExtractReferences(SnapshotFiller* filler); |
| 479 | 476 |
| 480 private: | 477 private: |
| 481 void FillRetainedObjects(); | 478 void FillRetainedObjects(); |
| 482 void FillImplicitReferences(); | 479 void FillImplicitReferences(); |
| 483 List<HeapObject*>* GetListMaybeDisposeInfo(v8::RetainedObjectInfo* info); | 480 List<HeapObject*>* GetListMaybeDisposeInfo(v8::RetainedObjectInfo* info); |
| 484 void SetNativeRootReference(v8::RetainedObjectInfo* info); | 481 void SetNativeRootReference(v8::RetainedObjectInfo* info); |
| 485 void SetRootNativeRootsReference(); | 482 void SetRootNativeRootsReference(); |
| 486 void SetWrapperNativeReferences(HeapObject* wrapper, | 483 void SetWrapperNativeReferences(HeapObject* wrapper, |
| (...skipping 12 matching lines...) Expand all Loading... |
| 499 INLINE(static bool StringsMatch(void* key1, void* key2)) { | 496 INLINE(static bool StringsMatch(void* key1, void* key2)) { |
| 500 return strcmp(reinterpret_cast<char*>(key1), | 497 return strcmp(reinterpret_cast<char*>(key1), |
| 501 reinterpret_cast<char*>(key2)) == 0; | 498 reinterpret_cast<char*>(key2)) == 0; |
| 502 } | 499 } |
| 503 | 500 |
| 504 NativeGroupRetainedObjectInfo* FindOrAddGroupInfo(const char* label); | 501 NativeGroupRetainedObjectInfo* FindOrAddGroupInfo(const char* label); |
| 505 | 502 |
| 506 Isolate* isolate_; | 503 Isolate* isolate_; |
| 507 HeapSnapshot* snapshot_; | 504 HeapSnapshot* snapshot_; |
| 508 StringsStorage* names_; | 505 StringsStorage* names_; |
| 509 SnapshottingProgressReportingInterface* progress_; | |
| 510 bool embedder_queried_; | 506 bool embedder_queried_; |
| 511 HeapObjectsSet in_groups_; | 507 HeapObjectsSet in_groups_; |
| 512 // RetainedObjectInfo* -> List<HeapObject*>* | 508 // RetainedObjectInfo* -> List<HeapObject*>* |
| 513 HashMap objects_by_info_; | 509 HashMap objects_by_info_; |
| 514 HashMap native_groups_; | 510 HashMap native_groups_; |
| 515 HeapEntriesAllocator* synthetic_entries_allocator_; | 511 HeapEntriesAllocator* synthetic_entries_allocator_; |
| 516 HeapEntriesAllocator* native_entries_allocator_; | 512 HeapEntriesAllocator* native_entries_allocator_; |
| 517 // Used during references extraction. | 513 // Used during references extraction. |
| 518 SnapshotFiller* filler_; | 514 SnapshotFiller* filler_; |
| 519 | 515 |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 605 friend class HeapSnapshotJSONSerializerEnumerator; | 601 friend class HeapSnapshotJSONSerializerEnumerator; |
| 606 friend class HeapSnapshotJSONSerializerIterator; | 602 friend class HeapSnapshotJSONSerializerIterator; |
| 607 | 603 |
| 608 DISALLOW_COPY_AND_ASSIGN(HeapSnapshotJSONSerializer); | 604 DISALLOW_COPY_AND_ASSIGN(HeapSnapshotJSONSerializer); |
| 609 }; | 605 }; |
| 610 | 606 |
| 611 | 607 |
| 612 } } // namespace v8::internal | 608 } } // namespace v8::internal |
| 613 | 609 |
| 614 #endif // V8_HEAP_SNAPSHOT_GENERATOR_H_ | 610 #endif // V8_HEAP_SNAPSHOT_GENERATOR_H_ |
| OLD | NEW |