[wasm-simd] Add OOB tests for v128 load zero

Bug: v8:10713
Change-Id: I7b123347e00f31d071d45e3b807354610b71ed2d
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2486238
Reviewed-by: Bill Budge <bbudge@chromium.org>
Commit-Queue: Zhi An Ng <zhin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#70667}
This commit is contained in:
Ng Zhi An 2020-10-20 10:31:38 -07:00 committed by Commit Bot
parent 83348261fc
commit 7da1a952c7

View File

@ -3720,6 +3720,22 @@ void RunLoadZeroTest(TestExecutionTier execution_tier, LowerSimd lower_simd,
for (int i = 1; i < lanes_s; i++) {
CHECK_EQ(S{0}, ReadLittleEndianValue<S>(&global[i]));
}
// Test for OOB.
{
WasmRunner<int32_t, uint32_t> r(execution_tier, lower_simd);
r.builder().AddMemoryElems<S>(kWasmPageSize / sizeof(S));
r.builder().AddGlobal<S>(kWasmS128);
BUILD(r, WASM_SET_GLOBAL(0, WASM_SIMD_LOAD_OP(op, WASM_GET_LOCAL(0))),
WASM_ONE);
// Load extends load sizeof(S) bytes.
for (uint32_t offset = kWasmPageSize - (sizeof(S) - 1);
offset < kWasmPageSize; ++offset) {
CHECK_TRAP(r.Call(offset));
}
}
}
WASM_SIMD_TEST_NO_LOWERING(S128Load32Zero) {