Revert "[heap] Allow shared references in WeakMap"
This reverts commit a183895687
.
Reason for revert: https://bugs.chromium.org/p/v8/issues/detail?id=12642
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
Change-Id: I113672aceba0ef5aa71f6fbedda7e0df854a437d
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3474673
Auto-Submit: Nico Hartmann <nicohartmann@chromium.org>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Nico Hartmann <nicohartmann@chromium.org>
Owners-Override: Nico Hartmann <nicohartmann@chromium.org>
Cr-Commit-Position: refs/heads/main@{#79168}
This commit is contained in:
parent
a1faaf06a4
commit
89a21b685d
@ -2912,16 +2912,12 @@ void MarkCompactCollector::ClearWeakCollections() {
|
||||
if (FLAG_verify_heap) {
|
||||
Object value = table.ValueAt(i);
|
||||
if (value.IsHeapObject()) {
|
||||
HeapObject heap_object = HeapObject::cast(value);
|
||||
CHECK_IMPLIES(
|
||||
(!is_shared_heap_ && key.InSharedHeap()) ||
|
||||
non_atomic_marking_state()->IsBlackOrGrey(key),
|
||||
(!is_shared_heap_ && heap_object.InSharedHeap()) ||
|
||||
non_atomic_marking_state()->IsBlackOrGrey(heap_object));
|
||||
CHECK_IMPLIES(non_atomic_marking_state()->IsBlackOrGrey(key),
|
||||
non_atomic_marking_state()->IsBlackOrGrey(
|
||||
HeapObject::cast(value)));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
if (!is_shared_heap_ && key.InSharedHeap()) continue;
|
||||
if (!non_atomic_marking_state()->IsBlackOrGrey(key)) {
|
||||
table.RemoveEntry(i);
|
||||
}
|
||||
|
@ -355,8 +355,7 @@ int MarkingVisitorBase<ConcreteVisitor, MarkingState>::VisitEphemeronHashTable(
|
||||
ObjectSlot value_slot =
|
||||
table.RawFieldOfElementAt(EphemeronHashTable::EntryToValueIndex(i));
|
||||
|
||||
if ((!is_shared_heap_ && key.InSharedHeap()) ||
|
||||
concrete_visitor()->marking_state()->IsBlackOrGrey(key)) {
|
||||
if (concrete_visitor()->marking_state()->IsBlackOrGrey(key)) {
|
||||
VisitPointer(table, value_slot);
|
||||
} else {
|
||||
Object value_obj = table.ValueAt(i);
|
||||
@ -367,8 +366,6 @@ int MarkingVisitorBase<ConcreteVisitor, MarkingState>::VisitEphemeronHashTable(
|
||||
concrete_visitor()->RecordSlot(table, value_slot, value);
|
||||
AddWeakReferenceForReferenceSummarizer(table, value);
|
||||
|
||||
if (!is_shared_heap_ && value.InSharedHeap()) continue;
|
||||
|
||||
// Revisit ephemerons with both key and value unreachable at end
|
||||
// of concurrent marking cycle.
|
||||
if (concrete_visitor()->marking_state()->IsWhite(value)) {
|
||||
|
@ -1,23 +0,0 @@
|
||||
// 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)));
|
Loading…
Reference in New Issue
Block a user