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


Ignore:
Timestamp:
Apr 22, 2007, 9:16:42 PM (18 years ago)
Author:
mjs
Message:

Reviewed by Darin.


Based an idea by Christopher E. Hyde <[email protected]>. His patch to do
this also had many other List changes and I found this much simpler subset of the changes
was actually a hair faster.


This optimization is valid because the arguments list is only kept around to
lazily make the arguments object. If it's not made by the time the function
exits, it never will be, since any function that captures the continuation will
have its own local arguments variable in scope.


Besides the 1.7% speed improvement, it shrinks List by 4 bytes
(which in turn shrinks ActivationImp by 4 bytes).


  • kjs/Context.cpp: (KJS::Context::~Context): Clear the activation's arguments list.
  • kjs/function.cpp: (KJS::ActivationImp::ActivationImp): Adjusted for list changes. (KJS::ActivationImp::mark): No need to mark, lists are always protected (this doesn't cause a ref-cycle for reasons stated above). (KJS::ActivationImp::createArgumentsObject): Clear arguments list.
  • kjs/function.h:
  • kjs/list.cpp: (KJS::List::List): No more needsMarking boolean (KJS::List::operator=): ditto
  • kjs/list.h: (KJS::List::List): ditto (KJS::List::reset): ditto (KJS::List::deref): ditto
File:
1 edited

Legend:

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

    r17483 r21019  
    171171
    172172    bool isActivation() { return true; }
     173
     174    void releaseArguments() { _arguments.reset(); }
     175
    173176  private:
    174177    static PropertySlot::GetValueFunc getArgumentsGetter();
    175178    static JSValue* argumentsGetter(ExecState*, JSObject*, const Identifier&, const PropertySlot& slot);
    176     void createArgumentsObject(ExecState*) const;
     179    void createArgumentsObject(ExecState*);
    177180   
    178181    FunctionImp* _function;
Note: See TracChangeset for help on using the changeset viewer.