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 | 5 // Flags: --expose-wasm |
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 let kReturnValue = 117; | 10 let kReturnValue = 117; |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 | 208 |
209 var module = new WebAssembly.Module(builder.toBuffer()); | 209 var module = new WebAssembly.Module(builder.toBuffer()); |
210 var i1 = new WebAssembly.Instance(module, null, mem_1); | 210 var i1 = new WebAssembly.Instance(module, null, mem_1); |
211 var i2 = new WebAssembly.Instance(module, null, mem_2); | 211 var i2 = new WebAssembly.Instance(module, null, mem_2); |
212 | 212 |
213 assertEquals(1, i1.exports.f()); | 213 assertEquals(1, i1.exports.f()); |
214 assertEquals(1000, i2.exports.f()); | 214 assertEquals(1000, i2.exports.f()); |
215 })(); | 215 })(); |
216 | 216 |
217 (function MustBeMemory() { | 217 (function MustBeMemory() { |
218 print("MustBeMemory..."); | |
219 var memory = new ArrayBuffer(65536); | 218 var memory = new ArrayBuffer(65536); |
220 var module = new WebAssembly.Module(buffer); | 219 var module = new WebAssembly.Module(buffer); |
221 assertThrows(() => new WebAssembly.Instance(module, null, memory), TypeError); | 220 assertThrows(() => new WebAssembly.Instance(module, null, memory), TypeError); |
222 })(); | 221 })(); |
OLD | NEW |