Mark i18n functions as native and set proper names
authorjkummerow@chromium.org <jkummerow@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Wed, 3 Jul 2013 15:30:27 +0000 (15:30 +0000)
committerjkummerow@chromium.org <jkummerow@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Wed, 3 Jul 2013 15:30:27 +0000 (15:30 +0000)
BUG=v8:2745
R=jkummerow@chromium.org

Review URL: https://codereview.chromium.org/18075004

Patch from Jochen Eisinger <jochen@chromium.org>.

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@15478 ce2b1a6d-e550-0410-aec6-3dcde31c8c00

src/extensions/i18n/break-iterator.js
src/extensions/i18n/collator.js
src/extensions/i18n/date-format.js
src/extensions/i18n/footer.js
src/extensions/i18n/i18n-utils.js
src/extensions/i18n/number-format.js
src/extensions/i18n/overrides.js

index 9369082..eefd8c2 100644 (file)
@@ -118,7 +118,10 @@ function initializeBreakIterator(iterator, locales, options) {
   },
   ATTRIBUTES.DONT_ENUM
 );
+%FunctionSetName(Intl.v8BreakIterator.prototype.resolvedOptions,
+                 'resolvedOptions');
 %FunctionRemovePrototype(Intl.v8BreakIterator.prototype.resolvedOptions);
+%SetNativeFlag(Intl.v8BreakIterator.prototype.resolvedOptions);
 
 
 /**
@@ -136,7 +139,9 @@ function initializeBreakIterator(iterator, locales, options) {
   },
   ATTRIBUTES.DONT_ENUM
 );
+%FunctionSetName(Intl.v8BreakIterator.supportedLocalesOf, 'supportedLocalesOf');
 %FunctionRemovePrototype(Intl.v8BreakIterator.supportedLocalesOf);
+%SetNativeFlag(Intl.v8BreakIterator.supportedLocalesOf);
 
 
 /**
index 021164a..3483515 100644 (file)
@@ -168,7 +168,9 @@ function initializeCollator(collator, locales, options) {
   },
   ATTRIBUTES.DONT_ENUM
 );
+%FunctionSetName(Intl.Collator.prototype.resolvedOptions, 'resolvedOptions');
 %FunctionRemovePrototype(Intl.Collator.prototype.resolvedOptions);
+%SetNativeFlag(Intl.Collator.prototype.resolvedOptions);
 
 
 /**
@@ -186,7 +188,9 @@ function initializeCollator(collator, locales, options) {
   },
   ATTRIBUTES.DONT_ENUM
 );
+%FunctionSetName(Intl.Collator.supportedLocalesOf, 'supportedLocalesOf');
 %FunctionRemovePrototype(Intl.Collator.supportedLocalesOf);
+%SetNativeFlag(Intl.Collator.supportedLocalesOf);
 
 
 /**
index a91103e..04e7a7c 100644 (file)
@@ -377,7 +377,10 @@ function initializeDateTimeFormat(dateFormat, locales, options) {
   },
   ATTRIBUTES.DONT_ENUM
 );
+%FunctionSetName(Intl.DateTimeFormat.prototype.resolvedOptions,
+                 'resolvedOptions');
 %FunctionRemovePrototype(Intl.DateTimeFormat.prototype.resolvedOptions);
+%SetNativeFlag(Intl.DateTimeFormat.prototype.resolvedOptions);
 
 
 /**
@@ -395,7 +398,9 @@ function initializeDateTimeFormat(dateFormat, locales, options) {
   },
   ATTRIBUTES.DONT_ENUM
 );
+%FunctionSetName(Intl.DateTimeFormat.supportedLocalesOf, 'supportedLocalesOf');
 %FunctionRemovePrototype(Intl.DateTimeFormat.supportedLocalesOf);
+%SetNativeFlag(Intl.DateTimeFormat.supportedLocalesOf);
 
 
 /**
index a08153c..ac33f1e 100644 (file)
@@ -38,7 +38,3 @@ CLEANUP_RE.test('');
 
 return Intl;
 }());
-
-// Alias v8Intl to Intl so we don't break existing applications.
-// TODO(cira): Remove in a couple of months (starting at Oct 1st 2012).
-var v8Intl = Intl;
index c15a7d3..d7e9486 100644 (file)
@@ -73,13 +73,17 @@ function addBoundMethod(obj, methodName, implementation, length) {
           }
         }
       }
+      %FunctionSetName(boundMethod, internalName);
       %FunctionRemovePrototype(boundMethod);
+      %SetNativeFlag(boundMethod);
       this[internalName] = boundMethod;
     }
     return this[internalName];
   }
 
+  %FunctionSetName(getter, methodName);
   %FunctionRemovePrototype(getter);
+  %SetNativeFlag(getter);
 
   Object.defineProperty(obj.prototype, methodName, {
     get: getter,
@@ -185,7 +189,7 @@ function getGetOption(options, caller) {
                     'Default options are missing.');
   }
 
-  function getOption(property, type, values, defaultValue) {
+  var getOption = function getOption(property, type, values, defaultValue) {
     if (options[property] !== undefined) {
       var value = options[property];
       switch (type) {
@@ -362,11 +366,11 @@ function toObject(value) {
 function setOptions(inOptions, extensionMap, keyValues, getOption, outOptions) {
   var extension = '';
 
-  function updateExtension(key, value) {
+  var updateExtension = function updateExtension(key, value) {
     return '-' + key + '-' + String(value);
   }
 
-  function updateProperty(property, type, value) {
+  var updateProperty = function updateProperty(property, type, value) {
     if (type === 'boolean' && (typeof value === 'string')) {
       value = (value === 'true') ? true : false;
     }
index 5f5285d..1cd3db1 100644 (file)
@@ -237,7 +237,10 @@ function initializeNumberFormat(numberFormat, locales, options) {
   },
   ATTRIBUTES.DONT_ENUM
 );
+%FunctionSetName(Intl.NumberFormat.prototype.resolvedOptions,
+                 'resolvedOptions');
 %FunctionRemovePrototype(Intl.NumberFormat.prototype.resolvedOptions);
+%SetNativeFlag(Intl.NumberFormat.prototype.resolvedOptions);
 
 
 /**
@@ -255,7 +258,9 @@ function initializeNumberFormat(numberFormat, locales, options) {
   },
   ATTRIBUTES.DONT_ENUM
 );
+%FunctionSetName(Intl.NumberFormat.supportedLocalesOf, 'supportedLocalesOf');
 %FunctionRemovePrototype(Intl.NumberFormat.supportedLocalesOf);
+%SetNativeFlag(Intl.NumberFormat.supportedLocalesOf);
 
 
 /**
index 58e22aa..b2d60b3 100644 (file)
@@ -91,7 +91,9 @@ Object.defineProperty(String.prototype, 'localeCompare', {
   configurable: true,
   enumerable: false
 });
+%FunctionSetName(String.prototype.localeCompare, 'localeCompare');
 %FunctionRemovePrototype(String.prototype.localeCompare);
+%SetNativeFlag(String.prototype.localeCompare);
 
 
 /**
@@ -117,7 +119,9 @@ Object.defineProperty(Number.prototype, 'toLocaleString', {
   configurable: true,
   enumerable: false
 });
+%FunctionSetName(Number.prototype.toLocaleString, 'toLocaleString');
 %FunctionRemovePrototype(Number.prototype.toLocaleString);
+%SetNativeFlag(Number.prototype.toLocaleString);
 
 
 /**
@@ -161,7 +165,9 @@ Object.defineProperty(Date.prototype, 'toLocaleString', {
   configurable: true,
   enumerable: false
 });
+%FunctionSetName(Date.prototype.toLocaleString, 'toLocaleString');
 %FunctionRemovePrototype(Date.prototype.toLocaleString);
+%SetNativeFlag(Date.prototype.toLocaleString);
 
 
 /**
@@ -184,7 +190,9 @@ Object.defineProperty(Date.prototype, 'toLocaleDateString', {
   configurable: true,
   enumerable: false
 });
+%FunctionSetName(Date.prototype.toLocaleDateString, 'toLocaleDateString');
 %FunctionRemovePrototype(Date.prototype.toLocaleDateString);
+%SetNativeFlag(Date.prototype.toLocaleDateString);
 
 
 /**
@@ -207,4 +215,6 @@ Object.defineProperty(Date.prototype, 'toLocaleTimeString', {
   configurable: true,
   enumerable: false
 });
+%FunctionSetName(Date.prototype.toLocaleTimeString, 'toLocaleTimeString');
 %FunctionRemovePrototype(Date.prototype.toLocaleTimeString);
+%SetNativeFlag(Date.prototype.toLocaleTimeString);