It does not have to be in Canonicalization pass (not every optimization that replaces instructions fits into it).
I am not entirely sure that it makes perfect sense to perform such optimization during range analysis itself though I do see at least one reason why you would want to do that: our conditional range propagation does not associate range information with uses, so [alpha > 0] information becomes lost after range analysis. This can be worked around by attaching more information to HUseListNode* during range analysis. Honestly speaking it's hard to speculate if some patch would be accepted or not without actually seeing a patch. -- Vyacheslav Egorov On Wed, Jul 25, 2012 at 4:20 PM, Evan Wallace <[email protected]> wrote: > 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. > > 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 -- v8-users mailing list [email protected] http://groups.google.com/group/v8-users
