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

Side by Side Diff: src/runtime.cc

Issue 525115: Add generated code for ascii string comparison... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 10 years, 11 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
« no previous file with comments | « src/ia32/codegen-ia32.cc ('k') | src/runtime.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-2009 the V8 project authors. All rights reserved. 1 // Copyright 2006-2009 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 1140 matching lines...) Expand 10 before | Expand all | Expand 10 after
1151 ASSERT(args.length() == 4); 1151 ASSERT(args.length() == 4);
1152 CONVERT_ARG_CHECKED(JSRegExp, regexp, 0); 1152 CONVERT_ARG_CHECKED(JSRegExp, regexp, 0);
1153 CONVERT_ARG_CHECKED(String, subject, 1); 1153 CONVERT_ARG_CHECKED(String, subject, 1);
1154 // Due to the way the JS calls are constructed this must be less than the 1154 // Due to the way the JS calls are constructed this must be less than the
1155 // length of a string, i.e. it is always a Smi. We check anyway for security. 1155 // length of a string, i.e. it is always a Smi. We check anyway for security.
1156 CONVERT_SMI_CHECKED(index, args[2]); 1156 CONVERT_SMI_CHECKED(index, args[2]);
1157 CONVERT_ARG_CHECKED(JSArray, last_match_info, 3); 1157 CONVERT_ARG_CHECKED(JSArray, last_match_info, 3);
1158 RUNTIME_ASSERT(last_match_info->HasFastElements()); 1158 RUNTIME_ASSERT(last_match_info->HasFastElements());
1159 RUNTIME_ASSERT(index >= 0); 1159 RUNTIME_ASSERT(index >= 0);
1160 RUNTIME_ASSERT(index <= subject->length()); 1160 RUNTIME_ASSERT(index <= subject->length());
1161 Counters::regexp_entry_runtime.Increment();
1161 Handle<Object> result = RegExpImpl::Exec(regexp, 1162 Handle<Object> result = RegExpImpl::Exec(regexp,
1162 subject, 1163 subject,
1163 index, 1164 index,
1164 last_match_info); 1165 last_match_info);
1165 if (result.is_null()) return Failure::Exception(); 1166 if (result.is_null()) return Failure::Exception();
1166 return *result; 1167 return *result;
1167 } 1168 }
1168 1169
1169 1170
1170 static Object* Runtime_MaterializeRegExpLiteral(Arguments args) { 1171 static Object* Runtime_MaterializeRegExpLiteral(Arguments args) {
(...skipping 3038 matching lines...) Expand 10 before | Expand all | Expand 10 after
4209 } 4210 }
4210 4211
4211 4212
4212 static Object* Runtime_StringCompare(Arguments args) { 4213 static Object* Runtime_StringCompare(Arguments args) {
4213 NoHandleAllocation ha; 4214 NoHandleAllocation ha;
4214 ASSERT(args.length() == 2); 4215 ASSERT(args.length() == 2);
4215 4216
4216 CONVERT_CHECKED(String, x, args[0]); 4217 CONVERT_CHECKED(String, x, args[0]);
4217 CONVERT_CHECKED(String, y, args[1]); 4218 CONVERT_CHECKED(String, y, args[1]);
4218 4219
4220 Counters::string_compare_runtime.Increment();
4221
4219 // A few fast case tests before we flatten. 4222 // A few fast case tests before we flatten.
4220 if (x == y) return Smi::FromInt(EQUAL); 4223 if (x == y) return Smi::FromInt(EQUAL);
4221 if (y->length() == 0) { 4224 if (y->length() == 0) {
4222 if (x->length() == 0) return Smi::FromInt(EQUAL); 4225 if (x->length() == 0) return Smi::FromInt(EQUAL);
4223 return Smi::FromInt(GREATER); 4226 return Smi::FromInt(GREATER);
4224 } else if (x->length() == 0) { 4227 } else if (x->length() == 0) {
4225 return Smi::FromInt(LESS); 4228 return Smi::FromInt(LESS);
4226 } 4229 }
4227 4230
4228 int d = x->Get(0) - y->Get(0); 4231 int d = x->Get(0) - y->Get(0);
(...skipping 3851 matching lines...) Expand 10 before | Expand all | Expand 10 after
8080 } else { 8083 } else {
8081 // Handle last resort GC and make sure to allow future allocations 8084 // Handle last resort GC and make sure to allow future allocations
8082 // to grow the heap without causing GCs (if possible). 8085 // to grow the heap without causing GCs (if possible).
8083 Counters::gc_last_resort_from_js.Increment(); 8086 Counters::gc_last_resort_from_js.Increment();
8084 Heap::CollectAllGarbage(false); 8087 Heap::CollectAllGarbage(false);
8085 } 8088 }
8086 } 8089 }
8087 8090
8088 8091
8089 } } // namespace v8::internal 8092 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/ia32/codegen-ia32.cc ('k') | src/runtime.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698