Oh ok, that makes sense. So V8 generates an integer instruction only if the remainder is always zero. I've submitted this as issue 2258<http://code.google.com/p/v8/issues/detail?id=2258> .
I'm more than happy to contribute my patch but I'm new to V8 and my quick hack probably isn't the correct way to do it. It looks like instruction replacement should take place in the canonicalize pass but range information isn't available until range analysis. I did the optimization during range analysis both to make sure the preconditions hold (non-negative dividend and positive divisor) and to make sure the correct range is calculated for subsequent instructions. Would a patch that adds and removes instructions during range analysis be accepted? -- v8-users mailing list [email protected] http://groups.google.com/group/v8-users
