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 1113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1124 switch (type()) { | 1124 switch (type()) { |
1125 case kHidden: return "/hidden/"; | 1125 case kHidden: return "/hidden/"; |
1126 case kObject: return "/object/"; | 1126 case kObject: return "/object/"; |
1127 case kClosure: return "/closure/"; | 1127 case kClosure: return "/closure/"; |
1128 case kString: return "/string/"; | 1128 case kString: return "/string/"; |
1129 case kCode: return "/code/"; | 1129 case kCode: return "/code/"; |
1130 case kArray: return "/array/"; | 1130 case kArray: return "/array/"; |
1131 case kRegExp: return "/regexp/"; | 1131 case kRegExp: return "/regexp/"; |
1132 case kHeapNumber: return "/number/"; | 1132 case kHeapNumber: return "/number/"; |
1133 case kNative: return "/native/"; | 1133 case kNative: return "/native/"; |
| 1134 case kArtificial: return "/artificial/"; |
1134 default: return "???"; | 1135 default: return "???"; |
1135 } | 1136 } |
1136 } | 1137 } |
1137 | 1138 |
1138 | 1139 |
1139 int HeapEntry::EntriesSize(int entries_count, | 1140 int HeapEntry::EntriesSize(int entries_count, |
1140 int children_count, | 1141 int children_count, |
1141 int retainers_count) { | 1142 int retainers_count) { |
1142 return sizeof(HeapEntry) * entries_count // NOLINT | 1143 return sizeof(HeapEntry) * entries_count // NOLINT |
1143 + sizeof(HeapGraphEdge) * children_count // NOLINT | 1144 + sizeof(HeapGraphEdge) * children_count // NOLINT |
(...skipping 1587 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2731 } | 2732 } |
2732 | 2733 |
2733 | 2734 |
2734 HeapEntry* NativeObjectsExplorer::AllocateEntry( | 2735 HeapEntry* NativeObjectsExplorer::AllocateEntry( |
2735 HeapThing ptr, int children_count, int retainers_count) { | 2736 HeapThing ptr, int children_count, int retainers_count) { |
2736 v8::RetainedObjectInfo* info = | 2737 v8::RetainedObjectInfo* info = |
2737 reinterpret_cast<v8::RetainedObjectInfo*>(ptr); | 2738 reinterpret_cast<v8::RetainedObjectInfo*>(ptr); |
2738 intptr_t elements = info->GetElementCount(); | 2739 intptr_t elements = info->GetElementCount(); |
2739 intptr_t size = info->GetSizeInBytes(); | 2740 intptr_t size = info->GetSizeInBytes(); |
2740 return snapshot_->AddEntry( | 2741 return snapshot_->AddEntry( |
2741 HeapEntry::kNative, | 2742 static_cast<HeapEntry::Type>(info->GetType()), |
2742 elements != -1 ? | 2743 elements != -1 ? |
2743 collection_->names()->GetFormatted( | 2744 collection_->names()->GetFormatted( |
2744 "%s / %" V8_PTR_PREFIX "d entries", | 2745 "%s / %" V8_PTR_PREFIX "d entries", |
2745 info->GetLabel(), | 2746 info->GetLabel(), |
2746 info->GetElementCount()) : | 2747 info->GetElementCount()) : |
2747 collection_->names()->GetCopy(info->GetLabel()), | 2748 collection_->names()->GetCopy(info->GetLabel()), |
2748 HeapObjectsMap::GenerateId(info), | 2749 HeapObjectsMap::GenerateId(info), |
2749 size != -1 ? static_cast<int>(size) : 0, | 2750 size != -1 ? static_cast<int>(size) : 0, |
2750 children_count, | 2751 children_count, |
2751 retainers_count); | 2752 retainers_count); |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2855 virtual void Dispose() { | 2856 virtual void Dispose() { |
2856 CHECK(!disposed_); | 2857 CHECK(!disposed_); |
2857 disposed_ = true; | 2858 disposed_ = true; |
2858 delete this; | 2859 delete this; |
2859 } | 2860 } |
2860 virtual bool IsEquivalent(RetainedObjectInfo* other) { | 2861 virtual bool IsEquivalent(RetainedObjectInfo* other) { |
2861 return hash_ == other->GetHash() && !strcmp(label_, other->GetLabel()); | 2862 return hash_ == other->GetHash() && !strcmp(label_, other->GetLabel()); |
2862 } | 2863 } |
2863 virtual intptr_t GetHash() { return hash_; } | 2864 virtual intptr_t GetHash() { return hash_; } |
2864 virtual const char* GetLabel() { return label_; } | 2865 virtual const char* GetLabel() { return label_; } |
| 2866 virtual HeapGraphNode::Type GetType() const { |
| 2867 return HeapGraphNode::kArtificial; |
| 2868 } |
2865 | 2869 |
2866 private: | 2870 private: |
2867 bool disposed_; | 2871 bool disposed_; |
2868 intptr_t hash_; | 2872 intptr_t hash_; |
2869 const char* label_; | 2873 const char* label_; |
2870 }; | 2874 }; |
2871 | 2875 |
2872 | 2876 |
2873 NativeGroupRetainedObjectInfo* NativeObjectsExplorer::FindOrAddGroupInfo( | 2877 NativeGroupRetainedObjectInfo* NativeObjectsExplorer::FindOrAddGroupInfo( |
2874 const char* label) { | 2878 const char* label) { |
(...skipping 665 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3540 "," JSON_S("types") ":" JSON_A( | 3544 "," JSON_S("types") ":" JSON_A( |
3541 JSON_A( | 3545 JSON_A( |
3542 JSON_S("hidden") | 3546 JSON_S("hidden") |
3543 "," JSON_S("array") | 3547 "," JSON_S("array") |
3544 "," JSON_S("string") | 3548 "," JSON_S("string") |
3545 "," JSON_S("object") | 3549 "," JSON_S("object") |
3546 "," JSON_S("code") | 3550 "," JSON_S("code") |
3547 "," JSON_S("closure") | 3551 "," JSON_S("closure") |
3548 "," JSON_S("regexp") | 3552 "," JSON_S("regexp") |
3549 "," JSON_S("number") | 3553 "," JSON_S("number") |
3550 "," JSON_S("native")) | 3554 "," JSON_S("native") |
| 3555 "," JSON_S("artificial")) |
3551 "," JSON_S("string") | 3556 "," JSON_S("string") |
3552 "," JSON_S("number") | 3557 "," JSON_S("number") |
3553 "," JSON_S("number") | 3558 "," JSON_S("number") |
3554 "," JSON_S("number") | 3559 "," JSON_S("number") |
3555 "," JSON_S("number") | 3560 "," JSON_S("number") |
3556 "," JSON_S("number") | 3561 "," JSON_S("number") |
3557 "," JSON_O( | 3562 "," JSON_O( |
3558 JSON_S("fields") ":" JSON_A( | 3563 JSON_S("fields") ":" JSON_A( |
3559 JSON_S("type") | 3564 JSON_S("type") |
3560 "," JSON_S("name_or_index") | 3565 "," JSON_S("name_or_index") |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3695 | 3700 |
3696 | 3701 |
3697 void HeapSnapshotJSONSerializer::SortHashMap( | 3702 void HeapSnapshotJSONSerializer::SortHashMap( |
3698 HashMap* map, List<HashMap::Entry*>* sorted_entries) { | 3703 HashMap* map, List<HashMap::Entry*>* sorted_entries) { |
3699 for (HashMap::Entry* p = map->Start(); p != NULL; p = map->Next(p)) | 3704 for (HashMap::Entry* p = map->Start(); p != NULL; p = map->Next(p)) |
3700 sorted_entries->Add(p); | 3705 sorted_entries->Add(p); |
3701 sorted_entries->Sort(SortUsingEntryValue); | 3706 sorted_entries->Sort(SortUsingEntryValue); |
3702 } | 3707 } |
3703 | 3708 |
3704 } } // namespace v8::internal | 3709 } } // namespace v8::internal |
OLD | NEW |