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_; } |
657 | 658 |
658 void AllocateEntries( | 659 void AllocateEntries( |
659 int entries_count, int children_count, int retainers_count); | 660 int entries_count, int children_count, int retainers_count); |
660 HeapEntry* AddEntry(HeapEntry::Type type, | 661 HeapEntry* AddEntry(HeapEntry::Type type, |
661 const char* name, | 662 const char* name, |
662 uint64_t id, | 663 uint64_t id, |
663 int size, | 664 int size, |
664 int children_count, | 665 int children_count, |
665 int retainers_count); | 666 int retainers_count); |
666 HeapEntry* AddRootEntry(int children_count); | 667 HeapEntry* AddRootEntry(int children_count); |
(...skipping 15 matching lines...) Expand all Loading... |
682 HeapSnapshotsCollection* collection_; | 683 HeapSnapshotsCollection* collection_; |
683 Type type_; | 684 Type type_; |
684 const char* title_; | 685 const char* title_; |
685 unsigned uid_; | 686 unsigned uid_; |
686 HeapEntry* root_entry_; | 687 HeapEntry* root_entry_; |
687 HeapEntry* gc_roots_entry_; | 688 HeapEntry* gc_roots_entry_; |
688 HeapEntry* natives_root_entry_; | 689 HeapEntry* natives_root_entry_; |
689 char* raw_entries_; | 690 char* raw_entries_; |
690 List<HeapEntry*> entries_; | 691 List<HeapEntry*> entries_; |
691 bool entries_sorted_; | 692 bool entries_sorted_; |
692 #ifdef DEBUG | |
693 int raw_entries_size_; | 693 int raw_entries_size_; |
694 #endif | |
695 | 694 |
696 friend class HeapSnapshotTester; | 695 friend class HeapSnapshotTester; |
697 | 696 |
698 DISALLOW_COPY_AND_ASSIGN(HeapSnapshot); | 697 DISALLOW_COPY_AND_ASSIGN(HeapSnapshot); |
699 }; | 698 }; |
700 | 699 |
701 | 700 |
702 class HeapObjectsMap { | 701 class HeapObjectsMap { |
703 public: | 702 public: |
704 HeapObjectsMap(); | 703 HeapObjectsMap(); |
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1090 INLINE(static bool ObjectsMatch(void* key1, void* key2)) { | 1089 INLINE(static bool ObjectsMatch(void* key1, void* key2)) { |
1091 return key1 == key2; | 1090 return key1 == key2; |
1092 } | 1091 } |
1093 | 1092 |
1094 INLINE(static uint32_t ObjectHash(const void* key)) { | 1093 INLINE(static uint32_t ObjectHash(const void* key)) { |
1095 return ComputeIntegerHash( | 1094 return ComputeIntegerHash( |
1096 static_cast<uint32_t>(reinterpret_cast<uintptr_t>(key))); | 1095 static_cast<uint32_t>(reinterpret_cast<uintptr_t>(key))); |
1097 } | 1096 } |
1098 | 1097 |
1099 void EnumerateNodes(); | 1098 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 |
1111 HeapSnapshot* snapshot_; | 1113 HeapSnapshot* snapshot_; |
1112 HashMap nodes_; | 1114 HashMap nodes_; |
1113 HashMap strings_; | 1115 HashMap strings_; |
1114 int next_node_id_; | 1116 int next_node_id_; |
1115 int next_string_id_; | 1117 int next_string_id_; |
1116 OutputStreamWriter* writer_; | 1118 OutputStreamWriter* writer_; |
1117 | 1119 |
1118 friend class HeapSnapshotJSONSerializerEnumerator; | 1120 friend class HeapSnapshotJSONSerializerEnumerator; |
1119 friend class HeapSnapshotJSONSerializerIterator; | 1121 friend class HeapSnapshotJSONSerializerIterator; |
1120 | 1122 |
1121 DISALLOW_COPY_AND_ASSIGN(HeapSnapshotJSONSerializer); | 1123 DISALLOW_COPY_AND_ASSIGN(HeapSnapshotJSONSerializer); |
1122 }; | 1124 }; |
1123 | 1125 |
1124 } } // namespace v8::internal | 1126 } } // namespace v8::internal |
1125 | 1127 |
1126 #endif // V8_PROFILE_GENERATOR_H_ | 1128 #endif // V8_PROFILE_GENERATOR_H_ |
OLD | NEW |