Commit 4722852b authored by Jakob Kummerow's avatar Jakob Kummerow Committed by V8 LUCI CQ

[wasm] Don't optimize super-large functions

We've seen Turbofan take excessive amounts of time for very large
functions. As a short-term mitigation, this patch disables optimization
for functions larger than 500KB (in their Wasm binary format).
Functions of such sizes are rare, so most modules should be unaffected
by this patch.

Change-Id: I9d222df5ca51b0fb5d6db7a7e9e3402f5276ff38
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2982608Reviewed-by: 's avatarAndreas Haas <ahaas@chromium.org>
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/master@{#75364}
parent 8224f4f5
......@@ -934,6 +934,19 @@ ExecutionTierPair GetRequestedExecutionTiers(
}
}
// Skip Turbofan compilation for super-large functions, because it
// would likely take so long that it's not worth it.
// TODO(jkummerow): This is a stop-gap solution to avoid excessive
// compile times. We would like to replace this hard threshold with
// a better solution (TBD) eventually.
uint32_t size = module->functions[func_index].code.length();
constexpr uint32_t kMaxWasmFunctionSizeForTurbofan = 500 * KB;
if (size > kMaxWasmFunctionSizeForTurbofan) {
result.top_tier = ExecutionTier::kLiftoff;
TRACE_COMPILE("Not optimizing function #%d because it's too big",
func_index);
}
// Correct top tier if necessary.
static_assert(ExecutionTier::kLiftoff < ExecutionTier::kTurbofan,
"Assume an order on execution tiers");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment