OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
457 resolved, | 457 resolved, |
458 isolate->factory()->NewStringFromAscii( | 458 isolate->factory()->NewStringFromAscii( |
459 CStrVector("maximumFractionDigits")), | 459 CStrVector("maximumFractionDigits")), |
460 isolate->factory()->NewNumberFromInt( | 460 isolate->factory()->NewNumberFromInt( |
461 number_format->getMaximumFractionDigits()), | 461 number_format->getMaximumFractionDigits()), |
462 NONE, | 462 NONE, |
463 kNonStrictMode); | 463 kNonStrictMode); |
464 | 464 |
465 Handle<String> key = isolate->factory()->NewStringFromAscii( | 465 Handle<String> key = isolate->factory()->NewStringFromAscii( |
466 CStrVector("minimumSignificantDigits")); | 466 CStrVector("minimumSignificantDigits")); |
467 if (resolved->HasLocalProperty(*key)) { | 467 if (JSReceiver::HasLocalProperty(resolved, key)) { |
468 JSObject::SetProperty( | 468 JSObject::SetProperty( |
469 resolved, | 469 resolved, |
470 isolate->factory()->NewStringFromAscii( | 470 isolate->factory()->NewStringFromAscii( |
471 CStrVector("minimumSignificantDigits")), | 471 CStrVector("minimumSignificantDigits")), |
472 isolate->factory()->NewNumberFromInt( | 472 isolate->factory()->NewNumberFromInt( |
473 number_format->getMinimumSignificantDigits()), | 473 number_format->getMinimumSignificantDigits()), |
474 NONE, | 474 NONE, |
475 kNonStrictMode); | 475 kNonStrictMode); |
476 } | 476 } |
477 | 477 |
478 key = isolate->factory()->NewStringFromAscii( | 478 key = isolate->factory()->NewStringFromAscii( |
479 CStrVector("maximumSignificantDigits")); | 479 CStrVector("maximumSignificantDigits")); |
480 if (resolved->HasLocalProperty(*key)) { | 480 if (JSReceiver::HasLocalProperty(resolved, key)) { |
481 JSObject::SetProperty( | 481 JSObject::SetProperty( |
482 resolved, | 482 resolved, |
483 isolate->factory()->NewStringFromAscii( | 483 isolate->factory()->NewStringFromAscii( |
484 CStrVector("maximumSignificantDigits")), | 484 CStrVector("maximumSignificantDigits")), |
485 isolate->factory()->NewNumberFromInt( | 485 isolate->factory()->NewNumberFromInt( |
486 number_format->getMaximumSignificantDigits()), | 486 number_format->getMaximumSignificantDigits()), |
487 NONE, | 487 NONE, |
488 kNonStrictMode); | 488 kNonStrictMode); |
489 } | 489 } |
490 | 490 |
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
848 | 848 |
849 return date_format; | 849 return date_format; |
850 } | 850 } |
851 | 851 |
852 | 852 |
853 icu::SimpleDateFormat* DateFormat::UnpackDateFormat( | 853 icu::SimpleDateFormat* DateFormat::UnpackDateFormat( |
854 Isolate* isolate, | 854 Isolate* isolate, |
855 Handle<JSObject> obj) { | 855 Handle<JSObject> obj) { |
856 Handle<String> key = | 856 Handle<String> key = |
857 isolate->factory()->NewStringFromAscii(CStrVector("dateFormat")); | 857 isolate->factory()->NewStringFromAscii(CStrVector("dateFormat")); |
858 if (obj->HasLocalProperty(*key)) { | 858 if (JSReceiver::HasLocalProperty(obj, key)) { |
859 return reinterpret_cast<icu::SimpleDateFormat*>( | 859 return reinterpret_cast<icu::SimpleDateFormat*>( |
860 obj->GetInternalField(0)); | 860 obj->GetInternalField(0)); |
861 } | 861 } |
862 | 862 |
863 return NULL; | 863 return NULL; |
864 } | 864 } |
865 | 865 |
866 | 866 |
867 void DateFormat::DeleteDateFormat(v8::Isolate* isolate, | 867 void DateFormat::DeleteDateFormat(v8::Isolate* isolate, |
868 Persistent<v8::Value>* object, | 868 Persistent<v8::Value>* object, |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
913 | 913 |
914 return number_format; | 914 return number_format; |
915 } | 915 } |
916 | 916 |
917 | 917 |
918 icu::DecimalFormat* NumberFormat::UnpackNumberFormat( | 918 icu::DecimalFormat* NumberFormat::UnpackNumberFormat( |
919 Isolate* isolate, | 919 Isolate* isolate, |
920 Handle<JSObject> obj) { | 920 Handle<JSObject> obj) { |
921 Handle<String> key = | 921 Handle<String> key = |
922 isolate->factory()->NewStringFromAscii(CStrVector("numberFormat")); | 922 isolate->factory()->NewStringFromAscii(CStrVector("numberFormat")); |
923 if (obj->HasLocalProperty(*key)) { | 923 if (JSReceiver::HasLocalProperty(obj, key)) { |
924 return reinterpret_cast<icu::DecimalFormat*>(obj->GetInternalField(0)); | 924 return reinterpret_cast<icu::DecimalFormat*>(obj->GetInternalField(0)); |
925 } | 925 } |
926 | 926 |
927 return NULL; | 927 return NULL; |
928 } | 928 } |
929 | 929 |
930 | 930 |
931 void NumberFormat::DeleteNumberFormat(v8::Isolate* isolate, | 931 void NumberFormat::DeleteNumberFormat(v8::Isolate* isolate, |
932 Persistent<v8::Value>* object, | 932 Persistent<v8::Value>* object, |
933 void* param) { | 933 void* param) { |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
974 } | 974 } |
975 | 975 |
976 return collator; | 976 return collator; |
977 } | 977 } |
978 | 978 |
979 | 979 |
980 icu::Collator* Collator::UnpackCollator(Isolate* isolate, | 980 icu::Collator* Collator::UnpackCollator(Isolate* isolate, |
981 Handle<JSObject> obj) { | 981 Handle<JSObject> obj) { |
982 Handle<String> key = | 982 Handle<String> key = |
983 isolate->factory()->NewStringFromAscii(CStrVector("collator")); | 983 isolate->factory()->NewStringFromAscii(CStrVector("collator")); |
984 if (obj->HasLocalProperty(*key)) { | 984 if (JSReceiver::HasLocalProperty(obj, key)) { |
985 return reinterpret_cast<icu::Collator*>(obj->GetInternalField(0)); | 985 return reinterpret_cast<icu::Collator*>(obj->GetInternalField(0)); |
986 } | 986 } |
987 | 987 |
988 return NULL; | 988 return NULL; |
989 } | 989 } |
990 | 990 |
991 | 991 |
992 void Collator::DeleteCollator(v8::Isolate* isolate, | 992 void Collator::DeleteCollator(v8::Isolate* isolate, |
993 Persistent<v8::Value>* object, | 993 Persistent<v8::Value>* object, |
994 void* param) { | 994 void* param) { |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1038 } | 1038 } |
1039 | 1039 |
1040 return break_iterator; | 1040 return break_iterator; |
1041 } | 1041 } |
1042 | 1042 |
1043 | 1043 |
1044 icu::BreakIterator* BreakIterator::UnpackBreakIterator(Isolate* isolate, | 1044 icu::BreakIterator* BreakIterator::UnpackBreakIterator(Isolate* isolate, |
1045 Handle<JSObject> obj) { | 1045 Handle<JSObject> obj) { |
1046 Handle<String> key = | 1046 Handle<String> key = |
1047 isolate->factory()->NewStringFromAscii(CStrVector("breakIterator")); | 1047 isolate->factory()->NewStringFromAscii(CStrVector("breakIterator")); |
1048 if (obj->HasLocalProperty(*key)) { | 1048 if (JSReceiver::HasLocalProperty(obj, key)) { |
1049 return reinterpret_cast<icu::BreakIterator*>(obj->GetInternalField(0)); | 1049 return reinterpret_cast<icu::BreakIterator*>(obj->GetInternalField(0)); |
1050 } | 1050 } |
1051 | 1051 |
1052 return NULL; | 1052 return NULL; |
1053 } | 1053 } |
1054 | 1054 |
1055 | 1055 |
1056 void BreakIterator::DeleteBreakIterator(v8::Isolate* isolate, | 1056 void BreakIterator::DeleteBreakIterator(v8::Isolate* isolate, |
1057 Persistent<v8::Value>* object, | 1057 Persistent<v8::Value>* object, |
1058 void* param) { | 1058 void* param) { |
1059 // First delete the hidden C++ object. | 1059 // First delete the hidden C++ object. |
1060 delete reinterpret_cast<icu::BreakIterator*>(Handle<JSObject>::cast( | 1060 delete reinterpret_cast<icu::BreakIterator*>(Handle<JSObject>::cast( |
1061 v8::Utils::OpenPersistent(object))->GetInternalField(0)); | 1061 v8::Utils::OpenPersistent(object))->GetInternalField(0)); |
1062 | 1062 |
1063 delete reinterpret_cast<icu::UnicodeString*>(Handle<JSObject>::cast( | 1063 delete reinterpret_cast<icu::UnicodeString*>(Handle<JSObject>::cast( |
1064 v8::Utils::OpenPersistent(object))->GetInternalField(1)); | 1064 v8::Utils::OpenPersistent(object))->GetInternalField(1)); |
1065 | 1065 |
1066 // Then dispose of the persistent handle to JS object. | 1066 // Then dispose of the persistent handle to JS object. |
1067 object->Dispose(); | 1067 object->Dispose(); |
1068 } | 1068 } |
1069 | 1069 |
1070 } } // namespace v8::internal | 1070 } } // namespace v8::internal |
OLD | NEW |