Bug 1641469 part 5 - Check entered-counts in WarpOracle. r=iain
authorJan de Mooij <jdemooij@mozilla.com>
Fri, 29 May 2020 06:35:42 +0000
changeset 532965 9c257fb7548dd9f4bbd2df8f05192f239c733e02
parent 532964 2a57e124f45d956cab265383d56c8466f3403e77
child 532966 fa975a6a85700dc5315b3a282581609e07e18db8
push id117486
push userjdemooij@mozilla.com
push dateFri, 29 May 2020 11:24:42 +0000
treeherderautoland@9c257fb7548d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersiain
bugs1641469
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 1641469 part 5 - Check entered-counts in WarpOracle. r=iain Transpile the first IC stub if all other stubs have entered-count 0. We probably want to tune the heuristics at some point, but for now this is a significant performance improvement. Differential Revision: https://phabricator.services.mozilla.com/D77243
js/src/jit/WarpOracle.cpp
--- a/js/src/jit/WarpOracle.cpp
+++ b/js/src/jit/WarpOracle.cpp
@@ -670,22 +670,29 @@ AbortReasonOr<Ok> WarpOracle::maybeInlin
     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()) {
+  // Don't optimize if there are other stubs with entered-count > 0. Counters
+  // are reset when a new stub is attached so this means the stub that was added
+  // most recently didn't handle all cases.
+  for (ICStub* next = stub->next(); next; next = next->next()) {
+    if (next->getEnteredCount() == 0) {
+      continue;
+    }
+
     [[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",
+    JitSpew(JitSpew_WarpTranspiler,
+            "multiple active 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?