Index: test/mjsunit/wasm/direct-import-call.js |
diff --git a/test/mjsunit/wasm/direct-import-call.js b/test/mjsunit/wasm/direct-import-call.js |
new file mode 100644 |
index 0000000000000000000000000000000000000000..9026009a2025dd9918212c9a9d6c6c91ec42152a |
--- /dev/null |
+++ b/test/mjsunit/wasm/direct-import-call.js |
@@ -0,0 +1,24 @@ |
+// Copyright 2015 the V8 project authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+// Flags: --expose-wasm |
+ |
+load("test/mjsunit/wasm/wasm-constants.js"); |
+load("test/mjsunit/wasm/wasm-module-builder.js"); |
+ |
+(function testCallImport() { |
+ var builder = new WasmModuleBuilder(); |
+ |
+ var sig_index = builder.addType(kSig_d_dd); |
+ builder.addImport("func", sig_index); |
+ builder.addFunction("main", sig_index) |
+ .addBody([ |
+ kExprGetLocal, 0, // -- |
+ kExprGetLocal, 1, // -- |
+ kExprCallFunction, 0]) // -- |
+ .exportAs("main"); |
+ |
+ var main = builder.instantiate({func: experimentalDoubleAdder}).exports.main; |
+ assertEquals(3.8, main(1.5, 2.3)); |
+})(); |