Changeset 27215 in webkit for trunk/JavaScriptCore/kjs/nodes.h


Ignore:
Timestamp:
Oct 28, 2007, 11:49:54 PM (18 years ago)
Author:
mjs
Message:

Reviewed by Darin.



Not a significant speedup or slowdown on SunSpider.

  • kjs/Parser.cpp: (KJS::clearNewNodes):
  • kjs/Parser.h:
  • kjs/grammar.y:
  • kjs/nodes.cpp: (KJS::BlockNode::BlockNode): (KJS::CaseBlockNode::CaseBlockNode): (KJS::FunctionBodyNode::FunctionBodyNode): (KJS::SourceElementsNode::SourceElementsNode): (KJS::ProgramNode::ProgramNode):
  • kjs/nodes.h: (KJS::ElementNode::): (KJS::ArrayNode::): (KJS::PropertyListNode::): (KJS::ObjectLiteralNode::): (KJS::ArgumentListNode::): (KJS::ArgumentsNode::): (KJS::VarDeclListNode::): (KJS::VarStatementNode::): (KJS::ForNode::): (KJS::ParameterNode::): (KJS::FuncExprNode::): (KJS::FuncDeclNode::): (KJS::SourceElementsNode::): (KJS::CaseClauseNode::): (KJS::ClauseListNode::):
File:
1 edited

Legend:

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

    r27210 r27215  
    143143    virtual void optimizeVariableAccess(FunctionBodyNode*, DeclarationStacks::NodeStack&) KJS_FAST_CALL { }
    144144
    145     virtual void breakCycle() KJS_FAST_CALL { }
    146 
    147145  protected:
    148146    Completion createErrorCompletion(ExecState *, ErrorType, const char *msg) KJS_FAST_CALL;
     
    307305  class ElementNode : public Node {
    308306  public:
    309     // list pointer is tail of a circular list, cracked in the ArrayNode ctor
    310     ElementNode(int e, Node *n) KJS_FAST_CALL : next(this), elision(e), node(n) { Parser::noteNodeCycle(this); }
    311     ElementNode(ElementNode *l, int e, Node *n) KJS_FAST_CALL
    312       : next(l->next), elision(e), node(n) { l->next = this; }
     307    ElementNode(int e, Node* n) KJS_FAST_CALL : elision(e), node(n) { }
     308    ElementNode(ElementNode* l, int e, Node* n) KJS_FAST_CALL
     309      : elision(e), node(n) { l->next = this; }
    313310    virtual void optimizeVariableAccess(FunctionBodyNode*, DeclarationStacks::NodeStack&) KJS_FAST_CALL;
    314311    JSValue* evaluate(ExecState*) KJS_FAST_CALL;
    315312    virtual void streamTo(SourceStream&) const KJS_FAST_CALL;
    316313    PassRefPtr<ElementNode> releaseNext() KJS_FAST_CALL { return next.release(); }
    317     virtual void breakCycle() KJS_FAST_CALL;
    318314    virtual Precedence precedence() const { ASSERT_NOT_REACHED(); return PrecExpression; }
    319315  private:
     
    327323  public:
    328324    ArrayNode(int e) KJS_FAST_CALL : elision(e), opt(true) { }
    329     ArrayNode(ElementNode *ele) KJS_FAST_CALL
    330       : element(ele->next.release()), elision(0), opt(false) { Parser::removeNodeCycle(element.get()); }
    331     ArrayNode(int eli, ElementNode *ele) KJS_FAST_CALL
    332       : element(ele->next.release()), elision(eli), opt(true) { Parser::removeNodeCycle(element.get()); }
     325    ArrayNode(ElementNode* ele) KJS_FAST_CALL
     326      : element(ele), elision(0), opt(false) { }
     327    ArrayNode(int eli, ElementNode* ele) KJS_FAST_CALL
     328      : element(ele), elision(eli), opt(true) { }
    333329    virtual void optimizeVariableAccess(FunctionBodyNode*, DeclarationStacks::NodeStack&) KJS_FAST_CALL;
    334330    JSValue* evaluate(ExecState*) KJS_FAST_CALL;
     
    360356  class PropertyListNode : public Node {
    361357  public:
    362     // list pointer is tail of a circular list, cracked in the ObjectLiteralNode ctor
    363     PropertyListNode(PropertyNode *n) KJS_FAST_CALL
    364       : node(n), next(this) { Parser::noteNodeCycle(this); }
    365     PropertyListNode(PropertyNode *n, PropertyListNode *l) KJS_FAST_CALL
    366       : node(n), next(l->next) { l->next = this; }
     358    PropertyListNode(PropertyNode* n) KJS_FAST_CALL
     359      : node(n) { }
     360    PropertyListNode(PropertyNode* n, PropertyListNode* l) KJS_FAST_CALL
     361      : node(n) { l->next = this; }
    367362    virtual void optimizeVariableAccess(FunctionBodyNode*, DeclarationStacks::NodeStack&) KJS_FAST_CALL;
    368363    JSValue* evaluate(ExecState*) KJS_FAST_CALL;
    369364    virtual void streamTo(SourceStream&) const KJS_FAST_CALL;
    370365    PassRefPtr<PropertyListNode> releaseNext() KJS_FAST_CALL { return next.release(); }
    371     virtual void breakCycle() KJS_FAST_CALL;
    372366    virtual Precedence precedence() const { ASSERT_NOT_REACHED(); return PrecExpression; }
    373367  private:
     
    380374  public:
    381375    ObjectLiteralNode() KJS_FAST_CALL { }
    382     ObjectLiteralNode(PropertyListNode *l) KJS_FAST_CALL : list(l->next.release()) { Parser::removeNodeCycle(list.get()); }
     376    ObjectLiteralNode(PropertyListNode* l) KJS_FAST_CALL : list(l) { }
    383377    virtual void optimizeVariableAccess(FunctionBodyNode*, DeclarationStacks::NodeStack&) KJS_FAST_CALL;
    384378    JSValue* evaluate(ExecState*) KJS_FAST_CALL;
     
    427421  class ArgumentListNode : public Node {
    428422  public:
    429     // list pointer is tail of a circular list, cracked in the ArgumentsNode ctor
    430     ArgumentListNode(Node *e) KJS_FAST_CALL : next(this), expr(e) { Parser::noteNodeCycle(this); }
    431     ArgumentListNode(ArgumentListNode *l, Node *e) KJS_FAST_CALL
    432       : next(l->next), expr(e) { l->next = this; }
     423    ArgumentListNode(Node* e) KJS_FAST_CALL : expr(e) { }
     424    ArgumentListNode(ArgumentListNode* l, Node* e) KJS_FAST_CALL
     425      : expr(e) { l->next = this; }
    433426    virtual void optimizeVariableAccess(FunctionBodyNode*, DeclarationStacks::NodeStack&) KJS_FAST_CALL;
    434427    JSValue* evaluate(ExecState*) KJS_FAST_CALL;
     
    436429    virtual void streamTo(SourceStream&) const KJS_FAST_CALL;
    437430    PassRefPtr<ArgumentListNode> releaseNext() KJS_FAST_CALL { return next.release(); }
    438     virtual void breakCycle() KJS_FAST_CALL;
    439431    virtual Precedence precedence() const { ASSERT_NOT_REACHED(); return PrecExpression; }
    440432  private:
     
    447439  public:
    448440    ArgumentsNode() KJS_FAST_CALL { }
    449     ArgumentsNode(ArgumentListNode *l) KJS_FAST_CALL
    450       : list(l->next.release()) { Parser::removeNodeCycle(list.get()); }
     441    ArgumentsNode(ArgumentListNode* l) KJS_FAST_CALL
     442      : list(l) { }
    451443    virtual void optimizeVariableAccess(FunctionBodyNode*, DeclarationStacks::NodeStack&) KJS_FAST_CALL;
    452444    JSValue* evaluate(ExecState*) KJS_FAST_CALL;
     
    12151207  class VarDeclListNode : public Node {
    12161208  public:
    1217     // list pointer is tail of a circular list, cracked in the ForNode/VarStatementNode ctor
    1218     VarDeclListNode(VarDeclNode *v) KJS_FAST_CALL : next(this), var(v) { Parser::noteNodeCycle(this); m_mayHaveDeclarations = true; }
    1219     VarDeclListNode(VarDeclListNode *l, VarDeclNode *v) KJS_FAST_CALL
    1220       : next(l->next), var(v) { l->next = this; m_mayHaveDeclarations = true; }
     1209    VarDeclListNode(VarDeclNode* v) KJS_FAST_CALL : var(v) { m_mayHaveDeclarations = true; }
     1210    VarDeclListNode(VarDeclListNode* l, VarDeclNode* v) KJS_FAST_CALL
     1211      : var(v) { l->next = this; m_mayHaveDeclarations = true; }
    12211212    virtual void optimizeVariableAccess(FunctionBodyNode*, DeclarationStacks::NodeStack&) KJS_FAST_CALL;
    12221213    JSValue* evaluate(ExecState*) KJS_FAST_CALL;
    12231214    virtual void streamTo(SourceStream&) const KJS_FAST_CALL;
    12241215    PassRefPtr<VarDeclListNode> releaseNext() KJS_FAST_CALL { return next.release(); }
    1225     virtual void breakCycle() KJS_FAST_CALL;
    12261216    virtual void getDeclarations(DeclarationStacks&) KJS_FAST_CALL;
    12271217    virtual Precedence precedence() const { ASSERT_NOT_REACHED(); return PrecExpression; }
     
    12351225  class VarStatementNode : public StatementNode {
    12361226  public:
    1237     VarStatementNode(VarDeclListNode *l) KJS_FAST_CALL : next(l->next.release()) { Parser::removeNodeCycle(next.get()); m_mayHaveDeclarations = true; }
     1227    VarStatementNode(VarDeclListNode* l) KJS_FAST_CALL : next(l) { m_mayHaveDeclarations = true; }
    12381228    virtual void optimizeVariableAccess(FunctionBodyNode*, DeclarationStacks::NodeStack&) KJS_FAST_CALL;
    12391229    virtual Completion execute(ExecState*) KJS_FAST_CALL;
     
    13121302  class ForNode : public StatementNode {
    13131303  public:
    1314     ForNode(Node *e1, Node *e2, Node *e3, StatementNode *s) KJS_FAST_CALL :
     1304    ForNode(Node* e1, Node* e2, Node* e3, StatementNode* s) KJS_FAST_CALL :
    13151305      expr1(e1), expr2(e2), expr3(e3), statement(s) { m_mayHaveDeclarations = true; }
    1316     ForNode(VarDeclListNode *e1, Node *e2, Node *e3, StatementNode *s) KJS_FAST_CALL :
    1317       expr1(e1->next.release()), expr2(e2), expr3(e3), statement(s) { Parser::removeNodeCycle(expr1.get()); m_mayHaveDeclarations = true; }
    13181306    virtual void optimizeVariableAccess(FunctionBodyNode*, DeclarationStacks::NodeStack&) KJS_FAST_CALL;
    13191307    virtual Completion execute(ExecState*) KJS_FAST_CALL;
     
    14251413  class ParameterNode : public Node {
    14261414  public:
    1427     // list pointer is tail of a circular list, cracked in the FuncDeclNode/FuncExprNode ctor
    1428     ParameterNode(const Identifier &i) KJS_FAST_CALL : id(i), next(this) { Parser::noteNodeCycle(this); }
    1429     ParameterNode(ParameterNode *next, const Identifier &i) KJS_FAST_CALL
    1430       : id(i), next(next->next) { next->next = this; }
     1415    ParameterNode(const Identifier& i) KJS_FAST_CALL : id(i) { }
     1416    ParameterNode(ParameterNode* l, const Identifier& i) KJS_FAST_CALL
     1417      : id(i) { l->next = this; }
    14311418    JSValue* evaluate(ExecState*) KJS_FAST_CALL;
    14321419    Identifier ident() KJS_FAST_CALL { return id; }
     
    14341421    virtual void streamTo(SourceStream&) const KJS_FAST_CALL;
    14351422    PassRefPtr<ParameterNode> releaseNext() KJS_FAST_CALL { return next.release(); }
    1436     virtual void breakCycle() KJS_FAST_CALL;
    14371423    virtual Precedence precedence() const { ASSERT_NOT_REACHED(); return PrecExpression; }
    14381424  private:
     
    14861472  class FuncExprNode : public Node {
    14871473  public:
    1488     FuncExprNode(const Identifier &i, FunctionBodyNode *b, ParameterNode *p = 0) KJS_FAST_CALL
    1489       : ident(i), param(p ? p->next.release() : 0), body(b) { if (p) { Parser::removeNodeCycle(param.get()); } addParams(); }
     1474    FuncExprNode(const Identifier& i, FunctionBodyNode* b, ParameterNode* p = 0) KJS_FAST_CALL
     1475      : ident(i), param(p), body(b) { addParams(); }
    14901476    virtual JSValue *evaluate(ExecState*) KJS_FAST_CALL;
    14911477    virtual void streamTo(SourceStream&) const KJS_FAST_CALL;
     
    15021488  class FuncDeclNode : public StatementNode {
    15031489  public:
    1504     FuncDeclNode(const Identifier &i, FunctionBodyNode *b) KJS_FAST_CALL
     1490    FuncDeclNode(const Identifier& i, FunctionBodyNode* b) KJS_FAST_CALL
    15051491      : ident(i), body(b) { addParams(); m_mayHaveDeclarations = true; }
    1506     FuncDeclNode(const Identifier &i, ParameterNode *p, FunctionBodyNode *b) KJS_FAST_CALL
    1507       : ident(i), param(p->next.release()), body(b) { Parser::removeNodeCycle(param.get()); addParams(); m_mayHaveDeclarations = true; }
     1492    FuncDeclNode(const Identifier& i, ParameterNode* p, FunctionBodyNode* b) KJS_FAST_CALL
     1493      : ident(i), param(p), body(b) { addParams(); m_mayHaveDeclarations = true; }
    15081494    virtual Completion execute(ExecState*) KJS_FAST_CALL;
    15091495    virtual void streamTo(SourceStream&) const KJS_FAST_CALL;
     
    15211507  public:
    15221508    static int count;
    1523     // list pointer is tail of a circular list, cracked in the BlockNode (or subclass) ctor
    15241509    SourceElementsNode(StatementNode*) KJS_FAST_CALL;
    1525     SourceElementsNode(SourceElementsNode *s1, StatementNode *s2) KJS_FAST_CALL;
     1510    SourceElementsNode(SourceElementsNode*, StatementNode*) KJS_FAST_CALL;
    15261511   
    15271512    virtual void optimizeVariableAccess(FunctionBodyNode*, DeclarationStacks::NodeStack&) KJS_FAST_CALL;
     
    15291514    virtual void streamTo(SourceStream&) const KJS_FAST_CALL;
    15301515    PassRefPtr<SourceElementsNode> releaseNext() KJS_FAST_CALL { return next.release(); }
    1531     virtual void breakCycle() KJS_FAST_CALL;
    15321516    virtual void getDeclarations(DeclarationStacks&) KJS_FAST_CALL;
    15331517  private:
     
    15421526      CaseClauseNode(Node *e) KJS_FAST_CALL : expr(e) { m_mayHaveDeclarations = true; }
    15431527      CaseClauseNode(Node *e, SourceElementsNode *s) KJS_FAST_CALL
    1544       : expr(e), source(s->next.release()) { Parser::removeNodeCycle(source.get()); m_mayHaveDeclarations = true; }
     1528      : expr(e), source(s) { m_mayHaveDeclarations = true; }
    15451529      virtual void optimizeVariableAccess(FunctionBodyNode*, DeclarationStacks::NodeStack&) KJS_FAST_CALL;
    15461530      JSValue* evaluate(ExecState*) KJS_FAST_CALL;
     
    15561540  class ClauseListNode : public Node {
    15571541  public:
    1558       // list pointer is tail of a circular list, cracked in the CaseBlockNode ctor
    1559       ClauseListNode(CaseClauseNode *c) KJS_FAST_CALL : clause(c), next(this) { Parser::noteNodeCycle(this); m_mayHaveDeclarations = true; }
    1560       ClauseListNode(ClauseListNode *n, CaseClauseNode *c) KJS_FAST_CALL
    1561       : clause(c), next(n->next) { n->next = this; m_mayHaveDeclarations = true; }
     1542      ClauseListNode(CaseClauseNode* c) KJS_FAST_CALL : clause(c) { m_mayHaveDeclarations = true; }
     1543      ClauseListNode(ClauseListNode* n, CaseClauseNode* c) KJS_FAST_CALL
     1544      : clause(c) { n->next = this; m_mayHaveDeclarations = true; }
    15621545      virtual void optimizeVariableAccess(FunctionBodyNode*, DeclarationStacks::NodeStack&) KJS_FAST_CALL;
    15631546      JSValue* evaluate(ExecState*) KJS_FAST_CALL;
     
    15661549      virtual void streamTo(SourceStream&) const KJS_FAST_CALL;
    15671550      PassRefPtr<ClauseListNode> releaseNext() KJS_FAST_CALL { return next.release(); }
    1568       virtual void breakCycle() KJS_FAST_CALL;
    15691551      virtual void getDeclarations(DeclarationStacks&) KJS_FAST_CALL;
    15701552      virtual Precedence precedence() const { ASSERT_NOT_REACHED(); return PrecExpression; }
     
    15771559  class CaseBlockNode : public Node {
    15781560  public:
    1579       CaseBlockNode(ClauseListNode *l1, CaseClauseNode *d, ClauseListNode *l2) KJS_FAST_CALL;
     1561      CaseBlockNode(ClauseListNode* l1, CaseClauseNode* d, ClauseListNode* l2) KJS_FAST_CALL;
    15801562      virtual void optimizeVariableAccess(FunctionBodyNode*, DeclarationStacks::NodeStack&) KJS_FAST_CALL;
    15811563      JSValue* evaluate(ExecState*) KJS_FAST_CALL;
     
    16041586  class ProgramNode : public FunctionBodyNode {
    16051587  public:
    1606     ProgramNode(SourceElementsNode *s) KJS_FAST_CALL;
     1588    ProgramNode(SourceElementsNode* s) KJS_FAST_CALL;
    16071589  };
    16081590
Note: See TracChangeset for help on using the changeset viewer.