OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 // Flags: --expose-wasm |
| 6 |
| 7 load("test/mjsunit/wasm/wasm-constants.js"); |
| 8 load("test/mjsunit/wasm/wasm-module-builder.js"); |
| 9 |
| 10 (function testMemorySizeZero() { |
| 11 print("testMemorySizeZero()"); |
| 12 var builder = new WasmModuleBuilder(); |
| 13 builder.addFunction("memory_size", kSig_i_v) |
| 14 .addBody([kExprMemorySize]) |
| 15 .exportFunc(); |
| 16 var module = builder.instantiate(); |
| 17 assertEquals(0, module.exports.memory_size()); |
| 18 })(); |
| 19 |
| 20 (function testMemorySizeNonZero() { |
| 21 print("testMemorySizeNonZero()"); |
| 22 var builder = new WasmModuleBuilder(); |
| 23 var size = 11; |
| 24 builder.addMemory(size, size, false); |
| 25 builder.addFunction("memory_size", kSig_i_v) |
| 26 .addBody([kExprMemorySize]) |
| 27 .exportFunc(); |
| 28 var module = builder.instantiate(); |
| 29 assertEquals(size, module.exports.memory_size()); |
| 30 })(); |
OLD | NEW |