Changeset 43144 in webkit for trunk/JavaScriptCore/parser/Lexer.h


Ignore:
Timestamp:
May 2, 2009, 4:33:56 AM (16 years ago)
Author:
[email protected]
Message:

2009-05-02 Maciej Stachowiak <[email protected]>

Reviewed by Cameron Zwarich.

  • speed up the lexer in various ways

~2% command-line SunSpider speedup

  • parser/Lexer.cpp: (JSC::Lexer::setCode): Moved below shift() so it can inline. (JSC::Lexer::scanRegExp): Use resize(0) instead of clear() on Vectors, since the intent here is not to free the underlying buffer. (JSC::Lexer::lex): ditto; also, change the loop logic a bit for the main lexing loop to avoid branching on !m_done twice per iteration. Now we only check it once. (JSC::Lexer::shift): Make this ALWAYS_INLINE and tag an unusual branch as UNLIKELY
  • parser/Lexer.h: (JSC::Lexer::makeIdentifier): force to be ALWAYS_INLINE
  • wtf/Vector.h: (WTF::::append): force to be ALWAYS_INLINE (may have helped in ways other than parsing but it wasn't getting inlined in a hot code path in the lexer)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/parser/Lexer.h

    r41045 r43144  
    124124        void record16(UChar);
    125125
    126         JSC::Identifier* makeIdentifier(const Vector<UChar>& buffer)
     126        ALWAYS_INLINE JSC::Identifier* makeIdentifier(const Vector<UChar>& buffer)
    127127        {
    128128            m_identifiers.append(JSC::Identifier(m_globalData, buffer.data(), buffer.size()));
Note: See TracChangeset for help on using the changeset viewer.