* Menu of -D flags for enabling instrumentation, as a commented-out CFLAGS +=
setting for convenient testing.
* js_FindProperty and js_LookupPropertyWithFlags return indexes into the scope
and prototype chains, respectively, to support internal instrumentation, and
to pave the way for the return of the property cache (bug 365851)..
* jsutil.[ch] JSBasicStats struct and functions for computing mean/sigma/max
and auto-scaling histogram.
* JS_SCOPE_DEPTH_METER instrumentation for compile- and run-time scope chain
length instrumentation:
+ At compile time, rt->hostenvScopeDepthStats and rt->lexicalScopeDepthStats
meter scope chains passed into the compile and evaluate APIs.
+ At runtime, rt->protoLookupDepthStats and rt->scopeSearchDepthStats track
steps along the prototype and scope chains until the sought-after property
is found.
* JS_ARENAMETER uses JSBasicStats now.
* Added rt->liveScopePropsPreSweep to fix the property tree stats code that
rotted when property tree sweeping moved to after the finalization phase.
* Un-bitrotted some DEBUG_brendan code, turned some off for myself via XXX.
* Mac OS X toolchain requires initialized data shared across dynamic library
member files, outlaws common data, so initialize extern metering vars.
* Old HASHMETER code in jshash.[ch] is now JS_HASHMETER-controlled and based
on JSBasicStats.
* DEBUG_scopemeters macro renamed JS_DUMP_SCOPE_METERS; uses JSBasicStats now.
* Disentangle DEBUG and DUMP_SCOPE_STATS (now JS_DUMP_PROPTREE_STATS) and fix
inconsistent thread safety for liveScopeProps (sometimes atomic-incremented,
sometimes runtime-locked).
* Compiler-modeled maxScopeDepth will propagate via JSScript to runtime for
capability-based, interpreter-inlined cache hit qualifier bits, to bypass
scope and prototype chain lookup by optimizing for common monomorphic get,
set, and call site referencing a prototype property in a well-named object
(no shadowing or mutation in 99.9% of the cases).
git-svn-id: svn://10.0.0.236/trunk@242973 18797224-902f-48f8-a5cc-f745e15eee43
their meaning better, adding a flag for 'for (var x ... in o)'.
- Set these flags from the parser, in a future-proof way (|=, not =, given the
zero initialized pn_extra flags member of pn_list).
- Test list flags in the code generator, including PNX_FORINVAR in conjunction
with whether the for..in loop is of the oddball form 'for (var x = i in o)'.
- Thereby fix failure to emit a JSOP_DEFVAR in the case that a function wraps
a for..in loop in a with statement (252892, r=shaver).
- The same fix cured another bug, not reported, where 'for (var x = i in o)'
in a function without any 'with' statement would emit the wrong opcode
(JSOP_FORNAME, not JSOP_FORVAR).
git-svn-id: svn://10.0.0.236/trunk@160101 18797224-902f-48f8-a5cc-f745e15eee43
locals (169559, r=shaver).
- Also fix longstanding bug where global regexps in precompiled scripts were
wrongly shared among threads/contexts (165201, r=shaver).
- Also fix strict-aliasing gcc warning causes (206599, r=bryner).
git-svn-id: svn://10.0.0.236/trunk@154749 18797224-902f-48f8-a5cc-f745e15eee43
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.
git-svn-id: svn://10.0.0.236/trunk@138638 18797224-902f-48f8-a5cc-f745e15eee43
- Optimize compile (parse+emit) operation to generate code for each top-level
statement or function in turn, recycling JSParseNodes as we go for greatly
reduced "long linear script" footprint.
- Fix O(n**2) growth problems in bytecode and srcnote generation.
- Add js_ParseTokenStream entry point to compiler, for tree-generation without
code-generation. Move JSOP_EVAL instruction selection from code-generator to
parser, to match other such specializations and enable js_ParseTokenStream.
- Fix js_CompileTokenStream (and get it right in new js_ParseTokenStream) to
respect JSOPTION_VAROBJFIX.
- Clean up bracing, multi-line conditions, and overlong lines.
git-svn-id: svn://10.0.0.236/trunk@85619 18797224-902f-48f8-a5cc-f745e15eee43
- Tabs expanded as much as I could stand, without taking too much cvsblame.
git-svn-id: svn://10.0.0.236/trunk@59716 18797224-902f-48f8-a5cc-f745e15eee43