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

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

Issue 2288773002: [wasm] Check the input of grow-memory before calling the runtime. (Closed)
Patch Set: Created 4 years, 3 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
« src/compiler/wasm-compiler.cc ('K') | « src/compiler/wasm-compiler.cc ('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 --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 kPageSize = 0x10000; 10 var kPageSize = 0x10000;
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 function testGrowMemoryTrapMaxPages() { 110 function testGrowMemoryTrapMaxPages() {
111 var builder = genGrowMemoryBuilder(); 111 var builder = genGrowMemoryBuilder();
112 builder.addMemory(1, 1, false); 112 builder.addMemory(1, 1, false);
113 var module = builder.instantiate(); 113 var module = builder.instantiate();
114 var maxPages = 16384; 114 var maxPages = 16384;
115 function growMem(pages) { return module.exports.grow_memory(pages); } 115 function growMem(pages) { return module.exports.grow_memory(pages); }
116 assertEquals(-1, growMem(maxPages)); 116 assertEquals(-1, growMem(maxPages));
117 } 117 }
118 118
119 testGrowMemoryTrapMaxPages(); 119 testGrowMemoryTrapMaxPages();
120
121 (function testGrowMemoryTrapsWithNonSmiInput() {
122 var builder = genGrowMemoryBuilder();
123 var module = builder.instantiate();
124 function growMem(pages) { return module.exports.grow_memory(pages); }
125 // The parameter of grow_memory is unsigned. Therefore -1 stands for
126 // UINT32_MIN, which cannot be represented as SMI.
127 assertEquals(-1, growMem(-1));
128 })();
gdeepti 2016/08/30 02:19:56 Nit: Test not consistent with the format of other
ahaas 2016/08/30 06:49:53 You are right, it should be consistent. Done.
OLDNEW
« src/compiler/wasm-compiler.cc ('K') | « src/compiler/wasm-compiler.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698