| 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 #include "platform/assert.h" | 5 #include "platform/assert.h" |
| 6 #include "vm/globals.h" | 6 #include "vm/globals.h" |
| 7 #include "vm/object_id_ring.h" | 7 #include "vm/object_id_ring.h" |
| 8 #include "vm/unit_test.h" | 8 #include "vm/unit_test.h" |
| 9 #include "vm/dart_api_impl.h" | 9 #include "vm/dart_api_impl.h" |
| 10 #include "vm/dart_api_state.h" | 10 #include "vm/dart_api_state.h" |
| 11 | 11 |
| 12 namespace dart { | 12 namespace dart { |
| 13 | 13 |
| 14 #ifndef PRODUCT |
| 14 | 15 |
| 15 class ObjectIdRingTestHelper { | 16 class ObjectIdRingTestHelper { |
| 16 public: | 17 public: |
| 17 static void SetCapacityAndMaxSerial(ObjectIdRing* ring, int32_t capacity, | 18 static void SetCapacityAndMaxSerial(ObjectIdRing* ring, int32_t capacity, |
| 18 int32_t max_serial) { | 19 int32_t max_serial) { |
| 19 ring->SetCapacityAndMaxSerial(capacity, max_serial); | 20 ring->SetCapacityAndMaxSerial(capacity, max_serial); |
| 20 } | 21 } |
| 21 | 22 |
| 22 static void ExpectIdIsValid(ObjectIdRing* ring, intptr_t id) { | 23 static void ExpectIdIsValid(ObjectIdRing* ring, intptr_t id) { |
| 23 EXPECT(ring->IsValidId(id)); | 24 EXPECT(ring->IsValidId(id)); |
| (...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 267 EXPECT_EQ(new_obj.raw(), new_obj_lookup); | 268 EXPECT_EQ(new_obj.raw(), new_obj_lookup); |
| 268 } | 269 } |
| 269 | 270 |
| 270 // Check our first entry reports it has expired. | 271 // Check our first entry reports it has expired. |
| 271 obj_lookup = ring->GetObjectForId(obj_id, &kind); | 272 obj_lookup = ring->GetObjectForId(obj_id, &kind); |
| 272 EXPECT_EQ(ObjectIdRing::kExpired, kind); | 273 EXPECT_EQ(ObjectIdRing::kExpired, kind); |
| 273 EXPECT_NE(obj.raw(), obj_lookup); | 274 EXPECT_NE(obj.raw(), obj_lookup); |
| 274 EXPECT_EQ(Object::null(), obj_lookup); | 275 EXPECT_EQ(Object::null(), obj_lookup); |
| 275 } | 276 } |
| 276 | 277 |
| 278 #endif // !PRODUCT |
| 279 |
| 277 } // namespace dart | 280 } // namespace dart |
| OLD | NEW |