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


Ignore:
Timestamp:
Sep 22, 2008, 10:22:22 PM (17 years ago)
Author:
Darin Adler
Message:

2008-09-22 Darin Adler <Darin Adler>

Reviewed by Sam Weinig.

Speeds up v8-raytrace by 7.2%.

  • kjs/nodes.cpp: (JSC::FunctionBodyNode::FunctionBodyNode): Initialize m_refCount to 0.
  • kjs/nodes.h: (JSC::FunctionBodyNode::ref): Call base class ref once, and thereafter use m_refCount. (JSC::FunctionBodyNode::deref): Ditto, but the deref side.
File:
1 edited

Legend:

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

    r36660 r36794  
    22702270        void setSource(const SourceRange& source) { m_source = source; }
    22712271        UString toSourceString() const JSC_FAST_CALL { return UString("{") + m_source.toString() + UString("}"); }
     2272
     2273        // These objects are ref/deref'd a lot in the scope chain, so this is a faster ref/deref.
     2274        // If the virtual machine changes so this doesn't happen as much we can change back.
     2275        void ref()
     2276        {
     2277            if (++m_refCount == 1)
     2278                ScopeNode::ref();
     2279        }
     2280        void deref()
     2281        {
     2282            ASSERT(m_refCount);
     2283            if (!--m_refCount)
     2284                ScopeNode::deref();
     2285        }
     2286
    22722287    protected:
    22732288        FunctionBodyNode(JSGlobalData*, SourceElements*, VarStack*, FunctionStack*, bool usesEval, bool needsClosure, int numConstants) JSC_FAST_CALL;
     
    22802295        OwnPtr<CodeBlock> m_code;
    22812296        SourceRange m_source;
     2297        unsigned m_refCount;
    22822298    };
    22832299
Note: See TracChangeset for help on using the changeset viewer.