Commit 25c11657 authored by Frank Tang's avatar Frank Tang Committed by Commit Bot

[Intl] Clean up by removing the following flags

  harmony_intl_bigint shipped in m76
  harmony_intl_date_format_range shipped in m76
  harmony_intl_datetime_style shipped in m76
  harmony_intl_numberformat_unified shipped in m77

Bug: v8:9272, v8:9273, v8:9274
Change-Id: Icc640e011021e691373bc61725013578b7185e50
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1799263
Commit-Queue: Frank Tang <ftang@chromium.org>
Reviewed-by: 's avatarJakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/master@{#63736}
parent 8a1a2867
...@@ -127,19 +127,16 @@ BUILTIN(BigIntPrototypeToLocaleString) { ...@@ -127,19 +127,16 @@ BUILTIN(BigIntPrototypeToLocaleString) {
HandleScope scope(isolate); HandleScope scope(isolate);
const char* method = "BigInt.prototype.toLocaleString"; const char* method = "BigInt.prototype.toLocaleString";
#ifdef V8_INTL_SUPPORT #ifdef V8_INTL_SUPPORT
if (FLAG_harmony_intl_bigint) { // 1. Let x be ? thisBigIntValue(this value).
// 1. Let x be ? thisBigIntValue(this value). Handle<BigInt> x;
Handle<BigInt> x; ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
ASSIGN_RETURN_FAILURE_ON_EXCEPTION( isolate, x, ThisBigIntValue(isolate, args.receiver(), method));
isolate, x, ThisBigIntValue(isolate, args.receiver(), method));
RETURN_RESULT_OR_FAILURE( RETURN_RESULT_OR_FAILURE(
isolate, isolate,
Intl::NumberToLocaleString(isolate, x, args.atOrUndefined(isolate, 1), Intl::NumberToLocaleString(isolate, x, args.atOrUndefined(isolate, 1),
args.atOrUndefined(isolate, 2), method)); args.atOrUndefined(isolate, 2), method));
} // Fallbacks to old toString implemention if no V8_INTL_SUPPORT
// Fallbacks to old toString implemention if flag is off or no
// V8_INTL_SUPPORT
#endif // V8_INTL_SUPPORT #endif // V8_INTL_SUPPORT
Handle<Object> radix = isolate->factory()->undefined_value(); Handle<Object> radix = isolate->factory()->undefined_value();
return BigIntToStringImpl(args.receiver(), radix, isolate, method); return BigIntToStringImpl(args.receiver(), radix, isolate, method);
......
...@@ -83,13 +83,8 @@ BUILTIN(NumberFormatPrototypeFormatToParts) { ...@@ -83,13 +83,8 @@ BUILTIN(NumberFormatPrototypeFormatToParts) {
Handle<Object> x; Handle<Object> x;
if (args.length() >= 2) { if (args.length() >= 2) {
if (FLAG_harmony_intl_bigint) { ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, x,
ASSIGN_RETURN_FAILURE_ON_EXCEPTION( Object::ToNumeric(isolate, args.at(1)));
isolate, x, Object::ToNumeric(isolate, args.at(1)));
} else {
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, x,
Object::ToNumber(isolate, args.at(1)));
}
} else { } else {
x = isolate->factory()->nan_value(); x = isolate->factory()->nan_value();
} }
...@@ -468,13 +463,8 @@ BUILTIN(NumberFormatInternalFormatNumber) { ...@@ -468,13 +463,8 @@ BUILTIN(NumberFormatInternalFormatNumber) {
// 4. Let x be ? ToNumeric(value). // 4. Let x be ? ToNumeric(value).
Handle<Object> numeric_obj; Handle<Object> numeric_obj;
if (FLAG_harmony_intl_bigint) { ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, numeric_obj,
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, numeric_obj, Object::ToNumeric(isolate, value));
Object::ToNumeric(isolate, value));
} else {
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, numeric_obj,
Object::ToNumber(isolate, value));
}
icu::number::LocalizedNumberFormatter* icu_localized_number_formatter = icu::number::LocalizedNumberFormatter* icu_localized_number_formatter =
number_format->icu_number_formatter().raw(); number_format->icu_number_formatter().raw();
......
...@@ -246,12 +246,7 @@ DEFINE_IMPLICATION(harmony_import_meta, harmony_dynamic_import) ...@@ -246,12 +246,7 @@ DEFINE_IMPLICATION(harmony_import_meta, harmony_dynamic_import)
V(harmony_promise_all_settled, "harmony Promise.allSettled") V(harmony_promise_all_settled, "harmony Promise.allSettled")
#ifdef V8_INTL_SUPPORT #ifdef V8_INTL_SUPPORT
#define HARMONY_SHIPPING(V) \ #define HARMONY_SHIPPING(V) HARMONY_SHIPPING_BASE(V)
HARMONY_SHIPPING_BASE(V) \
V(harmony_intl_bigint, "BigInt.prototype.toLocaleString") \
V(harmony_intl_date_format_range, "DateTimeFormat formatRange") \
V(harmony_intl_datetime_style, "dateStyle timeStyle for DateTimeFormat") \
V(harmony_intl_numberformat_unified, "Unified Intl.NumberFormat Features")
#else #else
#define HARMONY_SHIPPING(V) HARMONY_SHIPPING_BASE(V) #define HARMONY_SHIPPING(V) HARMONY_SHIPPING_BASE(V)
#endif #endif
......
...@@ -2917,6 +2917,13 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object, ...@@ -2917,6 +2917,13 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object,
SimpleInstallGetter(isolate_, prototype, factory->format_string(), SimpleInstallGetter(isolate_, prototype, factory->format_string(),
Builtins::kDateTimeFormatPrototypeFormat, false); Builtins::kDateTimeFormatPrototypeFormat, false);
SimpleInstallFunction(isolate_, prototype, "formatRange",
Builtins::kDateTimeFormatPrototypeFormatRange, 2,
false);
SimpleInstallFunction(
isolate_, prototype, "formatRangeToParts",
Builtins::kDateTimeFormatPrototypeFormatRangeToParts, 2, false);
} }
{ // -- N u m b e r F o r m a t { // -- N u m b e r F o r m a t
...@@ -4271,13 +4278,10 @@ EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_nullish) ...@@ -4271,13 +4278,10 @@ EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_nullish)
#ifdef V8_INTL_SUPPORT #ifdef V8_INTL_SUPPORT
EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_intl_add_calendar_numbering_system) EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_intl_add_calendar_numbering_system)
EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_intl_bigint)
EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_intl_dateformat_day_period) EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_intl_dateformat_day_period)
EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE( EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(
harmony_intl_dateformat_fractional_second_digits) harmony_intl_dateformat_fractional_second_digits)
EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_intl_dateformat_quarter) EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_intl_dateformat_quarter)
EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_intl_datetime_style)
EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_intl_numberformat_unified)
#endif // V8_INTL_SUPPORT #endif // V8_INTL_SUPPORT
#undef EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE #undef EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE
...@@ -4436,32 +4440,6 @@ void Genesis::InitializeGlobal_harmony_regexp_match_indices() { ...@@ -4436,32 +4440,6 @@ void Genesis::InitializeGlobal_harmony_regexp_match_indices() {
#ifdef V8_INTL_SUPPORT #ifdef V8_INTL_SUPPORT
void Genesis::InitializeGlobal_harmony_intl_date_format_range() {
if (!FLAG_harmony_intl_date_format_range) return;
Handle<JSObject> intl = Handle<JSObject>::cast(
JSReceiver::GetProperty(
isolate(),
Handle<JSReceiver>(native_context()->global_object(), isolate()),
factory()->InternalizeUtf8String("Intl"))
.ToHandleChecked());
Handle<JSFunction> date_time_format_constructor = Handle<JSFunction>::cast(
JSReceiver::GetProperty(
isolate(), intl, factory()->InternalizeUtf8String("DateTimeFormat"))
.ToHandleChecked());
Handle<JSObject> prototype(
JSObject::cast(date_time_format_constructor->prototype()), isolate_);
SimpleInstallFunction(isolate_, prototype, "formatRange",
Builtins::kDateTimeFormatPrototypeFormatRange, 2,
false);
SimpleInstallFunction(isolate_, prototype, "formatRangeToParts",
Builtins::kDateTimeFormatPrototypeFormatRangeToParts, 2,
false);
}
void Genesis::InitializeGlobal_harmony_intl_segmenter() { void Genesis::InitializeGlobal_harmony_intl_segmenter() {
if (!FLAG_harmony_intl_segmenter) return; if (!FLAG_harmony_intl_segmenter) return;
Handle<JSObject> intl = Handle<JSObject>::cast( Handle<JSObject> intl = Handle<JSObject>::cast(
......
...@@ -1086,13 +1086,8 @@ MaybeHandle<String> Intl::NumberToLocaleString(Isolate* isolate, ...@@ -1086,13 +1086,8 @@ MaybeHandle<String> Intl::NumberToLocaleString(Isolate* isolate,
Handle<Object> options, Handle<Object> options,
const char* method) { const char* method) {
Handle<Object> numeric_obj; Handle<Object> numeric_obj;
if (FLAG_harmony_intl_bigint) { ASSIGN_RETURN_ON_EXCEPTION(isolate, numeric_obj,
ASSIGN_RETURN_ON_EXCEPTION(isolate, numeric_obj, Object::ToNumeric(isolate, num), String);
Object::ToNumeric(isolate, num), String);
} else {
ASSIGN_RETURN_ON_EXCEPTION(isolate, numeric_obj,
Object::ToNumber(isolate, num), String);
}
// We only cache the instance when both locales and options are undefined, // We only cache the instance when both locales and options are undefined,
// as that is the only case when the specified side-effects of examining // as that is the only case when the specified side-effects of examining
...@@ -1204,40 +1199,18 @@ Maybe<Intl::NumberFormatDigitOptions> Intl::SetNumberFormatDigitOptions( ...@@ -1204,40 +1199,18 @@ Maybe<Intl::NumberFormatDigitOptions> Intl::SetNumberFormatDigitOptions(
int mxfd = 0; int mxfd = 0;
Handle<Object> mnfd_obj; Handle<Object> mnfd_obj;
Handle<Object> mxfd_obj; Handle<Object> mxfd_obj;
if (FLAG_harmony_intl_numberformat_unified) {
// 6. Let mnfd be ? Get(options, "minimumFractionDigits").
Handle<String> mnfd_str = factory->minimumFractionDigits_string();
ASSIGN_RETURN_ON_EXCEPTION_VALUE(
isolate, mnfd_obj, JSReceiver::GetProperty(isolate, options, mnfd_str),
Nothing<NumberFormatDigitOptions>());
// 8. Let mnfd be ? Get(options, "maximumFractionDigits").
Handle<String> mxfd_str = factory->maximumFractionDigits_string();
ASSIGN_RETURN_ON_EXCEPTION_VALUE(
isolate, mxfd_obj, JSReceiver::GetProperty(isolate, options, mxfd_str),
Nothing<NumberFormatDigitOptions>());
} else {
// 6. Let mnfd be ? GetNumberOption(options, "minimumFractionDigits", 0, 20,
// mnfdDefault).
if (!Intl::GetNumberOption(isolate, options,
factory->minimumFractionDigits_string(), 0, 20,
mnfd_default)
.To(&mnfd)) {
return Nothing<NumberFormatDigitOptions>();
}
// 7. Let mxfdActualDefault be max( mnfd, mxfdDefault ). // 6. Let mnfd be ? Get(options, "minimumFractionDigits").
int mxfd_actual_default = std::max(mnfd, mxfd_default); Handle<String> mnfd_str = factory->minimumFractionDigits_string();
ASSIGN_RETURN_ON_EXCEPTION_VALUE(
isolate, mnfd_obj, JSReceiver::GetProperty(isolate, options, mnfd_str),
Nothing<NumberFormatDigitOptions>());
// 8. Let mxfd be ? GetNumberOption(options, // 8. Let mxfd be ? Get(options, "maximumFractionDigits").
// "maximumFractionDigits", mnfd, 20, mxfdActualDefault). Handle<String> mxfd_str = factory->maximumFractionDigits_string();
if (!Intl::GetNumberOption(isolate, options, ASSIGN_RETURN_ON_EXCEPTION_VALUE(
factory->maximumFractionDigits_string(), mnfd, isolate, mxfd_obj, JSReceiver::GetProperty(isolate, options, mxfd_str),
20, mxfd_actual_default) Nothing<NumberFormatDigitOptions>());
.To(&mxfd)) {
return Nothing<NumberFormatDigitOptions>();
}
}
// 9. Let mnsd be ? Get(options, "minimumSignificantDigits"). // 9. Let mnsd be ? Get(options, "minimumSignificantDigits").
Handle<Object> mnsd_obj; Handle<Object> mnsd_obj;
...@@ -1286,47 +1259,44 @@ Maybe<Intl::NumberFormatDigitOptions> Intl::SetNumberFormatDigitOptions( ...@@ -1286,47 +1259,44 @@ Maybe<Intl::NumberFormatDigitOptions> Intl::SetNumberFormatDigitOptions(
digit_options.minimum_significant_digits = 0; digit_options.minimum_significant_digits = 0;
digit_options.maximum_significant_digits = 0; digit_options.maximum_significant_digits = 0;
if (FLAG_harmony_intl_numberformat_unified) { // 15. Else If mnfd is not undefined or mxfd is not undefined, then
// 15. Else If mnfd is not undefined or mxfd is not undefined, then if (!mnfd_obj->IsUndefined(isolate) || !mxfd_obj->IsUndefined(isolate)) {
if (!mnfd_obj->IsUndefined(isolate) || !mxfd_obj->IsUndefined(isolate)) { // 15. b. Let mnfd be ? DefaultNumberOption(mnfd, 0, 20, mnfdDefault).
// 15. b. Let mnfd be ? DefaultNumberOption(mnfd, 0, 20, mnfdDefault). Handle<String> mnfd_str = factory->minimumFractionDigits_string();
Handle<String> mnfd_str = factory->minimumFractionDigits_string(); if (!DefaultNumberOption(isolate, mnfd_obj, 0, 20, mnfd_default, mnfd_str)
if (!DefaultNumberOption(isolate, mnfd_obj, 0, 20, mnfd_default, .To(&mnfd)) {
mnfd_str) return Nothing<NumberFormatDigitOptions>();
.To(&mnfd)) { }
return Nothing<NumberFormatDigitOptions>();
}
// 15. c. Let mxfdActualDefault be max( mnfd, mxfdDefault ). // 15. c. Let mxfdActualDefault be max( mnfd, mxfdDefault ).
int mxfd_actual_default = std::max(mnfd, mxfd_default); int mxfd_actual_default = std::max(mnfd, mxfd_default);
// 15. d. Let mxfd be ? DefaultNumberOption(mxfd, mnfd, 20, // 15. d. Let mxfd be ? DefaultNumberOption(mxfd, mnfd, 20,
// mxfdActualDefault). // mxfdActualDefault).
Handle<String> mxfd_str = factory->maximumFractionDigits_string(); Handle<String> mxfd_str = factory->maximumFractionDigits_string();
if (!DefaultNumberOption(isolate, mxfd_obj, mnfd, 20, if (!DefaultNumberOption(isolate, mxfd_obj, mnfd, 20, mxfd_actual_default,
mxfd_actual_default, mxfd_str) mxfd_str)
.To(&mxfd)) { .To(&mxfd)) {
return Nothing<NumberFormatDigitOptions>(); return Nothing<NumberFormatDigitOptions>();
}
// 15. e. Set intlObj.[[MinimumFractionDigits]] to mnfd.
digit_options.minimum_fraction_digits = mnfd;
// 15. f. Set intlObj.[[MaximumFractionDigits]] to mxfd.
digit_options.maximum_fraction_digits = mxfd;
// Else If intlObj.[[Notation]] is "compact", then
} else if (notation_is_compact) {
// a. Set intlObj.[[RoundingType]] to "compact-rounding".
// Set minimum_significant_digits to -1 to represent roundingtype is
// "compact-rounding".
digit_options.minimum_significant_digits = -1;
// 17. Else,
} else {
// 17. b. Set intlObj.[[MinimumFractionDigits]] to mnfdDefault.
digit_options.minimum_fraction_digits = mnfd_default;
// 17. c. Set intlObj.[[MaximumFractionDigits]] to mxfdDefault.
digit_options.maximum_fraction_digits = mxfd_default;
} }
// 15. e. Set intlObj.[[MinimumFractionDigits]] to mnfd.
digit_options.minimum_fraction_digits = mnfd;
// 15. f. Set intlObj.[[MaximumFractionDigits]] to mxfd.
digit_options.maximum_fraction_digits = mxfd;
// Else If intlObj.[[Notation]] is "compact", then
} else if (notation_is_compact) {
// a. Set intlObj.[[RoundingType]] to "compact-rounding".
// Set minimum_significant_digits to -1 to represent roundingtype is
// "compact-rounding".
digit_options.minimum_significant_digits = -1;
// 17. Else,
} else {
// 17. b. Set intlObj.[[MinimumFractionDigits]] to mnfdDefault.
digit_options.minimum_fraction_digits = mnfd_default;
// 17. c. Set intlObj.[[MaximumFractionDigits]] to mxfdDefault.
digit_options.maximum_fraction_digits = mxfd_default;
} }
} }
return Just(digit_options); return Just(digit_options);
......
...@@ -1243,9 +1243,8 @@ MaybeHandle<JSDateTimeFormat> JSDateTimeFormat::New( ...@@ -1243,9 +1243,8 @@ MaybeHandle<JSDateTimeFormat> JSDateTimeFormat::New(
const std::vector<const char*> empty_values = {}; const std::vector<const char*> empty_values = {};
// 6. Let calendar be ? GetOption(options, "calendar", // 6. Let calendar be ? GetOption(options, "calendar",
// "string", undefined, undefined). // "string", undefined, undefined).
Maybe<bool> maybe_calendar = Maybe<bool> maybe_calendar = Intl::GetStringOption(
Intl::GetStringOption(isolate, options, "calendar", empty_values, isolate, options, "calendar", empty_values, service, &calendar_str);
"Intl.NumberFormat", &calendar_str);
MAYBE_RETURN(maybe_calendar, MaybeHandle<JSDateTimeFormat>()); MAYBE_RETURN(maybe_calendar, MaybeHandle<JSDateTimeFormat>());
if (maybe_calendar.FromJust() && calendar_str != nullptr) { if (maybe_calendar.FromJust() && calendar_str != nullptr) {
icu::Locale default_locale; icu::Locale default_locale;
...@@ -1262,7 +1261,7 @@ MaybeHandle<JSDateTimeFormat> JSDateTimeFormat::New( ...@@ -1262,7 +1261,7 @@ MaybeHandle<JSDateTimeFormat> JSDateTimeFormat::New(
// 8. Let numberingSystem be ? GetOption(options, "numberingSystem", // 8. Let numberingSystem be ? GetOption(options, "numberingSystem",
// "string", undefined, undefined). // "string", undefined, undefined).
Maybe<bool> maybe_numberingSystem = Intl::GetNumberingSystem( Maybe<bool> maybe_numberingSystem = Intl::GetNumberingSystem(
isolate, options, "Intl.NumberFormat", &numbering_system_str); isolate, options, service, &numbering_system_str);
MAYBE_RETURN(maybe_numberingSystem, MaybeHandle<JSDateTimeFormat>()); MAYBE_RETURN(maybe_numberingSystem, MaybeHandle<JSDateTimeFormat>());
} }
...@@ -1409,43 +1408,40 @@ MaybeHandle<JSDateTimeFormat> JSDateTimeFormat::New( ...@@ -1409,43 +1408,40 @@ MaybeHandle<JSDateTimeFormat> JSDateTimeFormat::New(
DateTimeStyle time_style = DateTimeStyle::kUndefined; DateTimeStyle time_style = DateTimeStyle::kUndefined;
std::unique_ptr<icu::SimpleDateFormat> icu_date_format; std::unique_ptr<icu::SimpleDateFormat> icu_date_format;
if (FLAG_harmony_intl_datetime_style) { // 28. Let dateStyle be ? GetOption(options, "dateStyle", "string", «
// 28. Let dateStyle be ? GetOption(options, "dateStyle", "string", « // "full", "long", "medium", "short" », undefined).
// "full", "long", "medium", "short" », undefined). Maybe<DateTimeStyle> maybe_date_style = Intl::GetStringOption<DateTimeStyle>(
Maybe<DateTimeStyle> maybe_date_style = isolate, options, "dateStyle", service,
Intl::GetStringOption<DateTimeStyle>( {"full", "long", "medium", "short"},
isolate, options, "dateStyle", service, {DateTimeStyle::kFull, DateTimeStyle::kLong, DateTimeStyle::kMedium,
{"full", "long", "medium", "short"}, DateTimeStyle::kShort},
{DateTimeStyle::kFull, DateTimeStyle::kLong, DateTimeStyle::kMedium, DateTimeStyle::kUndefined);
DateTimeStyle::kShort}, MAYBE_RETURN(maybe_date_style, MaybeHandle<JSDateTimeFormat>());
DateTimeStyle::kUndefined); // 29. If dateStyle is not undefined, set dateTimeFormat.[[DateStyle]] to
MAYBE_RETURN(maybe_date_style, MaybeHandle<JSDateTimeFormat>()); // dateStyle.
// 29. If dateStyle is not undefined, set dateTimeFormat.[[DateStyle]] to date_style = maybe_date_style.FromJust();
// dateStyle.
date_style = maybe_date_style.FromJust(); // 30. Let timeStyle be ? GetOption(options, "timeStyle", "string", «
// "full", "long", "medium", "short" »).
// 30. Let timeStyle be ? GetOption(options, "timeStyle", "string", « Maybe<DateTimeStyle> maybe_time_style = Intl::GetStringOption<DateTimeStyle>(
// "full", "long", "medium", "short" »). isolate, options, "timeStyle", service,
Maybe<DateTimeStyle> maybe_time_style = {"full", "long", "medium", "short"},
Intl::GetStringOption<DateTimeStyle>( {DateTimeStyle::kFull, DateTimeStyle::kLong, DateTimeStyle::kMedium,
isolate, options, "timeStyle", service, DateTimeStyle::kShort},
{"full", "long", "medium", "short"}, DateTimeStyle::kUndefined);
{DateTimeStyle::kFull, DateTimeStyle::kLong, DateTimeStyle::kMedium, MAYBE_RETURN(maybe_time_style, MaybeHandle<JSDateTimeFormat>());
DateTimeStyle::kShort},
DateTimeStyle::kUndefined); // 31. If timeStyle is not undefined, set dateTimeFormat.[[TimeStyle]] to
MAYBE_RETURN(maybe_time_style, MaybeHandle<JSDateTimeFormat>()); // timeStyle.
time_style = maybe_time_style.FromJust();
// 31. If timeStyle is not undefined, set dateTimeFormat.[[TimeStyle]] to
// timeStyle. // 32. If dateStyle or timeStyle are not undefined, then
time_style = maybe_time_style.FromJust(); if (date_style != DateTimeStyle::kUndefined ||
time_style != DateTimeStyle::kUndefined) {
// 32. If dateStyle or timeStyle are not undefined, then icu_date_format = DateTimeStylePattern(date_style, time_style, icu_locale,
if (date_style != DateTimeStyle::kUndefined || hc, generator.get());
time_style != DateTimeStyle::kUndefined) {
icu_date_format = DateTimeStylePattern(date_style, time_style, icu_locale,
hc, generator.get());
}
} }
// 33. Else, // 33. Else,
if (icu_date_format.get() == nullptr) { if (icu_date_format.get() == nullptr) {
bool has_hour_option = false; bool has_hour_option = false;
......
...@@ -26,46 +26,8 @@ ACCESSORS(JSNumberFormat, icu_number_formatter, ...@@ -26,46 +26,8 @@ ACCESSORS(JSNumberFormat, icu_number_formatter,
kIcuNumberFormatterOffset) kIcuNumberFormatterOffset)
ACCESSORS(JSNumberFormat, bound_format, Object, kBoundFormatOffset) ACCESSORS(JSNumberFormat, bound_format, Object, kBoundFormatOffset)
// Currenct ECMA 402 spec mandate to record (Min|Max)imumFractionDigits
// uncondictionally while the unified number proposal eventually will only
// record either (Min|Max)imumFractionDigits or (Min|Max)imumSignaficantDigits
// Since LocalizedNumberFormatter can only remember one set, and during
// 2019-1-17 ECMA402 meeting that the committee decide not to take a PR to
// address that prior to the unified number proposal, we have to add these two
// 5 bits int into flags to remember the (Min|Max)imumFractionDigits while
// (Min|Max)imumSignaficantDigits is present.
// TODO(ftang) remove the following once we ship int-number-format-unified
// * SMI_ACCESSORS of flags
// * Four inline functions: (set_)?(min|max)imum_fraction_digits
SMI_ACCESSORS(JSNumberFormat, flags, kFlagsOffset) SMI_ACCESSORS(JSNumberFormat, flags, kFlagsOffset)
inline int JSNumberFormat::minimum_fraction_digits() const {
return MinimumFractionDigitsBits::decode(flags());
}
inline void JSNumberFormat::set_minimum_fraction_digits(int digits) {
DCHECK_GE(MinimumFractionDigitsBits::kMax, digits);
DCHECK_LE(0, digits);
DCHECK_GE(20, digits);
int hints = flags();
hints = MinimumFractionDigitsBits::update(hints, digits);
set_flags(hints);
}
inline int JSNumberFormat::maximum_fraction_digits() const {
return MaximumFractionDigitsBits::decode(flags());
}
inline void JSNumberFormat::set_maximum_fraction_digits(int digits) {
DCHECK_GE(MaximumFractionDigitsBits::kMax, digits);
DCHECK_LE(0, digits);
DCHECK_GE(20, digits);
int hints = flags();
hints = MaximumFractionDigitsBits::update(hints, digits);
set_flags(hints);
}
inline void JSNumberFormat::set_style(Style style) { inline void JSNumberFormat::set_style(Style style) {
DCHECK_GE(StyleBits::kMax, style); DCHECK_GE(StyleBits::kMax, style);
int hints = flags(); int hints = flags();
......
...@@ -33,7 +33,6 @@ namespace { ...@@ -33,7 +33,6 @@ namespace {
// [[CurrencyDisplay]] is one of the values "code", "symbol", "name", // [[CurrencyDisplay]] is one of the values "code", "symbol", "name",
// or "narrowSymbol" identifying the display of the currency number format. // or "narrowSymbol" identifying the display of the currency number format.
// Note: "narrowSymbol" is added in proposal-unified-intl-numberformat
enum class CurrencyDisplay { enum class CurrencyDisplay {
CODE, CODE,
SYMBOL, SYMBOL,
...@@ -621,12 +620,11 @@ JSNumberFormat::SetDigitOptionsToFormatter( ...@@ -621,12 +620,11 @@ JSNumberFormat::SetDigitOptionsToFormatter(
result = result.integerWidth(icu::number::IntegerWidth::zeroFillTo( result = result.integerWidth(icu::number::IntegerWidth::zeroFillTo(
digit_options.minimum_integer_digits)); digit_options.minimum_integer_digits));
} }
if (FLAG_harmony_intl_numberformat_unified) {
// Value -1 of minimum_significant_digits represent the roundingtype is // Value -1 of minimum_significant_digits represent the roundingtype is
// "compact-rounding". // "compact-rounding".
if (digit_options.minimum_significant_digits < 0) { if (digit_options.minimum_significant_digits < 0) {
return result; return result;
}
} }
icu::number::Precision precision = icu::number::Precision precision =
(digit_options.minimum_significant_digits > 0) (digit_options.minimum_significant_digits > 0)
...@@ -704,15 +702,12 @@ Handle<JSObject> JSNumberFormat::ResolvedOptions( ...@@ -704,15 +702,12 @@ Handle<JSObject> JSNumberFormat::ResolvedOptions(
isolate, options, factory->currencyDisplay_string(), isolate, options, factory->currencyDisplay_string(),
CurrencyDisplayString(isolate, skeleton), Just(kDontThrow)) CurrencyDisplayString(isolate, skeleton), Just(kDontThrow))
.FromJust()); .FromJust());
if (FLAG_harmony_intl_numberformat_unified) { CHECK(JSReceiver::CreateDataProperty(
CHECK(JSReceiver::CreateDataProperty( isolate, options, factory->currencySign_string(),
isolate, options, factory->currencySign_string(), CurrencySignString(isolate, skeleton), Just(kDontThrow))
CurrencySignString(isolate, skeleton), Just(kDontThrow)) .FromJust());
.FromJust());
}
} }
if (FLAG_harmony_intl_numberformat_unified) {
if (style == JSNumberFormat::Style::UNIT) { if (style == JSNumberFormat::Style::UNIT) {
std::string unit = UnitFromSkeleton(skeleton); std::string unit = UnitFromSkeleton(skeleton);
if (!unit.empty()) { if (!unit.empty()) {
...@@ -727,7 +722,6 @@ Handle<JSObject> JSNumberFormat::ResolvedOptions( ...@@ -727,7 +722,6 @@ Handle<JSObject> JSNumberFormat::ResolvedOptions(
UnitDisplayString(isolate, skeleton), Just(kDontThrow)) UnitDisplayString(isolate, skeleton), Just(kDontThrow))
.FromJust()); .FromJust());
} }
}
CHECK( CHECK(
JSReceiver::CreateDataProperty( JSReceiver::CreateDataProperty(
...@@ -735,27 +729,9 @@ Handle<JSObject> JSNumberFormat::ResolvedOptions( ...@@ -735,27 +729,9 @@ Handle<JSObject> JSNumberFormat::ResolvedOptions(
factory->NewNumberFromInt(MinimumIntegerDigitsFromSkeleton(skeleton)), factory->NewNumberFromInt(MinimumIntegerDigitsFromSkeleton(skeleton)),
Just(kDontThrow)) Just(kDontThrow))
.FromJust()); .FromJust());
int32_t minimum = 0, maximum = 0; int32_t minimum = 0, maximum = 0;
bool output_fraction = if (FractionDigitsFromSkeleton(skeleton, &minimum, &maximum)) {
FractionDigitsFromSkeleton(skeleton, &minimum, &maximum);
if (!FLAG_harmony_intl_numberformat_unified && !output_fraction) {
// Currenct ECMA 402 spec mandate to record (Min|Max)imumFractionDigits
// uncondictionally while the unified number proposal eventually will only
// record either (Min|Max)imumFractionDigits or
// (Min|Max)imumSignaficantDigits Since LocalizedNumberFormatter can only
// remember one set, and during 2019-1-17 ECMA402 meeting that the committee
// decide not to take a PR to address that prior to the unified number
// proposal, we have to add these two 5 bits int into flags to remember the
// (Min|Max)imumFractionDigits while (Min|Max)imumSignaficantDigits is
// present.
// TODO(ftang) remove the following two lines once we ship
// int-number-format-unified
output_fraction = true;
minimum = number_format->minimum_fraction_digits();
maximum = number_format->maximum_fraction_digits();
}
if (output_fraction) {
CHECK(JSReceiver::CreateDataProperty( CHECK(JSReceiver::CreateDataProperty(
isolate, options, factory->minimumFractionDigits_string(), isolate, options, factory->minimumFractionDigits_string(),
factory->NewNumberFromInt(minimum), Just(kDontThrow)) factory->NewNumberFromInt(minimum), Just(kDontThrow))
...@@ -765,6 +741,7 @@ Handle<JSObject> JSNumberFormat::ResolvedOptions( ...@@ -765,6 +741,7 @@ Handle<JSObject> JSNumberFormat::ResolvedOptions(
factory->NewNumberFromInt(maximum), Just(kDontThrow)) factory->NewNumberFromInt(maximum), Just(kDontThrow))
.FromJust()); .FromJust());
} }
minimum = 0; minimum = 0;
maximum = 0; maximum = 0;
if (SignificantDigitsFromSkeleton(skeleton, &minimum, &maximum)) { if (SignificantDigitsFromSkeleton(skeleton, &minimum, &maximum)) {
...@@ -783,24 +760,22 @@ Handle<JSObject> JSNumberFormat::ResolvedOptions( ...@@ -783,24 +760,22 @@ Handle<JSObject> JSNumberFormat::ResolvedOptions(
factory->ToBoolean(UseGroupingFromSkeleton(skeleton)), factory->ToBoolean(UseGroupingFromSkeleton(skeleton)),
Just(kDontThrow)) Just(kDontThrow))
.FromJust()); .FromJust());
if (FLAG_harmony_intl_numberformat_unified) { Notation notation = NotationFromSkeleton(skeleton);
Notation notation = NotationFromSkeleton(skeleton); CHECK(JSReceiver::CreateDataProperty(
CHECK(JSReceiver::CreateDataProperty( isolate, options, factory->notation_string(),
isolate, options, factory->notation_string(), NotationAsString(isolate, notation), Just(kDontThrow))
NotationAsString(isolate, notation), Just(kDontThrow)) .FromJust());
.FromJust()); // Only output compactDisplay when notation is compact.
// Only output compactDisplay when notation is compact. if (notation == Notation::COMPACT) {
if (notation == Notation::COMPACT) {
CHECK(JSReceiver::CreateDataProperty(
isolate, options, factory->compactDisplay_string(),
CompactDisplayString(isolate, skeleton), Just(kDontThrow))
.FromJust());
}
CHECK(JSReceiver::CreateDataProperty( CHECK(JSReceiver::CreateDataProperty(
isolate, options, factory->signDisplay_string(), isolate, options, factory->compactDisplay_string(),
SignDisplayString(isolate, skeleton), Just(kDontThrow)) CompactDisplayString(isolate, skeleton), Just(kDontThrow))
.FromJust()); .FromJust());
} }
CHECK(JSReceiver::CreateDataProperty(
isolate, options, factory->signDisplay_string(),
SignDisplayString(isolate, skeleton), Just(kDontThrow))
.FromJust());
return options; return options;
} }
...@@ -877,7 +852,7 @@ MaybeHandle<JSNumberFormat> JSNumberFormat::New(Isolate* isolate, ...@@ -877,7 +852,7 @@ MaybeHandle<JSNumberFormat> JSNumberFormat::New(Isolate* isolate,
// 7. Let _numberingSystem_ be ? GetOption(_options_, `"numberingSystem"`, // 7. Let _numberingSystem_ be ? GetOption(_options_, `"numberingSystem"`,
// `"string"`, *undefined*, *undefined*). // `"string"`, *undefined*, *undefined*).
Maybe<bool> maybe_numberingSystem = Intl::GetNumberingSystem( Maybe<bool> maybe_numberingSystem = Intl::GetNumberingSystem(
isolate, options, "Intl.RelativeTimeFormat", &numbering_system_str); isolate, options, service, &numbering_system_str);
// 8. If _numberingSystem_ is not *undefined*, then // 8. If _numberingSystem_ is not *undefined*, then
// a. If _numberingSystem_ does not match the // a. If _numberingSystem_ does not match the
// `(3*8alphanum) *("-" (3*8alphanum))` sequence, throw a *RangeError* // `(3*8alphanum) *("-" (3*8alphanum))` sequence, throw a *RangeError*
...@@ -913,20 +888,15 @@ MaybeHandle<JSNumberFormat> JSNumberFormat::New(Isolate* isolate, ...@@ -913,20 +888,15 @@ MaybeHandle<JSNumberFormat> JSNumberFormat::New(Isolate* isolate,
.roundingMode(UNUM_ROUND_HALFUP); .roundingMode(UNUM_ROUND_HALFUP);
// 12. Let style be ? GetOption(options, "style", "string", « "decimal", // 12. Let style be ? GetOption(options, "style", "string", « "decimal",
// "percent", "currency" », "decimal"). // "percent", "currency", "unit" », "decimal").
std::vector<const char*> style_str_values({"decimal", "percent", "currency"});
std::vector<JSNumberFormat::Style> style_enum_values(
{JSNumberFormat::Style::DECIMAL, JSNumberFormat::Style::PERCENT,
JSNumberFormat::Style::CURRENCY});
if (FLAG_harmony_intl_numberformat_unified) {
style_str_values.push_back("unit");
style_enum_values.push_back(JSNumberFormat::Style::UNIT);
}
Maybe<JSNumberFormat::Style> maybe_style = Maybe<JSNumberFormat::Style> maybe_style =
Intl::GetStringOption<JSNumberFormat::Style>( Intl::GetStringOption<JSNumberFormat::Style>(
isolate, options, "style", service, style_str_values, isolate, options, "style", service,
style_enum_values, JSNumberFormat::Style::DECIMAL); {"decimal", "percent", "currency", "unit"},
{JSNumberFormat::Style::DECIMAL, JSNumberFormat::Style::PERCENT,
JSNumberFormat::Style::CURRENCY, JSNumberFormat::Style::UNIT},
JSNumberFormat::Style::DECIMAL);
MAYBE_RETURN(maybe_style, MaybeHandle<JSNumberFormat>()); MAYBE_RETURN(maybe_style, MaybeHandle<JSNumberFormat>());
JSNumberFormat::Style style = maybe_style.FromJust(); JSNumberFormat::Style style = maybe_style.FromJust();
...@@ -976,98 +946,87 @@ MaybeHandle<JSNumberFormat> JSNumberFormat::New(Isolate* isolate, ...@@ -976,98 +946,87 @@ MaybeHandle<JSNumberFormat> JSNumberFormat::New(Isolate* isolate,
} }
// 18. Let currencyDisplay be ? GetOption(options, "currencyDisplay", // 18. Let currencyDisplay be ? GetOption(options, "currencyDisplay",
// "string", « "code", "symbol", "name" », "symbol"). // "string", « "code", "symbol", "name", "narrowSymbol" », "symbol").
std::vector<const char*> currency_display_str_values(
{"code", "symbol", "name"});
std::vector<CurrencyDisplay> currency_display_enum_values(
{CurrencyDisplay::CODE, CurrencyDisplay::SYMBOL, CurrencyDisplay::NAME});
if (FLAG_harmony_intl_numberformat_unified) {
currency_display_str_values.push_back("narrowSymbol");
currency_display_enum_values.push_back(CurrencyDisplay::NARROW_SYMBOL);
}
Maybe<CurrencyDisplay> maybe_currency_display = Maybe<CurrencyDisplay> maybe_currency_display =
Intl::GetStringOption<CurrencyDisplay>( Intl::GetStringOption<CurrencyDisplay>(
isolate, options, "currencyDisplay", service, isolate, options, "currencyDisplay", service,
currency_display_str_values, currency_display_enum_values, {"code", "symbol", "name", "narrowSymbol"},
{CurrencyDisplay::CODE, CurrencyDisplay::SYMBOL,
CurrencyDisplay::NAME, CurrencyDisplay::NARROW_SYMBOL},
CurrencyDisplay::SYMBOL); CurrencyDisplay::SYMBOL);
MAYBE_RETURN(maybe_currency_display, MaybeHandle<JSNumberFormat>()); MAYBE_RETURN(maybe_currency_display, MaybeHandle<JSNumberFormat>());
CurrencyDisplay currency_display = maybe_currency_display.FromJust(); CurrencyDisplay currency_display = maybe_currency_display.FromJust();
CurrencySign currency_sign = CurrencySign::STANDARD; CurrencySign currency_sign = CurrencySign::STANDARD;
if (FLAG_harmony_intl_numberformat_unified) { // Let currencySign be ? GetOption(options, "currencySign", "string", «
// Let currencySign be ? GetOption(options, "currencySign", "string", « // "standard", "accounting" », "standard").
// "standard", "accounting" », "standard"). Maybe<CurrencySign> maybe_currency_sign = Intl::GetStringOption<CurrencySign>(
Maybe<CurrencySign> maybe_currency_sign = isolate, options, "currencySign", service, {"standard", "accounting"},
Intl::GetStringOption<CurrencySign>( {CurrencySign::STANDARD, CurrencySign::ACCOUNTING},
isolate, options, "currencySign", service, CurrencySign::STANDARD);
{"standard", "accounting"}, MAYBE_RETURN(maybe_currency_sign, MaybeHandle<JSNumberFormat>());
{CurrencySign::STANDARD, CurrencySign::ACCOUNTING}, currency_sign = maybe_currency_sign.FromJust();
CurrencySign::STANDARD);
MAYBE_RETURN(maybe_currency_sign, MaybeHandle<JSNumberFormat>()); // Let unit be ? GetOption(options, "unit", "string", undefined, undefined).
currency_sign = maybe_currency_sign.FromJust(); std::unique_ptr<char[]> unit_cstr;
Maybe<bool> found_unit = Intl::GetStringOption(
// Let unit be ? GetOption(options, "unit", "string", undefined, undefined). isolate, options, "unit", empty_values, service, &unit_cstr);
std::unique_ptr<char[]> unit_cstr; MAYBE_RETURN(found_unit, MaybeHandle<JSNumberFormat>());
Maybe<bool> found_unit = Intl::GetStringOption(
isolate, options, "unit", empty_values, service, &unit_cstr); std::string unit;
MAYBE_RETURN(found_unit, MaybeHandle<JSNumberFormat>()); if (found_unit.FromJust()) {
DCHECK_NOT_NULL(unit_cstr.get());
std::string unit; unit = unit_cstr.get();
if (found_unit.FromJust()) { }
DCHECK_NOT_NULL(unit_cstr.get());
unit = unit_cstr.get(); // Let unitDisplay be ? GetOption(options, "unitDisplay", "string", «
// "short", "narrow", "long" », "short").
Maybe<UnitDisplay> maybe_unit_display = Intl::GetStringOption<UnitDisplay>(
isolate, options, "unitDisplay", service, {"short", "narrow", "long"},
{UnitDisplay::SHORT, UnitDisplay::NARROW, UnitDisplay::LONG},
UnitDisplay::SHORT);
MAYBE_RETURN(maybe_unit_display, MaybeHandle<JSNumberFormat>());
UnitDisplay unit_display = maybe_unit_display.FromJust();
// If style is "unit", then
if (style == JSNumberFormat::Style::UNIT) {
// If unit is undefined, throw a TypeError exception.
if (unit == "") {
THROW_NEW_ERROR(isolate,
NewTypeError(MessageTemplate::kInvalidUnit,
factory->NewStringFromAsciiChecked(service),
factory->empty_string()),
JSNumberFormat);
} }
// Let unitDisplay be ? GetOption(options, "unitDisplay", "string", « // If the result of IsWellFormedUnitIdentifier(unit) is false, throw a
// "short", "narrow", "long" », "short"). // RangeError exception.
Maybe<UnitDisplay> maybe_unit_display = Intl::GetStringOption<UnitDisplay>( Maybe<std::pair<icu::MeasureUnit, icu::MeasureUnit>> maybe_wellformed =
isolate, options, "unitDisplay", service, {"short", "narrow", "long"}, IsWellFormedUnitIdentifier(isolate, unit);
{UnitDisplay::SHORT, UnitDisplay::NARROW, UnitDisplay::LONG}, if (maybe_wellformed.IsNothing()) {
UnitDisplay::SHORT); THROW_NEW_ERROR(
MAYBE_RETURN(maybe_unit_display, MaybeHandle<JSNumberFormat>()); isolate,
UnitDisplay unit_display = maybe_unit_display.FromJust(); NewRangeError(MessageTemplate::kInvalidUnit,
factory->NewStringFromAsciiChecked(service),
// If style is "unit", then factory->NewStringFromAsciiChecked(unit.c_str())),
if (style == JSNumberFormat::Style::UNIT) { JSNumberFormat);
// If unit is undefined, throw a TypeError exception. }
if (unit == "") { std::pair<icu::MeasureUnit, icu::MeasureUnit> unit_pair =
THROW_NEW_ERROR( maybe_wellformed.FromJust();
isolate,
NewTypeError(MessageTemplate::kInvalidUnit,
factory->NewStringFromAsciiChecked(service),
factory->empty_string()),
JSNumberFormat);
}
// If the result of IsWellFormedUnitIdentifier(unit) is false, throw a
// RangeError exception.
Maybe<std::pair<icu::MeasureUnit, icu::MeasureUnit>> maybe_wellformed =
IsWellFormedUnitIdentifier(isolate, unit);
if (maybe_wellformed.IsNothing()) {
THROW_NEW_ERROR(
isolate,
NewRangeError(MessageTemplate::kInvalidUnit,
factory->NewStringFromAsciiChecked(service),
factory->NewStringFromAsciiChecked(unit.c_str())),
JSNumberFormat);
}
std::pair<icu::MeasureUnit, icu::MeasureUnit> unit_pair =
maybe_wellformed.FromJust();
// Set intlObj.[[Unit]] to unit. // Set intlObj.[[Unit]] to unit.
if (unit_pair.first != icu::NoUnit::base()) { if (unit_pair.first != icu::NoUnit::base()) {
icu_number_formatter = icu_number_formatter.unit(unit_pair.first); icu_number_formatter = icu_number_formatter.unit(unit_pair.first);
} }
if (unit_pair.second != icu::NoUnit::base()) { if (unit_pair.second != icu::NoUnit::base()) {
icu_number_formatter = icu_number_formatter.perUnit(unit_pair.second); icu_number_formatter = icu_number_formatter.perUnit(unit_pair.second);
} }
// The default unitWidth is SHORT in ICU and that mapped from // The default unitWidth is SHORT in ICU and that mapped from
// Symbol so we can skip the setting for optimization. // Symbol so we can skip the setting for optimization.
if (unit_display != UnitDisplay::SHORT) { if (unit_display != UnitDisplay::SHORT) {
icu_number_formatter = icu_number_formatter =
icu_number_formatter.unitWidth(ToUNumberUnitWidth(unit_display)); icu_number_formatter.unitWidth(ToUNumberUnitWidth(unit_display));
}
} }
} }
...@@ -1123,18 +1082,16 @@ MaybeHandle<JSNumberFormat> JSNumberFormat::New(Isolate* isolate, ...@@ -1123,18 +1082,16 @@ MaybeHandle<JSNumberFormat> JSNumberFormat::New(Isolate* isolate,
} }
Notation notation = Notation::STANDARD; Notation notation = Notation::STANDARD;
if (FLAG_harmony_intl_numberformat_unified) { // 25. Let notation be ? GetOption(options, "notation", "string", «
// 25. Let notation be ? GetOption(options, "notation", "string", « // "standard", "scientific", "engineering", "compact" », "standard").
// "standard", "scientific", "engineering", "compact" », "standard"). Maybe<Notation> maybe_notation = Intl::GetStringOption<Notation>(
Maybe<Notation> maybe_notation = Intl::GetStringOption<Notation>( isolate, options, "notation", service,
isolate, options, "notation", service, {"standard", "scientific", "engineering", "compact"},
{"standard", "scientific", "engineering", "compact"}, {Notation::STANDARD, Notation::SCIENTIFIC, Notation::ENGINEERING,
{Notation::STANDARD, Notation::SCIENTIFIC, Notation::ENGINEERING, Notation::COMPACT},
Notation::COMPACT}, Notation::STANDARD);
Notation::STANDARD); MAYBE_RETURN(maybe_notation, MaybeHandle<JSNumberFormat>());
MAYBE_RETURN(maybe_notation, MaybeHandle<JSNumberFormat>()); notation = maybe_notation.FromJust();
notation = maybe_notation.FromJust();
}
// 27. Perform ? SetNumberFormatDigitOptions(numberFormat, options, // 27. Perform ? SetNumberFormatDigitOptions(numberFormat, options,
// mnfdDefault, mxfdDefault). // mnfdDefault, mxfdDefault).
...@@ -1147,24 +1104,21 @@ MaybeHandle<JSNumberFormat> JSNumberFormat::New(Isolate* isolate, ...@@ -1147,24 +1104,21 @@ MaybeHandle<JSNumberFormat> JSNumberFormat::New(Isolate* isolate,
icu_number_formatter = JSNumberFormat::SetDigitOptionsToFormatter( icu_number_formatter = JSNumberFormat::SetDigitOptionsToFormatter(
icu_number_formatter, digit_options); icu_number_formatter, digit_options);
if (FLAG_harmony_intl_numberformat_unified) { // 28. Let compactDisplay be ? GetOption(options, "compactDisplay",
// 28. Let compactDisplay be ? GetOption(options, "compactDisplay", // "string", « "short", "long" », "short").
// "string", « "short", "long" », "short"). Maybe<CompactDisplay> maybe_compact_display =
Maybe<CompactDisplay> maybe_compact_display = Intl::GetStringOption<CompactDisplay>(
Intl::GetStringOption<CompactDisplay>( isolate, options, "compactDisplay", service, {"short", "long"},
isolate, options, "compactDisplay", service, {"short", "long"}, {CompactDisplay::SHORT, CompactDisplay::LONG}, CompactDisplay::SHORT);
{CompactDisplay::SHORT, CompactDisplay::LONG}, MAYBE_RETURN(maybe_compact_display, MaybeHandle<JSNumberFormat>());
CompactDisplay::SHORT); CompactDisplay compact_display = maybe_compact_display.FromJust();
MAYBE_RETURN(maybe_compact_display, MaybeHandle<JSNumberFormat>());
CompactDisplay compact_display = maybe_compact_display.FromJust(); // 26. Set numberFormat.[[Notation]] to notation.
// The default notation in ICU is Simple, which mapped from STANDARD
// 26. Set numberFormat.[[Notation]] to notation. // so we can skip setting it.
// The default notation in ICU is Simple, which mapped from STANDARD if (notation != Notation::STANDARD) {
// so we can skip setting it. icu_number_formatter =
if (notation != Notation::STANDARD) { icu_number_formatter.notation(ToICUNotation(notation, compact_display));
icu_number_formatter = icu_number_formatter.notation(
ToICUNotation(notation, compact_display));
}
} }
// 30. Let useGrouping be ? GetOption(options, "useGrouping", "boolean", // 30. Let useGrouping be ? GetOption(options, "useGrouping", "boolean",
// undefined, true). // undefined, true).
...@@ -1178,27 +1132,25 @@ MaybeHandle<JSNumberFormat> JSNumberFormat::New(Isolate* isolate, ...@@ -1178,27 +1132,25 @@ MaybeHandle<JSNumberFormat> JSNumberFormat::New(Isolate* isolate,
UNumberGroupingStrategy::UNUM_GROUPING_OFF); UNumberGroupingStrategy::UNUM_GROUPING_OFF);
} }
if (FLAG_harmony_intl_numberformat_unified) { // 32. Let signDisplay be ? GetOption(options, "signDisplay", "string", «
// 32. Let signDisplay be ? GetOption(options, "signDisplay", "string", « // "auto", "never", "always", "exceptZero" », "auto").
// "auto", "never", "always", "exceptZero" », "auto"). Maybe<SignDisplay> maybe_sign_display = Intl::GetStringOption<SignDisplay>(
Maybe<SignDisplay> maybe_sign_display = Intl::GetStringOption<SignDisplay>( isolate, options, "signDisplay", service,
isolate, options, "signDisplay", service, {"auto", "never", "always", "exceptZero"},
{"auto", "never", "always", "exceptZero"}, {SignDisplay::AUTO, SignDisplay::NEVER, SignDisplay::ALWAYS,
{SignDisplay::AUTO, SignDisplay::NEVER, SignDisplay::ALWAYS, SignDisplay::EXCEPT_ZERO},
SignDisplay::EXCEPT_ZERO}, SignDisplay::AUTO);
SignDisplay::AUTO); MAYBE_RETURN(maybe_sign_display, MaybeHandle<JSNumberFormat>());
MAYBE_RETURN(maybe_sign_display, MaybeHandle<JSNumberFormat>()); SignDisplay sign_display = maybe_sign_display.FromJust();
SignDisplay sign_display = maybe_sign_display.FromJust();
// 33. Set numberFormat.[[SignDisplay]] to signDisplay.
// 33. Set numberFormat.[[SignDisplay]] to signDisplay. // The default sign in ICU is UNUM_SIGN_AUTO which is mapped from
// The default sign in ICU is UNUM_SIGN_AUTO which is mapped from // SignDisplay::AUTO and CurrencySign::STANDARD so we can skip setting
// SignDisplay::AUTO and CurrencySign::STANDARD so we can skip setting // under that values for optimization.
// under that values for optimization. if (sign_display != SignDisplay::AUTO ||
if (sign_display != SignDisplay::AUTO || currency_sign != CurrencySign::STANDARD) {
currency_sign != CurrencySign::STANDARD) { icu_number_formatter = icu_number_formatter.sign(
icu_number_formatter = icu_number_formatter.sign( ToUNumberSignDisplay(sign_display, currency_sign));
ToUNumberSignDisplay(sign_display, currency_sign));
}
} }
// 25. Let dataLocaleData be localeData.[[<dataLocale>]]. // 25. Let dataLocaleData be localeData.[[<dataLocale>]].
...@@ -1229,24 +1181,6 @@ MaybeHandle<JSNumberFormat> JSNumberFormat::New(Isolate* isolate, ...@@ -1229,24 +1181,6 @@ MaybeHandle<JSNumberFormat> JSNumberFormat::New(Isolate* isolate,
number_format->set_style(style); number_format->set_style(style);
number_format->set_locale(*locale_str); number_format->set_locale(*locale_str);
if (digit_options.minimum_significant_digits > 0) {
// The current ECMA 402 spec mandates recording (Min|Max)imumFractionDigits
// unconditionally, while the unified number proposal eventually will only
// record either (Min|Max)imumFractionDigits or
// (Min|Max)imumSignificantDigits. Since LocalizedNumberFormatter can only
// remember one set, and during 2019-1-17 ECMA402 meeting the committee
// decided not to take a PR to address that prior to the unified number
// proposal, we have to add these two 5-bit ints into flags to remember the
// (Min|Max)imumFractionDigits while (Min|Max)imumSignificantDigits is
// present.
// TODO(ftang) remove the following two lines once we ship
// int-number-format-unified
number_format->set_minimum_fraction_digits(
digit_options.minimum_fraction_digits);
number_format->set_maximum_fraction_digits(
digit_options.maximum_fraction_digits);
}
number_format->set_icu_number_formatter(*managed_number_formatter); number_format->set_icu_number_formatter(*managed_number_formatter);
number_format->set_bound_format(*factory->undefined_value()); number_format->set_bound_format(*factory->undefined_value());
......
...@@ -72,26 +72,6 @@ class JSNumberFormat : public JSObject { ...@@ -72,26 +72,6 @@ class JSNumberFormat : public JSObject {
DECL_PRINTER(JSNumberFormat) DECL_PRINTER(JSNumberFormat)
DECL_VERIFIER(JSNumberFormat) DECL_VERIFIER(JSNumberFormat)
// Current ECMA 402 spec mandates to record (Min|Max)imumFractionDigits
// unconditionally while the unified number proposal eventually will only
// record either (Min|Max)imumFractionDigits or (Min|Max)imumSignaficantDigits
// Since LocalizedNumberFormatter can only remember one set, and during
// 2019-1-17 ECMA402 meeting that the committee decide not to take a PR to
// address that prior to the unified number proposal, we have to add these two
// 5 bits int into flags to remember the (Min|Max)imumFractionDigits while
// (Min|Max)imumSignaficantDigits is present.
// TODO(ftang) remove the following once we ship int-number-format-unified
// * Four inline functions: (set_)?(min|max)imum_fraction_digits
// * kFlagsOffset
// * #define FLAGS_BIT_FIELDS
// * DECL_INT_ACCESSORS(flags)
inline int minimum_fraction_digits() const;
inline void set_minimum_fraction_digits(int digits);
inline int maximum_fraction_digits() const;
inline void set_maximum_fraction_digits(int digits);
// [[Style]] is one of the values "decimal", "percent", "currency", // [[Style]] is one of the values "decimal", "percent", "currency",
// or "unit" identifying the style of the number format. // or "unit" identifying the style of the number format.
// Note: "unit" is added in proposal-unified-intl-numberformat // Note: "unit" is added in proposal-unified-intl-numberformat
...@@ -106,15 +86,11 @@ class JSNumberFormat : public JSObject { ...@@ -106,15 +86,11 @@ class JSNumberFormat : public JSObject {
// Bit positions in |flags|. // Bit positions in |flags|.
#define FLAGS_BIT_FIELDS(V, _) \ #define FLAGS_BIT_FIELDS(V, _) \
V(MinimumFractionDigitsBits, int, 5, _) \
V(MaximumFractionDigitsBits, int, 5, _) \
V(StyleBits, Style, 2, _) V(StyleBits, Style, 2, _)
DEFINE_BIT_FIELDS(FLAGS_BIT_FIELDS) DEFINE_BIT_FIELDS(FLAGS_BIT_FIELDS)
#undef FLAGS_BIT_FIELDS #undef FLAGS_BIT_FIELDS
STATIC_ASSERT(20 <= MinimumFractionDigitsBits::kMax);
STATIC_ASSERT(20 <= MaximumFractionDigitsBits::kMax);
STATIC_ASSERT(Style::DECIMAL <= StyleBits::kMax); STATIC_ASSERT(Style::DECIMAL <= StyleBits::kMax);
STATIC_ASSERT(Style::PERCENT <= StyleBits::kMax); STATIC_ASSERT(Style::PERCENT <= StyleBits::kMax);
STATIC_ASSERT(Style::CURRENCY <= StyleBits::kMax); STATIC_ASSERT(Style::CURRENCY <= StyleBits::kMax);
......
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// Flags: --harmony-intl-bigint
var locales = [ var locales = [
"en", // "1,234,567,890,123,456" "en", // "1,234,567,890,123,456"
"de", // "1.234.567.890.123.456" "de", // "1.234.567.890.123.456"
......
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// Flags: --harmony-intl-datetime-style
// Throws only once during construction. // Throws only once during construction.
// Check for all getters to prevent regression. // Check for all getters to prevent regression.
// Preserve the order of getter initialization. // Preserve the order of getter initialization.
......
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// Flags: --harmony-intl-datetime-style
// Throws only once during construction. // Throws only once during construction.
// Check for all getters to prevent regression. // Check for all getters to prevent regression.
// Preserve the order of getter initialization. // Preserve the order of getter initialization.
......
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// Flags: --harmony-intl-datetime-style
var validStyle = ["full", "long", "medium", "short", undefined]; var validStyle = ["full", "long", "medium", "short", undefined];
var invalidStyle = ["narrow", "numeric"]; var invalidStyle = ["narrow", "numeric"];
......
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// Flags: --harmony-intl-datetime-style
// Throws only once during construction. // Throws only once during construction.
// Check for all getters to prevent regression. // Check for all getters to prevent regression.
// Preserve the order of getter initialization. // Preserve the order of getter initialization.
......
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// Flags: --harmony-intl-datetime-style
// Throws only once during construction. // Throws only once during construction.
// Check for all getters to prevent regression. // Check for all getters to prevent regression.
// Preserve the order of getter initialization. // Preserve the order of getter initialization.
......
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// Flags: --harmony-intl-date-format-range
const date1 = new Date("2019-01-03T03:20"); const date1 = new Date("2019-01-03T03:20");
const date2 = new Date("2019-01-05T19:33"); const date2 = new Date("2019-01-05T19:33");
const date3 = new Date("2019-01-05T22:57"); const date3 = new Date("2019-01-05T22:57");
......
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// Flags: --harmony-intl-date-format-range
let descriptor = Object.getOwnPropertyDescriptor( let descriptor = Object.getOwnPropertyDescriptor(
Intl.DateTimeFormat.prototype, "formatRangeToParts"); Intl.DateTimeFormat.prototype, "formatRangeToParts");
assertTrue(descriptor.writable); assertTrue(descriptor.writable);
......
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// Flags: --harmony-intl-date-format-range
let descriptor = Object.getOwnPropertyDescriptor( let descriptor = Object.getOwnPropertyDescriptor(
Intl.DateTimeFormat.prototype, "formatRange"); Intl.DateTimeFormat.prototype, "formatRange");
assertTrue(descriptor.writable); assertTrue(descriptor.writable);
......
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// Flags: --harmony-intl-datetime-style
// Checks for security holes introduced by Object.property overrides. // Checks for security holes introduced by Object.property overrides.
// For example: // For example:
// Object.defineProperty(Array.prototype, 'locale', { // Object.defineProperty(Array.prototype, 'locale', {
......
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// Flags: --harmony-intl-datetime-style
// Checks for security holes introduced by Object.property overrides. // Checks for security holes introduced by Object.property overrides.
// For example: // For example:
// Object.defineProperty(Array.prototype, 'locale', { // Object.defineProperty(Array.prototype, 'locale', {
......
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// Flags: --harmony-intl-datetime-style
// Checks for security holes introduced by Object.property overrides. // Checks for security holes introduced by Object.property overrides.
// For example: // For example:
// Object.defineProperty(Array.prototype, 'locale', { // Object.defineProperty(Array.prototype, 'locale', {
......
// Copyright 2013 the V8 project authors. All rights reserved.
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following
// disclaimer in the documentation and/or other materials provided
// with the distribution.
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Checks for security holes introduced by Object.property overrides.
// For example:
// Object.defineProperty(Array.prototype, 'locale', {
// set: function(value) {
// throw new Error('blah');
// },
// configurable: true,
// enumerable: false
// });
//
// would throw in case of (JS) x.locale = 'us' or (C++) x->Set('locale', 'us').
//
// Update both number-format.js and number-format.cc so they have the same
// list of properties.
// Flags: --noharmony-intl-numberformat-unified
// First get supported properties.
var properties = [];
// Some properties are optional and won't show up in resolvedOptions if
// they were not requested - currency, currencyDisplay,
// minimumSignificantDigits and maximumSignificantDigits - so we request them.
var options = Intl.NumberFormat(
undefined, {style: 'currency', currency: 'USD', currencyDisplay: 'name',
minimumSignificantDigits: 1, maximumSignificantDigits: 5}).
resolvedOptions();
for (var prop in options) {
if (options.hasOwnProperty(prop)) {
properties.push(prop);
}
}
var expectedProperties = [
'style', 'locale', 'numberingSystem',
'currency', 'currencyDisplay', 'useGrouping',
'minimumIntegerDigits', 'minimumFractionDigits',
'maximumFractionDigits', 'minimumSignificantDigits',
'maximumSignificantDigits'
];
assertEquals(expectedProperties.length, properties.length);
properties.forEach(function(prop) {
assertFalse(expectedProperties.indexOf(prop) === -1);
});
taintProperties(properties);
var locale = Intl.NumberFormat(undefined,
{currency: 'USD', currencyDisplay: 'name',
minimumIntegerDigits: 2,
numberingSystem: 'latn'}).
resolvedOptions().locale;
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// Flags: --harmony-intl-numberformat-unified
const testData = [ const testData = [
["short"], ["short"],
["long"], ["long"],
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// Flags: --harmony-intl-numberformat-unified
// Similar to constructor-order.js but also consider the new options // Similar to constructor-order.js but also consider the new options
// in https://tc39-transfer.github.io/proposal-unified-intl-numberformat/ // in https://tc39-transfer.github.io/proposal-unified-intl-numberformat/
......
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// Flags: --harmony-intl-numberformat-unified
// Test defaults // Test defaults
let nf = new Intl.NumberFormat(); let nf = new Intl.NumberFormat();
assertEquals(undefined, nf.resolvedOptions().currencyDisplay); assertEquals(undefined, nf.resolvedOptions().currencyDisplay);
......
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// Flags: --harmony-intl-numberformat-unified
// Test default. // Test default.
let nf = new Intl.NumberFormat(); let nf = new Intl.NumberFormat();
assertEquals(undefined, nf.resolvedOptions().currencySign); assertEquals(undefined, nf.resolvedOptions().currencySign);
......
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// Flags: --harmony-intl-numberformat-unified
// Except when the notation is "compact", the resolvedOptions().compactDisplay // Except when the notation is "compact", the resolvedOptions().compactDisplay
// should be undefined. // should be undefined.
// //
......
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// Flags: --harmony-intl-numberformat-unified
// Test notation: "engineering" with formatToParts. // Test notation: "engineering" with formatToParts.
const nf = Intl.NumberFormat("en", {notation: "engineering"}); const nf = Intl.NumberFormat("en", {notation: "engineering"});
......
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// Flags: --harmony-intl-numberformat-unified
// Test notation: "scientific" with formatToParts. // Test notation: "scientific" with formatToParts.
const nf = Intl.NumberFormat("en", {notation: "scientific"}); const nf = Intl.NumberFormat("en", {notation: "scientific"});
......
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// Flags: --harmony-intl-numberformat-unified
// Test defaults. // Test defaults.
let nf = new Intl.NumberFormat(); let nf = new Intl.NumberFormat();
......
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// Flags: --harmony-intl-numberformat-unified
//
// Test the handling of "percent" w/ "unit" // Test the handling of "percent" w/ "unit"
let nf1 = new Intl.NumberFormat("en-US", { let nf1 = new Intl.NumberFormat("en-US", {
......
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// Flags: --harmony-intl-numberformat-unified
// Test default. // Test default.
let nf = new Intl.NumberFormat(); let nf = new Intl.NumberFormat();
assertEquals("auto", nf.resolvedOptions().signDisplay); assertEquals("auto", nf.resolvedOptions().signDisplay);
......
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// Flags: --harmony-intl-numberformat-unified
// Test default. // Test default.
let nf = new Intl.NumberFormat(); let nf = new Intl.NumberFormat();
......
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// Flags: --harmony-intl-numberformat-unified
// Test default. // Test default.
let nf = new Intl.NumberFormat(); let nf = new Intl.NumberFormat();
assertEquals(undefined, nf.resolvedOptions().unitDisplay); assertEquals(undefined, nf.resolvedOptions().unitDisplay);
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// Flags: --harmony-intl-numberformat-unified
// Test precision of compact-rounding // Test precision of compact-rounding
let compact = {notation: "compact"}; let compact = {notation: "compact"};
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// Flags: --harmony-intl-numberformat-unified
// Test format of all valid units won't throw exception. // Test format of all valid units won't throw exception.
let validList = [ let validList = [
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// Flags: --harmony-intl-numberformat-unified
// Test Infinity, -Infinity, NaN won't crash with any notation in formatToParts. // Test Infinity, -Infinity, NaN won't crash with any notation in formatToParts.
let validNotations = [ let validNotations = [
......
...@@ -44,16 +44,12 @@ from testrunner.outproc import test262 ...@@ -44,16 +44,12 @@ from testrunner.outproc import test262
# TODO(littledan): move the flag mapping into the status file # TODO(littledan): move the flag mapping into the status file
FEATURE_FLAGS = { FEATURE_FLAGS = {
'Intl.DateTimeFormat-datetimestyle': '--harmony-intl-datetime-style',
'Intl.DateTimeFormat-formatRange': '--harmony-intl-date-format-range',
'Intl.NumberFormat-unified': '--harmony-intl-numberformat-unified',
'Intl.Segmenter': '--harmony-intl-segmenter', 'Intl.Segmenter': '--harmony-intl-segmenter',
'Intl.DateTimeFormat-dayPeriod': '--harmony-intl-dateformat-day-period', 'Intl.DateTimeFormat-dayPeriod': '--harmony-intl-dateformat-day-period',
'Intl.DateTimeFormat-quarter': '--harmony-intl-dateformat-quarter', 'Intl.DateTimeFormat-quarter': '--harmony-intl-dateformat-quarter',
'Intl.DateTimeFormat-fractionalSecondDigits': '--harmony-intl-dateformat-fractional-second-digits', 'Intl.DateTimeFormat-fractionalSecondDigits': '--harmony-intl-dateformat-fractional-second-digits',
'Symbol.prototype.description': '--harmony-symbol-description', 'Symbol.prototype.description': '--harmony-symbol-description',
'export-star-as-namespace-from-module': '--harmony-namespace-exports', 'export-star-as-namespace-from-module': '--harmony-namespace-exports',
'BigInt': '--harmony-intl-bigint',
'Promise.allSettled': '--harmony-promise-all-settled', 'Promise.allSettled': '--harmony-promise-all-settled',
'FinalizationGroup': '--harmony-weak-refs', 'FinalizationGroup': '--harmony-weak-refs',
'WeakRef': '--harmony-weak-refs', 'WeakRef': '--harmony-weak-refs',
......
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