tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

bug1857829.js (696B)


      1 // Tests if i31ref global value is normalized.
      2 var ins = wasmEvalText(`(module
      3    (global $i (ref i31) (ref.i31 (i32.const -1)))
      4    (func (export "f") (result i32)
      5       (ref.eq (ref.i31 (i32.const -1)) (global.get $i))
      6    )
      7 )`);
      8 assertEq(ins.exports.f(), 1);
      9 
     10 // OP test
     11 var ins = wasmEvalText(`(module
     12    (import "env" "v" (func $g (result (ref eq))))
     13    (func (export "f")
     14       (local $v (ref eq))
     15       (local.set $v (call $g))
     16       (if (i32.eq (i31.get_s (ref.cast (ref i31) (local.get $v))) (i32.const -1))
     17          (then
     18            (if (i32.eqz (ref.eq (local.get $v) (ref.i31 (i32.const -1))))
     19               (then (unreachable))))))
     20 )`, {env:{v:()=>-1}});
     21 ins.exports.f();