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

Unified Diff: src/jsregexp.cc

Issue 10380028: Limit recursion depth for gathering BoyerMoore info. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
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
Index: src/jsregexp.cc
diff --git a/src/jsregexp.cc b/src/jsregexp.cc
index 3455abce2399b3030a172e10ce1e2eb463f43647..cbfe18f4abed2d1ec310043adbd7b7e82072f2b6 100644
--- a/src/jsregexp.cc
+++ b/src/jsregexp.cc
@@ -997,7 +997,7 @@ RegExpEngine::CompilationResult RegExpCompiler::Assemble(
bool use_slow_safe_regexp_compiler = false;
if (heap->total_regexp_code_generated() >
- RegExpImpl::kRegWxpCompiledLimit &&
+ RegExpImpl::kRegExpCompiledLimit &&
heap->isolate()->memory_allocator()->SizeExecutable() >
RegExpImpl::kRegExpExecutableMemoryLimit) {
use_slow_safe_regexp_compiler = true;
@@ -3477,7 +3477,8 @@ void BoyerMoorePositionInfo::SetAll() {
BoyerMooreLookahead::BoyerMooreLookahead(
int length, RegExpCompiler* compiler)
: length_(length),
- compiler_(compiler) {
+ compiler_(compiler),
+ depth_(0) {
if (compiler->ascii()) {
max_char_ = String::kMaxAsciiCharCode;
} else {
@@ -5588,6 +5589,11 @@ STATIC_ASSERT(BoyerMoorePositionInfo::kMapSize ==
void ChoiceNode::FillInBMInfo(
int offset, BoyerMooreLookahead* bm, bool not_at_start) {
ZoneList<GuardedAlternative>* alts = alternatives();
+ if (bm->MaxDepthExceeded()) {
+ bm->SetRest(offset); // Give up trying to fill in info.
+ SaveBMInfo(bm, not_at_start, offset);
+ return;
+ }
for (int i = 0; i < alts->length(); i++) {
GuardedAlternative& alt = alts->at(i);
if (alt.guards() != NULL && alt.guards()->length() != 0) {

Powered by Google App Engine
This is Rietveld 408576698