tor-browser

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

byteSize-of-symbol.js (1055B)


      1 // |jit-test| skip-if: !getBuildConfiguration("moz-memory")
      2 // Run this test only if we're using jemalloc. Other malloc implementations
      3 // exhibit surprising behaviors. For example, 32-bit Fedora builds have
      4 // non-deterministic allocation sizes.
      5 
      6 // Check JS::ubi::Node::size results for symbols.
      7 
      8 // We actually hard-code specific sizes into this test, even though they're
      9 // implementation details, because in practice there are only two architecture
     10 // variants to consider (32-bit and 64-bit), and if these sizes change, that's
     11 // something SpiderMonkey hackers really want to know; they're supposed to be
     12 // stable.
     13 
     14 const SIZE_OF_SYMBOL = getBuildConfiguration("pointer-byte-size") == 4 ? 16 : 16;
     15 
     16 // Without a description.
     17 assertEq(byteSize(Symbol()), SIZE_OF_SYMBOL);
     18 
     19 // With a description.
     20 assertEq(byteSize(Symbol("This is a relatively long description to be passed to "
     21                         + "Symbol() but it doesn't matter because it just gets "
     22                         + "interned as a JSAtom* anyways.")),
     23         SIZE_OF_SYMBOL);