Index: runtime/vm/class_table.cc |
diff --git a/runtime/vm/class_table.cc b/runtime/vm/class_table.cc |
index 9432a1beeeca0f7e8c84c3fc73ea41bd68379715..b7f894c158b001ce3870a43bb17f480cd59354bd 100644 |
--- a/runtime/vm/class_table.cc |
+++ b/runtime/vm/class_table.cc |
@@ -143,10 +143,7 @@ void ClassTable::Register(const Class& cls) { |
} |
-void ClassTable::RegisterAt(intptr_t index, const Class& cls) { |
- ASSERT(Thread::Current()->IsMutatorThread()); |
- ASSERT(index != kIllegalCid); |
- ASSERT(index >= kNumPredefinedCids); |
+void ClassTable::AllocateIndex(intptr_t index) { |
if (index >= capacity_) { |
// Grow the capacity of the class table. |
// TODO(koda): Add ClassTable::Grow to share code. |
@@ -171,15 +168,24 @@ void ClassTable::RegisterAt(intptr_t index, const Class& cls) { |
class_heap_stats_table_ = new_stats_table; |
ASSERT(capacity_increment_ >= 1); |
} |
+ |
ASSERT(table_[index] == 0); |
- cls.set_id(index); |
- table_[index] = cls.raw(); |
if (index >= top_) { |
top_ = index + 1; |
} |
} |
+void ClassTable::RegisterAt(intptr_t index, const Class& cls) { |
+ ASSERT(Thread::Current()->IsMutatorThread()); |
+ ASSERT(index != kIllegalCid); |
+ ASSERT(index >= kNumPredefinedCids); |
+ AllocateIndex(index); |
+ cls.set_id(index); |
+ table_[index] = cls.raw(); |
+} |
+ |
+ |
#if defined(DEBUG) |
void ClassTable::Unregister(intptr_t index) { |
table_[index] = 0; |