Skip to content

Commit d5b444b

Browse files
FrankYFTangCommit Bot
authored andcommitted
Add UsageCounters for misc Intl features
We need to track misc features launched in 2019 to understand the impact. Also we need to measure the v8BreakIterator usage of 'word' and 'line' to lobby the need for 'line' in the replacement standard Intl.Segmenter which an Apple engineer opposed to include. Bug: v8:10251 Change-Id: I5d4cbe6ccf458c9ec4adfebad235f9c6dcd2ac37 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2067512 Reviewed-by: Yang Guo <yangguo@chromium.org> Commit-Queue: Frank Tang <ftang@chromium.org> Cr-Commit-Position: refs/heads/master@{#66506}
1 parent b66e24f commit d5b444b

4 files changed

Lines changed: 19 additions & 0 deletions

File tree

‎include/v8.h‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8411,6 +8411,11 @@ class V8_EXPORT Isolate {
84118411
kSharedArrayBufferConstructed = 82,
84128412
kArrayPrototypeHasElements = 83,
84138413
kObjectPrototypeHasElements = 84,
8414+
kNumberFormatStyleUnit = 85,
8415+
kDateTimeFormatRange = 86,
8416+
kDateTimeFormatDateTimeStyle = 87,
8417+
kBreakIteratorTypeWord = 88,
8418+
kBreakIteratorTypeLine = 89,
84148419

84158420
// If you add new values here, you'll also need to update Chromium's:
84168421
// web_feature.mojom, use_counter_callback.cc, and enums.xml. V8 changes to

‎src/objects/js-break-iterator.cc‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,10 +79,14 @@ MaybeHandle<JSV8BreakIterator> JSV8BreakIterator::New(
7979
icu::BreakIterator::createSentenceInstance(icu_locale, status));
8080
break;
8181
case Type::LINE:
82+
isolate->CountUsage(
83+
v8::Isolate::UseCounterFeature::kBreakIteratorTypeLine);
8284
break_iterator.reset(
8385
icu::BreakIterator::createLineInstance(icu_locale, status));
8486
break;
8587
default:
88+
isolate->CountUsage(
89+
v8::Isolate::UseCounterFeature::kBreakIteratorTypeWord);
8690
break_iterator.reset(
8791
icu::BreakIterator::createWordInstance(icu_locale, status));
8892
break;

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1540,6 +1540,10 @@ MaybeHandle<JSDateTimeFormat> JSDateTimeFormat::New(
15401540
// 32. If dateStyle or timeStyle are not undefined, then
15411541
if (date_style != DateTimeStyle::kUndefined ||
15421542
time_style != DateTimeStyle::kUndefined) {
1543+
// Track newer feature dateStyle/timeStyle option.
1544+
isolate->CountUsage(
1545+
v8::Isolate::UseCounterFeature::kDateTimeFormatDateTimeStyle);
1546+
15431547
icu_date_format = DateTimeStylePattern(date_style, time_style, icu_locale,
15441548
hc, generator.get());
15451549
}
@@ -1948,6 +1952,9 @@ MaybeHandle<T> FormatRangeCommon(
19481952
Isolate* isolate, Handle<JSDateTimeFormat> date_time_format, double x,
19491953
double y,
19501954
MaybeHandle<T> (*formatToResult)(Isolate*, const icu::FormattedValue&)) {
1955+
// Track newer feature formateRange and formatRangeToParts
1956+
isolate->CountUsage(v8::Isolate::UseCounterFeature::kDateTimeFormatRange);
1957+
19511958
// #sec-partitiondatetimerangepattern
19521959
// 1. Let x be TimeClip(x).
19531960
x = DateCache::TimeClip(x);

‎src/objects/js-number-format.cc‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1073,6 +1073,9 @@ MaybeHandle<JSNumberFormat> JSNumberFormat::New(Isolate* isolate,
10731073

10741074
// 13. If style is "unit", then
10751075
if (style == Style::UNIT) {
1076+
// Track newer style "unit".
1077+
isolate->CountUsage(v8::Isolate::UseCounterFeature::kNumberFormatStyleUnit);
1078+
10761079
// 13.a If unit is undefined, throw a TypeError exception.
10771080
if (unit == "") {
10781081
THROW_NEW_ERROR(isolate,

0 commit comments

Comments
 (0)