Reviewers: Søren Gjesse,

Description:
A follow-up to fix 553: really report function object moves.

As an afterthought, I realized that I put function objects moves
reporting into a method that deals with only code object moves.  I've
looked up that function objects are allocated in old pointer space and
new space, so I moved logging to the corresponding VM methods.

BUG=553

Please review this at http://codereview.chromium.org/552089

Affected files:
  M src/mark-compact.cc


Index: src/mark-compact.cc
diff --git a/src/mark-compact.cc b/src/mark-compact.cc
index e9afdce9c5abe2177aa9dafd209ddae851822c3a..339ead46430c716714707aa35309c7ee66ba6720 100644
--- a/src/mark-compact.cc
+++ b/src/mark-compact.cc
@@ -1195,7 +1195,7 @@ void MarkCompactCollector::EncodeForwardingAddresses() {

   // Compute the forwarding pointers in each space.
   EncodeForwardingAddressesInPagedSpace<MCAllocateFromOldPointerSpace,
-                                        IgnoreNonLiveObject>(
+                                        ReportDeleteIfNeeded>(
       Heap::old_pointer_space());

   EncodeForwardingAddressesInPagedSpace<MCAllocateFromOldDataSpace,
@@ -1900,6 +1900,11 @@ int MarkCompactCollector::RelocateOldNonCodeObject(HeapObject* obj,

   ASSERT(!HeapObject::FromAddress(new_addr)->IsCode());

+  HeapObject* copied_to = HeapObject::FromAddress(new_addr);
+  if (copied_to->IsJSFunction()) {
+    LOG(FunctionMoveEvent(old_addr, new_addr));
+  }
+
   return obj_size;
 }

@@ -1943,8 +1948,6 @@ int MarkCompactCollector::RelocateCodeObject(HeapObject* obj) {
     Code::cast(copied_to)->Relocate(new_addr - old_addr);
     // Notify the logger that compiled code has moved.
     LOG(CodeMoveEvent(old_addr, new_addr));
-  } else if (copied_to->IsJSFunction()) {
-    LOG(FunctionMoveEvent(old_addr, new_addr));
   }

   return obj_size;
@@ -1982,6 +1985,11 @@ int MarkCompactCollector::RelocateNewObject(HeapObject* obj) {
   }
 #endif

+  HeapObject* copied_to = HeapObject::FromAddress(new_addr);
+  if (copied_to->IsJSFunction()) {
+    LOG(FunctionMoveEvent(old_addr, new_addr));
+  }
+
   return obj_size;
 }



-- 
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to