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

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: Address Yang's comment 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/conversions-inl.h" 8 #include "src/conversions-inl.h"
9 #include "src/isolate-inl.h" 9 #include "src/isolate-inl.h"
10 #include "src/regexp/jsregexp-inl.h" 10 #include "src/regexp/jsregexp-inl.h"
(...skipping 1062 matching lines...) Expand 10 before | Expand all | Expand 10 after
1073 if (length < 0) length = -length; 1073 if (length < 0) length = -length;
1074 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( 1074 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
1075 isolate, result, isolate->factory()->NewRawTwoByteString(length)); 1075 isolate, result, isolate->factory()->NewRawTwoByteString(length));
1076 } 1076 }
1077 return ConvertCaseHelper(isolate, *s, *result, length, mapping); 1077 return ConvertCaseHelper(isolate, *s, *result, length, mapping);
1078 } 1078 }
1079 1079
1080 1080
1081 RUNTIME_FUNCTION(Runtime_StringToLowerCase) { 1081 RUNTIME_FUNCTION(Runtime_StringToLowerCase) {
1082 HandleScope scope(isolate); 1082 HandleScope scope(isolate);
1083 DCHECK(args.length() == 1); 1083 DCHECK_EQ(args.length(), 1);
1084 CONVERT_ARG_HANDLE_CHECKED(String, s, 0); 1084 CONVERT_ARG_HANDLE_CHECKED(String, s, 0);
1085 return ConvertCase(s, isolate, isolate->runtime_state()->to_lower_mapping()); 1085 return ConvertCase(s, isolate, isolate->runtime_state()->to_lower_mapping());
1086 } 1086 }
1087 1087
1088 1088
1089 RUNTIME_FUNCTION(Runtime_StringToUpperCase) { 1089 RUNTIME_FUNCTION(Runtime_StringToUpperCase) {
1090 HandleScope scope(isolate); 1090 HandleScope scope(isolate);
1091 DCHECK(args.length() == 1); 1091 DCHECK_EQ(args.length(), 1);
1092 CONVERT_ARG_HANDLE_CHECKED(String, s, 0); 1092 CONVERT_ARG_HANDLE_CHECKED(String, s, 0);
1093 return ConvertCase(s, isolate, isolate->runtime_state()->to_upper_mapping()); 1093 return ConvertCase(s, isolate, isolate->runtime_state()->to_upper_mapping());
1094 } 1094 }
1095 1095
1096 1096
1097 RUNTIME_FUNCTION(Runtime_StringTrim) { 1097 RUNTIME_FUNCTION(Runtime_StringTrim) {
1098 HandleScope scope(isolate); 1098 HandleScope scope(isolate);
1099 DCHECK(args.length() == 3); 1099 DCHECK(args.length() == 3);
1100 1100
1101 CONVERT_ARG_HANDLE_CHECKED(String, string, 0); 1101 CONVERT_ARG_HANDLE_CHECKED(String, string, 0);
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
1325 SealHandleScope shs(isolate); 1325 SealHandleScope shs(isolate);
1326 DCHECK(args.length() == 2); 1326 DCHECK(args.length() == 2);
1327 if (!args[0]->IsString()) return isolate->heap()->undefined_value(); 1327 if (!args[0]->IsString()) return isolate->heap()->undefined_value();
1328 if (!args[1]->IsNumber()) return isolate->heap()->undefined_value(); 1328 if (!args[1]->IsNumber()) return isolate->heap()->undefined_value();
1329 if (std::isinf(args.number_at(1))) return isolate->heap()->nan_value(); 1329 if (std::isinf(args.number_at(1))) return isolate->heap()->nan_value();
1330 return __RT_impl_Runtime_StringCharCodeAtRT(args, isolate); 1330 return __RT_impl_Runtime_StringCharCodeAtRT(args, isolate);
1331 } 1331 }
1332 1332
1333 } // namespace internal 1333 } // namespace internal
1334 } // namespace v8 1334 } // 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