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

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

Issue 22297008: Expose classes, codes, functions, and libraries collections. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 4 months 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | runtime/vm/service.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 #include "platform/assert.h" 5 #include "platform/assert.h"
6 #include "vm/dart_api_state.h" 6 #include "vm/dart_api_state.h"
7 #include "vm/object_id_ring.h" 7 #include "vm/object_id_ring.h"
8 8
9 namespace dart { 9 namespace dart {
10 10
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 bottom = serial_num_ - capacity_; 122 bottom = serial_num_ - capacity_;
123 } 123 }
124 return id >= bottom; 124 return id >= bottom;
125 } 125 }
126 126
127 127
128 bool ObjectIdRing::IsValidId(int32_t id) { 128 bool ObjectIdRing::IsValidId(int32_t id) {
129 if (id == kInvalidId) { 129 if (id == kInvalidId) {
130 return false; 130 return false;
131 } 131 }
132 if (id < 0) {
133 return false;
134 }
132 if (id >= max_serial_) { 135 if (id >= max_serial_) {
133 return false; 136 return false;
134 } 137 }
135 ASSERT((id >= 0) && (id < max_serial_)); 138 ASSERT((id >= 0) && (id < max_serial_));
136 if (wrapped_) { 139 if (wrapped_) {
137 // Serial number has wrapped around to 0. 140 // Serial number has wrapped around to 0.
138 if (serial_num_ >= capacity_) { 141 if (serial_num_ >= capacity_) {
139 // Serial number is larger than capacity, the serial 142 // Serial number is larger than capacity, the serial
140 // numbers are contiguous again. 143 // numbers are contiguous again.
141 wrapped_ = false; 144 wrapped_ = false;
(...skipping 13 matching lines...) Expand all
155 const int32_t max_serial_num = max_serial_; 158 const int32_t max_serial_num = max_serial_;
156 const int32_t bottom = max_serial_num - (capacity_ - serial_num_); 159 const int32_t bottom = max_serial_num - (capacity_ - serial_num_);
157 return id >= bottom && bottom < max_serial_num; 160 return id >= bottom && bottom < max_serial_num;
158 } 161 }
159 } 162 }
160 ASSERT(wrapped_ == false); 163 ASSERT(wrapped_ == false);
161 return IsValidContiguous(id); 164 return IsValidContiguous(id);
162 } 165 }
163 166
164 } // namespace dart 167 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698