OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 // Flags: --expose-wasm |
| 6 |
| 7 load("test/mjsunit/wasm/wasm-constants.js"); |
| 8 load("test/mjsunit/wasm/wasm-module-builder.js"); |
| 9 |
| 10 (function testCallImport() { |
| 11 var builder = new WasmModuleBuilder(); |
| 12 |
| 13 var sig_index = builder.addType(kSig_d_dd); |
| 14 builder.addImport("func", sig_index); |
| 15 builder.addFunction("main", sig_index) |
| 16 .addBody([ |
| 17 kExprGetLocal, 0, // -- |
| 18 kExprGetLocal, 1, // -- |
| 19 kExprCallFunction, 0]) // -- |
| 20 .exportAs("main"); |
| 21 |
| 22 var main = builder.instantiate({func: experimentalDoubleAdder}).exports.main
; |
| 23 assertEquals(3.8, main(1.5, 2.3)); |
| 24 })(); |
OLD | NEW |