Changeset 27199 in webkit for trunk/JavaScriptCore/kjs/function.h


Ignore:
Timestamp:
Oct 28, 2007, 7:00:57 PM (18 years ago)
Author:
ggaren
Message:

Reviewed by Maciej Stachowiak, Darin Adler.


Much supporting work done by Maciej Stachowiak, Maks Orlovich, and
Cameron Zwarich.


AST transfom to replace slow resolve nodes with fast local variable
alternatives that do direct memory access. Currently, only ResolveNode
provides a fast local variable alternative. 6 others are soon to come.


16.7% speedup on SunSpider.


Most of this patch is just scaffolding to support iterating all the
resolve nodes in the AST through optimizeResolveNodes(). In
optimizeResolveNodes(), most classes just push their child nodes onto
the processing stack, while ResolveNodes actually replace themselves in
the tree with more optimized alternatives, if possible.

Here are the interesting bits:

  • kjs/nodes.h: Added PlacementNewAdoptTag, along with implementations in Node and ResolveNode. This tag allows you to use placement new to swap out a base class Node in favor of a subclass copy that holds the same data. (Without this tag, default initialization would NULL out RefPtrs, change line numbers, etc.)
  • kjs/nodes.cpp: (KJS::ResolveNode::evaluate): Since we're taking the slow path, ASSERT that the fast path is impossible, to make sure we didn't leave anything on the table.

(KJS::FunctionBodyNode::optimizeResolveNodes): Here's where the AST
transformation happens.


(KJS::ResolveNode::optimizeResolveNodes): Here's where the ResolveNode
optimization happens.

  • kjs/function.h: Added symbolTable() accessor for, for the sake of an ASSERT.
File:
1 edited

Legend:

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

    r27191 r27199  
    188188    void releaseArguments() { d->arguments.reset(); }
    189189   
    190     LocalStorage& localStorage() { return d->localStorage; };
     190    LocalStorage& localStorage() { return d->localStorage; }
     191    SymbolTable& symbolTable() { return *m_symbolTable; }
    191192
    192193  private:
     
    196197   
    197198    OwnPtr<ActivationImpPrivate> d;
    198     SymbolTable* symbolTable;
     199    SymbolTable* m_symbolTable;
    199200  };
    200201
Note: See TracChangeset for help on using the changeset viewer.