Reviewers: Jakob,
Description:
Mark i18n functions as native and set proper names
BUG=v8:2745
[email protected]
Please review this at https://codereview.chromium.org/18075004/
SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge
Affected files:
M src/extensions/i18n/break-iterator.js
M src/extensions/i18n/collator.js
M src/extensions/i18n/date-format.js
M src/extensions/i18n/footer.js
M src/extensions/i18n/i18n-utils.js
M src/extensions/i18n/number-format.js
M src/extensions/i18n/overrides.js
Index: src/extensions/i18n/break-iterator.js
diff --git a/src/extensions/i18n/break-iterator.js
b/src/extensions/i18n/break-iterator.js
index
9369082cf62e98ce1b62b9239cd103653484861e..eefd8c2ab1ebd99c5737d7209807bac90e944d11
100644
--- a/src/extensions/i18n/break-iterator.js
+++ b/src/extensions/i18n/break-iterator.js
@@ -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: src/extensions/i18n/collator.js
diff --git a/src/extensions/i18n/collator.js
b/src/extensions/i18n/collator.js
index
021164ac6314f22a84d37acfe0d818c1da7224a2..3483515bef2e688e1a08b31e8e33a239e3f55f2b
100644
--- a/src/extensions/i18n/collator.js
+++ b/src/extensions/i18n/collator.js
@@ -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: src/extensions/i18n/date-format.js
diff --git a/src/extensions/i18n/date-format.js
b/src/extensions/i18n/date-format.js
index
a91103e9aadbbff733022c7a9cdc88491b0cb97c..04e7a7c7b9d34e50c4ec34bf2ec1e3966534c0b6
100644
--- a/src/extensions/i18n/date-format.js
+++ b/src/extensions/i18n/date-format.js
@@ -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: src/extensions/i18n/footer.js
diff --git a/src/extensions/i18n/footer.js b/src/extensions/i18n/footer.js
index
a08153c29344015232e9b2467669868a83e2b952..ac33f1e24224957ff05d2cddef072987dd96942d
100644
--- a/src/extensions/i18n/footer.js
+++ b/src/extensions/i18n/footer.js
@@ -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: src/extensions/i18n/i18n-utils.js
diff --git a/src/extensions/i18n/i18n-utils.js
b/src/extensions/i18n/i18n-utils.js
index
c15a7d3fbda93cbf5d3ac55f70c6a3b73a2f6af6..d7e9486c507681c73973fb25e9bb7a39198cfc21
100644
--- a/src/extensions/i18n/i18n-utils.js
+++ b/src/extensions/i18n/i18n-utils.js
@@ -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: src/extensions/i18n/number-format.js
diff --git a/src/extensions/i18n/number-format.js
b/src/extensions/i18n/number-format.js
index
5f5285da9a67b0cb0a829980e0e04910079ec5fe..1cd3db13554b245a4cdde7e47010df513b737f1e
100644
--- a/src/extensions/i18n/number-format.js
+++ b/src/extensions/i18n/number-format.js
@@ -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: src/extensions/i18n/overrides.js
diff --git a/src/extensions/i18n/overrides.js
b/src/extensions/i18n/overrides.js
index
58e22aa0d5dfaa5fe6bc775449e80d315c6a6fff..b2d60b3fc67d1abea69c177dca34383991ffb458
100644
--- a/src/extensions/i18n/overrides.js
+++ b/src/extensions/i18n/overrides.js
@@ -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);
--
--
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.