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 732 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
743 void AddEntry(Address addr, uint64_t id); | 743 void AddEntry(Address addr, uint64_t id); |
744 uint64_t FindEntry(Address addr); | 744 uint64_t FindEntry(Address addr); |
745 void RemoveDeadEntries(); | 745 void RemoveDeadEntries(); |
746 | 746 |
747 static bool AddressesMatch(void* key1, void* key2) { | 747 static bool AddressesMatch(void* key1, void* key2) { |
748 return key1 == key2; | 748 return key1 == key2; |
749 } | 749 } |
750 | 750 |
751 static uint32_t AddressHash(Address addr) { | 751 static uint32_t AddressHash(Address addr) { |
752 return ComputeIntegerHash( | 752 return ComputeIntegerHash( |
753 static_cast<uint32_t>(reinterpret_cast<uintptr_t>(addr))); | 753 static_cast<uint32_t>(reinterpret_cast<uintptr_t>(addr)), |
| 754 v8::internal::kZeroHashSeed); |
754 } | 755 } |
755 | 756 |
756 bool initial_fill_mode_; | 757 bool initial_fill_mode_; |
757 uint64_t next_id_; | 758 uint64_t next_id_; |
758 HashMap entries_map_; | 759 HashMap entries_map_; |
759 List<EntryInfo>* entries_; | 760 List<EntryInfo>* entries_; |
760 | 761 |
761 DISALLOW_COPY_AND_ASSIGN(HeapObjectsMap); | 762 DISALLOW_COPY_AND_ASSIGN(HeapObjectsMap); |
762 }; | 763 }; |
763 | 764 |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
826 HeapEntry* Map(HeapThing thing); | 827 HeapEntry* Map(HeapThing thing); |
827 void Pair(HeapThing thing, HeapEntriesAllocator* allocator, HeapEntry* entry); | 828 void Pair(HeapThing thing, HeapEntriesAllocator* allocator, HeapEntry* entry); |
828 void CountReference(HeapThing from, HeapThing to, | 829 void CountReference(HeapThing from, HeapThing to, |
829 int* prev_children_count = NULL, | 830 int* prev_children_count = NULL, |
830 int* prev_retainers_count = NULL); | 831 int* prev_retainers_count = NULL); |
831 | 832 |
832 int entries_count() { return entries_count_; } | 833 int entries_count() { return entries_count_; } |
833 int total_children_count() { return total_children_count_; } | 834 int total_children_count() { return total_children_count_; } |
834 int total_retainers_count() { return total_retainers_count_; } | 835 int total_retainers_count() { return total_retainers_count_; } |
835 | 836 |
836 static HeapEntry *const kHeapEntryPlaceholder; | 837 static HeapEntry* const kHeapEntryPlaceholder; |
837 | 838 |
838 private: | 839 private: |
839 struct EntryInfo { | 840 struct EntryInfo { |
840 EntryInfo(HeapEntry* entry, HeapEntriesAllocator* allocator) | 841 EntryInfo(HeapEntry* entry, HeapEntriesAllocator* allocator) |
841 : entry(entry), | 842 : entry(entry), |
842 allocator(allocator), | 843 allocator(allocator), |
843 children_count(0), | 844 children_count(0), |
844 retainers_count(0) { | 845 retainers_count(0) { |
845 } | 846 } |
846 HeapEntry* entry; | 847 HeapEntry* entry; |
847 HeapEntriesAllocator* allocator; | 848 HeapEntriesAllocator* allocator; |
848 int children_count; | 849 int children_count; |
849 int retainers_count; | 850 int retainers_count; |
850 }; | 851 }; |
851 | 852 |
852 static uint32_t Hash(HeapThing thing) { | 853 static uint32_t Hash(HeapThing thing) { |
853 return ComputeIntegerHash( | 854 return ComputeIntegerHash( |
854 static_cast<uint32_t>(reinterpret_cast<uintptr_t>(thing))); | 855 static_cast<uint32_t>(reinterpret_cast<uintptr_t>(thing)), |
| 856 v8::internal::kZeroHashSeed); |
855 } | 857 } |
856 static bool HeapThingsMatch(HeapThing key1, HeapThing key2) { | 858 static bool HeapThingsMatch(HeapThing key1, HeapThing key2) { |
857 return key1 == key2; | 859 return key1 == key2; |
858 } | 860 } |
859 | 861 |
860 HashMap entries_; | 862 HashMap entries_; |
861 int entries_count_; | 863 int entries_count_; |
862 int total_children_count_; | 864 int total_children_count_; |
863 int total_retainers_count_; | 865 int total_retainers_count_; |
864 | 866 |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1040 private: | 1042 private: |
1041 void FillRetainedObjects(); | 1043 void FillRetainedObjects(); |
1042 List<HeapObject*>* GetListMaybeDisposeInfo(v8::RetainedObjectInfo* info); | 1044 List<HeapObject*>* GetListMaybeDisposeInfo(v8::RetainedObjectInfo* info); |
1043 void SetNativeRootReference(v8::RetainedObjectInfo* info); | 1045 void SetNativeRootReference(v8::RetainedObjectInfo* info); |
1044 void SetRootNativesRootReference(); | 1046 void SetRootNativesRootReference(); |
1045 void SetWrapperNativeReferences(HeapObject* wrapper, | 1047 void SetWrapperNativeReferences(HeapObject* wrapper, |
1046 v8::RetainedObjectInfo* info); | 1048 v8::RetainedObjectInfo* info); |
1047 void VisitSubtreeWrapper(Object** p, uint16_t class_id); | 1049 void VisitSubtreeWrapper(Object** p, uint16_t class_id); |
1048 | 1050 |
1049 static uint32_t InfoHash(v8::RetainedObjectInfo* info) { | 1051 static uint32_t InfoHash(v8::RetainedObjectInfo* info) { |
1050 return ComputeIntegerHash(static_cast<uint32_t>(info->GetHash())); | 1052 return ComputeIntegerHash(static_cast<uint32_t>(info->GetHash()), |
| 1053 v8::internal::kZeroHashSeed); |
1051 } | 1054 } |
1052 static bool RetainedInfosMatch(void* key1, void* key2) { | 1055 static bool RetainedInfosMatch(void* key1, void* key2) { |
1053 return key1 == key2 || | 1056 return key1 == key2 || |
1054 (reinterpret_cast<v8::RetainedObjectInfo*>(key1))->IsEquivalent( | 1057 (reinterpret_cast<v8::RetainedObjectInfo*>(key1))->IsEquivalent( |
1055 reinterpret_cast<v8::RetainedObjectInfo*>(key2)); | 1058 reinterpret_cast<v8::RetainedObjectInfo*>(key2)); |
1056 } | 1059 } |
1057 | 1060 |
1058 HeapSnapshot* snapshot_; | 1061 HeapSnapshot* snapshot_; |
1059 HeapSnapshotsCollection* collection_; | 1062 HeapSnapshotsCollection* collection_; |
1060 SnapshottingProgressReportingInterface* progress_; | 1063 SnapshottingProgressReportingInterface* progress_; |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1118 } | 1121 } |
1119 void Serialize(v8::OutputStream* stream); | 1122 void Serialize(v8::OutputStream* stream); |
1120 | 1123 |
1121 private: | 1124 private: |
1122 INLINE(static bool ObjectsMatch(void* key1, void* key2)) { | 1125 INLINE(static bool ObjectsMatch(void* key1, void* key2)) { |
1123 return key1 == key2; | 1126 return key1 == key2; |
1124 } | 1127 } |
1125 | 1128 |
1126 INLINE(static uint32_t ObjectHash(const void* key)) { | 1129 INLINE(static uint32_t ObjectHash(const void* key)) { |
1127 return ComputeIntegerHash( | 1130 return ComputeIntegerHash( |
1128 static_cast<uint32_t>(reinterpret_cast<uintptr_t>(key))); | 1131 static_cast<uint32_t>(reinterpret_cast<uintptr_t>(key)), |
| 1132 v8::internal::kZeroHashSeed); |
1129 } | 1133 } |
1130 | 1134 |
1131 void EnumerateNodes(); | 1135 void EnumerateNodes(); |
1132 HeapSnapshot* CreateFakeSnapshot(); | 1136 HeapSnapshot* CreateFakeSnapshot(); |
1133 int GetNodeId(HeapEntry* entry); | 1137 int GetNodeId(HeapEntry* entry); |
1134 int GetStringId(const char* s); | 1138 int GetStringId(const char* s); |
1135 void SerializeEdge(HeapGraphEdge* edge); | 1139 void SerializeEdge(HeapGraphEdge* edge); |
1136 void SerializeImpl(); | 1140 void SerializeImpl(); |
1137 void SerializeNode(HeapEntry* entry); | 1141 void SerializeNode(HeapEntry* entry); |
1138 void SerializeNodes(); | 1142 void SerializeNodes(); |
(...skipping 13 matching lines...) Expand all Loading... |
1152 | 1156 |
1153 friend class HeapSnapshotJSONSerializerEnumerator; | 1157 friend class HeapSnapshotJSONSerializerEnumerator; |
1154 friend class HeapSnapshotJSONSerializerIterator; | 1158 friend class HeapSnapshotJSONSerializerIterator; |
1155 | 1159 |
1156 DISALLOW_COPY_AND_ASSIGN(HeapSnapshotJSONSerializer); | 1160 DISALLOW_COPY_AND_ASSIGN(HeapSnapshotJSONSerializer); |
1157 }; | 1161 }; |
1158 | 1162 |
1159 } } // namespace v8::internal | 1163 } } // namespace v8::internal |
1160 | 1164 |
1161 #endif // V8_PROFILE_GENERATOR_H_ | 1165 #endif // V8_PROFILE_GENERATOR_H_ |
OLD | NEW |