[heap] Preserve the weakness tag in short-circuiting cases of Scavenger
Bug: chromium:852420 Change-Id: Idc8104e0617a22586aa5d3bf1bf2618caaacacc1 Reviewed-on: https://chromium-review.googlesource.com/c/1430060 Reviewed-by: Michael Lippautz <mlippautz@chromium.org> Commit-Queue: Ulan Degenbaev <ulan@chromium.org> Cr-Commit-Position: refs/heads/master@{#59031}
This commit is contained in:
parent
cba3a50a4b
commit
be11971d25
@ -306,7 +306,7 @@ SlotCallbackResult Scavenger::EvacuateThinString(Map map, THeapObjectSlot slot,
|
|||||||
// ThinStrings always refer to internalized strings, which are always in old
|
// ThinStrings always refer to internalized strings, which are always in old
|
||||||
// space.
|
// space.
|
||||||
DCHECK(!Heap::InNewSpace(actual));
|
DCHECK(!Heap::InNewSpace(actual));
|
||||||
slot.StoreHeapObject(actual);
|
HeapObjectReference::Update(slot, actual);
|
||||||
return REMOVE_SLOT;
|
return REMOVE_SLOT;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -326,7 +326,7 @@ SlotCallbackResult Scavenger::EvacuateShortcutCandidate(Map map,
|
|||||||
object->unchecked_second() == ReadOnlyRoots(heap()).empty_string()) {
|
object->unchecked_second() == ReadOnlyRoots(heap()).empty_string()) {
|
||||||
HeapObject first = HeapObject::cast(object->unchecked_first());
|
HeapObject first = HeapObject::cast(object->unchecked_first());
|
||||||
|
|
||||||
slot.StoreHeapObject(first);
|
HeapObjectReference::Update(slot, first);
|
||||||
|
|
||||||
if (!Heap::InNewSpace(first)) {
|
if (!Heap::InNewSpace(first)) {
|
||||||
object->map_slot().Release_Store(
|
object->map_slot().Release_Store(
|
||||||
@ -338,7 +338,7 @@ SlotCallbackResult Scavenger::EvacuateShortcutCandidate(Map map,
|
|||||||
if (first_word.IsForwardingAddress()) {
|
if (first_word.IsForwardingAddress()) {
|
||||||
HeapObject target = first_word.ToForwardingAddress();
|
HeapObject target = first_word.ToForwardingAddress();
|
||||||
|
|
||||||
slot.StoreHeapObject(target);
|
HeapObjectReference::Update(slot, target);
|
||||||
object->map_slot().Release_Store(
|
object->map_slot().Release_Store(
|
||||||
MapWord::FromForwardingAddress(target).ToMap());
|
MapWord::FromForwardingAddress(target).ToMap());
|
||||||
return Heap::InToSpace(target) ? KEEP_SLOT : REMOVE_SLOT;
|
return Heap::InToSpace(target) ? KEEP_SLOT : REMOVE_SLOT;
|
||||||
@ -396,13 +396,7 @@ SlotCallbackResult Scavenger::ScavengeObject(THeapObjectSlot p,
|
|||||||
// copied.
|
// copied.
|
||||||
if (first_word.IsForwardingAddress()) {
|
if (first_word.IsForwardingAddress()) {
|
||||||
HeapObject dest = first_word.ToForwardingAddress();
|
HeapObject dest = first_word.ToForwardingAddress();
|
||||||
DCHECK(Heap::InFromSpace(*p));
|
HeapObjectReference::Update(p, dest);
|
||||||
if ((*p)->IsWeak()) {
|
|
||||||
p.store(HeapObjectReference::Weak(dest));
|
|
||||||
} else {
|
|
||||||
DCHECK((*p)->IsStrong());
|
|
||||||
p.store(HeapObjectReference::Strong(dest));
|
|
||||||
}
|
|
||||||
DCHECK_IMPLIES(Heap::InNewSpace(dest),
|
DCHECK_IMPLIES(Heap::InNewSpace(dest),
|
||||||
(Heap::InToSpace(dest) ||
|
(Heap::InToSpace(dest) ||
|
||||||
MemoryChunk::FromHeapObject(dest)->owner()->identity() ==
|
MemoryChunk::FromHeapObject(dest)->owner()->identity() ==
|
||||||
|
Loading…
Reference in New Issue
Block a user