Ignore:
Timestamp:
May 26, 2010, 11:25:56 PM (15 years ago)
Author:
[email protected]
Message:

Bug 39795 - Add support for YARR JIT generation of greedy quantified parens at the end of the main disjunction.
(relanding r60267)

Reviewed by Oliver Hunt.

If the last item in a main disjunction is a quantified set of parentheses,
this is easier to code generate for than the general case for quantified
parentheses. This is because we never need to backtrack into the parentheses

  • the first match will be the final and accepted match.

This patch also somewhat reverts a recent change to when fallback to PCRE
occurs. At the minute the compiler is tracking on patterns which will
require JIT fallback. This is handy from a performance perspective (it saves
the failed attempt at JIT compilation), but it means introducing knowledge
of the JITs capabilities into the other layers of the regex compilers. For
the specific feature of back-references, add a flag tracking their presence
on the pattern, and make these expressions fallback without attempting to
JIT. For parentheses, return to detecting which cases are have or have not
been handled during JIT compilation.

18% progression on tagcloud, ~1.5% overall on sunspidey.

  • yarr/RegexCompiler.cpp:

(JSC::Yarr::RegexPatternConstructor::atomBackReference):
(JSC::Yarr::RegexPatternConstructor::quantifyAtom):

  • yarr/RegexJIT.cpp:

(JSC::Yarr::RegexGenerator::TermGenerationState::isLastTerm):
(JSC::Yarr::RegexGenerator::TermGenerationState::isMainDisjunction):
(JSC::Yarr::RegexGenerator::generateParenthesesGreedyNoBacktrack):
(JSC::Yarr::RegexGenerator::generateTerm):
(JSC::Yarr::RegexGenerator::RegexGenerator):
(JSC::Yarr::RegexGenerator::shouldFallBack):
(JSC::Yarr::jitCompileRegex):

  • yarr/RegexPattern.h:

(JSC::Yarr::RegexPattern::RegexPattern):
(JSC::Yarr::RegexPattern::reset):

File:
1 edited

Legend:

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

    r60271 r60273  
    272272        , m_numSubpatterns(0)
    273273        , m_maxBackReference(0)
    274         , m_shouldFallBack(false)
     274        , m_containsBackreferences(false)
    275275        , newlineCached(0)
    276276        , digitsCached(0)
     
    294294        m_maxBackReference = 0;
    295295
    296         m_shouldFallBack = false;
     296        m_containsBackreferences = false;
    297297
    298298        newlineCached = 0;
     
    362362    unsigned m_numSubpatterns;
    363363    unsigned m_maxBackReference;
    364     bool m_shouldFallBack;
     364    bool m_containsBackreferences;
    365365    PatternDisjunction* m_body;
    366366    Vector<PatternDisjunction*, 4> m_disjunctions;
Note: See TracChangeset for help on using the changeset viewer.