Revision: 3679
Author: [email protected]
Date: Fri Jan 22 01:42:24 2010
Log: 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

Review URL: http://codereview.chromium.org/552089
http://code.google.com/p/v8/source/detail?r=3679

Modified:
 /branches/bleeding_edge/src/mark-compact.cc
 /branches/bleeding_edge/test/cctest/test-log-stack-tracer.cc

=======================================
--- /branches/bleeding_edge/src/mark-compact.cc Thu Jan 21 08:42:41 2010
+++ /branches/bleeding_edge/src/mark-compact.cc Fri Jan 22 01:42:24 2010
@@ -1195,7 +1195,7 @@

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

   EncodeForwardingAddressesInPagedSpace<MCAllocateFromOldDataSpace,
@@ -1899,6 +1899,11 @@
   }

   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 @@
     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;
@@ -1981,6 +1984,11 @@
     PrintF("relocate %p -> %p\n", old_addr, new_addr);
   }
 #endif
+
+  HeapObject* copied_to = HeapObject::FromAddress(new_addr);
+  if (copied_to->IsJSFunction()) {
+    LOG(FunctionMoveEvent(old_addr, new_addr));
+  }

   return obj_size;
 }
=======================================
--- /branches/bleeding_edge/test/cctest/test-log-stack-tracer.cc Thu Jan 21 08:42:41 2010 +++ /branches/bleeding_edge/test/cctest/test-log-stack-tracer.cc Fri Jan 22 01:42:24 2010
@@ -315,6 +315,9 @@
       "         JSTrace();"
       "};\n"
       "OuterJSTrace();");
+  // The last JS function called.
+  CHECK_EQ(GetGlobalJSFunction("JSFuncDoTrace")->address(),
+           sample.function);
   CHECK_GT(sample.frames_count, 1);
// Stack sampling will start from the caller of JSFuncDoTrace, i.e. "JSTrace"
   CheckRetAddrIsInJSFunction("JSTrace",

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

Reply via email to