Ignore:
Timestamp:
May 24, 2011, 11:49:18 AM (14 years ago)
Author:
[email protected]
Message:

2011-05-24 Oliver Hunt <[email protected]>

Reviewed by Geoffrey Garen.

Avoid creating unnecessary identifiers and strings in the syntax checker
https://bugs.webkit.org/show_bug.cgi?id=61378

Selectively tell the lexer that there are some places it does not need to
do the real work of creating Identifiers for IDENT and STRING tokens.

Make parseString and parseIdentifier templatized on whether they should
do real work, or merely validate the tokens.

SunSpider --parse-only reports ~5-8% win depending on hardware.

  • parser/ASTBuilder.h: (JSC::ASTBuilder::createDotAccess):
  • parser/JSParser.cpp: (JSC::JSParser::next): (JSC::JSParser::consume): (JSC::JSParser::parseVarDeclarationList): (JSC::JSParser::parseConstDeclarationList): (JSC::JSParser::parseExpression): (JSC::JSParser::parseAssignmentExpression): (JSC::JSParser::parseConditionalExpression): (JSC::JSParser::parseBinaryExpression): (JSC::JSParser::parseProperty): (JSC::JSParser::parseObjectLiteral): (JSC::JSParser::parseArrayLiteral): (JSC::JSParser::parseArguments): (JSC::JSParser::parseMemberExpression):
  • parser/Lexer.cpp: (JSC::Lexer::parseIdentifier): (JSC::Lexer::parseString): (JSC::Lexer::lex):
  • parser/Lexer.h:
  • parser/SyntaxChecker.h: (JSC::SyntaxChecker::createDotAccess): (JSC::SyntaxChecker::createProperty):
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/parser/ASTBuilder.h

    r78727 r87177  
    110110    static const bool NeedsFreeVariableInfo = true;
    111111    static const bool CanUseFunctionCache = true;
     112    static const int  DontBuildKeywords = 0;
     113    static const int  DontBuildStrings = 0;
    112114
    113115    ExpressionNode* makeBinaryNode(int token, std::pair<ExpressionNode*, BinaryOpInfo>, std::pair<ExpressionNode*, BinaryOpInfo>);
     
    210212    }
    211213
    212     ExpressionNode* createDotAccess(ExpressionNode* base, const Identifier& property, int start, int divot, int end)
    213     {
    214         DotAccessorNode* node = new (m_globalData) DotAccessorNode(m_globalData, base, property);
     214    ExpressionNode* createDotAccess(ExpressionNode* base, const Identifier* property, int start, int divot, int end)
     215    {
     216        DotAccessorNode* node = new (m_globalData) DotAccessorNode(m_globalData, base, *property);
    215217        setExceptionLocation(node, start, divot, end);
    216218        return node;
Note: See TracChangeset for help on using the changeset viewer.