| 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" |
| 46 #include "unicode/uversion.h" | 47 #include "unicode/uversion.h" |
| 47 | 48 |
| 48 | 49 |
| 49 namespace v8 { | 50 namespace v8 { |
| 50 namespace internal { | 51 namespace internal { |
| 51 namespace { | 52 namespace { |
| 52 | 53 |
| 53 const UChar* GetUCharBufferFromFlat(const String::FlatContent& flat, | 54 const UChar* GetUCharBufferFromFlat(const String::FlatContent& flat, |
| 54 std::unique_ptr<uc16[]>* dest, | 55 std::unique_ptr<uc16[]>* dest, |
| 55 int32_t length) { | 56 int32_t length) { |
| (...skipping 546 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 602 UCollationResult result; | 603 UCollationResult result; |
| 603 UErrorCode status = U_ZERO_ERROR; | 604 UErrorCode status = U_ZERO_ERROR; |
| 604 { | 605 { |
| 605 DisallowHeapAllocation no_gc; | 606 DisallowHeapAllocation no_gc; |
| 606 int32_t length1 = string1->length(); | 607 int32_t length1 = string1->length(); |
| 607 int32_t length2 = string2->length(); | 608 int32_t length2 = string2->length(); |
| 608 String::FlatContent flat1 = string1->GetFlatContent(); | 609 String::FlatContent flat1 = string1->GetFlatContent(); |
| 609 String::FlatContent flat2 = string2->GetFlatContent(); | 610 String::FlatContent flat2 = string2->GetFlatContent(); |
| 610 std::unique_ptr<uc16[]> sap1; | 611 std::unique_ptr<uc16[]> sap1; |
| 611 std::unique_ptr<uc16[]> sap2; | 612 std::unique_ptr<uc16[]> sap2; |
| 612 const UChar* string_val1 = GetUCharBufferFromFlat(flat1, &sap1, length1); | 613 icu::UnicodeString string_val1( |
| 613 const UChar* string_val2 = GetUCharBufferFromFlat(flat2, &sap2, length2); | 614 FALSE, GetUCharBufferFromFlat(flat1, &sap1, length1), length1); |
| 614 result = | 615 icu::UnicodeString string_val2( |
| 615 collator->compare(string_val1, length1, string_val2, length2, status); | 616 FALSE, GetUCharBufferFromFlat(flat2, &sap2, length2), length2); |
| 617 result = collator->compare(string_val1, string_val2, status); |
| 616 } | 618 } |
| 617 if (U_FAILURE(status)) return isolate->ThrowIllegalOperation(); | 619 if (U_FAILURE(status)) return isolate->ThrowIllegalOperation(); |
| 618 | 620 |
| 619 return *isolate->factory()->NewNumberFromInt(result); | 621 return *isolate->factory()->NewNumberFromInt(result); |
| 620 } | 622 } |
| 621 | 623 |
| 622 | 624 |
| 623 RUNTIME_FUNCTION(Runtime_StringNormalize) { | 625 RUNTIME_FUNCTION(Runtime_StringNormalize) { |
| 624 HandleScope scope(isolate); | 626 HandleScope scope(isolate); |
| 625 static const struct { | 627 static const struct { |
| (...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1180 Handle<FixedArray> date_cache_version = | 1182 Handle<FixedArray> date_cache_version = |
| 1181 Handle<FixedArray>::cast(isolate->eternal_handles()->GetSingleton( | 1183 Handle<FixedArray>::cast(isolate->eternal_handles()->GetSingleton( |
| 1182 EternalHandles::DATE_CACHE_VERSION)); | 1184 EternalHandles::DATE_CACHE_VERSION)); |
| 1183 return date_cache_version->get(0); | 1185 return date_cache_version->get(0); |
| 1184 } | 1186 } |
| 1185 | 1187 |
| 1186 } // namespace internal | 1188 } // namespace internal |
| 1187 } // namespace v8 | 1189 } // namespace v8 |
| 1188 | 1190 |
| 1189 #endif // V8_I18N_SUPPORT | 1191 #endif // V8_I18N_SUPPORT |
| OLD | NEW |