Index: runtime/vm/object_id_ring.cc |
diff --git a/runtime/vm/object_id_ring.cc b/runtime/vm/object_id_ring.cc |
index fd069888cd6b2ea42c99f300b9aaf946180ada88..0b396e83cae8c5a49953dbfd048cb46626e9087d 100644 |
--- a/runtime/vm/object_id_ring.cc |
+++ b/runtime/vm/object_id_ring.cc |
@@ -26,18 +26,26 @@ ObjectIdRing::~ObjectIdRing() { |
int32_t ObjectIdRing::GetIdForObject(RawObject* object) { |
+ // We do not allow inserting null because null is how we detect as entry was |
+ // reclaimed by the GC. |
+ ASSERT(object != Object::null()); |
return AllocateNewId(object); |
} |
-RawObject* ObjectIdRing::GetObjectForId(int32_t id) { |
+RawObject* ObjectIdRing::GetObjectForId(int32_t id, LookupResult* kind) { |
int32_t index = IndexOfId(id); |
if (index == kInvalidId) { |
- // Return sentinel to allow caller to distinguish expired ids. |
- return Object::sentinel().raw(); |
+ *kind = kExpired; |
+ return Object::null(); |
} |
ASSERT(index >= 0); |
ASSERT(index < capacity_); |
+ if (table_[index] == Object::null()) { |
+ *kind = kCollected; |
+ return Object::null(); |
+ } |
+ *kind = kValid; |
return table_[index]; |
} |