Files
tubestation/js
Julian Seward f091474a6f Bug 1967644 - wasm: Reduce inlining aggressiveness for very large functions. r=rhunt.
When inlining into a very large function, reduce inlining agressiveness by one
step (on the 1 .. 9 scale) if the function's bytecode size is over 400KB; by 2
steps if over 800KB, and by 3 steps if over 1.2MB.  This somewhat mitigates a
problem where inlining takes an already huge function and makes it even
bigger, leading to long delays in Ion.

The thresholds are so high (more than 400KB bytecode) that almost all functions
will be unaffected.  Above the 400k threshold, we gradually back off on
inlining; it doesn't get disabled completely.

The patch falls logically into two parts: the heuristic itself ..

* InliningHeuristics::isSmallEnoughToInline: the heuristic itself

* struct FuncCompileInput: new convenience function `bytecodeSize`

.. and updates to the stats-counting machinery.

* struct InliningStats: new field `largeFunctionBackoff`

* struct CompileStats: new field `numLargeFunctionBackoffs`

* auditInlineableCallees (calls isSmallEnoughToInline): note in RootCompiler if
  backoff was applied

Differential Revision: https://phabricator.services.mozilla.com/D250402
2025-05-23 08:49:01 +00:00
..