⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 283459 in webkit


Ignore:
Timestamp:
Oct 2, 2021, 7:12:39 PM (5 years ago)
Author:
ysuzuki@apple.com
Message:

[JSC] Enable Intl.DisplayNames without ICU version check
https://bugs.webkit.org/show_bug.cgi?id=231122

Reviewed by Ross Kirsling.

Now every port requires ICU 61.2 or later. Since Intl.DisplayNames requires ICU 61, we can enable it without ICU version check.
This simplifies Intl.DisplayNames code.

  • runtime/IntlDisplayNames.cpp:

(JSC::IntlDisplayNames::initializeDisplayNames):
(JSC::IntlDisplayNames::of const):

  • runtime/IntlDisplayNames.h:
  • runtime/IntlObject.cpp:

(JSC::IntlObject::finishCreation):

Location:
trunk/Source/JavaScriptCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r283445 r283459  
     12021-10-02  Yusuke Suzuki  <ysuzuki@apple.com>
     2
     3        [JSC] Enable Intl.DisplayNames without ICU version check
     4        https://bugs.webkit.org/show_bug.cgi?id=231122
     5
     6        Reviewed by Ross Kirsling.
     7
     8        Now every port requires ICU 61.2 or later. Since Intl.DisplayNames requires ICU 61, we can enable it without ICU version check.
     9        This simplifies Intl.DisplayNames code.
     10
     11        * runtime/IntlDisplayNames.cpp:
     12        (JSC::IntlDisplayNames::initializeDisplayNames):
     13        (JSC::IntlDisplayNames::of const):
     14        * runtime/IntlDisplayNames.h:
     15        * runtime/IntlObject.cpp:
     16        (JSC::IntlObject::finishCreation):
     17
    1182021-10-02  Yusuke Suzuki  <ysuzuki@apple.com>
    219
  • trunk/Source/JavaScriptCore/runtime/IntlDisplayNames.cpp

    r281375 r283459  
    111111    RETURN_IF_EXCEPTION(scope, void());
    112112
    113 #if HAVE(ICU_U_LOCALE_DISPLAY_NAMES)
    114113    UErrorCode status = U_ZERO_ERROR;
    115114
     
    139138        return;
    140139    }
    141 #else
    142     throwTypeError(globalObject, scope, "Failed to initialize Intl.DisplayNames since used feature is not supported in the linked ICU version"_s);
    143     return;
    144 #endif
    145140}
    146141
     
    152147    auto scope = DECLARE_THROW_SCOPE(vm);
    153148
    154 #if HAVE(ICU_U_LOCALE_DISPLAY_NAMES)
    155149    ASSERT(m_displayNames);
    156150    auto code = codeValue.toWTFString(globalObject);
     
    357351    }
    358352    return jsString(vm, String(buffer));
    359 #else
    360     UNUSED_PARAM(codeValue);
    361     throwTypeError(globalObject, scope, "Failed to initialize Intl.DisplayNames since used feature is not supported in the linked ICU version"_s);
    362     return { };
    363 #endif
    364353}
    365354
  • trunk/Source/JavaScriptCore/runtime/IntlDisplayNames.h

    r281375 r283459  
    3131
    3232namespace JSC {
    33 
    34 #if !defined(HAVE_ICU_U_LOCALE_DISPLAY_NAMES)
    35 // We need 61 or later since part of implementation uses UCURR_NARROW_SYMBOL_NAME.
    36 #if U_ICU_VERSION_MAJOR_NUM >= 61
    37 #define HAVE_ICU_U_LOCALE_DISPLAY_NAMES 1
    38 #endif
    39 #endif
    4033
    4134enum class RelevantExtensionKey : uint8_t;
  • trunk/Source/JavaScriptCore/runtime/IntlObject.cpp

    r282925 r283459  
    154154  Collator              createCollatorConstructor                    DontEnum|PropertyCallback
    155155  DateTimeFormat        createDateTimeFormatConstructor              DontEnum|PropertyCallback
     156  DisplayNames          createDisplayNamesConstructor                DontEnum|PropertyCallback
    156157  Locale                createLocaleConstructor                      DontEnum|PropertyCallback
    157158  NumberFormat          createNumberFormatConstructor                DontEnum|PropertyCallback
     
    239240    ASSERT(inherits(vm, info()));
    240241    JSC_TO_STRING_TAG_WITHOUT_TRANSITION();
    241 #if HAVE(ICU_U_LOCALE_DISPLAY_NAMES)
    242     putDirectWithoutTransition(vm, vm.propertyNames->DisplayNames, createDisplayNamesConstructor(vm, this), static_cast<unsigned>(PropertyAttribute::DontEnum));
    243 #else
    244     UNUSED_PARAM(&createDisplayNamesConstructor);
    245 #endif
    246242#if HAVE(ICU_U_LIST_FORMATTER)
    247243    putDirectWithoutTransition(vm, vm.propertyNames->ListFormat, createListFormatConstructor(vm, this), static_cast<unsigned>(PropertyAttribute::DontEnum));
Note: See TracChangeset for help on using the changeset viewer.