Comment #2 on issue 2451 by [email protected]: Math.round with negative numbers causes a method to de/re-optimize repeatedly and finally disabled
http://code.google.com/p/v8/issues/detail?id=2451

As it turns out, there is no quick fix for this problem in v8, and Math.floor is affected in a similar manner (for -0 as an input). To handle all cases in an efficient manner, we would really need some type feedback for these operations, but we don't have this currently.

In the meantime, I would propose to replace Math.round(a) by Math.floor(a+0.5), which is almost the same, but never returns -0. You can still get a deopt if the result doesn't fit into an integer, but hopefully that isn't the case for your application.

--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to