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

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

Issue 2653183003: [wasm] Memory buffer should be detached after Memory.Grow (Closed)
Patch Set: Ben's review Created 3 years, 11 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') | test/mjsunit/wasm/js-api.js » ('j') | 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 96317b7f640c7ae6d34ef82cc16169465fcb745a..178febdff471472d6bace5c9c935efdcd0416f33 100644
--- a/test/mjsunit/wasm/import-memory.js
+++ b/test/mjsunit/wasm/import-memory.js
@@ -397,3 +397,17 @@ load("test/mjsunit/wasm/wasm-module-builder.js");
// no maximum
assertThrows(() => builder.instantiate({m: {m: new WebAssembly.Memory({initial: 1})}}));
})();
+
+(function TestMemoryGrowDetachBuffer() {
+ print("TestMemoryGrowDetachBuffer");
+ let memory = new WebAssembly.Memory({initial: 1, maximum: 5});
+ var builder = new WasmModuleBuilder();
+ builder.addImportedMemory("m", "imported_mem");
+ let instance = builder.instantiate({m: {imported_mem: memory}});
+ let buffer = memory.buffer;
+ assertEquals(kPageSize, buffer.byteLength);
+ assertEquals(1, memory.grow(2));
+ assertTrue(buffer !== memory.buffer);
+ assertEquals(0, buffer.byteLength);
+ assertEquals(3*kPageSize, memory.buffer.byteLength);
+})();
« no previous file with comments | « src/wasm/wasm-module.cc ('k') | test/mjsunit/wasm/js-api.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698