| Index: src/array.js
|
| diff --git a/src/array.js b/src/array.js
|
| index 84c76620326f2973b270efd634594bc8e60e5df2..b99273cbb7b601ca033789e3c980e626224a3f72 100644
|
| --- a/src/array.js
|
| +++ b/src/array.js
|
| @@ -11,6 +11,13 @@
|
| // -------------------------------------------------------------------
|
| // Imports
|
|
|
| +var ArrayConcatBuiltin = utils.ImportNow("array_concat");
|
| +var ArrayPopBuiltin = utils.ImportNow("array_pop");
|
| +var ArrayPushBuiltin = utils.ImportNow("array_push");
|
| +var ArrayShiftBuiltin = utils.ImportNow("array_shift");
|
| +var ArraySliceBuiltin = utils.ImportNow("array_slice");
|
| +var ArraySpliceBuiltin = utils.ImportNow("array_splice");
|
| +var ArrayUnshiftBuiltin = utils.ImportNow("array_unshift");
|
| var Delete;
|
| var GlobalArray = global.Array;
|
| var InternalArray = utils.InternalArray;
|
| @@ -525,7 +532,7 @@ function ArrayPush() {
|
| // Returns an array containing the array elements of the object followed
|
| // by the array elements of each argument in order. See ECMA-262,
|
| // section 15.4.4.7.
|
| -function ArrayConcatJS(arg1) { // length == 1
|
| +function ArrayConcat(arg1) { // length == 1
|
| CHECK_OBJECT_COERCIBLE(this, "Array.prototype.concat");
|
|
|
| var array = TO_OBJECT(this);
|
| @@ -1619,45 +1626,43 @@ utils.InstallFunctions(GlobalArray, DONT_ENUM, [
|
| "isArray", ArrayIsArray
|
| ]);
|
|
|
| -var specialFunctions = %SpecialArrayFunctions();
|
|
|
| -var getFunction = function(name, jsBuiltin, len) {
|
| - var f = jsBuiltin;
|
| - if (specialFunctions.hasOwnProperty(name)) {
|
| - f = specialFunctions[name];
|
| - }
|
| - if (!IS_UNDEFINED(len)) {
|
| - %FunctionSetLength(f, len);
|
| - }
|
| - return f;
|
| -};
|
| +%FunctionSetLength(ArrayEvery, 1);
|
| +%FunctionSetLength(ArrayFilter, 1);
|
| +%FunctionSetLength(ArrayForEach, 1);
|
| +%FunctionSetLength(ArrayIndexOf, 1);
|
| +%FunctionSetLength(ArrayLastIndexOf, 1);
|
| +%FunctionSetLength(ArrayMap, 1);
|
| +%FunctionSetLength(ArrayReduce, 1);
|
| +%FunctionSetLength(ArrayReduceRight, 1);
|
| +%FunctionSetLength(ArraySome, 1);
|
|
|
| // Set up non-enumerable functions of the Array.prototype object and
|
| // set their names.
|
| // Manipulate the length of some of the functions to meet
|
| // expectations set by ECMA-262 or Mozilla.
|
| utils.InstallFunctions(GlobalArray.prototype, DONT_ENUM, [
|
| - "toString", getFunction("toString", ArrayToString),
|
| - "toLocaleString", getFunction("toLocaleString", ArrayToLocaleString),
|
| - "join", getFunction("join", ArrayJoin),
|
| - "pop", getFunction("pop", ArrayPop),
|
| - "push", getFunction("push", ArrayPush, 1),
|
| - "concat", getFunction("concat", ArrayConcatJS, 1),
|
| - "reverse", getFunction("reverse", ArrayReverse),
|
| - "shift", getFunction("shift", ArrayShift),
|
| - "unshift", getFunction("unshift", ArrayUnshift, 1),
|
| - "slice", getFunction("slice", ArraySlice, 2),
|
| - "splice", getFunction("splice", ArraySplice, 2),
|
| - "sort", getFunction("sort", ArraySort),
|
| - "filter", getFunction("filter", ArrayFilter, 1),
|
| - "forEach", getFunction("forEach", ArrayForEach, 1),
|
| - "some", getFunction("some", ArraySome, 1),
|
| - "every", getFunction("every", ArrayEvery, 1),
|
| - "map", getFunction("map", ArrayMap, 1),
|
| - "indexOf", getFunction("indexOf", ArrayIndexOf, 1),
|
| - "lastIndexOf", getFunction("lastIndexOf", ArrayLastIndexOf, 1),
|
| - "reduce", getFunction("reduce", ArrayReduce, 1),
|
| - "reduceRight", getFunction("reduceRight", ArrayReduceRight, 1)
|
| + "concat", ArrayConcatBuiltin,
|
| + "every", ArrayEvery,
|
| + "filter", ArrayFilter,
|
| + "forEach", ArrayForEach,
|
| + "indexOf", ArrayIndexOf,
|
| + "join", ArrayJoin,
|
| + "lastIndexOf", ArrayLastIndexOf,
|
| + "map", ArrayMap,
|
| + "pop", ArrayPopBuiltin,
|
| + "push", ArrayPushBuiltin,
|
| + "reduce", ArrayReduce,
|
| + "reduceRight", ArrayReduceRight,
|
| + "reverse", ArrayReverse,
|
| + "shift", ArrayShiftBuiltin,
|
| + "slice", ArraySliceBuiltin,
|
| + "some", ArraySome,
|
| + "sort", ArraySort,
|
| + "splice", ArraySpliceBuiltin,
|
| + "toLocaleString", ArrayToLocaleString,
|
| + "toString", ArrayToString,
|
| + "unshift", ArrayUnshiftBuiltin,
|
| ]);
|
|
|
| %FinishArrayPrototypeSetup(GlobalArray.prototype);
|
| @@ -1666,20 +1671,20 @@ utils.InstallFunctions(GlobalArray.prototype, DONT_ENUM, [
|
| // exposed to user code.
|
| // Adding only the functions that are actually used.
|
| utils.SetUpLockedPrototype(InternalArray, GlobalArray(), [
|
| - "concat", getFunction("concat", ArrayConcatJS),
|
| - "indexOf", getFunction("indexOf", ArrayIndexOf),
|
| - "join", getFunction("join", ArrayJoin),
|
| - "pop", getFunction("pop", ArrayPop),
|
| - "push", getFunction("push", ArrayPush),
|
| - "shift", getFunction("shift", ArrayShift),
|
| - "splice", getFunction("splice", ArraySplice)
|
| + "concat", ArrayConcatBuiltin,
|
| + "indexOf", ArrayIndexOf,
|
| + "join", ArrayJoin,
|
| + "pop", ArrayPopBuiltin,
|
| + "push", ArrayPushBuiltin,
|
| + "shift", ArrayShiftBuiltin,
|
| + "splice", ArraySpliceBuiltin,
|
| ]);
|
|
|
| utils.SetUpLockedPrototype(InternalPackedArray, GlobalArray(), [
|
| - "join", getFunction("join", ArrayJoin),
|
| - "pop", getFunction("pop", ArrayPop),
|
| - "push", getFunction("push", ArrayPush),
|
| - "shift", getFunction("shift", ArrayShift)
|
| + "join", ArrayJoin,
|
| + "pop", ArrayPopBuiltin,
|
| + "push", ArrayPushBuiltin,
|
| + "shift", ArrayShiftBuiltin,
|
| ]);
|
|
|
| // -------------------------------------------------------------------
|
| @@ -1706,7 +1711,7 @@ utils.Export(function(to) {
|
| });
|
|
|
| %InstallToContext([
|
| - "array_concat", ArrayConcatJS,
|
| + "array_concat", ArrayConcat,
|
| "array_pop", ArrayPop,
|
| "array_push", ArrayPush,
|
| "array_shift", ArrayShift,
|
|
|