Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(667)

Unified Diff: test/mjsunit/wasm/import-table.js

Issue 2591753002: [wasm] Implement correct 2-level namespace for imports. (Closed)
Patch Set: Fix debug tests Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test/mjsunit/wasm/import-memory.js ('k') | test/mjsunit/wasm/indirect-calls.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/wasm/import-table.js
diff --git a/test/mjsunit/wasm/import-table.js b/test/mjsunit/wasm/import-table.js
index ffb702c7817bc4bf6effe2a9c50f98e332b61073..ac27e519214726636dc1d30ce76cabdb2a5eef23 100644
--- a/test/mjsunit/wasm/import-table.js
+++ b/test/mjsunit/wasm/import-table.js
@@ -11,7 +11,7 @@ function testCallImport(func, check) {
var builder = new WasmModuleBuilder();
var sig_index = builder.addType(kSig_i_dd);
- builder.addImport("func", sig_index);
+ builder.addImport("q", "func", sig_index);
builder.addFunction("main", sig_index)
.addBody([
kExprGetLocal, 0, // --
@@ -19,7 +19,7 @@ function testCallImport(func, check) {
kExprCallFunction, 0]) // --
.exportAs("main");
- var main = builder.instantiate({func: func}).exports.main;
+ var main = builder.instantiate({q: {func: func}}).exports.main;
for (var i = 0; i < 100000; i += 10003) {
var a = 22.5 + i, b = 10.5 + i;
@@ -168,25 +168,23 @@ testCallImport(returnValue(objWithValueOf), checkReturn(198));
function testCallBinopVoid(type, func, check) {
- var ffi = new Object();
-
var passed_length = -1;
var passed_a = -1;
var passed_b = -1;
var args_a = -1;
var args_b = -1;
- ffi.func = function(a, b) {
+ var ffi = {q: {func: function(a, b) {
passed_length = arguments.length;
passed_a = a;
passed_b = b;
args_a = arguments[0];
args_b = arguments[1];
- }
+ }}};
var builder = new WasmModuleBuilder();
- builder.addImport("func", makeSig_v_xx(type));
+ builder.addImport("q", "func", makeSig_v_xx(type));
builder.addFunction("main", makeSig_r_xx(kAstI32, type))
.addBody([
kExprGetLocal, 0, // --
@@ -241,8 +239,8 @@ testCallBinopVoid(kAstF64);
function testCallPrint() {
var builder = new WasmModuleBuilder();
- builder.addImport("print", makeSig_v_x(kAstI32));
- builder.addImport("print", makeSig_r_x(kAstF64, kAstF64));
+ builder.addImport("q", "print", makeSig_v_x(kAstI32));
+ builder.addImport("q", "print", makeSig_r_x(kAstF64, kAstF64));
builder.addFunction("main", makeSig_r_x(kAstF64, kAstF64))
.addBody([
kExprI8Const, 97, // --
@@ -252,7 +250,7 @@ function testCallPrint() {
])
.exportFunc();
- var main = builder.instantiate({print: print}).exports.main;
+ var main = builder.instantiate({q: {print: print}}).exports.main;
for (var i = -9; i < 900; i += 16.125) {
main(i);
@@ -266,8 +264,8 @@ testCallPrint();
function testCallImport2(foo, bar, expected) {
var builder = new WasmModuleBuilder();
- builder.addImport("foo", kSig_i_v);
- builder.addImport("bar", kSig_i_v);
+ builder.addImport("q", "foo", kSig_i_v);
+ builder.addImport("t", "bar", kSig_i_v);
builder.addFunction("main", kSig_i_v)
.addBody([
kExprCallFunction, 0, // --
@@ -276,7 +274,7 @@ function testCallImport2(foo, bar, expected) {
]) // --
.exportFunc();
- var main = builder.instantiate({foo: foo, bar: bar}).exports.main;
+ var main = builder.instantiate({q: {foo: foo}, t: {bar: bar}}).exports.main;
assertEquals(expected, main());
}
@@ -285,7 +283,7 @@ testCallImport2(function() { return 33; }, function () { return 44; }, 77);
function testImportName(name) {
var builder = new WasmModuleBuilder();
- builder.addImportWithModule("M", name, kSig_i_v);
+ builder.addImport("M", name, kSig_i_v);
builder.addFunction("main", kSig_i_v)
.addBody([
kExprCallFunction, 0
« no previous file with comments | « test/mjsunit/wasm/import-memory.js ('k') | test/mjsunit/wasm/indirect-calls.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698