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