Skip to content

Commit d9715ad

Browse files
FrankYFTangV8 LUCI CQ
authored andcommitted
[Intl] rm alt_calendar hack post ICU 73-1
Also need to bump up the required ICU version. Bug: v8:14086 Change-Id: I52a53fcd201f3272aa712123fc00c54d0b762d53 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/4628805 Reviewed-by: Shu-yu Guo <[email protected]> Commit-Queue: Frank Tang <[email protected]> Cr-Commit-Position: refs/heads/main@{#88431}
1 parent d1aa685 commit d9715ad

5 files changed

Lines changed: 8 additions & 36 deletions

File tree

src/objects/intl-objects.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
#include "unicode/locid.h"
2222
#include "unicode/uversion.h"
2323

24-
#define V8_MINIMUM_ICU_VERSION 71
24+
#define V8_MINIMUM_ICU_VERSION 73
2525

2626
namespace U_ICU_NAMESPACE {
2727
class BreakIterator;

src/objects/js-date-time-format-inl.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@ ACCESSORS(JSDateTimeFormat, icu_simple_date_format,
2828
ACCESSORS(JSDateTimeFormat, icu_date_interval_format,
2929
Managed<icu::DateIntervalFormat>, kIcuDateIntervalFormatOffset)
3030

31-
BOOL_ACCESSORS(JSDateTimeFormat, flags, alt_calendar, AltCalendarBit::kShift)
32-
3331
inline void JSDateTimeFormat::set_hour_cycle(HourCycle hour_cycle) {
3432
int hints = flags();
3533
hints = HourCycleBits::update(hints, hour_cycle);

src/objects/js-date-time-format.cc

Lines changed: 7 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -530,8 +530,7 @@ Handle<Object> JSDateTimeFormat::TimeZoneId(Isolate* isolate,
530530

531531
namespace {
532532
Handle<String> GetCalendar(Isolate* isolate,
533-
const icu::SimpleDateFormat& simple_date_format,
534-
bool is_alt_calendar = false) {
533+
const icu::SimpleDateFormat& simple_date_format) {
535534
// getType() returns legacy calendar type name instead of LDML/BCP47 calendar
536535
// key values. intl.js maps them to BCP47 values for key "ca".
537536
// TODO(jshin): Consider doing it here, instead.
@@ -542,17 +541,9 @@ Handle<String> GetCalendar(Isolate* isolate,
542541
// and
543542
// http://www.unicode.org/repos/cldr/tags/latest/common/bcp47/calendar.xml
544543
if (calendar_str == "gregorian") {
545-
if (is_alt_calendar) {
546-
calendar_str = "iso8601";
547-
} else {
548-
calendar_str = "gregory";
549-
}
544+
calendar_str = "gregory";
550545
} else if (calendar_str == "ethiopic-amete-alem") {
551546
calendar_str = "ethioaa";
552-
} else if (calendar_str == "islamic") {
553-
if (is_alt_calendar) {
554-
calendar_str = "islamic-rgsa";
555-
}
556547
}
557548
return isolate->factory()->NewStringFromAsciiChecked(calendar_str.c_str());
558549
}
@@ -567,8 +558,7 @@ Handle<Object> GetTimeZone(Isolate* isolate,
567558
Handle<String> JSDateTimeFormat::Calendar(
568559
Isolate* isolate, Handle<JSDateTimeFormat> date_time_format) {
569560
return GetCalendar(isolate,
570-
*(date_time_format->icu_simple_date_format().raw()),
571-
date_time_format->alt_calendar());
561+
*(date_time_format->icu_simple_date_format().raw()));
572562
}
573563

574564
Handle<Object> JSDateTimeFormat::TimeZone(
@@ -2328,9 +2318,6 @@ MaybeHandle<JSDateTimeFormat> JSDateTimeFormat::New(
23282318
icu_locale.setUnicodeKeywordValue("ca", calendar_str.get(), status);
23292319
DCHECK(U_SUCCESS(status));
23302320
}
2331-
bool alt_calendar =
2332-
strstr(icu_locale.getName(), "calendar=iso8601") != nullptr ||
2333-
strstr(icu_locale.getName(), "calendar=islamic-rgsa") != nullptr;
23342321

23352322
if (numbering_system_str != nullptr &&
23362323
Intl::IsValidNumberingSystem(numbering_system_str.get())) {
@@ -2640,7 +2627,6 @@ MaybeHandle<JSDateTimeFormat> JSDateTimeFormat::New(
26402627
date_time_format->set_time_style(time_style);
26412628
}
26422629
date_time_format->set_hour_cycle(dateTimeFormatHourCycle);
2643-
date_time_format->set_alt_calendar(alt_calendar);
26442630
date_time_format->set_locale(*locale_str);
26452631
date_time_format->set_icu_locale(*managed_locale);
26462632
date_time_format->set_icu_simple_date_format(*managed_format);
@@ -2742,10 +2728,8 @@ MaybeHandle<JSArray> FormatToPartsWithTemporalSupport(
27422728
DateTimeValueRecord x_record;
27432729
MAYBE_ASSIGN_RETURN_ON_EXCEPTION_VALUE(
27442730
isolate, x_record,
2745-
HandleDateTimeValue(
2746-
isolate, *format,
2747-
GetCalendar(isolate, *format, date_time_format->alt_calendar()), x,
2748-
method_name),
2731+
HandleDateTimeValue(isolate, *format, GetCalendar(isolate, *format), x,
2732+
method_name),
27492733
Handle<JSArray>());
27502734

27512735
return FormatMillisecondsByKindToArray(isolate, *format, x_record.kind,
@@ -3070,8 +3054,8 @@ MaybeHandle<T> FormatRangeCommonWithTemporalSupport(
30703054
// 6. Let x be ? HandleDateTimeValue(dateTimeFormat, x).
30713055
icu::SimpleDateFormat* icu_simple_date_format =
30723056
date_time_format->icu_simple_date_format().raw();
3073-
Handle<String> date_time_format_calendar = GetCalendar(
3074-
isolate, *icu_simple_date_format, date_time_format->alt_calendar());
3057+
Handle<String> date_time_format_calendar =
3058+
GetCalendar(isolate, *icu_simple_date_format);
30753059
DateTimeValueRecord x_record;
30763060
MAYBE_ASSIGN_RETURN_ON_EXCEPTION_VALUE(
30773061
isolate, x_record,

src/objects/js-date-time-format.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,6 @@ class JSDateTimeFormat
150150
DECL_ACCESSORS(icu_simple_date_format, Managed<icu::SimpleDateFormat>)
151151
DECL_ACCESSORS(icu_date_interval_format, Managed<icu::DateIntervalFormat>)
152152

153-
DECL_BOOLEAN_ACCESSORS(alt_calendar)
154-
155153
DECL_PRINTER(JSDateTimeFormat)
156154

157155
TQ_OBJECT_CONSTRUCTORS(JSDateTimeFormat)

src/objects/js-date-time-format.tq

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,6 @@ bitfield struct JSDateTimeFormatFlags extends uint31 {
1010
hour_cycle: HourCycle: 3 bit;
1111
date_style: DateTimeStyle: 3 bit;
1212
time_style: DateTimeStyle: 3 bit;
13-
// ICU report the same type "gregorian" for both "gregorian" calendar and
14-
// "iso8601" calendar and the same type "islamic" for both "islamic" and
15-
// "islamic-rgsa" calendar. We use the alt_calendar bit to distinguish between
16-
// them. When the type is "gregorian" and the alt_calendar bit is set, it is
17-
// "iso8601", otherwise the true "gregorian" calendar. While the type is
18-
// "islamic" and the alt_calendar bit is set, it is "islamic-rgsa" calendar,
19-
// otherwise "islamic" calendar.
20-
alt_calendar: bool: 1bit;
2113
}
2214

2315
extern class JSDateTimeFormat extends JSObject {

0 commit comments

Comments
 (0)