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 | 5 // Flags: --expose-wasm |
6 | 6 |
7 // Basic tests. | 7 // Basic tests. |
8 | 8 |
9 var outOfUint32RangeValue = 1e12; | 9 var outOfUint32RangeValue = 1e12; |
10 | 10 |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 assertTrue(hasPropertyWasCalled); | 84 assertTrue(hasPropertyWasCalled); |
85 })(); | 85 })(); |
86 | 86 |
87 (function TestBuffer() { | 87 (function TestBuffer() { |
88 let memory = new WebAssembly.Memory({initial: 1}); | 88 let memory = new WebAssembly.Memory({initial: 1}); |
89 assertTrue(memory.buffer instanceof Object); | 89 assertTrue(memory.buffer instanceof Object); |
90 assertTrue(memory.buffer instanceof ArrayBuffer); | 90 assertTrue(memory.buffer instanceof ArrayBuffer); |
91 assertThrows(() => {'use strict'; memory.buffer = memory.buffer}, TypeError) | 91 assertThrows(() => {'use strict'; memory.buffer = memory.buffer}, TypeError) |
92 assertThrows(() => ({__proto__: memory}).buffer, TypeError) | 92 assertThrows(() => ({__proto__: memory}).buffer, TypeError) |
93 })(); | 93 })(); |
| 94 |
| 95 (function TestMemoryGrow() { |
| 96 var kPageSize = 65536; |
| 97 let memory = new WebAssembly.Memory({initial: 1, maximum:30}); |
| 98 assertEquals(1, memory.grow(9)); |
| 99 assertTrue(memory.buffer instanceof ArrayBuffer); |
| 100 assertTrue(10*kPageSize == memory.buffer.byteLength); |
| 101 assertMemoryIsValid(memory); |
| 102 assertThrows(() => memory.grow(21)); |
| 103 })(); |
OLD | NEW |