OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 636 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
647 void Delete(); | 647 void Delete(); |
648 | 648 |
649 HeapSnapshotsCollection* collection() { return collection_; } | 649 HeapSnapshotsCollection* collection() { return collection_; } |
650 Type type() { return type_; } | 650 Type type() { return type_; } |
651 const char* title() { return title_; } | 651 const char* title() { return title_; } |
652 unsigned uid() { return uid_; } | 652 unsigned uid() { return uid_; } |
653 HeapEntry* root() { return root_entry_; } | 653 HeapEntry* root() { return root_entry_; } |
654 HeapEntry* gc_roots() { return gc_roots_entry_; } | 654 HeapEntry* gc_roots() { return gc_roots_entry_; } |
655 HeapEntry* natives_root() { return natives_root_entry_; } | 655 HeapEntry* natives_root() { return natives_root_entry_; } |
656 List<HeapEntry*>* entries() { return &entries_; } | 656 List<HeapEntry*>* entries() { return &entries_; } |
657 int raw_entries_size() { return raw_entries_size_; } | |
658 | 657 |
659 void AllocateEntries( | 658 void AllocateEntries( |
660 int entries_count, int children_count, int retainers_count); | 659 int entries_count, int children_count, int retainers_count); |
661 HeapEntry* AddEntry(HeapEntry::Type type, | 660 HeapEntry* AddEntry(HeapEntry::Type type, |
662 const char* name, | 661 const char* name, |
663 uint64_t id, | 662 uint64_t id, |
664 int size, | 663 int size, |
665 int children_count, | 664 int children_count, |
666 int retainers_count); | 665 int retainers_count); |
667 HeapEntry* AddRootEntry(int children_count); | 666 HeapEntry* AddRootEntry(int children_count); |
(...skipping 15 matching lines...) Expand all Loading... |
683 HeapSnapshotsCollection* collection_; | 682 HeapSnapshotsCollection* collection_; |
684 Type type_; | 683 Type type_; |
685 const char* title_; | 684 const char* title_; |
686 unsigned uid_; | 685 unsigned uid_; |
687 HeapEntry* root_entry_; | 686 HeapEntry* root_entry_; |
688 HeapEntry* gc_roots_entry_; | 687 HeapEntry* gc_roots_entry_; |
689 HeapEntry* natives_root_entry_; | 688 HeapEntry* natives_root_entry_; |
690 char* raw_entries_; | 689 char* raw_entries_; |
691 List<HeapEntry*> entries_; | 690 List<HeapEntry*> entries_; |
692 bool entries_sorted_; | 691 bool entries_sorted_; |
| 692 #ifdef DEBUG |
693 int raw_entries_size_; | 693 int raw_entries_size_; |
| 694 #endif |
694 | 695 |
695 friend class HeapSnapshotTester; | 696 friend class HeapSnapshotTester; |
696 | 697 |
697 DISALLOW_COPY_AND_ASSIGN(HeapSnapshot); | 698 DISALLOW_COPY_AND_ASSIGN(HeapSnapshot); |
698 }; | 699 }; |
699 | 700 |
700 | 701 |
701 class HeapObjectsMap { | 702 class HeapObjectsMap { |
702 public: | 703 public: |
703 HeapObjectsMap(); | 704 HeapObjectsMap(); |
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1089 INLINE(static bool ObjectsMatch(void* key1, void* key2)) { | 1090 INLINE(static bool ObjectsMatch(void* key1, void* key2)) { |
1090 return key1 == key2; | 1091 return key1 == key2; |
1091 } | 1092 } |
1092 | 1093 |
1093 INLINE(static uint32_t ObjectHash(const void* key)) { | 1094 INLINE(static uint32_t ObjectHash(const void* key)) { |
1094 return ComputeIntegerHash( | 1095 return ComputeIntegerHash( |
1095 static_cast<uint32_t>(reinterpret_cast<uintptr_t>(key))); | 1096 static_cast<uint32_t>(reinterpret_cast<uintptr_t>(key))); |
1096 } | 1097 } |
1097 | 1098 |
1098 void EnumerateNodes(); | 1099 void EnumerateNodes(); |
1099 HeapSnapshot* CreateFakeSnapshot(); | |
1100 int GetNodeId(HeapEntry* entry); | 1100 int GetNodeId(HeapEntry* entry); |
1101 int GetStringId(const char* s); | 1101 int GetStringId(const char* s); |
1102 void SerializeEdge(HeapGraphEdge* edge); | 1102 void SerializeEdge(HeapGraphEdge* edge); |
1103 void SerializeImpl(); | 1103 void SerializeImpl(); |
1104 void SerializeNode(HeapEntry* entry); | 1104 void SerializeNode(HeapEntry* entry); |
1105 void SerializeNodes(); | 1105 void SerializeNodes(); |
1106 void SerializeSnapshot(); | 1106 void SerializeSnapshot(); |
1107 void SerializeString(const unsigned char* s); | 1107 void SerializeString(const unsigned char* s); |
1108 void SerializeStrings(); | 1108 void SerializeStrings(); |
1109 void SortHashMap(HashMap* map, List<HashMap::Entry*>* sorted_entries); | 1109 void SortHashMap(HashMap* map, List<HashMap::Entry*>* sorted_entries); |
1110 | 1110 |
1111 static const int kMaxSerializableSnapshotRawSize; | |
1112 | |
1113 HeapSnapshot* snapshot_; | 1111 HeapSnapshot* snapshot_; |
1114 HashMap nodes_; | 1112 HashMap nodes_; |
1115 HashMap strings_; | 1113 HashMap strings_; |
1116 int next_node_id_; | 1114 int next_node_id_; |
1117 int next_string_id_; | 1115 int next_string_id_; |
1118 OutputStreamWriter* writer_; | 1116 OutputStreamWriter* writer_; |
1119 | 1117 |
1120 friend class HeapSnapshotJSONSerializerEnumerator; | 1118 friend class HeapSnapshotJSONSerializerEnumerator; |
1121 friend class HeapSnapshotJSONSerializerIterator; | 1119 friend class HeapSnapshotJSONSerializerIterator; |
1122 | 1120 |
1123 DISALLOW_COPY_AND_ASSIGN(HeapSnapshotJSONSerializer); | 1121 DISALLOW_COPY_AND_ASSIGN(HeapSnapshotJSONSerializer); |
1124 }; | 1122 }; |
1125 | 1123 |
1126 } } // namespace v8::internal | 1124 } } // namespace v8::internal |
1127 | 1125 |
1128 #endif // V8_PROFILE_GENERATOR_H_ | 1126 #endif // V8_PROFILE_GENERATOR_H_ |
OLD | NEW |