Changeset 44174 in webkit for trunk/JavaScriptCore


Ignore:
Timestamp:
May 26, 2009, 8:22:47 PM (16 years ago)
Author:
[email protected]
Message:

<rdar://problem/6924033> REGRESSION: Assertion failure due to forward references

Reviewed by Gavin Barraclough.

Add a pattern type for forward references to ensure that we don't confuse the
quantifier alternatives assertion.

Location:
trunk/JavaScriptCore
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/ChangeLog

    r44171 r44174  
     12009-05-26  Oliver Hunt  <[email protected]>
     2
     3        Reviewed by Gavin Barraclough.
     4
     5        <rdar://problem/6924033> REGRESSION: Assertion failure due to forward references
     6
     7        Add a pattern type for forward references to ensure that we don't confuse the
     8        quantifier alternatives assertion.
     9
     10        * yarr/RegexCompiler.cpp:
     11        (JSC::Yarr::RegexPatternConstructor::atomBackReference):
     12        (JSC::Yarr::RegexPatternConstructor::setupAlternativeOffsets):
     13        * yarr/RegexInterpreter.cpp:
     14        (JSC::Yarr::ByteCompiler::emitDisjunction):
     15        * yarr/RegexJIT.cpp:
     16        (JSC::Yarr::RegexGenerator::generateTerm):
     17        * yarr/RegexPattern.h:
     18        (JSC::Yarr::PatternTerm::):
     19        (JSC::Yarr::PatternTerm::PatternTerm):
     20        (JSC::Yarr::PatternTerm::ForwardReference):
     21
    1222009-05-26  Gavin Barraclough  <[email protected]>
    223
  • trunk/JavaScriptCore/yarr/RegexCompiler.cpp

    r43110 r44174  
    472472        m_pattern.m_maxBackReference = std::max(m_pattern.m_maxBackReference, subpatternId);
    473473
    474         if (subpatternId > m_pattern.m_numSubpatterns)
     474        if (subpatternId > m_pattern.m_numSubpatterns) {
     475            m_alternative->m_terms.append(PatternTerm::ForwardReference());
    475476            return;
     477        }
    476478
    477479        PatternAlternative* currentAlternative = m_alternative;
     
    483485            ASSERT((term.type == PatternTerm::TypeParenthesesSubpattern) || (term.type == PatternTerm::TypeParentheticalAssertion));
    484486
    485             if ((term.type == PatternTerm::TypeParenthesesSubpattern) && term.invertOrCapture && (subpatternId == term.subpatternId))
     487            if ((term.type == PatternTerm::TypeParenthesesSubpattern) && term.invertOrCapture && (subpatternId == term.subpatternId)) {
     488                m_alternative->m_terms.append(PatternTerm::ForwardReference());
    486489                return;
     490            }
    487491        }
    488492
     
    593597                currentCallFrameSize += RegexStackSpaceForBackTrackInfoBackReference;
    594598                alternative->m_hasFixedSize = false;
     599                break;
     600
     601            case PatternTerm::TypeForwardReference:
    595602                break;
    596603
  • trunk/JavaScriptCore/yarr/RegexInterpreter.cpp

    r43901 r44174  
    15561556                case PatternTerm::TypeBackReference:
    15571557                    atomBackReference(term.subpatternId, term.inputPosition - currentCountAlreadyChecked, term.frameLocation, term.quantityCount, term.quantityType);
     1558                        break;
     1559
     1560                case PatternTerm::TypeForwardReference:
    15581561                    break;
    15591562
  • trunk/JavaScriptCore/yarr/RegexJIT.cpp

    r44030 r44174  
    10721072            break;
    10731073
     1074        case PatternTerm::TypeForwardReference:
     1075            break;
     1076
    10741077        case PatternTerm::TypeParenthesesSubpattern:
    10751078            if ((term.quantityCount == 1) && !term.parentheses.isCopy)
  • trunk/JavaScriptCore/yarr/RegexPattern.h

    r44169 r44174  
    7979        TypeCharacterClass,
    8080        TypeBackReference,
     81        TypeForwardReference,
    8182        TypeParenthesesSubpattern,
    8283        TypeParentheticalAssertion,
     
    144145    }
    145146
     147    static PatternTerm ForwardReference()
     148    {
     149        return PatternTerm(TypeForwardReference);
     150    }
     151
    146152    static PatternTerm BOL()
    147153    {
Note: See TracChangeset for help on using the changeset viewer.