v8/test/mjsunit/shared-memory/shared-string-promotion-major.js
Dominik Inführ 2b2e4e4267 Reland "[heap] Handle old-to-new slot promotion to shared heap"
This is a reland of commit 9cca4e60f1

This CL disables the mjsunit tests as well in single generation mode.

Original change's description:
> [heap] Handle old-to-new slot promotion to shared heap
>
> The GC might promote an in-place internalizable string from new space
> directly into the shared heap. This means that the GC might need to
> create OLD_TO_SHARED slots when updating OLD_TO_NEW slots.
>
> This CL implements this both for minor and full GCs.
>
> Bug: v8:11708
> Change-Id: I6102b9024d1dd5dd602d654b006ea5897ab5baa6
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3804604
> Commit-Queue: Dominik Inführ <dinfuehr@chromium.org>
> Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#82298}

Bug: v8:11708
Change-Id: I9e96fe7c3f263d4088536d3a15af6d00fa82625e
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3828099
Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
Commit-Queue: Dominik Inführ <dinfuehr@chromium.org>
Cr-Commit-Position: refs/heads/main@{#82540}
2022-08-17 16:39:18 +00:00

28 lines
760 B
JavaScript

// Copyright 2022 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: --expose-gc --allow-natives-syntax --verify-heap --shared-string-table
const old = {};
old.bar = 100;
gc();
assertFalse(%InYoungGeneration(old));
const foo = 'a'.repeat(9);
assertTrue(%InYoungGeneration(foo));
assertTrue(%IsInPlaceInternalizableString(foo));
// Create old-to-new reference.
old.foo = foo;
// Full GC would usally promote that string into old space,
// with --shared-string-table it is promoted into shared heap
// instead. This should create an old-to-shared reference from
// an old-to-new slot.
gc();
// An additional full GC for heap verification.
gc();