| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 913 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 924 // If no frames were symbolized, put the VM state entry in. | 924 // If no frames were symbolized, put the VM state entry in. |
| 925 if (no_symbolized_entries) { | 925 if (no_symbolized_entries) { |
| 926 *entry++ = EntryForVMState(sample.state); | 926 *entry++ = EntryForVMState(sample.state); |
| 927 } | 927 } |
| 928 } | 928 } |
| 929 | 929 |
| 930 profiles_->AddPathToCurrentProfiles(entries); | 930 profiles_->AddPathToCurrentProfiles(entries); |
| 931 } | 931 } |
| 932 | 932 |
| 933 | 933 |
| 934 HeapGraphEdge::HeapGraphEdge( | 934 HeapGraphEdge::HeapGraphEdge(Type type, const char* name, int from, int to) |
| 935 Type type, const char* name, int from, int to) : | 935 : type_(type), |
| 936 type_(type), | 936 from_index_(from), |
| 937 from_index_(from), | 937 to_index_(to), |
| 938 to_index_(to), | 938 name_(name) { |
| 939 name_(name) { | |
| 940 ASSERT(type == kContextVariable | 939 ASSERT(type == kContextVariable |
| 941 || type == kProperty | 940 || type == kProperty |
| 942 || type == kInternal | 941 || type == kInternal |
| 943 || type == kShortcut); | 942 || type == kShortcut); |
| 944 } | 943 } |
| 945 | 944 |
| 946 | 945 |
| 947 HeapGraphEdge::HeapGraphEdge(Type type, int index, int from, int to) : | 946 HeapGraphEdge::HeapGraphEdge(Type type, int index, int from, int to) |
| 948 type_(type), | 947 : type_(type), |
| 949 from_index_(from), | 948 from_index_(from), |
| 950 to_index_(to), | 949 to_index_(to), |
| 951 index_(index) { | 950 index_(index) { |
| 952 ASSERT(type == kElement || type == kHidden || type == kWeak); | 951 ASSERT(type == kElement || type == kHidden || type == kWeak); |
| 953 } | 952 } |
| 954 | 953 |
| 955 | 954 |
| 956 void HeapGraphEdge::ReplaceToIndexWithEntry(HeapSnapshot* snapshot) { | 955 void HeapGraphEdge::ReplaceToIndexWithEntry(HeapSnapshot* snapshot) { |
| 957 to_entry_ = &snapshot->entries()[to_index_]; | 956 to_entry_ = &snapshot->entries()[to_index_]; |
| 958 } | 957 } |
| 959 | 958 |
| 960 | 959 |
| 961 const int HeapEntry::kNoEntry = -1; | 960 const int HeapEntry::kNoEntry = -1; |
| 962 | 961 |
| 963 HeapEntry::HeapEntry(HeapSnapshot* snapshot, | 962 HeapEntry::HeapEntry(HeapSnapshot* snapshot, |
| 964 Type type, | 963 Type type, |
| 965 const char* name, | 964 const char* name, |
| 966 SnapshotObjectId id, | 965 SnapshotObjectId id, |
| 967 int self_size) : | 966 int self_size) |
| 968 painted_(false), | 967 : painted_(false), |
| 969 user_reachable_(false), | 968 user_reachable_(false), |
| 970 dominator_(kNoEntry), | 969 dominator_(kNoEntry), |
| 971 type_(type), | 970 type_(type), |
| 972 retainers_count_(0), | 971 retainers_count_(0), |
| 973 retainers_index_(-1), | 972 retainers_index_(-1), |
| 974 children_count_(0), | 973 children_count_(0), |
| 975 children_index_(-1), | 974 children_index_(-1), |
| 976 self_size_(self_size), | 975 self_size_(self_size), |
| 977 retained_size_(0), | 976 retained_size_(0), |
| 978 id_(id), | 977 id_(id), |
| 979 snapshot_(snapshot), | 978 snapshot_(snapshot), |
| 980 name_(name) { } | 979 name_(name) { } |
| 981 | 980 |
| 982 | 981 |
| 983 void HeapEntry::SetNamedReference(HeapGraphEdge::Type type, | 982 void HeapEntry::SetNamedReference(HeapGraphEdge::Type type, |
| 984 const char* name, | 983 const char* name, |
| 985 HeapEntry* entry) { | 984 HeapEntry* entry) { |
| 986 HeapGraphEdge edge(type, name, this->index(), entry->index()); | 985 HeapGraphEdge edge(type, name, this->index(), entry->index()); |
| 987 snapshot_->edges().Add(edge); | 986 snapshot_->edges().Add(edge); |
| 988 ++children_count_; | 987 ++children_count_; |
| 989 ++entry->retainers_count_; | 988 ++entry->retainers_count_; |
| 990 } | 989 } |
| (...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1268 return &sorted_entries_; | 1267 return &sorted_entries_; |
| 1269 } | 1268 } |
| 1270 | 1269 |
| 1271 | 1270 |
| 1272 void HeapSnapshot::Print(int max_depth) { | 1271 void HeapSnapshot::Print(int max_depth) { |
| 1273 root()->Print("", "", max_depth, 0); | 1272 root()->Print("", "", max_depth, 0); |
| 1274 } | 1273 } |
| 1275 | 1274 |
| 1276 | 1275 |
| 1277 template<typename T, class P> | 1276 template<typename T, class P> |
| 1278 static size_t GetMemoryUsedByList(const List<T,P>& list) { | 1277 static size_t GetMemoryUsedByList(const List<T, P>& list) { |
| 1279 return list.capacity() * sizeof(T); | 1278 return list.capacity() * sizeof(T); |
| 1280 } | 1279 } |
| 1281 | 1280 |
| 1282 | 1281 |
| 1283 size_t HeapSnapshot::RawSnapshotSize() const { | 1282 size_t HeapSnapshot::RawSnapshotSize() const { |
| 1284 return | 1283 return |
| 1285 GetMemoryUsedByList(entries_) + | 1284 GetMemoryUsedByList(entries_) + |
| 1286 GetMemoryUsedByList(edges_) + | 1285 GetMemoryUsedByList(edges_) + |
| 1287 GetMemoryUsedByList(children_) + | 1286 GetMemoryUsedByList(children_) + |
| 1288 GetMemoryUsedByList(retainers_) + | 1287 GetMemoryUsedByList(retainers_) + |
| (...skipping 2490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3779 | 3778 |
| 3780 | 3779 |
| 3781 void HeapSnapshotJSONSerializer::SortHashMap( | 3780 void HeapSnapshotJSONSerializer::SortHashMap( |
| 3782 HashMap* map, List<HashMap::Entry*>* sorted_entries) { | 3781 HashMap* map, List<HashMap::Entry*>* sorted_entries) { |
| 3783 for (HashMap::Entry* p = map->Start(); p != NULL; p = map->Next(p)) | 3782 for (HashMap::Entry* p = map->Start(); p != NULL; p = map->Next(p)) |
| 3784 sorted_entries->Add(p); | 3783 sorted_entries->Add(p); |
| 3785 sorted_entries->Sort(SortUsingEntryValue); | 3784 sorted_entries->Sort(SortUsingEntryValue); |
| 3786 } | 3785 } |
| 3787 | 3786 |
| 3788 } } // namespace v8::internal | 3787 } } // namespace v8::internal |
| OLD | NEW |