Fix unreachable code under --harmony-intl-number-format-v3
ICU 71 added new enum value UNUM_APPROXIMATELY_SIGN_FIELD need to map to "approximatelySign" We also discover a spec bug in https://github.com/tc39/proposal-intl-numberformat-v3/issues/99 All the parts of formatRangeToParts should have a source "shared" for the case that start and end are the same or very close. Bug: chromium:1336865 Change-Id: I89142479989d3d2017d8cb89194db737710c38ed Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3717278 Reviewed-by: Shu-yu Guo <syg@chromium.org> Commit-Queue: Frank Tang <ftang@chromium.org> Cr-Commit-Position: refs/heads/main@{#81286}
This commit is contained in:
parent
afb26623df
commit
ba6db33e06
@ -8,6 +8,7 @@
|
||||
#ifdef V8_INTL_SUPPORT
|
||||
#define INTERNALIZED_STRING_LIST_GENERATOR_INTL(V, _) \
|
||||
V(_, adoptText_string, "adoptText") \
|
||||
V(_, approximatelySign_string, "approximatelySign") \
|
||||
V(_, baseName_string, "baseName") \
|
||||
V(_, accounting_string, "accounting") \
|
||||
V(_, breakType_string, "breakType") \
|
||||
|
@ -2744,6 +2744,9 @@ Handle<String> Intl::NumberFieldToType(Isolate* isolate,
|
||||
case UNUM_MEASURE_UNIT_FIELD:
|
||||
return isolate->factory()->unit_string();
|
||||
|
||||
case UNUM_APPROXIMATELY_SIGN_FIELD:
|
||||
return isolate->factory()->approximatelySign_string();
|
||||
|
||||
default:
|
||||
UNREACHABLE();
|
||||
}
|
||||
|
79
test/intl/regress-1336865.js
Normal file
79
test/intl/regress-1336865.js
Normal file
@ -0,0 +1,79 @@
|
||||
// Copyright 2022 the V8 project authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
// Flags: --harmony-intl-number-format-v3
|
||||
|
||||
let nf = new Intl.NumberFormat();
|
||||
let actual1 = nf.formatRangeToParts(1, 1);
|
||||
/*
|
||||
[{type: "approximatelySign", value: "~", source: "shared"},
|
||||
{type: "integer", value: "1", source: "shared"}]
|
||||
*/
|
||||
assertEquals(2, actual1.length);
|
||||
assertEquals("approximatelySign", actual1[0].type);
|
||||
assertEquals("~", actual1[0].value);
|
||||
assertEquals("shared", actual1[0].source);
|
||||
assertEquals("integer", actual1[1].type);
|
||||
assertEquals("1", actual1[1].value);
|
||||
assertEquals("shared", actual1[1].source);
|
||||
/*
|
||||
[{type: "approximatelySign", value: "~", source: "shared"},
|
||||
{type: "integer", value: "9", source: "shared"},
|
||||
{type: "group", value: ",", source: "shared"},
|
||||
{type: "integer", value: "223", source: "shared"},
|
||||
{type: "group", value: ",", source: "shared"},
|
||||
{type: "integer", value: "372", source: "shared"},
|
||||
{type: "group", value: ",", source: "shared"},
|
||||
{type: "integer", value: "036", source: "shared"},
|
||||
{type: "group", value: ",", source: "shared"},
|
||||
{type: "integer", value: "854", source: "shared"},
|
||||
{type: "group", value: ",", source: "shared"},
|
||||
{type: "integer", value: "775", source: "shared"},
|
||||
{type: "group", value: ",, source: "shared""},
|
||||
{type: "integer", value: "807", source: "shared"}]
|
||||
*/
|
||||
let bigint = 12345678901234567890n;
|
||||
let actual2 = nf.formatRangeToParts(bigint, bigint);
|
||||
assertEquals(14, actual2.length);
|
||||
assertEquals("approximatelySign", actual2[0].type);
|
||||
assertEquals("~", actual2[0].value);
|
||||
assertEquals("shared", actual2[0].source);
|
||||
assertEquals("integer", actual2[1].type);
|
||||
assertEquals("12", actual2[1].value);
|
||||
assertEquals("shared", actual2[1].source);
|
||||
assertEquals("group", actual2[2].type);
|
||||
assertEquals(",", actual2[2].value);
|
||||
assertEquals("shared", actual2[2].source);
|
||||
assertEquals("integer", actual2[3].type);
|
||||
assertEquals("345", actual2[3].value);
|
||||
assertEquals("shared", actual2[3].source);
|
||||
assertEquals("group", actual2[4].type);
|
||||
assertEquals(",", actual2[4].value);
|
||||
assertEquals("shared", actual2[4].source);
|
||||
assertEquals("integer", actual2[5].type);
|
||||
assertEquals("678", actual2[5].value);
|
||||
assertEquals("shared", actual2[5].source);
|
||||
assertEquals("group", actual2[6].type);
|
||||
assertEquals(",", actual2[6].value);
|
||||
assertEquals("shared", actual2[6].source);
|
||||
assertEquals("integer", actual2[7].type);
|
||||
assertEquals("901", actual2[7].value);
|
||||
assertEquals("shared", actual2[7].source);
|
||||
assertEquals("group", actual2[8].type);
|
||||
assertEquals(",", actual2[8].value);
|
||||
assertEquals("shared", actual2[8].source);
|
||||
assertEquals("integer", actual2[9].type);
|
||||
assertEquals("234", actual2[9].value);
|
||||
assertEquals("shared", actual2[9].source);
|
||||
assertEquals("group", actual2[10].type);
|
||||
assertEquals(",", actual2[10].value);
|
||||
assertEquals("shared", actual2[10].source);
|
||||
assertEquals("integer", actual2[11].type);
|
||||
assertEquals("567", actual2[11].value);
|
||||
assertEquals("shared", actual2[11].source);
|
||||
assertEquals("group", actual2[12].type);
|
||||
assertEquals(",", actual2[12].value);
|
||||
assertEquals("shared", actual2[12].source);
|
||||
assertEquals("integer", actual2[13].type);
|
||||
assertEquals("890", actual2[13].value);
|
||||
assertEquals("shared", actual2[13].source);
|
@ -382,76 +382,76 @@ KNOWN_MAPS = {
|
||||
("read_only_space", 0x033d9): (131, "BasicBlockCountersMarkerMap"),
|
||||
("read_only_space", 0x0341d): (146, "ArrayBoilerplateDescriptionMap"),
|
||||
("read_only_space", 0x0351d): (159, "InterceptorInfoMap"),
|
||||
("read_only_space", 0x05f49): (132, "PromiseFulfillReactionJobTaskMap"),
|
||||
("read_only_space", 0x05f71): (133, "PromiseRejectReactionJobTaskMap"),
|
||||
("read_only_space", 0x05f99): (134, "CallableTaskMap"),
|
||||
("read_only_space", 0x05fc1): (135, "CallbackTaskMap"),
|
||||
("read_only_space", 0x05fe9): (136, "PromiseResolveThenableJobTaskMap"),
|
||||
("read_only_space", 0x06011): (139, "FunctionTemplateInfoMap"),
|
||||
("read_only_space", 0x06039): (140, "ObjectTemplateInfoMap"),
|
||||
("read_only_space", 0x06061): (141, "AccessCheckInfoMap"),
|
||||
("read_only_space", 0x06089): (142, "AccessorPairMap"),
|
||||
("read_only_space", 0x060b1): (143, "AliasedArgumentsEntryMap"),
|
||||
("read_only_space", 0x060d9): (144, "AllocationMementoMap"),
|
||||
("read_only_space", 0x06101): (147, "AsmWasmDataMap"),
|
||||
("read_only_space", 0x06129): (148, "AsyncGeneratorRequestMap"),
|
||||
("read_only_space", 0x06151): (149, "BreakPointMap"),
|
||||
("read_only_space", 0x06179): (150, "BreakPointInfoMap"),
|
||||
("read_only_space", 0x061a1): (151, "CachedTemplateObjectMap"),
|
||||
("read_only_space", 0x061c9): (152, "CallSiteInfoMap"),
|
||||
("read_only_space", 0x061f1): (153, "ClassPositionsMap"),
|
||||
("read_only_space", 0x06219): (154, "DebugInfoMap"),
|
||||
("read_only_space", 0x06241): (156, "ErrorStackDataMap"),
|
||||
("read_only_space", 0x06269): (158, "FunctionTemplateRareDataMap"),
|
||||
("read_only_space", 0x06291): (160, "InterpreterDataMap"),
|
||||
("read_only_space", 0x062b9): (161, "ModuleRequestMap"),
|
||||
("read_only_space", 0x062e1): (162, "PromiseCapabilityMap"),
|
||||
("read_only_space", 0x06309): (163, "PromiseOnStackMap"),
|
||||
("read_only_space", 0x06331): (164, "PromiseReactionMap"),
|
||||
("read_only_space", 0x06359): (165, "PropertyDescriptorObjectMap"),
|
||||
("read_only_space", 0x06381): (166, "PrototypeInfoMap"),
|
||||
("read_only_space", 0x063a9): (167, "RegExpBoilerplateDescriptionMap"),
|
||||
("read_only_space", 0x063d1): (168, "ScriptMap"),
|
||||
("read_only_space", 0x063f9): (169, "ScriptOrModuleMap"),
|
||||
("read_only_space", 0x06421): (170, "SourceTextModuleInfoEntryMap"),
|
||||
("read_only_space", 0x06449): (171, "StackFrameInfoMap"),
|
||||
("read_only_space", 0x06471): (172, "TemplateObjectDescriptionMap"),
|
||||
("read_only_space", 0x06499): (173, "Tuple2Map"),
|
||||
("read_only_space", 0x064c1): (174, "WasmContinuationObjectMap"),
|
||||
("read_only_space", 0x064e9): (175, "WasmExceptionTagMap"),
|
||||
("read_only_space", 0x06511): (176, "WasmIndirectFunctionTableMap"),
|
||||
("read_only_space", 0x06539): (196, "SloppyArgumentsElementsMap"),
|
||||
("read_only_space", 0x06561): (231, "DescriptorArrayMap"),
|
||||
("read_only_space", 0x06589): (219, "UncompiledDataWithoutPreparseDataMap"),
|
||||
("read_only_space", 0x065b1): (217, "UncompiledDataWithPreparseDataMap"),
|
||||
("read_only_space", 0x065d9): (220, "UncompiledDataWithoutPreparseDataWithJobMap"),
|
||||
("read_only_space", 0x06601): (218, "UncompiledDataWithPreparseDataAndJobMap"),
|
||||
("read_only_space", 0x06629): (252, "OnHeapBasicBlockProfilerDataMap"),
|
||||
("read_only_space", 0x06651): (197, "TurbofanBitsetTypeMap"),
|
||||
("read_only_space", 0x06679): (201, "TurbofanUnionTypeMap"),
|
||||
("read_only_space", 0x066a1): (200, "TurbofanRangeTypeMap"),
|
||||
("read_only_space", 0x066c9): (198, "TurbofanHeapConstantTypeMap"),
|
||||
("read_only_space", 0x066f1): (199, "TurbofanOtherNumberConstantTypeMap"),
|
||||
("read_only_space", 0x06719): (248, "InternalClassMap"),
|
||||
("read_only_space", 0x06741): (259, "SmiPairMap"),
|
||||
("read_only_space", 0x06769): (258, "SmiBoxMap"),
|
||||
("read_only_space", 0x06791): (225, "ExportedSubClassBaseMap"),
|
||||
("read_only_space", 0x067b9): (226, "ExportedSubClassMap"),
|
||||
("read_only_space", 0x067e1): (202, "AbstractInternalClassSubclass1Map"),
|
||||
("read_only_space", 0x06809): (203, "AbstractInternalClassSubclass2Map"),
|
||||
("read_only_space", 0x06831): (195, "InternalClassWithSmiElementsMap"),
|
||||
("read_only_space", 0x06859): (249, "InternalClassWithStructElementsMap"),
|
||||
("read_only_space", 0x06881): (227, "ExportedSubClass2Map"),
|
||||
("read_only_space", 0x068a9): (260, "SortStateMap"),
|
||||
("read_only_space", 0x068d1): (145, "AllocationSiteWithWeakNextMap"),
|
||||
("read_only_space", 0x068f9): (145, "AllocationSiteWithoutWeakNextMap"),
|
||||
("read_only_space", 0x069c5): (137, "LoadHandler1Map"),
|
||||
("read_only_space", 0x069ed): (137, "LoadHandler2Map"),
|
||||
("read_only_space", 0x06a15): (137, "LoadHandler3Map"),
|
||||
("read_only_space", 0x06a3d): (138, "StoreHandler0Map"),
|
||||
("read_only_space", 0x06a65): (138, "StoreHandler1Map"),
|
||||
("read_only_space", 0x06a8d): (138, "StoreHandler2Map"),
|
||||
("read_only_space", 0x06ab5): (138, "StoreHandler3Map"),
|
||||
("read_only_space", 0x05f69): (132, "PromiseFulfillReactionJobTaskMap"),
|
||||
("read_only_space", 0x05f91): (133, "PromiseRejectReactionJobTaskMap"),
|
||||
("read_only_space", 0x05fb9): (134, "CallableTaskMap"),
|
||||
("read_only_space", 0x05fe1): (135, "CallbackTaskMap"),
|
||||
("read_only_space", 0x06009): (136, "PromiseResolveThenableJobTaskMap"),
|
||||
("read_only_space", 0x06031): (139, "FunctionTemplateInfoMap"),
|
||||
("read_only_space", 0x06059): (140, "ObjectTemplateInfoMap"),
|
||||
("read_only_space", 0x06081): (141, "AccessCheckInfoMap"),
|
||||
("read_only_space", 0x060a9): (142, "AccessorPairMap"),
|
||||
("read_only_space", 0x060d1): (143, "AliasedArgumentsEntryMap"),
|
||||
("read_only_space", 0x060f9): (144, "AllocationMementoMap"),
|
||||
("read_only_space", 0x06121): (147, "AsmWasmDataMap"),
|
||||
("read_only_space", 0x06149): (148, "AsyncGeneratorRequestMap"),
|
||||
("read_only_space", 0x06171): (149, "BreakPointMap"),
|
||||
("read_only_space", 0x06199): (150, "BreakPointInfoMap"),
|
||||
("read_only_space", 0x061c1): (151, "CachedTemplateObjectMap"),
|
||||
("read_only_space", 0x061e9): (152, "CallSiteInfoMap"),
|
||||
("read_only_space", 0x06211): (153, "ClassPositionsMap"),
|
||||
("read_only_space", 0x06239): (154, "DebugInfoMap"),
|
||||
("read_only_space", 0x06261): (156, "ErrorStackDataMap"),
|
||||
("read_only_space", 0x06289): (158, "FunctionTemplateRareDataMap"),
|
||||
("read_only_space", 0x062b1): (160, "InterpreterDataMap"),
|
||||
("read_only_space", 0x062d9): (161, "ModuleRequestMap"),
|
||||
("read_only_space", 0x06301): (162, "PromiseCapabilityMap"),
|
||||
("read_only_space", 0x06329): (163, "PromiseOnStackMap"),
|
||||
("read_only_space", 0x06351): (164, "PromiseReactionMap"),
|
||||
("read_only_space", 0x06379): (165, "PropertyDescriptorObjectMap"),
|
||||
("read_only_space", 0x063a1): (166, "PrototypeInfoMap"),
|
||||
("read_only_space", 0x063c9): (167, "RegExpBoilerplateDescriptionMap"),
|
||||
("read_only_space", 0x063f1): (168, "ScriptMap"),
|
||||
("read_only_space", 0x06419): (169, "ScriptOrModuleMap"),
|
||||
("read_only_space", 0x06441): (170, "SourceTextModuleInfoEntryMap"),
|
||||
("read_only_space", 0x06469): (171, "StackFrameInfoMap"),
|
||||
("read_only_space", 0x06491): (172, "TemplateObjectDescriptionMap"),
|
||||
("read_only_space", 0x064b9): (173, "Tuple2Map"),
|
||||
("read_only_space", 0x064e1): (174, "WasmContinuationObjectMap"),
|
||||
("read_only_space", 0x06509): (175, "WasmExceptionTagMap"),
|
||||
("read_only_space", 0x06531): (176, "WasmIndirectFunctionTableMap"),
|
||||
("read_only_space", 0x06559): (196, "SloppyArgumentsElementsMap"),
|
||||
("read_only_space", 0x06581): (231, "DescriptorArrayMap"),
|
||||
("read_only_space", 0x065a9): (219, "UncompiledDataWithoutPreparseDataMap"),
|
||||
("read_only_space", 0x065d1): (217, "UncompiledDataWithPreparseDataMap"),
|
||||
("read_only_space", 0x065f9): (220, "UncompiledDataWithoutPreparseDataWithJobMap"),
|
||||
("read_only_space", 0x06621): (218, "UncompiledDataWithPreparseDataAndJobMap"),
|
||||
("read_only_space", 0x06649): (252, "OnHeapBasicBlockProfilerDataMap"),
|
||||
("read_only_space", 0x06671): (197, "TurbofanBitsetTypeMap"),
|
||||
("read_only_space", 0x06699): (201, "TurbofanUnionTypeMap"),
|
||||
("read_only_space", 0x066c1): (200, "TurbofanRangeTypeMap"),
|
||||
("read_only_space", 0x066e9): (198, "TurbofanHeapConstantTypeMap"),
|
||||
("read_only_space", 0x06711): (199, "TurbofanOtherNumberConstantTypeMap"),
|
||||
("read_only_space", 0x06739): (248, "InternalClassMap"),
|
||||
("read_only_space", 0x06761): (259, "SmiPairMap"),
|
||||
("read_only_space", 0x06789): (258, "SmiBoxMap"),
|
||||
("read_only_space", 0x067b1): (225, "ExportedSubClassBaseMap"),
|
||||
("read_only_space", 0x067d9): (226, "ExportedSubClassMap"),
|
||||
("read_only_space", 0x06801): (202, "AbstractInternalClassSubclass1Map"),
|
||||
("read_only_space", 0x06829): (203, "AbstractInternalClassSubclass2Map"),
|
||||
("read_only_space", 0x06851): (195, "InternalClassWithSmiElementsMap"),
|
||||
("read_only_space", 0x06879): (249, "InternalClassWithStructElementsMap"),
|
||||
("read_only_space", 0x068a1): (227, "ExportedSubClass2Map"),
|
||||
("read_only_space", 0x068c9): (260, "SortStateMap"),
|
||||
("read_only_space", 0x068f1): (145, "AllocationSiteWithWeakNextMap"),
|
||||
("read_only_space", 0x06919): (145, "AllocationSiteWithoutWeakNextMap"),
|
||||
("read_only_space", 0x069e5): (137, "LoadHandler1Map"),
|
||||
("read_only_space", 0x06a0d): (137, "LoadHandler2Map"),
|
||||
("read_only_space", 0x06a35): (137, "LoadHandler3Map"),
|
||||
("read_only_space", 0x06a5d): (138, "StoreHandler0Map"),
|
||||
("read_only_space", 0x06a85): (138, "StoreHandler1Map"),
|
||||
("read_only_space", 0x06aad): (138, "StoreHandler2Map"),
|
||||
("read_only_space", 0x06ad5): (138, "StoreHandler3Map"),
|
||||
("map_space", 0x02149): (2114, "ExternalMap"),
|
||||
("map_space", 0x02171): (2118, "JSMessageObjectMap"),
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user