| 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 #include "vm/flags.h" | 6 #include "vm/flags.h" |
| 7 #include "vm/freelist.h" | 7 #include "vm/freelist.h" |
| 8 #include "vm/growable_array.h" | 8 #include "vm/growable_array.h" |
| 9 #include "vm/heap.h" | 9 #include "vm/heap.h" |
| 10 #include "vm/object.h" | 10 #include "vm/object.h" |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 top_); | 137 top_); |
| 138 } | 138 } |
| 139 cls.set_id(top_); | 139 cls.set_id(top_); |
| 140 table_[top_] = cls.raw(); | 140 table_[top_] = cls.raw(); |
| 141 top_++; // Increment next index. | 141 top_++; // Increment next index. |
| 142 } | 142 } |
| 143 } | 143 } |
| 144 | 144 |
| 145 | 145 |
| 146 void ClassTable::RegisterAt(intptr_t index, const Class& cls) { | 146 void ClassTable::RegisterAt(intptr_t index, const Class& cls) { |
| 147 ASSERT(Thread::Current()->IsMutatorThread()); |
| 147 ASSERT(index != kIllegalCid); | 148 ASSERT(index != kIllegalCid); |
| 148 ASSERT(index >= kNumPredefinedCids); | 149 ASSERT(index >= kNumPredefinedCids); |
| 149 if (index >= capacity_) { | 150 if (index >= capacity_) { |
| 150 // Grow the capacity of the class table. | 151 // Grow the capacity of the class table. |
| 151 // TODO(koda): Add ClassTable::Grow to share code. | 152 // TODO(koda): Add ClassTable::Grow to share code. |
| 152 intptr_t new_capacity = index + capacity_increment_; | 153 intptr_t new_capacity = index + capacity_increment_; |
| 153 if (!Class::is_valid_id(index) || new_capacity < capacity_) { | 154 if (!Class::is_valid_id(index) || new_capacity < capacity_) { |
| 154 FATAL1("Fatal error in ClassTable::Register: invalid index %" Pd "\n", | 155 FATAL1("Fatal error in ClassTable::Register: invalid index %" Pd "\n", |
| 155 index); | 156 index); |
| 156 } | 157 } |
| (...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 541 | 542 |
| 542 void ClassTable::UpdateLiveNew(intptr_t cid, intptr_t size) { | 543 void ClassTable::UpdateLiveNew(intptr_t cid, intptr_t size) { |
| 543 ClassHeapStats* stats = PreliminaryStatsAt(cid); | 544 ClassHeapStats* stats = PreliminaryStatsAt(cid); |
| 544 ASSERT(stats != NULL); | 545 ASSERT(stats != NULL); |
| 545 ASSERT(size >= 0); | 546 ASSERT(size >= 0); |
| 546 stats->post_gc.AddNew(size); | 547 stats->post_gc.AddNew(size); |
| 547 } | 548 } |
| 548 | 549 |
| 549 | 550 |
| 550 } // namespace dart | 551 } // namespace dart |
| OLD | NEW |