@@ -3027,7 +3027,7 @@ void MarkCompactCollector::ClearJSWeakRefs() {
30273027 };
30283028 HeapObject target = HeapObject::cast (weak_cell.target ());
30293029 if (!non_atomic_marking_state ()->IsBlackOrGrey (target)) {
3030- DCHECK (! target.IsUndefined ());
3030+ DCHECK (target.CanBeHeldWeakly ());
30313031 // The value of the WeakCell is dead.
30323032 JSFinalizationRegistry finalization_registry =
30333033 JSFinalizationRegistry::cast (weak_cell.finalization_registry ());
@@ -3049,6 +3049,7 @@ void MarkCompactCollector::ClearJSWeakRefs() {
30493049
30503050 HeapObject unregister_token = weak_cell.unregister_token ();
30513051 if (!non_atomic_marking_state ()->IsBlackOrGrey (unregister_token)) {
3052+ DCHECK (unregister_token.CanBeHeldWeakly ());
30523053 // The unregister token is dead. Remove any corresponding entries in the
30533054 // key map. Multiple WeakCell with the same token will have all their
30543055 // unregister_token field set to undefined when processing the first
@@ -3057,7 +3058,7 @@ void MarkCompactCollector::ClearJSWeakRefs() {
30573058 JSFinalizationRegistry finalization_registry =
30583059 JSFinalizationRegistry::cast (weak_cell.finalization_registry ());
30593060 finalization_registry.RemoveUnregisterToken (
3060- JSReceiver::cast ( unregister_token) , isolate (),
3061+ unregister_token, isolate (),
30613062 JSFinalizationRegistry::kKeepMatchedCellsInRegistry ,
30623063 gc_notify_updated_slot);
30633064 } else {
0 commit comments