From 32d670d8dc147c4db6cd48a67892e2829dff4789 Mon Sep 17 00:00:00 2001 From: ownedbywuigi Date: Sat, 28 Mar 2026 10:11:23 +0000 Subject: [PATCH] Revert back to old tuning for reduced startup compile pressure --- js/src/jit/IonOptimizationLevels.cpp | 26 +++++++++++++------------- js/src/jit/JitOptions.cpp | 6 +++--- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/js/src/jit/IonOptimizationLevels.cpp b/js/src/jit/IonOptimizationLevels.cpp index 41aa0f6ed9..4f2ae07788 100644 --- a/js/src/jit/IonOptimizationLevels.cpp +++ b/js/src/jit/IonOptimizationLevels.cpp @@ -47,11 +47,12 @@ OptimizationInfo::initNormalOptimizationInfo() scalarReplacement_ = true; smallFunctionMaxInlineDepth_ = 10; compilerWarmUpThreshold_ = CompilerWarmupThreshold; - // Start compiling tiny helper functions sooner. This is particularly - // useful for jQuery-style code with many frequently-called short helpers. - compilerSmallFunctionWarmUpThreshold_ = 32; - // Inline callees a bit earlier once a script becomes warm. - inliningWarmUpThresholdFactor_ = 0.08; + // Compile small helper functions somewhat sooner, but keep this conservative + // to avoid startup regressions on large script-heavy applications. + compilerSmallFunctionWarmUpThreshold_ = 36; + // Keep inlining warm-up close to default to avoid excessive early + // compilation work during page startup. + inliningWarmUpThresholdFactor_ = 0.10; inliningRecompileThresholdFactor_ = 4; } @@ -115,14 +116,13 @@ OptimizationInfo::compilerWarmUpThreshold(JSScript* script, jsbytecode* pc) cons warmUpThreshold *= ratio; } - // jQuery spends a lot of time in medium-small wrappers that are too large - // to be classified as "small" but still hot enough to benefit from Ion. - // Nudge these scripts toward earlier compilation without affecting large - // scripts that are expensive to optimize. - if (script->length() <= 400 && numLocalsAndArgs <= 48) { - warmUpThreshold = (warmUpThreshold * 3) / 4; - if (warmUpThreshold < 30) - warmUpThreshold = 30; + // Medium-small helper scripts can benefit from earlier Ion entry, but only + // when considering loop-entry OSR. Applying this at function entry can hurt + // large app startup latency (for example, video sites with many wrappers). + if (pc && script->length() <= 400 && numLocalsAndArgs <= 48) { + warmUpThreshold = (warmUpThreshold * 4) / 5; + if (warmUpThreshold < 40) + warmUpThreshold = 40; } if (!pc || JitOptions.eagerCompilation) diff --git a/js/src/jit/JitOptions.cpp b/js/src/jit/JitOptions.cpp index d7dacb89a0..2e799740b7 100644 --- a/js/src/jit/JitOptions.cpp +++ b/js/src/jit/JitOptions.cpp @@ -167,9 +167,9 @@ DefaultJitOptions::DefaultJitOptions() // invalidating the script. SET_DEFAULT(osrPcMismatchesBeforeRecompile, 6000); - // The bytecode length limit for small function. jQuery has many helpers - // just above 200 bytecodes, so raise this to compile them sooner. - SET_DEFAULT(smallFunctionMaxBytecodeLength_, 320); + // The bytecode length limit for small function. Keep this modest to avoid + // startup regressions from classifying too many wrapper functions as small. + SET_DEFAULT(smallFunctionMaxBytecodeLength_, 256); // An artificial testing limit for the maximum supported offset of // pc-relative jump and call instructions.