Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(417)

Unified Diff: src/jsregexp.cc

Issue 10310041: Merged r11518, r11519 into trunk branch. (Closed) Base URL: https://v8.googlecode.com/svn/trunk
Patch Set: Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/ia32/ic-ia32.cc ('k') | src/mips/ic-mips.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/jsregexp.cc
diff --git a/src/jsregexp.cc b/src/jsregexp.cc
index 54f681856d70938464996b3618dea7095e7ebf98..3455abce2399b3030a172e10ce1e2eb463f43647 100644
--- a/src/jsregexp.cc
+++ b/src/jsregexp.cc
@@ -2722,8 +2722,8 @@ RegExpNode* ChoiceNode::FilterASCII(int depth) {
GuardedAlternative alternative = alternatives_->at(i);
RegExpNode* replacement = alternative.node()->FilterASCII(depth - 1);
ASSERT(replacement != this); // No missing EMPTY_MATCH_CHECK.
- alternatives_->at(i).set_node(replacement);
if (replacement != NULL) {
+ alternatives_->at(i).set_node(replacement);
surviving++;
survivor = replacement;
}
@@ -2739,9 +2739,11 @@ RegExpNode* ChoiceNode::FilterASCII(int depth) {
ZoneList<GuardedAlternative>* new_alternatives =
new ZoneList<GuardedAlternative>(surviving);
for (int i = 0; i < choice_count; i++) {
- GuardedAlternative alternative = alternatives_->at(i);
- if (alternative.node() != NULL) {
- new_alternatives->Add(alternative);
+ RegExpNode* replacement =
+ alternatives_->at(i).node()->FilterASCII(depth - 1);
+ if (replacement != NULL) {
+ alternatives_->at(i).set_node(replacement);
+ new_alternatives->Add(alternatives_->at(i));
}
}
alternatives_ = new_alternatives;
@@ -5832,7 +5834,12 @@ RegExpEngine::CompilationResult RegExpEngine::Compile(
node = loop_node;
}
}
- if (is_ascii) node = node->FilterASCII(RegExpCompiler::kMaxRecursion);
+ if (is_ascii) {
+ node = node->FilterASCII(RegExpCompiler::kMaxRecursion);
+ // Do it again to propagate the new nodes to places where they were not
+ // put because they had not been calculated yet.
+ if (node != NULL) node = node->FilterASCII(RegExpCompiler::kMaxRecursion);
+ }
if (node == NULL) node = new EndNode(EndNode::BACKTRACK);
data->node = node;
« no previous file with comments | « src/ia32/ic-ia32.cc ('k') | src/mips/ic-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698