Bug 1399866 - Dump more info on gray marking failure r=sfink
authorJon Coppeard <jcoppeard@mozilla.com>
Wed, 20 Sep 2017 18:23:47 +0100
changeset 433882 a079a0a2971dc11a7b88670d48dff46b011dac04
parent 433881 fbdfaa4bae2d1efadd68f7cac2fdefc2e24dd79c
child 433883 c83fc4d57beb43a625c582d2c959242fc6566832
push id1567
push userjlorenzo@mozilla.com
push dateThu, 02 Nov 2017 12:36:05 +0000
treeherdermozilla-release@e512c14a0406 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssfink
bugs1399866
milestone57.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1399866 - Dump more info on gray marking failure r=sfink
js/src/gc/Verifier.cpp
--- a/js/src/gc/Verifier.cpp
+++ b/js/src/gc/Verifier.cpp
@@ -453,16 +453,17 @@ class HeapCheckTracerBase : public JS::C
 {
   public:
     explicit HeapCheckTracerBase(JSRuntime* rt, WeakMapTraceKind weakTraceKind);
     bool init();
     bool traceHeap(AutoLockForExclusiveAccess& lock);
     virtual void checkCell(Cell* cell) = 0;
 
   protected:
+    void dumpCellInfo(Cell* cell);
     void dumpCellPath();
 
     Cell* parentCell() {
         return parentIndex == -1 ? nullptr : stack[parentIndex].thing.asCell();
     }
 
     size_t failures;
 
@@ -551,24 +552,35 @@ HeapCheckTracerBase::traceHeap(AutoLockF
             TraceChildren(this, item.thing);
         }
     }
 
     return !oom;
 }
 
 void
+HeapCheckTracerBase::dumpCellInfo(Cell* cell)
+{
+    auto kind = cell->getTraceKind();
+    fprintf(stderr, "%s", GCTraceKindToAscii(kind));
+    if (kind == JS::TraceKind::Object)
+        fprintf(stderr, " %s", static_cast<JSObject*>(cell)->getClass()->name);
+    fprintf(stderr, " %p", cell);
+}
+
+void
 HeapCheckTracerBase::dumpCellPath()
 {
     const char* name = contextName();
     for (int index = parentIndex; index != -1; index = stack[index].parentIndex) {
         const WorkItem& parent = stack[index];
         Cell* cell = parent.thing.asCell();
-        fprintf(stderr, "  from %s %p %s edge\n",
-                GCTraceKindToAscii(cell->getTraceKind()), cell, name);
+        fprintf(stderr, "  from ");
+        dumpCellInfo(cell);
+        fprintf(stderr, " %s edge\n", name);
         name = parent.name;
     }
     fprintf(stderr, "  from root %s\n", name);
 }
 
 #endif // defined(JSGC_HASH_TABLE_CHECKS) || defined(DEBUG)
 
 #ifdef JSGC_HASH_TABLE_CHECKS
@@ -643,26 +655,24 @@ CheckGrayMarkingTracer::CheckGrayMarking
     // Weak gray->black edges are allowed.
     setTraceWeakEdges(false);
 }
 
 void
 CheckGrayMarkingTracer::checkCell(Cell* cell)
 {
     Cell* parent = parentCell();
-    if (!cell->isTenured() || !parent || !parent->isTenured())
+    if (!parent)
         return;
 
-    TenuredCell* tenuredCell = &cell->asTenured();
-    TenuredCell* tenuredParent = &parent->asTenured();
-    if (tenuredParent->isMarkedBlack() && tenuredCell->isMarkedGray())
-    {
+    if (parent->isMarkedBlack() && cell->isMarkedGray()) {
         failures++;
-        fprintf(stderr, "Found black to gray edge to %s %p\n",
-                GCTraceKindToAscii(cell->getTraceKind()), cell);
+        fprintf(stderr, "Found black to gray edge to ");
+        dumpCellInfo(cell);
+        fprintf(stderr, "\n");
         dumpCellPath();
     }
 }
 
 bool
 CheckGrayMarkingTracer::check(AutoLockForExclusiveAccess& lock)
 {
     if (!traceHeap(lock))