Deal with predicates that modify the original array.

Allow filter to match Array.prototype.filter behavior when input array
is modified by the filter predicate.

Unit test fails for 3.6.1. Passes as of cca3254

Fix #400