From 0488582da887ffc523fc61bdfee93f2178ad91f4 Mon Sep 17 00:00:00 2001 From: Clemens Backes Date: Thu, 19 Jan 2023 12:53:10 +0100 Subject: [PATCH] [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 Reviewed-by: Andreas Haas Cr-Commit-Position: refs/heads/main@{#85441} --- src/wasm/function-compiler.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/wasm/function-compiler.cc b/src/wasm/function-compiler.cc index 7defa4f093..15f8c9d9f7 100644 --- a/src/wasm/function-compiler.cc +++ b/src/wasm/function-compiler.cc @@ -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()) {