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 627 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
638 HeapSnapshotsCollection* collection() { return collection_; } | 638 HeapSnapshotsCollection* collection() { return collection_; } |
639 Type type() { return type_; } | 639 Type type() { return type_; } |
640 const char* title() { return title_; } | 640 const char* title() { return title_; } |
641 unsigned uid() { return uid_; } | 641 unsigned uid() { return uid_; } |
642 HeapEntry* root() { return root_entry_; } | 642 HeapEntry* root() { return root_entry_; } |
643 HeapEntry* gc_roots() { return gc_roots_entry_; } | 643 HeapEntry* gc_roots() { return gc_roots_entry_; } |
644 HeapEntry* natives_root() { return natives_root_entry_; } | 644 HeapEntry* natives_root() { return natives_root_entry_; } |
645 HeapEntry* gc_subroot(int index) { return gc_subroot_entries_[index]; } | 645 HeapEntry* gc_subroot(int index) { return gc_subroot_entries_[index]; } |
646 List<HeapEntry*>* entries() { return &entries_; } | 646 List<HeapEntry*>* entries() { return &entries_; } |
647 size_t raw_entries_size() { return raw_entries_size_; } | 647 size_t raw_entries_size() { return raw_entries_size_; } |
648 void RememberLastSnapshotJSObjectId(); | |
648 SnapshotObjectId max_snapshot_js_object_id() const { | 649 SnapshotObjectId max_snapshot_js_object_id() const { |
649 return max_snapshot_js_object_id_; | 650 return max_snapshot_js_object_id_; |
650 } | 651 } |
651 | 652 |
652 void AllocateEntries( | 653 void AllocateEntries( |
653 int entries_count, int children_count, int retainers_count); | 654 int entries_count, int children_count, int retainers_count); |
654 HeapEntry* AddEntry(HeapEntry::Type type, | 655 HeapEntry* AddEntry(HeapEntry::Type type, |
655 const char* name, | 656 const char* name, |
656 SnapshotObjectId id, | 657 SnapshotObjectId id, |
657 int size, | 658 int size, |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
697 | 698 |
698 | 699 |
699 class HeapObjectsMap { | 700 class HeapObjectsMap { |
700 public: | 701 public: |
701 HeapObjectsMap(); | 702 HeapObjectsMap(); |
702 ~HeapObjectsMap(); | 703 ~HeapObjectsMap(); |
703 | 704 |
704 void SnapshotGenerationFinished(); | 705 void SnapshotGenerationFinished(); |
705 SnapshotObjectId FindObject(Address addr); | 706 SnapshotObjectId FindObject(Address addr); |
706 void MoveObject(Address from, Address to); | 707 void MoveObject(Address from, Address to); |
708 SnapshotObjectId max_snapshot_js_object_id() const { | |
mnaganov (inactive)
2012/03/29 12:12:17
I think, a name like 'current_id' is more appropri
| |
709 return next_id_ - kObjectIdStep; | |
710 } | |
707 | 711 |
708 static SnapshotObjectId GenerateId(v8::RetainedObjectInfo* info); | 712 static SnapshotObjectId GenerateId(v8::RetainedObjectInfo* info); |
709 static inline SnapshotObjectId GetNthGcSubrootId(int delta); | 713 static inline SnapshotObjectId GetNthGcSubrootId(int delta); |
710 | 714 |
711 static const int kObjectIdStep = 2; | 715 static const int kObjectIdStep = 2; |
712 static const SnapshotObjectId kInternalRootObjectId; | 716 static const SnapshotObjectId kInternalRootObjectId; |
713 static const SnapshotObjectId kGcRootsObjectId; | 717 static const SnapshotObjectId kGcRootsObjectId; |
714 static const SnapshotObjectId kNativesRootObjectId; | 718 static const SnapshotObjectId kNativesRootObjectId; |
715 static const SnapshotObjectId kGcRootsFirstSubrootId; | 719 static const SnapshotObjectId kGcRootsFirstSubrootId; |
716 static const SnapshotObjectId kFirstAvailableObjectId; | 720 static const SnapshotObjectId kFirstAvailableObjectId; |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
761 List<HeapSnapshot*>* snapshots() { return &snapshots_; } | 765 List<HeapSnapshot*>* snapshots() { return &snapshots_; } |
762 HeapSnapshot* GetSnapshot(unsigned uid); | 766 HeapSnapshot* GetSnapshot(unsigned uid); |
763 void RemoveSnapshot(HeapSnapshot* snapshot); | 767 void RemoveSnapshot(HeapSnapshot* snapshot); |
764 | 768 |
765 StringsStorage* names() { return &names_; } | 769 StringsStorage* names() { return &names_; } |
766 TokenEnumerator* token_enumerator() { return token_enumerator_; } | 770 TokenEnumerator* token_enumerator() { return token_enumerator_; } |
767 | 771 |
768 SnapshotObjectId GetObjectId(Address addr) { return ids_.FindObject(addr); } | 772 SnapshotObjectId GetObjectId(Address addr) { return ids_.FindObject(addr); } |
769 Handle<HeapObject> FindHeapObjectById(SnapshotObjectId id); | 773 Handle<HeapObject> FindHeapObjectById(SnapshotObjectId id); |
770 void ObjectMoveEvent(Address from, Address to) { ids_.MoveObject(from, to); } | 774 void ObjectMoveEvent(Address from, Address to) { ids_.MoveObject(from, to); } |
775 SnapshotObjectId max_snapshot_js_object_id() const { | |
776 return ids_.max_snapshot_js_object_id(); | |
777 } | |
771 | 778 |
772 private: | 779 private: |
773 INLINE(static bool HeapSnapshotsMatch(void* key1, void* key2)) { | 780 INLINE(static bool HeapSnapshotsMatch(void* key1, void* key2)) { |
774 return key1 == key2; | 781 return key1 == key2; |
775 } | 782 } |
776 | 783 |
777 bool is_tracking_objects_; // Whether tracking object moves is needed. | 784 bool is_tracking_objects_; // Whether tracking object moves is needed. |
778 List<HeapSnapshot*> snapshots_; | 785 List<HeapSnapshot*> snapshots_; |
779 // Mapping from snapshots' uids to HeapSnapshot* pointers. | 786 // Mapping from snapshots' uids to HeapSnapshot* pointers. |
780 HashMap snapshots_uids_; | 787 HashMap snapshots_uids_; |
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1158 | 1165 |
1159 friend class HeapSnapshotJSONSerializerEnumerator; | 1166 friend class HeapSnapshotJSONSerializerEnumerator; |
1160 friend class HeapSnapshotJSONSerializerIterator; | 1167 friend class HeapSnapshotJSONSerializerIterator; |
1161 | 1168 |
1162 DISALLOW_COPY_AND_ASSIGN(HeapSnapshotJSONSerializer); | 1169 DISALLOW_COPY_AND_ASSIGN(HeapSnapshotJSONSerializer); |
1163 }; | 1170 }; |
1164 | 1171 |
1165 } } // namespace v8::internal | 1172 } } // namespace v8::internal |
1166 | 1173 |
1167 #endif // V8_PROFILE_GENERATOR_H_ | 1174 #endif // V8_PROFILE_GENERATOR_H_ |
OLD | NEW |