Status: Accepted
Owner: ----
CC: [email protected]
Labels: Type-Bug Priority-Medium
New issue 2911 by [email protected]: Propagate truncation through the
chain of additions
http://code.google.com/p/v8/issues/detail?id=2911
Functions add1 and add2 below compute the same result, however when
optimized only add2 will have both additions reverted to truncating
addition. add1 will use double additions which incurs performance penalty.
Notice that add1 is more readable. Additionally note that in context of
large function x, y, z can already be known to be of type int32 and so
would require no coercion whatsoever.
function add1(x, y, z) {
return ((x|0) + (y|0) + (z|0)) | 0;
}
function add2(x, y, z) {
return ((((x|0) + (y|0))|0) + (z|0))|0;
}
function opt(f) {
var a = 0x7FFFFFFF;
f(a, a, a);
f(a, a, a);
f(a, a, a);
%OptimizeFunctionOnNextCall(f);
f(a, a, a);
}
opt(add1);
opt(add2);
--
You received this message because this project is configured to send all
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings
--
--
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.