Commit 2188bdaf authored by yangguo's avatar yangguo Committed by Commit bot

Install js intrinsic fallbacks for array functions on the native context.

R=cbruni@chromium.org

Review URL: https://codereview.chromium.org/1309503003

Cr-Commit-Position: refs/heads/master@{#30382}
parent e7cd9d32
......@@ -2,14 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
var $arrayConcat;
var $arrayPush;
var $arrayPop;
var $arrayShift;
var $arraySlice;
var $arraySplice;
var $arrayUnshift;
(function(global, utils) {
"use strict";
......@@ -1695,6 +1687,7 @@ utils.SetUpLockedPrototype(InternalPackedArray, GlobalArray(), [
utils.Export(function(to) {
to.ArrayIndexOf = ArrayIndexOf;
to.ArrayJoin = ArrayJoin;
to.ArrayPush = ArrayPush;
to.ArrayToString = ArrayToString;
to.InnerArrayEvery = InnerArrayEvery;
to.InnerArrayFilter = InnerArrayFilter;
......@@ -1711,12 +1704,14 @@ utils.Export(function(to) {
to.PackedArrayReverse = PackedArrayReverse;
});
$arrayConcat = ArrayConcatJS;
$arrayPush = ArrayPush;
$arrayPop = ArrayPop;
$arrayShift = ArrayShift;
$arraySlice = ArraySlice;
$arraySplice = ArraySplice;
$arrayUnshift = ArrayUnshift;
%InstallToContext([
"array_concat", ArrayConcatJS,
"array_pop", ArrayPop,
"array_push", ArrayPush,
"array_shift", ArrayShift,
"array_splice", ArraySplice,
"array_slice", ArraySlice,
"array_unshift", ArrayUnshift,
]);
});
This diff is collapsed.
......@@ -91,6 +91,13 @@ enum BindingFlags {
V(TO_STRING_FUN_INDEX, JSFunction, to_string_fun)
#define NATIVE_CONTEXT_IMPORTED_FIELDS(V) \
V(ARRAY_CONCAT_INDEX, JSFunction, array_concat) \
V(ARRAY_POP_INDEX, JSFunction, array_pop) \
V(ARRAY_PUSH_INDEX, JSFunction, array_push) \
V(ARRAY_SHIFT_INDEX, JSFunction, array_shift) \
V(ARRAY_SPLICE_INDEX, JSFunction, array_splice) \
V(ARRAY_SLICE_INDEX, JSFunction, array_slice) \
V(ARRAY_UNSHIFT_INDEX, JSFunction, array_unshift) \
V(ARRAY_VALUES_ITERATOR_INDEX, JSFunction, array_values_iterator) \
V(CREATE_DATE_FUN_INDEX, JSFunction, create_date_fun) \
V(DERIVED_GET_TRAP_INDEX, JSFunction, derived_get_trap) \
......
......@@ -19,6 +19,7 @@
var ArrayIndexOf;
var ArrayJoin;
var ArrayPush;
var IsFinite;
var IsNaN;
var GlobalBoolean = global.Boolean;
......@@ -39,6 +40,7 @@ var StringSubstring;
utils.Import(function(from) {
ArrayIndexOf = from.ArrayIndexOf;
ArrayJoin = from.ArrayJoin;
ArrayPush = from.ArrayPush;
IsFinite = from.IsFinite;
IsNaN = from.IsNaN;
MathFloor = from.MathFloor;
......@@ -298,7 +300,7 @@ function lookupSupportedLocalesOf(requestedLocales, availableLocales) {
do {
if (!IS_UNDEFINED(availableLocales[locale])) {
// Push requested locale not the resolved one.
%_CallFunction(matchedLocales, requestedLocales[i], $arrayPush);
%_CallFunction(matchedLocales, requestedLocales[i], ArrayPush);
break;
}
// Truncate locale if possible, if not break.
......@@ -715,7 +717,7 @@ function initializeLocaleList(locales) {
} else {
// We allow single string localeID.
if (typeof locales === 'string') {
%_CallFunction(seen, canonicalizeLanguageTag(locales), $arrayPush);
%_CallFunction(seen, canonicalizeLanguageTag(locales), ArrayPush);
return freezeArray(seen);
}
......@@ -729,7 +731,7 @@ function initializeLocaleList(locales) {
var tag = canonicalizeLanguageTag(value);
if (%_CallFunction(seen, tag, ArrayIndexOf) === -1) {
%_CallFunction(seen, tag, $arrayPush);
%_CallFunction(seen, tag, ArrayPush);
}
}
}
......@@ -775,7 +777,7 @@ function isValidLanguageTag(locale) {
if (%_CallFunction(GetLanguageVariantRE(), value, RegExpTest) &&
extensions.length === 0) {
if (%_CallFunction(variants, value, ArrayIndexOf) === -1) {
%_CallFunction(variants, value, $arrayPush);
%_CallFunction(variants, value, ArrayPush);
} else {
return false;
}
......@@ -783,7 +785,7 @@ function isValidLanguageTag(locale) {
if (%_CallFunction(GetLanguageSingletonRE(), value, RegExpTest)) {
if (%_CallFunction(extensions, value, ArrayIndexOf) === -1) {
%_CallFunction(extensions, value, $arrayPush);
%_CallFunction(extensions, value, ArrayPush);
} else {
return false;
}
......
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