Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(576)

Side by Side Diff: runtime/vm/object_id_ring.h

Issue 2481873005: clang-format runtime/vm (Closed)
Patch Set: Merge Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « runtime/vm/object_graph_test.cc ('k') | runtime/vm/object_id_ring_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 RUNTIME_VM_OBJECT_ID_RING_H_ 5 #ifndef RUNTIME_VM_OBJECT_ID_RING_H_
6 #define RUNTIME_VM_OBJECT_ID_RING_H_ 6 #define RUNTIME_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
21 class ObjectIdRing { 21 class ObjectIdRing {
22 public: 22 public:
23 enum LookupResult { 23 enum LookupResult {
24 kValid = 0, 24 kValid = 0,
25 kInvalid, // Malformed ring id (used in service.cc). 25 kInvalid, // Malformed ring id (used in service.cc).
26 kCollected, // Entry was reclaimed due to a full GC (entries are weak). 26 kCollected, // Entry was reclaimed due to a full GC (entries are weak).
27 kExpired, // Entry was evicted during an insertion into a full ring. 27 kExpired, // Entry was evicted during an insertion into a full ring.
28 }; 28 };
29 29
30 enum IdPolicy { 30 enum IdPolicy {
31 kAllocateId, // Always allocate a new object id. 31 kAllocateId, // Always allocate a new object id.
32 kReuseId, // If the object is already in the ring, reuse id. 32 kReuseId, // If the object is already in the ring, reuse id.
33 // Otherwise allocate a new object id. 33 // Otherwise allocate a new object id.
34 kNumIdPolicy, 34 kNumIdPolicy,
35 }; 35 };
36 36
37 static const int32_t kMaxId = 0x3FFFFFFF; 37 static const int32_t kMaxId = 0x3FFFFFFF;
38 static const int32_t kInvalidId = -1; 38 static const int32_t kInvalidId = -1;
39 static const int32_t kDefaultCapacity = 8192; 39 static const int32_t kDefaultCapacity = 8192;
40 40
41 static void Init(Isolate* isolate, int32_t capacity = kDefaultCapacity); 41 static void Init(Isolate* isolate, int32_t capacity = kDefaultCapacity);
42 42
43 ~ObjectIdRing(); 43 ~ObjectIdRing();
(...skipping 16 matching lines...) Expand all
60 int32_t FindExistingIdForObject(RawObject* raw_obj); 60 int32_t FindExistingIdForObject(RawObject* raw_obj);
61 61
62 ObjectIdRing(Isolate* isolate, int32_t capacity); 62 ObjectIdRing(Isolate* isolate, int32_t capacity);
63 Isolate* isolate_; 63 Isolate* isolate_;
64 RawObject** table_; 64 RawObject** table_;
65 int32_t max_serial_; 65 int32_t max_serial_;
66 int32_t capacity_; 66 int32_t capacity_;
67 int32_t serial_num_; 67 int32_t serial_num_;
68 bool wrapped_; 68 bool wrapped_;
69 69
70 RawObject** table() { 70 RawObject** table() { return table_; }
71 return table_; 71 int32_t table_size() { return capacity_; }
72 }
73 int32_t table_size() {
74 return capacity_;
75 }
76 72
77 int32_t NextSerial(); 73 int32_t NextSerial();
78 int32_t AllocateNewId(RawObject* object); 74 int32_t AllocateNewId(RawObject* object);
79 int32_t IndexOfId(int32_t id); 75 int32_t IndexOfId(int32_t id);
80 int32_t IdOfIndex(int32_t index); 76 int32_t IdOfIndex(int32_t index);
81 bool IsValidContiguous(int32_t id); 77 bool IsValidContiguous(int32_t id);
82 bool IsValidId(int32_t id); 78 bool IsValidId(int32_t id);
83 79
84 DISALLOW_COPY_AND_ASSIGN(ObjectIdRing); 80 DISALLOW_COPY_AND_ASSIGN(ObjectIdRing);
85 }; 81 };
86 82
87 } // namespace dart 83 } // namespace dart
88 84
89 #endif // RUNTIME_VM_OBJECT_ID_RING_H_ 85 #endif // RUNTIME_VM_OBJECT_ID_RING_H_
OLDNEW
« no previous file with comments | « runtime/vm/object_graph_test.cc ('k') | runtime/vm/object_id_ring_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698