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

Unified 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: Don't expose patternSymbol 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 side-by-side diff with in-line comments
Download patch
Index: src/js/i18n.js
diff --git a/src/js/i18n.js b/src/js/i18n.js
index a859a9fbeb9f1028e0c6245364a800651d8e7f29..f914c032bb4793cdbb09b289207f9bb105461abf 100644
--- a/src/js/i18n.js
+++ b/src/js/i18n.js
@@ -33,6 +33,7 @@ var MakeTypeError;
var MathFloor;
var ObjectDefineProperties = utils.ImportNow("ObjectDefineProperties");
var ObjectDefineProperty = utils.ImportNow("ObjectDefineProperty");
+var patternSymbol = utils.ImportNow("pattern_symbol");
var RegExpTest;
var StringIndexOf;
var StringLastIndexOf;
@@ -41,6 +42,7 @@ var StringReplace;
var StringSplit;
var StringSubstr;
var StringSubstring;
+const kIntlPattern = 15;
utils.Import(function(from) {
ArrayIndexOf = from.ArrayIndexOf;
@@ -1157,6 +1159,10 @@ function initializeNumberFormat(numberFormat, locales, options) {
minimumFractionDigits: {writable: true},
minimumIntegerDigits: {writable: true},
numberingSystem: {writable: true},
+ pattern: {get() {
+ %IncrementUseCounter(kIntlPattern);
+ return this[patternSymbol];
+ }},
requestedLocale: {value: requestedLocale, writable: true},
style: {value: internalOptions.style, writable: true},
useGrouping: {writable: true}
@@ -1561,7 +1567,11 @@ function initializeDateTimeFormat(dateFormat, locales, options) {
minute: {writable: true},
month: {writable: true},
numberingSystem: {writable: true},
- pattern: {writable: true},
+ [patternSymbol]: {writable: true},
+ pattern: {get() {
adamk 2016/01/05 19:10:09 Don't you want a setter too, since the old propert
Dan Ehrenberg 2016/01/06 03:20:55 Oh, good point. Done.
+ %IncrementUseCounter(kIntlPattern);
+ return this[patternSymbol];
+ }},
requestedLocale: {value: requestedLocale, writable: true},
second: {writable: true},
timeZone: {writable: true},
@@ -1638,7 +1648,7 @@ function initializeDateTimeFormat(dateFormat, locales, options) {
};
var format = this;
- var fromPattern = fromLDMLString(format.resolved.pattern);
+ var fromPattern = fromLDMLString(format.resolved[patternSymbol]);
var userCalendar = ICU_CALENDAR_MAP[format.resolved.calendar];
if (IS_UNDEFINED(userCalendar)) {
// Use ICU name if we don't have a match. It shouldn't happen, but

Powered by Google App Engine
This is Rietveld 408576698