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

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

Issue 1775353003: [wasm] Memory is exported on the module.exports object. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 9 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 | « test/mjsunit/wasm/instantiate-module-basic.js ('k') | test/mjsunit/wasm/start-function.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 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 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 --expose-gc --stress-compaction 5 // Flags: --expose-wasm --expose-gc --stress-compaction
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 var kMemSize = 65536; 10 var kMemSize = 65536;
(...skipping 15 matching lines...) Expand all
26 kExprSetLocal,0, 26 kExprSetLocal,0,
27 kExprI32Sub,kExprGetLocal,0,kExprI8Const,4, 27 kExprI32Sub,kExprGetLocal,0,kExprI8Const,4,
28 kExprI8Const,0]) 28 kExprI8Const,0])
29 .exportFunc(); 29 .exportFunc();
30 30
31 return builder.instantiate(null, memory); 31 return builder.instantiate(null, memory);
32 } 32 }
33 33
34 function testPokeMemory() { 34 function testPokeMemory() {
35 var module = genModule(null); 35 var module = genModule(null);
36 var buffer = module.memory; 36 var buffer = module.exports.memory;
37 var main = module.exports.main; 37 var main = module.exports.main;
38 assertEquals(kMemSize, buffer.byteLength); 38 assertEquals(kMemSize, buffer.byteLength);
39 39
40 var array = new Int8Array(buffer); 40 var array = new Int8Array(buffer);
41 assertEquals(kMemSize, array.length); 41 assertEquals(kMemSize, array.length);
42 42
43 for (var i = 0; i < kMemSize; i++) { 43 for (var i = 0; i < kMemSize; i++) {
44 assertEquals(0, array[i]); 44 assertEquals(0, array[i]);
45 } 45 }
46 46
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 } 139 }
140 140
141 141
142 for (offset = 65534; offset < 66536; offset++) { 142 for (offset = 65534; offset < 66536; offset++) {
143 assertTraps(kTrapMemOutOfBounds, read); 143 assertTraps(kTrapMemOutOfBounds, read);
144 assertTraps(kTrapMemOutOfBounds, write); 144 assertTraps(kTrapMemOutOfBounds, write);
145 } 145 }
146 } 146 }
147 147
148 testOOBThrows(); 148 testOOBThrows();
OLDNEW
« no previous file with comments | « test/mjsunit/wasm/instantiate-module-basic.js ('k') | test/mjsunit/wasm/start-function.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698