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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 | 128 |
129 | 129 |
130 (function testStackOverflow() { | 130 (function testStackOverflow() { |
131 print("testStackOverflow"); | 131 print("testStackOverflow"); |
132 var builder = new WasmModuleBuilder(); | 132 var builder = new WasmModuleBuilder(); |
133 | 133 |
134 var sig_index = builder.addType(kSig_v_v); | 134 var sig_index = builder.addType(kSig_v_v); |
135 builder.addFunction("recursion", sig_index) | 135 builder.addFunction("recursion", sig_index) |
136 .addBody([ | 136 .addBody([ |
137 kExprI32Const, 0, | 137 kExprI32Const, 0, |
138 kExprCallIndirect, sig_index | 138 kExprCallIndirect, kTableZero, sig_index |
139 ]) | 139 ]) |
140 .exportFunc() | 140 .exportFunc() |
141 builder.appendToTable([0]); | 141 builder.appendToTable([0]); |
142 | 142 |
143 try { | 143 try { |
144 builder.instantiate().exports.recursion(); | 144 builder.instantiate().exports.recursion(); |
145 fail("expected wasm exception"); | 145 fail("expected wasm exception"); |
146 } catch (e) { | 146 } catch (e) { |
147 assertEquals("Maximum call stack size exceeded", e.message, "trap reason"); | 147 assertEquals("Maximum call stack size exceeded", e.message, "trap reason"); |
148 } | 148 } |
149 })(); | 149 })(); |
OLD | NEW |