[Webkit-unassigned] [Bug 33860] New: potential speed up of parser by recoding expression rules

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Jan 19 13:07:33 PST 2010


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

           Summary: potential speed up of parser by recoding expression
                    rules
           Product: WebKit
           Version: 528+ (Nightly build)
          Platform: All
        OS/Version: All
            Status: UNCONFIRMED
          Severity: Normal
          Priority: P2
         Component: JavaScriptCore
        AssignedTo: webkit-unassigned at lists.webkit.org
        ReportedBy: pmuellr at yahoo.com


While playing with the bison parser for JavaScriptCore, I did a little googling
research on bison optimization.  Stumbled upon this:

   http://compilers.iecc.com/comparch/article/97-03-086

which claims you can reduce the number of reductions by changing the way the
rules are defined; basically flattening the recursive rules that define
precedence, and adding the precedence back via %prec directives.

Just to see what was going on, I traced through the following expression
(turned on the debug flags)

x  = { a: 1 };

The parser walks the following steps when it hits the "1" token, consuming a
"}" during the reduction:

    NUMBER
    Literal
    PrimaryExprNoBrace
    PrimaryExpr
    MemberExpr
    NewExpr
    LeftHandSideExpr
    PostfixExpr
    UnaryExpr
    MultiplicativeExpr
    AdditiveExpr
    ShiftExpr
    RelationalExpr
    EqualityExpr
    BitwiseANDExpr
    BitwiseXORExpr
    BitwiseORExpr
    LogicalANDExpr
    LogicalORExpr
    ConditionalExpr
    AssignmentExpr

It seems to me that at least the rules from PostfixExpr down through
ConditionalExpr would be good candidates to try this on.

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



More information about the webkit-unassigned mailing list