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

Unified Diff: src/runtime/runtime-strings.cc

Issue 2018963002: [builtins] Migrate String.prototype.trim/trimLeft/trimRight to C++. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Address Franziskas comments. Created 4 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/runtime/runtime.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/runtime/runtime-strings.cc
diff --git a/src/runtime/runtime-strings.cc b/src/runtime/runtime-strings.cc
index a26760314c4fd8ddcb2144f1ff3e28f6de3c6f62..8df345313698e197ae3384456f321c989e096f86 100644
--- a/src/runtime/runtime-strings.cc
+++ b/src/runtime/runtime-strings.cc
@@ -1088,39 +1088,6 @@ RUNTIME_FUNCTION(Runtime_StringToUpperCase) {
return ConvertCase(s, isolate, isolate->runtime_state()->to_upper_mapping());
}
-
-RUNTIME_FUNCTION(Runtime_StringTrim) {
- HandleScope scope(isolate);
- DCHECK(args.length() == 3);
-
- CONVERT_ARG_HANDLE_CHECKED(String, string, 0);
- CONVERT_BOOLEAN_ARG_CHECKED(trimLeft, 1);
- CONVERT_BOOLEAN_ARG_CHECKED(trimRight, 2);
-
- string = String::Flatten(string);
- int length = string->length();
-
- int left = 0;
- UnicodeCache* unicode_cache = isolate->unicode_cache();
- if (trimLeft) {
- while (left < length &&
- unicode_cache->IsWhiteSpaceOrLineTerminator(string->Get(left))) {
- left++;
- }
- }
-
- int right = length;
- if (trimRight) {
- while (
- right > left &&
- unicode_cache->IsWhiteSpaceOrLineTerminator(string->Get(right - 1))) {
- right--;
- }
- }
-
- return *isolate->factory()->NewSubString(string, left, right);
-}
-
RUNTIME_FUNCTION(Runtime_StringLessThan) {
HandleScope handle_scope(isolate);
DCHECK_EQ(2, args.length());
« no previous file with comments | « src/runtime/runtime.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698