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

Unified Diff: src/js/i18n.js

Issue 2018983002: [builtins] Also migrate String.prototype.toLowerCase/toUpperCase to C++. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@StringTrim
Patch Set: REBASE Created 4 years, 7 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/contexts.h ('k') | src/js/string.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/js/i18n.js
diff --git a/src/js/i18n.js b/src/js/i18n.js
index 233f6c5c6f96514568dd6a5553f57fdf67556a7f..7eac76fe1b86b67a56c33661b363e3328c02d53b 100644
--- a/src/js/i18n.js
+++ b/src/js/i18n.js
@@ -46,6 +46,8 @@ var StringLastIndexOf;
var StringSplit;
var StringSubstr;
var StringSubstring;
+var StringToLowerCase = GlobalString.prototype.toLowerCase;
+var StringToUpperCase = GlobalString.prototype.toUpperCase;
utils.Import(function(from) {
ArrayIndexOf = from.ArrayIndexOf;
@@ -693,8 +695,8 @@ function addWECPropertyIfDefined(object, property, value) {
* Returns titlecased word, aMeRricA -> America.
*/
function toTitleCaseWord(word) {
- return %StringToUpperCase(%_Call(StringSubstr, word, 0, 1)) +
- %StringToLowerCase(%_Call(StringSubstr, word, 1));
+ return %_Call(StringToUpperCase, %_Call(StringSubstr, word, 0, 1)) +
+ %_Call(StringToLowerCase, %_Call(StringSubstr, word, 1));
}
/**
@@ -715,7 +717,7 @@ function toTitleCaseTimezoneLocation(location) {
var parts = %_Call(StringSplit, match[2], separator);
for (var i = 1; i < parts.length; i++) {
var part = parts[i]
- var lowercasedPart = %StringToLowerCase(part);
+ var lowercasedPart = %_Call(StringToLowerCase, part);
result = result + separator +
((lowercasedPart !== 'es' &&
lowercasedPart !== 'of' && lowercasedPart !== 'au') ?
@@ -1155,7 +1157,8 @@ function initializeNumberFormat(numberFormat, locales, options) {
var currencyDisplay = getOption(
'currencyDisplay', 'string', ['code', 'symbol', 'name'], 'symbol');
if (internalOptions.style === 'currency') {
- defineWEProperty(internalOptions, 'currency', %StringToUpperCase(currency));
+ defineWEProperty(internalOptions, 'currency',
+ %_Call(StringToUpperCase, currency));
defineWEProperty(internalOptions, 'currencyDisplay', currencyDisplay);
}
@@ -1789,7 +1792,7 @@ function canonicalizeTimeZoneID(tzID) {
}
// Special case handling (UTC, GMT).
- var upperID = %StringToUpperCase(tzID);
+ var upperID = %_Call(StringToUpperCase, tzID);
if (upperID === 'UTC' || upperID === 'GMT' ||
upperID === 'ETC/UTC' || upperID === 'ETC/GMT') {
return 'UTC';
« no previous file with comments | « src/contexts.h ('k') | src/js/string.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698