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

Side by Side Diff: runtime/vm/object_reload.cc

Issue 2651813006: Set correct type for enum values list (fixes #28341). (Closed)
Patch Set: work in progress Created 3 years, 11 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
« no previous file with comments | « no previous file | runtime/vm/parser.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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/object.h" 5 #include "vm/object.h"
6 6
7 #include "vm/hash_table.h" 7 #include "vm/hash_table.h"
8 #include "vm/isolate_reload.h" 8 #include "vm/isolate_reload.h"
9 #include "vm/log.h" 9 #include "vm/log.h"
10 #include "vm/resolver.h" 10 #include "vm/resolver.h"
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 // Given an old enum class, add become mappings from old values to new values. 194 // Given an old enum class, add become mappings from old values to new values.
195 // Some notes about how we reload enums below: 195 // Some notes about how we reload enums below:
196 // 196 //
197 // When an enum is reloaded the following three things can happen, possibly 197 // When an enum is reloaded the following three things can happen, possibly
198 // simultaneously. 198 // simultaneously.
199 // 199 //
200 // 1) A new enum value is added. 200 // 1) A new enum value is added.
201 // This case is handled automatically. 201 // This case is handled automatically.
202 // 2) Enum values are reordered. 202 // 2) Enum values are reordered.
203 // We pair old and new enums and the old enums 'become' the new ones so 203 // We pair old and new enums and the old enums 'become' the new ones so
204 // the ordering is always correct (i.e. enum indicies match slots in values 204 // the ordering is always correct (i.e. enum indices match slots in values
205 // array) 205 // array)
206 // 3) An existing enum value is removed. 206 // 3) An existing enum value is removed.
207 // Each enum class has a canonical 'deleted' enum sentinel instance. 207 // Each enum class has a canonical 'deleted' enum sentinel instance.
208 // When an enum value is deleted, we 'become' all references to the 'deleted' 208 // When an enum value is deleted, we 'become' all references to the 'deleted'
209 // sentinel value. The index value is -1. 209 // sentinel value. The index value is -1.
210 // 210 //
211 void Class::ReplaceEnum(const Class& old_enum) const { 211 void Class::ReplaceEnum(const Class& old_enum) const {
212 // We only do this for finalized enum classes. 212 // We only do this for finalized enum classes.
213 ASSERT(is_enum_class()); 213 ASSERT(is_enum_class());
214 ASSERT(old_enum.is_enum_class()); 214 ASSERT(old_enum.is_enum_class());
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 ASSERT(!enum_values.IsNull()); 319 ASSERT(!enum_values.IsNull());
320 reload_context->AddEnumBecomeMapping(old_enum_values, enum_values); 320 reload_context->AddEnumBecomeMapping(old_enum_values, enum_values);
321 321
322 // Map the old E._deleted_enum_sentinel to the new E._deleted_enum_sentinel. 322 // Map the old E._deleted_enum_sentinel to the new E._deleted_enum_sentinel.
323 ASSERT(!old_deleted_enum_sentinel.IsNull()); 323 ASSERT(!old_deleted_enum_sentinel.IsNull());
324 ASSERT(!deleted_enum_sentinel.IsNull()); 324 ASSERT(!deleted_enum_sentinel.IsNull());
325 reload_context->AddEnumBecomeMapping(old_deleted_enum_sentinel, 325 reload_context->AddEnumBecomeMapping(old_deleted_enum_sentinel,
326 deleted_enum_sentinel); 326 deleted_enum_sentinel);
327 327
328 if (enums_deleted) { 328 if (enums_deleted) {
329 // Map all deleted enums to the deleted enum senintel value. 329 // Map all deleted enums to the deleted enum sentinel value.
330 // TODO(johnmccutchan): Add this to the reload 'notices' list. 330 // TODO(johnmccutchan): Add this to the reload 'notices' list.
331 VTIR_Print( 331 VTIR_Print(
332 "The following enum values were deleted from %s and will become the " 332 "The following enum values were deleted from %s and will become the "
333 "deleted enum sentinel:\n", 333 "deleted enum sentinel:\n",
334 old_enum.ToCString()); 334 old_enum.ToCString());
335 UnorderedHashMap<EnumMapTraits> enum_map(enum_map_storage.raw()); 335 UnorderedHashMap<EnumMapTraits> enum_map(enum_map_storage.raw());
336 UnorderedHashMap<EnumMapTraits>::Iterator it(&enum_map); 336 UnorderedHashMap<EnumMapTraits>::Iterator it(&enum_map);
337 while (it.MoveNext()) { 337 while (it.MoveNext()) {
338 const intptr_t entry = it.Current(); 338 const intptr_t entry = it.Current();
339 enum_ident = String::RawCast(enum_map.GetKey(entry)); 339 enum_ident = String::RawCast(enum_map.GetKey(entry));
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after
763 const Array& data_array = 763 const Array& data_array =
764 Array::Handle(zone, CachedEmptyICDataArray(num_args)); 764 Array::Handle(zone, CachedEmptyICDataArray(num_args));
765 set_ic_data_array(data_array); 765 set_ic_data_array(data_array);
766 } 766 }
767 } 767 }
768 } 768 }
769 769
770 #endif // !PRODUCT 770 #endif // !PRODUCT
771 771
772 } // namespace dart. 772 } // namespace dart.
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698