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

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

Issue 1965823002: Initial isolate reload support (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 7 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
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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_CLASS_TABLE_H_ 5 #ifndef VM_CLASS_TABLE_H_
6 #define VM_CLASS_TABLE_H_ 6 #define VM_CLASS_TABLE_H_
7 7
8 #include "platform/assert.h" 8 #include "platform/assert.h"
9 #include "vm/bitfield.h" 9 #include "vm/bitfield.h"
10 #include "vm/globals.h" 10 #include "vm/globals.h"
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 // access, without support for stats data. 149 // access, without support for stats data.
150 explicit ClassTable(ClassTable* original); 150 explicit ClassTable(ClassTable* original);
151 ~ClassTable(); 151 ~ClassTable();
152 152
153 // Thread-safe. 153 // Thread-safe.
154 RawClass* At(intptr_t index) const { 154 RawClass* At(intptr_t index) const {
155 ASSERT(IsValidIndex(index)); 155 ASSERT(IsValidIndex(index));
156 return table_[index]; 156 return table_[index];
157 } 157 }
158 158
159 void SetAt(intptr_t index, RawClass* raw_cls) {
160 table_[index] = raw_cls;
161 }
162
159 bool IsValidIndex(intptr_t index) const { 163 bool IsValidIndex(intptr_t index) const {
160 return (index > 0) && (index < top_); 164 return (index > 0) && (index < top_);
161 } 165 }
162 166
163 bool HasValidClassAt(intptr_t index) const { 167 bool HasValidClassAt(intptr_t index) const {
164 ASSERT(IsValidIndex(index)); 168 ASSERT(IsValidIndex(index));
165 return table_[index] != NULL; 169 return table_[index] != NULL;
166 } 170 }
167 171
168 intptr_t NumCids() const { return top_; } 172 intptr_t NumCids() const { return top_; }
169 173
174 // Used to drop recently added classes.
175 void SetNumCids(intptr_t num_cids) {
176 ASSERT(num_cids <= top_);
177 top_ = num_cids;
178 }
179
170 void Register(const Class& cls); 180 void Register(const Class& cls);
171 181
172 void RegisterAt(intptr_t index, const Class& cls); 182 void RegisterAt(intptr_t index, const Class& cls);
173 183
174 #if defined(DEBUG) 184 #if defined(DEBUG)
175 void Unregister(intptr_t index); 185 void Unregister(intptr_t index);
176 #endif 186 #endif
177 187
178 void VisitObjectPointers(ObjectPointerVisitor* visitor); 188 void VisitObjectPointers(ObjectPointerVisitor* visitor);
179 189
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 ClassHeapStats* PreliminaryStatsAt(intptr_t cid); 260 ClassHeapStats* PreliminaryStatsAt(intptr_t cid);
251 void UpdateLiveOld(intptr_t cid, intptr_t size, intptr_t count = 1); 261 void UpdateLiveOld(intptr_t cid, intptr_t size, intptr_t count = 1);
252 void UpdateLiveNew(intptr_t cid, intptr_t size); 262 void UpdateLiveNew(intptr_t cid, intptr_t size);
253 263
254 DISALLOW_COPY_AND_ASSIGN(ClassTable); 264 DISALLOW_COPY_AND_ASSIGN(ClassTable);
255 }; 265 };
256 266
257 } // namespace dart 267 } // namespace dart
258 268
259 #endif // VM_CLASS_TABLE_H_ 269 #endif // VM_CLASS_TABLE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698