From 377f182b48687fb0f36c29d0d4183c3032cd9c18 Mon Sep 17 00:00:00 2001 From: Frank Tang Date: Fri, 10 May 2019 16:26:36 -0700 Subject: [PATCH] [Intl] Remove harmony-locale flag harmony-locale is shipped in m74 and m74 is already out. Remove harmony-locale flag from the code. Bug: v8:8910 Change-Id: If9634b6767cfe449cfa03980bbad26ceb7408c79 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1592465 Commit-Queue: Frank Tang Reviewed-by: Adam Klein Cr-Commit-Position: refs/heads/master@{#61429} --- src/bootstrapper.cc | 100 ++++++++---------- src/flag-definitions.h | 9 +- .../CanonicalizeLocaleListTakeLocale.js | 2 - test/intl/locale/locale-canonicalization.js | 2 - test/intl/locale/locale-constructor.js | 2 - test/intl/locale/locale-properties.js | 2 - test/intl/locale/maximize_minimize.js | 2 - test/intl/locale/property.js | 2 - test/intl/locale/regress-8032.js | 2 - test/intl/regress-7982.js | 2 - test/intl/regress-8657.js | 2 - test/test262/testcfg.py | 1 - 12 files changed, 50 insertions(+), 78 deletions(-) diff --git a/src/bootstrapper.cc b/src/bootstrapper.cc index 43690f3b4a..f45c1e3ebf 100644 --- a/src/bootstrapper.cc +++ b/src/bootstrapper.cc @@ -3060,6 +3060,52 @@ void Genesis::InitializeGlobal(Handle global_object, Builtins::kListFormatPrototypeFormatToParts, 1, false); } + + { // -- L o c a l e + Handle locale_fun = InstallFunction( + isolate(), intl, "Locale", JS_INTL_LOCALE_TYPE, JSLocale::kSize, 0, + factory->the_hole_value(), Builtins::kLocaleConstructor); + InstallWithIntrinsicDefaultProto(isolate(), locale_fun, + Context::INTL_LOCALE_FUNCTION_INDEX); + locale_fun->shared()->set_length(1); + locale_fun->shared()->DontAdaptArguments(); + + // Setup %LocalePrototype%. + Handle prototype( + JSObject::cast(locale_fun->instance_prototype()), isolate()); + + InstallToStringTag(isolate(), prototype, "Intl.Locale"); + + SimpleInstallFunction(isolate(), prototype, "toString", + Builtins::kLocalePrototypeToString, 0, false); + SimpleInstallFunction(isolate(), prototype, "maximize", + Builtins::kLocalePrototypeMaximize, 0, false); + SimpleInstallFunction(isolate(), prototype, "minimize", + Builtins::kLocalePrototypeMinimize, 0, false); + // Base locale getters. + SimpleInstallGetter(isolate(), prototype, factory->language_string(), + Builtins::kLocalePrototypeLanguage, true); + SimpleInstallGetter(isolate(), prototype, factory->script_string(), + Builtins::kLocalePrototypeScript, true); + SimpleInstallGetter(isolate(), prototype, factory->region_string(), + Builtins::kLocalePrototypeRegion, true); + SimpleInstallGetter(isolate(), prototype, factory->baseName_string(), + Builtins::kLocalePrototypeBaseName, true); + // Unicode extension getters. + SimpleInstallGetter(isolate(), prototype, factory->calendar_string(), + Builtins::kLocalePrototypeCalendar, true); + SimpleInstallGetter(isolate(), prototype, factory->caseFirst_string(), + Builtins::kLocalePrototypeCaseFirst, true); + SimpleInstallGetter(isolate(), prototype, factory->collation_string(), + Builtins::kLocalePrototypeCollation, true); + SimpleInstallGetter(isolate(), prototype, factory->hourCycle_string(), + Builtins::kLocalePrototypeHourCycle, true); + SimpleInstallGetter(isolate(), prototype, factory->numeric_string(), + Builtins::kLocalePrototypeNumeric, true); + SimpleInstallGetter(isolate(), prototype, + factory->numberingSystem_string(), + Builtins::kLocalePrototypeNumberingSystem, true); + } } #endif // V8_INTL_SUPPORT @@ -4380,60 +4426,6 @@ void Genesis::InitializeGlobal_harmony_intl_date_format_range() { false); } -void Genesis::InitializeGlobal_harmony_locale() { - if (!FLAG_harmony_locale) return; - - Handle intl = Handle::cast( - JSReceiver::GetProperty( - isolate(), - Handle(native_context()->global_object(), isolate()), - factory()->InternalizeUtf8String("Intl")) - .ToHandleChecked()); - - Handle locale_fun = InstallFunction( - isolate(), intl, "Locale", JS_INTL_LOCALE_TYPE, JSLocale::kSize, 0, - factory()->the_hole_value(), Builtins::kLocaleConstructor); - InstallWithIntrinsicDefaultProto(isolate(), locale_fun, - Context::INTL_LOCALE_FUNCTION_INDEX); - locale_fun->shared()->set_length(1); - locale_fun->shared()->DontAdaptArguments(); - - // Setup %LocalePrototype%. - Handle prototype(JSObject::cast(locale_fun->instance_prototype()), - isolate()); - - InstallToStringTag(isolate(), prototype, "Intl.Locale"); - - SimpleInstallFunction(isolate(), prototype, "toString", - Builtins::kLocalePrototypeToString, 0, false); - SimpleInstallFunction(isolate(), prototype, "maximize", - Builtins::kLocalePrototypeMaximize, 0, false); - SimpleInstallFunction(isolate(), prototype, "minimize", - Builtins::kLocalePrototypeMinimize, 0, false); - // Base locale getters. - SimpleInstallGetter(isolate(), prototype, factory()->language_string(), - Builtins::kLocalePrototypeLanguage, true); - SimpleInstallGetter(isolate(), prototype, factory()->script_string(), - Builtins::kLocalePrototypeScript, true); - SimpleInstallGetter(isolate(), prototype, factory()->region_string(), - Builtins::kLocalePrototypeRegion, true); - SimpleInstallGetter(isolate(), prototype, factory()->baseName_string(), - Builtins::kLocalePrototypeBaseName, true); - // Unicode extension getters. - SimpleInstallGetter(isolate(), prototype, factory()->calendar_string(), - Builtins::kLocalePrototypeCalendar, true); - SimpleInstallGetter(isolate(), prototype, factory()->caseFirst_string(), - Builtins::kLocalePrototypeCaseFirst, true); - SimpleInstallGetter(isolate(), prototype, factory()->collation_string(), - Builtins::kLocalePrototypeCollation, true); - SimpleInstallGetter(isolate(), prototype, factory()->hourCycle_string(), - Builtins::kLocalePrototypeHourCycle, true); - SimpleInstallGetter(isolate(), prototype, factory()->numeric_string(), - Builtins::kLocalePrototypeNumeric, true); - SimpleInstallGetter(isolate(), prototype, factory()->numberingSystem_string(), - Builtins::kLocalePrototypeNumberingSystem, true); -} - void Genesis::InitializeGlobal_harmony_intl_segmenter() { if (!FLAG_harmony_intl_segmenter) return; Handle intl = Handle::cast( diff --git a/src/flag-definitions.h b/src/flag-definitions.h index f2df427a4d..ef1c07e8ff 100644 --- a/src/flag-definitions.h +++ b/src/flag-definitions.h @@ -248,11 +248,10 @@ 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_datetime_style, "dateStyle timeStyle for DateTimeFormat") \ - V(harmony_locale, "Intl.Locale") +#define HARMONY_SHIPPING(V) \ + HARMONY_SHIPPING_BASE(V) \ + V(harmony_intl_bigint, "BigInt.prototype.toLocaleString") \ + V(harmony_intl_datetime_style, "dateStyle timeStyle for DateTimeFormat") #else #define HARMONY_SHIPPING(V) HARMONY_SHIPPING_BASE(V) #endif diff --git a/test/intl/general/CanonicalizeLocaleListTakeLocale.js b/test/intl/general/CanonicalizeLocaleListTakeLocale.js index 8dcdf70b97..0643a28336 100644 --- a/test/intl/general/CanonicalizeLocaleListTakeLocale.js +++ b/test/intl/general/CanonicalizeLocaleListTakeLocale.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-locale -// // Test NumberFormat will accept Intl.Locale as first parameter, or // as in the array. diff --git a/test/intl/locale/locale-canonicalization.js b/test/intl/locale/locale-canonicalization.js index cc0478fdb6..487cfe55d0 100644 --- a/test/intl/locale/locale-canonicalization.js +++ b/test/intl/locale/locale-canonicalization.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-locale - // Make sure that locale string got canonicalized by the spec, // keys are sorted and unique, region upper cased, script title cased and // language lower cased. diff --git a/test/intl/locale/locale-constructor.js b/test/intl/locale/locale-constructor.js index bf2510553f..95a6f3d24f 100644 --- a/test/intl/locale/locale-constructor.js +++ b/test/intl/locale/locale-constructor.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-locale - // Locale constructor can't be called as function. assertThrows(() => Intl.Locale('sr'), TypeError); diff --git a/test/intl/locale/locale-properties.js b/test/intl/locale/locale-properties.js index 9800e8d6cf..7755c7e87e 100644 --- a/test/intl/locale/locale-properties.js +++ b/test/intl/locale/locale-properties.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-locale - // Make sure that locale exposes all required properties. Those not specified // should have undefined value. diff --git a/test/intl/locale/maximize_minimize.js b/test/intl/locale/maximize_minimize.js index 823a6670e3..51702ab410 100644 --- a/test/intl/locale/maximize_minimize.js +++ b/test/intl/locale/maximize_minimize.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-locale - // Make sure that maximize and minimize of all locales work reasonbly. assertEquals(new Intl.Locale("zh-TW").maximize().toString(), "zh-Hant-TW", diff --git a/test/intl/locale/property.js b/test/intl/locale/property.js index cbe076842f..b89705fe57 100644 --- a/test/intl/locale/property.js +++ b/test/intl/locale/property.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-locale - // Make sure that accessing locale property will return undefined instead of // crash. diff --git a/test/intl/locale/regress-8032.js b/test/intl/locale/regress-8032.js index b8219b1b50..647c4865ec 100644 --- a/test/intl/locale/regress-8032.js +++ b/test/intl/locale/regress-8032.js @@ -2,6 +2,4 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flags: --harmony-locale - assertThrows(() => new Intl.Locale(''), RangeError); diff --git a/test/intl/regress-7982.js b/test/intl/regress-7982.js index bd251c5939..92bcaf9d82 100644 --- a/test/intl/regress-7982.js +++ b/test/intl/regress-7982.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-locale - // Make sure that maximize and minimize of locales work reasonbly. assertEquals("zh-Hans-CN-u-ca-chinese", new Intl.Locale("zh-u-ca-Chinese").maximize().toString()); diff --git a/test/intl/regress-8657.js b/test/intl/regress-8657.js index c1c5cea708..a1f4f73445 100644 --- a/test/intl/regress-8657.js +++ b/test/intl/regress-8657.js @@ -2,6 +2,4 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flags: --harmony-locale - assertDoesNotThrow(() => new Intl.Locale('und')); diff --git a/test/test262/testcfg.py b/test/test262/testcfg.py index 08841362c0..b00482adc4 100644 --- a/test/test262/testcfg.py +++ b/test/test262/testcfg.py @@ -47,7 +47,6 @@ FEATURE_FLAGS = { 'numeric-separator-literal': '--harmony-numeric-separator', 'Intl.DateTimeFormat-datetimestyle': '--harmony-intl-datetime-style', 'Intl.DateTimeFormat-formatRange': '--harmony-intl-date-format-range', - 'Intl.Locale': '--harmony-locale', 'Intl.Segmenter': '--harmony-intl-segmenter', 'Symbol.prototype.description': '--harmony-symbol-description', 'globalThis': '--harmony-global',