summaryrefslogtreecommitdiff
path: root/deps/v8/test/mjsunit/wasm/stack.js
diff options
context:
space:
mode:
Diffstat (limited to 'deps/v8/test/mjsunit/wasm/stack.js')
-rw-r--r--deps/v8/test/mjsunit/wasm/stack.js30
1 files changed, 20 insertions, 10 deletions
diff --git a/deps/v8/test/mjsunit/wasm/stack.js b/deps/v8/test/mjsunit/wasm/stack.js
index d7c399dc03..79ab28e367 100644
--- a/deps/v8/test/mjsunit/wasm/stack.js
+++ b/deps/v8/test/mjsunit/wasm/stack.js
@@ -42,7 +42,9 @@ function STACK() {
var builder = new WasmModuleBuilder();
-builder.addImport("func", kSig_v_v);
+builder.addMemory(0, 1, false);
+
+builder.addImport("mod", "func", kSig_v_v);
builder.addFunction("main", kSig_v_v)
.addBody([kExprCallFunction, 0])
@@ -63,15 +65,15 @@ builder.addFunction("call_mem_out_of_bounds", kSig_i_v)
.addBody([kExprCallFunction, mem_oob_func.index])
.exportAs("call_mem_out_of_bounds");
-var module = builder.instantiate({func: STACK});
+var module = builder.instantiate({mod: {func: STACK}});
(function testSimpleStack() {
var expected_string = "Error\n" +
// The line numbers below will change as this test gains / loses lines..
" at STACK (stack.js:39:11)\n" + // --
" at main (<WASM>[1]+1)\n" + // --
- " at testSimpleStack (stack.js:76:18)\n" + // --
- " at stack.js:78:3"; // --
+ " at testSimpleStack (stack.js:78:18)\n" + // --
+ " at stack.js:80:3"; // --
module.exports.main();
assertEquals(expected_string, stripPath(stack));
@@ -90,8 +92,8 @@ Error.prepareStackTrace = function(error, frames) {
// isWasm function line pos file
[ false, "STACK", 39, 0, "stack.js"],
[ true, "main", 1, 1, null],
- [ false, "testStackFrames", 87, 0, "stack.js"],
- [ false, null, 96, 0, "stack.js"]
+ [ false, "testStackFrames", 89, 0, "stack.js"],
+ [ false, null, 98, 0, "stack.js"]
]);
})();
@@ -104,8 +106,8 @@ Error.prepareStackTrace = function(error, frames) {
verifyStack(e.stack, [
// isWasm function line pos file
[ true, "exec_unreachable", 2, 1, null],
- [ false, "testWasmUnreachable", 100, 0, "stack.js"],
- [ false, null, 111, 0, "stack.js"]
+ [ false, "testWasmUnreachable", 102, 0, "stack.js"],
+ [ false, null, 113, 0, "stack.js"]
]);
}
})();
@@ -120,8 +122,8 @@ Error.prepareStackTrace = function(error, frames) {
// isWasm function line pos file
[ true, "", 3, 3, null],
[ true, "call_mem_out_of_bounds", 4, 1, null],
- [ false, "testWasmMemOutOfBounds", 115, 0, "stack.js"],
- [ false, null, 127, 0, "stack.js"]
+ [ false, "testWasmMemOutOfBounds", 117, 0, "stack.js"],
+ [ false, null, 129, 0, "stack.js"]
]);
}
})();
@@ -145,5 +147,13 @@ Error.prepareStackTrace = function(error, frames) {
fail("expected wasm exception");
} catch (e) {
assertEquals("Maximum call stack size exceeded", e.message, "trap reason");
+ assertTrue(e.stack.length >= 4, "expected at least 4 stack entries");
+ verifyStack(e.stack.splice(0, 4), [
+ // isWasm function line pos file
+ [ true, "recursion", 0, 0, null],
+ [ true, "recursion", 0, 3, null],
+ [ true, "recursion", 0, 3, null],
+ [ true, "recursion", 0, 3, null]
+ ]);
}
})();