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) {
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<BigInt> x;
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
isolate, x, ThisBigIntValue(isolate, args.receiver(), method));
// 1. Let x be ? thisBigIntValue(this value).
Handle<BigInt> 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<Object> radix = isolate->factory()->undefined_value();
return BigIntToStringImpl(args.receiver(), radix, isolate, method);
......
......@@ -83,13 +83,8 @@ BUILTIN(NumberFormatPrototypeFormatToParts) {
Handle<Object> 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<Object> 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();
......
......@@ -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
......
......@@ -2917,6 +2917,13 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> 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<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() {
if (!FLAG_harmony_intl_segmenter) return;
Handle<JSObject> intl = Handle<JSObject>::cast(
......
......@@ -1086,13 +1086,8 @@ MaybeHandle<String> Intl::NumberToLocaleString(Isolate* isolate,
Handle<Object> options,
const char* method) {
Handle<Object> 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::NumberFormatDigitOptions> Intl::SetNumberFormatDigitOptions(
int mxfd = 0;
Handle<Object> mnfd_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 ).
int mxfd_actual_default = std::max(mnfd, mxfd_default);
// 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 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<NumberFormatDigitOptions>();
}
}
// 8. Let mxfd 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>());
// 9. Let mnsd be ? Get(options, "minimumSignificantDigits").
Handle<Object> mnsd_obj;
......@@ -1286,47 +1259,44 @@ Maybe<Intl::NumberFormatDigitOptions> 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<String> mnfd_str = factory->minimumFractionDigits_string();
if (!DefaultNumberOption(isolate, mnfd_obj, 0, 20, mnfd_default,
mnfd_str)
.To(&mnfd)) {
return Nothing<NumberFormatDigitOptions>();
}
// 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<String> mnfd_str = factory->minimumFractionDigits_string();
if (!DefaultNumberOption(isolate, mnfd_obj, 0, 20, mnfd_default, mnfd_str)
.To(&mnfd)) {
return Nothing<NumberFormatDigitOptions>();
}
// 15. c. Let mxfdActualDefault be max( mnfd, mxfdDefault ).
int mxfd_actual_default = std::max(mnfd, mxfd_default);
// 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<String> mxfd_str = factory->maximumFractionDigits_string();
if (!DefaultNumberOption(isolate, mxfd_obj, mnfd, 20,
mxfd_actual_default, mxfd_str)
.To(&mxfd)) {
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. d. Let mxfd be ? DefaultNumberOption(mxfd, mnfd, 20,
// mxfdActualDefault).
Handle<String> mxfd_str = factory->maximumFractionDigits_string();
if (!DefaultNumberOption(isolate, mxfd_obj, mnfd, 20, mxfd_actual_default,
mxfd_str)
.To(&mxfd)) {
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;
}
}
return Just(digit_options);
......
......@@ -1243,9 +1243,8 @@ MaybeHandle<JSDateTimeFormat> JSDateTimeFormat::New(
const std::vector<const char*> empty_values = {};
// 6. Let calendar be ? GetOption(options, "calendar",
// "string", undefined, undefined).
Maybe<bool> maybe_calendar =
Intl::GetStringOption(isolate, options, "calendar", empty_values,
"Intl.NumberFormat", &calendar_str);
Maybe<bool> maybe_calendar = Intl::GetStringOption(
isolate, options, "calendar", empty_values, service, &calendar_str);
MAYBE_RETURN(maybe_calendar, MaybeHandle<JSDateTimeFormat>());
if (maybe_calendar.FromJust() && calendar_str != nullptr) {
icu::Locale default_locale;
......@@ -1262,7 +1261,7 @@ MaybeHandle<JSDateTimeFormat> JSDateTimeFormat::New(
// 8. Let numberingSystem be ? GetOption(options, "numberingSystem",
// "string", undefined, undefined).
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>());
}
......@@ -1409,43 +1408,40 @@ MaybeHandle<JSDateTimeFormat> JSDateTimeFormat::New(
DateTimeStyle time_style = DateTimeStyle::kUndefined;
std::unique_ptr<icu::SimpleDateFormat> icu_date_format;
if (FLAG_harmony_intl_datetime_style) {
// 28. Let dateStyle be ? GetOption(options, "dateStyle", "string", «
// "full", "long", "medium", "short" », undefined).
Maybe<DateTimeStyle> maybe_date_style =
Intl::GetStringOption<DateTimeStyle>(
isolate, options, "dateStyle", service,
{"full", "long", "medium", "short"},
{DateTimeStyle::kFull, DateTimeStyle::kLong, DateTimeStyle::kMedium,
DateTimeStyle::kShort},
DateTimeStyle::kUndefined);
MAYBE_RETURN(maybe_date_style, MaybeHandle<JSDateTimeFormat>());
// 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<DateTimeStyle> maybe_time_style =
Intl::GetStringOption<DateTimeStyle>(
isolate, options, "timeStyle", service,
{"full", "long", "medium", "short"},
{DateTimeStyle::kFull, DateTimeStyle::kLong, DateTimeStyle::kMedium,
DateTimeStyle::kShort},
DateTimeStyle::kUndefined);
MAYBE_RETURN(maybe_time_style, MaybeHandle<JSDateTimeFormat>());
// 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());
}
// 28. Let dateStyle be ? GetOption(options, "dateStyle", "string", «
// "full", "long", "medium", "short" », undefined).
Maybe<DateTimeStyle> maybe_date_style = Intl::GetStringOption<DateTimeStyle>(
isolate, options, "dateStyle", service,
{"full", "long", "medium", "short"},
{DateTimeStyle::kFull, DateTimeStyle::kLong, DateTimeStyle::kMedium,
DateTimeStyle::kShort},
DateTimeStyle::kUndefined);
MAYBE_RETURN(maybe_date_style, MaybeHandle<JSDateTimeFormat>());
// 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<DateTimeStyle> maybe_time_style = Intl::GetStringOption<DateTimeStyle>(
isolate, options, "timeStyle", service,
{"full", "long", "medium", "short"},
{DateTimeStyle::kFull, DateTimeStyle::kLong, DateTimeStyle::kMedium,
DateTimeStyle::kShort},
DateTimeStyle::kUndefined);
MAYBE_RETURN(maybe_time_style, MaybeHandle<JSDateTimeFormat>());
// 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());
}
// 33. Else,
if (icu_date_format.get() == nullptr) {
bool has_hour_option = false;
......
......@@ -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();
......
This diff is collapsed.
......@@ -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);
......
......@@ -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"
......
......@@ -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.
......
......@@ -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.
......
......@@ -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"];
......
......@@ -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.
......
......@@ -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.
......
......@@ -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");
......
......@@ -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);
......
......@@ -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);
......
......@@ -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', {
......
......@@ -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', {
......
......@@ -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', {
......
// 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 @@
// 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"],
......
......@@ -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/
......
......@@ -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);
......
......@@ -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);
......
......@@ -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.
//
......
......@@ -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"});
......
......@@ -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"});
......
......@@ -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();
......
......@@ -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", {
......
......@@ -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);
......
......@@ -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();
......
......@@ -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);
......
......@@ -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"};
......
......@@ -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 = [
......
......@@ -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 = [
......
......@@ -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',
......
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