OLD | NEW |
1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // clang-format off | 5 // clang-format off |
6 // Flags: --expose-wasm | 6 // Flags: --expose-wasm |
7 | 7 |
8 load("test/mjsunit/wasm/wasm-constants.js"); | 8 load("test/mjsunit/wasm/wasm-constants.js"); |
9 load("test/mjsunit/wasm/wasm-module-builder.js"); | 9 load("test/mjsunit/wasm/wasm-module-builder.js"); |
10 | 10 |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 assertContains("out of bounds", e.message); | 118 assertContains("out of bounds", e.message); |
119 verifyStack(e.stack, [ | 119 verifyStack(e.stack, [ |
120 // isWasm function line pos file | 120 // isWasm function line pos file |
121 [ true, "", 2, 3, null], | 121 [ true, "", 2, 3, null], |
122 [ true, "call_mem_out_of_bounds", 3, 1, null], | 122 [ true, "call_mem_out_of_bounds", 3, 1, null], |
123 [ false, "testWasmMemOutOfBounds", 115, 0, "stack.js"], | 123 [ false, "testWasmMemOutOfBounds", 115, 0, "stack.js"], |
124 [ false, null, 127, 0, "stack.js"] | 124 [ false, null, 127, 0, "stack.js"] |
125 ]); | 125 ]); |
126 } | 126 } |
127 })(); | 127 })(); |
| 128 |
| 129 |
| 130 (function testStackOverflow() { |
| 131 print("testStackOverflow"); |
| 132 var builder = new WasmModuleBuilder(); |
| 133 |
| 134 var sig_index = builder.addType(kSig_v_v); |
| 135 builder.addFunction("recursion", sig_index) |
| 136 .addBody([ |
| 137 kExprI32Const, 0, |
| 138 kExprCallIndirect, kArity0, sig_index |
| 139 ]) |
| 140 .exportFunc() |
| 141 builder.appendToTable([0]); |
| 142 |
| 143 try { |
| 144 builder.instantiate().exports.recursion(); |
| 145 fail("expected wasm exception"); |
| 146 } catch (e) { |
| 147 assertEquals(kTrapMsgs[kTrapStackOverflow], e.message, "trap reason"); |
| 148 } |
| 149 })(); |
OLD | NEW |