Skip to content

Commit 192585a

Browse files
committed
Merge pull request #2094 from jridgewell/ios-jit-isArrayLike
Prevent iOS from improperly JIT-ing isArrayLike
2 parents 352529f + f580242 commit 192585a

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

underscore.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,9 +125,10 @@
125125
// Helper for collection methods to determine whether a collection
126126
// should be iterated as an array or as an object
127127
// Related: http://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength
128-
var MAX_ARRAY_INDEX = Math.pow(2, 53) - 1;
128+
// Avoids a very nasty iOS 8 JIT bug on ARM-64. #2094
129+
var MAX_ARRAY_INDEX = Math.pow(2, 53) - 1, LENGTH = 'length';
129130
var isArrayLike = function(collection) {
130-
var length = collection != null && collection.length;
131+
var length = collection != null && collection[LENGTH];
131132
return typeof length == 'number' && length >= 0 && length <= MAX_ARRAY_INDEX;
132133
};
133134

0 commit comments

Comments
 (0)