| 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 // Flags: --expose-wasm | 5 // Flags: --expose-wasm |
| 6 | 6 |
| 7 load("test/mjsunit/wasm/wasm-constants.js"); | 7 load("test/mjsunit/wasm/wasm-constants.js"); |
| 8 load("test/mjsunit/wasm/wasm-module-builder.js"); | 8 load("test/mjsunit/wasm/wasm-module-builder.js"); |
| 9 | 9 |
| 10 var builder = new WasmModuleBuilder(); | 10 var builder = new WasmModuleBuilder(); |
| 11 | 11 |
| 12 var last_func_index = builder.addFunction("exec_unreachable", kSig_v_v) | 12 var last_func_index = builder.addFunction("exec_unreachable", kSig_v_v) |
| 13 .addBody([kExprUnreachable]) | 13 .addBody([kExprUnreachable]).index |
| 14 | 14 |
| 15 var illegal_func_name = [0xff]; | 15 var illegal_func_name = [0xff]; |
| 16 var func_names = [ "☠", illegal_func_name, "some math: (½)² = ¼", "" ]; | 16 var func_names = [ "☠", illegal_func_name, "some math: (½)² = ¼", "" ]; |
| 17 var expected_names = ["exec_unreachable", "☠", null, | 17 var expected_names = ["exec_unreachable", "☠", null, |
| 18 "some math: (½)² = ¼", "", "main"]; | 18 "some math: (½)² = ¼", "", "main"]; |
| 19 | 19 |
| 20 for (var func_name of func_names) { | 20 for (var func_name of func_names) { |
| 21 last_func_index = builder.addFunction(func_name, kSig_v_v) | 21 last_func_index = builder.addFunction(func_name, kSig_v_v) |
| 22 .addBody([kExprCallFunction, last_func_index]).index; | 22 .addBody([kExprCallFunction, last_func_index]).index; |
| 23 } | 23 } |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 try { | 60 try { |
| 61 module.exports.main(); | 61 module.exports.main(); |
| 62 assertFalse("should throw"); | 62 assertFalse("should throw"); |
| 63 } catch (e) { | 63 } catch (e) { |
| 64 assertEquals(names.length, e.stack.length); | 64 assertEquals(names.length, e.stack.length); |
| 65 for (var i = 0; i < names.length; ++i) { | 65 for (var i = 0; i < names.length; ++i) { |
| 66 assertEquals(names[i], e.stack[i].getFunctionName()); | 66 assertEquals(names[i], e.stack[i].getFunctionName()); |
| 67 } | 67 } |
| 68 } | 68 } |
| 69 })(); | 69 })(); |
| OLD | NEW |