OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 var $arrayConcat; | 5 var $arrayConcat; |
6 var $arrayPush; | 6 var $arrayPush; |
7 var $arrayPop; | 7 var $arrayPop; |
8 var $arrayShift; | 8 var $arrayShift; |
9 var $arraySlice; | 9 var $arraySlice; |
10 var $arraySplice; | 10 var $arraySplice; |
(...skipping 1158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1169 ShadowPrototypeElements(this, num_non_undefined, max_prototype_element); | 1169 ShadowPrototypeElements(this, num_non_undefined, max_prototype_element); |
1170 } | 1170 } |
1171 | 1171 |
1172 return this; | 1172 return this; |
1173 } | 1173 } |
1174 | 1174 |
1175 | 1175 |
1176 function ArraySort(comparefn) { | 1176 function ArraySort(comparefn) { |
1177 CHECK_OBJECT_COERCIBLE(this, "Array.prototype.sort"); | 1177 CHECK_OBJECT_COERCIBLE(this, "Array.prototype.sort"); |
1178 | 1178 |
1179 var length = TO_UINT32(this.length); | 1179 var array = $toObject(this); |
1180 return %_CallFunction(this, length, comparefn, InnerArraySort); | 1180 var length = TO_UINT32(array.length); |
| 1181 return %_CallFunction(array, length, comparefn, InnerArraySort); |
1181 } | 1182 } |
1182 | 1183 |
1183 | 1184 |
1184 // The following functions cannot be made efficient on sparse arrays while | 1185 // The following functions cannot be made efficient on sparse arrays while |
1185 // preserving the semantics, since the calls to the receiver function can add | 1186 // preserving the semantics, since the calls to the receiver function can add |
1186 // or delete elements from the array. | 1187 // or delete elements from the array. |
1187 function InnerArrayFilter(f, receiver, array, length) { | 1188 function InnerArrayFilter(f, receiver, array, length) { |
1188 if (!IS_SPEC_FUNCTION(f)) throw MakeTypeError(kCalledNonCallable, f); | 1189 if (!IS_SPEC_FUNCTION(f)) throw MakeTypeError(kCalledNonCallable, f); |
1189 var needs_wrapper = false; | 1190 var needs_wrapper = false; |
1190 if (IS_NULL(receiver)) { | 1191 if (IS_NULL(receiver)) { |
(...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1694 | 1695 |
1695 $arrayConcat = ArrayConcatJS; | 1696 $arrayConcat = ArrayConcatJS; |
1696 $arrayPush = ArrayPush; | 1697 $arrayPush = ArrayPush; |
1697 $arrayPop = ArrayPop; | 1698 $arrayPop = ArrayPop; |
1698 $arrayShift = ArrayShift; | 1699 $arrayShift = ArrayShift; |
1699 $arraySlice = ArraySlice; | 1700 $arraySlice = ArraySlice; |
1700 $arraySplice = ArraySplice; | 1701 $arraySplice = ArraySplice; |
1701 $arrayUnshift = ArrayUnshift; | 1702 $arrayUnshift = ArrayUnshift; |
1702 | 1703 |
1703 }); | 1704 }); |
OLD | NEW |