Index: test/mjsunit/wasm/table.js |
diff --git a/test/mjsunit/wasm/table.js b/test/mjsunit/wasm/table.js |
index d2b0dcdee6c6d197181eb767f1e3136dbf575b64..ed5c61f41a6f91ed5cff054e3f063866e0333fa2 100644 |
--- a/test/mjsunit/wasm/table.js |
+++ b/test/mjsunit/wasm/table.js |
@@ -13,6 +13,8 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); |
var outOfUint32RangeValue = 1e12; |
var int32ButOob = 1073741824; |
+var kMaxUint32 = (4 * 1024 * 1024 * 1024) - 1; |
+var kV8MaxWasmTableSize = 10000000; |
function assertTableIsValid(table) { |
assertSame(WebAssembly.Table.prototype, table.__proto__); |
@@ -41,14 +43,17 @@ function assertTableIsValid(table) { |
assertThrows(() => new WebAssembly.Table({element: 0, initial: 10}), TypeError); |
assertThrows(() => new WebAssembly.Table({element: "any", initial: 10}), TypeError); |
- assertThrows(() => new WebAssembly.Table({element: "anyfunc", initial: -1}), RangeError); |
- assertThrows(() => new WebAssembly.Table({element: "anyfunc", initial: outOfUint32RangeValue}), RangeError); |
+ assertThrows(() => new WebAssembly.Table( |
+ {element: "anyfunc", initial: -1}), RangeError); |
+ assertThrows(() => new WebAssembly.Table( |
+ {element: "anyfunc", initial: outOfUint32RangeValue}), RangeError); |
- assertThrows(() => new WebAssembly.Table({element: "anyfunc", initial: 10, maximum: -1}), RangeError); |
- assertThrows(() => new WebAssembly.Table({element: "anyfunc", initial: 10, maximum: outOfUint32RangeValue}), RangeError); |
- assertThrows(() => new WebAssembly.Table({element: "anyfunc", initial: 10, maximum: 9}), RangeError); |
- |
- assertThrows(() => new WebAssembly.Table({element: "anyfunc", initial: 0, maximum: int32ButOob})); |
+ assertThrows(() => new WebAssembly.Table( |
+ {element: "anyfunc", initial: 10, maximum: -1}), RangeError); |
+ assertThrows(() => new WebAssembly.Table( |
+ {element: "anyfunc", initial: 10, maximum: outOfUint32RangeValue}), RangeError); |
+ assertThrows(() => new WebAssembly.Table( |
+ {element: "anyfunc", initial: 10, maximum: 9}), RangeError); |
let table; |
table = new WebAssembly.Table({element: "anyfunc", initial: 1}); |
@@ -94,6 +99,14 @@ function assertTableIsValid(table) { |
table = new WebAssembly.Table({element: "anyfunc", initial: 0, maximum: undefined}); |
assertTableIsValid(table); |
assertEquals(0, table.length); |
+ |
+ table = new WebAssembly.Table({element: "anyfunc", maximum: kMaxUint32}); |
+ assertTableIsValid(table); |
+ assertEquals(0, table.length); |
+ |
+ table = new WebAssembly.Table({element: "anyfunc", maximum: kV8MaxWasmTableSize + 1}); |
+ assertTableIsValid(table); |
+ assertEquals(0, table.length); |
})(); |
(function TestMaximumIsReadOnce() { |
@@ -260,4 +273,9 @@ function assertTableIsValid(table) { |
assertThrows(() => table.grow(-10), RangeError); |
assertThrows(() => WebAssembly.Table.prototype.grow.call([], 0), TypeError); |
+ |
+ table = new WebAssembly.Table( |
+ {element: "anyfunc", initial: 0, maximum: kV8MaxWasmTableSize}); |
+ table.grow(kV8MaxWasmTableSize); |
+ assertThrows(() => table.grow(1), RangeError); |
})(); |