Chromium Code Reviews| Index: runtime/vm/isolate_reload.cc |
| diff --git a/runtime/vm/isolate_reload.cc b/runtime/vm/isolate_reload.cc |
| index 4370ab183970ca74b93c649e8a0f3d2361cca742..2e8ea6bd0ef38c0ad8b0243672ccf94589f18fc4 100644 |
| --- a/runtime/vm/isolate_reload.cc |
| +++ b/runtime/vm/isolate_reload.cc |
| @@ -1156,21 +1156,8 @@ void IsolateReloadContext::Commit() { |
| } |
| } |
| - // Rehash constants map for all new classes and the closure class. |
| - Class& cls = Class::Handle(zone_); |
| - cls = I->class_table()->At(kClosureCid); |
| - cls.RehashConstants(zone_); |
| - { |
| - ASSERT(class_map_storage_ != Array::null()); |
| - UnorderedHashMap<ClassMapTraits> map(class_map_storage_); |
| - UnorderedHashMap<ClassMapTraits>::Iterator it(&map); |
| - while (it.MoveNext()) { |
| - const intptr_t entry = it.Current(); |
| - cls = Class::RawCast(map.GetKey(entry)); |
| - cls.RehashConstants(zone_); |
| - } |
| - map.Release(); |
| - } |
| + // Rehash constants map for all classes. |
| + RehashConstants(); |
| #ifdef DEBUG |
| // Verify that all canonical instances are correctly setup in the |
| @@ -1183,6 +1170,27 @@ void IsolateReloadContext::Commit() { |
| } |
| +void IsolateReloadContext::RehashConstants() { |
| + ClassTable* class_table = I->class_table(); |
| + Class& cls = Class::Handle(zone_); |
| + const intptr_t top = class_table->NumCids(); |
| + for (intptr_t cid = kInstanceCid; cid < top; cid++) { |
|
siva
2016/11/15 22:58:22
Should this be (kNumPredefinedCids + 1)
rmacnak
2016/11/15 23:13:33
No, we still need to rehash array, growable array,
|
| + if (!class_table->IsValidIndex(cid) || !class_table->HasValidClassAt(cid)) { |
|
siva
2016/11/15 22:58:22
IsValidIndex(cid) is implicit right with the check
|
| + // Skip invalid classes. |
| + continue; |
| + } |
| + if (RawObject::IsNumberClassId(cid) || RawObject::IsStringClassId(cid)) { |
| + // Skip classes that cannot be affected by the 'become' operation. |
| + continue; |
| + } |
|
siva
2016/11/15 22:58:22
By running from kNumPredefinedCids this check for
|
| + // Rehash constants. |
| + cls = class_table->At(cid); |
| + VTIR_Print("Rehashing constants in class `%s`\n", cls.ToCString()); |
| + cls.RehashConstants(zone_); |
| + } |
| +} |
| + |
| + |
| bool IsolateReloadContext::IsDirty(const Library& lib) { |
| const intptr_t index = lib.index(); |
| if (index == static_cast<classid_t>(-1)) { |