| 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 --allow-natives-syntax | 5 // Flags: --expose-wasm --allow-natives-syntax |
| 6 | 6 |
| 7 if ((typeof drainJobQueue) != "function") { | 7 if ((typeof drainJobQueue) != "function") { |
| 8 drainJobQueue = () => { %RunMicrotasks() }; | 8 drainJobQueue = () => { %RunMicrotasks() }; |
| 9 } | 9 } |
| 10 | 10 |
| (...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 462 var mem = new Memory({initial:1, maximum:2}); | 462 var mem = new Memory({initial:1, maximum:2}); |
| 463 var buf = mem.buffer; | 463 var buf = mem.buffer; |
| 464 assertEq(buf.byteLength, kPageSize); | 464 assertEq(buf.byteLength, kPageSize); |
| 465 assertEq(mem.grow(0), 1); | 465 assertEq(mem.grow(0), 1); |
| 466 // TODO(gdeepti): Pending spec clarification | 466 // TODO(gdeepti): Pending spec clarification |
| 467 // assertTrue(buf !== mem.buffer); | 467 // assertTrue(buf !== mem.buffer); |
| 468 // assertEq(buf.byteLength, 0); | 468 // assertEq(buf.byteLength, 0); |
| 469 buf = mem.buffer; | 469 buf = mem.buffer; |
| 470 assertEq(buf.byteLength, kPageSize); | 470 assertEq(buf.byteLength, kPageSize); |
| 471 assertEq(mem.grow(1), 1); | 471 assertEq(mem.grow(1), 1); |
| 472 // TODO(gdeepti): assertTrue(buf !== mem.buffer); | 472 assertTrue(buf !== mem.buffer); |
| 473 // TODO(gdeepti): assertEq(buf.byteLength, 0); | 473 assertEq(buf.byteLength, 0); |
| 474 buf = mem.buffer; | 474 buf = mem.buffer; |
| 475 assertEq(buf.byteLength, 2 * kPageSize); | 475 assertEq(buf.byteLength, 2 * kPageSize); |
| 476 assertErrorMessage(() => mem.grow(1), Error, /failed to grow memory/); | 476 assertErrorMessage(() => mem.grow(1), Error, /failed to grow memory/); |
| 477 assertEq(buf, mem.buffer); | 477 assertEq(buf, mem.buffer); |
| 478 | 478 |
| 479 // 'WebAssembly.Table' data property | 479 // 'WebAssembly.Table' data property |
| 480 let tableDesc = Object.getOwnPropertyDescriptor(WebAssembly, 'Table'); | 480 let tableDesc = Object.getOwnPropertyDescriptor(WebAssembly, 'Table'); |
| 481 assertEq(typeof tableDesc.value, "function"); | 481 assertEq(typeof tableDesc.value, "function"); |
| 482 assertTrue(tableDesc.writable); | 482 assertTrue(tableDesc.writable); |
| 483 assertFalse(tableDesc.enumerable); | 483 assertFalse(tableDesc.enumerable); |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 706 assertTrue(result.instance instanceof Instance); | 706 assertTrue(result.instance instanceof Instance); |
| 707 } | 707 } |
| 708 } | 708 } |
| 709 assertInstantiateSuccess(emptyModule); | 709 assertInstantiateSuccess(emptyModule); |
| 710 assertInstantiateSuccess(emptyModuleBinary); | 710 assertInstantiateSuccess(emptyModuleBinary); |
| 711 assertInstantiateSuccess(emptyModuleBinary.buffer); | 711 assertInstantiateSuccess(emptyModuleBinary.buffer); |
| 712 assertInstantiateSuccess(importingModule, {'': {f: () => {}}}); | 712 assertInstantiateSuccess(importingModule, {'': {f: () => {}}}); |
| 713 assertInstantiateSuccess(importingModuleBinary, {"":{f:()=>{}}}); | 713 assertInstantiateSuccess(importingModuleBinary, {"":{f:()=>{}}}); |
| 714 assertInstantiateSuccess(importingModuleBinary.buffer, {"":{f:()=>{}}}); | 714 assertInstantiateSuccess(importingModuleBinary.buffer, {"":{f:()=>{}}}); |
| 715 assertInstantiateSuccess(memoryImportingModuleBinary, {"": {"my_memory": scratch
_memory}}); | 715 assertInstantiateSuccess(memoryImportingModuleBinary, {"": {"my_memory": scratch
_memory}}); |
| OLD | NEW |