v8/test/cctest/wasm
Andreas Haas 51bdde997e [wasm] Add filter to NativeModule::RemoveCompiledCode
There was a concurrency issue `WasmEngine::EnterDebuggingForIsolate`
which gets fixed by this CL. When multiple isolates entered debugging
concurrently, then only the first CL that changes the debug state of
a NativeModule would remove all compiled code from the NativeModule.
However, changing the debug state and removing the compiled code would
not happen atomically inside a lock. Instead, first the debug state
gets changed inside the lock, and then the compiled code gets removed
outside the lock. The concurrency issue is now the following.

Assume isolate A enters debugging. It takes the lock, and then changes
the debug state. As it changes the debugging state, it is the task of
isolate A to delete all code. Concurrently isolate B also enters
debugging. It sees that the debug state is already changed to debug
state and therefore just continues execution without removing code
first. In the following execution of isolate B non-debug code may get
executed if isolate A is slow with removing the code.

This CL fixes the issue by adding a filter to `RemoveCompiledCode`, and
then letting all isolates remove compiled code according to the filter.
This means that isolate B would also iterate over all the code and
remove all functions which are non-debug functions. This guarantees
that isolate B does not execute non-debug code that existed before
isolate B entered debugging.

R=clemensb@chromium.org

Bug: v8:13541
Cq-Include-Trybots: luci.v8.try:v8_linux64_tsan_rel
Cq-Include-Trybots: luci.v8.try:v8_linux64_tsan_isolates_rel
Change-Id: If688c7f9b15f78e6cd6898123a321e577d32365f
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/4111524
Auto-Submit: Andreas Haas <ahaas@chromium.org>
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/main@{#84919}
2022-12-18 16:44:01 +00:00
..
DIR_METADATA
OWNERS
test-backing-store.cc [arraybuffers, api] Implement [[ArrayBufferDetachKey]] support 2022-10-21 12:55:18 +00:00
test-c-wasm-entry.cc [test] Migrate cctest/compiler/test-codegen to unittests/ 2022-08-22 17:28:27 +00:00
test-compilation-cache.cc [wasm] Use v8_flags for accessing flag values 2022-08-29 12:43:46 +00:00
test-gc.cc [wasm-gc] Subtyping support for call_indirect 2022-12-16 13:24:24 +00:00
test-grow-memory.cc
test-jump-table-assembler.cc Reland "[wasm] Do not add too much code at once" 2022-11-14 18:10:10 +00:00
test-liftoff-for-fuzzing.cc
test-liftoff-inspection.cc Reland: "[wasm] Compile debug code lazily" 2022-12-15 14:59:13 +00:00
test-run-wasm-64.cc [test] Migrate cctest/compiler/test-codegen to unittests/ 2022-08-22 17:28:27 +00:00
test-run-wasm-asmjs.cc [wasm] Do not validate asm.js code 2022-12-13 17:46:59 +00:00
test-run-wasm-atomics64.cc [cleanup] Remove flag for Wasm threads & atomics 2022-10-19 23:05:37 +00:00
test-run-wasm-atomics.cc [cleanup] Remove flag for Wasm threads & atomics 2022-10-19 23:05:37 +00:00
test-run-wasm-bulk-memory.cc [wasm] Enable --wasm-type-canonicalization, remove old code 2022-09-15 16:22:18 +00:00
test-run-wasm-exceptions.cc [wasm] Do not validate asm.js code 2022-12-13 17:46:59 +00:00
test-run-wasm-interpreter.cc [cctest] Use v8_flags for accessing flag values 2022-09-16 08:22:03 +00:00
test-run-wasm-js.cc [wasm] Do not validate asm.js code 2022-12-13 17:46:59 +00:00
test-run-wasm-memory64.cc [wasm] Do not validate asm.js code 2022-12-13 17:46:59 +00:00
test-run-wasm-module.cc [wasm] Use v8_flags for accessing flag values 2022-08-29 12:43:46 +00:00
test-run-wasm-relaxed-simd.cc [relaxed-simd] Fix ordering of relaxed FMA/FNMA operands 2022-12-16 19:12:44 +00:00
test-run-wasm-sign-extension.cc
test-run-wasm-simd-liftoff.cc [cleanup] Remove Wasm SIMD flag & deprecate embedder-enabling API 2022-10-22 00:47:42 +00:00
test-run-wasm-simd.cc [wasm][revec] Decision and Transformation 2022-12-16 13:14:35 +00:00
test-run-wasm-wrappers.cc [wasm-gc] Always use JSToWasmObject at the JS-to-Wasm boundary 2022-09-07 14:36:05 +00:00
test-run-wasm.cc Reland: "[wasm] Compile debug code lazily" 2022-12-15 14:59:13 +00:00
test-streaming-compilation.cc Reland: "[wasm] Compile debug code lazily" 2022-12-15 14:59:13 +00:00
test-wasm-breakpoints.cc Reland: "[wasm] Compile debug code lazily" 2022-12-15 14:59:13 +00:00
test-wasm-codegen.cc
test-wasm-import-wrapper-cache.cc [wasm] Do not validate asm.js code 2022-12-13 17:46:59 +00:00
test-wasm-metrics.cc [wasm] Remove thread timings (CPU time) 2022-12-09 12:11:22 +00:00
test-wasm-serialization.cc Reland: "[wasm] Compile debug code lazily" 2022-12-15 14:59:13 +00:00
test-wasm-shared-engine.cc Reland: [heap] Load MarkingBarrier from thread local on main thread 2022-11-14 12:18:18 +00:00
test-wasm-stack.cc [wasm] Do not validate asm.js code 2022-12-13 17:46:59 +00:00
test-wasm-strings.cc [stringrefs] Add generalized UTF-8 decoder / validator 2022-05-20 08:05:04 +00:00
test-wasm-trap-position.cc [wasm] Do not validate asm.js code 2022-12-13 17:46:59 +00:00
wasm-atomics-utils.h [test] Migrate cctest/compiler/test-codegen to unittests/ 2022-08-22 17:28:27 +00:00
wasm-run-utils.cc [wasm] Move Int64Lowering to a later point 2022-12-16 16:17:36 +00:00
wasm-run-utils.h [wasm] Add filter to NativeModule::RemoveCompiledCode 2022-12-18 16:44:01 +00:00
wasm-simd-utils.cc [test] Migrate cctest/compiler/test-codegen to unittests/ 2022-08-22 17:28:27 +00:00
wasm-simd-utils.h [wasm-relaxed-simd][x64] Prototype relaxed min and max 2021-10-21 00:58:24 +00:00