Commit b0b4e6ca authored by Clemens Backes's avatar Clemens Backes Committed by Commit Bot

[wasm] Fix --no-wasm-bounds-checks flag

If bounds checks are completely disabled (for performance testing) we
would still emit protected instructions which generate landing pads for
trap handlers in code generation. This CL fixes that by implicitly
disabling trap handling if stack checks are disabled.

R=ahaas@chromium.org

Bug: v8:10949
Change-Id: I1172087fb14ab56e9117c6eee388f71099568a13
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2808946Reviewed-by: 's avatarMaya Lekova <mslekova@chromium.org>
Reviewed-by: 's avatarAndreas Haas <ahaas@chromium.org>
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#73832}
parent 0c3b4220
......@@ -438,6 +438,7 @@ class WasmProtectedInstructionTrap final : public WasmOutOfLineTrap {
: WasmOutOfLineTrap(gen, instr), pc_(pc) {}
void Generate() override {
DCHECK(FLAG_wasm_bounds_checks && FLAG_wasm_trap_handler);
gen_->AddProtectedInstructionLanding(pc_, __ pc_offset());
GenerateWithTrapId(TrapId::kTrapMemOutOfBounds);
}
......
......@@ -376,6 +376,7 @@ class WasmProtectedInstructionTrap final : public WasmOutOfLineTrap {
: WasmOutOfLineTrap(gen, instr), pc_(pc) {}
void Generate() final {
DCHECK(FLAG_wasm_bounds_checks && FLAG_wasm_trap_handler);
gen_->AddProtectedInstructionLanding(pc_, __ pc_offset());
GenerateWithTrapId(TrapId::kTrapMemOutOfBounds);
}
......
......@@ -965,6 +965,8 @@ DEFINE_BOOL(wasm_loop_unrolling, false,
DEFINE_BOOL(wasm_trap_handler, true,
"use signal handlers to catch out of bounds memory access in wasm"
" (currently Linux x86_64 only)")
// "no bounds checks" implies "no trap handlers".
DEFINE_NEG_NEG_IMPLICATION(wasm_bounds_checks, wasm_trap_handler)
DEFINE_BOOL(wasm_fuzzer_gen_test, false,
"generate a test case when running a wasm fuzzer")
DEFINE_IMPLICATION(wasm_fuzzer_gen_test, single_threaded)
......
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