OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |