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 1115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1126 const char* title, | 1126 const char* title, |
1127 unsigned uid) | 1127 unsigned uid) |
1128 : collection_(collection), | 1128 : collection_(collection), |
1129 type_(type), | 1129 type_(type), |
1130 title_(title), | 1130 title_(title), |
1131 uid_(uid), | 1131 uid_(uid), |
1132 root_entry_(NULL), | 1132 root_entry_(NULL), |
1133 gc_roots_entry_(NULL), | 1133 gc_roots_entry_(NULL), |
1134 natives_root_entry_(NULL), | 1134 natives_root_entry_(NULL), |
1135 raw_entries_(NULL), | 1135 raw_entries_(NULL), |
1136 entries_sorted_(false), | 1136 entries_sorted_(false) { |
1137 max_snapshot_js_object_id_(0) { | |
1138 STATIC_CHECK( | 1137 STATIC_CHECK( |
1139 sizeof(HeapGraphEdge) == | 1138 sizeof(HeapGraphEdge) == |
1140 SnapshotSizeConstants<kPointerSize>::kExpectedHeapGraphEdgeSize); | 1139 SnapshotSizeConstants<kPointerSize>::kExpectedHeapGraphEdgeSize); |
1141 STATIC_CHECK( | 1140 STATIC_CHECK( |
1142 sizeof(HeapEntry) == | 1141 sizeof(HeapEntry) == |
1143 SnapshotSizeConstants<kPointerSize>::kExpectedHeapEntrySize); | 1142 SnapshotSizeConstants<kPointerSize>::kExpectedHeapEntrySize); |
1144 for (int i = 0; i < VisitorSynchronization::kNumberOfSyncTags; ++i) { | 1143 for (int i = 0; i < VisitorSynchronization::kNumberOfSyncTags; ++i) { |
1145 gc_subroot_entries_[i] = NULL; | 1144 gc_subroot_entries_[i] = NULL; |
1146 } | 1145 } |
1147 } | 1146 } |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1217 | 1216 |
1218 | 1217 |
1219 HeapEntry* HeapSnapshot::AddEntry(HeapEntry::Type type, | 1218 HeapEntry* HeapSnapshot::AddEntry(HeapEntry::Type type, |
1220 const char* name, | 1219 const char* name, |
1221 SnapshotObjectId id, | 1220 SnapshotObjectId id, |
1222 int size, | 1221 int size, |
1223 int children_count, | 1222 int children_count, |
1224 int retainers_count) { | 1223 int retainers_count) { |
1225 HeapEntry* entry = GetNextEntryToInit(); | 1224 HeapEntry* entry = GetNextEntryToInit(); |
1226 entry->Init(this, type, name, id, size, children_count, retainers_count); | 1225 entry->Init(this, type, name, id, size, children_count, retainers_count); |
1227 | |
1228 // Track only js objects. They have odd ids. | |
1229 if (id % HeapObjectsMap::kObjectIdStep && id > max_snapshot_js_object_id_) | |
1230 max_snapshot_js_object_id_ = id; | |
1231 | |
1232 return entry; | 1226 return entry; |
1233 } | 1227 } |
1234 | 1228 |
1235 | 1229 |
1236 void HeapSnapshot::SetDominatorsToSelf() { | 1230 void HeapSnapshot::SetDominatorsToSelf() { |
1237 for (int i = 0; i < entries_.length(); ++i) { | 1231 for (int i = 0; i < entries_.length(); ++i) { |
1238 HeapEntry* entry = entries_[i]; | 1232 HeapEntry* entry = entries_[i]; |
1239 if (entry->dominator() == NULL) entry->set_dominator(entry); | 1233 if (entry->dominator() == NULL) entry->set_dominator(entry); |
1240 } | 1234 } |
1241 } | 1235 } |
(...skipping 2495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3737 | 3731 |
3738 | 3732 |
3739 void HeapSnapshotJSONSerializer::SortHashMap( | 3733 void HeapSnapshotJSONSerializer::SortHashMap( |
3740 HashMap* map, List<HashMap::Entry*>* sorted_entries) { | 3734 HashMap* map, List<HashMap::Entry*>* sorted_entries) { |
3741 for (HashMap::Entry* p = map->Start(); p != NULL; p = map->Next(p)) | 3735 for (HashMap::Entry* p = map->Start(); p != NULL; p = map->Next(p)) |
3742 sorted_entries->Add(p); | 3736 sorted_entries->Add(p); |
3743 sorted_entries->Sort(SortUsingEntryValue); | 3737 sorted_entries->Sort(SortUsingEntryValue); |
3744 } | 3738 } |
3745 | 3739 |
3746 } } // namespace v8::internal | 3740 } } // namespace v8::internal |
OLD | NEW |