Ignore:
Timestamp:
Jul 23, 2008, 5:49:46 PM (17 years ago)
Author:
[email protected]
Message:

Improve switch performance.

Reviewed by Geoff Garen and Sam Weinig.

Improve switch performance by converting to a hashmap based jump
table to avoid the sequence of dispatches that would otherwise be
needed. This results in a 9-19x performance win for string switches
based on ad hoc testing, and a 6x improvement for integer switch
statements. SunSpider reports a 1.2% progression.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/VM/CodeGenerator.h

    r35245 r35309  
    314314        JumpContext* jumpContextForBreak(const Identifier&);
    315315
     316        void beginSwitch(RegisterID*, SwitchInfo::SwitchType);
     317        void endSwitch(uint32_t clauseCount, RefPtr<LabelID>*, ExpressionNode**, LabelID* defaultLabel, int32_t min, int32_t range);
     318
    316319        CodeType codeType() const { return m_codeType; }
    317320
     
    402405        int m_continueDepth;
    403406        Vector<ControlFlowContext> m_scopeContextStack;
     407        Vector<SwitchInfo> m_switchContextStack;
    404408
    405409        int m_nextVar;
Note: See TracChangeset for help on using the changeset viewer.