This commit adds `SharedImmutableStringsCache` which allows for de-duplication
and sharing of immutable strings between threads and JSRuntimes.
Each JSRuntime gets a SharedImmutableStringsCache member, but the accessor
always returns the parent runtime's cache. The caches in child JSRuntime's are
not wasting space, however, as initialization and allocation of the table
happens lazily within SharedImmutableStringsCache.
Furthermore, this commit removes `js::ScriptSource::Parent` and the
`CompressedSourceSet`. They are unnecessary because source text is always shared
via the parent runtime's `SharedImmutableStringsCache` now.
We have inconclusive evidence that compartmentStats is sometimes nullptr during
memory reporting, which would be bad. This patch makes us abort in that case.
It also changes some pointers to references to make the expected non-nullness
clearer.
--HG--
extra : rebase_source : c49f727450ce065d0e84d7728057c93d35353e91
Redoes object element measurement and reporting:
- Adds "non-heap/elements/shared", which reports a (size / refcount)
measurement. Previously these measurements went into
"non-heap/elements/mapped" and the full size would be erroneously reported
for every thread sharing the buffer.
- Renames "non-heap/elements/mapped" as "non-heap/elements/normal".
- Renames "malloc-heap/elements/non-asm.js" as "malloc-heap/elements/normal".
- Leaves "{malloc,non}-heap/elements/asm.js" unchanged.
--HG--
extra : rebase_source : cd1a660000fcb95674b317098be2dfec792b2c8e
It's gone from 4,096 bytes per JS thread to 72 bytes per thread. (Also, the
old code only measured the DtoaState for the main thread.)
--HG--
extra : rebase_source : bfe0772b8c760a45ca3665e2c0939b121189520a
Basically, this change is all about aggregating SpiderMonkey's fine-grained
measurements into the new set of coarse-grained measurements, called
ServoSizes (which is similar to the existing TabSizes). The change utilizes and
extends the existing macro machinery to do this in a way that has some chance
to maintaining correctness over the long-term despite the fact that this code
is so fiddly.
--HG--
extra : rebase_source : 1dc3d92830902d9e24496dcdc5f1ee8a6fe39fb4
Layout: js/src/vm/Symbol.h defines the new class JS::Symbol. JS::Symbol is the
same size as JSString on all platforms, because the allocator does not support
smaller allocations.
Allocation: Since the purpose of symbols is to serve as property keys, they are
always allocated in the atoms compartment.
We take a lock when allocating. This could probably be replaced with a
main-thread-only assertion. However, if atom allocation is not already a
bottleneck, symbol allocation probably never will be.
Symbols are given their own finalize-class in the GC. This means we allocate a
page per zone for symbols, even though they are only ever allocated in the
atoms zone. Terrence thought this could be easily fixed later. It should be; we
never touch the page, but a 32-bit virtual address space does not just have
infinite pages to spare.
A jsapi-test exercises the new symbol allocation code. A few oddities in
jsapi-tests are fixed in passing.
Discussion after review led to some new assertions about minimum object size in
AllocateObject and AllocateNonObject.
--HG--
extra : rebase_source : 45abb651d3b1b493d77a5dd0eb554f96b058c63a