tor-browser

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

bug1467415.js (931B)


      1 // This exposed an alias analysis bug in the Wasm Ion machinery.  It should
      2 // compute 125 (88 + 37) but with the bug would compute 176 (88 + 88) instead.
      3 // See bug 1467415.
      4 
      5 let mt = `
      6 (module
      7  (import "m" "g" (global (mut i32)))
      8  (import "m" "h" (global (mut i32)))
      9  (memory 1 1)
     10  (data (i32.const 0) "\\01\\00\\00\\00\\01\\00\\00\\00\\01\\00\\00\\00")
     11  (func (export "f") (result i32)
     12    (local i32)
     13    (local i32)
     14    (block (result i32)
     15      (local.set 0 (global.get 0))
     16      (block (result i32)
     17        (global.set 1 (i32.const 37))
     18        (block (result i32)
     19          (local.set 1 (global.get 0))
     20          (i32.add (local.get 0) (local.get 1)))))))
     21 `;
     22 
     23 let glob = new WebAssembly.Global({value:'i32', mutable:true}, 88);
     24 let module = new WebAssembly.Module(wasmTextToBinary(mt));
     25 let ins = new WebAssembly.Instance(module, {m:{g:glob, h:glob}});
     26 
     27 let shouldBe125 = ins.exports.f();
     28 assertEq(shouldBe125, 125);