Skip to content

Commit 10dddd7

Browse files
targosrichardlau
authored andcommitted
deps: V8: cherry-pick b0a7f5691113
Original commit message: Update to ICU68-1 ICU68-1 change the output skeleton format. So we need to change resolvedOptions code for 68 migration. Chromium roll https://chromium-review.googlesource.com/c/chromium/src/+/2474093 Bug: v8:10945 Change-Id: I3b2c7fbe8abb22df8fa51287c498ca3245b8c55b Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2477431 Commit-Queue: Frank Tang <[email protected]> Reviewed-by: Jakob Kummerow <[email protected]> Reviewed-by: Shu-yu Guo <[email protected]> Cr-Commit-Position: refs/heads/master@{#70972} Refs: v8/v8@b0a7f56 PR-URL: #39051 Fixes: #39050 Reviewed-By: Jiawen Geng <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Richard Lau <[email protected]>
1 parent 0d2b4b7 commit 10dddd7

File tree

4 files changed

+33
-53
lines changed

4 files changed

+33
-53
lines changed

common.gypi

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636

3737
# Reset this number to 0 on major V8 upgrades.
3838
# Increment by one for each non-official patch applied to deps/v8.
39-
'v8_embedder_string': '-node.73',
39+
'v8_embedder_string': '-node.74',
4040

4141
##### V8 defaults for Node.js #####
4242

deps/v8/DEPS

+1-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ deps = {
7676
'v8/third_party/depot_tools':
7777
Var('chromium_url') + '/chromium/tools/depot_tools.git' + '@' + 'd4e6fb6573e0955110a2c69be29557f6626d9ae6',
7878
'v8/third_party/icu':
79-
Var('chromium_url') + '/chromium/deps/icu.git' + '@' + 'f2223961702f00a8833874b0560d615a2cc42738',
79+
Var('chromium_url') + '/chromium/deps/icu.git' + '@' + 'c2a4cae149aae7fd30c4cbe3cf1b30df03b386f1',
8080
'v8/third_party/instrumented_libraries':
8181
Var('chromium_url') + '/chromium/src/third_party/instrumented_libraries.git' + '@' + 'bb3f1802c237dd19105dd0f7919f99e536a39d10',
8282
'v8/buildtools':

deps/v8/src/objects/js-number-format.cc

+30-50
Original file line numberDiff line numberDiff line change
@@ -389,17 +389,17 @@ Handle<String> CurrencySignString(Isolate* isolate,
389389
Handle<String> UnitDisplayString(Isolate* isolate,
390390
const icu::UnicodeString& skeleton) {
391391
// Ex: skeleton as
392-
// "measure-unit/length-meter .### rounding-mode-half-up unit-width-full-name"
392+
// "unit/length-meter .### rounding-mode-half-up unit-width-full-name"
393393
if (skeleton.indexOf("unit-width-full-name") >= 0) {
394394
return ReadOnlyRoots(isolate).long_string_handle();
395395
}
396396
// Ex: skeleton as
397-
// "measure-unit/length-meter .### rounding-mode-half-up unit-width-narrow".
397+
// "unit/length-meter .### rounding-mode-half-up unit-width-narrow".
398398
if (skeleton.indexOf("unit-width-narrow") >= 0) {
399399
return ReadOnlyRoots(isolate).narrow_string_handle();
400400
}
401401
// Ex: skeleton as
402-
// "measure-unit/length-foot .### rounding-mode-half-up"
402+
// "unit/length-foot .### rounding-mode-half-up"
403403
return ReadOnlyRoots(isolate).short_string_handle();
404404
}
405405

@@ -422,7 +422,7 @@ Notation NotationFromSkeleton(const icu::UnicodeString& skeleton) {
422422
return Notation::COMPACT;
423423
}
424424
// Ex: skeleton as
425-
// "measure-unit/length-foot .### rounding-mode-half-up"
425+
// "unit/length-foot .### rounding-mode-half-up"
426426
return Notation::STANDARD;
427427
}
428428

@@ -562,14 +562,14 @@ namespace {
562562

563563
// Ex: percent .### rounding-mode-half-up
564564
// Special case for "percent"
565-
// Ex: "measure-unit/length-kilometer per-measure-unit/duration-hour .###
566-
// rounding-mode-half-up" should return "kilometer-per-unit".
567-
// Ex: "measure-unit/duration-year .### rounding-mode-half-up" should return
565+
// Ex: "unit/milliliter-per-acre .### rounding-mode-half-up"
566+
// should return "milliliter-per-acre".
567+
// Ex: "unit/year .### rounding-mode-half-up" should return
568568
// "year".
569569
std::string UnitFromSkeleton(const icu::UnicodeString& skeleton) {
570570
std::string str;
571571
str = skeleton.toUTF8String<std::string>(str);
572-
std::string search("measure-unit/");
572+
std::string search("unit/");
573573
size_t begin = str.find(search);
574574
if (begin == str.npos) {
575575
// Special case for "percent".
@@ -578,64 +578,44 @@ std::string UnitFromSkeleton(const icu::UnicodeString& skeleton) {
578578
}
579579
return "";
580580
}
581-
// Skip the type (ex: "length").
582-
// "measure-unit/length-kilometer per-measure-unit/duration-hour"
583-
// b
584-
begin = str.find("-", begin + search.size());
581+
// Ex:
582+
// "unit/acre .### rounding-mode-half-up"
583+
// b
584+
// Ex:
585+
// "unit/milliliter-per-acre .### rounding-mode-half-up"
586+
// b
587+
begin += search.size();
585588
if (begin == str.npos) {
586589
return "";
587590
}
588-
begin++; // Skip the '-'.
589591
// Find the end of the subtype.
590592
size_t end = str.find(" ", begin);
591-
// "measure-unit/length-kilometer per-measure-unit/duration-hour"
592-
// b e
593+
// Ex:
594+
// "unit/acre .### rounding-mode-half-up"
595+
// b e
596+
// Ex:
597+
// "unit/milliliter-per-acre .### rounding-mode-half-up"
598+
// b e
593599
if (end == str.npos) {
594600
end = str.size();
595-
return str.substr(begin, end - begin);
596-
}
597-
// "measure-unit/length-kilometer per-measure-unit/duration-hour"
598-
// b e
599-
// [result ]
600-
std::string result = str.substr(begin, end - begin);
601-
begin = end + 1;
602-
// "measure-unit/length-kilometer per-measure-unit/duration-hour"
603-
// [result ]eb
604-
std::string search_per("per-measure-unit/");
605-
begin = str.find(search_per, begin);
606-
// "measure-unit/length-kilometer per-measure-unit/duration-hour"
607-
// [result ]e b
608-
if (begin == str.npos) {
609-
return result;
610-
}
611-
// Skip the type (ex: "duration").
612-
begin = str.find("-", begin + search_per.size());
613-
// "measure-unit/length-kilometer per-measure-unit/duration-hour"
614-
// [result ]e b
615-
if (begin == str.npos) {
616-
return result;
617601
}
618-
begin++; // Skip the '-'.
619-
// "measure-unit/length-kilometer per-measure-unit/duration-hour"
620-
// [result ]e b
621-
end = str.find(" ", begin);
622-
if (end == str.npos) {
623-
end = str.size();
624-
}
625-
// "measure-unit/length-kilometer per-measure-unit/duration-hour"
626-
// [result ] b e
627-
return result + "-per-" + str.substr(begin, end - begin);
602+
return str.substr(begin, end - begin);
628603
}
629604

630605
Style StyleFromSkeleton(const icu::UnicodeString& skeleton) {
631606
if (skeleton.indexOf("currency/") >= 0) {
632607
return Style::CURRENCY;
633608
}
634-
if (skeleton.indexOf("measure-unit/") >= 0) {
635-
if (skeleton.indexOf("scale/100") >= 0 &&
636-
skeleton.indexOf("measure-unit/concentr-percent") >= 0) {
609+
if (skeleton.indexOf("percent") >= 0) {
610+
// percent precision-integer rounding-mode-half-up scale/100
611+
if (skeleton.indexOf("scale/100") >= 0) {
637612
return Style::PERCENT;
613+
} else {
614+
return Style::UNIT;
638615
}
616+
}
617+
// Before ICU68: "measure-unit/", since ICU68 "unit/"
618+
if (skeleton.indexOf("unit/") >= 0) {
639619
return Style::UNIT;
640620
}
641621
return Style::DECIMAL;

deps/v8/test/cctest/test-api-icu.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ TEST(LocaleConfigurationChangeNotification) {
4747

4848
SetIcuLocale("zh_CN");
4949
isolate->LocaleConfigurationChangeNotification();
50-
CheckLocaleSpecificValues("zh-CN", "2020/2/14 下午1:45:00", "10,000.3");
50+
CheckLocaleSpecificValues("zh-CN", "2020/2/14下午1:45:00", "10,000.3");
5151

5252
UErrorCode error_code = U_ZERO_ERROR;
5353
icu::Locale::setDefault(default_locale, error_code);

0 commit comments

Comments
 (0)