diff --git a/src/builtins/builtins-bigint.cc b/src/builtins/builtins-bigint.cc index c414d6db64..30da5207f9 100644 --- a/src/builtins/builtins-bigint.cc +++ b/src/builtins/builtins-bigint.cc @@ -127,19 +127,16 @@ BUILTIN(BigIntPrototypeToLocaleString) { HandleScope scope(isolate); const char* method = "BigInt.prototype.toLocaleString"; #ifdef V8_INTL_SUPPORT - if (FLAG_harmony_intl_bigint) { - // 1. Let x be ? thisBigIntValue(this value). - Handle x; - ASSIGN_RETURN_FAILURE_ON_EXCEPTION( - isolate, x, ThisBigIntValue(isolate, args.receiver(), method)); + // 1. Let x be ? thisBigIntValue(this value). + Handle x; + ASSIGN_RETURN_FAILURE_ON_EXCEPTION( + isolate, x, ThisBigIntValue(isolate, args.receiver(), method)); - RETURN_RESULT_OR_FAILURE( - isolate, - Intl::NumberToLocaleString(isolate, x, args.atOrUndefined(isolate, 1), - args.atOrUndefined(isolate, 2), method)); - } - // Fallbacks to old toString implemention if flag is off or no - // V8_INTL_SUPPORT + RETURN_RESULT_OR_FAILURE( + isolate, + Intl::NumberToLocaleString(isolate, x, args.atOrUndefined(isolate, 1), + args.atOrUndefined(isolate, 2), method)); + // Fallbacks to old toString implemention if no V8_INTL_SUPPORT #endif // V8_INTL_SUPPORT Handle radix = isolate->factory()->undefined_value(); return BigIntToStringImpl(args.receiver(), radix, isolate, method); diff --git a/src/builtins/builtins-intl.cc b/src/builtins/builtins-intl.cc index 22bd065783..81954a481f 100644 --- a/src/builtins/builtins-intl.cc +++ b/src/builtins/builtins-intl.cc @@ -83,13 +83,8 @@ BUILTIN(NumberFormatPrototypeFormatToParts) { Handle x; if (args.length() >= 2) { - if (FLAG_harmony_intl_bigint) { - ASSIGN_RETURN_FAILURE_ON_EXCEPTION( - isolate, x, Object::ToNumeric(isolate, args.at(1))); - } else { - ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, x, - Object::ToNumber(isolate, args.at(1))); - } + ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, x, + Object::ToNumeric(isolate, args.at(1))); } else { x = isolate->factory()->nan_value(); } @@ -468,13 +463,8 @@ BUILTIN(NumberFormatInternalFormatNumber) { // 4. Let x be ? ToNumeric(value). Handle numeric_obj; - if (FLAG_harmony_intl_bigint) { - ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, numeric_obj, - Object::ToNumeric(isolate, value)); - } else { - ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, numeric_obj, - Object::ToNumber(isolate, value)); - } + ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, numeric_obj, + Object::ToNumeric(isolate, value)); icu::number::LocalizedNumberFormatter* icu_localized_number_formatter = number_format->icu_number_formatter().raw(); diff --git a/src/flags/flag-definitions.h b/src/flags/flag-definitions.h index b681fa2fc2..763894b7f7 100644 --- a/src/flags/flag-definitions.h +++ b/src/flags/flag-definitions.h @@ -246,12 +246,7 @@ DEFINE_IMPLICATION(harmony_import_meta, harmony_dynamic_import) V(harmony_promise_all_settled, "harmony Promise.allSettled") #ifdef V8_INTL_SUPPORT -#define HARMONY_SHIPPING(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") +#define HARMONY_SHIPPING(V) HARMONY_SHIPPING_BASE(V) #else #define HARMONY_SHIPPING(V) HARMONY_SHIPPING_BASE(V) #endif diff --git a/src/init/bootstrapper.cc b/src/init/bootstrapper.cc index c926c077bd..c1d3f6f97c 100644 --- a/src/init/bootstrapper.cc +++ b/src/init/bootstrapper.cc @@ -2917,6 +2917,13 @@ void Genesis::InitializeGlobal(Handle global_object, SimpleInstallGetter(isolate_, prototype, factory->format_string(), 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 @@ -4271,13 +4278,10 @@ EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_nullish) #ifdef V8_INTL_SUPPORT 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_fractional_second_digits) 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 #undef EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE @@ -4436,32 +4440,6 @@ void Genesis::InitializeGlobal_harmony_regexp_match_indices() { #ifdef V8_INTL_SUPPORT -void Genesis::InitializeGlobal_harmony_intl_date_format_range() { - if (!FLAG_harmony_intl_date_format_range) return; - - Handle intl = Handle::cast( - JSReceiver::GetProperty( - isolate(), - Handle(native_context()->global_object(), isolate()), - factory()->InternalizeUtf8String("Intl")) - .ToHandleChecked()); - - Handle date_time_format_constructor = Handle::cast( - JSReceiver::GetProperty( - isolate(), intl, factory()->InternalizeUtf8String("DateTimeFormat")) - .ToHandleChecked()); - - Handle 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() { if (!FLAG_harmony_intl_segmenter) return; Handle intl = Handle::cast( diff --git a/src/objects/intl-objects.cc b/src/objects/intl-objects.cc index d3081b575b..13539a72a4 100644 --- a/src/objects/intl-objects.cc +++ b/src/objects/intl-objects.cc @@ -1086,13 +1086,8 @@ MaybeHandle Intl::NumberToLocaleString(Isolate* isolate, Handle options, const char* method) { Handle numeric_obj; - if (FLAG_harmony_intl_bigint) { - ASSIGN_RETURN_ON_EXCEPTION(isolate, numeric_obj, - Object::ToNumeric(isolate, num), String); - } else { - ASSIGN_RETURN_ON_EXCEPTION(isolate, numeric_obj, - Object::ToNumber(isolate, num), String); - } + ASSIGN_RETURN_ON_EXCEPTION(isolate, numeric_obj, + Object::ToNumeric(isolate, num), String); // 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 @@ -1204,40 +1199,18 @@ Maybe Intl::SetNumberFormatDigitOptions( int mxfd = 0; Handle mnfd_obj; Handle mxfd_obj; - if (FLAG_harmony_intl_numberformat_unified) { - // 6. Let mnfd be ? Get(options, "minimumFractionDigits"). - Handle mnfd_str = factory->minimumFractionDigits_string(); - ASSIGN_RETURN_ON_EXCEPTION_VALUE( - isolate, mnfd_obj, JSReceiver::GetProperty(isolate, options, mnfd_str), - Nothing()); - // 8. Let mnfd be ? Get(options, "maximumFractionDigits"). - Handle mxfd_str = factory->maximumFractionDigits_string(); - ASSIGN_RETURN_ON_EXCEPTION_VALUE( - isolate, mxfd_obj, JSReceiver::GetProperty(isolate, options, mxfd_str), - Nothing()); - } 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(); - } + // 6. Let mnfd be ? Get(options, "minimumFractionDigits"). + Handle mnfd_str = factory->minimumFractionDigits_string(); + ASSIGN_RETURN_ON_EXCEPTION_VALUE( + isolate, mnfd_obj, JSReceiver::GetProperty(isolate, options, mnfd_str), + Nothing()); - // 7. Let mxfdActualDefault be max( mnfd, mxfdDefault ). - int mxfd_actual_default = std::max(mnfd, mxfd_default); - - // 8. Let mxfd be ? GetNumberOption(options, - // "maximumFractionDigits", mnfd, 20, mxfdActualDefault). - if (!Intl::GetNumberOption(isolate, options, - factory->maximumFractionDigits_string(), mnfd, - 20, mxfd_actual_default) - .To(&mxfd)) { - return Nothing(); - } - } + // 8. Let mxfd be ? Get(options, "maximumFractionDigits"). + Handle mxfd_str = factory->maximumFractionDigits_string(); + ASSIGN_RETURN_ON_EXCEPTION_VALUE( + isolate, mxfd_obj, JSReceiver::GetProperty(isolate, options, mxfd_str), + Nothing()); // 9. Let mnsd be ? Get(options, "minimumSignificantDigits"). Handle mnsd_obj; @@ -1286,47 +1259,44 @@ Maybe Intl::SetNumberFormatDigitOptions( digit_options.minimum_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 - if (!mnfd_obj->IsUndefined(isolate) || !mxfd_obj->IsUndefined(isolate)) { - // 15. b. Let mnfd be ? DefaultNumberOption(mnfd, 0, 20, mnfdDefault). - Handle mnfd_str = factory->minimumFractionDigits_string(); - if (!DefaultNumberOption(isolate, mnfd_obj, 0, 20, mnfd_default, - mnfd_str) - .To(&mnfd)) { - return Nothing(); - } - - // 15. c. Let mxfdActualDefault be max( mnfd, mxfdDefault ). - int mxfd_actual_default = std::max(mnfd, mxfd_default); - - // 15. d. Let mxfd be ? DefaultNumberOption(mxfd, mnfd, 20, - // mxfdActualDefault). - Handle mxfd_str = factory->maximumFractionDigits_string(); - if (!DefaultNumberOption(isolate, mxfd_obj, mnfd, 20, - mxfd_actual_default, mxfd_str) - .To(&mxfd)) { - return Nothing(); - } - // 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. Else If mnfd is not undefined or mxfd is not undefined, then + if (!mnfd_obj->IsUndefined(isolate) || !mxfd_obj->IsUndefined(isolate)) { + // 15. b. Let mnfd be ? DefaultNumberOption(mnfd, 0, 20, mnfdDefault). + Handle mnfd_str = factory->minimumFractionDigits_string(); + if (!DefaultNumberOption(isolate, mnfd_obj, 0, 20, mnfd_default, mnfd_str) + .To(&mnfd)) { + return Nothing(); } + + // 15. c. Let mxfdActualDefault be max( mnfd, mxfdDefault ). + int mxfd_actual_default = std::max(mnfd, mxfd_default); + + // 15. d. Let mxfd be ? DefaultNumberOption(mxfd, mnfd, 20, + // mxfdActualDefault). + Handle mxfd_str = factory->maximumFractionDigits_string(); + if (!DefaultNumberOption(isolate, mxfd_obj, mnfd, 20, mxfd_actual_default, + mxfd_str) + .To(&mxfd)) { + return Nothing(); + } + // 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); diff --git a/src/objects/js-date-time-format.cc b/src/objects/js-date-time-format.cc index 1ee7f2056b..8d32c82332 100644 --- a/src/objects/js-date-time-format.cc +++ b/src/objects/js-date-time-format.cc @@ -1243,9 +1243,8 @@ MaybeHandle JSDateTimeFormat::New( const std::vector empty_values = {}; // 6. Let calendar be ? GetOption(options, "calendar", // "string", undefined, undefined). - Maybe maybe_calendar = - Intl::GetStringOption(isolate, options, "calendar", empty_values, - "Intl.NumberFormat", &calendar_str); + Maybe maybe_calendar = Intl::GetStringOption( + isolate, options, "calendar", empty_values, service, &calendar_str); MAYBE_RETURN(maybe_calendar, MaybeHandle()); if (maybe_calendar.FromJust() && calendar_str != nullptr) { icu::Locale default_locale; @@ -1262,7 +1261,7 @@ MaybeHandle JSDateTimeFormat::New( // 8. Let numberingSystem be ? GetOption(options, "numberingSystem", // "string", undefined, undefined). Maybe maybe_numberingSystem = Intl::GetNumberingSystem( - isolate, options, "Intl.NumberFormat", &numbering_system_str); + isolate, options, service, &numbering_system_str); MAYBE_RETURN(maybe_numberingSystem, MaybeHandle()); } @@ -1409,43 +1408,40 @@ MaybeHandle JSDateTimeFormat::New( DateTimeStyle time_style = DateTimeStyle::kUndefined; std::unique_ptr icu_date_format; - if (FLAG_harmony_intl_datetime_style) { - // 28. Let dateStyle be ? GetOption(options, "dateStyle", "string", « - // "full", "long", "medium", "short" », undefined). - Maybe maybe_date_style = - Intl::GetStringOption( - isolate, options, "dateStyle", service, - {"full", "long", "medium", "short"}, - {DateTimeStyle::kFull, DateTimeStyle::kLong, DateTimeStyle::kMedium, - DateTimeStyle::kShort}, - DateTimeStyle::kUndefined); - MAYBE_RETURN(maybe_date_style, MaybeHandle()); - // 29. If dateStyle is not undefined, set dateTimeFormat.[[DateStyle]] to - // dateStyle. - date_style = maybe_date_style.FromJust(); + // 28. Let dateStyle be ? GetOption(options, "dateStyle", "string", « + // "full", "long", "medium", "short" », undefined). + Maybe maybe_date_style = Intl::GetStringOption( + isolate, options, "dateStyle", service, + {"full", "long", "medium", "short"}, + {DateTimeStyle::kFull, DateTimeStyle::kLong, DateTimeStyle::kMedium, + DateTimeStyle::kShort}, + DateTimeStyle::kUndefined); + MAYBE_RETURN(maybe_date_style, MaybeHandle()); + // 29. If dateStyle is not undefined, set dateTimeFormat.[[DateStyle]] to + // dateStyle. + date_style = maybe_date_style.FromJust(); - // 30. Let timeStyle be ? GetOption(options, "timeStyle", "string", « - // "full", "long", "medium", "short" »). - Maybe maybe_time_style = - Intl::GetStringOption( - isolate, options, "timeStyle", service, - {"full", "long", "medium", "short"}, - {DateTimeStyle::kFull, DateTimeStyle::kLong, DateTimeStyle::kMedium, - DateTimeStyle::kShort}, - DateTimeStyle::kUndefined); - MAYBE_RETURN(maybe_time_style, MaybeHandle()); + // 30. Let timeStyle be ? GetOption(options, "timeStyle", "string", « + // "full", "long", "medium", "short" »). + Maybe maybe_time_style = Intl::GetStringOption( + isolate, options, "timeStyle", service, + {"full", "long", "medium", "short"}, + {DateTimeStyle::kFull, DateTimeStyle::kLong, DateTimeStyle::kMedium, + DateTimeStyle::kShort}, + DateTimeStyle::kUndefined); + MAYBE_RETURN(maybe_time_style, MaybeHandle()); - // 31. If timeStyle is not undefined, set dateTimeFormat.[[TimeStyle]] to - // timeStyle. - time_style = maybe_time_style.FromJust(); + // 31. If timeStyle is not undefined, set dateTimeFormat.[[TimeStyle]] to + // timeStyle. + time_style = maybe_time_style.FromJust(); - // 32. If dateStyle or timeStyle are not undefined, then - if (date_style != DateTimeStyle::kUndefined || - time_style != DateTimeStyle::kUndefined) { - icu_date_format = DateTimeStylePattern(date_style, time_style, icu_locale, - hc, generator.get()); - } + // 32. If dateStyle or timeStyle are not undefined, then + if (date_style != DateTimeStyle::kUndefined || + time_style != DateTimeStyle::kUndefined) { + icu_date_format = DateTimeStylePattern(date_style, time_style, icu_locale, + hc, generator.get()); } + // 33. Else, if (icu_date_format.get() == nullptr) { bool has_hour_option = false; diff --git a/src/objects/js-number-format-inl.h b/src/objects/js-number-format-inl.h index afdfef89f2..f68252ab0b 100644 --- a/src/objects/js-number-format-inl.h +++ b/src/objects/js-number-format-inl.h @@ -26,46 +26,8 @@ ACCESSORS(JSNumberFormat, icu_number_formatter, kIcuNumberFormatterOffset) 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) -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) { DCHECK_GE(StyleBits::kMax, style); int hints = flags(); diff --git a/src/objects/js-number-format.cc b/src/objects/js-number-format.cc index b149fa60a1..1fb351d55b 100644 --- a/src/objects/js-number-format.cc +++ b/src/objects/js-number-format.cc @@ -33,7 +33,6 @@ namespace { // [[CurrencyDisplay]] is one of the values "code", "symbol", "name", // or "narrowSymbol" identifying the display of the currency number format. -// Note: "narrowSymbol" is added in proposal-unified-intl-numberformat enum class CurrencyDisplay { CODE, SYMBOL, @@ -621,12 +620,11 @@ JSNumberFormat::SetDigitOptionsToFormatter( result = result.integerWidth(icu::number::IntegerWidth::zeroFillTo( digit_options.minimum_integer_digits)); } - if (FLAG_harmony_intl_numberformat_unified) { - // Value -1 of minimum_significant_digits represent the roundingtype is - // "compact-rounding". - if (digit_options.minimum_significant_digits < 0) { - return result; - } + + // Value -1 of minimum_significant_digits represent the roundingtype is + // "compact-rounding". + if (digit_options.minimum_significant_digits < 0) { + return result; } icu::number::Precision precision = (digit_options.minimum_significant_digits > 0) @@ -704,15 +702,12 @@ Handle JSNumberFormat::ResolvedOptions( isolate, options, factory->currencyDisplay_string(), CurrencyDisplayString(isolate, skeleton), Just(kDontThrow)) .FromJust()); - if (FLAG_harmony_intl_numberformat_unified) { - CHECK(JSReceiver::CreateDataProperty( - isolate, options, factory->currencySign_string(), - CurrencySignString(isolate, skeleton), Just(kDontThrow)) - .FromJust()); - } + CHECK(JSReceiver::CreateDataProperty( + isolate, options, factory->currencySign_string(), + CurrencySignString(isolate, skeleton), Just(kDontThrow)) + .FromJust()); } - if (FLAG_harmony_intl_numberformat_unified) { if (style == JSNumberFormat::Style::UNIT) { std::string unit = UnitFromSkeleton(skeleton); if (!unit.empty()) { @@ -727,7 +722,6 @@ Handle JSNumberFormat::ResolvedOptions( UnitDisplayString(isolate, skeleton), Just(kDontThrow)) .FromJust()); } - } CHECK( JSReceiver::CreateDataProperty( @@ -735,27 +729,9 @@ Handle JSNumberFormat::ResolvedOptions( factory->NewNumberFromInt(MinimumIntegerDigitsFromSkeleton(skeleton)), Just(kDontThrow)) .FromJust()); - int32_t minimum = 0, maximum = 0; - bool output_fraction = - 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) { + int32_t minimum = 0, maximum = 0; + if (FractionDigitsFromSkeleton(skeleton, &minimum, &maximum)) { CHECK(JSReceiver::CreateDataProperty( isolate, options, factory->minimumFractionDigits_string(), factory->NewNumberFromInt(minimum), Just(kDontThrow)) @@ -765,6 +741,7 @@ Handle JSNumberFormat::ResolvedOptions( factory->NewNumberFromInt(maximum), Just(kDontThrow)) .FromJust()); } + minimum = 0; maximum = 0; if (SignificantDigitsFromSkeleton(skeleton, &minimum, &maximum)) { @@ -783,24 +760,22 @@ Handle JSNumberFormat::ResolvedOptions( factory->ToBoolean(UseGroupingFromSkeleton(skeleton)), Just(kDontThrow)) .FromJust()); - if (FLAG_harmony_intl_numberformat_unified) { - Notation notation = NotationFromSkeleton(skeleton); + Notation notation = NotationFromSkeleton(skeleton); + CHECK(JSReceiver::CreateDataProperty( + isolate, options, factory->notation_string(), + NotationAsString(isolate, notation), Just(kDontThrow)) + .FromJust()); + // Only output compactDisplay when notation is compact. + if (notation == Notation::COMPACT) { CHECK(JSReceiver::CreateDataProperty( - isolate, options, factory->notation_string(), - NotationAsString(isolate, notation), Just(kDontThrow)) - .FromJust()); - // Only output compactDisplay when notation is compact. - if (notation == Notation::COMPACT) { - CHECK(JSReceiver::CreateDataProperty( - isolate, options, factory->compactDisplay_string(), - CompactDisplayString(isolate, skeleton), Just(kDontThrow)) - .FromJust()); - } - CHECK(JSReceiver::CreateDataProperty( - isolate, options, factory->signDisplay_string(), - SignDisplayString(isolate, skeleton), Just(kDontThrow)) + isolate, options, factory->compactDisplay_string(), + CompactDisplayString(isolate, skeleton), Just(kDontThrow)) .FromJust()); } + CHECK(JSReceiver::CreateDataProperty( + isolate, options, factory->signDisplay_string(), + SignDisplayString(isolate, skeleton), Just(kDontThrow)) + .FromJust()); return options; } @@ -877,7 +852,7 @@ MaybeHandle JSNumberFormat::New(Isolate* isolate, // 7. Let _numberingSystem_ be ? GetOption(_options_, `"numberingSystem"`, // `"string"`, *undefined*, *undefined*). Maybe maybe_numberingSystem = Intl::GetNumberingSystem( - isolate, options, "Intl.RelativeTimeFormat", &numbering_system_str); + isolate, options, service, &numbering_system_str); // 8. If _numberingSystem_ is not *undefined*, then // a. If _numberingSystem_ does not match the // `(3*8alphanum) *("-" (3*8alphanum))` sequence, throw a *RangeError* @@ -913,20 +888,15 @@ MaybeHandle JSNumberFormat::New(Isolate* isolate, .roundingMode(UNUM_ROUND_HALFUP); // 12. Let style be ? GetOption(options, "style", "string", « "decimal", - // "percent", "currency" », "decimal"). + // "percent", "currency", "unit" », "decimal"). - std::vector style_str_values({"decimal", "percent", "currency"}); - std::vector 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 maybe_style = Intl::GetStringOption( - isolate, options, "style", service, style_str_values, - style_enum_values, JSNumberFormat::Style::DECIMAL); + isolate, options, "style", service, + {"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::Style style = maybe_style.FromJust(); @@ -976,98 +946,87 @@ MaybeHandle JSNumberFormat::New(Isolate* isolate, } // 18. Let currencyDisplay be ? GetOption(options, "currencyDisplay", - // "string", « "code", "symbol", "name" », "symbol"). - std::vector currency_display_str_values( - {"code", "symbol", "name"}); - std::vector 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); - } + // "string", « "code", "symbol", "name", "narrowSymbol" », "symbol"). Maybe maybe_currency_display = Intl::GetStringOption( 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); MAYBE_RETURN(maybe_currency_display, MaybeHandle()); CurrencyDisplay currency_display = maybe_currency_display.FromJust(); CurrencySign currency_sign = CurrencySign::STANDARD; - if (FLAG_harmony_intl_numberformat_unified) { - // Let currencySign be ? GetOption(options, "currencySign", "string", « - // "standard", "accounting" », "standard"). - Maybe maybe_currency_sign = - Intl::GetStringOption( - isolate, options, "currencySign", service, - {"standard", "accounting"}, - {CurrencySign::STANDARD, CurrencySign::ACCOUNTING}, - CurrencySign::STANDARD); - MAYBE_RETURN(maybe_currency_sign, MaybeHandle()); - currency_sign = maybe_currency_sign.FromJust(); + // Let currencySign be ? GetOption(options, "currencySign", "string", « + // "standard", "accounting" », "standard"). + Maybe maybe_currency_sign = Intl::GetStringOption( + isolate, options, "currencySign", service, {"standard", "accounting"}, + {CurrencySign::STANDARD, CurrencySign::ACCOUNTING}, + CurrencySign::STANDARD); + MAYBE_RETURN(maybe_currency_sign, MaybeHandle()); + currency_sign = maybe_currency_sign.FromJust(); - // Let unit be ? GetOption(options, "unit", "string", undefined, undefined). - std::unique_ptr unit_cstr; - Maybe found_unit = Intl::GetStringOption( - isolate, options, "unit", empty_values, service, &unit_cstr); - MAYBE_RETURN(found_unit, MaybeHandle()); + // Let unit be ? GetOption(options, "unit", "string", undefined, undefined). + std::unique_ptr unit_cstr; + Maybe found_unit = Intl::GetStringOption( + isolate, options, "unit", empty_values, service, &unit_cstr); + MAYBE_RETURN(found_unit, MaybeHandle()); - std::string unit; - if (found_unit.FromJust()) { - DCHECK_NOT_NULL(unit_cstr.get()); - unit = unit_cstr.get(); + std::string unit; + 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 maybe_unit_display = Intl::GetStringOption( + isolate, options, "unitDisplay", service, {"short", "narrow", "long"}, + {UnitDisplay::SHORT, UnitDisplay::NARROW, UnitDisplay::LONG}, + UnitDisplay::SHORT); + MAYBE_RETURN(maybe_unit_display, MaybeHandle()); + 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", « - // "short", "narrow", "long" », "short"). - Maybe maybe_unit_display = Intl::GetStringOption( - isolate, options, "unitDisplay", service, {"short", "narrow", "long"}, - {UnitDisplay::SHORT, UnitDisplay::NARROW, UnitDisplay::LONG}, - UnitDisplay::SHORT); - MAYBE_RETURN(maybe_unit_display, MaybeHandle()); - UnitDisplay unit_display = maybe_unit_display.FromJust(); + // If the result of IsWellFormedUnitIdentifier(unit) is false, throw a + // RangeError exception. + Maybe> 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 unit_pair = + maybe_wellformed.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); - } + // Set intlObj.[[Unit]] to unit. + if (unit_pair.first != icu::NoUnit::base()) { + icu_number_formatter = icu_number_formatter.unit(unit_pair.first); + } + if (unit_pair.second != icu::NoUnit::base()) { + icu_number_formatter = icu_number_formatter.perUnit(unit_pair.second); + } - // If the result of IsWellFormedUnitIdentifier(unit) is false, throw a - // RangeError exception. - Maybe> 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 unit_pair = - maybe_wellformed.FromJust(); - - // Set intlObj.[[Unit]] to unit. - if (unit_pair.first != icu::NoUnit::base()) { - icu_number_formatter = icu_number_formatter.unit(unit_pair.first); - } - if (unit_pair.second != icu::NoUnit::base()) { - icu_number_formatter = icu_number_formatter.perUnit(unit_pair.second); - } - - // The default unitWidth is SHORT in ICU and that mapped from - // Symbol so we can skip the setting for optimization. - if (unit_display != UnitDisplay::SHORT) { - icu_number_formatter = - icu_number_formatter.unitWidth(ToUNumberUnitWidth(unit_display)); - } + // The default unitWidth is SHORT in ICU and that mapped from + // Symbol so we can skip the setting for optimization. + if (unit_display != UnitDisplay::SHORT) { + icu_number_formatter = + icu_number_formatter.unitWidth(ToUNumberUnitWidth(unit_display)); } } @@ -1123,18 +1082,16 @@ MaybeHandle JSNumberFormat::New(Isolate* isolate, } Notation notation = Notation::STANDARD; - if (FLAG_harmony_intl_numberformat_unified) { - // 25. Let notation be ? GetOption(options, "notation", "string", « - // "standard", "scientific", "engineering", "compact" », "standard"). - Maybe maybe_notation = Intl::GetStringOption( - isolate, options, "notation", service, - {"standard", "scientific", "engineering", "compact"}, - {Notation::STANDARD, Notation::SCIENTIFIC, Notation::ENGINEERING, - Notation::COMPACT}, - Notation::STANDARD); - MAYBE_RETURN(maybe_notation, MaybeHandle()); - notation = maybe_notation.FromJust(); - } + // 25. Let notation be ? GetOption(options, "notation", "string", « + // "standard", "scientific", "engineering", "compact" », "standard"). + Maybe maybe_notation = Intl::GetStringOption( + isolate, options, "notation", service, + {"standard", "scientific", "engineering", "compact"}, + {Notation::STANDARD, Notation::SCIENTIFIC, Notation::ENGINEERING, + Notation::COMPACT}, + Notation::STANDARD); + MAYBE_RETURN(maybe_notation, MaybeHandle()); + notation = maybe_notation.FromJust(); // 27. Perform ? SetNumberFormatDigitOptions(numberFormat, options, // mnfdDefault, mxfdDefault). @@ -1147,24 +1104,21 @@ MaybeHandle JSNumberFormat::New(Isolate* isolate, icu_number_formatter = JSNumberFormat::SetDigitOptionsToFormatter( icu_number_formatter, digit_options); - if (FLAG_harmony_intl_numberformat_unified) { - // 28. Let compactDisplay be ? GetOption(options, "compactDisplay", - // "string", « "short", "long" », "short"). - Maybe maybe_compact_display = - Intl::GetStringOption( - isolate, options, "compactDisplay", service, {"short", "long"}, - {CompactDisplay::SHORT, CompactDisplay::LONG}, - CompactDisplay::SHORT); - MAYBE_RETURN(maybe_compact_display, MaybeHandle()); - CompactDisplay compact_display = maybe_compact_display.FromJust(); + // 28. Let compactDisplay be ? GetOption(options, "compactDisplay", + // "string", « "short", "long" », "short"). + Maybe maybe_compact_display = + Intl::GetStringOption( + isolate, options, "compactDisplay", service, {"short", "long"}, + {CompactDisplay::SHORT, CompactDisplay::LONG}, CompactDisplay::SHORT); + MAYBE_RETURN(maybe_compact_display, MaybeHandle()); + CompactDisplay compact_display = maybe_compact_display.FromJust(); - // 26. Set numberFormat.[[Notation]] to notation. - // The default notation in ICU is Simple, which mapped from STANDARD - // so we can skip setting it. - if (notation != Notation::STANDARD) { - icu_number_formatter = icu_number_formatter.notation( - ToICUNotation(notation, compact_display)); - } + // 26. Set numberFormat.[[Notation]] to notation. + // The default notation in ICU is Simple, which mapped from STANDARD + // so we can skip setting it. + if (notation != Notation::STANDARD) { + icu_number_formatter = + icu_number_formatter.notation(ToICUNotation(notation, compact_display)); } // 30. Let useGrouping be ? GetOption(options, "useGrouping", "boolean", // undefined, true). @@ -1178,27 +1132,25 @@ MaybeHandle JSNumberFormat::New(Isolate* isolate, UNumberGroupingStrategy::UNUM_GROUPING_OFF); } - if (FLAG_harmony_intl_numberformat_unified) { - // 32. Let signDisplay be ? GetOption(options, "signDisplay", "string", « - // "auto", "never", "always", "exceptZero" », "auto"). - Maybe maybe_sign_display = Intl::GetStringOption( - isolate, options, "signDisplay", service, - {"auto", "never", "always", "exceptZero"}, - {SignDisplay::AUTO, SignDisplay::NEVER, SignDisplay::ALWAYS, - SignDisplay::EXCEPT_ZERO}, - SignDisplay::AUTO); - MAYBE_RETURN(maybe_sign_display, MaybeHandle()); - SignDisplay sign_display = maybe_sign_display.FromJust(); + // 32. Let signDisplay be ? GetOption(options, "signDisplay", "string", « + // "auto", "never", "always", "exceptZero" », "auto"). + Maybe maybe_sign_display = Intl::GetStringOption( + isolate, options, "signDisplay", service, + {"auto", "never", "always", "exceptZero"}, + {SignDisplay::AUTO, SignDisplay::NEVER, SignDisplay::ALWAYS, + SignDisplay::EXCEPT_ZERO}, + SignDisplay::AUTO); + MAYBE_RETURN(maybe_sign_display, MaybeHandle()); + SignDisplay sign_display = maybe_sign_display.FromJust(); - // 33. Set numberFormat.[[SignDisplay]] to signDisplay. - // The default sign in ICU is UNUM_SIGN_AUTO which is mapped from - // SignDisplay::AUTO and CurrencySign::STANDARD so we can skip setting - // under that values for optimization. - if (sign_display != SignDisplay::AUTO || - currency_sign != CurrencySign::STANDARD) { - icu_number_formatter = icu_number_formatter.sign( - ToUNumberSignDisplay(sign_display, currency_sign)); - } + // 33. Set numberFormat.[[SignDisplay]] to signDisplay. + // The default sign in ICU is UNUM_SIGN_AUTO which is mapped from + // SignDisplay::AUTO and CurrencySign::STANDARD so we can skip setting + // under that values for optimization. + if (sign_display != SignDisplay::AUTO || + currency_sign != CurrencySign::STANDARD) { + icu_number_formatter = icu_number_formatter.sign( + ToUNumberSignDisplay(sign_display, currency_sign)); } // 25. Let dataLocaleData be localeData.[[]]. @@ -1229,24 +1181,6 @@ MaybeHandle JSNumberFormat::New(Isolate* isolate, number_format->set_style(style); 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_bound_format(*factory->undefined_value()); diff --git a/src/objects/js-number-format.h b/src/objects/js-number-format.h index f9a4b729ba..d0807e5bef 100644 --- a/src/objects/js-number-format.h +++ b/src/objects/js-number-format.h @@ -72,26 +72,6 @@ class JSNumberFormat : public JSObject { DECL_PRINTER(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", // or "unit" identifying the style of the number format. // Note: "unit" is added in proposal-unified-intl-numberformat @@ -106,15 +86,11 @@ class JSNumberFormat : public JSObject { // Bit positions in |flags|. #define FLAGS_BIT_FIELDS(V, _) \ - V(MinimumFractionDigitsBits, int, 5, _) \ - V(MaximumFractionDigitsBits, int, 5, _) \ V(StyleBits, Style, 2, _) DEFINE_BIT_FIELDS(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::PERCENT <= StyleBits::kMax); STATIC_ASSERT(Style::CURRENCY <= StyleBits::kMax); diff --git a/test/intl/bigint/tolocalestring.js b/test/intl/bigint/tolocalestring.js index d0b6792ea8..449d644546 100644 --- a/test/intl/bigint/tolocalestring.js +++ b/test/intl/bigint/tolocalestring.js @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flags: --harmony-intl-bigint - var locales = [ "en", // "1,234,567,890,123,456" "de", // "1.234.567.890.123.456" diff --git a/test/intl/date-format/constructor-date-style-order.js b/test/intl/date-format/constructor-date-style-order.js index 8e601b48d3..b148d8eea7 100644 --- a/test/intl/date-format/constructor-date-style-order.js +++ b/test/intl/date-format/constructor-date-style-order.js @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flags: --harmony-intl-datetime-style - // Throws only once during construction. // Check for all getters to prevent regression. // Preserve the order of getter initialization. diff --git a/test/intl/date-format/constructor-date-time-style-order.js b/test/intl/date-format/constructor-date-time-style-order.js index d4d114662f..8152b17618 100644 --- a/test/intl/date-format/constructor-date-time-style-order.js +++ b/test/intl/date-format/constructor-date-time-style-order.js @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flags: --harmony-intl-datetime-style - // Throws only once during construction. // Check for all getters to prevent regression. // Preserve the order of getter initialization. diff --git a/test/intl/date-format/constructor-date-time-style.js b/test/intl/date-format/constructor-date-time-style.js index f4bc40b396..477c5c5a01 100644 --- a/test/intl/date-format/constructor-date-time-style.js +++ b/test/intl/date-format/constructor-date-time-style.js @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flags: --harmony-intl-datetime-style - var validStyle = ["full", "long", "medium", "short", undefined]; var invalidStyle = ["narrow", "numeric"]; diff --git a/test/intl/date-format/constructor-no-style-order.js b/test/intl/date-format/constructor-no-style-order.js index bd4bc4cc37..a671968367 100644 --- a/test/intl/date-format/constructor-no-style-order.js +++ b/test/intl/date-format/constructor-no-style-order.js @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flags: --harmony-intl-datetime-style - // Throws only once during construction. // Check for all getters to prevent regression. // Preserve the order of getter initialization. diff --git a/test/intl/date-format/constructor-time-style-order.js b/test/intl/date-format/constructor-time-style-order.js index d35f21a196..b3c8850dde 100644 --- a/test/intl/date-format/constructor-time-style-order.js +++ b/test/intl/date-format/constructor-time-style-order.js @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flags: --harmony-intl-datetime-style - // Throws only once during construction. // Check for all getters to prevent regression. // Preserve the order of getter initialization. diff --git a/test/intl/date-format/en-format-range-to-parts.js b/test/intl/date-format/en-format-range-to-parts.js index c2421812f8..9d9b2b8193 100644 --- a/test/intl/date-format/en-format-range-to-parts.js +++ b/test/intl/date-format/en-format-range-to-parts.js @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flags: --harmony-intl-date-format-range - const date1 = new Date("2019-01-03T03:20"); const date2 = new Date("2019-01-05T19:33"); const date3 = new Date("2019-01-05T22:57"); diff --git a/test/intl/date-format/format-range-to-parts.js b/test/intl/date-format/format-range-to-parts.js index b2eac1765c..3ffd61ba7e 100644 --- a/test/intl/date-format/format-range-to-parts.js +++ b/test/intl/date-format/format-range-to-parts.js @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flags: --harmony-intl-date-format-range - let descriptor = Object.getOwnPropertyDescriptor( Intl.DateTimeFormat.prototype, "formatRangeToParts"); assertTrue(descriptor.writable); diff --git a/test/intl/date-format/format-range.js b/test/intl/date-format/format-range.js index f00f228b07..066e53e1bd 100644 --- a/test/intl/date-format/format-range.js +++ b/test/intl/date-format/format-range.js @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flags: --harmony-intl-date-format-range - let descriptor = Object.getOwnPropertyDescriptor( Intl.DateTimeFormat.prototype, "formatRange"); assertTrue(descriptor.writable); diff --git a/test/intl/date-format/property-override-date-style.js b/test/intl/date-format/property-override-date-style.js index 542ef5eb27..f0a2211d2b 100644 --- a/test/intl/date-format/property-override-date-style.js +++ b/test/intl/date-format/property-override-date-style.js @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flags: --harmony-intl-datetime-style - // Checks for security holes introduced by Object.property overrides. // For example: // Object.defineProperty(Array.prototype, 'locale', { diff --git a/test/intl/date-format/property-override-date-time-style.js b/test/intl/date-format/property-override-date-time-style.js index 8977be2967..6cb7af171f 100644 --- a/test/intl/date-format/property-override-date-time-style.js +++ b/test/intl/date-format/property-override-date-time-style.js @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flags: --harmony-intl-datetime-style - // Checks for security holes introduced by Object.property overrides. // For example: // Object.defineProperty(Array.prototype, 'locale', { diff --git a/test/intl/date-format/property-override-time-style.js b/test/intl/date-format/property-override-time-style.js index ab8fa22d0b..50cb6e26f1 100644 --- a/test/intl/date-format/property-override-time-style.js +++ b/test/intl/date-format/property-override-time-style.js @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flags: --harmony-intl-datetime-style - // Checks for security holes introduced by Object.property overrides. // For example: // Object.defineProperty(Array.prototype, 'locale', { diff --git a/test/intl/number-format/property-override.js b/test/intl/number-format/property-override.js deleted file mode 100644 index 590b1c2e4b..0000000000 --- a/test/intl/number-format/property-override.js +++ /dev/null @@ -1,80 +0,0 @@ -// 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; diff --git a/test/intl/number-format/unified/compact-display.js b/test/intl/number-format/unified/compact-display.js index 228a2b6259..666cab86f4 100644 --- a/test/intl/number-format/unified/compact-display.js +++ b/test/intl/number-format/unified/compact-display.js @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flags: --harmony-intl-numberformat-unified - const testData = [ ["short"], ["long"], diff --git a/test/intl/number-format/unified/constructor-order.js b/test/intl/number-format/unified/constructor-order.js index be716371f5..f32f0b1696 100644 --- a/test/intl/number-format/unified/constructor-order.js +++ b/test/intl/number-format/unified/constructor-order.js @@ -2,7 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flags: --harmony-intl-numberformat-unified // Similar to constructor-order.js but also consider the new options // in https://tc39-transfer.github.io/proposal-unified-intl-numberformat/ diff --git a/test/intl/number-format/unified/currency-display.js b/test/intl/number-format/unified/currency-display.js index effd026778..3c407f27cb 100644 --- a/test/intl/number-format/unified/currency-display.js +++ b/test/intl/number-format/unified/currency-display.js @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flags: --harmony-intl-numberformat-unified - // Test defaults let nf = new Intl.NumberFormat(); assertEquals(undefined, nf.resolvedOptions().currencyDisplay); diff --git a/test/intl/number-format/unified/currency-sign.js b/test/intl/number-format/unified/currency-sign.js index 3f2941a8e9..9bfecf8c9b 100644 --- a/test/intl/number-format/unified/currency-sign.js +++ b/test/intl/number-format/unified/currency-sign.js @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flags: --harmony-intl-numberformat-unified - // Test default. let nf = new Intl.NumberFormat(); assertEquals(undefined, nf.resolvedOptions().currencySign); diff --git a/test/intl/number-format/unified/no-compact-display.js b/test/intl/number-format/unified/no-compact-display.js index 95611e90fc..36d75722ea 100644 --- a/test/intl/number-format/unified/no-compact-display.js +++ b/test/intl/number-format/unified/no-compact-display.js @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flags: --harmony-intl-numberformat-unified - // Except when the notation is "compact", the resolvedOptions().compactDisplay // should be undefined. // diff --git a/test/intl/number-format/unified/notation-engineering-formatToParts.js b/test/intl/number-format/unified/notation-engineering-formatToParts.js index 280771b2e7..da91f4ba96 100644 --- a/test/intl/number-format/unified/notation-engineering-formatToParts.js +++ b/test/intl/number-format/unified/notation-engineering-formatToParts.js @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flags: --harmony-intl-numberformat-unified - // Test notation: "engineering" with formatToParts. const nf = Intl.NumberFormat("en", {notation: "engineering"}); diff --git a/test/intl/number-format/unified/notation-scientific-formatToParts.js b/test/intl/number-format/unified/notation-scientific-formatToParts.js index 9ffd5f8709..ade723dbe3 100644 --- a/test/intl/number-format/unified/notation-scientific-formatToParts.js +++ b/test/intl/number-format/unified/notation-scientific-formatToParts.js @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flags: --harmony-intl-numberformat-unified - // Test notation: "scientific" with formatToParts. const nf = Intl.NumberFormat("en", {notation: "scientific"}); diff --git a/test/intl/number-format/unified/notation.js b/test/intl/number-format/unified/notation.js index b26ee01f5c..3711644f52 100644 --- a/test/intl/number-format/unified/notation.js +++ b/test/intl/number-format/unified/notation.js @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flags: --harmony-intl-numberformat-unified - // Test defaults. let nf = new Intl.NumberFormat(); diff --git a/test/intl/number-format/unified/percent.js b/test/intl/number-format/unified/percent.js index 9918210ec7..c4de0f7fec 100644 --- a/test/intl/number-format/unified/percent.js +++ b/test/intl/number-format/unified/percent.js @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flags: --harmony-intl-numberformat-unified -// // Test the handling of "percent" w/ "unit" let nf1 = new Intl.NumberFormat("en-US", { diff --git a/test/intl/number-format/unified/sign-display.js b/test/intl/number-format/unified/sign-display.js index c71f57e67c..18b74c9f0b 100644 --- a/test/intl/number-format/unified/sign-display.js +++ b/test/intl/number-format/unified/sign-display.js @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flags: --harmony-intl-numberformat-unified - // Test default. let nf = new Intl.NumberFormat(); assertEquals("auto", nf.resolvedOptions().signDisplay); diff --git a/test/intl/number-format/unified/style-unit.js b/test/intl/number-format/unified/style-unit.js index 72eb0a782d..757c0093c2 100644 --- a/test/intl/number-format/unified/style-unit.js +++ b/test/intl/number-format/unified/style-unit.js @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flags: --harmony-intl-numberformat-unified - // Test default. let nf = new Intl.NumberFormat(); diff --git a/test/intl/number-format/unified/unit-display.js b/test/intl/number-format/unified/unit-display.js index d4d814d70e..d451fda324 100644 --- a/test/intl/number-format/unified/unit-display.js +++ b/test/intl/number-format/unified/unit-display.js @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flags: --harmony-intl-numberformat-unified - // Test default. let nf = new Intl.NumberFormat(); assertEquals(undefined, nf.resolvedOptions().unitDisplay); diff --git a/test/intl/regress-9408.js b/test/intl/regress-9408.js index 88883981f3..d5cfb11345 100644 --- a/test/intl/regress-9408.js +++ b/test/intl/regress-9408.js @@ -2,7 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flags: --harmony-intl-numberformat-unified // Test precision of compact-rounding let compact = {notation: "compact"}; diff --git a/test/intl/regress-9475.js b/test/intl/regress-9475.js index 3549ef8f38..68e2fdd7d7 100644 --- a/test/intl/regress-9475.js +++ b/test/intl/regress-9475.js @@ -2,7 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flags: --harmony-intl-numberformat-unified // Test format of all valid units won't throw exception. let validList = [ diff --git a/test/intl/regress-9513.js b/test/intl/regress-9513.js index e23b5cf77e..fc50df2418 100644 --- a/test/intl/regress-9513.js +++ b/test/intl/regress-9513.js @@ -2,7 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flags: --harmony-intl-numberformat-unified // Test Infinity, -Infinity, NaN won't crash with any notation in formatToParts. let validNotations = [ diff --git a/test/test262/testcfg.py b/test/test262/testcfg.py index 9aa91dfaef..691d38d339 100644 --- a/test/test262/testcfg.py +++ b/test/test262/testcfg.py @@ -44,16 +44,12 @@ from testrunner.outproc import test262 # TODO(littledan): move the flag mapping into the status file 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.DateTimeFormat-dayPeriod': '--harmony-intl-dateformat-day-period', 'Intl.DateTimeFormat-quarter': '--harmony-intl-dateformat-quarter', 'Intl.DateTimeFormat-fractionalSecondDigits': '--harmony-intl-dateformat-fractional-second-digits', 'Symbol.prototype.description': '--harmony-symbol-description', 'export-star-as-namespace-from-module': '--harmony-namespace-exports', - 'BigInt': '--harmony-intl-bigint', 'Promise.allSettled': '--harmony-promise-all-settled', 'FinalizationGroup': '--harmony-weak-refs', 'WeakRef': '--harmony-weak-refs',