Index: test/mjsunit/wasm/grow-memory.js |
diff --git a/test/mjsunit/wasm/grow-memory.js b/test/mjsunit/wasm/grow-memory.js |
index 27aca22d1a68060dc3ea95371046cbe5be9cbf4f..473760fc3d1c2601cbc9274f6692762902b01798 100644 |
--- a/test/mjsunit/wasm/grow-memory.js |
+++ b/test/mjsunit/wasm/grow-memory.js |
@@ -117,3 +117,14 @@ function testGrowMemoryTrapMaxPages() { |
} |
testGrowMemoryTrapMaxPages(); |
+ |
+function testGrowMemoryTrapsWithNonSmiInput() { |
+ var builder = genGrowMemoryBuilder(); |
+ var module = builder.instantiate(); |
+ function growMem(pages) { return module.exports.grow_memory(pages); } |
+ // The parameter of grow_memory is unsigned. Therefore -1 stands for |
+ // UINT32_MIN, which cannot be represented as SMI. |
+ assertEquals(-1, growMem(-1)); |
+}; |
+ |
+testGrowMemoryTrapsWithNonSmiInput(); |