Optimizes `toArray` for v8