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

Unified Diff: src/jsregexp.cc

Issue 7170014: Avoid OOM on regexps with nested quantifiers. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 9 years, 6 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/ast.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/jsregexp.cc
===================================================================
--- src/jsregexp.cc (revision 8295)
+++ src/jsregexp.cc (working copy)
@@ -3766,7 +3766,9 @@
bool needs_capture_clearing = !capture_registers.is_empty();
if (body_can_be_empty) {
body_start_reg = compiler->AllocateRegister();
- } else if (FLAG_regexp_optimization && !needs_capture_clearing) {
+ } else if (FLAG_regexp_optimization &&
+ !body->ContainsExpandedQuantifier() &&
+ !needs_capture_clearing) {
// Only unroll if there are no captures and the body can't be
// empty.
if (min > 0 && min <= kMaxUnrolledMinMatches) {
@@ -3780,6 +3782,7 @@
for (int i = 0; i < min; i++) {
answer = body->ToNode(compiler, answer);
}
+ if (min > 1) body->set_contains_expanded_quantifier(true);
return answer;
}
if (max <= kMaxUnrolledMaxMatches) {
@@ -3800,6 +3803,7 @@
answer = alternation;
if (not_at_start) alternation->set_not_at_start();
}
+ if (max > 1) body->set_contains_expanded_quantifier(true);
return answer;
}
}
« no previous file with comments | « src/ast.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698