Bug 1639839 - Log when snapshotting IC stubs fails. r=iain
authorTom Schuster <evilpies@gmail.com>
Thu, 21 May 2020 18:12:56 +0000
changeset 531486 b7aa40fd2d2a8bcea543524957f23ccd8783b016
parent 531485 15c7977477482783098ffa5f9648c94534e53081
child 531487 33b80df7aede00a42c87809875e8d5d9cf91bb96
push id37440
push userabutkovits@mozilla.com
push dateFri, 22 May 2020 09:43:16 +0000
treeherdermozilla-central@fbf71e4d2e21 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersiain
bugs1639839
milestone78.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 1639839 - Log when snapshotting IC stubs fails. r=iain Differential Revision: https://phabricator.services.mozilla.com/D76309
js/src/jit/WarpOracle.cpp
--- a/js/src/jit/WarpOracle.cpp
+++ b/js/src/jit/WarpOracle.cpp
@@ -632,39 +632,61 @@ AbortReasonOr<WarpScriptSnapshot*> WarpO
     return abort(AbortReason::Alloc);
   }
 
   autoClearOpSnapshots.release();
 
   return scriptSnapshot;
 }
 
+static void LineNumberAndColumn(HandleScript script, BytecodeLocation loc,
+                                unsigned* line, unsigned* column) {
+#ifdef DEBUG
+  *line = PCToLineNumber(script, loc.toRawBytecode(), column);
+#else
+  *line = script->lineno();
+  *column = script->column();
+#endif
+}
+
 AbortReasonOr<Ok> WarpOracle::maybeInlineIC(WarpOpSnapshotList& snapshots,
                                             HandleScript script,
                                             BytecodeLocation loc) {
   // Add a WarpCacheIR snapshot if the Baseline IC has a single ICStub we can
   // inline.
 
   MOZ_ASSERT(loc.opHasIC());
 
   uint32_t offset = loc.bytecodeToOffset(script);
 
   // TODO: slow. Should traverse ICEntries as we go, like BaselineCompiler.
   const ICEntry& entry = script->jitScript()->icEntryFromPCOffset(offset);
 
   ICStub* stub = entry.firstStub();
 
   if (stub->isFallback()) {
+    [[maybe_unused]] unsigned line, column;
+    LineNumberAndColumn(script, loc, &line, &column);
+
     // No optimized stubs.
-    // TODO: add logging for failure/success cases.
+    JitSpew(JitSpew_WarpTranspiler,
+            "fallback stub (entered-count: %" PRIu32
+            ") for JSOp::%s @ %s:%u:%u",
+            stub->toFallbackStub()->enteredCount(), CodeName(loc.getOp()),
+            script->filename(), line, column);
     return Ok();
   }
 
   if (!stub->next()->isFallback()) {
+    [[maybe_unused]] unsigned line, column;
+    LineNumberAndColumn(script, loc, &line, &column);
+
     // More than one optimized stub.
+    JitSpew(JitSpew_WarpTranspiler, "multiple stubs for JSOp::%s @ %s:%u:%u",
+            CodeName(loc.getOp()), script->filename(), line, column);
     return Ok();
   }
 
   // TODO: check stub's hit count if we're not doing eager compilation.
   // TODO: don't inline if the IC had unhandled cases => CacheIR is incomplete.
   // TOOD: have a consistent bailout => invalidate story. Set a flag on the IC?
 
   const CacheIRStubInfo* stubInfo = nullptr;
@@ -701,22 +723,27 @@ AbortReasonOr<Ok> WarpOracle::maybeInlin
 
     switch (op) {
 #define DEFINE_OP(op, ...) \
   case CacheOp::op:        \
     break;
       CACHE_IR_TRANSPILER_OPS(DEFINE_OP)
 #undef DEFINE_OP
 
-      default:
-        // Unsupported opcode.
+      default: {
+        [[maybe_unused]] unsigned line, column;
+        LineNumberAndColumn(script, loc, &line, &column);
+
+        // Unsupported CacheIR opcode.
         JitSpew(JitSpew_WarpTranspiler,
-                "unsupported CacheIR opcode: %s @ JSOp::%s",
-                CacheIROpNames[size_t(op)], CodeName(loc.getOp()));
+                "unsupported CacheIR opcode %s for JSOp::%s @ %s:%u:%u",
+                CacheIROpNames[size_t(op)], CodeName(loc.getOp()),
+                script->filename(), line, column);
         return Ok();
+      }
     }
   }
 
   // Copy the ICStub data to protect against the stub being unlinked or mutated.
   // We don't need to copy the CacheIRStubInfo: because we store and trace the
   // stub's JitCode*, the baselineCacheIRStubCodes_ map in JitZone will keep it
   // alive.
   size_t bytesNeeded = stubInfo->stubDataSize();