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


Ignore:
Timestamp:
Oct 25, 2007, 12:09:44 AM (18 years ago)
Author:
ggaren
Message:

JavaScriptCore:

Reviewed by Maciej Stachowiak.


Fixed http://bugs.webkit.org/show_bug.cgi?id=15683
Re-order declaration initialization to avoid calling hasProperty inside
VarDeclNode::processDeclaration


.7% speedup on SunSpider.

  • kjs/function.h:
  • kjs/function.cpp: Merged parameter processing into FunctionBodyNode's other processing of declared symbols, so the order of execution could change.
  • kjs/nodes.cpp: (KJS::VarDeclNode::getDeclarations): Added special case for the "arguments" property name, explained in the comment.

(KJS::VarDeclNode::processDeclaration): Removed call to hasProperty
in the case of function code, since we know the declared symbol
management will resolve conflicts between symbols. Yay!

(KJS::VarDeclListNode::getDeclarations): Now that VarDeclNode's
implementation of getDeclarations is non-trivial, we can't take a
short-cut here any longer -- we need to put the VarDecl node on the
stack so it gets processed normally.

(KJS::FunctionBodyNode::processDeclarations): Changed the order of
processing to enforce mutual exclusion rules.

  • kjs/nodes.h: (KJS::DeclarationStacks::DeclarationStacks): Structure includes an ExecState now, for fast access to the "arguments" property name.

LayoutTests:

Layout tests for bugs that might result from changes like
http://bugs.webkit.org/show_bug.cgi?id=15683

  • fast/js/vardecl-preserve-parameters-expected.txt: Added.
  • fast/js/vardecl-preserve-parameters.html: Added.
  • fast/js/vardecl-preserve-vardecl-expected.txt: Added.
  • fast/js/vardecl-preserve-vardecl.html: Added.
File:
1 edited

Legend:

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

    r26960 r27025  
    8989      typedef Vector<FuncDeclNode*, 16> FunctionStack;
    9090     
    91       DeclarationStacks(NodeStack& n, VarStack& v, FunctionStack& f)
    92         : nodeStack(n)
     91      DeclarationStacks(ExecState* e, NodeStack& n, VarStack& v, FunctionStack& f)
     92        : exec(e)
     93        , nodeStack(n)
    9394        , varStack(v)
    9495        , functionStack(f)
    9596      {
    9697      }
    97        
     98
     99      ExecState* exec;
    98100      NodeStack& nodeStack;
    99101      VarStack& varStack;
     
    12441246    UString m_sourceURL;
    12451247    int m_sourceId;
    1246     Vector<Identifier> m_parameters;
    1247 
    1248     void initializeDeclarationStacks();
     1248
     1249    void initializeDeclarationStacks(ExecState*);
    12491250    bool m_initializedDeclarationStacks;
     1251
    12501252    DeclarationStacks::VarStack m_varStack;
    12511253    DeclarationStacks::FunctionStack m_functionStack;
     1254    Vector<Identifier> m_parameters;
    12521255  };
    12531256
Note: See TracChangeset for help on using the changeset viewer.