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