| function assert(b, m = "Bad!") { |
| function test(f, iters = 1000) { |
| for (let i = 0; i < iters; i++) |
| function prep(index, i, A, B) |
| if (index === (n - 1) && i === 5000) { |
| function check(index, arr, A, B, originalPrototype) |
| assert(originalPrototype !== prototype); |
| for (let i = 0; i < 5000; i++) |
| assert(arr[i].__proto__ === originalPrototype); |
| for (let i = 5000; i < 10000; i++) |
| assert(arr[i].__proto__ === prototype); |
| for (let i = 0; i < 10000; i++) |
| assert(arr[i].__proto__ === originalPrototype); |
| test(function body(index) { |
| function A(x, f = func) { |
| var originalPrototype = A.prototype; |
| for (let i = 0; i < 10000; i++) { |
| check(index, arr, A, B, originalPrototype); |