Mark i18n functions as native and set proper names

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
parent 5a71b173
......@@ -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);
/**
......
......@@ -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);
/**
......
......@@ -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);
/**
......
......@@ -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;
......@@ -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;
}
......
......@@ -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);
/**
......
......@@ -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);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment