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

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

Issue 984963002: Intrinsics in the INLINE_FUNCTION_LIST are now avaliable without '_', too. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Platform ports. Created 5 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
« no previous file with comments | « src/runtime/runtime-regexp.cc ('k') | src/x64/code-stubs-x64.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/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/arguments.h" 7 #include "src/arguments.h"
8 #include "src/jsregexp-inl.h" 8 #include "src/jsregexp-inl.h"
9 #include "src/jsregexp.h" 9 #include "src/jsregexp.h"
10 #include "src/runtime/runtime-utils.h" 10 #include "src/runtime/runtime-utils.h"
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 for (int i = 0; i < end; i++) { 272 for (int i = 0; i < end; i++) {
273 if (flat1.Get(i) != flat2.Get(i)) { 273 if (flat1.Get(i) != flat2.Get(i)) {
274 return Smi::FromInt(flat1.Get(i) - flat2.Get(i)); 274 return Smi::FromInt(flat1.Get(i) - flat2.Get(i));
275 } 275 }
276 } 276 }
277 277
278 return Smi::FromInt(str1_length - str2_length); 278 return Smi::FromInt(str1_length - str2_length);
279 } 279 }
280 280
281 281
282 RUNTIME_FUNCTION(Runtime_SubString) { 282 RUNTIME_FUNCTION(Runtime_SubStringRT) {
283 HandleScope scope(isolate); 283 HandleScope scope(isolate);
284 DCHECK(args.length() == 3); 284 DCHECK(args.length() == 3);
285 285
286 CONVERT_ARG_HANDLE_CHECKED(String, string, 0); 286 CONVERT_ARG_HANDLE_CHECKED(String, string, 0);
287 int start, end; 287 int start, end;
288 // We have a fast integer-only case here to avoid a conversion to double in 288 // We have a fast integer-only case here to avoid a conversion to double in
289 // the common case where from and to are Smis. 289 // the common case where from and to are Smis.
290 if (args[1]->IsSmi() && args[2]->IsSmi()) { 290 if (args[1]->IsSmi() && args[2]->IsSmi()) {
291 CONVERT_SMI_ARG_CHECKED(from_number, 1); 291 CONVERT_SMI_ARG_CHECKED(from_number, 1);
292 CONVERT_SMI_ARG_CHECKED(to_number, 2); 292 CONVERT_SMI_ARG_CHECKED(to_number, 2);
293 start = from_number; 293 start = from_number;
294 end = to_number; 294 end = to_number;
295 } else { 295 } else {
296 CONVERT_DOUBLE_ARG_CHECKED(from_number, 1); 296 CONVERT_DOUBLE_ARG_CHECKED(from_number, 1);
297 CONVERT_DOUBLE_ARG_CHECKED(to_number, 2); 297 CONVERT_DOUBLE_ARG_CHECKED(to_number, 2);
298 start = FastD2IChecked(from_number); 298 start = FastD2IChecked(from_number);
299 end = FastD2IChecked(to_number); 299 end = FastD2IChecked(to_number);
300 } 300 }
301 RUNTIME_ASSERT(end >= start); 301 RUNTIME_ASSERT(end >= start);
302 RUNTIME_ASSERT(start >= 0); 302 RUNTIME_ASSERT(start >= 0);
303 RUNTIME_ASSERT(end <= string->length()); 303 RUNTIME_ASSERT(end <= string->length());
304 isolate->counters()->sub_string_runtime()->Increment(); 304 isolate->counters()->sub_string_runtime()->Increment();
305 305
306 return *isolate->factory()->NewSubString(string, start, end); 306 return *isolate->factory()->NewSubString(string, start, end);
307 } 307 }
308 308
309 309
310 RUNTIME_FUNCTION(Runtime_StringAdd) { 310 RUNTIME_FUNCTION(Runtime_SubString) {
311 SealHandleScope shs(isolate);
312 return __RT_impl_Runtime_SubStringRT(args, isolate);
313 }
314
315
316 RUNTIME_FUNCTION(Runtime_StringAddRT) {
311 HandleScope scope(isolate); 317 HandleScope scope(isolate);
312 DCHECK(args.length() == 2); 318 DCHECK(args.length() == 2);
313 CONVERT_ARG_HANDLE_CHECKED(String, str1, 0); 319 CONVERT_ARG_HANDLE_CHECKED(String, str1, 0);
314 CONVERT_ARG_HANDLE_CHECKED(String, str2, 1); 320 CONVERT_ARG_HANDLE_CHECKED(String, str2, 1);
315 isolate->counters()->string_add_runtime()->Increment(); 321 isolate->counters()->string_add_runtime()->Increment();
316 Handle<String> result; 322 Handle<String> result;
317 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( 323 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
318 isolate, result, isolate->factory()->NewConsString(str1, str2)); 324 isolate, result, isolate->factory()->NewConsString(str1, str2));
319 return *result; 325 return *result;
320 } 326 }
321 327
322 328
329 RUNTIME_FUNCTION(Runtime_StringAdd) {
330 SealHandleScope shs(isolate);
331 return __RT_impl_Runtime_StringAddRT(args, isolate);
332 }
333
334
323 RUNTIME_FUNCTION(Runtime_InternalizeString) { 335 RUNTIME_FUNCTION(Runtime_InternalizeString) {
324 HandleScope handles(isolate); 336 HandleScope handles(isolate);
325 RUNTIME_ASSERT(args.length() == 1); 337 RUNTIME_ASSERT(args.length() == 1);
326 CONVERT_ARG_HANDLE_CHECKED(String, string, 0); 338 CONVERT_ARG_HANDLE_CHECKED(String, string, 0);
327 return *isolate->factory()->InternalizeString(string); 339 return *isolate->factory()->InternalizeString(string);
328 } 340 }
329 341
330 342
331 RUNTIME_FUNCTION(Runtime_StringMatch) { 343 RUNTIME_FUNCTION(Runtime_StringMatch) {
332 HandleScope handles(isolate); 344 HandleScope handles(isolate);
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
407 DCHECK(args.length() == 1); 419 DCHECK(args.length() == 1);
408 if (args[0]->IsNumber()) { 420 if (args[0]->IsNumber()) {
409 CONVERT_NUMBER_CHECKED(uint32_t, code, Uint32, args[0]); 421 CONVERT_NUMBER_CHECKED(uint32_t, code, Uint32, args[0]);
410 code &= 0xffff; 422 code &= 0xffff;
411 return *isolate->factory()->LookupSingleCharacterStringFromCode(code); 423 return *isolate->factory()->LookupSingleCharacterStringFromCode(code);
412 } 424 }
413 return isolate->heap()->empty_string(); 425 return isolate->heap()->empty_string();
414 } 426 }
415 427
416 428
417 RUNTIME_FUNCTION(Runtime_StringCompare) { 429 RUNTIME_FUNCTION(Runtime_StringCompareRT) {
418 HandleScope handle_scope(isolate); 430 HandleScope handle_scope(isolate);
419 DCHECK(args.length() == 2); 431 DCHECK(args.length() == 2);
420 432
421 CONVERT_ARG_HANDLE_CHECKED(String, x, 0); 433 CONVERT_ARG_HANDLE_CHECKED(String, x, 0);
422 CONVERT_ARG_HANDLE_CHECKED(String, y, 1); 434 CONVERT_ARG_HANDLE_CHECKED(String, y, 1);
423 435
424 isolate->counters()->string_compare_runtime()->Increment(); 436 isolate->counters()->string_compare_runtime()->Increment();
425 437
426 // A few fast case tests before we flatten. 438 // A few fast case tests before we flatten.
427 if (x.is_identical_to(y)) return Smi::FromInt(EQUAL); 439 if (x.is_identical_to(y)) return Smi::FromInt(EQUAL);
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
476 Object* result; 488 Object* result;
477 if (r == 0) { 489 if (r == 0) {
478 result = equal_prefix_result; 490 result = equal_prefix_result;
479 } else { 491 } else {
480 result = (r < 0) ? Smi::FromInt(LESS) : Smi::FromInt(GREATER); 492 result = (r < 0) ? Smi::FromInt(LESS) : Smi::FromInt(GREATER);
481 } 493 }
482 return result; 494 return result;
483 } 495 }
484 496
485 497
498 RUNTIME_FUNCTION(Runtime_StringCompare) {
499 SealHandleScope shs(isolate);
500 return __RT_impl_Runtime_StringCompareRT(args, isolate);
501 }
502
503
486 RUNTIME_FUNCTION(Runtime_StringBuilderConcat) { 504 RUNTIME_FUNCTION(Runtime_StringBuilderConcat) {
487 HandleScope scope(isolate); 505 HandleScope scope(isolate);
488 DCHECK(args.length() == 3); 506 DCHECK(args.length() == 3);
489 CONVERT_ARG_HANDLE_CHECKED(JSArray, array, 0); 507 CONVERT_ARG_HANDLE_CHECKED(JSArray, array, 0);
490 int32_t array_length; 508 int32_t array_length;
491 if (!args[1]->ToInt32(&array_length)) { 509 if (!args[1]->ToInt32(&array_length)) {
492 THROW_NEW_ERROR_RETURN_FAILURE(isolate, NewInvalidStringLengthError()); 510 THROW_NEW_ERROR_RETURN_FAILURE(isolate, NewInvalidStringLengthError());
493 } 511 }
494 CONVERT_ARG_HANDLE_CHECKED(String, special, 2); 512 CONVERT_ARG_HANDLE_CHECKED(String, special, 2);
495 513
(...skipping 782 matching lines...) Expand 10 before | Expand all | Expand 10 after
1278 return __RT_impl_Runtime_StringCharCodeAtRT(args, isolate); 1296 return __RT_impl_Runtime_StringCharCodeAtRT(args, isolate);
1279 } 1297 }
1280 1298
1281 1299
1282 RUNTIME_FUNCTION(Runtime_IsStringWrapperSafeForDefaultValueOf) { 1300 RUNTIME_FUNCTION(Runtime_IsStringWrapperSafeForDefaultValueOf) {
1283 UNIMPLEMENTED(); 1301 UNIMPLEMENTED();
1284 return NULL; 1302 return NULL;
1285 } 1303 }
1286 } 1304 }
1287 } // namespace v8::internal 1305 } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/runtime/runtime-regexp.cc ('k') | src/x64/code-stubs-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698