Ignore:
Timestamp:
Aug 10, 2015, 1:24:35 PM (10 years ago)
Author:
[email protected]
Message:

Let's rename FunctionBodyNode
https://bugs.webkit.org/show_bug.cgi?id=147292

Reviewed by Mark Lam & Saam Barati.

FunctionBodyNode => FunctionMetadataNode

Make FunctionMetadataNode inherit from Node instead of StatementNode
because a FunctionMetadataNode can appear in expression context and does
not have a next statement.

(I decided to continue allocating FunctionMetadataNode in the AST arena,
and to retain "Node" in its name, because it really is a parsing
construct, and we transform its data before consuming it elsewhere.

There is still room for a future patch to distill and simplify the
metadata we track about functions between FunDeclNode/FuncExprNode,
FunctionMetadataNode, and UnlinkedFunctionExecutable. But this is a start.)

  • builtins/BuiltinExecutables.cpp:

(JSC::BuiltinExecutables::createExecutableInternal):

  • bytecode/UnlinkedCodeBlock.cpp:

(JSC::generateFunctionCodeBlock):
(JSC::UnlinkedFunctionExecutable::UnlinkedFunctionExecutable):

  • bytecode/UnlinkedCodeBlock.h:
  • bytecompiler/BytecodeGenerator.cpp:

(JSC::BytecodeGenerator::generate):
(JSC::BytecodeGenerator::BytecodeGenerator):
(JSC::BytecodeGenerator::emitNewArray):
(JSC::BytecodeGenerator::emitNewFunction):
(JSC::BytecodeGenerator::emitNewFunctionExpression):

  • bytecompiler/BytecodeGenerator.h:

(JSC::BytecodeGenerator::makeFunction):

  • bytecompiler/NodesCodegen.cpp:

(JSC::EvalNode::emitBytecode):
(JSC::FunctionNode::emitBytecode):
(JSC::FunctionBodyNode::emitBytecode): Deleted.

  • parser/ASTBuilder.h:

(JSC::ASTBuilder::createFunctionExpr):
(JSC::ASTBuilder::createFunctionBody):

  • parser/NodeConstructors.h:

(JSC::FunctionParameters::FunctionParameters):
(JSC::FuncExprNode::FuncExprNode):
(JSC::FuncDeclNode::FuncDeclNode):

  • parser/Nodes.cpp:

(JSC::EvalNode::EvalNode):
(JSC::FunctionMetadataNode::FunctionMetadataNode):
(JSC::FunctionMetadataNode::finishParsing):
(JSC::FunctionMetadataNode::setEndPosition):
(JSC::FunctionBodyNode::FunctionBodyNode): Deleted.
(JSC::FunctionBodyNode::finishParsing): Deleted.
(JSC::FunctionBodyNode::setEndPosition): Deleted.

  • parser/Nodes.h:

(JSC::FuncExprNode::body):
(JSC::FuncDeclNode::body):

  • parser/Parser.h:

(JSC::Parser::isFunctionMetadataNode):
(JSC::Parser::next):
(JSC::Parser<LexerType>::parse):
(JSC::Parser::isFunctionBodyNode): Deleted.

  • runtime/CodeCache.cpp:

(JSC::CodeCache::getFunctionExecutableFromGlobalCode):

  • runtime/CodeCache.h:
File:
1 edited

Legend:

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

    r187969 r188219  
    146146}
    147147
    148 // ------------------------------ FunctionBodyNode -----------------------------
    149 
    150 FunctionBodyNode::FunctionBodyNode(
     148// ------------------------------ FunctionMetadataNode -----------------------------
     149
     150FunctionMetadataNode::FunctionMetadataNode(
    151151    ParserArena&, const JSTokenLocation& startLocation,
    152152    const JSTokenLocation& endLocation, unsigned startColumn, unsigned endColumn,
    153153    int functionKeywordStart, int functionNameStart, int parametersStart, bool isInStrictContext,
    154154    ConstructorKind constructorKind, unsigned parameterCount, FunctionParseMode mode)
    155         : StatementNode(endLocation)
     155        : Node(endLocation)
    156156        , m_startColumn(startColumn)
    157157        , m_endColumn(endColumn)
     
    168168}
    169169
    170 void FunctionBodyNode::finishParsing(const SourceCode& source, const Identifier& ident, enum FunctionMode functionMode)
     170void FunctionMetadataNode::finishParsing(const SourceCode& source, const Identifier& ident, enum FunctionMode functionMode)
    171171{
    172172    m_source = source;
     
    175175}
    176176
    177 void FunctionBodyNode::setEndPosition(JSTextPosition position)
     177void FunctionMetadataNode::setEndPosition(JSTextPosition position)
    178178{
    179179    m_lastLine = position.line;
Note: See TracChangeset for help on using the changeset viewer.