Ignore:
Timestamp:
Sep 15, 2010, 5:05:13 PM (15 years ago)
Author:
[email protected]
Message:

2010-09-15 Oliver Hunt <[email protected]>

Reviewed by Geoffrey Garen.

Use free variable analysis to improve activation performance
https://bugs.webkit.org/show_bug.cgi?id=45837

Adds free and captured variable tracking to the JS parser. This
allows us to avoid construction of an activation object in some
cases. Future patches will make more use of this information to
improve those cases where activations are still needed.

  • parser/ASTBuilder.h:
  • parser/JSParser.cpp: (JSC::JSParser::Scope::Scope): (JSC::JSParser::Scope::declareVariable): (JSC::JSParser::Scope::useVariable): (JSC::JSParser::Scope::collectFreeVariables): (JSC::JSParser::Scope::capturedVariables): (JSC::JSParser::ScopeRef::ScopeRef): (JSC::JSParser::ScopeRef::operator->): (JSC::JSParser::ScopeRef::index): (JSC::JSParser::currentScope): (JSC::JSParser::pushScope): (JSC::JSParser::popScope): (JSC::JSParser::parseProgram): (JSC::JSParser::parseVarDeclarationList): (JSC::JSParser::parseConstDeclarationList): (JSC::JSParser::parseTryStatement): (JSC::JSParser::parseFormalParameters): (JSC::JSParser::parseFunctionInfo): (JSC::JSParser::parseFunctionDeclaration): (JSC::JSParser::parsePrimaryExpression):
  • parser/Nodes.cpp: (JSC::ScopeNodeData::ScopeNodeData): (JSC::ScopeNode::ScopeNode): (JSC::ProgramNode::ProgramNode): (JSC::ProgramNode::create): (JSC::EvalNode::EvalNode): (JSC::EvalNode::create): (JSC::FunctionBodyNode::FunctionBodyNode): (JSC::FunctionBodyNode::create):
  • parser/Nodes.h: (JSC::ScopeNode::needsActivation): (JSC::ScopeNode::hasCapturedVariables):
  • parser/Parser.cpp: (JSC::Parser::didFinishParsing):
  • parser/Parser.h: (JSC::Parser::parse):
  • parser/SyntaxChecker.h:
  • runtime/Executable.cpp: (JSC::EvalExecutable::compileInternal): (JSC::ProgramExecutable::compileInternal): (JSC::FunctionExecutable::compileForCallInternal): (JSC::FunctionExecutable::compileForConstructInternal):
  • runtime/Executable.h: (JSC::ScriptExecutable::needsActivation): (JSC::ScriptExecutable::recordParse):
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/parser/Parser.h

    r63267 r67583  
    5252
    5353        void didFinishParsing(SourceElements*, ParserArenaData<DeclarationStacks::VarStack>*,
    54                               ParserArenaData<DeclarationStacks::FunctionStack>*, CodeFeatures features, int lastLine, int numConstants);
     54                              ParserArenaData<DeclarationStacks::FunctionStack>*, CodeFeatures features,
     55                              int lastLine, int numConstants, IdentifierSet&);
    5556
    5657        ParserArena& arena() { return m_arena; }
     
    6869        ParserArenaData<DeclarationStacks::VarStack>* m_varDeclarations;
    6970        ParserArenaData<DeclarationStacks::FunctionStack>* m_funcDeclarations;
     71        IdentifierSet m_capturedVariables;
    7072        CodeFeatures m_features;
    7173        int m_lastLine;
     
    8890        if (m_sourceElements) {
    8991            result = ParsedNode::create(globalData,
    90             m_sourceElements,
    91             m_varDeclarations ? &m_varDeclarations->data : 0,
    92             m_funcDeclarations ? &m_funcDeclarations->data : 0,
    93             source,
    94             m_features,
    95             m_numConstants);
     92                m_sourceElements,
     93                m_varDeclarations ? &m_varDeclarations->data : 0,
     94                m_funcDeclarations ? &m_funcDeclarations->data : 0,
     95                m_capturedVariables,
     96                source,
     97                m_features,
     98                m_numConstants);
    9699            result->setLoc(m_source->firstLine(), m_lastLine);
    97100        } else if (lexicalGlobalObject) {
Note: See TracChangeset for help on using the changeset viewer.