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

Unified Diff: test/mjsunit/wasm/test-wasm-module-builder.js

Issue 1763433002: [wasm] Rework encoding of local declarations. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 9 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/cctest/wasm/wasm-run-utils.h ('k') | test/mjsunit/wasm/verify-function-simple.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/wasm/test-wasm-module-builder.js
diff --git a/test/mjsunit/wasm/test-wasm-module-builder.js b/test/mjsunit/wasm/test-wasm-module-builder.js
index 7c287efa4f1138e1c13fa29e549453407ee0709d..3063553303b443180a9fc60755b1719227c0f220 100644
--- a/test/mjsunit/wasm/test-wasm-module-builder.js
+++ b/test/mjsunit/wasm/test-wasm-module-builder.js
@@ -47,6 +47,29 @@ var debug = false;
assertEquals(27777, instance.exports.main(27777));
})();
+(function LocalsTest2() {
+ // TODO(titzer): i64 only works on 64-bit platforms.
+ var types = [
+ {locals: {i32_count: 1}, type: kAstI32},
+// {locals: {i64_count: 1}, type: kAstI64},
+ {locals: {f32_count: 1}, type: kAstF32},
+ {locals: {f64_count: 1}, type: kAstF64},
+ ];
+
+ for (p of types) {
+ var module = new WasmModuleBuilder();
+ module.addFunction(undefined, [p.type, p.type])
+ .addLocals(p.locals)
+ .addBody([kExprSetLocal, 1, kExprGetLocal, 0])
+ .exportAs("main");
+
+ var buffer = module.toBuffer(debug);
+ var instance = _WASMEXP_.instantiateModule(buffer);
+ assertEquals(19, instance.exports.main(19));
+ assertEquals(27777, instance.exports.main(27777));
+ }
+})();
+
(function CallTest() {
var module = new WasmModuleBuilder();
module.addFunction("add", [kAstI32, kAstI32, kAstI32])
« no previous file with comments | « test/cctest/wasm/wasm-run-utils.h ('k') | test/mjsunit/wasm/verify-function-simple.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698