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

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

Issue 2636173002: [wasm] Enforce memory and table limits during instantiation. (Closed)
Patch Set: [wasm] Enforce memory and table limits during instantiation. 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
« no previous file with comments | « test/mjsunit/wasm/instantiate-module-basic.js ('k') | test/mjsunit/wasm/table.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;
11 11
12 function genModule(memory) { 12 function genModule(memory) {
13 var builder = new WasmModuleBuilder(); 13 var builder = new WasmModuleBuilder();
14 14
15 builder.addImportedMemory("", "memory", 1, 1); 15 builder.addImportedMemory("", "memory", 1);
16 builder.exportMemoryAs("memory"); 16 builder.exportMemoryAs("memory");
17 builder.addFunction("main", kSig_i_i) 17 builder.addFunction("main", kSig_i_i)
18 .addBody([ 18 .addBody([
19 // main body: while(i) { if(mem[i]) return -1; i -= 4; } return 0; 19 // main body: while(i) { if(mem[i]) return -1; i -= 4; } return 0;
20 // TODO(titzer): this manual bytecode has a copy of test-run-wasm.cc 20 // TODO(titzer): this manual bytecode has a copy of test-run-wasm.cc
21 /**/ kExprLoop, kWasmStmt, // -- 21 /**/ kExprLoop, kWasmStmt, // --
22 /* */ kExprGetLocal, 0, // -- 22 /* */ kExprGetLocal, 0, // --
23 /* */ kExprIf, kWasmStmt, // -- 23 /* */ kExprIf, kWasmStmt, // --
24 /* */ kExprGetLocal, 0, // -- 24 /* */ kExprGetLocal, 0, // --
25 /* */ kExprI32LoadMem, 0, 0, // -- 25 /* */ kExprI32LoadMem, 0, 0, // --
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 } 161 }
162 162
163 163
164 for (offset = 65534; offset < 66536; offset++) { 164 for (offset = 65534; offset < 66536; offset++) {
165 assertTraps(kTrapMemOutOfBounds, read); 165 assertTraps(kTrapMemOutOfBounds, read);
166 assertTraps(kTrapMemOutOfBounds, write); 166 assertTraps(kTrapMemOutOfBounds, write);
167 } 167 }
168 } 168 }
169 169
170 testOOBThrows(); 170 testOOBThrows();
OLDNEW
« no previous file with comments | « test/mjsunit/wasm/instantiate-module-basic.js ('k') | test/mjsunit/wasm/table.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698