From 2bde8e466a4451c7319e3a072d118917957d6554 Mon Sep 17 00:00:00 2001 From: Steve Block Date: Wed, 25 May 2011 19:08:45 +0100 Subject: Merge WebKit at r82507: Initial merge by git Change-Id: I60ce9d780725b58b45e54165733a8ffee23b683e --- Source/JavaScriptCore/yarr/YarrInterpreter.cpp | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'Source/JavaScriptCore/yarr/YarrInterpreter.cpp') diff --git a/Source/JavaScriptCore/yarr/YarrInterpreter.cpp b/Source/JavaScriptCore/yarr/YarrInterpreter.cpp index 37d44f7..d8c5d27 100644 --- a/Source/JavaScriptCore/yarr/YarrInterpreter.cpp +++ b/Source/JavaScriptCore/yarr/YarrInterpreter.cpp @@ -1234,6 +1234,10 @@ public: if (input.checkInput(currentTerm().checkInputCount)) MATCH_NEXT(); BACKTRACK(); + + case ByteTerm::TypeUncheckInput: + input.uncheckInput(currentTerm().checkInputCount); + MATCH_NEXT(); } // We should never fall-through to here. @@ -1354,6 +1358,10 @@ public: case ByteTerm::TypeCheckInput: input.uncheckInput(currentTerm().checkInputCount); BACKTRACK(); + + case ByteTerm::TypeUncheckInput: + input.checkInput(currentTerm().checkInputCount); + BACKTRACK(); } ASSERT_NOT_REACHED(); @@ -1453,6 +1461,11 @@ public: m_bodyDisjunction->terms.append(ByteTerm::CheckInput(count)); } + void uncheckInput(unsigned count) + { + m_bodyDisjunction->terms.append(ByteTerm::UncheckInput(count)); + } + void assertionBOL(int inputPosition) { m_bodyDisjunction->terms.append(ByteTerm::BOL(inputPosition)); @@ -1849,10 +1862,21 @@ public: ASSERT(currentCountAlreadyChecked >= static_cast(term.inputPosition)); int positiveInputOffset = currentCountAlreadyChecked - term.inputPosition; + int uncheckAmount = positiveInputOffset - term.parentheses.disjunction->m_minimumSize; + + if (uncheckAmount > 0) { + uncheckInput(uncheckAmount); + currentCountAlreadyChecked -= uncheckAmount; + } else + uncheckAmount = 0; atomParentheticalAssertionBegin(term.parentheses.subpatternId, term.invert(), term.frameLocation, alternativeFrameLocation); emitDisjunction(term.parentheses.disjunction, currentCountAlreadyChecked, positiveInputOffset, true); atomParentheticalAssertionEnd(0, term.frameLocation, term.quantityCount, term.quantityType); + if (uncheckAmount) { + checkInput(uncheckAmount); + currentCountAlreadyChecked += uncheckAmount; + } break; } } -- cgit v1.1