Chromium Code Reviews| 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..a3fe46c31b6cf8d477dcfb2890663e6c92fbd3fb 100644 |
| --- a/runtime/vm/object_id_ring.cc |
| +++ b/runtime/vm/object_id_ring.cc |
| @@ -26,18 +26,25 @@ ObjectIdRing::~ObjectIdRing() { |
| int32_t ObjectIdRing::GetIdForObject(RawObject* object) { |
| + // We do not allow inserting null or any of the psuedo-nulls because the are |
| + // used as sentinel values for expired and reclaimed entries. |
| + ASSERT(!object->IsNullOrPseudoNull()); |
|
turnidge
2014/08/27 16:13:56
Technically we could allow null to be inserted now
rmacnak
2014/08/27 18:09:59
No, the regular null is how we know an entry was c
|
| return AllocateNewId(object); |
| } |
| -RawObject* ObjectIdRing::GetObjectForId(int32_t id) { |
| +RawObject* ObjectIdRing::GetObjectForId(int32_t id, LookupResult* kind) { |
| + *kind = kValid; |
| 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 table_[index]; |
| } |