[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}
This commit is contained in:
Leszek Swirski 2020-10-26 15:00:26 +01:00 committed by Commit Bot
parent 15efe5a635
commit 2361c7c6d6
3 changed files with 21 additions and 3 deletions

View File

@ -1090,6 +1090,16 @@ RUNTIME_FUNCTION(Runtime_HaveSameMap) {
return isolate->heap()->ToBoolean(obj1.map() == obj2.map());
}
RUNTIME_FUNCTION(Runtime_InLargeObjectSpace) {
SealHandleScope shs(isolate);
DCHECK_EQ(1, args.length());
CONVERT_ARG_CHECKED(HeapObject, obj, 0);
return isolate->heap()->ToBoolean(
isolate->heap()->new_lo_space()->Contains(obj) ||
isolate->heap()->code_lo_space()->Contains(obj) ||
isolate->heap()->lo_space()->Contains(obj));
}
RUNTIME_FUNCTION(Runtime_HasElementsInALargeObjectSpace) {
SealHandleScope shs(isolate);
DCHECK_EQ(1, args.length());

View File

@ -507,6 +507,7 @@ namespace internal {
F(HaveSameMap, 2, 1) \
F(HeapObjectVerify, 1, 1) \
F(ICsAreEnabled, 0, 1) \
F(InLargeObjectSpace, 1, 1) \
F(InYoungGeneration, 1, 1) \
F(IsAsmWasmCode, 1, 1) \
F(IsBeingInterpreted, 0, 1) \

View File

@ -1,13 +1,20 @@
// 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);
const size = 100000;
const arr = Array(size).fill(0.5);
for (let i = 0; i < 10; i++) {
arr.join(",");
assertTrue(%InLargeObjectSpace(arr.join("")));
}
})();