Index: src/array.js |
diff --git a/src/array.js b/src/array.js |
index 93378cfb00b1b14c0150e5b179c6de5f6a8852a2..0d25f99efdb0da06efa0cfcaa8070953c71e37a6 100644 |
--- a/src/array.js |
+++ b/src/array.js |
@@ -12,6 +12,7 @@ var $arraySplice; |
var $arrayUnshift; |
var $innerArrayForEach; |
var $innerArrayEvery; |
+var $innerArrayReverse; |
(function(global, shared, exports) { |
@@ -564,18 +565,7 @@ function SparseReverse(array, len) { |
} |
-function ArrayReverse() { |
- CHECK_OBJECT_COERCIBLE(this, "Array.prototype.reverse"); |
- |
- var array = TO_OBJECT_INLINE(this); |
- var len = TO_UINT32(array.length); |
- |
- if (UseSparseVariant(array, len, IS_ARRAY(array), len)) { |
- %NormalizeElements(array); |
- SparseReverse(array, len); |
- return array; |
- } |
- |
+function InnerArrayReverse(array, len) { |
var j = len - 1; |
for (var i = 0; i < j; i++, j--) { |
var current_i = array[i]; |
@@ -600,6 +590,22 @@ function ArrayReverse() { |
} |
+function ArrayReverse() { |
+ CHECK_OBJECT_COERCIBLE(this, "Array.prototype.reverse"); |
+ |
+ var array = TO_OBJECT_INLINE(this); |
+ var len = TO_UINT32(array.length); |
+ |
+ if (UseSparseVariant(array, len, IS_ARRAY(array), len)) { |
+ %NormalizeElements(array); |
+ SparseReverse(array, len); |
+ return array; |
+ } |
+ |
+ return InnerArrayReverse(array, len); |
+} |
+ |
+ |
function ObservedArrayShift(len) { |
var first = this[0]; |
@@ -1609,5 +1615,6 @@ $arrayUnshift = ArrayUnshift; |
$innerArrayForEach = InnerArrayForEach; |
$innerArrayEvery = InnerArrayEvery; |
+$innerArrayReverse = InnerArrayReverse; |
}); |