7768e9347b
This is a reland of a183895687
Now that https://crrev.com/c/3485678 landed and fixed the deadlock
in the linked bug, we can reland this CL without changes.
Original change's description:
> [heap] Allow shared references in WeakMap
>
> Shared references can also be stored in WeakMaps and during marking we
> need to be able to deal with such references. In a client GC shared
> objects are treated as live, so we don't need to update or check mark
> bits for such objects.
>
> Bug: v8:11708
> Change-Id: I0dbf797472c4779f462750dab63cc9b012aad091
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3447365
> Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
> Commit-Queue: Dominik Inführ <dinfuehr@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#79153}
Bug: v8:11708, v8:12642
Change-Id: I5945a16255647c897a1df834267137bf73b6207f
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3485679
Auto-Submit: Dominik Inführ <dinfuehr@chromium.org>
Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/main@{#79267}
24 lines
637 B
JavaScript
24 lines
637 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: --shared-string-table --allow-natives-syntax --stress-compaction --expose-gc
|
|
|
|
const val1 = "some value";
|
|
assertTrue(%IsSharedString(val1));
|
|
|
|
const wm = new WeakMap();
|
|
const key1 = {};
|
|
|
|
wm.set(key1, val1);
|
|
assertTrue(wm.get(key1) == val1);
|
|
assertTrue(%IsSharedString(wm.get(key1)));
|
|
|
|
gc();
|
|
assertTrue(wm.get(key1) == val1);
|
|
assertTrue(%IsSharedString(wm.get(key1)));
|
|
|
|
%SharedGC();
|
|
assertTrue(wm.get(key1) == val1);
|
|
assertTrue(%IsSharedString(wm.get(key1)));
|