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/runtime/Executable.h

    r63675 r67583  
    173173        bool usesEval() const { return m_features & EvalFeature; }
    174174        bool usesArguments() const { return m_features & ArgumentsFeature; }
    175         bool needsActivation() const { return m_features & (EvalFeature | ClosureFeature | WithFeature | CatchFeature); }
     175        bool needsActivation() const { return m_hasCapturedVariables || m_features & (EvalFeature | WithFeature | CatchFeature); }
    176176
    177177        virtual PassOwnPtr<ExceptionInfo> reparseExceptionInfo(JSGlobalData*, ScopeChainNode*, CodeBlock*) = 0;
    178178
    179179    protected:
    180         void recordParse(CodeFeatures features, int firstLine, int lastLine)
     180        void recordParse(CodeFeatures features, bool hasCapturedVariables, int firstLine, int lastLine)
    181181        {
    182182            m_features = features;
     183            m_hasCapturedVariables = hasCapturedVariables;
    183184            m_firstLine = firstLine;
    184185            m_lastLine = lastLine;
     
    187188        SourceCode m_source;
    188189        CodeFeatures m_features;
     190        bool m_hasCapturedVariables;
    189191        int m_firstLine;
    190192        int m_lastLine;
Note: See TracChangeset for help on using the changeset viewer.