tor-browser

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

inline-add.js (691B)


      1 // |jit-test| slow;
      2 //
      3 // This is intended to be run manually with IONFLAGS=logs and
      4 // postprocessing by iongraph to verify manually (by inspecting the
      5 // MIR) that:
      6 //
      7 //  - the add operation is inlined as it should be
      8 //  - loads and stores are not moved across the add
      9 //
     10 // Be sure to run with --ion-eager --ion-offthread-compile=off.
     11 
     12 function add(ta) {
     13    var x = ta[0];
     14    Atomics.add(ta, 86, 6);
     15    var y = ta[1];
     16    var z = y + 1;
     17    var w = x + z;
     18    return w;
     19 }
     20 
     21 var sab = new SharedArrayBuffer(4096);
     22 var ia = new Int32Array(sab);
     23 for ( var i=0, limit=ia.length ; i < limit ; i++ )
     24    ia[i] = 37;
     25 var v = 0;
     26 for ( var i=0 ; i < 1000 ; i++ )
     27    v += add(ia);
     28 //print(v);