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

Unified Diff: src/i18n.js

Issue 1123703002: Reland "Wrap v8natives.js into a function." (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: revert stack trace printing Created 5 years, 8 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
« no previous file with comments | « src/harmony-typedarray.js ('k') | src/json.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/i18n.js
diff --git a/src/i18n.js b/src/i18n.js
index 46e8bb88e5829254bdca044cb431bb628b5fa07e..ec6518a33dc8e5cd7892a417af57588d3d9ca51b 100644
--- a/src/i18n.js
+++ b/src/i18n.js
@@ -254,7 +254,7 @@ function addBoundMethod(obj, methodName, implementation, length) {
}
}
}
- SetFunctionName(boundMethod, internalName);
+ $setFunctionName(boundMethod, internalName);
%FunctionRemovePrototype(boundMethod);
%SetNativeFlag(boundMethod);
this[internalName] = boundMethod;
@@ -262,11 +262,11 @@ function addBoundMethod(obj, methodName, implementation, length) {
return this[internalName];
}
- SetFunctionName(getter, methodName);
+ $setFunctionName(getter, methodName);
%FunctionRemovePrototype(getter);
%SetNativeFlag(getter);
- ObjectDefineProperty(obj.prototype, methodName, {
+ $objectDefineProperty(obj.prototype, methodName, {
get: getter,
enumerable: false,
configurable: true
@@ -585,14 +585,14 @@ function setOptions(inOptions, extensionMap, keyValues, getOption, outOptions) {
*/
function freezeArray(array) {
array.forEach(function(element, index) {
- ObjectDefineProperty(array, index, {value: element,
- configurable: false,
- writable: false,
- enumerable: true});
+ $objectDefineProperty(array, index, {value: element,
+ configurable: false,
+ writable: false,
+ enumerable: true});
});
- ObjectDefineProperty(array, 'length', {value: array.length,
- writable: false});
+ $objectDefineProperty(array, 'length', {value: array.length,
+ writable: false});
return array;
}
@@ -653,8 +653,8 @@ function getAvailableLocalesOf(service) {
* Configurable is false by default.
*/
function defineWEProperty(object, property, value) {
- ObjectDefineProperty(object, property,
- {value: value, writable: true, enumerable: true});
+ $objectDefineProperty(object, property,
+ {value: value, writable: true, enumerable: true});
}
@@ -673,11 +673,10 @@ function addWEPropertyIfDefined(object, property, value) {
* Defines a property and sets writable, enumerable and configurable to true.
*/
function defineWECProperty(object, property, value) {
- ObjectDefineProperty(object, property,
- {value: value,
- writable: true,
- enumerable: true,
- configurable: true});
+ $objectDefineProperty(object, property, {value: value,
+ writable: true,
+ enumerable: true,
+ configurable: true});
}
@@ -917,7 +916,7 @@ function initializeCollator(collator, locales, options) {
// problems. If malicious user decides to redefine Object.prototype.locale
// we can't just use plain x.locale = 'us' or in C++ Set("locale", "us").
// ObjectDefineProperties will either succeed defining or throw an error.
- var resolved = ObjectDefineProperties({}, {
+ var resolved = $objectDefineProperties({}, {
caseFirst: {writable: true},
collation: {value: internalOptions.collation, writable: true},
ignorePunctuation: {writable: true},
@@ -935,7 +934,7 @@ function initializeCollator(collator, locales, options) {
// Writable, configurable and enumerable are set to false by default.
%MarkAsInitializedIntlObjectOfType(collator, 'collator', internalCollator);
- ObjectDefineProperty(collator, 'resolved', {value: resolved});
+ $objectDefineProperty(collator, 'resolved', {value: resolved});
return collator;
}
@@ -990,7 +989,7 @@ function initializeCollator(collator, locales, options) {
},
DONT_ENUM
);
-SetFunctionName(Intl.Collator.prototype.resolvedOptions, 'resolvedOptions');
+$setFunctionName(Intl.Collator.prototype.resolvedOptions, 'resolvedOptions');
%FunctionRemovePrototype(Intl.Collator.prototype.resolvedOptions);
%SetNativeFlag(Intl.Collator.prototype.resolvedOptions);
@@ -1010,7 +1009,7 @@ SetFunctionName(Intl.Collator.prototype.resolvedOptions, 'resolvedOptions');
},
DONT_ENUM
);
-SetFunctionName(Intl.Collator.supportedLocalesOf, 'supportedLocalesOf');
+$setFunctionName(Intl.Collator.supportedLocalesOf, 'supportedLocalesOf');
%FunctionRemovePrototype(Intl.Collator.supportedLocalesOf);
%SetNativeFlag(Intl.Collator.supportedLocalesOf);
@@ -1131,7 +1130,7 @@ function initializeNumberFormat(numberFormat, locales, options) {
getOption, internalOptions);
var requestedLocale = locale.locale + extension;
- var resolved = ObjectDefineProperties({}, {
+ var resolved = $objectDefineProperties({}, {
currency: {writable: true},
currencyDisplay: {writable: true},
locale: {writable: true},
@@ -1156,12 +1155,12 @@ function initializeNumberFormat(numberFormat, locales, options) {
// We can't get information about number or currency style from ICU, so we
// assume user request was fulfilled.
if (internalOptions.style === 'currency') {
- ObjectDefineProperty(resolved, 'currencyDisplay', {value: currencyDisplay,
- writable: true});
+ $objectDefineProperty(resolved, 'currencyDisplay', {value: currencyDisplay,
+ writable: true});
}
%MarkAsInitializedIntlObjectOfType(numberFormat, 'numberformat', formatter);
- ObjectDefineProperty(numberFormat, 'resolved', {value: resolved});
+ $objectDefineProperty(numberFormat, 'resolved', {value: resolved});
return numberFormat;
}
@@ -1234,7 +1233,7 @@ function initializeNumberFormat(numberFormat, locales, options) {
},
DONT_ENUM
);
-SetFunctionName(Intl.NumberFormat.prototype.resolvedOptions,
+$setFunctionName(Intl.NumberFormat.prototype.resolvedOptions,
'resolvedOptions');
%FunctionRemovePrototype(Intl.NumberFormat.prototype.resolvedOptions);
%SetNativeFlag(Intl.NumberFormat.prototype.resolvedOptions);
@@ -1255,7 +1254,7 @@ SetFunctionName(Intl.NumberFormat.prototype.resolvedOptions,
},
DONT_ENUM
);
-SetFunctionName(Intl.NumberFormat.supportedLocalesOf, 'supportedLocalesOf');
+$setFunctionName(Intl.NumberFormat.supportedLocalesOf, 'supportedLocalesOf');
%FunctionRemovePrototype(Intl.NumberFormat.supportedLocalesOf);
%SetNativeFlag(Intl.NumberFormat.supportedLocalesOf);
@@ -1451,33 +1450,33 @@ function toDateTimeOptions(options, required, defaults) {
}
if (needsDefault && (defaults === 'date' || defaults === 'all')) {
- ObjectDefineProperty(options, 'year', {value: 'numeric',
- writable: true,
- enumerable: true,
- configurable: true});
- ObjectDefineProperty(options, 'month', {value: 'numeric',
+ $objectDefineProperty(options, 'year', {value: 'numeric',
writable: true,
enumerable: true,
configurable: true});
- ObjectDefineProperty(options, 'day', {value: 'numeric',
- writable: true,
- enumerable: true,
- configurable: true});
- }
-
- if (needsDefault && (defaults === 'time' || defaults === 'all')) {
- ObjectDefineProperty(options, 'hour', {value: 'numeric',
+ $objectDefineProperty(options, 'month', {value: 'numeric',
writable: true,
enumerable: true,
configurable: true});
- ObjectDefineProperty(options, 'minute', {value: 'numeric',
- writable: true,
- enumerable: true,
- configurable: true});
- ObjectDefineProperty(options, 'second', {value: 'numeric',
- writable: true,
- enumerable: true,
- configurable: true});
+ $objectDefineProperty(options, 'day', {value: 'numeric',
+ writable: true,
+ enumerable: true,
+ configurable: true});
+ }
+
+ if (needsDefault && (defaults === 'time' || defaults === 'all')) {
+ $objectDefineProperty(options, 'hour', {value: 'numeric',
+ writable: true,
+ enumerable: true,
+ configurable: true});
+ $objectDefineProperty(options, 'minute', {value: 'numeric',
+ writable: true,
+ enumerable: true,
+ configurable: true});
+ $objectDefineProperty(options, 'second', {value: 'numeric',
+ writable: true,
+ enumerable: true,
+ configurable: true});
}
return options;
@@ -1525,7 +1524,7 @@ function initializeDateTimeFormat(dateFormat, locales, options) {
getOption, internalOptions);
var requestedLocale = locale.locale + extension;
- var resolved = ObjectDefineProperties({}, {
+ var resolved = $objectDefineProperties({}, {
calendar: {writable: true},
day: {writable: true},
era: {writable: true},
@@ -1553,7 +1552,7 @@ function initializeDateTimeFormat(dateFormat, locales, options) {
}
%MarkAsInitializedIntlObjectOfType(dateFormat, 'dateformat', formatter);
- ObjectDefineProperty(dateFormat, 'resolved', {value: resolved});
+ $objectDefineProperty(dateFormat, 'resolved', {value: resolved});
return dateFormat;
}
@@ -1626,7 +1625,7 @@ function initializeDateTimeFormat(dateFormat, locales, options) {
},
DONT_ENUM
);
-SetFunctionName(Intl.DateTimeFormat.prototype.resolvedOptions,
+$setFunctionName(Intl.DateTimeFormat.prototype.resolvedOptions,
'resolvedOptions');
%FunctionRemovePrototype(Intl.DateTimeFormat.prototype.resolvedOptions);
%SetNativeFlag(Intl.DateTimeFormat.prototype.resolvedOptions);
@@ -1647,7 +1646,7 @@ SetFunctionName(Intl.DateTimeFormat.prototype.resolvedOptions,
},
DONT_ENUM
);
-SetFunctionName(Intl.DateTimeFormat.supportedLocalesOf, 'supportedLocalesOf');
+$setFunctionName(Intl.DateTimeFormat.supportedLocalesOf, 'supportedLocalesOf');
%FunctionRemovePrototype(Intl.DateTimeFormat.supportedLocalesOf);
%SetNativeFlag(Intl.DateTimeFormat.supportedLocalesOf);
@@ -1742,7 +1741,7 @@ function initializeBreakIterator(iterator, locales, options) {
'type', 'string', ['character', 'word', 'sentence', 'line'], 'word'));
var locale = resolveLocale('breakiterator', locales, options);
- var resolved = ObjectDefineProperties({}, {
+ var resolved = $objectDefineProperties({}, {
requestedLocale: {value: locale.locale, writable: true},
type: {value: internalOptions.type, writable: true},
locale: {writable: true}
@@ -1754,7 +1753,7 @@ function initializeBreakIterator(iterator, locales, options) {
%MarkAsInitializedIntlObjectOfType(iterator, 'breakiterator',
internalIterator);
- ObjectDefineProperty(iterator, 'resolved', {value: resolved});
+ $objectDefineProperty(iterator, 'resolved', {value: resolved});
return iterator;
}
@@ -1805,7 +1804,7 @@ function initializeBreakIterator(iterator, locales, options) {
},
DONT_ENUM
);
-SetFunctionName(Intl.v8BreakIterator.prototype.resolvedOptions,
+$setFunctionName(Intl.v8BreakIterator.prototype.resolvedOptions,
'resolvedOptions');
%FunctionRemovePrototype(Intl.v8BreakIterator.prototype.resolvedOptions);
%SetNativeFlag(Intl.v8BreakIterator.prototype.resolvedOptions);
@@ -1827,7 +1826,7 @@ SetFunctionName(Intl.v8BreakIterator.prototype.resolvedOptions,
},
DONT_ENUM
);
-SetFunctionName(Intl.v8BreakIterator.supportedLocalesOf, 'supportedLocalesOf');
+$setFunctionName(Intl.v8BreakIterator.supportedLocalesOf, 'supportedLocalesOf');
%FunctionRemovePrototype(Intl.v8BreakIterator.supportedLocalesOf);
%SetNativeFlag(Intl.v8BreakIterator.supportedLocalesOf);
@@ -1921,7 +1920,7 @@ function cachedOrNewService(service, locales, options, defaults) {
* Compares this and that, and returns less than 0, 0 or greater than 0 value.
* Overrides the built-in method.
*/
-OverrideFunction(GlobalString.prototype, 'localeCompare', function(that) {
+$overrideFunction(GlobalString.prototype, 'localeCompare', function(that) {
if (%_IsConstructCall()) {
throw MakeTypeError(kOrdinaryFunctionCalledAsConstructor);
}
@@ -1945,7 +1944,7 @@ OverrideFunction(GlobalString.prototype, 'localeCompare', function(that) {
* If the form is not one of "NFC", "NFD", "NFKC", or "NFKD", then throw
* a RangeError Exception.
*/
-OverrideFunction(GlobalString.prototype, 'normalize', function(that) {
+$overrideFunction(GlobalString.prototype, 'normalize', function(that) {
if (%_IsConstructCall()) {
throw MakeTypeError(kOrdinaryFunctionCalledAsConstructor);
}
@@ -1968,7 +1967,7 @@ OverrideFunction(GlobalString.prototype, 'normalize', function(that) {
* Formats a Number object (this) using locale and options values.
* If locale or options are omitted, defaults are used.
*/
-OverrideFunction(GlobalNumber.prototype, 'toLocaleString', function() {
+$overrideFunction(GlobalNumber.prototype, 'toLocaleString', function() {
if (%_IsConstructCall()) {
throw MakeTypeError(kOrdinaryFunctionCalledAsConstructor);
}
@@ -2011,7 +2010,7 @@ function toLocaleDateTime(date, locales, options, required, defaults, service) {
* If locale or options are omitted, defaults are used - both date and time are
* present in the output.
*/
-OverrideFunction(GlobalDate.prototype, 'toLocaleString', function() {
+$overrideFunction(GlobalDate.prototype, 'toLocaleString', function() {
if (%_IsConstructCall()) {
throw MakeTypeError(kOrdinaryFunctionCalledAsConstructor);
}
@@ -2029,7 +2028,7 @@ OverrideFunction(GlobalDate.prototype, 'toLocaleString', function() {
* If locale or options are omitted, defaults are used - only date is present
* in the output.
*/
-OverrideFunction(GlobalDate.prototype, 'toLocaleDateString', function() {
+$overrideFunction(GlobalDate.prototype, 'toLocaleDateString', function() {
if (%_IsConstructCall()) {
throw MakeTypeError(kOrdinaryFunctionCalledAsConstructor);
}
@@ -2047,7 +2046,7 @@ OverrideFunction(GlobalDate.prototype, 'toLocaleDateString', function() {
* If locale or options are omitted, defaults are used - only time is present
* in the output.
*/
-OverrideFunction(GlobalDate.prototype, 'toLocaleTimeString', function() {
+$overrideFunction(GlobalDate.prototype, 'toLocaleTimeString', function() {
if (%_IsConstructCall()) {
throw MakeTypeError(kOrdinaryFunctionCalledAsConstructor);
}
« no previous file with comments | « src/harmony-typedarray.js ('k') | src/json.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698