| 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 1541 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1552 HashMap::Entry* entry = entries_map_.Lookup(addr, AddressHash(addr), true); | 1552 HashMap::Entry* entry = entries_map_.Lookup(addr, AddressHash(addr), true); |
| 1553 ASSERT(entry->value == NULL); | 1553 ASSERT(entry->value == NULL); |
| 1554 entry->value = reinterpret_cast<void*>(entries_->length()); | 1554 entry->value = reinterpret_cast<void*>(entries_->length()); |
| 1555 entries_->Add(EntryInfo(id)); | 1555 entries_->Add(EntryInfo(id)); |
| 1556 } | 1556 } |
| 1557 | 1557 |
| 1558 | 1558 |
| 1559 uint64_t HeapObjectsMap::FindEntry(Address addr) { | 1559 uint64_t HeapObjectsMap::FindEntry(Address addr) { |
| 1560 HashMap::Entry* entry = entries_map_.Lookup(addr, AddressHash(addr), false); | 1560 HashMap::Entry* entry = entries_map_.Lookup(addr, AddressHash(addr), false); |
| 1561 if (entry != NULL) { | 1561 if (entry != NULL) { |
| 1562 int entry_index = reinterpret_cast<intptr_t>(entry->value); | 1562 int entry_index = |
| 1563 static_cast<int>(reinterpret_cast<intptr_t>(entry->value)); |
| 1563 EntryInfo& entry_info = entries_->at(entry_index); | 1564 EntryInfo& entry_info = entries_->at(entry_index); |
| 1564 entry_info.accessed = true; | 1565 entry_info.accessed = true; |
| 1565 return entry_info.id; | 1566 return entry_info.id; |
| 1566 } else { | 1567 } else { |
| 1567 return 0; | 1568 return 0; |
| 1568 } | 1569 } |
| 1569 } | 1570 } |
| 1570 | 1571 |
| 1571 | 1572 |
| 1572 void HeapObjectsMap::RemoveDeadEntries() { | 1573 void HeapObjectsMap::RemoveDeadEntries() { |
| 1573 List<EntryInfo>* new_entries = new List<EntryInfo>(); | 1574 List<EntryInfo>* new_entries = new List<EntryInfo>(); |
| 1574 for (HashMap::Entry* entry = entries_map_.Start(); | 1575 for (HashMap::Entry* entry = entries_map_.Start(); |
| 1575 entry != NULL; | 1576 entry != NULL; |
| 1576 entry = entries_map_.Next(entry)) { | 1577 entry = entries_map_.Next(entry)) { |
| 1577 int entry_index = reinterpret_cast<intptr_t>(entry->value); | 1578 int entry_index = |
| 1579 static_cast<int>(reinterpret_cast<intptr_t>(entry->value)); |
| 1578 EntryInfo& entry_info = entries_->at(entry_index); | 1580 EntryInfo& entry_info = entries_->at(entry_index); |
| 1579 if (entry_info.accessed) { | 1581 if (entry_info.accessed) { |
| 1580 entry->value = reinterpret_cast<void*>(new_entries->length()); | 1582 entry->value = reinterpret_cast<void*>(new_entries->length()); |
| 1581 new_entries->Add(EntryInfo(entry_info.id, false)); | 1583 new_entries->Add(EntryInfo(entry_info.id, false)); |
| 1582 } | 1584 } |
| 1583 } | 1585 } |
| 1584 delete entries_; | 1586 delete entries_; |
| 1585 entries_ = new_entries; | 1587 entries_ = new_entries; |
| 1586 } | 1588 } |
| 1587 | 1589 |
| (...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1820 HeapEntry* entry = added_entries[i]; | 1822 HeapEntry* entry = added_entries[i]; |
| 1821 if (entry->painted_reachable()) | 1823 if (entry->painted_reachable()) |
| 1822 diff->AddAddedEntry(entry); | 1824 diff->AddAddedEntry(entry); |
| 1823 } | 1825 } |
| 1824 return diff; | 1826 return diff; |
| 1825 } | 1827 } |
| 1826 | 1828 |
| 1827 } } // namespace v8::internal | 1829 } } // namespace v8::internal |
| 1828 | 1830 |
| 1829 #endif // ENABLE_LOGGING_AND_PROFILING | 1831 #endif // ENABLE_LOGGING_AND_PROFILING |
| OLD | NEW |