| 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/runtime/runtime-utils.h" | 5 #include "src/runtime/runtime-utils.h" |
| 6 | 6 |
| 7 #include "src/arguments.h" | 7 #include "src/arguments.h" |
| 8 #include "src/conversions-inl.h" | 8 #include "src/conversions-inl.h" |
| 9 #include "src/isolate-inl.h" | 9 #include "src/isolate-inl.h" |
| 10 #include "src/messages.h" | 10 #include "src/messages.h" |
| (...skipping 821 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 832 CONVERT_ARG_HANDLE_CHECKED(String, source, 1); | 832 CONVERT_ARG_HANDLE_CHECKED(String, source, 1); |
| 833 CONVERT_ARG_HANDLE_CHECKED(String, flags, 2); | 833 CONVERT_ARG_HANDLE_CHECKED(String, flags, 2); |
| 834 | 834 |
| 835 RETURN_FAILURE_ON_EXCEPTION(isolate, | 835 RETURN_FAILURE_ON_EXCEPTION(isolate, |
| 836 JSRegExp::Initialize(regexp, source, flags)); | 836 JSRegExp::Initialize(regexp, source, flags)); |
| 837 | 837 |
| 838 return *regexp; | 838 return *regexp; |
| 839 } | 839 } |
| 840 | 840 |
| 841 | 841 |
| 842 RUNTIME_FUNCTION(Runtime_MaterializeRegExpLiteral) { | |
| 843 HandleScope scope(isolate); | |
| 844 DCHECK(args.length() == 4); | |
| 845 CONVERT_ARG_HANDLE_CHECKED(LiteralsArray, literals, 0); | |
| 846 CONVERT_SMI_ARG_CHECKED(index, 1); | |
| 847 CONVERT_ARG_HANDLE_CHECKED(String, pattern, 2); | |
| 848 CONVERT_ARG_HANDLE_CHECKED(String, flags, 3); | |
| 849 | |
| 850 Handle<JSRegExp> regexp; | |
| 851 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, regexp, | |
| 852 JSRegExp::New(pattern, flags)); | |
| 853 literals->set_literal(index, *regexp); | |
| 854 return *regexp; | |
| 855 } | |
| 856 | |
| 857 | |
| 858 // Only called from Runtime_RegExpExecMultiple so it doesn't need to maintain | 842 // Only called from Runtime_RegExpExecMultiple so it doesn't need to maintain |
| 859 // separate last match info. See comment on that function. | 843 // separate last match info. See comment on that function. |
| 860 template <bool has_capture> | 844 template <bool has_capture> |
| 861 static Object* SearchRegExpMultiple(Isolate* isolate, Handle<String> subject, | 845 static Object* SearchRegExpMultiple(Isolate* isolate, Handle<String> subject, |
| 862 Handle<JSRegExp> regexp, | 846 Handle<JSRegExp> regexp, |
| 863 Handle<JSArray> last_match_array, | 847 Handle<JSArray> last_match_array, |
| 864 Handle<JSArray> result_array) { | 848 Handle<JSArray> result_array) { |
| 865 DCHECK(subject->IsFlat()); | 849 DCHECK(subject->IsFlat()); |
| 866 DCHECK_NE(has_capture, regexp->CaptureCount() == 0); | 850 DCHECK_NE(has_capture, regexp->CaptureCount() == 0); |
| 867 | 851 |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1038 | 1022 |
| 1039 | 1023 |
| 1040 RUNTIME_FUNCTION(Runtime_IsRegExp) { | 1024 RUNTIME_FUNCTION(Runtime_IsRegExp) { |
| 1041 SealHandleScope shs(isolate); | 1025 SealHandleScope shs(isolate); |
| 1042 DCHECK(args.length() == 1); | 1026 DCHECK(args.length() == 1); |
| 1043 CONVERT_ARG_CHECKED(Object, obj, 0); | 1027 CONVERT_ARG_CHECKED(Object, obj, 0); |
| 1044 return isolate->heap()->ToBoolean(obj->IsJSRegExp()); | 1028 return isolate->heap()->ToBoolean(obj->IsJSRegExp()); |
| 1045 } | 1029 } |
| 1046 } // namespace internal | 1030 } // namespace internal |
| 1047 } // namespace v8 | 1031 } // namespace v8 |
| OLD | NEW |