OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 1380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1391 return id; | 1391 return id; |
1392 } | 1392 } |
1393 | 1393 |
1394 | 1394 |
1395 void HeapObjectsMap::MoveObject(Address from, Address to) { | 1395 void HeapObjectsMap::MoveObject(Address from, Address to) { |
1396 if (from == to) return; | 1396 if (from == to) return; |
1397 HashMap::Entry* entry = entries_map_.Lookup(from, AddressHash(from), false); | 1397 HashMap::Entry* entry = entries_map_.Lookup(from, AddressHash(from), false); |
1398 if (entry != NULL) { | 1398 if (entry != NULL) { |
1399 void* value = entry->value; | 1399 void* value = entry->value; |
1400 entries_map_.Remove(from, AddressHash(from)); | 1400 entries_map_.Remove(from, AddressHash(from)); |
1401 entry = entries_map_.Lookup(to, AddressHash(to), true); | 1401 if (to != NULL) { |
1402 // We can have an entry at the new location, it is OK, as GC can overwrite | 1402 entry = entries_map_.Lookup(to, AddressHash(to), true); |
1403 // dead objects with alive objects being moved. | 1403 // We can have an entry at the new location, it is OK, as GC can overwrite |
1404 entry->value = value; | 1404 // dead objects with alive objects being moved. |
| 1405 entry->value = value; |
| 1406 } |
1405 } | 1407 } |
1406 } | 1408 } |
1407 | 1409 |
1408 | 1410 |
1409 void HeapObjectsMap::AddEntry(Address addr, uint64_t id) { | 1411 void HeapObjectsMap::AddEntry(Address addr, uint64_t id) { |
1410 HashMap::Entry* entry = entries_map_.Lookup(addr, AddressHash(addr), true); | 1412 HashMap::Entry* entry = entries_map_.Lookup(addr, AddressHash(addr), true); |
1411 ASSERT(entry->value == NULL); | 1413 ASSERT(entry->value == NULL); |
1412 entry->value = reinterpret_cast<void*>(entries_->length()); | 1414 entry->value = reinterpret_cast<void*>(entries_->length()); |
1413 entries_->Add(EntryInfo(id)); | 1415 entries_->Add(EntryInfo(id)); |
1414 } | 1416 } |
(...skipping 1953 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3368 | 3370 |
3369 | 3371 |
3370 void HeapSnapshotJSONSerializer::SortHashMap( | 3372 void HeapSnapshotJSONSerializer::SortHashMap( |
3371 HashMap* map, List<HashMap::Entry*>* sorted_entries) { | 3373 HashMap* map, List<HashMap::Entry*>* sorted_entries) { |
3372 for (HashMap::Entry* p = map->Start(); p != NULL; p = map->Next(p)) | 3374 for (HashMap::Entry* p = map->Start(); p != NULL; p = map->Next(p)) |
3373 sorted_entries->Add(p); | 3375 sorted_entries->Add(p); |
3374 sorted_entries->Sort(SortUsingEntryValue); | 3376 sorted_entries->Sort(SortUsingEntryValue); |
3375 } | 3377 } |
3376 | 3378 |
3377 } } // namespace v8::internal | 3379 } } // namespace v8::internal |
OLD | NEW |