| 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 testCallImport(func, check) { | 10 function testCallImport(func, check) { |
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 259 } | 259 } |
| 260 } | 260 } |
| 261 | 261 |
| 262 testCallPrint(); | 262 testCallPrint(); |
| 263 testCallPrint(); | 263 testCallPrint(); |
| 264 | 264 |
| 265 | 265 |
| 266 function testCallImport2(foo, bar, expected) { | 266 function testCallImport2(foo, bar, expected) { |
| 267 var builder = new WasmModuleBuilder(); | 267 var builder = new WasmModuleBuilder(); |
| 268 | 268 |
| 269 builder.addImport("foo", kSig_i_v); | 269 builder.addImport("foo", kSig_i); |
| 270 builder.addImport("bar", kSig_i_v); | 270 builder.addImport("bar", kSig_i); |
| 271 builder.addFunction("main", kSig_i_v) | 271 builder.addFunction("main", kSig_i) |
| 272 .addBody([ | 272 .addBody([ |
| 273 kExprCallFunction, 0, // -- | 273 kExprCallFunction, 0, // -- |
| 274 kExprCallFunction, 1, // -- | 274 kExprCallFunction, 1, // -- |
| 275 kExprI32Add, // -- | 275 kExprI32Add, // -- |
| 276 ]) // -- | 276 ]) // -- |
| 277 .exportFunc(); | 277 .exportFunc(); |
| 278 | 278 |
| 279 var main = builder.instantiate({foo: foo, bar: bar}).exports.main; | 279 var main = builder.instantiate({foo: foo, bar: bar}).exports.main; |
| 280 assertEquals(expected, main()); | 280 assertEquals(expected, main()); |
| 281 } | 281 } |
| 282 | 282 |
| 283 testCallImport2(function() { return 33; }, function () { return 44; }, 77); | 283 testCallImport2(function() { return 33; }, function () { return 44; }, 77); |
| OLD | NEW |