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

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

Issue 2510743003: [regexp] Fix matching of regexps that are both sticky and anchored at end. (Closed)
Patch Set: Reformat Created 4 years, 1 month 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 | test/mjsunit/es6/regexp-sticky.js » ('j') | 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 6724 matching lines...) Expand 10 before | Expand all | Expand 10 after
6735 // Interpreted regexp implementation. 6735 // Interpreted regexp implementation.
6736 EmbeddedVector<byte, 1024> codes; 6736 EmbeddedVector<byte, 1024> codes;
6737 RegExpMacroAssemblerIrregexp macro_assembler(isolate, codes, zone); 6737 RegExpMacroAssemblerIrregexp macro_assembler(isolate, codes, zone);
6738 #endif // V8_INTERPRETED_REGEXP 6738 #endif // V8_INTERPRETED_REGEXP
6739 6739
6740 macro_assembler.set_slow_safe(TooMuchRegExpCode(pattern)); 6740 macro_assembler.set_slow_safe(TooMuchRegExpCode(pattern));
6741 6741
6742 // Inserted here, instead of in Assembler, because it depends on information 6742 // Inserted here, instead of in Assembler, because it depends on information
6743 // in the AST that isn't replicated in the Node structure. 6743 // in the AST that isn't replicated in the Node structure.
6744 static const int kMaxBacksearchLimit = 1024; 6744 static const int kMaxBacksearchLimit = 1024;
6745 if (is_end_anchored && 6745 if (is_end_anchored && !is_start_anchored && !is_sticky &&
6746 !is_start_anchored &&
6747 max_length < kMaxBacksearchLimit) { 6746 max_length < kMaxBacksearchLimit) {
6748 macro_assembler.SetCurrentPositionFromEnd(max_length); 6747 macro_assembler.SetCurrentPositionFromEnd(max_length);
6749 } 6748 }
6750 6749
6751 if (is_global) { 6750 if (is_global) {
6752 RegExpMacroAssembler::GlobalMode mode = RegExpMacroAssembler::GLOBAL; 6751 RegExpMacroAssembler::GlobalMode mode = RegExpMacroAssembler::GLOBAL;
6753 if (data->tree->min_match() > 0) { 6752 if (data->tree->min_match() > 0) {
6754 mode = RegExpMacroAssembler::GLOBAL_NO_ZERO_LENGTH_CHECK; 6753 mode = RegExpMacroAssembler::GLOBAL_NO_ZERO_LENGTH_CHECK;
6755 } else if (is_unicode) { 6754 } else if (is_unicode) {
6756 mode = RegExpMacroAssembler::GLOBAL_UNICODE; 6755 mode = RegExpMacroAssembler::GLOBAL_UNICODE;
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
6871 6870
6872 6871
6873 void RegExpResultsCache::Clear(FixedArray* cache) { 6872 void RegExpResultsCache::Clear(FixedArray* cache) {
6874 for (int i = 0; i < kRegExpResultsCacheSize; i++) { 6873 for (int i = 0; i < kRegExpResultsCacheSize; i++) {
6875 cache->set(i, Smi::kZero); 6874 cache->set(i, Smi::kZero);
6876 } 6875 }
6877 } 6876 }
6878 6877
6879 } // namespace internal 6878 } // namespace internal
6880 } // namespace v8 6879 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/es6/regexp-sticky.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698