Ignore:
Timestamp:
Apr 29, 2014, 3:23:17 PM (11 years ago)
Author:
[email protected]
Message:

Source/JavaScriptCore: Don't hold on to parameterBindingNodes forever
https://bugs.webkit.org/show_bug.cgi?id=132360

Reviewed by Geoffrey Garen.

Don't keep the parameter nodes anymore. Instead we store the
original parameter string and reparse whenever we actually
need them. Because we only actually need them for compilation
this only results in a single extra parse.

  • bytecode/UnlinkedCodeBlock.cpp:

(JSC::generateFunctionCodeBlock):
(JSC::UnlinkedFunctionExecutable::UnlinkedFunctionExecutable):
(JSC::UnlinkedFunctionExecutable::visitChildren):
(JSC::UnlinkedFunctionExecutable::finishCreation):
(JSC::UnlinkedFunctionExecutable::paramString):
(JSC::UnlinkedFunctionExecutable::parameters):
(JSC::UnlinkedFunctionExecutable::parameterCount): Deleted.

  • bytecode/UnlinkedCodeBlock.h:

(JSC::UnlinkedFunctionExecutable::create):
(JSC::UnlinkedFunctionExecutable::parameterCount):
(JSC::UnlinkedFunctionExecutable::parameters): Deleted.
(JSC::UnlinkedFunctionExecutable::finishCreation): Deleted.

  • parser/ASTBuilder.h:

(JSC::ASTBuilder::ASTBuilder):
(JSC::ASTBuilder::setFunctionBodyParameters):

  • parser/Nodes.h:

(JSC::FunctionBodyNode::parametersStartOffset):
(JSC::FunctionBodyNode::parametersEndOffset):
(JSC::FunctionBodyNode::setParameterLocation):

  • parser/Parser.cpp:

(JSC::Parser<LexerType>::parseFunctionInfo):
(JSC::parseParameters):

  • parser/Parser.h:

(JSC::parse):

  • parser/SourceCode.h:

(JSC::SourceCode::subExpression):

  • parser/SyntaxChecker.h:

(JSC::SyntaxChecker::setFunctionBodyParameters):

LayoutTests: Don't hold on to parameter BindingNodes forever
https://bugs.webkit.org/show_bug.cgi?id=132360

Reviewed by Geoffrey Garen.

We don't regenerate the parameter string anymore, so these tests now
match the original input.

  • js/destructuring-assignment-expected.txt:
File:
1 edited

Legend:

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

    r167313 r167964  
    15361536        FunctionParameters* parameters() const { return m_parameters.get(); }
    15371537        size_t parameterCount() const { return m_parameters->size(); }
     1538        int parametersStartOffset() const { return m_parametersStart.endOffset; }
     1539        int parametersEndOffset() const { return m_parametersEnd.startOffset; }
    15381540
    15391541        virtual void emitBytecode(BytecodeGenerator&, RegisterID* = 0) override;
     
    15581560        static const bool scopeIsFunction = true;
    15591561
     1562        void setParameterLocation(const JSTokenLocation& openParen, const JSTokenLocation& closeParen)
     1563        {
     1564            m_parametersStart = openParen;
     1565            m_parametersEnd = closeParen;
     1566        }
    15601567    private:
    15611568        FunctionBodyNode(VM*, const JSTokenLocation& start, const JSTokenLocation& end, unsigned startColumn, unsigned endColumn, bool inStrictContext);
     
    15661573        FunctionMode m_functionMode;
    15671574        RefPtr<FunctionParameters> m_parameters;
     1575        JSTokenLocation m_parametersStart;
     1576        JSTokenLocation m_parametersEnd;
    15681577        int m_functionNameStart;
    15691578        unsigned m_startColumn;
Note: See TracChangeset for help on using the changeset viewer.