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

Unified Diff: test/mjsunit/wasm/instantiate-module-basic.js

Issue 2296993002: [wasm] mjsunit support for I32 globals and test (Closed)
Patch Set: formatting Created 4 years, 4 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 | « no previous file | test/mjsunit/wasm/wasm-module-builder.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/wasm/instantiate-module-basic.js
diff --git a/test/mjsunit/wasm/instantiate-module-basic.js b/test/mjsunit/wasm/instantiate-module-basic.js
index 92cdc14ff915391eeb2dd2dcd78c1708729d2b9e..0328bad31b76abd2787fec520b14ca6c9b1329c4 100644
--- a/test/mjsunit/wasm/instantiate-module-basic.js
+++ b/test/mjsunit/wasm/instantiate-module-basic.js
@@ -153,3 +153,26 @@ promise.then(module => CheckInstance(new WebAssembly.Instance(module)));
assertEquals(42, outval_1);
assertEquals(1000, outval_2);
})();
+
+(function GlobalsArePrivateToTheInstance() {
+ var builder = new WasmModuleBuilder();
+ builder.addGlobal(kAstI32);
+ builder.addFunction("read", kSig_i_v)
+ .addBody([
+ kExprGetGlobal, 0])
+ .exportFunc();
+
+ builder.addFunction("write", kSig_v_i)
+ .addBody([
+ kExprGetLocal, 0,
+ kExprSetGlobal, 0])
+ .exportFunc();
+
+ var module = new WebAssembly.Module(builder.toBuffer());
+ var i1 = new WebAssembly.Instance(module);
+ var i2 = new WebAssembly.Instance(module);
+ i1.exports.write(1);
+ i2.exports.write(2);
+ assertEquals(1, i1.exports.read());
+ assertEquals(2, i2.exports.read());
+})();
« no previous file with comments | « no previous file | test/mjsunit/wasm/wasm-module-builder.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698