| 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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 kExprGetLocal, 1, // -- | 71 kExprGetLocal, 1, // -- |
| 72 kExprI64Sub]) // -- | 72 kExprI64Sub]) // -- |
| 73 .exportFunc() | 73 .exportFunc() |
| 74 | 74 |
| 75 var module = builder.instantiate(); | 75 var module = builder.instantiate(); |
| 76 | 76 |
| 77 assertThrows(function() { | 77 assertThrows(function() { |
| 78 module.exports.function_with_invalid_signature(33, 88); | 78 module.exports.function_with_invalid_signature(33, 88); |
| 79 }, TypeError); | 79 }, TypeError); |
| 80 })(); | 80 })(); |
| 81 |
| 82 (function I64JSImportThrows() { |
| 83 var builder = new WasmModuleBuilder(); |
| 84 |
| 85 var sig_index = builder.addType(kSig_i_i); |
| 86 var sig_i64_index = builder.addType(kSig_i_l); |
| 87 var index = builder.addImport("func", sig_i64_index); |
| 88 builder.addFunction("main", sig_index) |
| 89 .addBody([ |
| 90 kExprGetLocal, 0, |
| 91 kExprI64SConvertI32, |
| 92 kExprCallImport, kArity1, index // -- |
| 93 ]) // -- |
| 94 .exportFunc(); |
| 95 |
| 96 var func = function() {return {};}; |
| 97 var main = builder.instantiate({func: func}).exports.main; |
| 98 assertThrows(function() { |
| 99 main(13); |
| 100 }, TypeError); |
| 101 })(); |
| OLD | NEW |