Ignore:
Timestamp:
Nov 17, 2010, 3:03:40 AM (15 years ago)
Author:
Csaba Osztrogonác
Message:

Extend YARR Interpreter with beginning character look-up optimization
https://bugs.webkit.org/show_bug.cgi?id=45751

Patch by Peter Varga <[email protected]> on 2010-11-17
Reviewed by Gavin Barraclough.

Add beginning character look-up optimization which sets the start
index to the first possible successful pattern match.
Extend YARR Interpreter with lookupForBeginChars function which
implements the beginning character look-up optimization.

  • yarr/RegexInterpreter.cpp:

(JSC::Yarr::Interpreter::InputStream::readPair):
(JSC::Yarr::Interpreter::InputStream::isNotAvailableInput):
(JSC::Yarr::Interpreter::lookupForBeginChars):
(JSC::Yarr::Interpreter::matchDisjunction):
(JSC::Yarr::Interpreter::interpret):

  • yarr/RegexInterpreter.h:

(JSC::Yarr::BytecodePattern::BytecodePattern):

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/yarr/RegexInterpreter.h

    r72140 r72186  
    325325        , m_ignoreCase(pattern.m_ignoreCase)
    326326        , m_multiline(pattern.m_multiline)
     327        , m_containsBeginChars(pattern.m_containsBeginChars)
    327328        , m_allocator(allocator)
    328329    {
     
    336337        // take responsibility for that.
    337338        pattern.m_userCharacterClasses.clear();
     339
     340        m_beginChars.append(pattern.m_beginChars);
    338341    }
    339342
     
    347350    bool m_ignoreCase;
    348351    bool m_multiline;
     352    bool m_containsBeginChars;
    349353    // Each BytecodePattern is associated with a RegExp, each RegExp is associated
    350354    // with a JSGlobalData.  Cache a pointer to out JSGlobalData's m_regexAllocator.
     
    353357    CharacterClass* newlineCharacterClass;
    354358    CharacterClass* wordcharCharacterClass;
     359
     360    Vector<BeginChar> m_beginChars;
     361
    355362private:
    356363    Vector<ByteDisjunction*> m_allParenthesesInfo;
Note: See TracChangeset for help on using the changeset viewer.