[webkit-dev] Math.floor(expr1/expr2)

Maciej Stachowiak mjs at apple.com
Thu May 28 16:15:24 PDT 2009


On May 28, 2009, at 10:35 AM, Zoltan Herczeg wrote:

> Hi,
>
> we plans to make a super instruction for floor(expr1/expr2), which  
> is an
> integer division (if both operands are integer numbers). We hope it  
> would
> be benficial for embedded systems. I think the implementation would be
> similar to the JS apply() function: the fast case detects whether both
> operands are integer numbers and the function JSCell refers to the  
> native
> floor function. The slow case would be the original SF byte code  
> (the fast
> case has a jump to the end of the slow case).
>
> Do other ports interested in such super instruction? Where would be  
> easier
> to detect these kind of expressions: in AST level or in SF byte code  
> level
> (as a peephole optimization)?

We've considered adding guarded optimized cases for many Math  
functions. Oliver hunt can probably tell you about his thinking on  
these. I think the right place to do that level of optimization would  
be at the AST level, given the fairly complex relationship and  
dependency on specific symbol names.

  - Maciej



More information about the webkit-dev mailing list