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 1243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1254 } | 1254 } |
1255 | 1255 |
1256 | 1256 |
1257 template<typename T, class P> | 1257 template<typename T, class P> |
1258 static size_t GetMemoryUsedByList(const List<T, P>& list) { | 1258 static size_t GetMemoryUsedByList(const List<T, P>& list) { |
1259 return list.length() * sizeof(T) + sizeof(list); | 1259 return list.length() * sizeof(T) + sizeof(list); |
1260 } | 1260 } |
1261 | 1261 |
1262 | 1262 |
1263 size_t HeapSnapshot::RawSnapshotSize() const { | 1263 size_t HeapSnapshot::RawSnapshotSize() const { |
1264 STATIC_CHECK(sizeof(*this) == | 1264 STATIC_CHECK(SnapshotSizeConstants<kPointerSize>::kExpectedHeapSnapshotSize == |
1265 SnapshotSizeConstants<kPointerSize>::kExpectedHeapSnapshotSize); | 1265 sizeof(HeapSnapshot)); // NOLINT |
1266 return | 1266 return |
1267 sizeof(*this) + | 1267 sizeof(*this) + |
1268 GetMemoryUsedByList(entries_) + | 1268 GetMemoryUsedByList(entries_) + |
1269 GetMemoryUsedByList(edges_) + | 1269 GetMemoryUsedByList(edges_) + |
1270 GetMemoryUsedByList(children_) + | 1270 GetMemoryUsedByList(children_) + |
1271 GetMemoryUsedByList(sorted_entries_); | 1271 GetMemoryUsedByList(sorted_entries_); |
1272 } | 1272 } |
1273 | 1273 |
1274 | 1274 |
1275 // We split IDs on evens for embedder objects (see | 1275 // We split IDs on evens for embedder objects (see |
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1544 ASSERT(object == NULL); | 1544 ASSERT(object == NULL); |
1545 object = obj; | 1545 object = obj; |
1546 // Can't break -- kFilterUnreachable requires full heap traversal. | 1546 // Can't break -- kFilterUnreachable requires full heap traversal. |
1547 } | 1547 } |
1548 } | 1548 } |
1549 return object != NULL ? Handle<HeapObject>(object) : Handle<HeapObject>(); | 1549 return object != NULL ? Handle<HeapObject>(object) : Handle<HeapObject>(); |
1550 } | 1550 } |
1551 | 1551 |
1552 | 1552 |
1553 size_t HeapSnapshotsCollection::GetUsedMemorySize() const { | 1553 size_t HeapSnapshotsCollection::GetUsedMemorySize() const { |
1554 STATIC_CHECK( | 1554 STATIC_CHECK(SnapshotSizeConstants<kPointerSize>:: |
1555 sizeof(*this) == SnapshotSizeConstants<kPointerSize>:: | 1555 kExpectedHeapSnapshotsCollectionSize == |
1556 kExpectedHeapSnapshotsCollectionSize); | 1556 sizeof(HeapSnapshotsCollection)); // NOLINT |
1557 size_t size = sizeof(*this); | 1557 size_t size = sizeof(*this); |
1558 size += names_.GetUsedMemorySize(); | 1558 size += names_.GetUsedMemorySize(); |
1559 size += ids_.GetUsedMemorySize(); | 1559 size += ids_.GetUsedMemorySize(); |
1560 size += sizeof(HashMap::Entry) * snapshots_uids_.capacity(); | 1560 size += sizeof(HashMap::Entry) * snapshots_uids_.capacity(); |
1561 size += GetMemoryUsedByList(snapshots_); | 1561 size += GetMemoryUsedByList(snapshots_); |
1562 for (int i = 0; i < snapshots_.length(); ++i) { | 1562 for (int i = 0; i < snapshots_.length(); ++i) { |
1563 size += snapshots_[i]->RawSnapshotSize(); | 1563 size += snapshots_[i]->RawSnapshotSize(); |
1564 } | 1564 } |
1565 return size; | 1565 return size; |
1566 } | 1566 } |
(...skipping 1990 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3557 | 3557 |
3558 | 3558 |
3559 void HeapSnapshotJSONSerializer::SortHashMap( | 3559 void HeapSnapshotJSONSerializer::SortHashMap( |
3560 HashMap* map, List<HashMap::Entry*>* sorted_entries) { | 3560 HashMap* map, List<HashMap::Entry*>* sorted_entries) { |
3561 for (HashMap::Entry* p = map->Start(); p != NULL; p = map->Next(p)) | 3561 for (HashMap::Entry* p = map->Start(); p != NULL; p = map->Next(p)) |
3562 sorted_entries->Add(p); | 3562 sorted_entries->Add(p); |
3563 sorted_entries->Sort(SortUsingEntryValue); | 3563 sorted_entries->Sort(SortUsingEntryValue); |
3564 } | 3564 } |
3565 | 3565 |
3566 } } // namespace v8::internal | 3566 } } // namespace v8::internal |
OLD | NEW |