Reviewed by Eric.
authormjs@apple.com <mjs@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 24 Dec 2007 10:13:00 +0000 (10:13 +0000)
committermjs@apple.com <mjs@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 24 Dec 2007 10:13:00 +0000 (10:13 +0000)
commitb307469038edaf2fbeff3fc1a027a36a8e2e2899
tree9f4db608ec3c5d118f15a43305ad35f63110e80a
parenta0dc8ca8286f87cac91ca3ac4cf0222c09426bb4
    Reviewed by Eric.

        - Optimize variable declarations
        http://bugs.webkit.org/show_bug.cgi?id=16585

        3.5% speedup on SunSpider.

        var statements now result in either assignments or empty statements.

        This allows a couple of optimization opportunities:
        - No need to branch at runtime to check if there is an initializer
        - EmptyStatementNodes can be removed entirely (also done in this patch)
        - Assignment expressions get properly optimized for local variables

        This patch also includes some code cleanup:
        - Most of the old VarStatement/VarDecl logic is now only used for const declarations,
          thus it is renamed appropriately
        - AssignExprNode is gone

        * JavaScriptCore.exp:
        * kjs/NodeInfo.h:
        * kjs/grammar.y:
        * kjs/nodes.cpp:
        (KJS::SourceElements::append):
        (KJS::ConstDeclNode::ConstDeclNode):
        (KJS::ConstDeclNode::optimizeVariableAccess):
        (KJS::ConstDeclNode::handleSlowCase):
        (KJS::ConstDeclNode::evaluateSingle):
        (KJS::ConstDeclNode::evaluate):
        (KJS::ConstStatementNode::optimizeVariableAccess):
        (KJS::ConstStatementNode::execute):
        (KJS::VarStatementNode::optimizeVariableAccess):
        (KJS::VarStatementNode::execute):
        (KJS::ForInNode::ForInNode):
        (KJS::ForInNode::optimizeVariableAccess):
        (KJS::ForInNode::execute):
        (KJS::FunctionBodyNode::initializeSymbolTable):
        (KJS::ProgramNode::initializeSymbolTable):
        (KJS::FunctionBodyNode::processDeclarations):
        (KJS::ProgramNode::processDeclarations):
        (KJS::EvalNode::processDeclarations):
        * kjs/nodes.h:
        (KJS::DeclarationStacks::):
        (KJS::StatementNode::):
        (KJS::ConstDeclNode::):
        (KJS::ConstStatementNode::):
        (KJS::EmptyStatementNode::):
        (KJS::VarStatementNode::):
        (KJS::ForNode::):
        * kjs/nodes2string.cpp:
        (KJS::ConstDeclNode::streamTo):
        (KJS::ConstStatementNode::streamTo):
        (KJS::ScopeNode::streamTo):
        (KJS::VarStatementNode::streamTo):
        (KJS::ForNode::streamTo):
        (KJS::ForInNode::streamTo):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@28973 268f45cc-cd09-0410-ab3c-d52691b4dbfc
JavaScriptCore/ChangeLog
JavaScriptCore/JavaScriptCore.exp
JavaScriptCore/kjs/NodeInfo.h
JavaScriptCore/kjs/grammar.y
JavaScriptCore/kjs/nodes.cpp
JavaScriptCore/kjs/nodes.h
JavaScriptCore/kjs/nodes2string.cpp