On 2015/01/29 08:17:28, Benedikt Meurer wrote:
On 2015/01/29 at 08:14:08, dtc-v8 wrote:
...
>
> Can you see any other issues?
>
> It may well be cleaner to transform the int32 addition to an int64
addition
earlier and I'll give this a try too.
Well, the problem is still the same:
ChangeUint32ToUint64(Int32Add(x,y)) is not equivalent to
Int64Add(ChangeUint32ToUint64(x), ChangeUint32ToUint64(y)), but to
Word64And(Int64Add(ChangeUint32ToUint64(x), ChangeUint32ToUint64(y)),
0xffffffff), so the optimization itself is unsound. It might be safe for
asm.js
heap access patterns, where we end with Load/Store operations, but in
general
that's not true.
Even if this logic is hoisted earlier it will be similar, so the required
constraints need to be understood.
A 32 bit addition is not equivalent to a 64 bit addition in general but
this is
a very useful optimization and the question is if it is valid under the
constraints?
The index (the result of the addition) is constrained to be a 31 bit
unsigned
integer whether calculated using 32 bit or 64 bit addition.
The offset (an argument to the addition) is a signed 32 bit integer that is
sign
extended to 64 bits in the 64 bit addition.
The other argument to the addition operation has been constrained to be a
31 bit
unsigned integer that is zero extended to 64 bits in the address
calculation.
The original addition is an Int32Add, which I presume means it truncates or
was
proven to not overflow so truncation was not an issue. This could be
produced by
a truncating u[i>>n] asm.js style access or a u[i] un-truncated access that
is
proven to not overflow. This is not asm.js specific.
If there are cases that are not valid then an example would be very helpful?
https://codereview.chromium.org/860283004/
--
--
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/d/optout.