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

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

Issue 2474193002: During a reload, give const fields their new values. (Closed)
Patch Set: Created 4 years, 1 month 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 | « runtime/vm/isolate_reload_test.cc ('k') | 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/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 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 for (intptr_t i = 0; i < field_list.Length(); i++) { 121 for (intptr_t i = 0; i < field_list.Length(); i++) {
122 field = Field::RawCast(field_list.At(i)); 122 field = Field::RawCast(field_list.At(i));
123 name = field.name(); 123 name = field.name();
124 if (field.is_static()) { 124 if (field.is_static()) {
125 // Find the corresponding old field, if it exists, and migrate 125 // Find the corresponding old field, if it exists, and migrate
126 // over the field value. 126 // over the field value.
127 for (intptr_t j = 0; j < old_field_list.Length(); j++) { 127 for (intptr_t j = 0; j < old_field_list.Length(); j++) {
128 old_field = Field::RawCast(old_field_list.At(j)); 128 old_field = Field::RawCast(old_field_list.At(j));
129 old_name = old_field.name(); 129 old_name = old_field.name();
130 if (name.Equals(old_name)) { 130 if (name.Equals(old_name)) {
131 if (update_values) { 131 // We only copy values if requested and if the field is not a const
132 // field. We let const fields be updated with a reload.
133 if (update_values && !field.is_const()) {
132 value = old_field.StaticValue(); 134 value = old_field.StaticValue();
133 field.SetStaticValue(value); 135 field.SetStaticValue(value);
134 } 136 }
135 reload_context->AddStaticFieldMapping(old_field, field); 137 reload_context->AddStaticFieldMapping(old_field, field);
136 } 138 }
137 } 139 }
138 } 140 }
139 } 141 }
140 } 142 }
141 143
(...skipping 614 matching lines...) Expand 10 before | Expand all | Expand 10 after
756 const Array& data_array = 758 const Array& data_array =
757 Array::Handle(zone, CachedEmptyICDataArray(num_args)); 759 Array::Handle(zone, CachedEmptyICDataArray(num_args));
758 set_ic_data_array(data_array); 760 set_ic_data_array(data_array);
759 } 761 }
760 } 762 }
761 } 763 }
762 764
763 #endif // !PRODUCT 765 #endif // !PRODUCT
764 766
765 } // namespace dart. 767 } // namespace dart.
OLDNEW
« no previous file with comments | « runtime/vm/isolate_reload_test.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698