| Index: src/array.js
|
| ===================================================================
|
| --- src/array.js (revision 7763)
|
| +++ src/array.js (working copy)
|
| @@ -397,11 +397,6 @@
|
|
|
|
|
| function ArrayJoin(separator) {
|
| - if (IS_NULL_OR_UNDEFINED(this) && !IS_UNDETECTABLE(this)) {
|
| - throw MakeTypeError("called_on_null_or_undefined",
|
| - ["Array.prototype.join"]);
|
| - }
|
| -
|
| if (IS_UNDEFINED(separator)) {
|
| separator = ',';
|
| } else if (!IS_STRING(separator)) {
|
| @@ -418,11 +413,6 @@
|
| // Removes the last element from the array and returns it. See
|
| // ECMA-262, section 15.4.4.6.
|
| function ArrayPop() {
|
| - if (IS_NULL_OR_UNDEFINED(this) && !IS_UNDETECTABLE(this)) {
|
| - throw MakeTypeError("called_on_null_or_undefined",
|
| - ["Array.prototype.pop"]);
|
| - }
|
| -
|
| var n = TO_UINT32(this.length);
|
| if (n == 0) {
|
| this.length = n;
|
| @@ -439,11 +429,6 @@
|
| // Appends the arguments to the end of the array and returns the new
|
| // length of the array. See ECMA-262, section 15.4.4.7.
|
| function ArrayPush() {
|
| - if (IS_NULL_OR_UNDEFINED(this) && !IS_UNDETECTABLE(this)) {
|
| - throw MakeTypeError("called_on_null_or_undefined",
|
| - ["Array.prototype.push"]);
|
| - }
|
| -
|
| var n = TO_UINT32(this.length);
|
| var m = %_ArgumentsLength();
|
| for (var i = 0; i < m; i++) {
|
| @@ -455,11 +440,6 @@
|
|
|
|
|
| function ArrayConcat(arg1) { // length == 1
|
| - if (IS_NULL_OR_UNDEFINED(this) && !IS_UNDETECTABLE(this)) {
|
| - throw MakeTypeError("called_on_null_or_undefined",
|
| - ["Array.prototype.concat"]);
|
| - }
|
| -
|
| var arg_count = %_ArgumentsLength();
|
| var arrays = new InternalArray(1 + arg_count);
|
| arrays[0] = this;
|
| @@ -516,11 +496,6 @@
|
|
|
|
|
| function ArrayReverse() {
|
| - if (IS_NULL_OR_UNDEFINED(this) && !IS_UNDETECTABLE(this)) {
|
| - throw MakeTypeError("called_on_null_or_undefined",
|
| - ["Array.prototype.reverse"]);
|
| - }
|
| -
|
| var j = TO_UINT32(this.length) - 1;
|
|
|
| if (UseSparseVariant(this, j, IS_ARRAY(this))) {
|
| @@ -552,11 +527,6 @@
|
|
|
|
|
| function ArrayShift() {
|
| - if (IS_NULL_OR_UNDEFINED(this) && !IS_UNDETECTABLE(this)) {
|
| - throw MakeTypeError("called_on_null_or_undefined",
|
| - ["Array.prototype.shift"]);
|
| - }
|
| -
|
| var len = TO_UINT32(this.length);
|
|
|
| if (len === 0) {
|
| @@ -578,11 +548,6 @@
|
|
|
|
|
| function ArrayUnshift(arg1) { // length == 1
|
| - if (IS_NULL_OR_UNDEFINED(this) && !IS_UNDETECTABLE(this)) {
|
| - throw MakeTypeError("called_on_null_or_undefined",
|
| - ["Array.prototype.unshift"]);
|
| - }
|
| -
|
| var len = TO_UINT32(this.length);
|
| var num_arguments = %_ArgumentsLength();
|
|
|
| @@ -602,11 +567,6 @@
|
|
|
|
|
| function ArraySlice(start, end) {
|
| - if (IS_NULL_OR_UNDEFINED(this) && !IS_UNDETECTABLE(this)) {
|
| - throw MakeTypeError("called_on_null_or_undefined",
|
| - ["Array.prototype.slice"]);
|
| - }
|
| -
|
| var len = TO_UINT32(this.length);
|
| var start_i = TO_INTEGER(start);
|
| var end_i = len;
|
| @@ -644,11 +604,6 @@
|
|
|
|
|
| function ArraySplice(start, delete_count) {
|
| - if (IS_NULL_OR_UNDEFINED(this) && !IS_UNDETECTABLE(this)) {
|
| - throw MakeTypeError("called_on_null_or_undefined",
|
| - ["Array.prototype.splice"]);
|
| - }
|
| -
|
| var num_arguments = %_ArgumentsLength();
|
|
|
| var len = TO_UINT32(this.length);
|
| @@ -720,11 +675,6 @@
|
|
|
|
|
| function ArraySort(comparefn) {
|
| - if (IS_NULL_OR_UNDEFINED(this) && !IS_UNDETECTABLE(this)) {
|
| - throw MakeTypeError("called_on_null_or_undefined",
|
| - ["Array.prototype.sort"]);
|
| - }
|
| -
|
| // In-place QuickSort algorithm.
|
| // For short (length <= 22) arrays, insertion sort is used for efficiency.
|
|
|
| @@ -986,11 +936,6 @@
|
| // preserving the semantics, since the calls to the receiver function can add
|
| // or delete elements from the array.
|
| function ArrayFilter(f, receiver) {
|
| - if (IS_NULL_OR_UNDEFINED(this) && !IS_UNDETECTABLE(this)) {
|
| - throw MakeTypeError("called_on_null_or_undefined",
|
| - ["Array.prototype.filter"]);
|
| - }
|
| -
|
| if (!IS_FUNCTION(f)) {
|
| throw MakeTypeError('called_non_callable', [ f ]);
|
| }
|
| @@ -1012,11 +957,6 @@
|
|
|
|
|
| function ArrayForEach(f, receiver) {
|
| - if (IS_NULL_OR_UNDEFINED(this) && !IS_UNDETECTABLE(this)) {
|
| - throw MakeTypeError("called_on_null_or_undefined",
|
| - ["Array.prototype.forEach"]);
|
| - }
|
| -
|
| if (!IS_FUNCTION(f)) {
|
| throw MakeTypeError('called_non_callable', [ f ]);
|
| }
|
| @@ -1035,11 +975,6 @@
|
| // Executes the function once for each element present in the
|
| // array until it finds one where callback returns true.
|
| function ArraySome(f, receiver) {
|
| - if (IS_NULL_OR_UNDEFINED(this) && !IS_UNDETECTABLE(this)) {
|
| - throw MakeTypeError("called_on_null_or_undefined",
|
| - ["Array.prototype.some"]);
|
| - }
|
| -
|
| if (!IS_FUNCTION(f)) {
|
| throw MakeTypeError('called_non_callable', [ f ]);
|
| }
|
| @@ -1057,11 +992,6 @@
|
|
|
|
|
| function ArrayEvery(f, receiver) {
|
| - if (IS_NULL_OR_UNDEFINED(this) && !IS_UNDETECTABLE(this)) {
|
| - throw MakeTypeError("called_on_null_or_undefined",
|
| - ["Array.prototype.every"]);
|
| - }
|
| -
|
| if (!IS_FUNCTION(f)) {
|
| throw MakeTypeError('called_non_callable', [ f ]);
|
| }
|
| @@ -1078,11 +1008,6 @@
|
| }
|
|
|
| function ArrayMap(f, receiver) {
|
| - if (IS_NULL_OR_UNDEFINED(this) && !IS_UNDETECTABLE(this)) {
|
| - throw MakeTypeError("called_on_null_or_undefined",
|
| - ["Array.prototype.map"]);
|
| - }
|
| -
|
| if (!IS_FUNCTION(f)) {
|
| throw MakeTypeError('called_non_callable', [ f ]);
|
| }
|
| @@ -1103,11 +1028,6 @@
|
|
|
|
|
| function ArrayIndexOf(element, index) {
|
| - if (IS_NULL_OR_UNDEFINED(this) && !IS_UNDETECTABLE(this)) {
|
| - throw MakeTypeError("called_on_null_or_undefined",
|
| - ["Array.prototype.indexOf"]);
|
| - }
|
| -
|
| var length = TO_UINT32(this.length);
|
| if (length == 0) return -1;
|
| if (IS_UNDEFINED(index)) {
|
| @@ -1165,11 +1085,6 @@
|
|
|
|
|
| function ArrayLastIndexOf(element, index) {
|
| - if (IS_NULL_OR_UNDEFINED(this) && !IS_UNDETECTABLE(this)) {
|
| - throw MakeTypeError("called_on_null_or_undefined",
|
| - ["Array.prototype.lastIndexOf"]);
|
| - }
|
| -
|
| var length = TO_UINT32(this.length);
|
| if (length == 0) return -1;
|
| if (%_ArgumentsLength() < 2) {
|
| @@ -1223,11 +1138,6 @@
|
|
|
|
|
| function ArrayReduce(callback, current) {
|
| - if (IS_NULL_OR_UNDEFINED(this) && !IS_UNDETECTABLE(this)) {
|
| - throw MakeTypeError("called_on_null_or_undefined",
|
| - ["Array.prototype.reduce"]);
|
| - }
|
| -
|
| if (!IS_FUNCTION(callback)) {
|
| throw MakeTypeError('called_non_callable', [callback]);
|
| }
|
| @@ -1257,11 +1167,6 @@
|
| }
|
|
|
| function ArrayReduceRight(callback, current) {
|
| - if (IS_NULL_OR_UNDEFINED(this) && !IS_UNDETECTABLE(this)) {
|
| - throw MakeTypeError("called_on_null_or_undefined",
|
| - ["Array.prototype.reduceRight"]);
|
| - }
|
| -
|
| if (!IS_FUNCTION(callback)) {
|
| throw MakeTypeError('called_non_callable', [callback]);
|
| }
|
|
|