diff options
Diffstat (limited to 'deps/v8/test/mjsunit/wasm/memory.js')
-rw-r--r-- | deps/v8/test/mjsunit/wasm/memory.js | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/deps/v8/test/mjsunit/wasm/memory.js b/deps/v8/test/mjsunit/wasm/memory.js index e86825bd27..1fbe0581b1 100644 --- a/deps/v8/test/mjsunit/wasm/memory.js +++ b/deps/v8/test/mjsunit/wasm/memory.js @@ -91,3 +91,13 @@ function assertMemoryIsValid(memory) { assertThrows(() => {'use strict'; memory.buffer = memory.buffer}, TypeError) assertThrows(() => ({__proto__: memory}).buffer, TypeError) })(); + +(function TestMemoryGrow() { + var kPageSize = 65536; + let memory = new WebAssembly.Memory({initial: 1, maximum:30}); + assertEquals(1, memory.grow(9)); + assertTrue(memory.buffer instanceof ArrayBuffer); + assertTrue(10*kPageSize == memory.buffer.byteLength); + assertMemoryIsValid(memory); + assertThrows(() => memory.grow(21)); +})(); |