@@ -1398,7 +1398,7 @@ struct Inlining : public Pass {
13981398 continue ;
13991399 }
14001400 Name inlinedName = inlinedFunction->name ;
1401- if (!isUnderSizeLimit (func->name , inlinedName)) {
1401+ if (!isUnderSizeLimit (func->name , inlinedName, getPassRunner ()-> options )) {
14021402 continue ;
14031403 }
14041404
@@ -1501,21 +1501,12 @@ struct Inlining : public Pass {
15011501 }
15021502
15031503 // Checks if the combined size of the code after inlining is under the
1504- // absolute size limit. We have an absolute limit in order to avoid
1505- // extremely-large sizes after inlining, as they may hit limits in VMs and/or
1506- // slow down startup (measurements there indicate something like ~1 second to
1507- // optimize a 100K function). See e.g.
1508- // https://github.com/WebAssembly/binaryen/pull/3730#issuecomment-867939138
1509- // https://github.com/emscripten-core/emscripten/issues/13899#issuecomment-825073344
1510- bool isUnderSizeLimit (Name target, Name source) {
1504+ // absolute size limit.
1505+ bool isUnderSizeLimit (Name target, Name source, PassOptions& options) {
15111506 // Estimate the combined binary size from the number of instructions.
15121507 auto combinedSize = infos[target].size + infos[source].size ;
15131508 auto estimatedBinarySize = Measurer::BytesPerExpr * combinedSize;
1514- // The limit is arbitrary, but based on the links above. It is a very high
1515- // value that should appear very rarely in practice (for example, it does
1516- // not occur on the Emscripten benchmark suite of real-world codebases).
1517- const Index MaxCombinedBinarySize = 400 * 1024 ;
1518- return estimatedBinarySize < MaxCombinedBinarySize;
1509+ return estimatedBinarySize < options.inlining .maxCombinedBinarySize ;
15191510 }
15201511};
15211512
0 commit comments