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

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

Issue 2548223002: [wasm] Update WasmMemoryObject correctly when module memory is exported. (Closed)
Patch Set: Rebase 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/regress/wasm/regression-670683.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/wasm/import-memory.js
diff --git a/test/mjsunit/wasm/import-memory.js b/test/mjsunit/wasm/import-memory.js
index 3b70332f97bc5eb95d2dbd81135df3a89204d0c2..3f2cf1155a84991253eb957e7bc1c45fe3bd1ee8 100644
--- a/test/mjsunit/wasm/import-memory.js
+++ b/test/mjsunit/wasm/import-memory.js
@@ -366,3 +366,21 @@ load("test/mjsunit/wasm/wasm-module-builder.js");
verify_mem_size(++current_mem_size);
}
})();
+
+(function TestExportGrow() {
+ print("TestExportGrow");
+ let builder = new WasmModuleBuilder();
+ builder.addMemory(1, 5, true);
+ builder.exportMemoryAs("exported_mem");
+ builder.addFunction("mem_size", kSig_i_v)
+ .addBody([kExprMemorySize, kMemoryZero])
+ .exportFunc();
+ builder.addFunction("grow", kSig_i_i)
+ .addBody([kExprGetLocal, 0, kExprGrowMemory, kMemoryZero])
+ .exportFunc();
+ instance = builder.instantiate();
+ assertEquals(kPageSize, instance.exports.exported_mem.buffer.byteLength);
+ assertEquals(1, instance.exports.grow(2));
+ assertEquals(3, instance.exports.mem_size());
+ assertEquals(3*kPageSize, instance.exports.exported_mem.buffer.byteLength);
+})();
« no previous file with comments | « test/mjsunit/regress/wasm/regression-670683.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698