tor-browser

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

getter-setter-ic.js (682B)


      1 // Ensure readGeckoProfilingStack() doesn't crash with Ion
      2 // getter/setter ICs on the stack.
      3 function getObjects() {
      4    var objs = [];
      5    objs.push({x: 0, get prop() {
      6 readGeckoProfilingStack();
      7 return ++this.x;
      8    }, set prop(v) {
      9 readGeckoProfilingStack();
     10 this.x = v + 2;
     11    }});
     12    objs.push({x: 0, y: 0, get prop() {
     13 readGeckoProfilingStack();
     14 return this.y;
     15    }, set prop(v) {
     16 readGeckoProfilingStack();
     17 this.y = v;
     18    }});
     19    return objs;
     20 }
     21 function f() {
     22    var objs = getObjects();
     23    var res = 0;
     24    for (var i=0; i<100; i++) {
     25 var o = objs[i % objs.length];
     26 res += o.prop;
     27 o.prop = i;
     28    }
     29    assertEq(res, 4901);
     30 }
     31 enableGeckoProfiling();
     32 f();