OLD | NEW |
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 #include "vm/class_table.h" | 5 #include "vm/class_table.h" |
6 | 6 |
7 #include "vm/atomic.h" | 7 #include "vm/atomic.h" |
8 #include "vm/flags.h" | 8 #include "vm/flags.h" |
9 #include "vm/freelist.h" | 9 #include "vm/freelist.h" |
10 #include "vm/growable_array.h" | 10 #include "vm/growable_array.h" |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 } | 208 } |
209 | 209 |
210 | 210 |
211 #if defined(DEBUG) | 211 #if defined(DEBUG) |
212 void ClassTable::Unregister(intptr_t index) { | 212 void ClassTable::Unregister(intptr_t index) { |
213 table_[index] = 0; | 213 table_[index] = 0; |
214 } | 214 } |
215 #endif | 215 #endif |
216 | 216 |
217 | 217 |
218 #if defined(DART_PRECOMPILER) | |
219 void ClassTable::Remap(intptr_t* old_to_new_cid) { | 218 void ClassTable::Remap(intptr_t* old_to_new_cid) { |
220 ASSERT(Thread::Current()->no_safepoint_scope_depth() > 0); | 219 ASSERT(Thread::Current()->no_safepoint_scope_depth() > 0); |
221 intptr_t num_cids = NumCids(); | 220 intptr_t num_cids = NumCids(); |
222 RawClass** cls_by_old_cid = new RawClass*[num_cids]; | 221 RawClass** cls_by_old_cid = new RawClass*[num_cids]; |
223 for (intptr_t i = 0; i < num_cids; i++) { | 222 for (intptr_t i = 0; i < num_cids; i++) { |
224 cls_by_old_cid[i] = table_[i]; | 223 cls_by_old_cid[i] = table_[i]; |
225 } | 224 } |
226 for (intptr_t i = 0; i < num_cids; i++) { | 225 for (intptr_t i = 0; i < num_cids; i++) { |
227 table_[old_to_new_cid[i]] = cls_by_old_cid[i]; | 226 table_[old_to_new_cid[i]] = cls_by_old_cid[i]; |
228 } | 227 } |
229 delete[] cls_by_old_cid; | 228 delete[] cls_by_old_cid; |
230 } | 229 } |
231 #endif | |
232 | 230 |
233 | 231 |
234 void ClassTable::VisitObjectPointers(ObjectPointerVisitor* visitor) { | 232 void ClassTable::VisitObjectPointers(ObjectPointerVisitor* visitor) { |
235 ASSERT(visitor != NULL); | 233 ASSERT(visitor != NULL); |
236 visitor->VisitPointers(reinterpret_cast<RawObject**>(&table_[0]), top_); | 234 visitor->VisitPointers(reinterpret_cast<RawObject**>(&table_[0]), top_); |
237 } | 235 } |
238 | 236 |
239 | 237 |
240 void ClassTable::Validate() { | 238 void ClassTable::Validate() { |
241 Class& cls = Class::Handle(); | 239 Class& cls = Class::Handle(); |
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
591 void ClassTable::UpdateLiveNew(intptr_t cid, intptr_t size) { | 589 void ClassTable::UpdateLiveNew(intptr_t cid, intptr_t size) { |
592 ClassHeapStats* stats = PreliminaryStatsAt(cid); | 590 ClassHeapStats* stats = PreliminaryStatsAt(cid); |
593 ASSERT(stats != NULL); | 591 ASSERT(stats != NULL); |
594 ASSERT(size >= 0); | 592 ASSERT(size >= 0); |
595 stats->post_gc.AddNew(size); | 593 stats->post_gc.AddNew(size); |
596 } | 594 } |
597 #endif // !PRODUCT | 595 #endif // !PRODUCT |
598 | 596 |
599 | 597 |
600 } // namespace dart | 598 } // namespace dart |
OLD | NEW |