Remove old JIT and engine bug guards.

This commit is contained in:
John-David Dalton
2016-08-03 21:40:48 -07:00
parent 02e9f4c333
commit a98667ca05
2 changed files with 5 additions and 72 deletions

View File

@@ -2824,12 +2824,7 @@
* @returns {boolean} Returns `true` if `key` exists, else `false`.
*/
function baseHas(object, key) {
// Avoid a bug in IE 10-11 where objects with a [[Prototype]] of `null`,
// that are composed entirely of index properties, return `false` for
// `hasOwnProperty` checks of them.
return object != null &&
(hasOwnProperty.call(object, key) ||
(typeof object == 'object' && key in object && getPrototype(object) === null));
return object != null && hasOwnProperty.call(object, key);
}
/**
@@ -4004,7 +3999,7 @@
object = parent(object, path);
var key = toKey(last(path));
return !(object != null && baseHas(object, key)) || delete object[key];
return !(object != null && hasOwnProperty.call(object, key)) || delete object[key];
}
/**
@@ -5412,7 +5407,7 @@
var index = objLength;
while (index--) {
var key = objProps[index];
if (!(isPartial ? key in other : baseHas(other, key))) {
if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {
return false;
}
}
@@ -5548,19 +5543,6 @@
return arguments.length ? result(arguments[0], arguments[1]) : result;
}
/**
* Gets the "length" property value of `object`.
*
* **Note:** This function is used to avoid a
* [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792) that affects
* Safari on at least iOS 8.1-8.3 ARM64.
*
* @private
* @param {Object} object The object to query.
* @returns {*} Returns the "length" value.
*/
var getLength = baseProperty('length');
/**
* Gets the data for `map`.
*
@@ -10888,7 +10870,7 @@
* // => false
*/
function isArrayLike(value) {
return value != null && isLength(getLength(value)) && !isFunction(value);
return value != null && isLength(value.length) && !isFunction(value);
}
/**
@@ -12838,7 +12820,7 @@
length = result.length;
for (var key in object) {
if (baseHas(object, key) &&
if (hasOwnProperty.call(object, key) &&
!(skipIndexes && (key == 'length' || isIndex(key, length))) &&
!(isProto && key == 'constructor')) {
result.push(key);

View File

@@ -5785,26 +5785,6 @@
assert.deepEqual(_.filter(array, isEven), [2]);
});
QUnit.test('should iterate over an object with numeric keys (test in Mobile Safari 8)', function(assert) {
assert.expect(1);
// Trigger a mobile Safari 8 JIT bug.
// See https://github.com/lodash/lodash/issues/799.
var counter = 0,
object = { '1': 'foo', '8': 'bar', '50': 'baz' };
lodashStable.times(1000, function(assert) {
_.filter([], stubTrue);
});
_.filter(object, function() {
counter++;
return true;
});
assert.strictEqual(counter, 3);
});
}());
/*--------------------------------------------------------------------------*/
@@ -7805,19 +7785,6 @@
}
});
QUnit.test('`_.' + methodName + '` should work for objects with a `[[Prototype]]` of `null`', function(assert) {
assert.expect(1);
if (create) {
var object = create(null);
object[1] = 'a';
assert.strictEqual(func(object, 1), true);
}
else {
skipAssert(assert);
}
});
QUnit.test('`_.' + methodName + '` should check for a key over a path', function(assert) {
assert.expect(2);
@@ -11238,22 +11205,6 @@
skipAssert(assert, 7);
}
});
QUnit.test('should avoid V8 bug #2291 (test in Chrome 19-20)', function(assert) {
assert.expect(1);
// Trigger a V8 JIT bug.
// See https://code.google.com/p/v8/issues/detail?id=2291.
var object = {};
// First, have a comparison statement.
object == object;
// Then perform the check with `object`.
_.isObject(object);
assert.strictEqual(_.isObject('a'), false);
});
}(1, 2, 3));
/*--------------------------------------------------------------------------*/