v8/test/mjsunit/regress/regress-542823.js
Leszek Swirski 2361c7c6d6 [test] Speed up mjsunit/regress/regress-542823 more
Make the array elements in msunit/regress/regress-542823 larger, so that
it takes fewer of them to force the joined string to go into large
object space. Also, set the array's size dynamically based on the
maximum non-large object size, rather than having a fixed magic "large
enough" size, and verify that the resulting joined string is indeed in
LO space.

This reduces the runtime of this test under slow_path and gc-stress from
minutes to seconds.

Bug: v8:11060
Change-Id: I51d960b6a3e052199f50c1a6ba6fbce1b6d1ae38
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2498689
Auto-Submit: Leszek Swirski <leszeks@chromium.org>
Reviewed-by: Michael Achenbach <machenbach@chromium.org>
Commit-Queue: Leszek Swirski <leszeks@chromium.org>
Cr-Commit-Position: refs/heads/master@{#70762}
2020-10-26 16:51:10 +00:00

21 lines
658 B
JavaScript

// Copyright 2015 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// Flags: --allow-natives-syntax
(function() {
const page_size_bits = 18;
const max_heap_object_size = (1 << (page_size_bits - 1));
const filler = "Large amount of text per element, so that the joined array is"
+ "large enough to be allocated in the large object space"
const size = Math.ceil(max_heap_object_size / filler.length + 1);
const arr = Array(size).fill(filler);
for (let i = 0; i < 10; i++) {
assertTrue(%InLargeObjectSpace(arr.join("")));
}
})();