[Webkit-unassigned] [Bug 15884] New: JavaScriptCore should use simple type inferencing to speed-up AddNode

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Nov 7 07:28:15 PST 2007


http://bugs.webkit.org/show_bug.cgi?id=15884

           Summary: JavaScriptCore should use simple type inferencing to
                    speed-up AddNode
           Product: WebKit
           Version: 525+ (Nightly build)
          Platform: Macintosh
        OS/Version: Mac OS X 10.4
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: JavaScriptCore
        AssignedTo: webkit-unassigned at lists.webkit.org
        ReportedBy: eric at webkit.org


JavaScriptCore should use simple type inferencing to speed-up AddNode (and
other nodes which depend on input types).

I propose that this type inferencing be done in a separate walk of the AST
tree, instead of at parse time.  That makes it easier to do const collapsing
and const propagation before the type inferencing pass.  Maybe all of these get
rolled into a single "optimize" pass in the end.

In this optimize method, we would inference the types of the node children
(recursive call, probably) and then use that information to infer the types of
this node.  Often the child node information is not needed to inferring the
type, but propagating the call down the tree is needed for a full tree walk. 
Based on the types, we would then placement new a more specific node instead of
the generic AddNodeObjects (see below).

The idea is to have AddNodeObjects AddNodeNumbers AddNodeStrings, where Objects
is where you have to call toPrimative first on both, Strings you only need to
call evaluate() and cast to a StringImp and grab the value, we could add
StringLeft and StringRight for the cases where one of them is a string and the
other is not, but I think that'd be overkill for the first pass.

Numeric would be the big speedup, because you'd just immediately call
evaluateToNumber (once bug 15879 is in) and not only would the AddNodeNumbers
have no branches for types, but it would also be dealing with doubles directly
(in both the evaluate and evaluateToNumber cases).

Other nodes could do the same sort of thing for a speedup, the comparison Nodes
being a good example.


-- 
Configure bugmail: http://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