Index: test/mjsunit/wasm/stack.js |
diff --git a/test/mjsunit/wasm/stack.js b/test/mjsunit/wasm/stack.js |
index 4ff0d1d4fd5158edad14006a919d9eddb75948b0..0197b77caf9db1710bbc9db66185cf50a0a9a5de 100644 |
--- a/test/mjsunit/wasm/stack.js |
+++ b/test/mjsunit/wasm/stack.js |
@@ -125,3 +125,25 @@ Error.prepareStackTrace = function(error, frames) { |
]); |
} |
})(); |
+ |
+ |
+(function testStackOverflow() { |
+ print("testStackOverflow"); |
+ var builder = new WasmModuleBuilder(); |
+ |
+ var sig_index = builder.addType(kSig_v_v); |
+ builder.addFunction("recursion", sig_index) |
+ .addBody([ |
+ kExprI32Const, 0, |
+ kExprCallIndirect, kArity0, sig_index |
+ ]) |
+ .exportFunc() |
+ builder.appendToTable([0]); |
+ |
+ try { |
+ builder.instantiate().exports.recursion(); |
+ fail("expected wasm exception"); |
+ } catch (e) { |
+ assertEquals("Maximum call stack size exceeded", e.message, "trap reason"); |
+ } |
+})(); |