Changeset 27842 in webkit for trunk/JavaScriptCore/kjs/nodes.cpp


Ignore:
Timestamp:
Nov 15, 2007, 10:54:09 PM (18 years ago)
Author:
[email protected]
Message:

Reviewed by Eric Seidel.

Another round of grammar / parsing cleanup.


  1. Created distinct parser calls for parsing function bodies vs programs. This will help later with optimizing global variable access.


  1. Turned Parser into a singleton. Cleaned up Lexer's singleton interface.


  1. Modified Lexer to free a little more memory when done lexing. (Added FIXMEs for similar issues that I didn't fix.)


  1. Changed Lexer::makeIdentifier and Lexer::makeUString to start respecting the arguments passed to them. (No behavior change, but this problem could have caused serious problems for an unsuspecting user of these functions.)


  1. Removed KJS_DEBUG_MEM because it was bit-rotted.


  1. Removed Parser::prettyPrint because the same work was simpler to do at the call site.


  1. Some renames:


"Parser::accept" => "Parser::didFinishParsing"
"Parser::sid" => "Parser::m_sourceID"
"Lexer::doneParsing" => "Lexer::clear"
"sid" => "sourceId"
"lineno" => "lineNo"


  • JavaScriptCore.exp:
  • kjs/Parser.cpp: (KJS::Parser::Parser): (KJS::Parser::parseProgram): (KJS::Parser::parseFunctionBody): (KJS::Parser::parse): (KJS::Parser::didFinishParsing): (KJS::parser):
  • kjs/Parser.h: (KJS::Parser::sourceId):
  • kjs/function.cpp: (KJS::GlobalFuncImp::callAsFunction):
  • kjs/function_object.cpp: (FunctionObjectImp::construct):
  • kjs/grammar.y:
  • kjs/interpreter.cpp: (KJS::Interpreter::checkSyntax): (KJS::Interpreter::evaluate):
  • kjs/interpreter.h:
  • kjs/lexer.cpp: (kjsyylex): (KJS::lexer): (KJS::Lexer::Lexer): (KJS::Lexer::~Lexer): (KJS::Lexer::scanRegExp): (KJS::Lexer::doneParsing): (KJS::Lexer::makeIdentifier): (KJS::Lexer::makeUString):
  • kjs/lexer.h: (KJS::Lexer::pattern): (KJS::Lexer::flags): (KJS::Lexer::sawError):
  • kjs/nodes.cpp: (KJS::Node::Node): (KJS::FunctionBodyNode::FunctionBodyNode):
  • kjs/nodes.h:
  • kjs/testkjs.cpp: (prettyPrintScript): (kjsmain):
  • kjs/ustring.cpp:
  • kjs/ustring.h:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/kjs/nodes.cpp

    r27799 r27842  
    133133    ++NodeCounter::count;
    134134#endif
    135   m_line = Lexer::curr()->lineNo();
     135  m_line = lexer().lineNo();
    136136  if (!newNodes)
    137137      newNodes = new HashSet<Node*>;
     
    146146    ++NodeCounter::count;
    147147#endif
    148     m_line = Lexer::curr()->lineNo();
     148    m_line = lexer().lineNo();
    149149    if (!newNodes)
    150150        newNodes = new HashSet<Node*>;
     
    44134413FunctionBodyNode::FunctionBodyNode(SourceElements* children)
    44144414    : BlockNode(children)
    4415     , m_sourceURL(Lexer::curr()->sourceURL())
    4416     , m_sourceId(Parser::sid)
     4415    , m_sourceURL(lexer().sourceURL())
     4416    , m_sourceId(parser().sourceId())
    44174417    , m_initializedDeclarationStacks(false)
    44184418    , m_initializedSymbolTable(false)
Note: See TracChangeset for help on using the changeset viewer.