OLD | NEW |
1 // Copyright 2017 the V8 project authors. All rights reserved. | 1 // Copyright 2017 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 #ifndef V8_INTL_SUPPORT | 5 #ifndef V8_INTL_SUPPORT |
6 #error Internationalization is expected to be enabled. | 6 #error Internationalization is expected to be enabled. |
7 #endif // V8_INTL_SUPPORT | 7 #endif // V8_INTL_SUPPORT |
8 | 8 |
9 #include "src/builtins/builtins-utils.h" | 9 #include "src/builtins/builtins-utils.h" |
10 #include "src/builtins/builtins.h" | 10 #include "src/builtins/builtins.h" |
11 #include "src/intl.h" | 11 #include "src/intl.h" |
12 #include "src/objects-inl.h" | 12 #include "src/objects-inl.h" |
13 | 13 |
14 #include "unicode/normalizer2.h" | 14 #include "unicode/normalizer2.h" |
15 | 15 |
16 namespace v8 { | 16 namespace v8 { |
17 namespace internal { | 17 namespace internal { |
18 | 18 |
19 BUILTIN(StringPrototypeToLowerCaseIntl) { | |
20 HandleScope scope(isolate); | |
21 TO_THIS_STRING(string, "String.prototype.toLowerCase"); | |
22 string = String::Flatten(string); | |
23 return ConvertCase(string, false, isolate); | |
24 } | |
25 | |
26 BUILTIN(StringPrototypeToUpperCaseIntl) { | 19 BUILTIN(StringPrototypeToUpperCaseIntl) { |
27 HandleScope scope(isolate); | 20 HandleScope scope(isolate); |
28 TO_THIS_STRING(string, "String.prototype.toUpperCase"); | 21 TO_THIS_STRING(string, "String.prototype.toUpperCase"); |
29 string = String::Flatten(string); | 22 string = String::Flatten(string); |
30 return ConvertCase(string, true, isolate); | 23 return ConvertCase(string, true, isolate); |
31 } | 24 } |
32 | 25 |
33 BUILTIN(StringPrototypeNormalizeIntl) { | 26 BUILTIN(StringPrototypeNormalizeIntl) { |
34 HandleScope handle_scope(isolate); | 27 HandleScope handle_scope(isolate); |
35 TO_THIS_STRING(string, "String.prototype.normalize"); | 28 TO_THIS_STRING(string, "String.prototype.normalize"); |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 } | 92 } |
100 | 93 |
101 RETURN_RESULT_OR_FAILURE( | 94 RETURN_RESULT_OR_FAILURE( |
102 isolate, isolate->factory()->NewStringFromTwoByte(Vector<const uint16_t>( | 95 isolate, isolate->factory()->NewStringFromTwoByte(Vector<const uint16_t>( |
103 reinterpret_cast<const uint16_t*>(result.getBuffer()), | 96 reinterpret_cast<const uint16_t*>(result.getBuffer()), |
104 result.length()))); | 97 result.length()))); |
105 } | 98 } |
106 | 99 |
107 } // namespace internal | 100 } // namespace internal |
108 } // namespace v8 | 101 } // namespace v8 |
OLD | NEW |