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-utils.h" | 10 #include "src/runtime/runtime-utils.h" |
(...skipping 741 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
752 if (result->HasFastObjectElements()) { | 752 if (result->HasFastObjectElements()) { |
753 RegExpResultsCache::Enter(isolate, subject, pattern, elements, | 753 RegExpResultsCache::Enter(isolate, subject, pattern, elements, |
754 RegExpResultsCache::STRING_SPLIT_SUBSTRINGS); | 754 RegExpResultsCache::STRING_SPLIT_SUBSTRINGS); |
755 } | 755 } |
756 } | 756 } |
757 | 757 |
758 return *result; | 758 return *result; |
759 } | 759 } |
760 | 760 |
761 | 761 |
762 RUNTIME_FUNCTION(Runtime_RegExpExecRT) { | 762 RUNTIME_FUNCTION(Runtime_RegExpExec) { |
763 HandleScope scope(isolate); | 763 HandleScope scope(isolate); |
764 DCHECK(args.length() == 4); | 764 DCHECK(args.length() == 4); |
765 CONVERT_ARG_HANDLE_CHECKED(JSRegExp, regexp, 0); | 765 CONVERT_ARG_HANDLE_CHECKED(JSRegExp, regexp, 0); |
766 CONVERT_ARG_HANDLE_CHECKED(String, subject, 1); | 766 CONVERT_ARG_HANDLE_CHECKED(String, subject, 1); |
767 CONVERT_INT32_ARG_CHECKED(index, 2); | 767 CONVERT_INT32_ARG_CHECKED(index, 2); |
768 CONVERT_ARG_HANDLE_CHECKED(JSArray, last_match_info, 3); | 768 CONVERT_ARG_HANDLE_CHECKED(JSArray, last_match_info, 3); |
769 // Due to the way the JS calls are constructed this must be less than the | 769 // Due to the way the JS calls are constructed this must be less than the |
770 // length of a string, i.e. it is always a Smi. We check anyway for security. | 770 // length of a string, i.e. it is always a Smi. We check anyway for security. |
771 RUNTIME_ASSERT(index >= 0); | 771 RUNTIME_ASSERT(index >= 0); |
772 RUNTIME_ASSERT(index <= subject->length()); | 772 RUNTIME_ASSERT(index <= subject->length()); |
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1103 if (regexp->CaptureCount() == 0) { | 1103 if (regexp->CaptureCount() == 0) { |
1104 return SearchRegExpMultiple<false>(isolate, subject, regexp, | 1104 return SearchRegExpMultiple<false>(isolate, subject, regexp, |
1105 last_match_info, result_array); | 1105 last_match_info, result_array); |
1106 } else { | 1106 } else { |
1107 return SearchRegExpMultiple<true>(isolate, subject, regexp, last_match_info, | 1107 return SearchRegExpMultiple<true>(isolate, subject, regexp, last_match_info, |
1108 result_array); | 1108 result_array); |
1109 } | 1109 } |
1110 } | 1110 } |
1111 | 1111 |
1112 | 1112 |
1113 RUNTIME_FUNCTION(Runtime_RegExpExec) { | |
1114 SealHandleScope shs(isolate); | |
1115 return __RT_impl_Runtime_RegExpExecRT(args, isolate); | |
1116 } | |
1117 | |
1118 | |
1119 RUNTIME_FUNCTION(Runtime_IsRegExp) { | 1113 RUNTIME_FUNCTION(Runtime_IsRegExp) { |
1120 SealHandleScope shs(isolate); | 1114 SealHandleScope shs(isolate); |
1121 DCHECK(args.length() == 1); | 1115 DCHECK(args.length() == 1); |
1122 CONVERT_ARG_CHECKED(Object, obj, 0); | 1116 CONVERT_ARG_CHECKED(Object, obj, 0); |
1123 return isolate->heap()->ToBoolean(obj->IsJSRegExp()); | 1117 return isolate->heap()->ToBoolean(obj->IsJSRegExp()); |
1124 } | 1118 } |
1125 } | 1119 } |
1126 } // namespace v8::internal | 1120 } // namespace v8::internal |
OLD | NEW |