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


Ignore:
Timestamp:
Oct 26, 2007, 3:43:03 PM (18 years ago)
Author:
ggaren
Message:

Reviewed by Maciej Stachowiak.


Switched ActivationImp to using a symbol table. For now, though, all
clients take the slow path.


Net .6% speedup on SunSpider.


Slowdowns:

  • ActivationImp now mallocs in its constructor
  • Local variable hits use an extra level of indirection to retrieve data
  • Local variable misses do two lookups

Speedups:

  • Fast initialization of local variables upon function entry


  • kjs/function.cpp: (KJS::ActivationImp::ActivationImp): Malloc a private structure to hold data that won't fit in a JSCell. (KJS::ActivationImp::argumentsGetter): Use slow symbol table path for lookup. (KJS::ActivationImp::getOwnPropertySlot): ditto (KJS::ActivationImp::deleteProperty): ditto (KJS::ActivationImp::put): ditto (KJS::ActivationImp::createArgumentsObject): ditto

(KJS::ActivationImp::mark): Call JSObject::mark first so that one of
our properties doesn't try to recursively mark us. (This caused a crash
in earlier testing. Not sure why we haven't run into it before.)

  • kjs/nodes.cpp: Functions now build a symbol table the first time they're called. (KJS::VarDeclNode::evaluate): (KJS::FunctionBodyNode::FunctionBodyNode): (KJS::FunctionBodyNode::initializeSymbolTable): (KJS::FunctionBodyNode::processDeclarations): (KJS::FunctionBodyNode::processDeclarationsForFunctionCode): (KJS::FunctionBodyNode::processDeclarationsForProgramCode):
  • kjs/nodes.h: (KJS::FunctionBodyNode::symbolTable):
  • wtf/Forward.h: Added Vector.
File:
1 edited

Legend:

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

    r27028 r27126  
    12351235
    12361236    virtual Completion execute(ExecState*) KJS_FAST_CALL;
     1237   
     1238    SymbolTable& symbolTable() { return m_symbolTable; }
    12371239
    12381240    void addParam(const Identifier& ident) KJS_FAST_CALL;
     
    12421244    Vector<Identifier>& parameters() KJS_FAST_CALL { return m_parameters; }
    12431245    ALWAYS_INLINE void processDeclarations(ExecState*);
    1244     ALWAYS_INLINE void processDeclarationsFunctionCode(ExecState*);
    1245     ALWAYS_INLINE void processDeclarationsProgramCode(ExecState*);
     1246    ALWAYS_INLINE void processDeclarationsForFunctionCode(ExecState*);
     1247    ALWAYS_INLINE void processDeclarationsForProgramCode(ExecState*);
    12461248  private:
    12471249    UString m_sourceURL;
     
    12511253    bool m_initializedDeclarationStacks;
    12521254
    1253     // Properties that will go into the ActivationImp's symbol table. (Used for initializing the ActivationImp.)
    1254     DeclarationStacks::VarStack m_varStack;
    1255     DeclarationStacks::FunctionStack m_functionStack;
    1256     Vector<Identifier> m_parameters;
     1255    void initializesymbolTable();
     1256    bool m_initializedSymbolTable;
     1257   
     1258    // Properties that will go into the ActivationImp's local storage. (Used for initializing the ActivationImp.)
     1259     DeclarationStacks::VarStack m_varStack;
     1260     DeclarationStacks::FunctionStack m_functionStack;
     1261     Vector<Identifier> m_parameters;
     1262
     1263    // Mapping from property name -> local storage index. (Used once to transform the AST, and subsequently for residual slow case lookups.)
     1264    SymbolTable m_symbolTable;
    12571265  };
    12581266
Note: See TracChangeset for help on using the changeset viewer.