tor-browser

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

arm-hwcap-madness.js (1155B)


      1 // |jit-test| skip-if: !getBuildConfiguration("arm"); test-also=--arm-hwcap=armv7,vfp
      2 
      3 // The command line options disable the idiv instruction and thus make the
      4 // baseline compiler unavailable, so we must be prepared for a run-time error
      5 // below in the baseline-only configuration.
      6 
      7 // The flags above should be sufficient for there to be a WebAssembly object.
      8 assertEq(typeof WebAssembly, "object");
      9 
     10 try {
     11    var i = new WebAssembly.Instance(
     12        new WebAssembly.Module(
     13            wasmTextToBinary('(module (func (export "") (result i32) (i32.const 42)))')));
     14    assertEq(i.exports[""](), 42);
     15 } catch (e) {
     16    if (String(e).match(/no WebAssembly compiler available/)) {
     17        switch (wasmCompileMode()) {
     18        case "none":
     19            // This is fine: the limited feature set combined with command line
     20            // compiler selection caused all compilers to be disabled.
     21            break;
     22        default:
     23            // This is not fine: if there's a compiler available then we should
     24            // not get an error.
     25            throw e;
     26        }
     27    } else {
     28        // Some other error, propagate it.
     29        throw e;
     30    }
     31 }