Currently JM and Ion use the same strategy to decide when a script is compiled:
1) Initial compilation after 40 calls and/or loop backedges.
2) Recompilation after 10,000 calls/backedges to inline calls.
These numbers make sense for JM because the alternative (interpreting) is very slow and compilation is pretty fast.
For Ion, the plan is to:
1) JM compilation after 40 calls/backedges.
2) Ion compilation after 10,000 calls/backedges, inlining calls.
The main benefit is that we don't waste time optimizing "warm", not hot, functions and this avoids some regressions, especially on SS.
I prototyped this change and the initial results are promising, SS/Kraken/V8 all become faster.
Sweet! What was the resolution re: JM to Ion calls?
(In reply to David Anderson [:dvander] from comment #1)
> Sweet! What was the resolution re: JM to Ion calls?
It uses some simple heuristics (just a few lines of code), e.g. perform a JM -> Ion call only if both caller and callee are Ion-compileable, the callee has at least one loop and the caller is not (very) hot. In the other cases we fallback to JM for the callee. I tried some other things (transitioning to Ion after the script prologue) but these rules are pretty simple (I will explain them in the patch) and gave the best results.
Created attachment 630520 [details] [diff] [review]
Created attachment 630521 [details]
Created attachment 630525 [details] [diff] [review]
Created attachment 630528 [details]
Comment on attachment 630525 [details] [diff] [review]
Review of attachment 630525 [details] [diff] [review]:
@@ +48,5 @@
> * Number of times a script must be called or had a backedge before we try to
> + * inline its calls. This number should match IonMonkey's usesBeforeCompile.
Is it worth hoisting this constant out?
(In reply to David Anderson [:dvander] from comment #7)
> Is it worth hoisting this constant out?
I considered it but I couldn't think of a good place to put it: both JITs use the constant even if the other JIT is disabled. Maybe jsscript.h but that also seemed a bit confusing.