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

Side by Side Diff: src/regexp/jsregexp.cc

Issue 2777583003: Regexp: Optimize better in presence of lookaround. (Closed)
Patch Set: Created 3 years, 8 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/regexp/jsregexp.h" 5 #include "src/regexp/jsregexp.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "src/base/platform/platform.h" 9 #include "src/base/platform/platform.h"
10 #include "src/compilation-cache.h" 10 #include "src/compilation-cache.h"
(...skipping 2284 matching lines...) Expand 10 before | Expand all | Expand 10 after
2295 if (budget <= 0) return 0; 2295 if (budget <= 0) return 0;
2296 if (action_type_ == POSITIVE_SUBMATCH_SUCCESS) return 0; // Rewinds input! 2296 if (action_type_ == POSITIVE_SUBMATCH_SUCCESS) return 0; // Rewinds input!
2297 return on_success()->EatsAtLeast(still_to_find, 2297 return on_success()->EatsAtLeast(still_to_find,
2298 budget - 1, 2298 budget - 1,
2299 not_at_start); 2299 not_at_start);
2300 } 2300 }
2301 2301
2302 2302
2303 void ActionNode::FillInBMInfo(Isolate* isolate, int offset, int budget, 2303 void ActionNode::FillInBMInfo(Isolate* isolate, int offset, int budget,
2304 BoyerMooreLookahead* bm, bool not_at_start) { 2304 BoyerMooreLookahead* bm, bool not_at_start) {
2305 if (action_type_ == BEGIN_SUBMATCH) { 2305 if (action_type_ != POSITIVE_SUBMATCH_SUCCESS) {
2306 bm->SetRest(offset);
2307 } else if (action_type_ != POSITIVE_SUBMATCH_SUCCESS) {
2308 on_success()->FillInBMInfo(isolate, offset, budget - 1, bm, not_at_start); 2306 on_success()->FillInBMInfo(isolate, offset, budget - 1, bm, not_at_start);
2309 } 2307 }
2310 SaveBMInfo(bm, not_at_start, offset); 2308 SaveBMInfo(bm, not_at_start, offset);
2311 } 2309 }
2312 2310
2313 2311
2314 int AssertionNode::EatsAtLeast(int still_to_find, 2312 int AssertionNode::EatsAtLeast(int still_to_find,
2315 int budget, 2313 int budget,
2316 bool not_at_start) { 2314 bool not_at_start) {
2317 if (budget <= 0) return 0; 2315 if (budget <= 0) return 0;
(...skipping 4606 matching lines...) Expand 10 before | Expand all | Expand 10 after
6924 6922
6925 6923
6926 void RegExpResultsCache::Clear(FixedArray* cache) { 6924 void RegExpResultsCache::Clear(FixedArray* cache) {
6927 for (int i = 0; i < kRegExpResultsCacheSize; i++) { 6925 for (int i = 0; i < kRegExpResultsCacheSize; i++) {
6928 cache->set(i, Smi::kZero); 6926 cache->set(i, Smi::kZero);
6929 } 6927 }
6930 } 6928 }
6931 6929
6932 } // namespace internal 6930 } // namespace internal
6933 } // namespace v8 6931 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698