From a8a8e6b797e7f5d0e35a9b1d59533fa50fac3607 Mon Sep 17 00:00:00 2001 From: Jakob Gruber Date: Wed, 21 Apr 2021 08:43:50 +0200 Subject: [PATCH] Remove FlagScope use in test-js-to-wasm.cc Flag reads from background threads are unfortunately scattered and hard to completely avoid in the current state of V8. An example TSAN failure: ci.chromium.org/ui/p/v8/builders/ci/V8%20Linux64%20TSAN/36369/overview The root cause is that FlagScope destruction modifies flag values on the main thread, racing with flag reads from the background thread. In cctests, there's no need to reset flags back to initial values at the end of tests. Let's simply remove the problematic flag scopes. Bug: v8:11658 Change-Id: I59ed3794ddc9ed570772726a423dc22afc4dc207 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2843346 Auto-Submit: Jakob Gruber Reviewed-by: Clemens Backes Commit-Queue: Clemens Backes Cr-Commit-Position: refs/heads/master@{#74082} --- test/cctest/test-js-to-wasm.cc | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/test/cctest/test-js-to-wasm.cc b/test/cctest/test-js-to-wasm.cc index e1734162e8..21cfa77b21 100644 --- a/test/cctest/test-js-to-wasm.cc +++ b/test/cctest/test-js-to-wasm.cc @@ -262,12 +262,13 @@ enum TestMode { kJSToWasmInliningDisabled, kJSToWasmInliningEnabled }; class FastJSWasmCallTester { public: FastJSWasmCallTester() - : allow_natives_syntax_(&i::FLAG_allow_natives_syntax, true), - inline_js_wasm_calls_(&i::FLAG_turbo_inline_js_wasm_calls, true), - stress_background_compile_(&i::FLAG_stress_background_compile, false), - allocator_(), + : allocator_(), zone_(&allocator_, ZONE_NAME), - builder_(zone_.New(&zone_)) {} + builder_(zone_.New(&zone_)) { + i::FLAG_allow_natives_syntax = true; + i::FLAG_turbo_inline_js_wasm_calls = true; + i::FLAG_stress_background_compile = false; + } void DeclareCallback(const char* name, FunctionSig* signature, const char* module) { @@ -742,9 +743,6 @@ class FastJSWasmCallTester { return string_stream.str(); } - i::FlagScope allow_natives_syntax_; - i::FlagScope inline_js_wasm_calls_; - i::FlagScope stress_background_compile_; AccountingAllocator allocator_; Zone zone_; WasmModuleBuilder* builder_;