ProString is almost a QStringRef, except that it keeps a copy of instead
of a pointer to the QString - to make it refcountable. additionally, it
holds a hash so it can be efficiently used for repetetive hash lookups.
this function class just joins each string list argument into a
single string. so instead of first building a list and joining it
right afterwards, create a single string in the first place.
turn else, for(), defineTest() and defineReplace() into own node
types instead of treating them as magic conditionals/functions.
on top of that, introduce a proper branching node type, so finding
the alternative code paths can be moved into the parser instead of
burdening the evaluator with it.
it wouldn't work as expected anyway, as the splitting rule (using the
semicolon in addition to whitespace) applied only to the string literal
from the pro file, but not any expanded [environment] variables, etc.
(i.e., where it might any make sense). so just drop it, as it would
considerably complicate following optimizations.
unlike in qmake, the arguments are already expanded at this point
(which is strictly speaking a bug for the iterator variable name),
so it is plain wrong to call doVariableReplace on them.
We used to indicate that the cache for a file is up to date by having a
Entry with ent->locker == 0. But we first wake up all threads and only
after all the threads who waited for that parse to complete we set
ent->locker to zero. Thus a different thread could get the impression
that it needs to wait for the parse thread, yet get no wake up.
We need a different flag to indicate that we are actually already done
parsing and the cache can simply be used instead of waiting for a wake
up.
Reviewed-By: ossi
we are so fast now, we can burn a few cycles again ... :}
variable names are mapped as soon as they become known (and not when
using them). that sprinkles map() calls everywhere, but it's faster.
previously, the entire value hash was simply pushed on a stack upon
entering a custom function. the problem with that was that setting the
function's argument already detached (i.e., copied) the entire hash.
so instead store only actually modified values in nested scopes and let
lookups cascade to parent scopes.
improvement: 2% for qt, 15% for creator ...
it is extremely unlikely that a function would change one of the
interesting variables (all types of source file lists) but not re-export
them subsequently. thus the scoping only complicates matters and burns
cpu cycles.
we ignore the tiny possibility that this could illegitimately reset a
list while doing exact parsing - the subsequent cumulative parsing would
most likely catch these files again anyway.
This reverts commit e70530c5ad. It
did break builds on older gcc versions (gcc 4.1.2 64 bit Linux,
gcc 4.0.1 on Mac OS X):
parser/qmljsgrammar_p.h: In static member function ???static int
QmlJSGrammar::nt_action(int, int)???:
parser/qmljsgrammar_p.h:188: error: ???QmlJSGrammar::<anonymous enum>???
is/uses anonymous type
parser/qmljsgrammar_p.h:188: error: trying to instantiate
???template<class T> struct QConcatenable???
...
this makes the i/o part of the evaluator thread-safe.
for safety, assert absolute paths in IoUtils::exists().
on the way, i "stole" some code i wrote for KDE. there have been no
copyright-worthy contributions from others to it, so this is legal.