Status: New
Owner: ----
New issue 1890 by [email protected]: Issues with loops and Smi arithmetic
http://code.google.com/p/v8/issues/detail?id=1890
I am investigating why the 'b29' case of
http://jsperf.com/hashcode-string-x/2 is so much slower than FireFox.
I did not come to a definitive conclusion, but I did see some missed
optimization opportunities.
(1) InferRange does a poor job for bitwise operations and does not even try
for XOR, so on the back-edge, hash is unbounded.
(2) If I fix (1) by adding '& mask', the first add in the loop still has
an overflow check. This points to there being some problem in the overall
range analysis. I can't tell if this is a deliberate decision to forgo
precision in order to improve dataflow speed.
(3) The expressions mask >> N are not constant folded. The value
of 'mask' is propagated into the loop, but the opportunities to constant
fold are not taken. This looks like it should occur in Canonicalize.
(4) The index check is unnecessary. This may also be an issue with
InferRange.
More speculatively:
(5) The code for charCodeAt is enormous, and I think most of FireFox's win
is here. We could get a big improvement if a region-constant string was
strength-reduced to a pointer + char size. The string would have to be
flattened on or before first indexing, and the pointer would have to be
recomputed after GC.
I think it will take a lot of work to significantly improve performance
here, but I'm happy to clean up and contribute some code for step (1). I
have a scheme which works for AND, OR and XOR, is more precise than the
current scheme and produces singleton ranges when the inputs are singletons.
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev