Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(790)

Unified Diff: test/mjsunit/wasm/stack.js

Issue 2256603002: [wasm] Add stack checks at the beginning of each function. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Use the right control input. Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/wasm/ast-decoder.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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");
+ }
+})();
« no previous file with comments | « src/wasm/ast-decoder.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698