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

Side by Side Diff: src/runtime.cc

Issue 43075: * Reapply revisions 1383, 1384, 1391, 1398, 1401, 1402,... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 years, 9 months 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 | Annotate | Revision Log
OLDNEW
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 912 matching lines...) Expand 10 before | Expand all | Expand 10 after
923 } 923 }
924 } 924 }
925 } 925 }
926 926
927 return *value; 927 return *value;
928 } 928 }
929 929
930 930
931 static Object* Runtime_RegExpExec(Arguments args) { 931 static Object* Runtime_RegExpExec(Arguments args) {
932 HandleScope scope; 932 HandleScope scope;
933 ASSERT(args.length() == 3); 933 ASSERT(args.length() == 4);
934 CONVERT_CHECKED(JSRegExp, raw_regexp, args[0]); 934 CONVERT_CHECKED(JSRegExp, raw_regexp, args[0]);
935 Handle<JSRegExp> regexp(raw_regexp); 935 Handle<JSRegExp> regexp(raw_regexp);
936 CONVERT_CHECKED(String, raw_subject, args[1]); 936 CONVERT_CHECKED(String, raw_subject, args[1]);
937 Handle<String> subject(raw_subject); 937 Handle<String> subject(raw_subject);
938 Handle<Object> index(args[2]); 938 // Due to the way the JS files are constructed this must be less than the
939 ASSERT(index->IsNumber()); 939 // length of a string, i.e. it is always a Smi. We check anyway for security.
940 Handle<Object> result = RegExpImpl::Exec(regexp, subject, index); 940 CONVERT_CHECKED(Smi, index, args[2]);
941 CONVERT_CHECKED(JSArray, raw_last_match_info, args[3]);
942 Handle<JSArray> last_match_info(raw_last_match_info);
943 CHECK(last_match_info->HasFastElements());
944 Handle<Object> result = RegExpImpl::Exec(regexp,
945 subject,
946 index->value(),
947 last_match_info);
941 if (result.is_null()) return Failure::Exception(); 948 if (result.is_null()) return Failure::Exception();
942 return *result; 949 return *result;
943 } 950 }
944 951
945 952
946 static Object* Runtime_RegExpExecGlobal(Arguments args) { 953 static Object* Runtime_RegExpExecGlobal(Arguments args) {
947 HandleScope scope; 954 HandleScope scope;
948 ASSERT(args.length() == 2); 955 ASSERT(args.length() == 3);
949 CONVERT_CHECKED(JSRegExp, raw_regexp, args[0]); 956 CONVERT_CHECKED(JSRegExp, raw_regexp, args[0]);
950 Handle<JSRegExp> regexp(raw_regexp); 957 Handle<JSRegExp> regexp(raw_regexp);
951 CONVERT_CHECKED(String, raw_subject, args[1]); 958 CONVERT_CHECKED(String, raw_subject, args[1]);
952 Handle<String> subject(raw_subject); 959 Handle<String> subject(raw_subject);
953 Handle<Object> result = RegExpImpl::ExecGlobal(regexp, subject); 960 CONVERT_CHECKED(JSArray, raw_last_match_info, args[2]);
961 Handle<JSArray> last_match_info(raw_last_match_info);
962 CHECK(last_match_info->HasFastElements());
963 Handle<Object> result =
964 RegExpImpl::ExecGlobal(regexp, subject, last_match_info);
954 if (result.is_null()) return Failure::Exception(); 965 if (result.is_null()) return Failure::Exception();
955 return *result; 966 return *result;
956 } 967 }
957 968
958 969
959 static Object* Runtime_MaterializeRegExpLiteral(Arguments args) { 970 static Object* Runtime_MaterializeRegExpLiteral(Arguments args) {
960 HandleScope scope; 971 HandleScope scope;
961 ASSERT(args.length() == 4); 972 ASSERT(args.length() == 4);
962 CONVERT_ARG_CHECKED(FixedArray, literals, 0); 973 CONVERT_ARG_CHECKED(FixedArray, literals, 0);
963 int index = Smi::cast(args[1])->value(); 974 int index = Smi::cast(args[1])->value();
(...skipping 5222 matching lines...) Expand 10 before | Expand all | Expand 10 after
6186 } else { 6197 } else {
6187 // Handle last resort GC and make sure to allow future allocations 6198 // Handle last resort GC and make sure to allow future allocations
6188 // to grow the heap without causing GCs (if possible). 6199 // to grow the heap without causing GCs (if possible).
6189 Counters::gc_last_resort_from_js.Increment(); 6200 Counters::gc_last_resort_from_js.Increment();
6190 Heap::CollectAllGarbage(); 6201 Heap::CollectAllGarbage();
6191 } 6202 }
6192 } 6203 }
6193 6204
6194 6205
6195 } } // namespace v8::internal 6206 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698