| OLD | NEW |
| 1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 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 #ifndef V8_REGEXP_REGEXP_UTILS_H_ | 5 #ifndef V8_REGEXP_REGEXP_UTILS_H_ |
| 6 #define V8_REGEXP_REGEXP_UTILS_H_ | 6 #define V8_REGEXP_REGEXP_UTILS_H_ |
| 7 | 7 |
| 8 #include "src/objects.h" | 8 #include "src/objects.h" |
| 9 | 9 |
| 10 namespace v8 { | 10 namespace v8 { |
| 11 namespace internal { | 11 namespace internal { |
| 12 | 12 |
| 13 // Helper methods for C++ regexp builtins. | 13 // Helper methods for C++ regexp builtins. |
| 14 class RegExpUtils : public AllStatic { | 14 class RegExpUtils : public AllStatic { |
| 15 public: | 15 public: |
| 16 // Last match info accessors. | 16 // Last match info accessors. |
| 17 static Handle<String> GenericCaptureGetter(Isolate* isolate, | 17 static Handle<String> GenericCaptureGetter(Isolate* isolate, |
| 18 Handle<RegExpMatchInfo> match_info, | 18 Handle<RegExpMatchInfo> match_info, |
| 19 int capture, bool* ok = nullptr); | 19 int capture, bool* ok = nullptr); |
| 20 | 20 |
| 21 // Last index (RegExp.lastIndex) accessors. | 21 // Last index (RegExp.lastIndex) accessors. |
| 22 static MaybeHandle<Object> SetLastIndex(Isolate* isolate, | 22 static MUST_USE_RESULT MaybeHandle<Object> SetLastIndex( |
| 23 Handle<JSReceiver> regexp, int value); | 23 Isolate* isolate, Handle<JSReceiver> regexp, int value); |
| 24 static MaybeHandle<Object> GetLastIndex(Isolate* isolate, | 24 static MUST_USE_RESULT MaybeHandle<Object> GetLastIndex( |
| 25 Handle<JSReceiver> recv); | 25 Isolate* isolate, Handle<JSReceiver> recv); |
| 26 | 26 |
| 27 // ES#sec-regexpexec Runtime Semantics: RegExpExec ( R, S ) | 27 // ES#sec-regexpexec Runtime Semantics: RegExpExec ( R, S ) |
| 28 static MaybeHandle<Object> RegExpExec(Isolate* isolate, | 28 static MUST_USE_RESULT MaybeHandle<Object> RegExpExec( |
| 29 Handle<JSReceiver> regexp, | 29 Isolate* isolate, Handle<JSReceiver> regexp, Handle<String> string, |
| 30 Handle<String> string, | 30 Handle<Object> exec); |
| 31 Handle<Object> exec); | |
| 32 | 31 |
| 33 // ES#sec-isregexp IsRegExp ( argument ) | 32 // ES#sec-isregexp IsRegExp ( argument ) |
| 34 // Includes checking of the match property. | 33 // Includes checking of the match property. |
| 35 static Maybe<bool> IsRegExp(Isolate* isolate, Handle<Object> object); | 34 static Maybe<bool> IsRegExp(Isolate* isolate, Handle<Object> object); |
| 36 | 35 |
| 37 // Checks whether the given object is an unmodified JSRegExp instance. | 36 // Checks whether the given object is an unmodified JSRegExp instance. |
| 38 // Neither the object's map, nor its prototype's map may be modified. | 37 // Neither the object's map, nor its prototype's map may be modified. |
| 39 static bool IsUnmodifiedRegExp(Isolate* isolate, Handle<Object> obj); | 38 static bool IsUnmodifiedRegExp(Isolate* isolate, Handle<Object> obj); |
| 40 | 39 |
| 41 // ES#sec-advancestringindex | 40 // ES#sec-advancestringindex |
| 42 // AdvanceStringIndex ( S, index, unicode ) | 41 // AdvanceStringIndex ( S, index, unicode ) |
| 43 static int AdvanceStringIndex(Isolate* isolate, Handle<String> string, | 42 static int AdvanceStringIndex(Isolate* isolate, Handle<String> string, |
| 44 int index, bool unicode); | 43 int index, bool unicode); |
| 45 static MaybeHandle<Object> SetAdvancedStringIndex(Isolate* isolate, | 44 static MUST_USE_RESULT MaybeHandle<Object> SetAdvancedStringIndex( |
| 46 Handle<JSReceiver> regexp, | 45 Isolate* isolate, Handle<JSReceiver> regexp, Handle<String> string, |
| 47 Handle<String> string, | 46 bool unicode); |
| 48 bool unicode); | |
| 49 }; | 47 }; |
| 50 | 48 |
| 51 } // namespace internal | 49 } // namespace internal |
| 52 } // namespace v8 | 50 } // namespace v8 |
| 53 | 51 |
| 54 #endif // V8_REGEXP_REGEXP_UTILS_H_ | 52 #endif // V8_REGEXP_REGEXP_UTILS_H_ |
| OLD | NEW |