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 727 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
738 | 738 |
739 void AddEntry(Address addr, uint64_t id); | 739 void AddEntry(Address addr, uint64_t id); |
740 uint64_t FindEntry(Address addr); | 740 uint64_t FindEntry(Address addr); |
741 void RemoveDeadEntries(); | 741 void RemoveDeadEntries(); |
742 | 742 |
743 static bool AddressesMatch(void* key1, void* key2) { | 743 static bool AddressesMatch(void* key1, void* key2) { |
744 return key1 == key2; | 744 return key1 == key2; |
745 } | 745 } |
746 | 746 |
747 static uint32_t AddressHash(Address addr) { | 747 static uint32_t AddressHash(Address addr) { |
748 return static_cast<int32_t>(reinterpret_cast<intptr_t>(addr)); | 748 return ComputeIntegerHash( |
| 749 static_cast<uint32_t>(reinterpret_cast<uintptr_t>(addr))); |
749 } | 750 } |
750 | 751 |
751 bool initial_fill_mode_; | 752 bool initial_fill_mode_; |
752 uint64_t next_id_; | 753 uint64_t next_id_; |
753 HashMap entries_map_; | 754 HashMap entries_map_; |
754 List<EntryInfo>* entries_; | 755 List<EntryInfo>* entries_; |
755 | 756 |
756 DISALLOW_COPY_AND_ASSIGN(HeapObjectsMap); | 757 DISALLOW_COPY_AND_ASSIGN(HeapObjectsMap); |
757 }; | 758 }; |
758 | 759 |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
881 private: | 882 private: |
882 struct EntryInfo { | 883 struct EntryInfo { |
883 explicit EntryInfo(HeapEntry* entry) | 884 explicit EntryInfo(HeapEntry* entry) |
884 : entry(entry), children_count(0), retainers_count(0) { } | 885 : entry(entry), children_count(0), retainers_count(0) { } |
885 HeapEntry* entry; | 886 HeapEntry* entry; |
886 int children_count; | 887 int children_count; |
887 int retainers_count; | 888 int retainers_count; |
888 }; | 889 }; |
889 | 890 |
890 uint32_t Hash(HeapObject* object) { | 891 uint32_t Hash(HeapObject* object) { |
891 return static_cast<uint32_t>(reinterpret_cast<intptr_t>(object)); | 892 return ComputeIntegerHash( |
| 893 static_cast<uint32_t>(reinterpret_cast<uintptr_t>(object))); |
892 } | 894 } |
893 static bool HeapObjectsMatch(void* key1, void* key2) { return key1 == key2; } | 895 static bool HeapObjectsMatch(void* key1, void* key2) { return key1 == key2; } |
894 | 896 |
895 bool IsAlias(void* ptr) { | 897 bool IsAlias(void* ptr) { |
896 return reinterpret_cast<intptr_t>(ptr) & kAliasTag; | 898 return reinterpret_cast<intptr_t>(ptr) & kAliasTag; |
897 } | 899 } |
898 void* MakeAlias(void* ptr) { | 900 void* MakeAlias(void* ptr) { |
899 return reinterpret_cast<void*>(reinterpret_cast<intptr_t>(ptr) | kAliasTag); | 901 return reinterpret_cast<void*>(reinterpret_cast<intptr_t>(ptr) | kAliasTag); |
900 } | 902 } |
901 void* Unalias(void* ptr) { | 903 void* Unalias(void* ptr) { |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
988 writer_(NULL) { | 990 writer_(NULL) { |
989 } | 991 } |
990 void Serialize(v8::OutputStream* stream); | 992 void Serialize(v8::OutputStream* stream); |
991 | 993 |
992 private: | 994 private: |
993 INLINE(static bool ObjectsMatch(void* key1, void* key2)) { | 995 INLINE(static bool ObjectsMatch(void* key1, void* key2)) { |
994 return key1 == key2; | 996 return key1 == key2; |
995 } | 997 } |
996 | 998 |
997 INLINE(static uint32_t ObjectHash(const void* key)) { | 999 INLINE(static uint32_t ObjectHash(const void* key)) { |
998 return static_cast<int32_t>(reinterpret_cast<intptr_t>(key)); | 1000 return ComputeIntegerHash( |
| 1001 static_cast<uint32_t>(reinterpret_cast<uintptr_t>(key))); |
999 } | 1002 } |
1000 | 1003 |
1001 void EnumerateNodes(); | 1004 void EnumerateNodes(); |
1002 int GetNodeId(HeapEntry* entry); | 1005 int GetNodeId(HeapEntry* entry); |
1003 int GetStringId(const char* s); | 1006 int GetStringId(const char* s); |
1004 void SerializeEdge(HeapGraphEdge* edge); | 1007 void SerializeEdge(HeapGraphEdge* edge); |
1005 void SerializeImpl(); | 1008 void SerializeImpl(); |
1006 void SerializeNode(HeapEntry* entry); | 1009 void SerializeNode(HeapEntry* entry); |
1007 void SerializeNodes(); | 1010 void SerializeNodes(); |
1008 void SerializeSnapshot(); | 1011 void SerializeSnapshot(); |
(...skipping 12 matching lines...) Expand all Loading... |
1021 friend class HeapSnapshotJSONSerializerIterator; | 1024 friend class HeapSnapshotJSONSerializerIterator; |
1022 | 1025 |
1023 DISALLOW_COPY_AND_ASSIGN(HeapSnapshotJSONSerializer); | 1026 DISALLOW_COPY_AND_ASSIGN(HeapSnapshotJSONSerializer); |
1024 }; | 1027 }; |
1025 | 1028 |
1026 } } // namespace v8::internal | 1029 } } // namespace v8::internal |
1027 | 1030 |
1028 #endif // ENABLE_LOGGING_AND_PROFILING | 1031 #endif // ENABLE_LOGGING_AND_PROFILING |
1029 | 1032 |
1030 #endif // V8_PROFILE_GENERATOR_H_ | 1033 #endif // V8_PROFILE_GENERATOR_H_ |
OLD | NEW |