| 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(func, check) { | 10 function testCallFFI(func, check) { |
| 11 var builder = new WasmModuleBuilder(); | 11 var builder = new WasmModuleBuilder(); |
| 12 | 12 |
| 13 var sig_index = builder.addSignature(kSig_i_dd); | 13 var sig_index = builder.addType(kSig_i_dd); |
| 14 builder.addImport("func", sig_index); | 14 builder.addImport("func", sig_index); |
| 15 builder.addFunction("main", sig_index) | 15 builder.addFunction("main", sig_index) |
| 16 .addBody([ | 16 .addBody([ |
| 17 kExprGetLocal, 0, // -- | 17 kExprGetLocal, 0, // -- |
| 18 kExprGetLocal, 1, // -- | 18 kExprGetLocal, 1, // -- |
| 19 kExprCallImport, kArity2, 0 // -- | 19 kExprCallImport, kArity2, 0 // -- |
| 20 ]) // -- | 20 ]) // -- |
| 21 .exportFunc(); | 21 .exportFunc(); |
| 22 | 22 |
| 23 var main = builder.instantiate({func: func}).exports.main; | 23 var main = builder.instantiate({func: func}).exports.main; |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 251 kExprCallImport, kArity1, 1 // -- | 251 kExprCallImport, kArity1, 1 // -- |
| 252 ]) // -- | 252 ]) // -- |
| 253 .exportFunc() | 253 .exportFunc() |
| 254 | 254 |
| 255 var main = builder.instantiate({print: print}).exports.main; | 255 var main = builder.instantiate({print: print}).exports.main; |
| 256 for (var i = -9; i < 900; i += 6.125) main(i); | 256 for (var i = -9; i < 900; i += 6.125) main(i); |
| 257 } | 257 } |
| 258 | 258 |
| 259 testCallPrint(); | 259 testCallPrint(); |
| 260 testCallPrint(); | 260 testCallPrint(); |
| OLD | NEW |