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

Unified Diff: src/jsregexp.h

Issue 10536002: Backport to 3.10 of r11696: Limit work done analyzing regexps with very large fanout. (Closed) Base URL: http://v8.googlecode.com/svn/branches/3.10/
Patch Set: Created 8 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 | « no previous file | src/jsregexp.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/jsregexp.h
===================================================================
--- src/jsregexp.h (revision 11709)
+++ src/jsregexp.h (working copy)
@@ -574,9 +574,12 @@
// Collects information on the possible code units (mod 128) that can match if
// we look forward. This is used for a Boyer-Moore-like string searching
// implementation. TODO(erikcorry): This should share more code with
- // EatsAtLeast, GetQuickCheckDetails.
+ // EatsAtLeast, GetQuickCheckDetails. The budget argument is used to limit
+ // the number of nodes we are willing to look at in order to create this data.
+ static const int kFillInBMBudget = 200;
virtual void FillInBMInfo(int offset,
int recursion_depth,
+ int budget,
BoyerMooreLookahead* bm,
bool not_at_start) {
UNREACHABLE();
@@ -679,9 +682,11 @@
virtual RegExpNode* FilterASCII(int depth);
virtual void FillInBMInfo(int offset,
int recursion_depth,
+ int budget,
BoyerMooreLookahead* bm,
bool not_at_start) {
- on_success_->FillInBMInfo(offset, recursion_depth + 1, bm, not_at_start);
+ on_success_->FillInBMInfo(
+ offset, recursion_depth + 1, budget - 1, bm, not_at_start);
if (offset == 0) set_bm_info(not_at_start, bm);
}
@@ -736,6 +741,7 @@
}
virtual void FillInBMInfo(int offset,
int recursion_depth,
+ int budget,
BoyerMooreLookahead* bm,
bool not_at_start);
Type type() { return type_; }
@@ -807,6 +813,7 @@
RegExpCompiler* compiler);
virtual void FillInBMInfo(int offset,
int recursion_depth,
+ int budget,
BoyerMooreLookahead* bm,
bool not_at_start);
void CalculateOffsets();
@@ -869,6 +876,7 @@
bool not_at_start);
virtual void FillInBMInfo(int offset,
int recursion_depth,
+ int budget,
BoyerMooreLookahead* bm,
bool not_at_start);
AssertionNodeType type() { return type_; }
@@ -909,6 +917,7 @@
}
virtual void FillInBMInfo(int offset,
int recursion_depth,
+ int budget,
BoyerMooreLookahead* bm,
bool not_at_start);
@@ -936,6 +945,7 @@
}
virtual void FillInBMInfo(int offset,
int recursion_depth,
+ int budget,
BoyerMooreLookahead* bm,
bool not_at_start) {
// Returning 0 from EatsAtLeast should ensure we never get here.
@@ -1028,6 +1038,7 @@
bool not_at_start);
virtual void FillInBMInfo(int offset,
int recursion_depth,
+ int budget,
BoyerMooreLookahead* bm,
bool not_at_start);
@@ -1080,10 +1091,11 @@
bool not_at_start);
virtual void FillInBMInfo(int offset,
int recursion_depth,
+ int budget,
BoyerMooreLookahead* bm,
bool not_at_start) {
alternatives_->at(1).node()->FillInBMInfo(
- offset, recursion_depth + 1, bm, not_at_start);
+ offset, recursion_depth + 1, budget - 1, bm, not_at_start);
if (offset == 0) set_bm_info(not_at_start, bm);
}
// For a negative lookahead we don't emit the quick check for the
@@ -1115,6 +1127,7 @@
bool not_at_start);
virtual void FillInBMInfo(int offset,
int recursion_depth,
+ int budget,
BoyerMooreLookahead* bm,
bool not_at_start);
RegExpNode* loop_node() { return loop_node_; }
« no previous file with comments | « no previous file | src/jsregexp.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698