| // Test a bunch of things about typed array constructors with iterators. |
| // Test that the dfg actually respects iterators. |
| if (this.i < foo.length/2) { |
| foo[Symbol.iterator] = iterator; |
| for (var i = 1; i < 100000; i++) { |
| if (new Int32Array(foo).length !== 2) |
| throw "iterator did not run"; |
| // Test that the optimizations used for iterators during construction is valid. |
| foo = { 0:0, 1:1, 2:2, 3:3 }; |
| foo.__defineGetter__("length", function() { |
| foo[Symbol.iterator] = Array.prototype[Symbol.iterator]; |
| if (new Int32Array(foo).length !== 2) |
| throw "iterator did not run"; |
| // Test that we handle length is unset... whoops. |
| if (new Int32Array(foo).length !== 0) |
| throw "did not handle object with unset length"; |
| // Test that we handle prototypes with accessors. |
| foo[Symbol.iterator] = Array.prototype[Symbol.iterator]; |
| bar.__defineGetter__("1", function() { |
| if (new Int32Array(foo).length !== 2) |
| throw "did not handle object with accessor on prototype"; |