| 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_; }
|
|
|