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

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

Issue 82793004: Add field and function view for libraries. Rough cut. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 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 | Annotate | Revision Log
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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 serial_num_++; 79 serial_num_++;
80 if (serial_num_ >= max_serial_) { 80 if (serial_num_ >= max_serial_) {
81 serial_num_ = 0; 81 serial_num_ = 0;
82 wrapped_ = true; 82 wrapped_ = true;
83 } 83 }
84 return r; 84 return r;
85 } 85 }
86 86
87 87
88 int32_t ObjectIdRing::AllocateNewId(RawObject* raw_obj) { 88 int32_t ObjectIdRing::AllocateNewId(RawObject* raw_obj) {
89 ASSERT(raw_obj->IsHeapObject()); 89 // TODO(turnidge): Fix before submit.
Ivan Posva 2013/11/22 22:38:12 // TODO(turnidge): Do not enter Smis into the Obje
turnidge 2013/11/22 22:49:58 Done.
90 // ASSERT(raw_obj->IsHeapObject());
90 int32_t id = NextSerial(); 91 int32_t id = NextSerial();
91 ASSERT(id != kInvalidId); 92 ASSERT(id != kInvalidId);
92 int32_t cursor = IndexOfId(id); 93 int32_t cursor = IndexOfId(id);
93 ASSERT(cursor != kInvalidId); 94 ASSERT(cursor != kInvalidId);
94 if (table_[cursor] != Object::null()) { 95 if (table_[cursor] != Object::null()) {
95 // Free old handle. 96 // Free old handle.
96 table_[cursor] = Object::null(); 97 table_[cursor] = Object::null();
97 } 98 }
98 ASSERT(table_[cursor] == Object::null()); 99 ASSERT(table_[cursor] == Object::null());
99 table_[cursor] = raw_obj; 100 table_[cursor] = raw_obj;
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 const int32_t max_serial_num = max_serial_; 159 const int32_t max_serial_num = max_serial_;
159 const int32_t bottom = max_serial_num - (capacity_ - serial_num_); 160 const int32_t bottom = max_serial_num - (capacity_ - serial_num_);
160 return id >= bottom && bottom < max_serial_num; 161 return id >= bottom && bottom < max_serial_num;
161 } 162 }
162 } 163 }
163 ASSERT(wrapped_ == false); 164 ASSERT(wrapped_ == false);
164 return IsValidContiguous(id); 165 return IsValidContiguous(id);
165 } 166 }
166 167
167 } // namespace dart 168 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698