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

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

Issue 1812673005: Use ICU case conversion/transliterator for case conversion behind a flag (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Yang's comment addressed - return right away for no-change 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 unified diff | Download patch
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/runtime/runtime-utils.h" 5 #include "src/runtime/runtime-utils.h"
6 6
7 #include "src/arguments.h" 7 #include "src/arguments.h"
8 #include "src/regexp/jsregexp-inl.h" 8 #include "src/regexp/jsregexp-inl.h"
9 #include "src/string-builder.h" 9 #include "src/string-builder.h"
10 #include "src/string-search.h" 10 #include "src/string-search.h"
(...skipping 1059 matching lines...) Expand 10 before | Expand all | Expand 10 after
1070 if (length < 0) length = -length; 1070 if (length < 0) length = -length;
1071 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( 1071 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
1072 isolate, result, isolate->factory()->NewRawTwoByteString(length)); 1072 isolate, result, isolate->factory()->NewRawTwoByteString(length));
1073 } 1073 }
1074 return ConvertCaseHelper(isolate, *s, *result, length, mapping); 1074 return ConvertCaseHelper(isolate, *s, *result, length, mapping);
1075 } 1075 }
1076 1076
1077 1077
1078 RUNTIME_FUNCTION(Runtime_StringToLowerCase) { 1078 RUNTIME_FUNCTION(Runtime_StringToLowerCase) {
1079 HandleScope scope(isolate); 1079 HandleScope scope(isolate);
1080 DCHECK(args.length() == 1); 1080 DCHECK_EQ(args.length(), 1);
1081 CONVERT_ARG_HANDLE_CHECKED(String, s, 0); 1081 CONVERT_ARG_HANDLE_CHECKED(String, s, 0);
1082 return ConvertCase(s, isolate, isolate->runtime_state()->to_lower_mapping()); 1082 return ConvertCase(s, isolate, isolate->runtime_state()->to_lower_mapping());
1083 } 1083 }
1084 1084
1085 1085
1086 RUNTIME_FUNCTION(Runtime_StringToUpperCase) { 1086 RUNTIME_FUNCTION(Runtime_StringToUpperCase) {
1087 HandleScope scope(isolate); 1087 HandleScope scope(isolate);
1088 DCHECK(args.length() == 1); 1088 DCHECK_EQ(args.length(), 1);
1089 CONVERT_ARG_HANDLE_CHECKED(String, s, 0); 1089 CONVERT_ARG_HANDLE_CHECKED(String, s, 0);
1090 return ConvertCase(s, isolate, isolate->runtime_state()->to_upper_mapping()); 1090 return ConvertCase(s, isolate, isolate->runtime_state()->to_upper_mapping());
1091 } 1091 }
1092 1092
1093 1093
1094 RUNTIME_FUNCTION(Runtime_StringTrim) { 1094 RUNTIME_FUNCTION(Runtime_StringTrim) {
1095 HandleScope scope(isolate); 1095 HandleScope scope(isolate);
1096 DCHECK(args.length() == 3); 1096 DCHECK(args.length() == 3);
1097 1097
1098 CONVERT_ARG_HANDLE_CHECKED(String, string, 0); 1098 CONVERT_ARG_HANDLE_CHECKED(String, string, 0);
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
1322 SealHandleScope shs(isolate); 1322 SealHandleScope shs(isolate);
1323 DCHECK(args.length() == 2); 1323 DCHECK(args.length() == 2);
1324 if (!args[0]->IsString()) return isolate->heap()->undefined_value(); 1324 if (!args[0]->IsString()) return isolate->heap()->undefined_value();
1325 if (!args[1]->IsNumber()) return isolate->heap()->undefined_value(); 1325 if (!args[1]->IsNumber()) return isolate->heap()->undefined_value();
1326 if (std::isinf(args.number_at(1))) return isolate->heap()->nan_value(); 1326 if (std::isinf(args.number_at(1))) return isolate->heap()->nan_value();
1327 return __RT_impl_Runtime_StringCharCodeAtRT(args, isolate); 1327 return __RT_impl_Runtime_StringCharCodeAtRT(args, isolate);
1328 } 1328 }
1329 1329
1330 } // namespace internal 1330 } // namespace internal
1331 } // namespace v8 1331 } // namespace v8
OLDNEW
« src/runtime/runtime-i18n.cc ('K') | « src/runtime/runtime-i18n.cc ('k') | src/v8.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698