| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 // limitations under the License. | 4 // limitations under the License. |
| 5 | 5 |
| 6 #include "i18n.h" | 6 #include "i18n.h" |
| 7 | 7 |
| 8 #include "unicode/brkiter.h" | 8 #include "unicode/brkiter.h" |
| 9 #include "unicode/calendar.h" | 9 #include "unicode/calendar.h" |
| 10 #include "unicode/coll.h" | 10 #include "unicode/coll.h" |
| (...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 428 | 428 |
| 429 JSObject::SetProperty( | 429 JSObject::SetProperty( |
| 430 resolved, | 430 resolved, |
| 431 factory->NewStringFromStaticAscii("maximumFractionDigits"), | 431 factory->NewStringFromStaticAscii("maximumFractionDigits"), |
| 432 factory->NewNumberFromInt(number_format->getMaximumFractionDigits()), | 432 factory->NewNumberFromInt(number_format->getMaximumFractionDigits()), |
| 433 NONE, | 433 NONE, |
| 434 SLOPPY).Assert(); | 434 SLOPPY).Assert(); |
| 435 | 435 |
| 436 Handle<String> key = | 436 Handle<String> key = |
| 437 factory->NewStringFromStaticAscii("minimumSignificantDigits"); | 437 factory->NewStringFromStaticAscii("minimumSignificantDigits"); |
| 438 if (JSReceiver::HasLocalProperty(resolved, key)) { | 438 if (JSReceiver::HasOwnProperty(resolved, key)) { |
| 439 JSObject::SetProperty( | 439 JSObject::SetProperty( |
| 440 resolved, | 440 resolved, |
| 441 factory->NewStringFromStaticAscii("minimumSignificantDigits"), | 441 factory->NewStringFromStaticAscii("minimumSignificantDigits"), |
| 442 factory->NewNumberFromInt(number_format->getMinimumSignificantDigits()), | 442 factory->NewNumberFromInt(number_format->getMinimumSignificantDigits()), |
| 443 NONE, | 443 NONE, |
| 444 SLOPPY).Assert(); | 444 SLOPPY).Assert(); |
| 445 } | 445 } |
| 446 | 446 |
| 447 key = factory->NewStringFromStaticAscii("maximumSignificantDigits"); | 447 key = factory->NewStringFromStaticAscii("maximumSignificantDigits"); |
| 448 if (JSReceiver::HasLocalProperty(resolved, key)) { | 448 if (JSReceiver::HasOwnProperty(resolved, key)) { |
| 449 JSObject::SetProperty( | 449 JSObject::SetProperty( |
| 450 resolved, | 450 resolved, |
| 451 factory->NewStringFromStaticAscii("maximumSignificantDigits"), | 451 factory->NewStringFromStaticAscii("maximumSignificantDigits"), |
| 452 factory->NewNumberFromInt(number_format->getMaximumSignificantDigits()), | 452 factory->NewNumberFromInt(number_format->getMaximumSignificantDigits()), |
| 453 NONE, | 453 NONE, |
| 454 SLOPPY).Assert(); | 454 SLOPPY).Assert(); |
| 455 } | 455 } |
| 456 | 456 |
| 457 // Set the locale | 457 // Set the locale |
| 458 char result[ULOC_FULLNAME_CAPACITY]; | 458 char result[ULOC_FULLNAME_CAPACITY]; |
| (...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 816 | 816 |
| 817 return date_format; | 817 return date_format; |
| 818 } | 818 } |
| 819 | 819 |
| 820 | 820 |
| 821 icu::SimpleDateFormat* DateFormat::UnpackDateFormat( | 821 icu::SimpleDateFormat* DateFormat::UnpackDateFormat( |
| 822 Isolate* isolate, | 822 Isolate* isolate, |
| 823 Handle<JSObject> obj) { | 823 Handle<JSObject> obj) { |
| 824 Handle<String> key = | 824 Handle<String> key = |
| 825 isolate->factory()->NewStringFromStaticAscii("dateFormat"); | 825 isolate->factory()->NewStringFromStaticAscii("dateFormat"); |
| 826 if (JSReceiver::HasLocalProperty(obj, key)) { | 826 if (JSReceiver::HasOwnProperty(obj, key)) { |
| 827 return reinterpret_cast<icu::SimpleDateFormat*>( | 827 return reinterpret_cast<icu::SimpleDateFormat*>( |
| 828 obj->GetInternalField(0)); | 828 obj->GetInternalField(0)); |
| 829 } | 829 } |
| 830 | 830 |
| 831 return NULL; | 831 return NULL; |
| 832 } | 832 } |
| 833 | 833 |
| 834 | 834 |
| 835 template<class T> | 835 template<class T> |
| 836 void DeleteNativeObjectAt(const v8::WeakCallbackData<v8::Value, void>& data, | 836 void DeleteNativeObjectAt(const v8::WeakCallbackData<v8::Value, void>& data, |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 890 | 890 |
| 891 return number_format; | 891 return number_format; |
| 892 } | 892 } |
| 893 | 893 |
| 894 | 894 |
| 895 icu::DecimalFormat* NumberFormat::UnpackNumberFormat( | 895 icu::DecimalFormat* NumberFormat::UnpackNumberFormat( |
| 896 Isolate* isolate, | 896 Isolate* isolate, |
| 897 Handle<JSObject> obj) { | 897 Handle<JSObject> obj) { |
| 898 Handle<String> key = | 898 Handle<String> key = |
| 899 isolate->factory()->NewStringFromStaticAscii("numberFormat"); | 899 isolate->factory()->NewStringFromStaticAscii("numberFormat"); |
| 900 if (JSReceiver::HasLocalProperty(obj, key)) { | 900 if (JSReceiver::HasOwnProperty(obj, key)) { |
| 901 return reinterpret_cast<icu::DecimalFormat*>(obj->GetInternalField(0)); | 901 return reinterpret_cast<icu::DecimalFormat*>(obj->GetInternalField(0)); |
| 902 } | 902 } |
| 903 | 903 |
| 904 return NULL; | 904 return NULL; |
| 905 } | 905 } |
| 906 | 906 |
| 907 | 907 |
| 908 void NumberFormat::DeleteNumberFormat( | 908 void NumberFormat::DeleteNumberFormat( |
| 909 const v8::WeakCallbackData<v8::Value, void>& data) { | 909 const v8::WeakCallbackData<v8::Value, void>& data) { |
| 910 DeleteNativeObjectAt<icu::DecimalFormat>(data, 0); | 910 DeleteNativeObjectAt<icu::DecimalFormat>(data, 0); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 945 SetResolvedCollatorSettings(isolate, icu_locale, collator, resolved); | 945 SetResolvedCollatorSettings(isolate, icu_locale, collator, resolved); |
| 946 } | 946 } |
| 947 | 947 |
| 948 return collator; | 948 return collator; |
| 949 } | 949 } |
| 950 | 950 |
| 951 | 951 |
| 952 icu::Collator* Collator::UnpackCollator(Isolate* isolate, | 952 icu::Collator* Collator::UnpackCollator(Isolate* isolate, |
| 953 Handle<JSObject> obj) { | 953 Handle<JSObject> obj) { |
| 954 Handle<String> key = isolate->factory()->NewStringFromStaticAscii("collator"); | 954 Handle<String> key = isolate->factory()->NewStringFromStaticAscii("collator"); |
| 955 if (JSReceiver::HasLocalProperty(obj, key)) { | 955 if (JSReceiver::HasOwnProperty(obj, key)) { |
| 956 return reinterpret_cast<icu::Collator*>(obj->GetInternalField(0)); | 956 return reinterpret_cast<icu::Collator*>(obj->GetInternalField(0)); |
| 957 } | 957 } |
| 958 | 958 |
| 959 return NULL; | 959 return NULL; |
| 960 } | 960 } |
| 961 | 961 |
| 962 | 962 |
| 963 void Collator::DeleteCollator( | 963 void Collator::DeleteCollator( |
| 964 const v8::WeakCallbackData<v8::Value, void>& data) { | 964 const v8::WeakCallbackData<v8::Value, void>& data) { |
| 965 DeleteNativeObjectAt<icu::Collator>(data, 0); | 965 DeleteNativeObjectAt<icu::Collator>(data, 0); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1004 } | 1004 } |
| 1005 | 1005 |
| 1006 return break_iterator; | 1006 return break_iterator; |
| 1007 } | 1007 } |
| 1008 | 1008 |
| 1009 | 1009 |
| 1010 icu::BreakIterator* BreakIterator::UnpackBreakIterator(Isolate* isolate, | 1010 icu::BreakIterator* BreakIterator::UnpackBreakIterator(Isolate* isolate, |
| 1011 Handle<JSObject> obj) { | 1011 Handle<JSObject> obj) { |
| 1012 Handle<String> key = | 1012 Handle<String> key = |
| 1013 isolate->factory()->NewStringFromStaticAscii("breakIterator"); | 1013 isolate->factory()->NewStringFromStaticAscii("breakIterator"); |
| 1014 if (JSReceiver::HasLocalProperty(obj, key)) { | 1014 if (JSReceiver::HasOwnProperty(obj, key)) { |
| 1015 return reinterpret_cast<icu::BreakIterator*>(obj->GetInternalField(0)); | 1015 return reinterpret_cast<icu::BreakIterator*>(obj->GetInternalField(0)); |
| 1016 } | 1016 } |
| 1017 | 1017 |
| 1018 return NULL; | 1018 return NULL; |
| 1019 } | 1019 } |
| 1020 | 1020 |
| 1021 | 1021 |
| 1022 void BreakIterator::DeleteBreakIterator( | 1022 void BreakIterator::DeleteBreakIterator( |
| 1023 const v8::WeakCallbackData<v8::Value, void>& data) { | 1023 const v8::WeakCallbackData<v8::Value, void>& data) { |
| 1024 DeleteNativeObjectAt<icu::BreakIterator>(data, 0); | 1024 DeleteNativeObjectAt<icu::BreakIterator>(data, 0); |
| 1025 DeleteNativeObjectAt<icu::UnicodeString>(data, 1); | 1025 DeleteNativeObjectAt<icu::UnicodeString>(data, 1); |
| 1026 DestroyGlobalHandle(data); | 1026 DestroyGlobalHandle(data); |
| 1027 } | 1027 } |
| 1028 | 1028 |
| 1029 } } // namespace v8::internal | 1029 } } // namespace v8::internal |
| OLD | NEW |