Closed Bug 1507432 Opened 6 years ago Closed 4 years ago

IonBuilder: Prevent inlining when the caller block is cold.

Categories

(Core :: JavaScript Engine: JIT, enhancement, P5)

enhancement

Tracking

()

RESOLVED FIXED
Performance Impact low

People

(Reporter: nbp, Unassigned)

References

(Blocks 1 open bug)

Details

(Keywords: perf, perf:responsiveness)

When running IonBuilder, with Type Inference we are capable of figuring out the function pointer and inlining it even in blocks which have a 0 use-count. Today our inlining heuristics are based only on the callee use-count, which might miss-lead us into inlining extra code, at the cost of extra time spent in the compiler on the main thread and off-thread. We can improve over this state by adding a minimum caller threshold before inlining. Using a threshold at 0, would ensure that we do not inline in block which were never reached, and are likely to be removed by branch pruning. Using a larger threshold might cause issues later on with Scalar Replacement. Non-zero-hit branches are not removed by branch pruning, and these function might "escape" some object/array/scope-chain which could have been removed with Scalar Replacement.
Ok, this is harder than I initially thought as we do not increment the code-coverage counters when we are in Ion, which implies that after a recompilation, we might still not inline the function, even if the code got visited multiple time since. An alternative would be to increment the coverage-counters before the call-site, and only once per block, if we ever fail to inline due to caller counters which are not hot enough. Currently, we de increment the code-coverage counter after bailout, so the inconsistency of code-coverage counters might not cause much issues.
Flags: needinfo?(nicolas.b.pierron)
Whiteboard: [qf] → [qf:p3:responsiveness]

Inlining is disable in the first Ion stage, and the second Ion stage can be considered as being disabled.
So, this should not matter anymore.

Flags: needinfo?(nicolas.b.pierron)
Priority: P2 → P5

I think this is not a problem with trial-inlining.

Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Performance Impact: --- → P3
Whiteboard: [qf:p3:responsiveness]
You need to log in before you can comment on or make changes to this bug.