Added test.

https://codereview.chromium.org/9156001/diff/2002/src/hydrogen-instructions.cc
File src/hydrogen-instructions.cc (right):

https://codereview.chromium.org/9156001/diff/2002/src/hydrogen-instructions.cc#newcode1317
src/hydrogen-instructions.cc:1317: result.ExtendRange(&lower, &upper);
On 2012/02/28 13:26:52, fschneider wrote:
I'd simplify this by propagating the inputs kMaxInt and kMinInt into
ExtendRange
and change it to return a Range object directy:

return result.ExtendRange();

This looks a little strange but let me explain.

The code above is the 1x1 decomposition.
Each input range is 'decomposed' into 1 BitRange.
It is possible to do a more precise decompostion into several BitRanges.
2 BitRanges might be the sweet-spot since it prevents change-of-sign
polluting the result.
E.g.  [-2,3] = {xxxxxxxx} as one BitRange, but is {1111111x, 000000xx}
as two.

If you have a 2x2 decomposition, then you have 4 intermediate results.

[-2,3] ^ [-1,5] = {xxxxxxxx} ^ {xxxxxxxx} = xxxxxxxx

but

[-2,3] ^ [-1,5] = {1111111x, 000000xx} ^ {11111111,00000xxx}
  result11 = 1111111x ^ 11111111 = 0000000x
  result12 = 1111111x ^ 00000xxx = 11111xxx
  result21 = 000000xx ^ 11111111 = 111111xx
  result22 = 000000xx ^ 00000xxx = 00000xxx

These can be accumulated into a range as follows:

  result11.ExtendRange(&lower, &upper);  // 0, 1
  result12.ExtendRange(&lower, &upper);  // -8, 1
  result21.ExtendRange(&lower, &upper);  // -8, 1
  result22.ExtendRange(&lower, &upper);  // -8, 7
= [-8,7]

Do you think I should implement the 2x2 decomposition? It is more
complex but does ensure that small signed integers are known to be smi.

https://codereview.chromium.org/9156001/

--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to