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


Ignore:
Timestamp:
Dec 10, 2007, 9:47:41 PM (17 years ago)
Author:
[email protected]
Message:

JavaScriptCore:

Reviewed by Sam Weinig.

Split this:


FunctionBodyNode


|

ProgramNode


into this:


ScopeNode


| | |

FunctionBodyNode ProgramNode EvalNode

in preparation for specializing each class more while optimizing global
variable access.


Also removed some cruft from the FunctionBodyNode interface to simplify
things.


SunSpider says this patch is a .8% speedup, which seems reasonable,
since it eliminates a few branches and adds KJS_FAST_CALL in a few
places.


Layout tests and JS tests pass. Also, this baby builds on Windows! (Qt
mileage may vary...)

WebCore:

Reviewed by Sam Weinig.

Updated for rename in JavaScriptCore.

  • bridge/mac/WebCoreScriptDebugger.mm: (-[WebCoreScriptCallFrame scopeChain]): (-[WebCoreScriptCallFrame functionName]): (-[WebCoreScriptCallFrame evaluateWebScript:]):

WebKit/win:

Reviewed by Sam Weinig.

Updated for rename in JavaScriptCore.

  • WebScriptCallFrame.cpp: (WebScriptCallFrame::functionName): (WebScriptCallFrame::valueByEvaluatingJavaScriptFromString):
File:
1 edited

Legend:

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

    r28551 r28608  
    19501950  };
    19511951
    1952   // inherited by ProgramNode
    1953   class FunctionBodyNode : public BlockNode {
    1954   public:
    1955     FunctionBodyNode(SourceElements* children) KJS_FAST_CALL;
     1952  class ScopeNode : public BlockNode {
     1953  public:
     1954    ScopeNode(SourceElements*) KJS_FAST_CALL;
     1955
    19561956    int sourceId() KJS_FAST_CALL { return m_sourceId; }
    19571957    const UString& sourceURL() KJS_FAST_CALL { return m_sourceURL; }
    19581958
     1959  protected:
     1960    void initializeDeclarationStacks(ExecState*) KJS_FAST_CALL;
     1961
     1962    DeclarationStacks::VarStack m_varStack;
     1963    DeclarationStacks::FunctionStack m_functionStack;
     1964
     1965  private:
     1966    UString m_sourceURL;
     1967    int m_sourceId;
     1968  };
     1969
     1970  class ProgramNode : public ScopeNode {
     1971  public:
     1972    ProgramNode(SourceElements*) KJS_FAST_CALL;
    19591973    virtual Completion execute(ExecState*) KJS_FAST_CALL;
    19601974   
    1961     SymbolTable& symbolTable() { return m_symbolTable; }
    1962 
    1963     void addParam(const Identifier& ident) KJS_FAST_CALL;
    1964     size_t numParams() const KJS_FAST_CALL { return m_parameters.size(); }
    1965     Identifier paramName(size_t pos) const KJS_FAST_CALL { return m_parameters[pos]; }
     1975  private:
     1976    ALWAYS_INLINE void processDeclarations(ExecState*) KJS_FAST_CALL;
     1977  };
     1978
     1979  class EvalNode : public ScopeNode {
     1980  public:
     1981    EvalNode(SourceElements*) KJS_FAST_CALL;
     1982    virtual Completion execute(ExecState*) KJS_FAST_CALL;
     1983   
     1984  private:
     1985    ALWAYS_INLINE void processDeclarations(ExecState*) KJS_FAST_CALL;
     1986  };
     1987
     1988  class FunctionBodyNode : public ScopeNode {
     1989  public:
     1990    FunctionBodyNode(SourceElements*) KJS_FAST_CALL;
     1991
     1992    virtual Completion execute(ExecState*) KJS_FAST_CALL;
     1993
     1994    SymbolTable& symbolTable() KJS_FAST_CALL { return m_symbolTable; }
     1995
     1996    Vector<Identifier>& parameters() KJS_FAST_CALL { return m_parameters; }
    19661997    UString paramString() const KJS_FAST_CALL;
    1967     Vector<Identifier>& parameters() KJS_FAST_CALL { return m_parameters; }
    1968     ALWAYS_INLINE void processDeclarations(ExecState*);
    1969     ALWAYS_INLINE void processDeclarationsForFunctionCode(ExecState*);
    1970     ALWAYS_INLINE void processDeclarationsForProgramCode(ExecState*);
    1971   private:
    1972     UString m_sourceURL;
    1973     int m_sourceId;
    1974 
    1975     void initializeDeclarationStacks(ExecState*);
    1976     bool m_initializedDeclarationStacks;
    1977 
    1978     void initializeSymbolTable();
    1979     bool m_initializedSymbolTable;
    1980    
    1981     void optimizeVariableAccess();
    1982     bool m_optimizedResolveNodes;
    1983    
    1984     // Properties that will go into the ActivationImp's local storage. (Used for initializing the ActivationImp.)
    1985     DeclarationStacks::VarStack m_varStack;
    1986     DeclarationStacks::FunctionStack m_functionStack;
     1998
     1999  private:
     2000    void initializeSymbolTable() KJS_FAST_CALL;
     2001    void optimizeVariableAccess() KJS_FAST_CALL;
     2002    ALWAYS_INLINE void processDeclarations(ExecState*) KJS_FAST_CALL;
     2003
     2004    bool m_initialized;
    19872005    Vector<Identifier> m_parameters;
    1988 
    1989     // Mapping from property name -> local storage index. (Used once to transform the AST, and subsequently for residual slow case lookups.)
    19902006    SymbolTable m_symbolTable;
    19912007  };
    19922008
    1993     class FuncExprNode : public ExpressionNode {
     2009  class FuncExprNode : public ExpressionNode {
    19942010  public:
    19952011    FuncExprNode(const Identifier& i, FunctionBodyNode* b, ParameterNode* p = 0) KJS_FAST_CALL
     
    20862102  };
    20872103 
    2088   class ProgramNode : public FunctionBodyNode {
    2089   public:
    2090     ProgramNode(SourceElements* children) KJS_FAST_CALL;
    2091   };
    2092 
    20932104  struct ElementList {
    20942105      ElementNode* head;
Note: See TracChangeset for help on using the changeset viewer.