summaryrefslogtreecommitdiffstats
path: root/Source/JavaScriptCore/yarr
diff options
context:
space:
mode:
authorBen Murdoch <benm@google.com>2011-05-24 11:24:40 +0100
committerBen Murdoch <benm@google.com>2011-06-02 09:53:15 +0100
commit81bc750723a18f21cd17d1b173cd2a4dda9cea6e (patch)
tree7a9e5ed86ff429fd347a25153107221543909b19 /Source/JavaScriptCore/yarr
parent94088a6d336c1dd80a1e734af51e96abcbb689a7 (diff)
downloadexternal_webkit-81bc750723a18f21cd17d1b173cd2a4dda9cea6e.zip
external_webkit-81bc750723a18f21cd17d1b173cd2a4dda9cea6e.tar.gz
external_webkit-81bc750723a18f21cd17d1b173cd2a4dda9cea6e.tar.bz2
Merge WebKit at r80534: Intial merge by Git
Change-Id: Ia7a83357124c9e1cdb1debf55d9661ec0bd09a61
Diffstat (limited to 'Source/JavaScriptCore/yarr')
-rw-r--r--Source/JavaScriptCore/yarr/YarrPattern.cpp26
1 files changed, 10 insertions, 16 deletions
diff --git a/Source/JavaScriptCore/yarr/YarrPattern.cpp b/Source/JavaScriptCore/yarr/YarrPattern.cpp
index 3d6dbd3..5913f7e 100644
--- a/Source/JavaScriptCore/yarr/YarrPattern.cpp
+++ b/Source/JavaScriptCore/yarr/YarrPattern.cpp
@@ -495,7 +495,9 @@ public:
for (unsigned i = 0; i < numParenAlternatives; i++) {
if (!parenthesesDisjunction->m_alternatives[i]->m_terms.size() && numParenAlternatives > 1) {
+ PatternAlternative* altToRemove = parenthesesDisjunction->m_alternatives[i];
parenthesesDisjunction->m_alternatives.remove(i);
+ delete altToRemove;
--numParenAlternatives;
containsEmptyAlternative = true;
@@ -812,20 +814,6 @@ public:
}
}
- bool addBeginTerm(PatternTerm term, Vector<TermChain>* beginTerms, PatternAlternative* alternative, unsigned numTerms, unsigned termIndex, unsigned depth)
- {
- if (term.quantityType == QuantifierFixedCount) {
- beginTerms->append(TermChain(term));
- if (depth < 2 && termIndex < numTerms - 1 && term.quantityCount == 1)
- setupAlternativeBeginTerms(alternative, &beginTerms->last().hotTerms, termIndex + 1, depth + 1);
- } else if (termIndex != numTerms - 1) {
- beginTerms->append(TermChain(term));
- return true;
- }
-
- return false;
- }
-
// This function collects the terms which are potentially matching the first number of depth characters in the result.
// If this function returns false then it found at least one term which makes the beginning character
// look-up optimization inefficient.
@@ -861,10 +849,17 @@ public:
return false;
case PatternTerm::TypePatternCharacter:
- if (addBeginTerm(term, beginTerms, alternative, numTerms, termIndex, depth)) {
+ if (termIndex != numTerms - 1) {
+ beginTerms->append(TermChain(term));
termIndex++;
checkNext = true;
+ } else if (term.quantityType == QuantifierFixedCount) {
+ beginTerms->append(TermChain(term));
+ if (depth < 2 && termIndex < numTerms - 1 && term.quantityCount == 1)
+ if (!setupAlternativeBeginTerms(alternative, &beginTerms->last().hotTerms, termIndex + 1, depth + 1))
+ return false;
}
+
break;
case PatternTerm::TypeCharacterClass:
@@ -881,7 +876,6 @@ public:
termIndex++;
checkNext = true;
-
}
if (!setupDisjunctionBeginTerms(term.parentheses.disjunction, beginTerms, depth))