Commit c255e5fb authored by Ng Zhi An's avatar Ng Zhi An Committed by Commit Bot

Remove redundant buffer read/write checks

The point of this test is to check for OOB access traps, the read/write
of the entire backing buffer is not useful to this test, and causes the
test to be really slow, especially on arm simulator. This change cuts
the runtime of the test from ~7.5min to ~1.5min.

Bug: v8:7783
Bug: v8:9396
Change-Id: Id57648e920b7631d8c481d2a43ded1c16cd2d1d3
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1793905
Commit-Queue: Zhi An Ng <zhin@chromium.org>
Reviewed-by: 's avatarClemens Hammacher <clemensh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#63726}
parent a31d04d7
......@@ -145,23 +145,20 @@ function testOOBThrows() {
.exportFunc();
var module = builder.instantiate();
var offset;
function read() { return module.exports.geti(0, offset); }
function write() { return module.exports.geti(offset, 0); }
let read = offset => module.exports.geti(0, offset);
let write = offset => module.exports.geti(offset, 0);
for (offset = 0; offset < 65533; offset++) {
assertEquals(0, read());
assertEquals(0, write());
}
assertEquals(0, read(65532));
assertEquals(0, write(65532));
// Note that this test might be run concurrently in multiple Isolates, which
// makes an exact comparison of the expected trap count unreliable. But is is
// still possible to check the lower bound for the expected trap count.
for (offset = 65534; offset < 66536; offset++) {
for (let offset = 65534; offset < 66536; offset++) {
const trap_count = %GetWasmRecoveredTrapCount();
assertTraps(kTrapMemOutOfBounds, read);
assertTraps(kTrapMemOutOfBounds, write);
assertTraps(kTrapMemOutOfBounds, () => read(offset));
assertTraps(kTrapMemOutOfBounds, () => write(offset));
if (%IsWasmTrapHandlerEnabled()) {
assertTrue(trap_count + 2 <= %GetWasmRecoveredTrapCount());
}
......
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