Revision: 15478
Author:   [email protected]
Date:     Wed Jul  3 08:30:27 2013
Log:      Mark i18n functions as native and set proper names

BUG=v8:2745
[email protected]

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

Patch from Jochen Eisinger <[email protected]>.
http://code.google.com/p/v8/source/detail?r=15478

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

=======================================
--- /branches/bleeding_edge/src/extensions/i18n/break-iterator.js Wed Jul 3 04:22:29 2013 +++ /branches/bleeding_edge/src/extensions/i18n/break-iterator.js Wed Jul 3 08:30:27 2013
@@ -118,7 +118,10 @@
   },
   ATTRIBUTES.DONT_ENUM
 );
+%FunctionSetName(Intl.v8BreakIterator.prototype.resolvedOptions,
+                 'resolvedOptions');
 %FunctionRemovePrototype(Intl.v8BreakIterator.prototype.resolvedOptions);
+%SetNativeFlag(Intl.v8BreakIterator.prototype.resolvedOptions);


 /**
@@ -136,7 +139,9 @@
   },
   ATTRIBUTES.DONT_ENUM
 );
+%FunctionSetName(Intl.v8BreakIterator.supportedLocalesOf, 
'supportedLocalesOf');
 %FunctionRemovePrototype(Intl.v8BreakIterator.supportedLocalesOf);
+%SetNativeFlag(Intl.v8BreakIterator.supportedLocalesOf);


 /**
=======================================
--- /branches/bleeding_edge/src/extensions/i18n/collator.js Wed Jul 3 04:22:29 2013 +++ /branches/bleeding_edge/src/extensions/i18n/collator.js Wed Jul 3 08:30:27 2013
@@ -168,7 +168,9 @@
   },
   ATTRIBUTES.DONT_ENUM
 );
+%FunctionSetName(Intl.Collator.prototype.resolvedOptions, 'resolvedOptions');
 %FunctionRemovePrototype(Intl.Collator.prototype.resolvedOptions);
+%SetNativeFlag(Intl.Collator.prototype.resolvedOptions);


 /**
@@ -186,7 +188,9 @@
   },
   ATTRIBUTES.DONT_ENUM
 );
+%FunctionSetName(Intl.Collator.supportedLocalesOf, 'supportedLocalesOf');
 %FunctionRemovePrototype(Intl.Collator.supportedLocalesOf);
+%SetNativeFlag(Intl.Collator.supportedLocalesOf);


 /**
=======================================
--- /branches/bleeding_edge/src/extensions/i18n/date-format.js Wed Jul 3 04:22:29 2013 +++ /branches/bleeding_edge/src/extensions/i18n/date-format.js Wed Jul 3 08:30:27 2013
@@ -377,7 +377,10 @@
   },
   ATTRIBUTES.DONT_ENUM
 );
+%FunctionSetName(Intl.DateTimeFormat.prototype.resolvedOptions,
+                 'resolvedOptions');
 %FunctionRemovePrototype(Intl.DateTimeFormat.prototype.resolvedOptions);
+%SetNativeFlag(Intl.DateTimeFormat.prototype.resolvedOptions);


 /**
@@ -395,7 +398,9 @@
   },
   ATTRIBUTES.DONT_ENUM
 );
+%FunctionSetName(Intl.DateTimeFormat.supportedLocalesOf, 'supportedLocalesOf');
 %FunctionRemovePrototype(Intl.DateTimeFormat.supportedLocalesOf);
+%SetNativeFlag(Intl.DateTimeFormat.supportedLocalesOf);


 /**
=======================================
--- /branches/bleeding_edge/src/extensions/i18n/footer.js Wed Jul 3 04:22:29 2013 +++ /branches/bleeding_edge/src/extensions/i18n/footer.js Wed Jul 3 08:30:27 2013
@@ -38,7 +38,3 @@

 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;
=======================================
--- /branches/bleeding_edge/src/extensions/i18n/i18n-utils.js Wed Jul 3 04:22:29 2013 +++ /branches/bleeding_edge/src/extensions/i18n/i18n-utils.js Wed Jul 3 08:30:27 2013
@@ -73,13 +73,17 @@
           }
         }
       }
+      %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 @@
                     '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 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;
     }
=======================================
--- /branches/bleeding_edge/src/extensions/i18n/number-format.js Wed Jul 3 04:22:29 2013 +++ /branches/bleeding_edge/src/extensions/i18n/number-format.js Wed Jul 3 08:30:27 2013
@@ -237,7 +237,10 @@
   },
   ATTRIBUTES.DONT_ENUM
 );
+%FunctionSetName(Intl.NumberFormat.prototype.resolvedOptions,
+                 'resolvedOptions');
 %FunctionRemovePrototype(Intl.NumberFormat.prototype.resolvedOptions);
+%SetNativeFlag(Intl.NumberFormat.prototype.resolvedOptions);


 /**
@@ -255,7 +258,9 @@
   },
   ATTRIBUTES.DONT_ENUM
 );
+%FunctionSetName(Intl.NumberFormat.supportedLocalesOf, 'supportedLocalesOf');
 %FunctionRemovePrototype(Intl.NumberFormat.supportedLocalesOf);
+%SetNativeFlag(Intl.NumberFormat.supportedLocalesOf);


 /**
=======================================
--- /branches/bleeding_edge/src/extensions/i18n/overrides.js Wed Jul 3 04:22:29 2013 +++ /branches/bleeding_edge/src/extensions/i18n/overrides.js Wed Jul 3 08:30:27 2013
@@ -91,7 +91,9 @@
   configurable: true,
   enumerable: false
 });
+%FunctionSetName(String.prototype.localeCompare, 'localeCompare');
 %FunctionRemovePrototype(String.prototype.localeCompare);
+%SetNativeFlag(String.prototype.localeCompare);


 /**
@@ -117,7 +119,9 @@
   configurable: true,
   enumerable: false
 });
+%FunctionSetName(Number.prototype.toLocaleString, 'toLocaleString');
 %FunctionRemovePrototype(Number.prototype.toLocaleString);
+%SetNativeFlag(Number.prototype.toLocaleString);


 /**
@@ -161,7 +165,9 @@
   configurable: true,
   enumerable: false
 });
+%FunctionSetName(Date.prototype.toLocaleString, 'toLocaleString');
 %FunctionRemovePrototype(Date.prototype.toLocaleString);
+%SetNativeFlag(Date.prototype.toLocaleString);


 /**
@@ -184,7 +190,9 @@
   configurable: true,
   enumerable: false
 });
+%FunctionSetName(Date.prototype.toLocaleDateString, 'toLocaleDateString');
 %FunctionRemovePrototype(Date.prototype.toLocaleDateString);
+%SetNativeFlag(Date.prototype.toLocaleDateString);


 /**
@@ -207,4 +215,6 @@
   configurable: true,
   enumerable: false
 });
+%FunctionSetName(Date.prototype.toLocaleTimeString, 'toLocaleTimeString');
 %FunctionRemovePrototype(Date.prototype.toLocaleTimeString);
+%SetNativeFlag(Date.prototype.toLocaleTimeString);

--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to