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

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

Issue 2142013002: Fix language/enum* hot reload failures (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 5 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 | no next file » | 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/isolate_reload.h" 7 #include "vm/isolate_reload.h"
8 #include "vm/log.h" 8 #include "vm/log.h"
9 #include "vm/resolver.h" 9 #include "vm/resolver.h"
10 #include "vm/symbols.h" 10 #include "vm/symbols.h"
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 // Grab '_enum_names' from |old_enum|. 213 // Grab '_enum_names' from |old_enum|.
214 const Field& old_enum_names_field = Field::Handle( 214 const Field& old_enum_names_field = Field::Handle(
215 old_enum.LookupStaticFieldAllowPrivate(Symbols::_EnumNames())); 215 old_enum.LookupStaticFieldAllowPrivate(Symbols::_EnumNames()));
216 ASSERT(!old_enum_names_field.IsNull()); 216 ASSERT(!old_enum_names_field.IsNull());
217 const Array& old_enum_names = 217 const Array& old_enum_names =
218 Array::Handle(Array::RawCast(old_enum_names_field.StaticValue())); 218 Array::Handle(Array::RawCast(old_enum_names_field.StaticValue()));
219 ASSERT(!old_enum_names.IsNull()); 219 ASSERT(!old_enum_names.IsNull());
220 220
221 // Grab 'values' from |old_enum|. 221 // Grab 'values' from |old_enum|.
222 const Field& old_enum_values_field = Field::Handle( 222 const Field& old_enum_values_field = Field::Handle(
223 old_enum.LookupStaticField(Symbols::Values())); 223 old_enum.LookupStaticFieldAllowPrivate(Symbols::Values()));
224 ASSERT(!old_enum_values_field.IsNull()); 224 ASSERT(!old_enum_values_field.IsNull());
225 const Array& old_enum_values = 225 const Array& old_enum_values =
226 Array::Handle(Array::RawCast(old_enum_values_field.StaticValue())); 226 Array::Handle(Array::RawCast(old_enum_values_field.StaticValue()));
227 ASSERT(!old_enum_values.IsNull()); 227 ASSERT(!old_enum_values.IsNull());
228 228
229 // Grab _enum_names from |this|. 229 // Grab _enum_names from |this|.
230 const Field& enum_names_field = Field::Handle( 230 const Field& enum_names_field = Field::Handle(
231 LookupStaticFieldAllowPrivate(Symbols::_EnumNames())); 231 LookupStaticFieldAllowPrivate(Symbols::_EnumNames()));
232 ASSERT(!enum_names_field.IsNull()); 232 ASSERT(!enum_names_field.IsNull());
233 Array& enum_names = 233 Array& enum_names =
234 Array::Handle(Array::RawCast(enum_names_field.StaticValue())); 234 Array::Handle(Array::RawCast(enum_names_field.StaticValue()));
235 ASSERT(!enum_names.IsNull()); 235 ASSERT(!enum_names.IsNull());
236 236
237 // Grab values from |this|. 237 // Grab values from |this|.
238 const Field& enum_values_field = Field::Handle( 238 const Field& enum_values_field = Field::Handle(
239 LookupStaticField(Symbols::Values())); 239 LookupStaticFieldAllowPrivate(Symbols::Values()));
240 ASSERT(!enum_values_field.IsNull()); 240 ASSERT(!enum_values_field.IsNull());
241 Array& enum_values = 241 Array& enum_values =
242 Array::Handle(Array::RawCast(enum_values_field.StaticValue())); 242 Array::Handle(Array::RawCast(enum_values_field.StaticValue()));
243 ASSERT(!enum_values.IsNull()); 243 ASSERT(!enum_values.IsNull());
244 244
245 // Grab the |index| field. 245 // Grab the |index| field.
246 const Field& index_field = 246 const Field& index_field =
247 Field::Handle(old_enum.LookupInstanceField(Symbols::Index())); 247 Field::Handle(old_enum.LookupInstanceField(Symbols::Index()));
248 ASSERT(!index_field.IsNull()); 248 ASSERT(!index_field.IsNull());
249 249
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 enum_value = old_enum_values.At(i); 283 enum_value = old_enum_values.At(i);
284 // Update index to the be new index. 284 // Update index to the be new index.
285 UpdateEnumIndex(Instance::Cast(enum_value), 285 UpdateEnumIndex(Instance::Cast(enum_value),
286 index_field, 286 index_field,
287 index_in_new_cls); 287 index_in_new_cls);
288 // Chop off the 'EnumClass.' 288 // Chop off the 'EnumClass.'
289 enum_field_name = String::SubString(enum_name, 289 enum_field_name = String::SubString(enum_name,
290 enum_class_name.Length() + 1); 290 enum_class_name.Length() + 1);
291 ASSERT(!enum_field_name.IsNull()); 291 ASSERT(!enum_field_name.IsNull());
292 // Grab the static field. 292 // Grab the static field.
293 enum_field = LookupStaticField(enum_field_name); 293 enum_field = LookupStaticFieldAllowPrivate(enum_field_name);
294 ASSERT(!enum_field.IsNull()); 294 ASSERT(!enum_field.IsNull());
295 // Use old value with updated index. 295 // Use old value with updated index.
296 enum_field.SetStaticValue(Instance::Cast(enum_value), true); 296 enum_field.SetStaticValue(Instance::Cast(enum_value), true);
297 enum_values.SetAt(index_in_new_cls, enum_value); 297 enum_values.SetAt(index_in_new_cls, enum_value);
298 enum_names.SetAt(index_in_new_cls, enum_name); 298 enum_names.SetAt(index_in_new_cls, enum_name);
299 } 299 }
300 } 300 }
301 301
302 if (to_add.Length() == 0) { 302 if (to_add.Length() == 0) {
303 // Nothing to do. 303 // Nothing to do.
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
560 } 560 }
561 ClearAndSetStaticTarget(new_target); 561 ClearAndSetStaticTarget(new_target);
562 } else { 562 } else {
563 ClearWithSentinel(); 563 ClearWithSentinel();
564 } 564 }
565 } 565 }
566 566
567 #endif // !PRODUCT 567 #endif // !PRODUCT
568 568
569 } // namespace dart. 569 } // namespace dart.
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698