This patch reduces sizeof(js::HashTable):
- On 64-bit: from 32 bytes to 24 bytes.
- On 32-bit: from 24 bytes to 16 bytes.
The latter is particularly nice because jemalloc rounds up allocation requests
of 24 bytes to 32, but it can allocate 16 bytes without slop, so we're saving
16 bytes per heap-allocated HashTable.
This is done by:
- Shrinking |removedCount| and |hashShift|.
- Reordering the fields.
- Not defining |mutationCount| and |mEntered| in non-DEBUG builds rather than
using DebugOnly<> -- in non-DEBUG builds, DebugOnly<> fields take up 1 byte
each.
This change saves over 55 KiB when starting Firefox and loading Gmail.
The patch also uses uint32_t more consistently for the generation.
--HG--
extra : rebase_source : 8bdfbfe40f233711433bd9b7a2b5a19d69beacc7
With just this patch, there are not actually any symbol jsids flowing through
the system, just as there are not actually any object jsids. But a subsequent
patch (part 23) changes this.
This patch deletes some code in CTypes.cpp that is simply confused about how
element accesses work: Int64 and UInt64 objects were never actually converted
to object jsids, so the code being removed here was already dead code.
--HG--
extra : rebase_source : 86f421c6454344e76ce5219b7b1aed5c83b45f24
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
The API for symbol Values is much like the API for strings.
The implementation behind all this is in a later patch. Here, a class
JS::Symbol is declared, but not defined anywhere yet.
The constants being deleted from js/public/Value.h probably haven't been used
since Tracemonkey days.
--HG--
extra : rebase_source : 5b2d0cc4d99223483e850ee80913eef3854c427c
JSVAL_TYPE_SYMBOL is inserted between STRING and NULL, rather than added at the
end, in order to preserve all the inequality relations on JSValueTypes used
throughout Value.h. (Search the header for the operators < > <= >=.)
Otherwise, this pretty much just works. Some details of Ion snapshot layout
had to change to accommodate 4-bit types.
--HG--
extra : rebase_source : e3141e6a9ee32ef563dab43a4942a9e67d234865