optimize for loop:

```
for(var i=0, ii=this.layers.length; i<ii; ++i) {
```