| OLD | NEW |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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/v8.h" | 5 #include "src/v8.h" |
| 6 | 6 |
| 7 #include "src/arguments.h" | 7 #include "src/arguments.h" |
| 8 #include "src/jsregexp-inl.h" | 8 #include "src/jsregexp-inl.h" |
| 9 #include "src/jsregexp.h" | 9 #include "src/jsregexp.h" |
| 10 #include "src/runtime/runtime.h" | 10 #include "src/runtime/runtime.h" |
| (...skipping 1070 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1081 return __RT_impl_Runtime_RegExpConstructResult(args, isolate); | 1081 return __RT_impl_Runtime_RegExpConstructResult(args, isolate); |
| 1082 } | 1082 } |
| 1083 | 1083 |
| 1084 | 1084 |
| 1085 RUNTIME_FUNCTION(RuntimeReference_RegExpExec) { | 1085 RUNTIME_FUNCTION(RuntimeReference_RegExpExec) { |
| 1086 SealHandleScope shs(isolate); | 1086 SealHandleScope shs(isolate); |
| 1087 return __RT_impl_Runtime_RegExpExecRT(args, isolate); | 1087 return __RT_impl_Runtime_RegExpExecRT(args, isolate); |
| 1088 } | 1088 } |
| 1089 | 1089 |
| 1090 | 1090 |
| 1091 RUNTIME_FUNCTION(RuntimeReference_IsRegExp) { |
| 1092 SealHandleScope shs(isolate); |
| 1093 DCHECK(args.length() == 1); |
| 1094 CONVERT_ARG_CHECKED(Object, obj, 0); |
| 1095 return isolate->heap()->ToBoolean(obj->IsJSRegExp()); |
| 1096 } |
| 1097 |
| 1098 |
| 1091 // Perform string match of pattern on subject, starting at start index. | 1099 // Perform string match of pattern on subject, starting at start index. |
| 1092 // Caller must ensure that 0 <= start_index <= sub->length(), | 1100 // Caller must ensure that 0 <= start_index <= sub->length(), |
| 1093 // and should check that pat->length() + start_index <= sub->length(). | 1101 // and should check that pat->length() + start_index <= sub->length(). |
| 1094 int Runtime::StringMatch(Isolate* isolate, Handle<String> sub, | 1102 int Runtime::StringMatch(Isolate* isolate, Handle<String> sub, |
| 1095 Handle<String> pat, int start_index) { | 1103 Handle<String> pat, int start_index) { |
| 1096 DCHECK(0 <= start_index); | 1104 DCHECK(0 <= start_index); |
| 1097 DCHECK(start_index <= sub->length()); | 1105 DCHECK(start_index <= sub->length()); |
| 1098 | 1106 |
| 1099 int pattern_length = pat->length(); | 1107 int pattern_length = pat->length(); |
| 1100 if (pattern_length == 0) return start_index; | 1108 if (pattern_length == 0) return start_index; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 1122 } | 1130 } |
| 1123 Vector<const uc16> pat_vector = seq_pat.ToUC16Vector(); | 1131 Vector<const uc16> pat_vector = seq_pat.ToUC16Vector(); |
| 1124 if (seq_sub.IsOneByte()) { | 1132 if (seq_sub.IsOneByte()) { |
| 1125 return SearchString(isolate, seq_sub.ToOneByteVector(), pat_vector, | 1133 return SearchString(isolate, seq_sub.ToOneByteVector(), pat_vector, |
| 1126 start_index); | 1134 start_index); |
| 1127 } | 1135 } |
| 1128 return SearchString(isolate, seq_sub.ToUC16Vector(), pat_vector, start_index); | 1136 return SearchString(isolate, seq_sub.ToUC16Vector(), pat_vector, start_index); |
| 1129 } | 1137 } |
| 1130 } | 1138 } |
| 1131 } // namespace v8::internal | 1139 } // namespace v8::internal |
| OLD | NEW |