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

Side by Side Diff: src/runtime.cc

Issue 28184: Avoids allocating a JSArray of capture information on each non-global... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 years, 10 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
« src/macros.py ('K') | « src/runtime.h ('k') | src/string.js » ('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 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
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() == 3); 861 ASSERT(args.length() == 4);
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 Handle<Object> index(args[2]); 866 CONVERT_CHECKED(Smi, index, args[2]);
Christian Plesner Hansen 2009/02/26 15:18:53 This looks suspect -- plain small integers sometim
867 CONVERT_CHECKED(JSArray, raw_captures, args[3]);
868 Handle<JSArray> captures(raw_captures);
867 ASSERT(index->IsNumber()); 869 ASSERT(index->IsNumber());
868 Handle<Object> result = RegExpImpl::Exec(regexp, subject, index); 870 Handle<Object> result = RegExpImpl::Exec(regexp, subject, index, captures);
869 if (result.is_null()) return Failure::Exception(); 871 if (result.is_null()) return Failure::Exception();
870 return *result; 872 return *result;
871 } 873 }
872 874
873 875
874 static Object* Runtime_RegExpExecGlobal(Arguments args) { 876 static Object* Runtime_RegExpExecGlobal(Arguments args) {
875 HandleScope scope; 877 HandleScope scope;
876 ASSERT(args.length() == 2); 878 ASSERT(args.length() == 3);
877 CONVERT_CHECKED(JSRegExp, raw_regexp, args[0]); 879 CONVERT_CHECKED(JSRegExp, raw_regexp, args[0]);
878 Handle<JSRegExp> regexp(raw_regexp); 880 Handle<JSRegExp> regexp(raw_regexp);
879 CONVERT_CHECKED(String, raw_subject, args[1]); 881 CONVERT_CHECKED(String, raw_subject, args[1]);
880 Handle<String> subject(raw_subject); 882 Handle<String> subject(raw_subject);
881 Handle<Object> result = RegExpImpl::ExecGlobal(regexp, subject); 883 CONVERT_CHECKED(JSArray, raw_captures, args[2]);
884 Handle<JSArray> captures(raw_captures);
885 Handle<Object> result =
886 RegExpImpl::ExecGlobal(regexp, subject, captures);
882 if (result.is_null()) return Failure::Exception(); 887 if (result.is_null()) return Failure::Exception();
883 return *result; 888 return *result;
884 } 889 }
885 890
886 891
887 static Object* Runtime_MaterializeRegExpLiteral(Arguments args) { 892 static Object* Runtime_MaterializeRegExpLiteral(Arguments args) {
888 HandleScope scope; 893 HandleScope scope;
889 ASSERT(args.length() == 4); 894 ASSERT(args.length() == 4);
890 CONVERT_ARG_CHECKED(FixedArray, literals, 0); 895 CONVERT_ARG_CHECKED(FixedArray, literals, 0);
891 int index = Smi::cast(args[1])->value(); 896 int index = Smi::cast(args[1])->value();
(...skipping 5220 matching lines...) Expand 10 before | Expand all | Expand 10 after
6112 } else { 6117 } else {
6113 // Handle last resort GC and make sure to allow future allocations 6118 // Handle last resort GC and make sure to allow future allocations
6114 // to grow the heap without causing GCs (if possible). 6119 // to grow the heap without causing GCs (if possible).
6115 Counters::gc_last_resort_from_js.Increment(); 6120 Counters::gc_last_resort_from_js.Increment();
6116 Heap::CollectAllGarbage(); 6121 Heap::CollectAllGarbage();
6117 } 6122 }
6118 } 6123 }
6119 6124
6120 6125
6121 } } // namespace v8::internal 6126 } } // namespace v8::internal
OLDNEW
« src/macros.py ('K') | « src/runtime.h ('k') | src/string.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698