Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(199)

Side by Side Diff: src/js/i18n.js

Issue 1558113002: Add UseCounters for various standards-related code paths (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix accidental redefinition Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/js/harmony-unicode-regexps.js ('k') | src/js/macros.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // ECMAScript 402 API implementation. 5 // ECMAScript 402 API implementation.
6 6
7 /** 7 /**
8 * Intl object is a single object that has some named properties, 8 * Intl object is a single object that has some named properties,
9 * all of which are constructors. 9 * all of which are constructors.
10 */ 10 */
(...skipping 15 matching lines...) Expand all
26 var GlobalDate = global.Date; 26 var GlobalDate = global.Date;
27 var GlobalNumber = global.Number; 27 var GlobalNumber = global.Number;
28 var GlobalRegExp = global.RegExp; 28 var GlobalRegExp = global.RegExp;
29 var GlobalString = global.String; 29 var GlobalString = global.String;
30 var MakeError; 30 var MakeError;
31 var MakeRangeError; 31 var MakeRangeError;
32 var MakeTypeError; 32 var MakeTypeError;
33 var MathFloor; 33 var MathFloor;
34 var ObjectDefineProperties = utils.ImportNow("ObjectDefineProperties"); 34 var ObjectDefineProperties = utils.ImportNow("ObjectDefineProperties");
35 var ObjectDefineProperty = utils.ImportNow("ObjectDefineProperty"); 35 var ObjectDefineProperty = utils.ImportNow("ObjectDefineProperty");
36 var patternSymbol = utils.ImportNow("intl_pattern_symbol");
36 var RegExpTest; 37 var RegExpTest;
38 var resolvedSymbol = utils.ImportNow("intl_resolved_symbol");
37 var StringIndexOf; 39 var StringIndexOf;
38 var StringLastIndexOf; 40 var StringLastIndexOf;
39 var StringMatch; 41 var StringMatch;
40 var StringReplace; 42 var StringReplace;
41 var StringSplit; 43 var StringSplit;
42 var StringSubstr; 44 var StringSubstr;
43 var StringSubstring; 45 var StringSubstring;
44 46
45 utils.Import(function(from) { 47 utils.Import(function(from) {
46 ArrayIndexOf = from.ArrayIndexOf; 48 ArrayIndexOf = from.ArrayIndexOf;
(...skipping 824 matching lines...) Expand 10 before | Expand all | Expand 10 after
871 var language = '(' + alpha + '{2,3}(-' + extLang + ')?|' + alpha + '{4}|' + 873 var language = '(' + alpha + '{2,3}(-' + extLang + ')?|' + alpha + '{4}|' +
872 alpha + '{5,8})'; 874 alpha + '{5,8})';
873 var langTag = language + '(-' + script + ')?(-' + region + ')?(-' + 875 var langTag = language + '(-' + script + ')?(-' + region + ')?(-' +
874 variant + ')*(-' + extension + ')*(-' + privateUse + ')?'; 876 variant + ')*(-' + extension + ')*(-' + privateUse + ')?';
875 877
876 var languageTag = 878 var languageTag =
877 '^(' + langTag + '|' + privateUse + '|' + grandfathered + ')$'; 879 '^(' + langTag + '|' + privateUse + '|' + grandfathered + ')$';
878 LANGUAGE_TAG_RE = new GlobalRegExp(languageTag, 'i'); 880 LANGUAGE_TAG_RE = new GlobalRegExp(languageTag, 'i');
879 } 881 }
880 882
883 var resolvedAccessor = {
884 get() {
885 %IncrementUseCounter(kIntlResolved);
886 return this[resolvedSymbol];
887 },
888 set(value) {
889 this[resolvedSymbol] = value;
890 }
891 };
892
881 /** 893 /**
882 * Initializes the given object so it's a valid Collator instance. 894 * Initializes the given object so it's a valid Collator instance.
883 * Useful for subclassing. 895 * Useful for subclassing.
884 */ 896 */
885 function initializeCollator(collator, locales, options) { 897 function initializeCollator(collator, locales, options) {
886 if (%IsInitializedIntlObject(collator)) { 898 if (%IsInitializedIntlObject(collator)) {
887 throw MakeTypeError(kReinitializeIntl, "Collator"); 899 throw MakeTypeError(kReinitializeIntl, "Collator");
888 } 900 }
889 901
890 if (IS_UNDEFINED(options)) { 902 if (IS_UNDEFINED(options)) {
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
969 strength: {writable: true}, 981 strength: {writable: true},
970 usage: {value: internalOptions.usage, writable: true} 982 usage: {value: internalOptions.usage, writable: true}
971 }); 983 });
972 984
973 var internalCollator = %CreateCollator(requestedLocale, 985 var internalCollator = %CreateCollator(requestedLocale,
974 internalOptions, 986 internalOptions,
975 resolved); 987 resolved);
976 988
977 // Writable, configurable and enumerable are set to false by default. 989 // Writable, configurable and enumerable are set to false by default.
978 %MarkAsInitializedIntlObjectOfType(collator, 'collator', internalCollator); 990 %MarkAsInitializedIntlObjectOfType(collator, 'collator', internalCollator);
979 ObjectDefineProperty(collator, 'resolved', {value: resolved}); 991 collator[resolvedSymbol] = resolved;
992 ObjectDefineProperty(collator, 'resolved', resolvedAccessor);
980 993
981 return collator; 994 return collator;
982 } 995 }
983 996
984 997
985 /** 998 /**
986 * Constructs Intl.Collator object given optional locales and options 999 * Constructs Intl.Collator object given optional locales and options
987 * parameters. 1000 * parameters.
988 * 1001 *
989 * @constructor 1002 * @constructor
(...skipping 19 matching lines...) Expand all
1009 %AddNamedProperty(Intl.Collator.prototype, 'resolvedOptions', function() { 1022 %AddNamedProperty(Intl.Collator.prototype, 'resolvedOptions', function() {
1010 if (!IS_UNDEFINED(new.target)) { 1023 if (!IS_UNDEFINED(new.target)) {
1011 throw MakeTypeError(kOrdinaryFunctionCalledAsConstructor); 1024 throw MakeTypeError(kOrdinaryFunctionCalledAsConstructor);
1012 } 1025 }
1013 1026
1014 if (!%IsInitializedIntlObjectOfType(this, 'collator')) { 1027 if (!%IsInitializedIntlObjectOfType(this, 'collator')) {
1015 throw MakeTypeError(kResolvedOptionsCalledOnNonObject, "Collator"); 1028 throw MakeTypeError(kResolvedOptionsCalledOnNonObject, "Collator");
1016 } 1029 }
1017 1030
1018 var coll = this; 1031 var coll = this;
1019 var locale = getOptimalLanguageTag(coll.resolved.requestedLocale, 1032 var locale = getOptimalLanguageTag(coll[resolvedSymbol].requestedLocale,
1020 coll.resolved.locale); 1033 coll[resolvedSymbol].locale);
1021 1034
1022 return { 1035 return {
1023 locale: locale, 1036 locale: locale,
1024 usage: coll.resolved.usage, 1037 usage: coll[resolvedSymbol].usage,
1025 sensitivity: coll.resolved.sensitivity, 1038 sensitivity: coll[resolvedSymbol].sensitivity,
1026 ignorePunctuation: coll.resolved.ignorePunctuation, 1039 ignorePunctuation: coll[resolvedSymbol].ignorePunctuation,
1027 numeric: coll.resolved.numeric, 1040 numeric: coll[resolvedSymbol].numeric,
1028 caseFirst: coll.resolved.caseFirst, 1041 caseFirst: coll[resolvedSymbol].caseFirst,
1029 collation: coll.resolved.collation 1042 collation: coll[resolvedSymbol].collation
1030 }; 1043 };
1031 }, 1044 },
1032 DONT_ENUM 1045 DONT_ENUM
1033 ); 1046 );
1034 %FunctionSetName(Intl.Collator.prototype.resolvedOptions, 'resolvedOptions'); 1047 %FunctionSetName(Intl.Collator.prototype.resolvedOptions, 'resolvedOptions');
1035 %FunctionRemovePrototype(Intl.Collator.prototype.resolvedOptions); 1048 %FunctionRemovePrototype(Intl.Collator.prototype.resolvedOptions);
1036 %SetNativeFlag(Intl.Collator.prototype.resolvedOptions); 1049 %SetNativeFlag(Intl.Collator.prototype.resolvedOptions);
1037 1050
1038 1051
1039 /** 1052 /**
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
1096 value = GlobalNumber(value); 1109 value = GlobalNumber(value);
1097 if (IsNaN(value) || value < min || value > max) { 1110 if (IsNaN(value) || value < min || value > max) {
1098 throw MakeRangeError(kPropertyValueOutOfRange, property); 1111 throw MakeRangeError(kPropertyValueOutOfRange, property);
1099 } 1112 }
1100 return MathFloor(value); 1113 return MathFloor(value);
1101 } 1114 }
1102 1115
1103 return fallback; 1116 return fallback;
1104 } 1117 }
1105 1118
1119 var patternAccessor = {
1120 get() {
1121 %IncrementUseCounter(kIntlPattern);
1122 return this[patternSymbol];
1123 },
1124 set(value) {
1125 this[patternSymbol] = value;
1126 }
1127 };
1106 1128
1107 /** 1129 /**
1108 * Initializes the given object so it's a valid NumberFormat instance. 1130 * Initializes the given object so it's a valid NumberFormat instance.
1109 * Useful for subclassing. 1131 * Useful for subclassing.
1110 */ 1132 */
1111 function initializeNumberFormat(numberFormat, locales, options) { 1133 function initializeNumberFormat(numberFormat, locales, options) {
1112 if (%IsInitializedIntlObject(numberFormat)) { 1134 if (%IsInitializedIntlObject(numberFormat)) {
1113 throw MakeTypeError(kReinitializeIntl, "NumberFormat"); 1135 throw MakeTypeError(kReinitializeIntl, "NumberFormat");
1114 } 1136 }
1115 1137
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
1191 1213
1192 var requestedLocale = locale.locale + extension; 1214 var requestedLocale = locale.locale + extension;
1193 var resolved = ObjectDefineProperties({}, { 1215 var resolved = ObjectDefineProperties({}, {
1194 currency: {writable: true}, 1216 currency: {writable: true},
1195 currencyDisplay: {writable: true}, 1217 currencyDisplay: {writable: true},
1196 locale: {writable: true}, 1218 locale: {writable: true},
1197 maximumFractionDigits: {writable: true}, 1219 maximumFractionDigits: {writable: true},
1198 minimumFractionDigits: {writable: true}, 1220 minimumFractionDigits: {writable: true},
1199 minimumIntegerDigits: {writable: true}, 1221 minimumIntegerDigits: {writable: true},
1200 numberingSystem: {writable: true}, 1222 numberingSystem: {writable: true},
1223 pattern: patternAccessor,
1201 requestedLocale: {value: requestedLocale, writable: true}, 1224 requestedLocale: {value: requestedLocale, writable: true},
1202 style: {value: internalOptions.style, writable: true}, 1225 style: {value: internalOptions.style, writable: true},
1203 useGrouping: {writable: true} 1226 useGrouping: {writable: true}
1204 }); 1227 });
1205 if (%HasOwnProperty(internalOptions, 'minimumSignificantDigits')) { 1228 if (%HasOwnProperty(internalOptions, 'minimumSignificantDigits')) {
1206 defineWEProperty(resolved, 'minimumSignificantDigits', UNDEFINED); 1229 defineWEProperty(resolved, 'minimumSignificantDigits', UNDEFINED);
1207 } 1230 }
1208 if (%HasOwnProperty(internalOptions, 'maximumSignificantDigits')) { 1231 if (%HasOwnProperty(internalOptions, 'maximumSignificantDigits')) {
1209 defineWEProperty(resolved, 'maximumSignificantDigits', UNDEFINED); 1232 defineWEProperty(resolved, 'maximumSignificantDigits', UNDEFINED);
1210 } 1233 }
1211 var formatter = %CreateNumberFormat(requestedLocale, 1234 var formatter = %CreateNumberFormat(requestedLocale,
1212 internalOptions, 1235 internalOptions,
1213 resolved); 1236 resolved);
1214 1237
1215 if (internalOptions.style === 'currency') { 1238 if (internalOptions.style === 'currency') {
1216 ObjectDefineProperty(resolved, 'currencyDisplay', {value: currencyDisplay, 1239 ObjectDefineProperty(resolved, 'currencyDisplay', {value: currencyDisplay,
1217 writable: true}); 1240 writable: true});
1218 } 1241 }
1219 1242
1220 %MarkAsInitializedIntlObjectOfType(numberFormat, 'numberformat', formatter); 1243 %MarkAsInitializedIntlObjectOfType(numberFormat, 'numberformat', formatter);
1221 ObjectDefineProperty(numberFormat, 'resolved', {value: resolved}); 1244 numberFormat[resolvedSymbol] = resolved;
1245 ObjectDefineProperty(numberFormat, 'resolved', resolvedAccessor);
1222 1246
1223 return numberFormat; 1247 return numberFormat;
1224 } 1248 }
1225 1249
1226 1250
1227 /** 1251 /**
1228 * Constructs Intl.NumberFormat object given optional locales and options 1252 * Constructs Intl.NumberFormat object given optional locales and options
1229 * parameters. 1253 * parameters.
1230 * 1254 *
1231 * @constructor 1255 * @constructor
(...skipping 19 matching lines...) Expand all
1251 %AddNamedProperty(Intl.NumberFormat.prototype, 'resolvedOptions', function() { 1275 %AddNamedProperty(Intl.NumberFormat.prototype, 'resolvedOptions', function() {
1252 if (!IS_UNDEFINED(new.target)) { 1276 if (!IS_UNDEFINED(new.target)) {
1253 throw MakeTypeError(kOrdinaryFunctionCalledAsConstructor); 1277 throw MakeTypeError(kOrdinaryFunctionCalledAsConstructor);
1254 } 1278 }
1255 1279
1256 if (!%IsInitializedIntlObjectOfType(this, 'numberformat')) { 1280 if (!%IsInitializedIntlObjectOfType(this, 'numberformat')) {
1257 throw MakeTypeError(kResolvedOptionsCalledOnNonObject, "NumberFormat"); 1281 throw MakeTypeError(kResolvedOptionsCalledOnNonObject, "NumberFormat");
1258 } 1282 }
1259 1283
1260 var format = this; 1284 var format = this;
1261 var locale = getOptimalLanguageTag(format.resolved.requestedLocale, 1285 var locale = getOptimalLanguageTag(format[resolvedSymbol].requestedLocale,
1262 format.resolved.locale); 1286 format[resolvedSymbol].locale);
1263 1287
1264 var result = { 1288 var result = {
1265 locale: locale, 1289 locale: locale,
1266 numberingSystem: format.resolved.numberingSystem, 1290 numberingSystem: format[resolvedSymbol].numberingSystem,
1267 style: format.resolved.style, 1291 style: format[resolvedSymbol].style,
1268 useGrouping: format.resolved.useGrouping, 1292 useGrouping: format[resolvedSymbol].useGrouping,
1269 minimumIntegerDigits: format.resolved.minimumIntegerDigits, 1293 minimumIntegerDigits: format[resolvedSymbol].minimumIntegerDigits,
1270 minimumFractionDigits: format.resolved.minimumFractionDigits, 1294 minimumFractionDigits: format[resolvedSymbol].minimumFractionDigits,
1271 maximumFractionDigits: format.resolved.maximumFractionDigits, 1295 maximumFractionDigits: format[resolvedSymbol].maximumFractionDigits,
1272 }; 1296 };
1273 1297
1274 if (result.style === 'currency') { 1298 if (result.style === 'currency') {
1275 defineWECProperty(result, 'currency', format.resolved.currency); 1299 defineWECProperty(result, 'currency', format[resolvedSymbol].currency);
1276 defineWECProperty(result, 'currencyDisplay', 1300 defineWECProperty(result, 'currencyDisplay',
1277 format.resolved.currencyDisplay); 1301 format[resolvedSymbol].currencyDisplay);
1278 } 1302 }
1279 1303
1280 if (%HasOwnProperty(format.resolved, 'minimumSignificantDigits')) { 1304 if (%HasOwnProperty(format[resolvedSymbol], 'minimumSignificantDigits')) {
1281 defineWECProperty(result, 'minimumSignificantDigits', 1305 defineWECProperty(result, 'minimumSignificantDigits',
1282 format.resolved.minimumSignificantDigits); 1306 format[resolvedSymbol].minimumSignificantDigits);
1283 } 1307 }
1284 1308
1285 if (%HasOwnProperty(format.resolved, 'maximumSignificantDigits')) { 1309 if (%HasOwnProperty(format[resolvedSymbol], 'maximumSignificantDigits')) {
1286 defineWECProperty(result, 'maximumSignificantDigits', 1310 defineWECProperty(result, 'maximumSignificantDigits',
1287 format.resolved.maximumSignificantDigits); 1311 format[resolvedSymbol].maximumSignificantDigits);
1288 } 1312 }
1289 1313
1290 return result; 1314 return result;
1291 }, 1315 },
1292 DONT_ENUM 1316 DONT_ENUM
1293 ); 1317 );
1294 %FunctionSetName(Intl.NumberFormat.prototype.resolvedOptions, 1318 %FunctionSetName(Intl.NumberFormat.prototype.resolvedOptions,
1295 'resolvedOptions'); 1319 'resolvedOptions');
1296 %FunctionRemovePrototype(Intl.NumberFormat.prototype.resolvedOptions); 1320 %FunctionRemovePrototype(Intl.NumberFormat.prototype.resolvedOptions);
1297 %SetNativeFlag(Intl.NumberFormat.prototype.resolvedOptions); 1321 %SetNativeFlag(Intl.NumberFormat.prototype.resolvedOptions);
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
1595 var resolved = ObjectDefineProperties({}, { 1619 var resolved = ObjectDefineProperties({}, {
1596 calendar: {writable: true}, 1620 calendar: {writable: true},
1597 day: {writable: true}, 1621 day: {writable: true},
1598 era: {writable: true}, 1622 era: {writable: true},
1599 hour12: {writable: true}, 1623 hour12: {writable: true},
1600 hour: {writable: true}, 1624 hour: {writable: true},
1601 locale: {writable: true}, 1625 locale: {writable: true},
1602 minute: {writable: true}, 1626 minute: {writable: true},
1603 month: {writable: true}, 1627 month: {writable: true},
1604 numberingSystem: {writable: true}, 1628 numberingSystem: {writable: true},
1605 pattern: {writable: true}, 1629 [patternSymbol]: {writable: true},
1630 pattern: patternAccessor,
1606 requestedLocale: {value: requestedLocale, writable: true}, 1631 requestedLocale: {value: requestedLocale, writable: true},
1607 second: {writable: true}, 1632 second: {writable: true},
1608 timeZone: {writable: true}, 1633 timeZone: {writable: true},
1609 timeZoneName: {writable: true}, 1634 timeZoneName: {writable: true},
1610 tz: {value: tz, writable: true}, 1635 tz: {value: tz, writable: true},
1611 weekday: {writable: true}, 1636 weekday: {writable: true},
1612 year: {writable: true} 1637 year: {writable: true}
1613 }); 1638 });
1614 1639
1615 var formatter = %CreateDateTimeFormat( 1640 var formatter = %CreateDateTimeFormat(
1616 requestedLocale, {skeleton: ldmlString, timeZone: tz}, resolved); 1641 requestedLocale, {skeleton: ldmlString, timeZone: tz}, resolved);
1617 1642
1618 if (resolved.timeZone === "Etc/Unknown") { 1643 if (resolved.timeZone === "Etc/Unknown") {
1619 throw MakeRangeError(kUnsupportedTimeZone, tz); 1644 throw MakeRangeError(kUnsupportedTimeZone, tz);
1620 } 1645 }
1621 1646
1622 %MarkAsInitializedIntlObjectOfType(dateFormat, 'dateformat', formatter); 1647 %MarkAsInitializedIntlObjectOfType(dateFormat, 'dateformat', formatter);
1623 ObjectDefineProperty(dateFormat, 'resolved', {value: resolved}); 1648 dateFormat[resolvedSymbol] = resolved;
1649 ObjectDefineProperty(dateFormat, 'resolved', resolvedAccessor);
1624 1650
1625 return dateFormat; 1651 return dateFormat;
1626 } 1652 }
1627 1653
1628 1654
1629 /** 1655 /**
1630 * Constructs Intl.DateTimeFormat object given optional locales and options 1656 * Constructs Intl.DateTimeFormat object given optional locales and options
1631 * parameters. 1657 * parameters.
1632 * 1658 *
1633 * @constructor 1659 * @constructor
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
1672 'islamic': 'islamic', 1698 'islamic': 'islamic',
1673 'hebrew': 'hebrew', 1699 'hebrew': 'hebrew',
1674 'chinese': 'chinese', 1700 'chinese': 'chinese',
1675 'indian': 'indian', 1701 'indian': 'indian',
1676 'coptic': 'coptic', 1702 'coptic': 'coptic',
1677 'ethiopic': 'ethiopic', 1703 'ethiopic': 'ethiopic',
1678 'ethiopic-amete-alem': 'ethioaa' 1704 'ethiopic-amete-alem': 'ethioaa'
1679 }; 1705 };
1680 1706
1681 var format = this; 1707 var format = this;
1682 var fromPattern = fromLDMLString(format.resolved.pattern); 1708 var fromPattern = fromLDMLString(format[resolvedSymbol][patternSymbol]);
1683 var userCalendar = ICU_CALENDAR_MAP[format.resolved.calendar]; 1709 var userCalendar = ICU_CALENDAR_MAP[format[resolvedSymbol].calendar];
1684 if (IS_UNDEFINED(userCalendar)) { 1710 if (IS_UNDEFINED(userCalendar)) {
1685 // Use ICU name if we don't have a match. It shouldn't happen, but 1711 // Use ICU name if we don't have a match. It shouldn't happen, but
1686 // it would be too strict to throw for this. 1712 // it would be too strict to throw for this.
1687 userCalendar = format.resolved.calendar; 1713 userCalendar = format[resolvedSymbol].calendar;
1688 } 1714 }
1689 1715
1690 var locale = getOptimalLanguageTag(format.resolved.requestedLocale, 1716 var locale = getOptimalLanguageTag(format[resolvedSymbol].requestedLocale,
1691 format.resolved.locale); 1717 format[resolvedSymbol].locale);
1692 1718
1693 var result = { 1719 var result = {
1694 locale: locale, 1720 locale: locale,
1695 numberingSystem: format.resolved.numberingSystem, 1721 numberingSystem: format[resolvedSymbol].numberingSystem,
1696 calendar: userCalendar, 1722 calendar: userCalendar,
1697 timeZone: format.resolved.timeZone 1723 timeZone: format[resolvedSymbol].timeZone
1698 }; 1724 };
1699 1725
1700 addWECPropertyIfDefined(result, 'timeZoneName', fromPattern.timeZoneName); 1726 addWECPropertyIfDefined(result, 'timeZoneName', fromPattern.timeZoneName);
1701 addWECPropertyIfDefined(result, 'era', fromPattern.era); 1727 addWECPropertyIfDefined(result, 'era', fromPattern.era);
1702 addWECPropertyIfDefined(result, 'year', fromPattern.year); 1728 addWECPropertyIfDefined(result, 'year', fromPattern.year);
1703 addWECPropertyIfDefined(result, 'month', fromPattern.month); 1729 addWECPropertyIfDefined(result, 'month', fromPattern.month);
1704 addWECPropertyIfDefined(result, 'day', fromPattern.day); 1730 addWECPropertyIfDefined(result, 'day', fromPattern.day);
1705 addWECPropertyIfDefined(result, 'weekday', fromPattern.weekday); 1731 addWECPropertyIfDefined(result, 'weekday', fromPattern.weekday);
1706 addWECPropertyIfDefined(result, 'hour12', fromPattern.hour12); 1732 addWECPropertyIfDefined(result, 'hour12', fromPattern.hour12);
1707 addWECPropertyIfDefined(result, 'hour', fromPattern.hour); 1733 addWECPropertyIfDefined(result, 'hour', fromPattern.hour);
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
1839 type: {value: internalOptions.type, writable: true}, 1865 type: {value: internalOptions.type, writable: true},
1840 locale: {writable: true} 1866 locale: {writable: true}
1841 }); 1867 });
1842 1868
1843 var internalIterator = %CreateBreakIterator(locale.locale, 1869 var internalIterator = %CreateBreakIterator(locale.locale,
1844 internalOptions, 1870 internalOptions,
1845 resolved); 1871 resolved);
1846 1872
1847 %MarkAsInitializedIntlObjectOfType(iterator, 'breakiterator', 1873 %MarkAsInitializedIntlObjectOfType(iterator, 'breakiterator',
1848 internalIterator); 1874 internalIterator);
1849 ObjectDefineProperty(iterator, 'resolved', {value: resolved}); 1875 iterator[resolvedSymbol] = resolved;
1876 ObjectDefineProperty(iterator, 'resolved', resolvedAccessor);
1850 1877
1851 return iterator; 1878 return iterator;
1852 } 1879 }
1853 1880
1854 1881
1855 /** 1882 /**
1856 * Constructs Intl.v8BreakIterator object given optional locales and options 1883 * Constructs Intl.v8BreakIterator object given optional locales and options
1857 * parameters. 1884 * parameters.
1858 * 1885 *
1859 * @constructor 1886 * @constructor
(...skipping 20 matching lines...) Expand all
1880 function() { 1907 function() {
1881 if (!IS_UNDEFINED(new.target)) { 1908 if (!IS_UNDEFINED(new.target)) {
1882 throw MakeTypeError(kOrdinaryFunctionCalledAsConstructor); 1909 throw MakeTypeError(kOrdinaryFunctionCalledAsConstructor);
1883 } 1910 }
1884 1911
1885 if (!%IsInitializedIntlObjectOfType(this, 'breakiterator')) { 1912 if (!%IsInitializedIntlObjectOfType(this, 'breakiterator')) {
1886 throw MakeTypeError(kResolvedOptionsCalledOnNonObject, "v8BreakIterator"); 1913 throw MakeTypeError(kResolvedOptionsCalledOnNonObject, "v8BreakIterator");
1887 } 1914 }
1888 1915
1889 var segmenter = this; 1916 var segmenter = this;
1890 var locale = getOptimalLanguageTag(segmenter.resolved.requestedLocale, 1917 var locale =
1891 segmenter.resolved.locale); 1918 getOptimalLanguageTag(segmenter[resolvedSymbol].requestedLocale,
1919 segmenter[resolvedSymbol].locale);
1892 1920
1893 return { 1921 return {
1894 locale: locale, 1922 locale: locale,
1895 type: segmenter.resolved.type 1923 type: segmenter[resolvedSymbol].type
1896 }; 1924 };
1897 }, 1925 },
1898 DONT_ENUM 1926 DONT_ENUM
1899 ); 1927 );
1900 %FunctionSetName(Intl.v8BreakIterator.prototype.resolvedOptions, 1928 %FunctionSetName(Intl.v8BreakIterator.prototype.resolvedOptions,
1901 'resolvedOptions'); 1929 'resolvedOptions');
1902 %FunctionRemovePrototype(Intl.v8BreakIterator.prototype.resolvedOptions); 1930 %FunctionRemovePrototype(Intl.v8BreakIterator.prototype.resolvedOptions);
1903 %SetNativeFlag(Intl.v8BreakIterator.prototype.resolvedOptions); 1931 %SetNativeFlag(Intl.v8BreakIterator.prototype.resolvedOptions);
1904 1932
1905 1933
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
2160 } 2188 }
2161 2189
2162 var locales = %_Arguments(0); 2190 var locales = %_Arguments(0);
2163 var options = %_Arguments(1); 2191 var options = %_Arguments(1);
2164 return toLocaleDateTime( 2192 return toLocaleDateTime(
2165 this, locales, options, 'time', 'time', 'dateformattime'); 2193 this, locales, options, 'time', 'time', 'dateformattime');
2166 } 2194 }
2167 ); 2195 );
2168 2196
2169 }) 2197 })
OLDNEW
« no previous file with comments | « src/js/harmony-unicode-regexps.js ('k') | src/js/macros.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698