bug1450800.js (951B)
1 // |jit-test| skip-if: !this.gczeal || !WebAssembly.Global 2 3 gczeal(9, 10); 4 function wasmEvalText(str, imports) { 5 let binary = wasmTextToBinary(str); 6 m = new WebAssembly.Module(binary); 7 return new WebAssembly.Instance(m, imports); 8 } 9 assertEq(wasmEvalText(`(module 10 (global (import "a" "b") i32) 11 (export "g" (global 0)) 12 (func (export "get") (result i32) global.get 0))`, 13 { a: { b: 42 }}).exports.get(), 14 42); 15 for (let v of []) {} 16 function testInitExpr(type, initialValue, nextValue, coercion, assertFunc = assertEq) { 17 var module = wasmEvalText(`(module 18 (import "globals" "a" (global ${type})) 19 (global $glob_imm ${type} (global.get 0)) 20 (export "global_imm" (global $glob_imm)) 21 )`, { 22 globals: { 23 a: coercion(initialValue) 24 } 25 }).exports; 26 } 27 testInitExpr('i32', 13, 37, x => x | 0);