[Webkit-unassigned] [Bug 19408] Constant folding in parser

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Jul 16 03:49:12 PDT 2008


https://bugs.webkit.org/show_bug.cgi?id=19408


loki at inf.u-szeged.hu changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #21658|0                           |1
        is obsolete|                            |
  Attachment #22302|                            |review?
               Flag|                            |




------- Comment #9 from loki at inf.u-szeged.hu  2008-07-16 03:49 PDT -------
Created an attachment (id=22302)
 --> (https://bugs.webkit.org/attachment.cgi?id=22302&action=view)
Fold only *, +, <<, >>, ~ operators

I have tried several implementations of constant folding, but I couldn't
achieve such as big speed-up as the first time. So I tried to determine why the
first patch was so good.

The first thing what I have noticed if an unused member (or non-member)
function left in the code it will easily change the result (in any direction).
For example: after I have placed an isString() function into ExpressionNode and
StringNode (and do nothing else). The result was about 1% slow down. In spite
of this, after an isBoolean() function was placed into ExpressionNode and
BooleanNode an 0.5% speed up was measured.

I guess the reason of this that the pointers of the objects and the target of
jumps have been changed in the generated object files.

The second thing: it is pointless to implement all constant folding cases in
the parser. In general the JavaScripts (or any other language) contain very
few constant folding opportunity at parser-time. In the most frequent cases the
following operators were used: *, +, <<, >>, ~. SunSpider contains very few
const. folding opportunity (only for * and + operators)

So the attached patch does constant folding for *, + (only for numbers), <<,
>>, ~ operators. I have also added a new test case for LayoutTests/fast/js
which covers all constant folding cases.

I have not measured any significant performance speed up in SunSpider, but the
end result is not worse than reference:
  ** TOTAL **:  FROM: 3201.4ms +/- 0.7%   TO: 3193.4ms +/- 0.7%

The patch is against rev. 35197.


-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.



More information about the webkit-unassigned mailing list