Commit 7b4bae3a authored by Frank Tang's avatar Frank Tang Committed by Commit Bot

Add flag for Intl BestFitMatcher

Make it ready to stage with harmony_intl_best_fit_matcher flag

Bug: v8:11584
Change-Id: Ia6b9057b94dabe2a1edbea6855e2c42759ae1d5f
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2773796
Commit-Queue: Frank Tang <ftang@chromium.org>
Reviewed-by: 's avatarJakob Kummerow <jkummerow@chromium.org>
Reviewed-by: 's avatarShu-yu Guo <syg@chromium.org>
Cr-Commit-Position: refs/heads/master@{#73586}
parent 34c37396
......@@ -260,8 +260,9 @@ DEFINE_IMPLICATION(harmony_weak_refs_with_cleanup_some, harmony_weak_refs)
V(harmony_import_assertions, "harmony import assertions")
#ifdef V8_INTL_SUPPORT
#define HARMONY_INPROGRESS(V) \
HARMONY_INPROGRESS_BASE(V) \
#define HARMONY_INPROGRESS(V) \
HARMONY_INPROGRESS_BASE(V) \
V(harmony_intl_best_fit_matcher, "Intl BestFitMatcher") \
V(harmony_intl_displaynames_date_types, "Intl.DisplayNames date types")
#else
#define HARMONY_INPROGRESS(V) HARMONY_INPROGRESS_BASE(V)
......
......@@ -4327,6 +4327,7 @@ EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_private_brand_checks)
EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_class_static_blocks)
#ifdef V8_INTL_SUPPORT
EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_intl_best_fit_matcher)
EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_intl_displaynames_date_types)
EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_intl_dateformat_day_period)
#endif // V8_INTL_SUPPORT
......
......@@ -1599,10 +1599,6 @@ Handle<JSArray> CreateArrayFromList(Isolate* isolate,
return array;
}
// To mitigate the risk of bestfit locale matcher, we first check in without
// turnning it on.
static bool implement_bestfit = false;
// ECMA 402 9.2.9 SupportedLocales(availableLocales, requestedLocales, options)
// https://tc39.github.io/ecma402/#sec-supportedlocales
MaybeHandle<JSObject> SupportedLocales(
......@@ -1627,7 +1623,8 @@ MaybeHandle<JSObject> SupportedLocales(
// 3. If matcher is "best fit", then
// a. Let supportedLocales be BestFitSupportedLocales(availableLocales,
// requestedLocales).
if (matcher == Intl::MatcherOption::kBestFit && implement_bestfit) {
if (matcher == Intl::MatcherOption::kBestFit &&
FLAG_harmony_intl_best_fit_matcher) {
supported_locales =
BestFitSupportedLocales(isolate, available_locales, requested_locales);
} else {
......@@ -1884,7 +1881,8 @@ Maybe<Intl::ResolvedLocale> Intl::ResolveLocale(
const std::vector<std::string>& requested_locales, MatcherOption matcher,
const std::set<std::string>& relevant_extension_keys) {
std::string locale;
if (matcher == Intl::MatcherOption::kBestFit && implement_bestfit) {
if (matcher == Intl::MatcherOption::kBestFit &&
FLAG_harmony_intl_best_fit_matcher) {
locale = BestFitMatcher(isolate, available_locales, requested_locales);
} else {
locale = LookupMatcher(isolate, available_locales, requested_locales);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment