tor-browser

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

wasm-11.js (757B)


      1 // |jit-test| test-also=--wasm-compiler=optimizing; skip-if: !wasmDebuggingEnabled()
      2 
      3 // Test single-stepping where the TLS register can be evicted by a non-trivial
      4 // function body.
      5 
      6 var g = newGlobal({newCompartment: true});
      7 g.parent = this;
      8 g.eval(`
      9    var dbg = new Debugger(parent);
     10 `);
     11 
     12 var i = new WebAssembly.Instance(new WebAssembly.Module(wasmTextToBinary(`
     13    (module
     14        (func (export "f2")
     15            i64.const 0
     16            i64.const 0
     17            i32.const 0
     18            select
     19            drop
     20        )
     21    )
     22 `)));
     23 
     24 g.eval(`
     25    var calledOnStep = 0;
     26    dbg.onEnterFrame = frame => {
     27        if (frame.type === "wasmcall")
     28            frame.onStep = () => { calledOnStep++ }
     29    };
     30 `);
     31 
     32 i.exports.f2();
     33 assertEq(g.calledOnStep, 2);