| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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/deferred_objects.h" | 5 #include "vm/deferred_objects.h" |
| 6 | 6 |
| 7 #include "vm/deopt_instructions.h" | 7 #include "vm/deopt_instructions.h" |
| 8 #include "vm/flags.h" | 8 #include "vm/flags.h" |
| 9 #include "vm/object.h" | 9 #include "vm/object.h" |
| 10 | 10 |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 | 109 |
| 110 if (FLAG_trace_deoptimization_verbose) { | 110 if (FLAG_trace_deoptimization_verbose) { |
| 111 OS::PrintErr("materializing instance of %s (%" Px ", %" Pd " fields)\n", | 111 OS::PrintErr("materializing instance of %s (%" Px ", %" Pd " fields)\n", |
| 112 cls.ToCString(), | 112 cls.ToCString(), |
| 113 reinterpret_cast<uword>(args_), | 113 reinterpret_cast<uword>(args_), |
| 114 field_count_); | 114 field_count_); |
| 115 } | 115 } |
| 116 | 116 |
| 117 const Instance& obj = Instance::ZoneHandle(Instance::New(cls)); | 117 const Instance& obj = Instance::ZoneHandle(Instance::New(cls)); |
| 118 | 118 |
| 119 Smi& offset = Smi::Handle(); |
| 119 Field& field = Field::Handle(); | 120 Field& field = Field::Handle(); |
| 120 Object& value = Object::Handle(); | 121 Object& value = Object::Handle(); |
| 122 const Array& offset_map = Array::Handle(cls.OffsetToFieldMap()); |
| 123 |
| 121 for (intptr_t i = 0; i < field_count_; i++) { | 124 for (intptr_t i = 0; i < field_count_; i++) { |
| 122 field ^= GetField(i); | 125 offset ^= GetFieldOffset(i); |
| 126 field ^= offset_map.At(offset.Value() / kWordSize); |
| 123 value = GetValue(i); | 127 value = GetValue(i); |
| 124 obj.SetField(field, value); | 128 if (!field.IsNull()) { |
| 129 obj.SetField(field, value); |
| 130 } else { |
| 131 ASSERT(offset.Value() == cls.type_arguments_field_offset()); |
| 132 obj.SetFieldAtOffset(offset.Value(), value); |
| 133 } |
| 125 | 134 |
| 126 if (FLAG_trace_deoptimization_verbose) { | 135 if (FLAG_trace_deoptimization_verbose) { |
| 127 OS::PrintErr(" %s <- %s\n", | 136 OS::PrintErr(" %s <- %s\n", |
| 128 String::Handle(field.name()).ToCString(), | 137 String::Handle(field.name()).ToCString(), |
| 129 value.ToCString()); | 138 value.ToCString()); |
| 130 } | 139 } |
| 131 } | 140 } |
| 132 | 141 |
| 133 object_ = &obj; | 142 object_ = &obj; |
| 134 } | 143 } |
| 135 | 144 |
| 136 } // namespace dart | 145 } // namespace dart |
| OLD | NEW |