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

Unified Diff: test/mjsunit/wasm/indirect-calls.js

Issue 2345593003: [wasm] Master CL for Binary 0xC changes. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix test failures and TSAN races. Created 4 years, 3 months 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/incrementer.wasm ('k') | test/mjsunit/wasm/instance-gc.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/wasm/indirect-calls.js
diff --git a/test/mjsunit/wasm/indirect-calls.js b/test/mjsunit/wasm/indirect-calls.js
index 1e87c6f8230fd862b49acfeddbe0bcfe491285d0..26021bb74d69a7d4a5ad12feac7ef5dc3d1c8eea 100644
--- a/test/mjsunit/wasm/indirect-calls.js
+++ b/test/mjsunit/wasm/indirect-calls.js
@@ -14,7 +14,7 @@ var module = (function () {
builder.addImport("add", sig_index);
builder.addFunction("add", sig_index)
.addBody([
- kExprGetLocal, 0, kExprGetLocal, 1, kExprCallImport, kArity2, 0
+ kExprGetLocal, 0, kExprGetLocal, 1, kExprCallFunction, 0
]);
builder.addFunction("sub", sig_index)
.addBody([
@@ -24,13 +24,13 @@ var module = (function () {
]);
builder.addFunction("main", kSig_i_iii)
.addBody([
- kExprGetLocal, 0,
kExprGetLocal, 1,
kExprGetLocal, 2,
- kExprCallIndirect, kArity2, sig_index
+ kExprGetLocal, 0,
+ kExprCallIndirect, sig_index
])
.exportFunc()
- builder.appendToTable([0, 1, 2]);
+ builder.appendToTable([1, 2, 3]);
return builder.instantiate({add: function(a, b) { return a + b | 0; }});
})();
@@ -47,3 +47,40 @@ assertEquals(19, module.exports.main(0, 12, 7));
assertTraps(kTrapFuncSigMismatch, "module.exports.main(2, 12, 33)");
assertTraps(kTrapFuncInvalid, "module.exports.main(3, 12, 33)");
+
+
+module = (function () {
+ var builder = new WasmModuleBuilder();
+
+ var sig_i_ii = builder.addType(kSig_i_ii);
+ var sig_i_i = builder.addType(kSig_i_i);
+ builder.addImport("mul", sig_i_ii);
+ builder.addFunction("add", sig_i_ii)
+ .addBody([
+ kExprGetLocal, 0, // --
+ kExprGetLocal, 1, // --
+ kExprI32Add // --
+ ]);
+ builder.addFunction("popcnt", sig_i_i)
+ .addBody([
+ kExprGetLocal, 0, // --
+ kExprI32Popcnt // --
+ ]);
+ builder.addFunction("main", kSig_i_iii)
+ .addBody([
+ kExprGetLocal, 1,
+ kExprGetLocal, 2,
+ kExprGetLocal, 0,
+ kExprCallIndirect, sig_i_ii
+ ])
+ .exportFunc()
+ builder.appendToTable([0, 1, 2, 3]);
+
+ return builder.instantiate({mul: function(a, b) { return a * b | 0; }});
+})();
+
+assertEquals(-6, module.exports.main(0, -2, 3));
+assertEquals(99, module.exports.main(1, 22, 77));
+assertTraps(kTrapFuncSigMismatch, "module.exports.main(2, 12, 33)");
+assertTraps(kTrapFuncSigMismatch, "module.exports.main(3, 12, 33)");
+assertTraps(kTrapFuncInvalid, "module.exports.main(4, 12, 33)");
« no previous file with comments | « test/mjsunit/wasm/incrementer.wasm ('k') | test/mjsunit/wasm/instance-gc.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698