Replaces Array.prototype.reduce with a for loop.

As this is possibly the hottest code path, this speeds up average total
execution time with about 25%, benchmarking shows.