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

Side by Side Diff: src/runtime.cc

Issue 12217071: Combine %_SubString and %_StringCharAt. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 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
« no previous file with comments | « src/regexp.js ('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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 3529 matching lines...) Expand 10 before | Expand all | Expand 10 after
3540 } else { 3540 } else {
3541 CONVERT_DOUBLE_ARG_CHECKED(from_number, 1); 3541 CONVERT_DOUBLE_ARG_CHECKED(from_number, 1);
3542 CONVERT_DOUBLE_ARG_CHECKED(to_number, 2); 3542 CONVERT_DOUBLE_ARG_CHECKED(to_number, 2);
3543 start = FastD2IChecked(from_number); 3543 start = FastD2IChecked(from_number);
3544 end = FastD2IChecked(to_number); 3544 end = FastD2IChecked(to_number);
3545 } 3545 }
3546 RUNTIME_ASSERT(end >= start); 3546 RUNTIME_ASSERT(end >= start);
3547 RUNTIME_ASSERT(start >= 0); 3547 RUNTIME_ASSERT(start >= 0);
3548 RUNTIME_ASSERT(end <= value->length()); 3548 RUNTIME_ASSERT(end <= value->length());
3549 isolate->counters()->sub_string_runtime()->Increment(); 3549 isolate->counters()->sub_string_runtime()->Increment();
3550 if (end - start == 1) {
3551 return isolate->heap()->LookupSingleCharacterStringFromCode(
3552 value->Get(start));
3553 }
3550 return value->SubString(start, end); 3554 return value->SubString(start, end);
3551 } 3555 }
3552 3556
3553 3557
3554 RUNTIME_FUNCTION(MaybeObject*, Runtime_StringMatch) { 3558 RUNTIME_FUNCTION(MaybeObject*, Runtime_StringMatch) {
3555 ASSERT_EQ(3, args.length()); 3559 ASSERT_EQ(3, args.length());
3556 3560
3557 CONVERT_ARG_HANDLE_CHECKED(String, subject, 0); 3561 CONVERT_ARG_HANDLE_CHECKED(String, subject, 0);
3558 CONVERT_ARG_HANDLE_CHECKED(JSRegExp, regexp, 1); 3562 CONVERT_ARG_HANDLE_CHECKED(JSRegExp, regexp, 1);
3559 CONVERT_ARG_HANDLE_CHECKED(JSArray, regexp_info, 2); 3563 CONVERT_ARG_HANDLE_CHECKED(JSArray, regexp_info, 2);
(...skipping 9968 matching lines...) Expand 10 before | Expand all | Expand 10 after
13528 // Handle last resort GC and make sure to allow future allocations 13532 // Handle last resort GC and make sure to allow future allocations
13529 // to grow the heap without causing GCs (if possible). 13533 // to grow the heap without causing GCs (if possible).
13530 isolate->counters()->gc_last_resort_from_js()->Increment(); 13534 isolate->counters()->gc_last_resort_from_js()->Increment();
13531 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, 13535 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags,
13532 "Runtime::PerformGC"); 13536 "Runtime::PerformGC");
13533 } 13537 }
13534 } 13538 }
13535 13539
13536 13540
13537 } } // namespace v8::internal 13541 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/regexp.js ('k') | src/string.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698