| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef VM_OBJECT_ID_RING_H_ | 5 #ifndef VM_OBJECT_ID_RING_H_ |
| 6 #define VM_OBJECT_ID_RING_H_ | 6 #define VM_OBJECT_ID_RING_H_ |
| 7 | 7 |
| 8 namespace dart { | 8 namespace dart { |
| 9 | 9 |
| 10 // Forward declarations. | 10 // Forward declarations. |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 public: | 21 public: |
| 22 static const int32_t kMaxId = 0x3FFFFFFF; | 22 static const int32_t kMaxId = 0x3FFFFFFF; |
| 23 static const int32_t kInvalidId = -1; | 23 static const int32_t kInvalidId = -1; |
| 24 static const int32_t kDefaultCapacity = 1024; | 24 static const int32_t kDefaultCapacity = 1024; |
| 25 | 25 |
| 26 static void Init(Isolate* isolate, int32_t capacity = kDefaultCapacity); | 26 static void Init(Isolate* isolate, int32_t capacity = kDefaultCapacity); |
| 27 | 27 |
| 28 ~ObjectIdRing(); | 28 ~ObjectIdRing(); |
| 29 | 29 |
| 30 int32_t GetIdForObject(RawObject* raw_obj); | 30 int32_t GetIdForObject(RawObject* raw_obj); |
| 31 |
| 32 // Returns Object::sentinel() when the id is not valid. |
| 31 RawObject* GetObjectForId(int32_t id); | 33 RawObject* GetObjectForId(int32_t id); |
| 32 | 34 |
| 33 void VisitPointers(ObjectPointerVisitor* visitor); | 35 void VisitPointers(ObjectPointerVisitor* visitor); |
| 34 | 36 |
| 35 private: | 37 private: |
| 36 friend class ObjectIdRingTestHelper; | 38 friend class ObjectIdRingTestHelper; |
| 37 | 39 |
| 38 void SetCapacityAndMaxSerial(int32_t capacity, int32_t max_serial); | 40 void SetCapacityAndMaxSerial(int32_t capacity, int32_t max_serial); |
| 39 | 41 |
| 40 ObjectIdRing(Isolate* isolate, int32_t capacity); | 42 ObjectIdRing(Isolate* isolate, int32_t capacity); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 57 int32_t IndexOfId(int32_t id); | 59 int32_t IndexOfId(int32_t id); |
| 58 bool IsValidContiguous(int32_t id); | 60 bool IsValidContiguous(int32_t id); |
| 59 bool IsValidId(int32_t id); | 61 bool IsValidId(int32_t id); |
| 60 | 62 |
| 61 DISALLOW_COPY_AND_ASSIGN(ObjectIdRing); | 63 DISALLOW_COPY_AND_ASSIGN(ObjectIdRing); |
| 62 }; | 64 }; |
| 63 | 65 |
| 64 } // namespace dart | 66 } // namespace dart |
| 65 | 67 |
| 66 #endif // VM_OBJECT_ID_RING_H_ | 68 #endif // VM_OBJECT_ID_RING_H_ |
| OLD | NEW |