| OLD | NEW |
| 1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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 function testCallFFI(ffi) { | 10 function testCallFFI(ffi) { |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 kExprI64SConvertI32, | 108 kExprI64SConvertI32, |
| 109 kExprCallFunction, index // -- | 109 kExprCallFunction, index // -- |
| 110 ]) // -- | 110 ]) // -- |
| 111 .exportFunc(); | 111 .exportFunc(); |
| 112 var func = function() {return {};}; | 112 var func = function() {return {};}; |
| 113 var main = builder.instantiate({func: func}).exports.main; | 113 var main = builder.instantiate({func: func}).exports.main; |
| 114 assertThrows(function() { | 114 assertThrows(function() { |
| 115 main(13); | 115 main(13); |
| 116 }, TypeError); | 116 }, TypeError); |
| 117 })(); | 117 })(); |
| 118 |
| 119 (function ImportSymbolToNumberThrows() { |
| 120 var builder = new WasmModuleBuilder(); |
| 121 var index = builder.addImport("func", kSig_i_v); |
| 122 builder.addFunction("main", kSig_i_v) |
| 123 .addBody([kExprCallFunction, 0]) |
| 124 .exportFunc(); |
| 125 var func = () => Symbol(); |
| 126 var main = builder.instantiate({func: func}).exports.main; |
| 127 assertThrows(() => main(), TypeError); |
| 128 })(); |
| OLD | NEW |