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

Side by Side Diff: src/runtime.cc

Issue 88173002: Flatten cons string for single character substrings. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years 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/heap.cc ('k') | no next file » | 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 4445 matching lines...) Expand 10 before | Expand all | Expand 10 after
4456 } else { 4456 } else {
4457 CONVERT_DOUBLE_ARG_CHECKED(from_number, 1); 4457 CONVERT_DOUBLE_ARG_CHECKED(from_number, 1);
4458 CONVERT_DOUBLE_ARG_CHECKED(to_number, 2); 4458 CONVERT_DOUBLE_ARG_CHECKED(to_number, 2);
4459 start = FastD2IChecked(from_number); 4459 start = FastD2IChecked(from_number);
4460 end = FastD2IChecked(to_number); 4460 end = FastD2IChecked(to_number);
4461 } 4461 }
4462 RUNTIME_ASSERT(end >= start); 4462 RUNTIME_ASSERT(end >= start);
4463 RUNTIME_ASSERT(start >= 0); 4463 RUNTIME_ASSERT(start >= 0);
4464 RUNTIME_ASSERT(end <= value->length()); 4464 RUNTIME_ASSERT(end <= value->length());
4465 isolate->counters()->sub_string_runtime()->Increment(); 4465 isolate->counters()->sub_string_runtime()->Increment();
4466 if (end - start == 1) {
4467 return isolate->heap()->LookupSingleCharacterStringFromCode(
4468 value->Get(start));
4469 }
4470 return value->SubString(start, end); 4466 return value->SubString(start, end);
4471 } 4467 }
4472 4468
4473 4469
4474 RUNTIME_FUNCTION(MaybeObject*, Runtime_StringMatch) { 4470 RUNTIME_FUNCTION(MaybeObject*, Runtime_StringMatch) {
4475 HandleScope handles(isolate); 4471 HandleScope handles(isolate);
4476 ASSERT_EQ(3, args.length()); 4472 ASSERT_EQ(3, args.length());
4477 4473
4478 CONVERT_ARG_HANDLE_CHECKED(String, subject, 0); 4474 CONVERT_ARG_HANDLE_CHECKED(String, subject, 0);
4479 CONVERT_ARG_HANDLE_CHECKED(JSRegExp, regexp, 1); 4475 CONVERT_ARG_HANDLE_CHECKED(JSRegExp, regexp, 1);
(...skipping 10427 matching lines...) Expand 10 before | Expand all | Expand 10 after
14907 // Handle last resort GC and make sure to allow future allocations 14903 // Handle last resort GC and make sure to allow future allocations
14908 // to grow the heap without causing GCs (if possible). 14904 // to grow the heap without causing GCs (if possible).
14909 isolate->counters()->gc_last_resort_from_js()->Increment(); 14905 isolate->counters()->gc_last_resort_from_js()->Increment();
14910 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, 14906 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags,
14911 "Runtime::PerformGC"); 14907 "Runtime::PerformGC");
14912 } 14908 }
14913 } 14909 }
14914 14910
14915 14911
14916 } } // namespace v8::internal 14912 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/heap.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698