Changeset 29065 in webkit for trunk/JavaScriptCore/kjs/object.h


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/object.h

    r28884 r29065  
    593593}
    594594
    595 inline void ScopeChain::release()
    596 {
    597     // This function is only called by deref(),
    598     // Deref ensures these conditions are true.
    599     ASSERT(_node && _node->refCount == 0);
    600     ScopeChainNode *n = _node;
    601     do {
    602         ScopeChainNode *next = n->next;
    603         delete n;
    604         n = next;
    605     } while (n && --n->refCount == 0);
    606 }
    607 
    608595inline JSValue* JSObject::toPrimitive(ExecState* exec, JSType preferredType) const
    609596{
Note: See TracChangeset for help on using the changeset viewer.