[wasm] Add DCHECK that we do not validate unexpectedly

After several fixes (https://crrev.com/c/4152483,
https://crrev.com/c/4152489, https://crrev.com/c/4152950,
https://crrev.com/c/4168411, https://crrev.com/c/4168412), we can
finally add the DCHECK that we do not have to validate functions under
normal circumstances (if no non-default flags are enabled).

This should protect us against future bugs that lead to
double-validation and hence unnecessary overhead.

R=ahaas@chromium.org

Change-Id: I519b221b96c43f921677e0ab8e519ede249ef12e
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/4178823
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Reviewed-by: Andreas Haas <ahaas@chromium.org>
Cr-Commit-Position: refs/heads/main@{#85441}
This commit is contained in:
Clemens Backes 2023-01-19 12:53:10 +01:00 committed by V8 LUCI CQ
parent a41eb50499
commit 0488582da8

View File

@ -88,7 +88,9 @@ WasmCompilationResult WasmCompilationUnit::ExecuteFunctionCompilation(
// - with lazy validation,
// - with PGO (which compiles some functions eagerly), or
// - with compilation hints (which also compiles some functions eagerly).
// TODO(clemensb): Add a proper check.
DCHECK(!v8_flags.wasm_lazy_compilation || v8_flags.wasm_lazy_validation ||
v8_flags.experimental_wasm_pgo_from_file ||
v8_flags.experimental_wasm_compilation_hints);
if (ValidateFunctionBody(env->enabled_features, env->module, detected,
func_body)
.failed()) {