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

Unified Diff: src/js/i18n.js

Issue 2232063002: [builtins] WIP: Array indexOf in TurboFan/Runtime (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Move fast path FastElements -> FastSmiOrObjectElements Created 4 years, 4 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/js/array.js ('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 6d38a3f2db194c5c1f262dbfa4d0b88599f3f7af..8ae3e70851a3c91c1e30ab156f2e432d6eeadbd2 100644
--- a/src/js/i18n.js
+++ b/src/js/i18n.js
@@ -17,7 +17,6 @@
// -------------------------------------------------------------------
// Imports
-var ArrayIndexOf;
var ArrayJoin;
var ArrayPush;
var FLAG_intl_extra;
@@ -42,7 +41,6 @@ var StringSubstr;
var StringSubstring;
utils.Import(function(from) {
- ArrayIndexOf = from.ArrayIndexOf;
ArrayJoin = from.ArrayJoin;
ArrayPush = from.ArrayPush;
IsNaN = from.IsNaN;
@@ -369,7 +367,7 @@ function getGetOption(options, caller) {
throw %make_error(kWrongValueType);
}
- if (!IS_UNDEFINED(values) && %_Call(ArrayIndexOf, values, value) === -1) {
+ if (!IS_UNDEFINED(values) && %ArrayIndexOf(values, value, 0) === -1) {
throw %make_range_error(kValueOutOfRange, value, caller, property);
}
@@ -770,7 +768,7 @@ function initializeLocaleList(locales) {
var tag = canonicalizeLanguageTag(value);
- if (%_Call(ArrayIndexOf, seen, tag) === -1) {
+ if (%ArrayIndexOf(seen, tag, 0) === -1) {
%_Call(ArrayPush, seen, tag);
}
}
@@ -816,7 +814,7 @@ function isValidLanguageTag(locale) {
var value = parts[i];
if (!IS_NULL(InternalRegExpMatch(GetLanguageVariantRE(), value)) &&
extensions.length === 0) {
- if (%_Call(ArrayIndexOf, variants, value) === -1) {
+ if (%ArrayIndexOf(variants, value, 0) === -1) {
%_Call(ArrayPush, variants, value);
} else {
return false;
@@ -824,7 +822,7 @@ function isValidLanguageTag(locale) {
}
if (!IS_NULL(InternalRegExpMatch(GetLanguageSingletonRE(), value))) {
- if (%_Call(ArrayIndexOf, extensions, value) === -1) {
+ if (%ArrayIndexOf(extensions, value, 0) === -1) {
%_Call(ArrayPush, extensions, value);
} else {
return false;
@@ -949,7 +947,7 @@ function initializeCollator(collator, locales, options) {
'pinyin', 'reformed', 'searchjl', 'stroke', 'trad', 'unihan', 'zhuyin'
];
- if (%_Call(ArrayIndexOf, ALLOWED_CO_VALUES, extensionMap.co) !== -1) {
+ if (%ArrayIndexOf(ALLOWED_CO_VALUES, extensionMap.co, 0) !== -1) {
extension = '-u-co-' + extensionMap.co;
// ICU can't tell us what the collation is, so save user's input.
collation = extensionMap.co;
@@ -2041,7 +2039,7 @@ function LocaleConvertCase(s, locales, isToUpper) {
}
var CUSTOM_CASE_LANGUAGES = ['az', 'el', 'lt', 'tr'];
- var langIndex = %_Call(ArrayIndexOf, CUSTOM_CASE_LANGUAGES, language);
+ var langIndex = %ArrayIndexOf(CUSTOM_CASE_LANGUAGES, language, 0);
if (langIndex == -1) {
// language-independent case conversion.
return isToUpper ? %StringToUpperCaseI18N(s) : %StringToLowerCaseI18N(s);
@@ -2092,7 +2090,7 @@ OverrideFunction(GlobalString.prototype, 'normalize', function() {
var NORMALIZATION_FORMS = ['NFC', 'NFD', 'NFKC', 'NFKD'];
- var normalizationForm = %_Call(ArrayIndexOf, NORMALIZATION_FORMS, form);
+ var normalizationForm = %ArrayIndexOf(NORMALIZATION_FORMS, form, 0);
if (normalizationForm === -1) {
throw %make_range_error(kNormalizationForm,
%_Call(ArrayJoin, NORMALIZATION_FORMS, ', '));
« no previous file with comments | « src/js/array.js ('k') | src/js/string.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698