OLD | NEW |
---|---|
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 | 5 |
6 #ifdef V8_I18N_SUPPORT | 6 #ifdef V8_I18N_SUPPORT |
7 #include "src/runtime/runtime-utils.h" | 7 #include "src/runtime/runtime-utils.h" |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 | 10 |
(...skipping 25 matching lines...) Expand all Loading... | |
36 #include "unicode/rbbi.h" | 36 #include "unicode/rbbi.h" |
37 #include "unicode/smpdtfmt.h" | 37 #include "unicode/smpdtfmt.h" |
38 #include "unicode/timezone.h" | 38 #include "unicode/timezone.h" |
39 #include "unicode/translit.h" | 39 #include "unicode/translit.h" |
40 #include "unicode/uchar.h" | 40 #include "unicode/uchar.h" |
41 #include "unicode/ucol.h" | 41 #include "unicode/ucol.h" |
42 #include "unicode/ucurr.h" | 42 #include "unicode/ucurr.h" |
43 #include "unicode/uloc.h" | 43 #include "unicode/uloc.h" |
44 #include "unicode/unistr.h" | 44 #include "unicode/unistr.h" |
45 #include "unicode/unum.h" | 45 #include "unicode/unum.h" |
46 #include "unicode/ustring.h" | |
47 #include "unicode/uvernum.h" | |
46 #include "unicode/uversion.h" | 48 #include "unicode/uversion.h" |
47 | 49 |
48 | 50 |
49 namespace v8 { | 51 namespace v8 { |
50 namespace internal { | 52 namespace internal { |
51 namespace { | 53 namespace { |
52 | 54 |
53 const UChar* GetUCharBufferFromFlat(const String::FlatContent& flat, | 55 const UChar* GetUCharBufferFromFlat(const String::FlatContent& flat, |
54 std::unique_ptr<uc16[]>* dest, | 56 std::unique_ptr<uc16[]>* dest, |
55 int32_t length) { | 57 int32_t length) { |
(...skipping 546 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
602 UCollationResult result; | 604 UCollationResult result; |
603 UErrorCode status = U_ZERO_ERROR; | 605 UErrorCode status = U_ZERO_ERROR; |
604 { | 606 { |
605 DisallowHeapAllocation no_gc; | 607 DisallowHeapAllocation no_gc; |
606 int32_t length1 = string1->length(); | 608 int32_t length1 = string1->length(); |
607 int32_t length2 = string2->length(); | 609 int32_t length2 = string2->length(); |
608 String::FlatContent flat1 = string1->GetFlatContent(); | 610 String::FlatContent flat1 = string1->GetFlatContent(); |
609 String::FlatContent flat2 = string2->GetFlatContent(); | 611 String::FlatContent flat2 = string2->GetFlatContent(); |
610 std::unique_ptr<uc16[]> sap1; | 612 std::unique_ptr<uc16[]> sap1; |
611 std::unique_ptr<uc16[]> sap2; | 613 std::unique_ptr<uc16[]> sap2; |
614 #if U_ICU_VERSION_MAJOR_NUM < 59 | |
612 const UChar* string_val1 = GetUCharBufferFromFlat(flat1, &sap1, length1); | 615 const UChar* string_val1 = GetUCharBufferFromFlat(flat1, &sap1, length1); |
613 const UChar* string_val2 = GetUCharBufferFromFlat(flat2, &sap2, length2); | 616 const UChar* string_val2 = GetUCharBufferFromFlat(flat2, &sap2, length2); |
617 #else | |
618 const char16_t* string_val1 = reinterpret_cast<const char16_t*>( | |
619 GetUCharBufferFromFlat(flat1, &sap1, length1)); | |
620 const char16_t* string_val2 = reinterpret_cast<const char16_t*>( | |
621 GetUCharBufferFromFlat(flat2, &sap2, length2)); | |
jungshik at Google
2017/03/08 22:56:53
Markus, can you change (or add an overload to) icu
| |
622 #endif | |
614 result = | 623 result = |
615 collator->compare(string_val1, length1, string_val2, length2, status); | 624 collator->compare(string_val1, length1, string_val2, length2, status); |
616 } | 625 } |
617 if (U_FAILURE(status)) return isolate->ThrowIllegalOperation(); | 626 if (U_FAILURE(status)) return isolate->ThrowIllegalOperation(); |
618 | 627 |
619 return *isolate->factory()->NewNumberFromInt(result); | 628 return *isolate->factory()->NewNumberFromInt(result); |
620 } | 629 } |
621 | 630 |
622 | 631 |
623 RUNTIME_FUNCTION(Runtime_StringNormalize) { | 632 RUNTIME_FUNCTION(Runtime_StringNormalize) { |
(...skipping 556 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1180 Handle<FixedArray> date_cache_version = | 1189 Handle<FixedArray> date_cache_version = |
1181 Handle<FixedArray>::cast(isolate->eternal_handles()->GetSingleton( | 1190 Handle<FixedArray>::cast(isolate->eternal_handles()->GetSingleton( |
1182 EternalHandles::DATE_CACHE_VERSION)); | 1191 EternalHandles::DATE_CACHE_VERSION)); |
1183 return date_cache_version->get(0); | 1192 return date_cache_version->get(0); |
1184 } | 1193 } |
1185 | 1194 |
1186 } // namespace internal | 1195 } // namespace internal |
1187 } // namespace v8 | 1196 } // namespace v8 |
1188 | 1197 |
1189 #endif // V8_I18N_SUPPORT | 1198 #endif // V8_I18N_SUPPORT |
OLD | NEW |