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 21 matching lines...) Expand all Loading... |
32 let exportingModuleBinary = (() => { | 32 let exportingModuleBinary = (() => { |
33 var builder = new WasmModuleBuilder(); | 33 var builder = new WasmModuleBuilder(); |
34 builder.addFunction("f", kSig_i_v) | 34 builder.addFunction("f", kSig_i_v) |
35 .addBody([kExprI32Const, 42]) | 35 .addBody([kExprI32Const, 42]) |
36 .exportAs("f"); | 36 .exportAs("f"); |
37 return new Int8Array(builder.toBuffer()); | 37 return new Int8Array(builder.toBuffer()); |
38 })(); | 38 })(); |
39 | 39 |
40 let importingModuleBinary = (() => { | 40 let importingModuleBinary = (() => { |
41 var builder = new WasmModuleBuilder(); | 41 var builder = new WasmModuleBuilder(); |
42 builder.addImport("f", kSig_i_v); | 42 builder.addImport("", "f", kSig_i_v); |
43 return new Int8Array(builder.toBuffer()); | 43 return new Int8Array(builder.toBuffer()); |
44 })(); | 44 })(); |
45 | 45 |
46 // 'WebAssembly' data property on global object | 46 // 'WebAssembly' data property on global object |
47 let wasmDesc = Object.getOwnPropertyDescriptor(this, 'WebAssembly'); | 47 let wasmDesc = Object.getOwnPropertyDescriptor(this, 'WebAssembly'); |
48 assertEq(typeof wasmDesc.value, "object"); | 48 assertEq(typeof wasmDesc.value, "object"); |
49 assertEq(wasmDesc.writable, true); | 49 assertEq(wasmDesc.writable, true); |
50 assertEq(wasmDesc.enumerable, false); | 50 assertEq(wasmDesc.enumerable, false); |
51 assertEq(wasmDesc.configurable, true); | 51 assertEq(wasmDesc.configurable, true); |
52 | 52 |
(...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
550 assertEq(result.instance instanceof Instance, true); | 550 assertEq(result.instance instanceof Instance, true); |
551 } | 551 } |
552 } | 552 } |
553 assertInstantiateSuccess(emptyModule); | 553 assertInstantiateSuccess(emptyModule); |
554 assertInstantiateSuccess(emptyModuleBinary); | 554 assertInstantiateSuccess(emptyModuleBinary); |
555 assertInstantiateSuccess(emptyModuleBinary.buffer); | 555 assertInstantiateSuccess(emptyModuleBinary.buffer); |
556 assertInstantiateSuccess(importingModule, {"":{f:()=>{}}}); | 556 assertInstantiateSuccess(importingModule, {"":{f:()=>{}}}); |
557 assertInstantiateSuccess(importingModuleBinary, {"":{f:()=>{}}}); | 557 assertInstantiateSuccess(importingModuleBinary, {"":{f:()=>{}}}); |
558 assertInstantiateSuccess(importingModuleBinary.buffer, {"":{f:()=>{}}}); | 558 assertInstantiateSuccess(importingModuleBinary.buffer, {"":{f:()=>{}}}); |
559 } | 559 } |
OLD | NEW |