[test] Speed up mjsunit/regress/regress-542823

msunit/regress/regress-542823 is intended to test large object
allocation in Array.prototype.join, but to do so it has a pretty
inefficient way of first building a large array.

Speed-up this test by using Array.prototype.fill, call .join directly,
and make the whole thing an IIFE to avoid global loads.

Bug: v8:11060
Change-Id: I5906bcb6c65b10ec830b026cf1f24acb6d5e1aaf
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2498681
Commit-Queue: Leszek Swirski <leszeks@chromium.org>
Commit-Queue: Maya Lekova <mslekova@chromium.org>
Auto-Submit: Leszek Swirski <leszeks@chromium.org>
Reviewed-by: Maya Lekova <mslekova@chromium.org>
Cr-Commit-Position: refs/heads/master@{#70755}
This commit is contained in:
Leszek Swirski 2020-10-26 12:44:51 +01:00 committed by Commit Bot
parent 5fec7ad225
commit b12f17abac

View File

@ -2,11 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
__v_0 = 100000;
__v_1 = new Array();
for (var __v_2 = 0; __v_2 < __v_0; __v_2++) {
__v_1[__v_2] = 0.5;
}
for (var __v_2 = 0; __v_2 < 10; __v_2++) {
var __v_0 = __v_1 + 0.5;
(function() {
const size = 100000;
const arr = Array(size).fill(0.5);
for (let i = 0; i < 10; i++) {
arr.join(",");
}
})();