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 1447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1458 entry_info.accessed = true; | 1458 entry_info.accessed = true; |
1459 return entry_info.id; | 1459 return entry_info.id; |
1460 } else { | 1460 } else { |
1461 return 0; | 1461 return 0; |
1462 } | 1462 } |
1463 } | 1463 } |
1464 | 1464 |
1465 | 1465 |
1466 void HeapObjectsMap::RemoveDeadEntries() { | 1466 void HeapObjectsMap::RemoveDeadEntries() { |
1467 List<EntryInfo>* new_entries = new List<EntryInfo>(); | 1467 List<EntryInfo>* new_entries = new List<EntryInfo>(); |
| 1468 List<void*> dead_entries; |
1468 for (HashMap::Entry* entry = entries_map_.Start(); | 1469 for (HashMap::Entry* entry = entries_map_.Start(); |
1469 entry != NULL; | 1470 entry != NULL; |
1470 entry = entries_map_.Next(entry)) { | 1471 entry = entries_map_.Next(entry)) { |
1471 int entry_index = | 1472 int entry_index = |
1472 static_cast<int>(reinterpret_cast<intptr_t>(entry->value)); | 1473 static_cast<int>(reinterpret_cast<intptr_t>(entry->value)); |
1473 EntryInfo& entry_info = entries_->at(entry_index); | 1474 EntryInfo& entry_info = entries_->at(entry_index); |
1474 if (entry_info.accessed) { | 1475 if (entry_info.accessed) { |
1475 entry->value = reinterpret_cast<void*>(new_entries->length()); | 1476 entry->value = reinterpret_cast<void*>(new_entries->length()); |
1476 new_entries->Add(EntryInfo(entry_info.id, false)); | 1477 new_entries->Add(EntryInfo(entry_info.id, false)); |
| 1478 } else { |
| 1479 dead_entries.Add(entry->key); |
1477 } | 1480 } |
1478 } | 1481 } |
| 1482 for (int i = 0; i < dead_entries.length(); ++i) { |
| 1483 void* raw_entry = dead_entries[i]; |
| 1484 entries_map_.Remove( |
| 1485 raw_entry, AddressHash(reinterpret_cast<Address>(raw_entry))); |
| 1486 } |
1479 delete entries_; | 1487 delete entries_; |
1480 entries_ = new_entries; | 1488 entries_ = new_entries; |
1481 } | 1489 } |
1482 | 1490 |
1483 | 1491 |
1484 HeapSnapshotsCollection::HeapSnapshotsCollection() | 1492 HeapSnapshotsCollection::HeapSnapshotsCollection() |
1485 : is_tracking_objects_(false), | 1493 : is_tracking_objects_(false), |
1486 snapshots_uids_(HeapSnapshotsMatch), | 1494 snapshots_uids_(HeapSnapshotsMatch), |
1487 token_enumerator_(new TokenEnumerator()) { | 1495 token_enumerator_(new TokenEnumerator()) { |
1488 } | 1496 } |
(...skipping 607 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2096 HeapEntry* entry = added_entries[i]; | 2104 HeapEntry* entry = added_entries[i]; |
2097 if (entry->painted_reachable()) | 2105 if (entry->painted_reachable()) |
2098 diff->AddAddedEntry(add_child_index++, added_entry_index++, entry); | 2106 diff->AddAddedEntry(add_child_index++, added_entry_index++, entry); |
2099 } | 2107 } |
2100 return diff; | 2108 return diff; |
2101 } | 2109 } |
2102 | 2110 |
2103 } } // namespace v8::internal | 2111 } } // namespace v8::internal |
2104 | 2112 |
2105 #endif // ENABLE_LOGGING_AND_PROFILING | 2113 #endif // ENABLE_LOGGING_AND_PROFILING |
OLD | NEW |