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

Side by Side Diff: src/objects.cc

Issue 2841633004: [regexp] Fix passing all flags to RegExp construction (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 | « src/objects.h ('k') | test/mjsunit/harmony/regexp-dotall.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 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 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/objects.h" 5 #include "src/objects.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 #include <iomanip> 8 #include <iomanip>
9 #include <memory> 9 #include <memory>
10 #include <sstream> 10 #include <sstream>
(...skipping 16207 matching lines...) Expand 10 before | Expand all | Expand 10 after
16218 UNREACHABLE(); 16218 UNREACHABLE();
16219 return NULL; 16219 return NULL;
16220 } 16220 }
16221 16221
16222 namespace { 16222 namespace {
16223 16223
16224 JSRegExp::Flags RegExpFlagsFromString(Handle<String> flags, bool* success) { 16224 JSRegExp::Flags RegExpFlagsFromString(Handle<String> flags, bool* success) {
16225 JSRegExp::Flags value = JSRegExp::kNone; 16225 JSRegExp::Flags value = JSRegExp::kNone;
16226 int length = flags->length(); 16226 int length = flags->length();
16227 // A longer flags string cannot be valid. 16227 // A longer flags string cannot be valid.
16228 if (length > 5) return JSRegExp::Flags(0); 16228 if (length > JSRegExp::FlagCount()) return JSRegExp::Flags(0);
16229 for (int i = 0; i < length; i++) { 16229 for (int i = 0; i < length; i++) {
16230 JSRegExp::Flag flag = JSRegExp::kNone; 16230 JSRegExp::Flag flag = JSRegExp::kNone;
16231 switch (flags->Get(i)) { 16231 switch (flags->Get(i)) {
16232 case 'g': 16232 case 'g':
16233 flag = JSRegExp::kGlobal; 16233 flag = JSRegExp::kGlobal;
16234 break; 16234 break;
16235 case 'i': 16235 case 'i':
16236 flag = JSRegExp::kIgnoreCase; 16236 flag = JSRegExp::kIgnoreCase;
16237 break; 16237 break;
16238 case 'm': 16238 case 'm':
(...skipping 4431 matching lines...) Expand 10 before | Expand all | Expand 10 after
20670 // depend on this. 20670 // depend on this.
20671 return DICTIONARY_ELEMENTS; 20671 return DICTIONARY_ELEMENTS;
20672 } 20672 }
20673 DCHECK_LE(kind, LAST_ELEMENTS_KIND); 20673 DCHECK_LE(kind, LAST_ELEMENTS_KIND);
20674 return kind; 20674 return kind;
20675 } 20675 }
20676 } 20676 }
20677 20677
20678 } // namespace internal 20678 } // namespace internal
20679 } // namespace v8 20679 } // namespace v8
OLDNEW
« no previous file with comments | « src/objects.h ('k') | test/mjsunit/harmony/regexp-dotall.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698