From b5946d78c55c29878eaffa20e83d2aee0c838498 Mon Sep 17 00:00:00 2001 From: "mikhail.naganov@gmail.com" Date: Mon, 26 Sep 2011 15:59:27 +0000 Subject: [PATCH] Add ObjectMoveEvent reporting for the Heap Profiler into MarkCompact. R=vegorov@chromium.org BUG=none TEST=none Review URL: http://codereview.chromium.org/8036024 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@9432 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/mark-compact.cc | 1 + src/profile-generator.cc | 10 ++++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/mark-compact.cc b/src/mark-compact.cc index b90ecf0..117da36 100644 --- a/src/mark-compact.cc +++ b/src/mark-compact.cc @@ -2367,6 +2367,7 @@ void MarkCompactCollector::MigrateObject(Address dst, Address src, int size, AllocationSpace dest) { + HEAP_PROFILE(heap(), ObjectMoveEvent(src, dst)); if (dest == OLD_POINTER_SPACE || dest == LO_SPACE) { Address src_slot = src; Address dst_slot = dst; diff --git a/src/profile-generator.cc b/src/profile-generator.cc index c075c03..c1052e6 100644 --- a/src/profile-generator.cc +++ b/src/profile-generator.cc @@ -1403,10 +1403,12 @@ void HeapObjectsMap::MoveObject(Address from, Address to) { if (entry != NULL) { void* value = entry->value; entries_map_.Remove(from, AddressHash(from)); - entry = entries_map_.Lookup(to, AddressHash(to), true); - // We can have an entry at the new location, it is OK, as GC can overwrite - // dead objects with alive objects being moved. - entry->value = value; + if (to != NULL) { + entry = entries_map_.Lookup(to, AddressHash(to), true); + // We can have an entry at the new location, it is OK, as GC can overwrite + // dead objects with alive objects being moved. + entry->value = value; + } } } -- 2.7.4