(size)
| 281 | instances[4] = new WebAssembly.Instance(modules[1], {x: {table:table}}); |
| 282 | |
| 283 | function VerifyTableBoundsCheck(size) { |
| 284 | print("Verifying bounds for size = " + size); |
| 285 | assertEquals(size, table.length); |
| 286 | for (let i = 0; i < 5; i++) { |
| 287 | // Validity check for indirect call |
| 288 | assertEquals(10, instances[i].exports.main(0)); |
| 289 | // Bounds check at different out of bounds indices |
| 290 | assertInvalidFunction = function(s) { |
| 291 | assertThrows( |
| 292 | () => instances[i].exports.main(s), WebAssembly.RuntimeError, |
| 293 | kTrapMsgs[kTrapTableOutOfBounds]); |
| 294 | } |
| 295 | assertInvalidFunction(size); |
| 296 | assertInvalidFunction(size + 1); |
| 297 | assertInvalidFunction(size + 1000); |
| 298 | assertInvalidFunction(2 * size); |
| 299 | } |
| 300 | } |
| 301 | |
| 302 | for (let i = 0; i < 4; i++) { |
| 303 | VerifyTableBoundsCheck(99900 * i + 1); |
no test coverage detected