Ignore:
Timestamp:
Apr 14, 2010, 2:38:44 PM (15 years ago)
Author:
[email protected]
Message:

2010-04-14 Peter Varga <[email protected]>

Reviewed by Geoffrey Garen.

Move the YARR JIT fallback detection from RegexJIT.cpp to
RegexCompiler.cpp.

https://bugs.webkit.org/show_bug.cgi?id=37571

  • yarr/RegexCompiler.cpp: (JSC::Yarr::RegexPatternConstructor::atomBackReference): (JSC::Yarr::RegexPatternConstructor::quantifyAtom):
  • yarr/RegexJIT.cpp: (JSC::Yarr::RegexGenerator::generateTerm): (JSC::Yarr::RegexGenerator::RegexGenerator): (JSC::Yarr::jitCompileRegex):
  • yarr/RegexJIT.h: (JSC::Yarr::RegexCodeBlock::operator!):
  • yarr/RegexPattern.h: (JSC::Yarr::RegexPattern::RegexPattern): (JSC::Yarr::RegexPattern::reset):
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/yarr/RegexJIT.cpp

    r55500 r57608  
    10891089
    10901090        case PatternTerm::TypeBackReference:
    1091             m_generationFailed = true;
     1091            ASSERT_NOT_REACHED();
    10921092            break;
    10931093
     
    10961096
    10971097        case PatternTerm::TypeParenthesesSubpattern:
    1098             if ((term.quantityCount == 1) && !term.parentheses.isCopy)
    1099                 generateParenthesesSingle(state);
    1100             else
    1101                 m_generationFailed = true;
     1098            ASSERT((term.quantityCount == 1) && !term.parentheses.isCopy); // must fallback to pcre before this point
     1099            generateParenthesesSingle(state);
    11021100            break;
    11031101
     
    13521350    RegexGenerator(RegexPattern& pattern)
    13531351        : m_pattern(pattern)
    1354         , m_generationFailed(false)
    13551352    {
    13561353    }
     
    13821379    }
    13831380
    1384     bool generationFailed()
    1385     {
    1386         return m_generationFailed;
    1387     }
    1388 
    13891381private:
    13901382    RegexPattern& m_pattern;
    13911383    Vector<AlternativeBacktrackRecord> m_backtrackRecords;
    1392     bool m_generationFailed;
    13931384};
    13941385
     
    14021393    numSubpatterns = pattern.m_numSubpatterns;
    14031394
    1404     RegexGenerator generator(pattern);
    1405     generator.compile(globalData, jitObject);
    1406 
    1407     if (generator.generationFailed()) {
     1395    if (pattern.m_shouldFallBack) {
    14081396        JSRegExpIgnoreCaseOption ignoreCaseOption = ignoreCase ? JSRegExpIgnoreCase : JSRegExpDoNotIgnoreCase;
    14091397        JSRegExpMultilineOption multilineOption = multiline ? JSRegExpMultiline : JSRegExpSingleLine;
    14101398        jitObject.setFallback(jsRegExpCompile(reinterpret_cast<const UChar*>(patternString.data()), patternString.size(), ignoreCaseOption, multilineOption, &numSubpatterns, &error));
     1399    } else {
     1400        RegexGenerator generator(pattern);
     1401        generator.compile(globalData, jitObject);
    14111402    }
    14121403}
Note: See TracChangeset for help on using the changeset viewer.