2. Hashtable is replaced by ObjToIntMap or UintMap to minimize memory usage.
3. Converting of strings to utf8 encoding is coded explicitly to avoid overhead of creating many objects.
2. Removal of Codegen.superClassSlashName field since Codegen.superSlashName since it is never used as a part of a signature and ClassFileWriter converts . into / in type name automatically.
- call the JSRuntime's checkObjectAccess callback, if configured, for each
get or set that invokes a user-defined function (a user-defined function is
a scripted or native function object, not a native JSPropertyOp C function).
The value passed as an in-out parameter in *vp is the function object, so
the callback could, e.g., clone function objects and configure them with
different parent objects, if that helped import them into a trust domain.
- Fix a long-standing bug that broke the deprecated, old-style, and rarely-
used top-level getter/setter function declaration form:
getter function f() { return ++x; }
setter function f(y) { return x = y; }
We want js_CheckRedeclaration to complain only if a permanent getter is
being redefined by another getter, likewise for a setter -- but not when
(as above) a setter is being added to a top-level object for the same id
as a pre-existing getter (or vice versa).
- call the JSRuntime's checkObjectAccess callback, if configured, for each
get or set that invokes a user-defined function (a user-defined function is
a scripted or native function object, not a native JSPropertyOp C function).
The value passed as an in-out parameter in *vp is the function object, so
the callback could, e.g., clone function objects and configure them with
different parent objects, if that helped import them into a trust domain.
- Fix a long-standing bug that broke the deprecated, old-style, and rarely-
used top-level getter/setter function declaration form:
getter function f() { return ++x; }
setter function f(y) { return x = y; }
We want js_CheckRedeclaration to complain only if a permanent getter is
being redefined by another getter, likewise for a setter -- but not when
(as above) a setter is being added to a top-level object for the same id
as a pre-existing getter (or vice versa).
in js_FoldConstants where it was added (suboptimally: it worked, but it ran
so late that js_FoldConstants recursion was not reduced, only js_EmitTree
recursion), to NewBinary, where it avoids JSParseNode allocations up front
and reduces recursion in all parse-tree walking.
- This change enables js_FoldConstants to see a very long concatenation of
string literals as a PN_LIST node, so it can quickly concatenate without
running afoul of O(n^2) problems inherent in js_ConcatStrings applied to
two atomized strings (the old way of folding string concatenations, still
used for any pairwise string literal concatenation).
- Further optimize the first change for the second by having NewBinary set a
new pn_strcat flag (overlaying the pn_extra field) of the PN_LIST arm of
the JSParseNode.pn_u union, whenever it sees at least one string literal in
a concatenation that might be folded (whose operands might all be constants
of string or number type).
- Notes:
- only string and number constants are folded (not boolean or null
constants);
- only all-constant left-associated binary expression chains are folded,
so 2 * foo * 3 is not folded using commutativity of * over numbers, nor
is "hi" + " there" + foo folded to "hi there" + foo.
- gcc3.2 -O and objdump -x say I added 708 bytes of instructions with this
change. I tried to keep it down to what was necessary for common script;
I don't think JS needs an optimizing-compiler-strength constant folder,
and I don't think this 1K bloat is too high a price to pay for this fix.
But I'll certainly work on reducing footprint elsewhere, if I can.
- Bug 174341, r=shaver.