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

Unified Diff: test/mjsunit/wasm/globals.js

Issue 2410953003: [wasm] Fix decoding of shared global index space (Closed)
Patch Set: Increase allocation limit Created 4 years, 2 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 | « src/wasm/wasm-module.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/wasm/globals.js
diff --git a/test/mjsunit/wasm/globals.js b/test/mjsunit/wasm/globals.js
index 4b976dcef2b6fb1a3bea52f6e4648d75684dcd61..ca421477a258f10f340d3414228f1a812123c848 100644
--- a/test/mjsunit/wasm/globals.js
+++ b/test/mjsunit/wasm/globals.js
@@ -64,3 +64,25 @@ function TestImportedExported(type, val, expected) {
TestImportedExported(kAstI32, 415.5, 415);
TestImportedExported(kAstF32, -979.34343, Math.fround(-979.34343));
TestImportedExported(kAstF64, 81347.66666, 81347.66666);
+
+function TestGlobalIndexSpace(type, val) {
+ print("TestGlobalIndexSpace(" + val + ") = " + val);
+ var builder = new WasmModuleBuilder();
+ var im = builder.addImportedGlobal("foo", undefined, type);
+ assertEquals(0, im);
+ var def = builder.addGlobal(type, false);
+ assertEquals(1, def.index);
+ def.init_index = im;
+
+ var sig = makeSig([], [type]);
+ builder.addFunction("main", sig)
+ .addBody([kExprGetGlobal, def.index])
+ .exportAs("main");
+
+ var instance = builder.instantiate({foo: val});
+ assertEquals(val, instance.exports.main());
+}
+
+TestGlobalIndexSpace(kAstI32, 123);
+TestGlobalIndexSpace(kAstF32, 54321.125);
+TestGlobalIndexSpace(kAstF64, 12345.678);
« no previous file with comments | « src/wasm/wasm-module.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698