| 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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 })(); | 115 })(); |
| 116 | 116 |
| 117 (function testWasmUnreachable() { | 117 (function testWasmUnreachable() { |
| 118 try { | 118 try { |
| 119 module.exports.exec_unreachable(); | 119 module.exports.exec_unreachable(); |
| 120 fail("expected wasm exception"); | 120 fail("expected wasm exception"); |
| 121 } catch (e) { | 121 } catch (e) { |
| 122 assertContains("unreachable", e.message); | 122 assertContains("unreachable", e.message); |
| 123 verifyStack(e.stack, [ | 123 verifyStack(e.stack, [ |
| 124 // function line file toString | 124 // function line file toString |
| 125 [ "exec_unreachable", null, null, "exec_unreachable (<WASM>:-1)"],
// TODO(clemensh): position should be 1 | 125 [ "exec_unreachable", null, null, "exec_unreachable (<WASM>:1)"], |
| 126 ["testWasmUnreachable", 119, "stack.js", "stack.js:119:20"], | 126 ["testWasmUnreachable", 119, "stack.js", "stack.js:119:20"], |
| 127 [ null, 136, "stack.js", "stack.js:136:3"] | 127 [ null, 136, "stack.js", "stack.js:136:3"] |
| 128 ]); | 128 ]); |
| 129 verifyWasmStack(e.stack, [ | 129 verifyWasmStack(e.stack, [ |
| 130 // isWasm funcIndex byteOffset | 130 // isWasm funcIndex byteOffset |
| 131 [ true, unreach_func.index, -1], // TODO(clemensh): position s
hould be 1 | 131 [ true, unreach_func.index, 1], |
| 132 [ false, undefined, null], | 132 [ false, undefined, null], |
| 133 [ false, undefined, null], | 133 [ false, undefined, null], |
| 134 ]); | 134 ]); |
| 135 } | 135 } |
| 136 })(); | 136 })(); |
| 137 | 137 |
| 138 (function testWasmMemOutOfBounds() { | 138 (function testWasmMemOutOfBounds() { |
| 139 try { | 139 try { |
| 140 module.exports.call_mem_out_of_bounds(); | 140 module.exports.call_mem_out_of_bounds(); |
| 141 fail("expected wasm exception"); | 141 fail("expected wasm exception"); |
| 142 } catch (e) { | 142 } catch (e) { |
| 143 assertContains("out of bounds", e.message); | 143 assertContains("out of bounds", e.message); |
| 144 verifyStack(e.stack, [ | 144 verifyStack(e.stack, [ |
| 145 // function line file toString | 145 // function line file toString |
| 146 [ "?", null, null, " (<WASM>:-1)"], // TOD
O(clemensh): position should be 1 | 146 [ "?", null, null, " (<WASM>:1)"], |
| 147 ["call_mem_out_of_bounds", null, null, "bounds (<WASM>:1)"], | 147 ["call_mem_out_of_bounds", null, null, "bounds (<WASM>:1)"], |
| 148 ["testWasmMemOutOfBounds", 140, "stack.js", "stack.js:140:20"], | 148 ["testWasmMemOutOfBounds", 140, "stack.js", "stack.js:140:20"], |
| 149 [ null, 160, "stack.js", "stack.js:160:3"] | 149 [ null, 160, "stack.js", "stack.js:160:3"] |
| 150 ]); | 150 ]); |
| 151 assertTrue(call_mem_oob_func.index != mem_oob_func.index); | 151 assertTrue(call_mem_oob_func.index != mem_oob_func.index); |
| 152 verifyWasmStack(e.stack, [ | 152 verifyWasmStack(e.stack, [ |
| 153 // isWasm funcIndex byteOffset | 153 // isWasm funcIndex byteOffset |
| 154 [ true, mem_oob_func.index, -1], // TODO(clemensh): positi
on should be 1 | 154 [ true, mem_oob_func.index, 1], |
| 155 [ true, call_mem_oob_func.index, 1], | 155 [ true, call_mem_oob_func.index, 1], |
| 156 [ false, undefined, 1], | 156 [ false, undefined, 1], |
| 157 [ false, undefined, 1], | 157 [ false, undefined, 1], |
| 158 ]); | 158 ]); |
| 159 } | 159 } |
| 160 })(); | 160 })(); |
| OLD | NEW |