Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(301)

Side by Side Diff: src/runtime/runtime-regexp.cc

Issue 2448463002: [regexp] Remove unused code (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/runtime/runtime.h ('k') | src/s390/interface-descriptors-s390.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 802 matching lines...) Expand 10 before | Expand all | Expand 10 after
813 CONVERT_ARG_HANDLE_CHECKED(RegExpMatchInfo, last_match_info, 3); 813 CONVERT_ARG_HANDLE_CHECKED(RegExpMatchInfo, last_match_info, 3);
814 // Due to the way the JS calls are constructed this must be less than the 814 // Due to the way the JS calls are constructed this must be less than the
815 // length of a string, i.e. it is always a Smi. We check anyway for security. 815 // length of a string, i.e. it is always a Smi. We check anyway for security.
816 CHECK(index >= 0); 816 CHECK(index >= 0);
817 CHECK(index <= subject->length()); 817 CHECK(index <= subject->length());
818 isolate->counters()->regexp_entry_runtime()->Increment(); 818 isolate->counters()->regexp_entry_runtime()->Increment();
819 RETURN_RESULT_OR_FAILURE( 819 RETURN_RESULT_OR_FAILURE(
820 isolate, RegExpImpl::Exec(regexp, subject, index, last_match_info)); 820 isolate, RegExpImpl::Exec(regexp, subject, index, last_match_info));
821 } 821 }
822 822
823
824 RUNTIME_FUNCTION(Runtime_RegExpFlags) {
825 SealHandleScope shs(isolate);
826 DCHECK(args.length() == 1);
827 CONVERT_ARG_CHECKED(JSRegExp, regexp, 0);
828 return regexp->flags();
829 }
830
831 RUNTIME_FUNCTION(Runtime_RegExpSource) {
832 SealHandleScope shs(isolate);
833 DCHECK(args.length() == 1);
834 CONVERT_ARG_CHECKED(JSRegExp, regexp, 0);
835 return regexp->source();
836 }
837
838 // TODO(jgruber): Remove this once all uses in regexp.js have been removed.
839 RUNTIME_FUNCTION(Runtime_RegExpConstructResult) {
840 HandleScope handle_scope(isolate);
841 DCHECK(args.length() == 3);
842 CONVERT_SMI_ARG_CHECKED(size, 0);
843 CHECK(size >= 0 && size <= FixedArray::kMaxLength);
844 CONVERT_ARG_HANDLE_CHECKED(Object, index, 1);
845 CONVERT_ARG_HANDLE_CHECKED(Object, input, 2);
846 Handle<FixedArray> elements = isolate->factory()->NewFixedArray(size);
847 Handle<Map> regexp_map(isolate->native_context()->regexp_result_map());
848 Handle<JSObject> object =
849 isolate->factory()->NewJSObjectFromMap(regexp_map, NOT_TENURED);
850 Handle<JSArray> array = Handle<JSArray>::cast(object);
851 array->set_elements(*elements);
852 array->set_length(Smi::FromInt(size));
853 // Write in-object properties after the length of the array.
854 array->InObjectPropertyAtPut(JSRegExpResult::kIndexIndex, *index);
855 array->InObjectPropertyAtPut(JSRegExpResult::kInputIndex, *input);
856 return *array;
857 }
858
859 RUNTIME_FUNCTION(Runtime_RegExpInitializeAndCompile) {
860 HandleScope scope(isolate);
861 DCHECK(args.length() == 3);
862 CONVERT_ARG_HANDLE_CHECKED(JSRegExp, regexp, 0);
863 CONVERT_ARG_HANDLE_CHECKED(String, source, 1);
864 CONVERT_ARG_HANDLE_CHECKED(String, flags, 2);
865
866 RETURN_FAILURE_ON_EXCEPTION(isolate,
867 JSRegExp::Initialize(regexp, source, flags));
868
869 return *regexp;
870 }
871
872 RUNTIME_FUNCTION(Runtime_RegExpInternalReplace) { 823 RUNTIME_FUNCTION(Runtime_RegExpInternalReplace) {
873 HandleScope scope(isolate); 824 HandleScope scope(isolate);
874 DCHECK(args.length() == 3); 825 DCHECK(args.length() == 3);
875 CONVERT_ARG_HANDLE_CHECKED(JSRegExp, regexp, 0); 826 CONVERT_ARG_HANDLE_CHECKED(JSRegExp, regexp, 0);
876 CONVERT_ARG_HANDLE_CHECKED(String, subject, 1); 827 CONVERT_ARG_HANDLE_CHECKED(String, subject, 1);
877 CONVERT_ARG_HANDLE_CHECKED(String, replacement, 2); 828 CONVERT_ARG_HANDLE_CHECKED(String, replacement, 2);
878 829
879 Handle<RegExpMatchInfo> internal_match_info = 830 Handle<RegExpMatchInfo> internal_match_info =
880 isolate->regexp_internal_match_info(); 831 isolate->regexp_internal_match_info();
881 832
(...skipping 617 matching lines...) Expand 10 before | Expand all | Expand 10 after
1499 1450
1500 RUNTIME_FUNCTION(Runtime_IsRegExp) { 1451 RUNTIME_FUNCTION(Runtime_IsRegExp) {
1501 SealHandleScope shs(isolate); 1452 SealHandleScope shs(isolate);
1502 DCHECK(args.length() == 1); 1453 DCHECK(args.length() == 1);
1503 CONVERT_ARG_CHECKED(Object, obj, 0); 1454 CONVERT_ARG_CHECKED(Object, obj, 0);
1504 return isolate->heap()->ToBoolean(obj->IsJSRegExp()); 1455 return isolate->heap()->ToBoolean(obj->IsJSRegExp());
1505 } 1456 }
1506 1457
1507 } // namespace internal 1458 } // namespace internal
1508 } // namespace v8 1459 } // namespace v8
OLDNEW
« no previous file with comments | « src/runtime/runtime.h ('k') | src/s390/interface-descriptors-s390.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698