tor-browser

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

unroll5.js (1257B)


      1 // |jit-test| test-also=--setpref=wasm_unroll_loops=true
      2 
      3 // Loop unrolling test.  Seen to be causing assertion failures to do with
      4 // incorrect header phi arg remapping -- the loop header contains a phi,
      5 // neither arg of which is from inside the loop.
      6 
      7 let t = `
      8 (module
      9  (memory 0)
     10  (func (export "f1")
     11        (param $local0 i32) (param $local1 i32) (param $local2 i32)
     12        (result i32)
     13    (local $local3 i32) (local $local4 i32)
     14    (local $local5 i32) (local $local6 i32)
     15    (local $local7 i32) (local $local8 i32)
     16    (i32.load (local.get $local0))
     17    if
     18      (local.set $local8 (i32.shl (local.get $local2) (i32.const 2)))
     19      loop $again
     20        local.get $local8
     21        i32.load
     22        local.set $local4
     23        local.get $local5
     24        local.get $local2
     25        i32.const 4
     26        i32.add
     27        local.tee $local3
     28        i32.store
     29        local.get $local6
     30        local.set $local4
     31        i32.const 2
     32        local.set $local6
     33        local.get $local4
     34        br_if $again
     35      end
     36    end
     37    i32.const 0
     38  )
     39 )`;
     40 
     41 let i = new WebAssembly.Instance(new WebAssembly.Module(wasmTextToBinary(t)));
     42 
     43 // We only care that we can compile this without asserting (in the unroller).
     44 assertEq(i + "", "[object WebAssembly.Instance]");