OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 840 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
851 } | 851 } |
852 } | 852 } |
853 } | 853 } |
854 | 854 |
855 return *value; | 855 return *value; |
856 } | 856 } |
857 | 857 |
858 | 858 |
859 static Object* Runtime_RegExpExec(Arguments args) { | 859 static Object* Runtime_RegExpExec(Arguments args) { |
860 HandleScope scope; | 860 HandleScope scope; |
861 ASSERT(args.length() == 4); | 861 ASSERT(args.length() == 3); |
862 CONVERT_CHECKED(JSRegExp, raw_regexp, args[0]); | 862 CONVERT_CHECKED(JSRegExp, raw_regexp, args[0]); |
863 Handle<JSRegExp> regexp(raw_regexp); | 863 Handle<JSRegExp> regexp(raw_regexp); |
864 CONVERT_CHECKED(String, raw_subject, args[1]); | 864 CONVERT_CHECKED(String, raw_subject, args[1]); |
865 Handle<String> subject(raw_subject); | 865 Handle<String> subject(raw_subject); |
866 // Due to the way the JS files are constructed this must be less than the | 866 Handle<Object> index(args[2]); |
867 // length of a string, i.e. it is always a Smi. We check anyway for security. | 867 ASSERT(index->IsNumber()); |
868 CONVERT_CHECKED(Smi, index, args[2]); | 868 Handle<Object> result = RegExpImpl::Exec(regexp, subject, index); |
869 CONVERT_CHECKED(JSArray, raw_last_match_info, args[3]); | |
870 Handle<JSArray> last_match_info(raw_last_match_info); | |
871 CHECK(last_match_info->HasFastElements()); | |
872 Handle<Object> result = RegExpImpl::Exec(regexp, | |
873 subject, | |
874 index->value(), | |
875 last_match_info); | |
876 if (result.is_null()) return Failure::Exception(); | 869 if (result.is_null()) return Failure::Exception(); |
877 return *result; | 870 return *result; |
878 } | 871 } |
879 | 872 |
880 | 873 |
881 static Object* Runtime_RegExpExecGlobal(Arguments args) { | 874 static Object* Runtime_RegExpExecGlobal(Arguments args) { |
882 HandleScope scope; | 875 HandleScope scope; |
883 ASSERT(args.length() == 3); | 876 ASSERT(args.length() == 2); |
884 CONVERT_CHECKED(JSRegExp, raw_regexp, args[0]); | 877 CONVERT_CHECKED(JSRegExp, raw_regexp, args[0]); |
885 Handle<JSRegExp> regexp(raw_regexp); | 878 Handle<JSRegExp> regexp(raw_regexp); |
886 CONVERT_CHECKED(String, raw_subject, args[1]); | 879 CONVERT_CHECKED(String, raw_subject, args[1]); |
887 Handle<String> subject(raw_subject); | 880 Handle<String> subject(raw_subject); |
888 CONVERT_CHECKED(JSArray, raw_last_match_info, args[2]); | 881 Handle<Object> result = RegExpImpl::ExecGlobal(regexp, subject); |
889 Handle<JSArray> last_match_info(raw_last_match_info); | |
890 CHECK(last_match_info->HasFastElements()); | |
891 Handle<Object> result = | |
892 RegExpImpl::ExecGlobal(regexp, subject, last_match_info); | |
893 if (result.is_null()) return Failure::Exception(); | 882 if (result.is_null()) return Failure::Exception(); |
894 return *result; | 883 return *result; |
895 } | 884 } |
896 | 885 |
897 | 886 |
898 static Object* Runtime_MaterializeRegExpLiteral(Arguments args) { | 887 static Object* Runtime_MaterializeRegExpLiteral(Arguments args) { |
899 HandleScope scope; | 888 HandleScope scope; |
900 ASSERT(args.length() == 4); | 889 ASSERT(args.length() == 4); |
901 CONVERT_ARG_CHECKED(FixedArray, literals, 0); | 890 CONVERT_ARG_CHECKED(FixedArray, literals, 0); |
902 int index = Smi::cast(args[1])->value(); | 891 int index = Smi::cast(args[1])->value(); |
(...skipping 5226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6129 } else { | 6118 } else { |
6130 // Handle last resort GC and make sure to allow future allocations | 6119 // Handle last resort GC and make sure to allow future allocations |
6131 // to grow the heap without causing GCs (if possible). | 6120 // to grow the heap without causing GCs (if possible). |
6132 Counters::gc_last_resort_from_js.Increment(); | 6121 Counters::gc_last_resort_from_js.Increment(); |
6133 Heap::CollectAllGarbage(); | 6122 Heap::CollectAllGarbage(); |
6134 } | 6123 } |
6135 } | 6124 } |
6136 | 6125 |
6137 | 6126 |
6138 } } // namespace v8::internal | 6127 } } // namespace v8::internal |
OLD | NEW |