• fschneider@chromium.org's avatar
    Add an assigned variables analysis. · 0143d707
    fschneider@chromium.org authored
    This change adds a pass over the AST that computes the
    set of assigned variables for locals and parameters for each expression.
    
    The result of this analysis is used to for two purposes:
    1. Recognize variables that are trivial subexpressions. A left sub-expression
       of a binary operation is trivial if it is a local variable or a parameter
       and it is not assigned in the right sub-expression. In the case of a 
       trivial left sub-expression we evaluate the right first.
       Currently only binary operations and compare operations are considered
       when finding trivial left sub-expressions.
    
    2. Recogize certain simple for-loops with a constant trip count where the loop
       variable is always within smi range. If the loop count variable is not
       assigned in the body of the loop (except in the update expression the
       for-loop). This allows omitting smi checks on operation using the loop
       count variable.
    
    Review URL: http://codereview.chromium.org/669155
    
    git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@4087 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
    0143d707
data-flow.cc 42.5 KB