- Revision
- 283459
- Author
- [email protected]
- Date
- 2021-10-02 19:12:39 -0700 (Sat, 02 Oct 2021)
Log 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):
Modified Paths
Diff
Modified: trunk/Source/_javascript_Core/ChangeLog (283458 => 283459)
--- trunk/Source/_javascript_Core/ChangeLog 2021-10-03 02:11:46 UTC (rev 283458)
+++ trunk/Source/_javascript_Core/ChangeLog 2021-10-03 02:12:39 UTC (rev 283459)
@@ -1,5 +1,22 @@
2021-10-02 Yusuke Suzuki <[email protected]>
+ [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):
+
+2021-10-02 Yusuke Suzuki <[email protected]>
+
[JSC] Enable HAVE_ICU_U_DATE_INTERVAL_FORMAT_FORMAT_RANGE_TO_PARTS on Darwin OSS build
https://bugs.webkit.org/show_bug.cgi?id=231120
Modified: trunk/Source/_javascript_Core/runtime/IntlDisplayNames.cpp (283458 => 283459)
--- trunk/Source/_javascript_Core/runtime/IntlDisplayNames.cpp 2021-10-03 02:11:46 UTC (rev 283458)
+++ trunk/Source/_javascript_Core/runtime/IntlDisplayNames.cpp 2021-10-03 02:12:39 UTC (rev 283459)
@@ -110,7 +110,6 @@
m_languageDisplay = intlOption<LanguageDisplay>(globalObject, options, vm.propertyNames->languageDisplay, { { "dialect"_s, LanguageDisplay::Dialect }, { "standard"_s, LanguageDisplay::Standard } }, "languageDisplay must be either \"dialect\" or \"standard\""_s, LanguageDisplay::Dialect);
RETURN_IF_EXCEPTION(scope, void());
-#if HAVE(ICU_U_LOCALE_DISPLAY_NAMES)
UErrorCode status = U_ZERO_ERROR;
UDisplayContext contexts[] = {
@@ -138,10 +137,6 @@
throwTypeError(globalObject, scope, "failed to initialize DisplayNames"_s);
return;
}
-#else
- throwTypeError(globalObject, scope, "Failed to initialize Intl.DisplayNames since used feature is not supported in the linked ICU version"_s);
- return;
-#endif
}
// https://tc39.es/proposal-intl-displaynames/#sec-Intl.DisplayNames.prototype.of
@@ -151,7 +146,6 @@
VM& vm = globalObject->vm();
auto scope = DECLARE_THROW_SCOPE(vm);
-#if HAVE(ICU_U_LOCALE_DISPLAY_NAMES)
ASSERT(m_displayNames);
auto code = codeValue.toWTFString(globalObject);
RETURN_IF_EXCEPTION(scope, { });
@@ -356,11 +350,6 @@
return throwTypeError(globalObject, scope, "Failed to query a display name."_s);
}
return jsString(vm, String(buffer));
-#else
- UNUSED_PARAM(codeValue);
- throwTypeError(globalObject, scope, "Failed to initialize Intl.DisplayNames since used feature is not supported in the linked ICU version"_s);
- return { };
-#endif
}
// https://tc39.es/proposal-intl-displaynames/#sec-Intl.DisplayNames.prototype.resolvedOptions
Modified: trunk/Source/_javascript_Core/runtime/IntlDisplayNames.h (283458 => 283459)
--- trunk/Source/_javascript_Core/runtime/IntlDisplayNames.h 2021-10-03 02:11:46 UTC (rev 283458)
+++ trunk/Source/_javascript_Core/runtime/IntlDisplayNames.h 2021-10-03 02:12:39 UTC (rev 283459)
@@ -31,13 +31,6 @@
namespace JSC {
-#if !defined(HAVE_ICU_U_LOCALE_DISPLAY_NAMES)
-// We need 61 or later since part of implementation uses UCURR_NARROW_SYMBOL_NAME.
-#if U_ICU_VERSION_MAJOR_NUM >= 61
-#define HAVE_ICU_U_LOCALE_DISPLAY_NAMES 1
-#endif
-#endif
-
enum class RelevantExtensionKey : uint8_t;
class IntlDisplayNames final : public JSNonFinalObject {
Modified: trunk/Source/_javascript_Core/runtime/IntlObject.cpp (283458 => 283459)
--- trunk/Source/_javascript_Core/runtime/IntlObject.cpp 2021-10-03 02:11:46 UTC (rev 283458)
+++ trunk/Source/_javascript_Core/runtime/IntlObject.cpp 2021-10-03 02:12:39 UTC (rev 283459)
@@ -153,6 +153,7 @@
getCanonicalLocales intlObjectFuncGetCanonicalLocales DontEnum|Function 1
Collator createCollatorConstructor DontEnum|PropertyCallback
DateTimeFormat createDateTimeFormatConstructor DontEnum|PropertyCallback
+ DisplayNames createDisplayNamesConstructor DontEnum|PropertyCallback
Locale createLocaleConstructor DontEnum|PropertyCallback
NumberFormat createNumberFormatConstructor DontEnum|PropertyCallback
PluralRules createPluralRulesConstructor DontEnum|PropertyCallback
@@ -238,11 +239,6 @@
Base::finishCreation(vm);
ASSERT(inherits(vm, info()));
JSC_TO_STRING_TAG_WITHOUT_TRANSITION();
-#if HAVE(ICU_U_LOCALE_DISPLAY_NAMES)
- putDirectWithoutTransition(vm, vm.propertyNames->DisplayNames, createDisplayNamesConstructor(vm, this), static_cast<unsigned>(PropertyAttribute::DontEnum));
-#else
- UNUSED_PARAM(&createDisplayNamesConstructor);
-#endif
#if HAVE(ICU_U_LIST_FORMATTER)
putDirectWithoutTransition(vm, vm.propertyNames->ListFormat, createListFormatConstructor(vm, this), static_cast<unsigned>(PropertyAttribute::DontEnum));
#else