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