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 806 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
817 to_ = to; | 817 to_ = to; |
818 } | 818 } |
819 | 819 |
820 | 820 |
821 HeapEntry* HeapGraphEdge::From() { | 821 HeapEntry* HeapGraphEdge::From() { |
822 return reinterpret_cast<HeapEntry*>(this - child_index_) - 1; | 822 return reinterpret_cast<HeapEntry*>(this - child_index_) - 1; |
823 } | 823 } |
824 | 824 |
825 | 825 |
826 void HeapEntry::Init(HeapSnapshot* snapshot, | 826 void HeapEntry::Init(HeapSnapshot* snapshot, |
827 int children_count, | |
828 int retainers_count) { | |
829 Init(snapshot, kInternal, "", 0, 0, children_count, retainers_count); | |
830 } | |
831 | |
832 | |
833 void HeapEntry::Init(HeapSnapshot* snapshot, | |
834 Type type, | 827 Type type, |
835 const char* name, | 828 const char* name, |
836 uint64_t id, | 829 uint64_t id, |
837 int self_size, | 830 int self_size, |
838 int children_count, | 831 int children_count, |
839 int retainers_count) { | 832 int retainers_count) { |
840 snapshot_ = snapshot; | 833 snapshot_ = snapshot; |
841 type_ = type; | 834 type_ = type; |
842 painted_ = kUnpainted; | 835 painted_ = kUnpainted; |
843 calculated_data_index_ = kNoCalculatedData; | 836 calculated_data_index_ = kNoCalculatedData; |
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1203 }; | 1196 }; |
1204 | 1197 |
1205 template <> struct SnapshotSizeConstants<8> { | 1198 template <> struct SnapshotSizeConstants<8> { |
1206 static const int kExpectedHeapGraphEdgeSize = 24; | 1199 static const int kExpectedHeapGraphEdgeSize = 24; |
1207 static const int kExpectedHeapEntrySize = 40; | 1200 static const int kExpectedHeapEntrySize = 40; |
1208 }; | 1201 }; |
1209 | 1202 |
1210 } // namespace | 1203 } // namespace |
1211 | 1204 |
1212 HeapSnapshot::HeapSnapshot(HeapSnapshotsCollection* collection, | 1205 HeapSnapshot::HeapSnapshot(HeapSnapshotsCollection* collection, |
| 1206 HeapSnapshot::Type type, |
1213 const char* title, | 1207 const char* title, |
1214 unsigned uid) | 1208 unsigned uid) |
1215 : collection_(collection), | 1209 : collection_(collection), |
| 1210 type_(type), |
1216 title_(title), | 1211 title_(title), |
1217 uid_(uid), | 1212 uid_(uid), |
1218 root_entry_index_(-1), | 1213 root_entry_index_(-1), |
1219 raw_entries_(NULL), | 1214 raw_entries_(NULL), |
1220 entries_sorted_(false) { | 1215 entries_sorted_(false) { |
1221 STATIC_ASSERT( | 1216 STATIC_ASSERT( |
1222 sizeof(HeapGraphEdge) == | 1217 sizeof(HeapGraphEdge) == |
1223 SnapshotSizeConstants<sizeof(void*)>::kExpectedHeapGraphEdgeSize); // NOL
INT | 1218 SnapshotSizeConstants<sizeof(void*)>::kExpectedHeapGraphEdgeSize); // NOL
INT |
1224 STATIC_ASSERT( | 1219 STATIC_ASSERT( |
1225 sizeof(HeapEntry) == | 1220 sizeof(HeapEntry) == |
(...skipping 10 matching lines...) Expand all Loading... |
1236 calculated_data_.Iterate(DisposeCalculatedData); | 1231 calculated_data_.Iterate(DisposeCalculatedData); |
1237 } | 1232 } |
1238 | 1233 |
1239 | 1234 |
1240 void HeapSnapshot::AllocateEntries(int entries_count, | 1235 void HeapSnapshot::AllocateEntries(int entries_count, |
1241 int children_count, | 1236 int children_count, |
1242 int retainers_count) { | 1237 int retainers_count) { |
1243 ASSERT(raw_entries_ == NULL); | 1238 ASSERT(raw_entries_ == NULL); |
1244 raw_entries_ = NewArray<char>( | 1239 raw_entries_ = NewArray<char>( |
1245 HeapEntry::EntriesSize(entries_count, children_count, retainers_count)); | 1240 HeapEntry::EntriesSize(entries_count, children_count, retainers_count)); |
| 1241 #ifdef DEBUG |
| 1242 raw_entries_size_ = |
| 1243 HeapEntry::EntriesSize(entries_count, children_count, retainers_count); |
| 1244 #endif |
1246 } | 1245 } |
1247 | 1246 |
1248 | 1247 |
1249 HeapEntry* HeapSnapshot::AddEntry(HeapObject* object, | 1248 HeapEntry* HeapSnapshot::AddEntry(HeapObject* object, |
1250 int children_count, | 1249 int children_count, |
1251 int retainers_count) { | 1250 int retainers_count) { |
1252 if (object == kInternalRootObject) { | 1251 if (object == kInternalRootObject) { |
1253 ASSERT(root_entry_index_ == -1); | 1252 ASSERT(root_entry_index_ == -1); |
1254 root_entry_index_ = entries_.length(); | 1253 root_entry_index_ = entries_.length(); |
1255 HeapEntry* entry = GetNextEntryToInit(); | 1254 ASSERT(retainers_count == 0); |
1256 entry->Init(this, children_count, retainers_count); | 1255 return AddEntry( |
1257 return entry; | 1256 HeapEntry::kInternal, "", 0, 0, children_count, retainers_count); |
1258 } else if (object->IsJSFunction()) { | 1257 } else if (object->IsJSFunction()) { |
1259 JSFunction* func = JSFunction::cast(object); | 1258 JSFunction* func = JSFunction::cast(object); |
1260 SharedFunctionInfo* shared = func->shared(); | 1259 SharedFunctionInfo* shared = func->shared(); |
1261 String* name = String::cast(shared->name())->length() > 0 ? | 1260 String* name = String::cast(shared->name())->length() > 0 ? |
1262 String::cast(shared->name()) : shared->inferred_name(); | 1261 String::cast(shared->name()) : shared->inferred_name(); |
1263 return AddEntry(object, | 1262 return AddEntry(object, |
1264 HeapEntry::kClosure, | 1263 HeapEntry::kClosure, |
1265 collection_->GetName(name), | 1264 collection_->GetFunctionName(name), |
1266 children_count, | 1265 children_count, |
1267 retainers_count); | 1266 retainers_count); |
1268 } else if (object->IsJSObject()) { | 1267 } else if (object->IsJSObject()) { |
1269 return AddEntry(object, | 1268 return AddEntry(object, |
1270 HeapEntry::kObject, | 1269 HeapEntry::kObject, |
1271 collection_->GetName( | 1270 collection_->GetName( |
1272 JSObject::cast(object)->constructor_name()), | 1271 JSObject::cast(object)->constructor_name()), |
1273 children_count, | 1272 children_count, |
1274 retainers_count); | 1273 retainers_count); |
1275 } else if (object->IsString()) { | 1274 } else if (object->IsString()) { |
1276 return AddEntry(object, | 1275 return AddEntry(object, |
1277 HeapEntry::kString, | 1276 HeapEntry::kString, |
1278 collection_->GetName(String::cast(object)), | 1277 collection_->GetName(String::cast(object)), |
1279 children_count, | 1278 children_count, |
1280 retainers_count); | 1279 retainers_count); |
1281 } else if (object->IsCode()) { | 1280 } else if (object->IsCode()) { |
1282 return AddEntry(object, | 1281 return AddEntry(object, |
1283 HeapEntry::kCode, | 1282 HeapEntry::kCode, |
1284 "", | 1283 "", |
1285 children_count, | 1284 children_count, |
1286 retainers_count); | 1285 retainers_count); |
1287 } else if (object->IsSharedFunctionInfo()) { | 1286 } else if (object->IsSharedFunctionInfo()) { |
1288 SharedFunctionInfo* shared = SharedFunctionInfo::cast(object); | 1287 SharedFunctionInfo* shared = SharedFunctionInfo::cast(object); |
1289 String* name = String::cast(shared->name())->length() > 0 ? | 1288 String* name = String::cast(shared->name())->length() > 0 ? |
1290 String::cast(shared->name()) : shared->inferred_name(); | 1289 String::cast(shared->name()) : shared->inferred_name(); |
1291 return AddEntry(object, | 1290 return AddEntry(object, |
1292 HeapEntry::kCode, | 1291 HeapEntry::kCode, |
1293 collection_->GetName(name), | 1292 collection_->GetFunctionName(name), |
1294 children_count, | 1293 children_count, |
1295 retainers_count); | 1294 retainers_count); |
1296 } else if (object->IsScript()) { | 1295 } else if (object->IsScript()) { |
1297 Script* script = Script::cast(object); | 1296 Script* script = Script::cast(object); |
1298 return AddEntry(object, | 1297 return AddEntry(object, |
1299 HeapEntry::kCode, | 1298 HeapEntry::kCode, |
1300 script->name()->IsString() ? | 1299 script->name()->IsString() ? |
1301 collection_->GetName(String::cast(script->name())) : "", | 1300 collection_->GetName(String::cast(script->name())) : "", |
1302 children_count, | 1301 children_count, |
1303 retainers_count); | 1302 retainers_count); |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1338 calculated_data_.Add(HeapEntryCalculatedData()); | 1337 calculated_data_.Add(HeapEntryCalculatedData()); |
1339 return calculated_data_.length() - 1; | 1338 return calculated_data_.length() - 1; |
1340 } | 1339 } |
1341 | 1340 |
1342 | 1341 |
1343 HeapEntry* HeapSnapshot::AddEntry(HeapObject* object, | 1342 HeapEntry* HeapSnapshot::AddEntry(HeapObject* object, |
1344 HeapEntry::Type type, | 1343 HeapEntry::Type type, |
1345 const char* name, | 1344 const char* name, |
1346 int children_count, | 1345 int children_count, |
1347 int retainers_count) { | 1346 int retainers_count) { |
| 1347 return AddEntry(type, |
| 1348 name, |
| 1349 collection_->GetObjectId(object->address()), |
| 1350 GetObjectSize(object), |
| 1351 children_count, |
| 1352 retainers_count); |
| 1353 } |
| 1354 |
| 1355 |
| 1356 HeapEntry* HeapSnapshot::AddEntry(HeapEntry::Type type, |
| 1357 const char* name, |
| 1358 uint64_t id, |
| 1359 int size, |
| 1360 int children_count, |
| 1361 int retainers_count) { |
1348 HeapEntry* entry = GetNextEntryToInit(); | 1362 HeapEntry* entry = GetNextEntryToInit(); |
1349 entry->Init(this, | 1363 entry->Init(this, type, name, id, size, children_count, retainers_count); |
1350 type, | |
1351 name, | |
1352 collection_->GetObjectId(object->address()), | |
1353 GetObjectSize(object), | |
1354 children_count, | |
1355 retainers_count); | |
1356 return entry; | 1364 return entry; |
1357 } | 1365 } |
1358 | 1366 |
1359 | 1367 |
1360 HeapEntry* HeapSnapshot::GetNextEntryToInit() { | 1368 HeapEntry* HeapSnapshot::GetNextEntryToInit() { |
1361 if (entries_.length() > 0) { | 1369 if (entries_.length() > 0) { |
1362 HeapEntry* last_entry = entries_.last(); | 1370 HeapEntry* last_entry = entries_.last(); |
1363 entries_.Add(reinterpret_cast<HeapEntry*>( | 1371 entries_.Add(reinterpret_cast<HeapEntry*>( |
1364 reinterpret_cast<char*>(last_entry) + last_entry->EntrySize())); | 1372 reinterpret_cast<char*>(last_entry) + last_entry->EntrySize())); |
1365 } else { | 1373 } else { |
1366 entries_.Add(reinterpret_cast<HeapEntry*>(raw_entries_)); | 1374 entries_.Add(reinterpret_cast<HeapEntry*>(raw_entries_)); |
1367 } | 1375 } |
| 1376 ASSERT(reinterpret_cast<char*>(entries_.last()) < |
| 1377 (raw_entries_ + raw_entries_size_)); |
1368 return entries_.last(); | 1378 return entries_.last(); |
1369 } | 1379 } |
1370 | 1380 |
1371 | 1381 |
1372 int HeapSnapshot::GetObjectSize(HeapObject* obj) { | 1382 int HeapSnapshot::GetObjectSize(HeapObject* obj) { |
1373 return obj->IsJSObject() ? | 1383 return obj->IsJSObject() ? |
1374 CalculateNetworkSize(JSObject::cast(obj)) : obj->Size(); | 1384 CalculateNetworkSize(JSObject::cast(obj)) : obj->Size(); |
1375 } | 1385 } |
1376 | 1386 |
1377 | 1387 |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1527 delete *snapshot_ptr; | 1537 delete *snapshot_ptr; |
1528 } | 1538 } |
1529 | 1539 |
1530 | 1540 |
1531 HeapSnapshotsCollection::~HeapSnapshotsCollection() { | 1541 HeapSnapshotsCollection::~HeapSnapshotsCollection() { |
1532 delete token_enumerator_; | 1542 delete token_enumerator_; |
1533 snapshots_.Iterate(DeleteHeapSnapshot); | 1543 snapshots_.Iterate(DeleteHeapSnapshot); |
1534 } | 1544 } |
1535 | 1545 |
1536 | 1546 |
1537 HeapSnapshot* HeapSnapshotsCollection::NewSnapshot(const char* name, | 1547 HeapSnapshot* HeapSnapshotsCollection::NewSnapshot(HeapSnapshot::Type type, |
| 1548 const char* name, |
1538 unsigned uid) { | 1549 unsigned uid) { |
1539 is_tracking_objects_ = true; // Start watching for heap objects moves. | 1550 is_tracking_objects_ = true; // Start watching for heap objects moves. |
1540 HeapSnapshot* snapshot = new HeapSnapshot(this, name, uid); | 1551 HeapSnapshot* snapshot = new HeapSnapshot(this, type, name, uid); |
1541 snapshots_.Add(snapshot); | 1552 snapshots_.Add(snapshot); |
1542 HashMap::Entry* entry = | 1553 HashMap::Entry* entry = |
1543 snapshots_uids_.Lookup(reinterpret_cast<void*>(snapshot->uid()), | 1554 snapshots_uids_.Lookup(reinterpret_cast<void*>(snapshot->uid()), |
1544 static_cast<uint32_t>(snapshot->uid()), | 1555 static_cast<uint32_t>(snapshot->uid()), |
1545 true); | 1556 true); |
1546 ASSERT(entry->value == NULL); | 1557 ASSERT(entry->value == NULL); |
1547 entry->value = snapshot; | 1558 entry->value = snapshot; |
1548 return snapshot; | 1559 return snapshot; |
1549 } | 1560 } |
1550 | 1561 |
1551 | 1562 |
1552 HeapSnapshot* HeapSnapshotsCollection::GetSnapshot(unsigned uid) { | 1563 HeapSnapshot* HeapSnapshotsCollection::GetSnapshot(unsigned uid) { |
1553 HashMap::Entry* entry = snapshots_uids_.Lookup(reinterpret_cast<void*>(uid), | 1564 HashMap::Entry* entry = snapshots_uids_.Lookup(reinterpret_cast<void*>(uid), |
1554 static_cast<uint32_t>(uid), | 1565 static_cast<uint32_t>(uid), |
1555 false); | 1566 false); |
1556 return entry != NULL ? reinterpret_cast<HeapSnapshot*>(entry->value) : NULL; | 1567 return entry != NULL ? reinterpret_cast<HeapSnapshot*>(entry->value) : NULL; |
1557 } | 1568 } |
1558 | 1569 |
1559 | 1570 |
1560 HeapSnapshotsDiff* HeapSnapshotsCollection::CompareSnapshots( | 1571 HeapSnapshotsDiff* HeapSnapshotsCollection::CompareSnapshots( |
1561 HeapSnapshot* snapshot1, | 1572 HeapSnapshot* snapshot1, |
1562 HeapSnapshot* snapshot2) { | 1573 HeapSnapshot* snapshot2) { |
1563 return comparator_.Compare(snapshot1, snapshot2); | 1574 return comparator_.Compare(snapshot1, snapshot2); |
1564 } | 1575 } |
1565 | 1576 |
1566 | 1577 |
| 1578 HeapEntry *const HeapEntriesMap::kHeapEntryPlaceholder = |
| 1579 reinterpret_cast<HeapEntry*>(1); |
| 1580 |
1567 HeapEntriesMap::HeapEntriesMap() | 1581 HeapEntriesMap::HeapEntriesMap() |
1568 : entries_(HeapObjectsMatch), | 1582 : entries_(HeapObjectsMatch), |
1569 entries_count_(0), | 1583 entries_count_(0), |
1570 total_children_count_(0), | 1584 total_children_count_(0), |
1571 total_retainers_count_(0) { | 1585 total_retainers_count_(0) { |
1572 } | 1586 } |
1573 | 1587 |
1574 | 1588 |
1575 HeapEntriesMap::~HeapEntriesMap() { | 1589 HeapEntriesMap::~HeapEntriesMap() { |
1576 for (HashMap::Entry* p = entries_.Start(); p != NULL; p = entries_.Next(p)) { | 1590 for (HashMap::Entry* p = entries_.Start(); p != NULL; p = entries_.Next(p)) { |
(...skipping 28 matching lines...) Expand all Loading... |
1605 HashMap::Entry* cache_entry = entries_.Lookup(object, Hash(object), true); | 1619 HashMap::Entry* cache_entry = entries_.Lookup(object, Hash(object), true); |
1606 ASSERT(cache_entry->value == NULL); | 1620 ASSERT(cache_entry->value == NULL); |
1607 cache_entry->value = new EntryInfo(entry); | 1621 cache_entry->value = new EntryInfo(entry); |
1608 ++entries_count_; | 1622 ++entries_count_; |
1609 } | 1623 } |
1610 | 1624 |
1611 | 1625 |
1612 void HeapEntriesMap::CountReference(HeapObject* from, HeapObject* to, | 1626 void HeapEntriesMap::CountReference(HeapObject* from, HeapObject* to, |
1613 int* prev_children_count, | 1627 int* prev_children_count, |
1614 int* prev_retainers_count) { | 1628 int* prev_retainers_count) { |
1615 HashMap::Entry* from_cache_entry = entries_.Lookup(from, Hash(from), true); | 1629 HashMap::Entry* from_cache_entry = entries_.Lookup(from, Hash(from), false); |
1616 HashMap::Entry* to_cache_entry = entries_.Lookup(to, Hash(to), false); | 1630 HashMap::Entry* to_cache_entry = entries_.Lookup(to, Hash(to), false); |
1617 ASSERT(from_cache_entry != NULL); | 1631 ASSERT(from_cache_entry != NULL); |
1618 ASSERT(to_cache_entry != NULL); | 1632 ASSERT(to_cache_entry != NULL); |
1619 EntryInfo* from_entry_info = | 1633 EntryInfo* from_entry_info = |
1620 reinterpret_cast<EntryInfo*>(Unalias(from_cache_entry->value)); | 1634 reinterpret_cast<EntryInfo*>(Unalias(from_cache_entry->value)); |
1621 EntryInfo* to_entry_info = | 1635 EntryInfo* to_entry_info = |
1622 reinterpret_cast<EntryInfo*>(Unalias(to_cache_entry->value)); | 1636 reinterpret_cast<EntryInfo*>(Unalias(to_cache_entry->value)); |
1623 if (prev_children_count) | 1637 if (prev_children_count) |
1624 *prev_children_count = from_entry_info->children_count; | 1638 *prev_children_count = from_entry_info->children_count; |
1625 if (prev_retainers_count) | 1639 if (prev_retainers_count) |
1626 *prev_retainers_count = to_entry_info->retainers_count; | 1640 *prev_retainers_count = to_entry_info->retainers_count; |
1627 ++from_entry_info->children_count; | 1641 ++from_entry_info->children_count; |
1628 ++to_entry_info->retainers_count; | 1642 ++to_entry_info->retainers_count; |
1629 ++total_children_count_; | 1643 ++total_children_count_; |
1630 ++total_retainers_count_; | 1644 ++total_retainers_count_; |
1631 } | 1645 } |
1632 | 1646 |
1633 | 1647 |
1634 template<class Visitor> | |
1635 void HeapEntriesMap::UpdateEntries(Visitor* visitor) { | |
1636 for (HashMap::Entry* p = entries_.Start(); | |
1637 p != NULL; | |
1638 p = entries_.Next(p)) { | |
1639 if (!IsAlias(p->value)) { | |
1640 EntryInfo* entry_info = reinterpret_cast<EntryInfo*>(p->value); | |
1641 entry_info->entry = visitor->GetEntry( | |
1642 reinterpret_cast<HeapObject*>(p->key), | |
1643 entry_info->children_count, | |
1644 entry_info->retainers_count); | |
1645 entry_info->children_count = 0; | |
1646 entry_info->retainers_count = 0; | |
1647 } | |
1648 } | |
1649 } | |
1650 | |
1651 | |
1652 HeapSnapshotGenerator::HeapSnapshotGenerator(HeapSnapshot* snapshot) | 1648 HeapSnapshotGenerator::HeapSnapshotGenerator(HeapSnapshot* snapshot) |
1653 : snapshot_(snapshot), | 1649 : snapshot_(snapshot), |
1654 collection_(snapshot->collection()), | 1650 collection_(snapshot->collection()), |
1655 filler_(NULL) { | 1651 filler_(NULL) { |
1656 } | 1652 } |
1657 | 1653 |
1658 | |
1659 HeapEntry *const | |
1660 HeapSnapshotGenerator::SnapshotFillerInterface::kHeapEntryPlaceholder = | |
1661 reinterpret_cast<HeapEntry*>(1); | |
1662 | |
1663 class SnapshotCounter : public HeapSnapshotGenerator::SnapshotFillerInterface { | 1654 class SnapshotCounter : public HeapSnapshotGenerator::SnapshotFillerInterface { |
1664 public: | 1655 public: |
1665 explicit SnapshotCounter(HeapEntriesMap* entries) | 1656 explicit SnapshotCounter(HeapEntriesMap* entries) |
1666 : entries_(entries) { } | 1657 : entries_(entries) { } |
1667 HeapEntry* AddEntry(HeapObject* obj) { | 1658 HeapEntry* AddEntry(HeapObject* obj) { |
1668 entries_->Pair(obj, kHeapEntryPlaceholder); | 1659 entries_->Pair(obj, HeapEntriesMap::kHeapEntryPlaceholder); |
1669 return kHeapEntryPlaceholder; | 1660 return HeapEntriesMap::kHeapEntryPlaceholder; |
1670 } | 1661 } |
1671 void SetElementReference(HeapObject* parent_obj, | 1662 void SetElementReference(HeapObject* parent_obj, |
1672 HeapEntry*, | 1663 HeapEntry*, |
1673 int, | 1664 int, |
1674 Object* child_obj, | 1665 Object* child_obj, |
1675 HeapEntry*) { | 1666 HeapEntry*) { |
1676 entries_->CountReference(parent_obj, HeapObject::cast(child_obj)); | 1667 entries_->CountReference(parent_obj, HeapObject::cast(child_obj)); |
1677 } | 1668 } |
1678 void SetNamedReference(HeapGraphEdge::Type, | 1669 void SetNamedReference(HeapGraphEdge::Type, |
1679 HeapObject* parent_obj, | 1670 HeapObject* parent_obj, |
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2050 void HeapSnapshotGenerator::SetRootReference(Object* child_obj) { | 2041 void HeapSnapshotGenerator::SetRootReference(Object* child_obj) { |
2051 HeapEntry* child_entry = GetEntry(child_obj); | 2042 HeapEntry* child_entry = GetEntry(child_obj); |
2052 ASSERT(child_entry != NULL); | 2043 ASSERT(child_entry != NULL); |
2053 filler_->SetRootReference(child_obj, child_entry); | 2044 filler_->SetRootReference(child_obj, child_entry); |
2054 } | 2045 } |
2055 | 2046 |
2056 | 2047 |
2057 void HeapSnapshotsDiff::CreateRoots(int additions_count, int deletions_count) { | 2048 void HeapSnapshotsDiff::CreateRoots(int additions_count, int deletions_count) { |
2058 raw_additions_root_ = | 2049 raw_additions_root_ = |
2059 NewArray<char>(HeapEntry::EntriesSize(1, additions_count, 0)); | 2050 NewArray<char>(HeapEntry::EntriesSize(1, additions_count, 0)); |
2060 additions_root()->Init(snapshot2_, additions_count, 0); | 2051 additions_root()->Init( |
| 2052 snapshot2_, HeapEntry::kInternal, "", 0, 0, additions_count, 0); |
2061 raw_deletions_root_ = | 2053 raw_deletions_root_ = |
2062 NewArray<char>(HeapEntry::EntriesSize(1, deletions_count, 0)); | 2054 NewArray<char>(HeapEntry::EntriesSize(1, deletions_count, 0)); |
2063 deletions_root()->Init(snapshot1_, deletions_count, 0); | 2055 deletions_root()->Init( |
| 2056 snapshot1_, HeapEntry::kInternal, "", 0, 0, deletions_count, 0); |
2064 } | 2057 } |
2065 | 2058 |
2066 | 2059 |
2067 static void DeleteHeapSnapshotsDiff(HeapSnapshotsDiff** diff_ptr) { | 2060 static void DeleteHeapSnapshotsDiff(HeapSnapshotsDiff** diff_ptr) { |
2068 delete *diff_ptr; | 2061 delete *diff_ptr; |
2069 } | 2062 } |
2070 | 2063 |
2071 HeapSnapshotsComparator::~HeapSnapshotsComparator() { | 2064 HeapSnapshotsComparator::~HeapSnapshotsComparator() { |
2072 diffs_.Iterate(DeleteHeapSnapshotsDiff); | 2065 diffs_.Iterate(DeleteHeapSnapshotsDiff); |
2073 } | 2066 } |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2131 HeapEntry* entry = added_entries[i]; | 2124 HeapEntry* entry = added_entries[i]; |
2132 if (entry->painted_reachable()) | 2125 if (entry->painted_reachable()) |
2133 diff->AddAddedEntry(add_child_index++, added_entry_index++, entry); | 2126 diff->AddAddedEntry(add_child_index++, added_entry_index++, entry); |
2134 } | 2127 } |
2135 return diff; | 2128 return diff; |
2136 } | 2129 } |
2137 | 2130 |
2138 } } // namespace v8::internal | 2131 } } // namespace v8::internal |
2139 | 2132 |
2140 #endif // ENABLE_LOGGING_AND_PROFILING | 2133 #endif // ENABLE_LOGGING_AND_PROFILING |
OLD | NEW |