Ignore:
Timestamp:
Oct 28, 2009, 6:25:02 PM (16 years ago)
Author:
[email protected]
Message:

Improve for..in enumeration performance
https://bugs.webkit.org/show_bug.cgi?id=30887

Reviewed by Geoff Garen.

Improve indexing of an object with a for..in iterator by
identifying cases where get_by_val is being used with a iterator
as the subscript and replace it with a new get_by_pname
bytecode. get_by_pname then optimizes lookups that directly access
the base object.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/bytecompiler/BytecodeGenerator.h

    r49734 r50254  
    6262    };
    6363
     64    struct ForInContext {
     65        RefPtr<RegisterID> expectedSubscriptRegister;
     66        RefPtr<RegisterID> iterRegister;
     67        RefPtr<RegisterID> indexRegister;
     68        RefPtr<RegisterID> propertyRegister;
     69    };
     70
    6471    class BytecodeGenerator : public FastAllocBase {
    6572    public:
     
    332339        void popFinallyContext();
    333340
     341        void pushOptimisedForIn(RegisterID* expectedBase, RegisterID* iter, RegisterID* index, RegisterID* propertyRegister)
     342        {
     343            ForInContext context = { expectedBase, iter, index, propertyRegister };
     344            m_forInContextStack.append(context);
     345        }
     346
     347        void popOptimisedForIn()
     348        {
     349            m_forInContextStack.removeLast();
     350        }
     351
    334352        LabelScope* breakTarget(const Identifier&);
    335353        LabelScope* continueTarget(const Identifier&);
     
    468486        Vector<ControlFlowContext> m_scopeContextStack;
    469487        Vector<SwitchInfo> m_switchContextStack;
     488        Vector<ForInContext> m_forInContextStack;
    470489
    471490        int m_nextGlobalIndex;
Note: See TracChangeset for help on using the changeset viewer.