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

Side by Side Diff: test/mjsunit/wasm/memory.js

Issue 2638243002: [wasm] WebAssembly.Memory.grow() should handle the no instance case (Closed)
Patch Set: 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 unified diff | Download patch
« test/mjsunit/wasm/js-api.js ('K') | « test/mjsunit/wasm/js-api.js ('k') | no next file » | 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 // Basic tests. 7 // Basic tests.
8 8
9 var outOfUint32RangeValue = 1e12; 9 var outOfUint32RangeValue = 1e12;
10 10
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 assertTrue(hasPropertyWasCalled); 84 assertTrue(hasPropertyWasCalled);
85 })(); 85 })();
86 86
87 (function TestBuffer() { 87 (function TestBuffer() {
88 let memory = new WebAssembly.Memory({initial: 1}); 88 let memory = new WebAssembly.Memory({initial: 1});
89 assertTrue(memory.buffer instanceof Object); 89 assertTrue(memory.buffer instanceof Object);
90 assertTrue(memory.buffer instanceof ArrayBuffer); 90 assertTrue(memory.buffer instanceof ArrayBuffer);
91 assertThrows(() => {'use strict'; memory.buffer = memory.buffer}, TypeError) 91 assertThrows(() => {'use strict'; memory.buffer = memory.buffer}, TypeError)
92 assertThrows(() => ({__proto__: memory}).buffer, TypeError) 92 assertThrows(() => ({__proto__: memory}).buffer, TypeError)
93 })(); 93 })();
94
95 (function TestMemoryGrow() {
96 var kPageSize = 65536;
97 let memory = new WebAssembly.Memory({initial: 1, maximum:30});
98 assertEquals(1, memory.grow(9));
99 assertTrue(memory.buffer instanceof ArrayBuffer);
100 assertTrue(10*kPageSize == memory.buffer.byteLength);
101 assertMemoryIsValid(memory);
102 assertThrows(() => memory.grow(21));
103 })();
OLDNEW
« test/mjsunit/wasm/js-api.js ('K') | « test/mjsunit/wasm/js-api.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698