Ignore:
Timestamp:
Jan 1, 2008, 11:13:40 AM (17 years ago)
Author:
Darin Adler
Message:

Reviewed by Geoff.

This gives a 1.019x speedup on SunSpider.

After doing this, I realized this probably will be obsolete when the optimization
to avoid creating an activation object is done. When we do that one we should check
if rolling this out will speed things up, since this does add overhead at the time
you copy the scope chain.

  • kjs/object.h: Removed the ScopeChain::release function. It was marked inline, and called in exactly one place, so moved it there. No idea why it was in this header file!
  • kjs/scope_chain.cpp: Removed the overload of the ScopeChain::push function that takes another ScopeChain. It was unused. I think we used it over in WebCore at one point, but not any more.
  • kjs/scope_chain.h: Changed ScopeChainNode into a struct rather than a class, got rid of its constructor so we can have one that's uninitialized, and moved the refCount into a derived struct, ScopeChainHeapNode. Made _node mutable so it can be changed in the moveToHeap function. Changed the copy constructor and assignment operator to call moveToHeap, since the top node can't be shared when it's embedded in another ScopeChain object. Updated functions as needed to handle the case where the first object isn't on the heap or to add casts for cases where it's guaranteed to be. Changed the push function to always put the new node into the ScopeChain object; it will get put onto the heap when needed later.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/kjs/scope_chain.cpp

    r28079 r29065  
    2828namespace KJS {
    2929
    30 void ScopeChain::push(const ScopeChain &c)
    31 {
    32     ScopeChainNode **tail = &_node;
    33     for (ScopeChainNode *n = c._node; n; n = n->next) {
    34         ScopeChainNode *newNode = new ScopeChainNode(*tail, n->object);
    35         *tail = newNode;
    36         tail = &newNode->next;
    37     }
    38 }
    39 
    4030#ifndef NDEBUG
    4131
Note: See TracChangeset for help on using the changeset viewer.