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

Side by Side 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, 10 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 the V8 project authors. All rights reserved. 1 // Copyright 2016 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Flags: --expose-wasm 5 // Flags: --expose-wasm
6 6
7 load("test/mjsunit/wasm/wasm-constants.js"); 7 load("test/mjsunit/wasm/wasm-constants.js");
8 load("test/mjsunit/wasm/wasm-module-builder.js"); 8 load("test/mjsunit/wasm/wasm-module-builder.js");
9 9
10 (function TestOne() { 10 (function TestOne() {
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after
390 390
391 // initial size is too large 391 // initial size is too large
392 assertThrows(() => builder.instantiate({m: {m: new WebAssembly.Memory({initial : 3, maximum: 3})}})); 392 assertThrows(() => builder.instantiate({m: {m: new WebAssembly.Memory({initial : 3, maximum: 3})}}));
393 393
394 // maximum size is too large 394 // maximum size is too large
395 assertThrows(() => builder.instantiate({m: {m: new WebAssembly.Memory({initial : 1, maximum: 4})}})); 395 assertThrows(() => builder.instantiate({m: {m: new WebAssembly.Memory({initial : 1, maximum: 4})}}));
396 396
397 // no maximum 397 // no maximum
398 assertThrows(() => builder.instantiate({m: {m: new WebAssembly.Memory({initial : 1})}})); 398 assertThrows(() => builder.instantiate({m: {m: new WebAssembly.Memory({initial : 1})}}));
399 })(); 399 })();
400
401 (function TestMemoryGrowDetachBuffer() {
402 print("TestMemoryGrowDetachBuffer");
403 let memory = new WebAssembly.Memory({initial: 1, maximum: 5});
404 var builder = new WasmModuleBuilder();
405 builder.addImportedMemory("m", "imported_mem");
406 let instance = builder.instantiate({m: {imported_mem: memory}});
407 let buffer = memory.buffer;
408 assertEquals(kPageSize, buffer.byteLength);
409 assertEquals(1, memory.grow(2));
410 assertTrue(buffer !== memory.buffer);
411 assertEquals(0, buffer.byteLength);
412 assertEquals(3*kPageSize, memory.buffer.byteLength);
413 })();
OLDNEW
« 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