OLD | NEW |
---|---|
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 Loading... | |
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.
| |
OLD | NEW |