Skip to content

Commit f38367d

Browse files
committed
[JSC] Remove Intl runtime feature flags for already shipped ones
https://bugs.webkit.org/show_bug.cgi?id=229371 Reviewed by Ross Kirsling. JSTests: * stress/intl-datetimeformat-day-period.js: * test262/config.yaml: Source/JavaScriptCore: Since they are already shipped, we should remove these runtime flags. * builtins/DatePrototype.js: (globalPrivate.toDateTimeOptionsAnyAll): (globalPrivate.toDateTimeOptionsTimeTime): * bytecode/BytecodeIntrinsicRegistry.cpp: (JSC::BytecodeIntrinsicRegistry::BytecodeIntrinsicRegistry): * bytecode/BytecodeIntrinsicRegistry.h: * runtime/IntlDateTimeFormat.cpp: (JSC::toDateTimeOptionsAnyDate): (JSC::IntlDateTimeFormat::initializeDateTimeFormat): (JSC::IntlDateTimeFormat::resolvedOptions const): * runtime/IntlDateTimeFormatPrototype.cpp: (JSC::IntlDateTimeFormatPrototype::finishCreation): * runtime/OptionsList.h: Canonical link: https://commits.webkit.org/240798@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@281383 268f45cc-cd09-0410-ab3c-d52691b4dbfc
1 parent 71bae82 commit f38367d

10 files changed

Lines changed: 58 additions & 42 deletions

File tree

‎JSTests/ChangeLog‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
2021-08-21 Yusuke Suzuki <ysuzuki@apple.com>
2+
3+
[JSC] Remove Intl runtime feature flags for already shipped ones
4+
https://bugs.webkit.org/show_bug.cgi?id=229371
5+
6+
Reviewed by Ross Kirsling.
7+
8+
* stress/intl-datetimeformat-day-period.js:
9+
* test262/config.yaml:
10+
111
2021-08-21 Yusuke Suzuki <ysuzuki@apple.com>
212

313
[JSC] Intl.DisplayNames v2

‎JSTests/stress/intl-datetimeformat-day-period.js‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
//@ runDefault("--useIntlDateTimeFormatDayPeriod=1")
2-
31
function shouldBe(actual, expected) {
42
if (actual !== expected)
53
throw new Error(`expected ${expected} but got ${actual}`);

‎JSTests/test262/config.yaml‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ flags:
1010
class-static-fields-private: usePrivateStaticClassFields
1111
class-static-methods-private: usePrivateMethods
1212
error-cause: useErrorCause
13-
Intl.DateTimeFormat-dayPeriod: useIntlDateTimeFormatDayPeriod
1413
SharedArrayBuffer: useSharedArrayBuffer
1514
Atomics: useSharedArrayBuffer
1615
Array.prototype.at: useAtMethod

‎Source/JavaScriptCore/ChangeLog‎

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,26 @@
1+
2021-08-21 Yusuke Suzuki <ysuzuki@apple.com>
2+
3+
[JSC] Remove Intl runtime feature flags for already shipped ones
4+
https://bugs.webkit.org/show_bug.cgi?id=229371
5+
6+
Reviewed by Ross Kirsling.
7+
8+
Since they are already shipped, we should remove these runtime flags.
9+
10+
* builtins/DatePrototype.js:
11+
(globalPrivate.toDateTimeOptionsAnyAll):
12+
(globalPrivate.toDateTimeOptionsTimeTime):
13+
* bytecode/BytecodeIntrinsicRegistry.cpp:
14+
(JSC::BytecodeIntrinsicRegistry::BytecodeIntrinsicRegistry):
15+
* bytecode/BytecodeIntrinsicRegistry.h:
16+
* runtime/IntlDateTimeFormat.cpp:
17+
(JSC::toDateTimeOptionsAnyDate):
18+
(JSC::IntlDateTimeFormat::initializeDateTimeFormat):
19+
(JSC::IntlDateTimeFormat::resolvedOptions const):
20+
* runtime/IntlDateTimeFormatPrototype.cpp:
21+
(JSC::IntlDateTimeFormatPrototype::finishCreation):
22+
* runtime/OptionsList.h:
23+
124
2021-08-21 Yusuke Suzuki <ysuzuki@apple.com>
225

326
[JSC] Intl.DisplayNames v2

‎Source/JavaScriptCore/builtins/DatePrototype.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ function toDateTimeOptionsAnyAll(opts)
4545
options.year === @undefined &&
4646
options.month === @undefined &&
4747
options.day === @undefined &&
48-
(!@useIntlDateTimeFormatDayPeriod || options.dayPeriod === @undefined) &&
48+
options.dayPeriod === @undefined &&
4949
options.hour === @undefined &&
5050
options.minute === @undefined &&
5151
options.second === @undefined &&
@@ -168,7 +168,7 @@ function toDateTimeOptionsTimeTime(opts)
168168

169169
// Check original instead of descendant to reduce lookups up the prototype chain.
170170
var needsDefaults = !options || (
171-
(!@useIntlDateTimeFormatDayPeriod || options.dayPeriod === @undefined) &&
171+
options.dayPeriod === @undefined &&
172172
options.hour === @undefined &&
173173
options.minute === @undefined &&
174174
options.second === @undefined &&

‎Source/JavaScriptCore/bytecode/BytecodeIntrinsicRegistry.cpp‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,6 @@ BytecodeIntrinsicRegistry::BytecodeIntrinsicRegistry(VM& vm)
112112
m_AsyncGeneratorSuspendReasonYield.set(m_vm, jsNumber(static_cast<int32_t>(JSAsyncGenerator::AsyncGeneratorSuspendReason::Yield)));
113113
m_AsyncGeneratorSuspendReasonAwait.set(m_vm, jsNumber(static_cast<int32_t>(JSAsyncGenerator::AsyncGeneratorSuspendReason::Await)));
114114
m_AsyncGeneratorSuspendReasonNone.set(m_vm, jsNumber(static_cast<int32_t>(JSAsyncGenerator::AsyncGeneratorSuspendReason::None)));
115-
m_useIntlDateTimeFormatDayPeriod.set(m_vm, jsBoolean(Options::useIntlDateTimeFormatDayPeriod()));
116115
m_abstractModuleRecordFieldState.set(m_vm, jsNumber(static_cast<int32_t>(AbstractModuleRecord::Field::State)));
117116
}
118117

‎Source/JavaScriptCore/bytecode/BytecodeIntrinsicRegistry.h‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,6 @@ enum class LinkTimeConstant : int32_t;
153153
macro(AsyncGeneratorSuspendReasonYield) \
154154
macro(AsyncGeneratorSuspendReasonAwait) \
155155
macro(AsyncGeneratorSuspendReasonNone) \
156-
macro(useIntlDateTimeFormatDayPeriod) \
157156
macro(abstractModuleRecordFieldState) \
158157

159158
#define JSC_COMMON_BYTECODE_INTRINSIC_CONSTANTS_CUSTOM_EACH_NAME(macro) \

‎Source/JavaScriptCore/runtime/IntlDateTimeFormat.cpp‎

Lines changed: 22 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -245,12 +245,10 @@ static JSObject* toDateTimeOptionsAnyDate(JSGlobalObject* globalObject, JSValue
245245
// ii. Let value be Get(options, prop).
246246
// iii. ReturnIfAbrupt(value).
247247
// iv. If value is not undefined, then let needDefaults be false.
248-
if (Options::useIntlDateTimeFormatDayPeriod()) {
249-
JSValue dayPeriod = options->get(globalObject, vm.propertyNames->dayPeriod);
250-
RETURN_IF_EXCEPTION(scope, { });
251-
if (!dayPeriod.isUndefined())
252-
needDefaults = false;
253-
}
248+
JSValue dayPeriod = options->get(globalObject, vm.propertyNames->dayPeriod);
249+
RETURN_IF_EXCEPTION(scope, { });
250+
if (!dayPeriod.isUndefined())
251+
needDefaults = false;
254252

255253
JSValue hour = options->get(globalObject, vm.propertyNames->hour);
256254
RETURN_IF_EXCEPTION(scope, { });
@@ -691,11 +689,8 @@ void IntlDateTimeFormat::initializeDateTimeFormat(JSGlobalObject* globalObject,
691689
break;
692690
}
693691

694-
DayPeriod dayPeriod = DayPeriod::None;
695-
if (Options::useIntlDateTimeFormatDayPeriod()) {
696-
dayPeriod = intlOption<DayPeriod>(globalObject, options, vm.propertyNames->dayPeriod, { { "narrow"_s, DayPeriod::Narrow }, { "short"_s, DayPeriod::Short }, { "long"_s, DayPeriod::Long } }, "dayPeriod must be \"narrow\", \"short\", or \"long\""_s, DayPeriod::None);
697-
RETURN_IF_EXCEPTION(scope, void());
698-
}
692+
DayPeriod dayPeriod = intlOption<DayPeriod>(globalObject, options, vm.propertyNames->dayPeriod, { { "narrow"_s, DayPeriod::Narrow }, { "short"_s, DayPeriod::Short }, { "long"_s, DayPeriod::Long } }, "dayPeriod must be \"narrow\", \"short\", or \"long\""_s, DayPeriod::None);
693+
RETURN_IF_EXCEPTION(scope, void());
699694

700695
Hour hour = intlOption<Hour>(globalObject, options, vm.propertyNames->hour, { { "2-digit"_s, Hour::TwoDigit }, { "numeric"_s, Hour::Numeric } }, "hour must be \"2-digit\" or \"numeric\""_s, Hour::None);
701696
RETURN_IF_EXCEPTION(scope, void());
@@ -746,22 +741,20 @@ void IntlDateTimeFormat::initializeDateTimeFormat(JSGlobalObject* globalObject,
746741
}
747742
}
748743

749-
if (Options::useIntlDateTimeFormatDayPeriod()) {
750-
// dayPeriod must be set after setting hour.
751-
// https://unicode-org.atlassian.net/browse/ICU-20731
752-
switch (dayPeriod) {
753-
case DayPeriod::Narrow:
754-
skeletonBuilder.append("BBBBB");
755-
break;
756-
case DayPeriod::Short:
757-
skeletonBuilder.append('B');
758-
break;
759-
case DayPeriod::Long:
760-
skeletonBuilder.append("BBBB");
761-
break;
762-
case DayPeriod::None:
763-
break;
764-
}
744+
// dayPeriod must be set after setting hour.
745+
// https://unicode-org.atlassian.net/browse/ICU-20731
746+
switch (dayPeriod) {
747+
case DayPeriod::Narrow:
748+
skeletonBuilder.append("BBBBB");
749+
break;
750+
case DayPeriod::Short:
751+
skeletonBuilder.append('B');
752+
break;
753+
case DayPeriod::Long:
754+
skeletonBuilder.append("BBBB");
755+
break;
756+
case DayPeriod::None:
757+
break;
765758
}
766759

767760
Minute minute = intlOption<Minute>(globalObject, options, vm.propertyNames->minute, { { "2-digit"_s, Minute::TwoDigit }, { "numeric"_s, Minute::Numeric } }, "minute must be \"2-digit\" or \"numeric\""_s, Minute::None);
@@ -1184,10 +1177,8 @@ JSObject* IntlDateTimeFormat::resolvedOptions(JSGlobalObject* globalObject) cons
11841177
if (m_day != Day::None)
11851178
options->putDirect(vm, vm.propertyNames->day, jsNontrivialString(vm, dayString(m_day)));
11861179

1187-
if (Options::useIntlDateTimeFormatDayPeriod()) {
1188-
if (m_dayPeriod != DayPeriod::None)
1189-
options->putDirect(vm, vm.propertyNames->dayPeriod, jsNontrivialString(vm, dayPeriodString(m_dayPeriod)));
1190-
}
1180+
if (m_dayPeriod != DayPeriod::None)
1181+
options->putDirect(vm, vm.propertyNames->dayPeriod, jsNontrivialString(vm, dayPeriodString(m_dayPeriod)));
11911182

11921183
if (m_hour != Hour::None)
11931184
options->putDirect(vm, vm.propertyNames->hour, jsNontrivialString(vm, hourString(m_hour)));

‎Source/JavaScriptCore/runtime/IntlDateTimeFormatPrototype.cpp‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,7 @@ void IntlDateTimeFormatPrototype::finishCreation(VM& vm, JSGlobalObject* globalO
8282
Base::finishCreation(vm);
8383
ASSERT(inherits(vm, info()));
8484
#if HAVE(ICU_U_DATE_INTERVAL_FORMAT_FORMAT_RANGE_TO_PARTS)
85-
if (Options::useIntlDateTimeFormatRangeToParts())
86-
JSC_NATIVE_FUNCTION_WITHOUT_TRANSITION("formatRangeToParts", IntlDateTimeFormatPrototypeFuncFormatRangeToParts, static_cast<unsigned>(PropertyAttribute::DontEnum), 2);
85+
JSC_NATIVE_FUNCTION_WITHOUT_TRANSITION("formatRangeToParts", IntlDateTimeFormatPrototypeFuncFormatRangeToParts, static_cast<unsigned>(PropertyAttribute::DontEnum), 2);
8786
#else
8887
UNUSED_PARAM(globalObject);
8988
UNUSED_PARAM(&IntlDateTimeFormatPrototypeFuncFormatRangeToParts);

‎Source/JavaScriptCore/runtime/OptionsList.h‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -542,8 +542,6 @@ bool canUseWebAssemblyFastMemory();
542542
v(Bool, useWebAssemblyMultiValues, true, Normal, "Allow types from the wasm mulit-values spec.") \
543543
v(Bool, useWebAssemblyThreading, true, Normal, "Allow instructions from the wasm threading spec.") \
544544
v(Bool, useWeakRefs, true, Normal, "Expose the WeakRef constructor.") \
545-
v(Bool, useIntlDateTimeFormatDayPeriod, true, Normal, "Expose the Intl.DateTimeFormat dayPeriod feature.") \
546-
v(Bool, useIntlDateTimeFormatRangeToParts, true, Normal, "Expose the Intl.DateTimeFormat#formatRangeToParts feature.") \
547545
v(Bool, useAtMethod, true, Normal, "Expose the at() method on Array, %TypedArray%, and String.") \
548546
v(Bool, useErrorCause, true, Normal, "Allow a cause to be provided when constructing an Error, _NativeError_, or AggregateError.") \
549547
v(Bool, useSharedArrayBuffer, false, Normal, nullptr) \

0 commit comments

Comments
 (0)