| 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/code_patcher.h" | 7 #include "vm/code_patcher.h" |
| 8 #include "vm/compiler.h" | 8 #include "vm/compiler.h" |
| 9 #include "vm/deopt_instructions.h" | 9 #include "vm/deopt_instructions.h" |
| 10 #include "vm/flags.h" | 10 #include "vm/flags.h" |
| (...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 290 } else { | 290 } else { |
| 291 intptr_t context_index = ToContextIndex(offset.Value()); | 291 intptr_t context_index = ToContextIndex(offset.Value()); |
| 292 value = GetValue(i); | 292 value = GetValue(i); |
| 293 context.SetAt(context_index, value); | 293 context.SetAt(context_index, value); |
| 294 if (FLAG_trace_deoptimization_verbose) { | 294 if (FLAG_trace_deoptimization_verbose) { |
| 295 OS::PrintErr(" ctx@%" Pd " (offset %" Pd ") <- %s\n", | 295 OS::PrintErr(" ctx@%" Pd " (offset %" Pd ") <- %s\n", |
| 296 context_index, offset.Value(), value.ToCString()); | 296 context_index, offset.Value(), value.ToCString()); |
| 297 } | 297 } |
| 298 } | 298 } |
| 299 } | 299 } |
| 300 } else if (cls.id() == kClosureCid) { | |
| 301 // TODO(regis): It would be better to programmatically add these fields to | |
| 302 // the VM Closure class. Declaring them in the Dart class _Closure does not | |
| 303 // work, because the class is prefinalized and CalculateFieldOffsets is | |
| 304 // therefore not called. Resetting the finalization state may be an option. | |
| 305 const Closure& closure = Closure::Cast(*object_); | |
| 306 | |
| 307 Smi& offset = Smi::Handle(); | |
| 308 Object& value = Object::Handle(); | |
| 309 | |
| 310 for (intptr_t i = 0; i < field_count_; i++) { | |
| 311 offset ^= GetFieldOffset(i); | |
| 312 if (offset.Value() == Closure::type_arguments_offset()) { | |
| 313 TypeArguments& arguments = TypeArguments::Handle(); | |
| 314 arguments ^= GetValue(i); | |
| 315 closure.SetTypeArguments(arguments); | |
| 316 if (FLAG_trace_deoptimization_verbose) { | |
| 317 OS::PrintErr(" closure@type_arguments (offset %" Pd ") <- %s\n", | |
| 318 offset.Value(), value.ToCString()); | |
| 319 } | |
| 320 } else if (offset.Value() == Closure::function_offset()) { | |
| 321 Function& function = Function::Handle(); | |
| 322 function ^= GetValue(i); | |
| 323 closure.set_function(function); | |
| 324 if (FLAG_trace_deoptimization_verbose) { | |
| 325 OS::PrintErr(" closure@function (offset %" Pd ") <- %s\n", | |
| 326 offset.Value(), value.ToCString()); | |
| 327 } | |
| 328 } else { | |
| 329 ASSERT(offset.Value() == Closure::context_offset()); | |
| 330 Context& context = Context::Handle(); | |
| 331 context ^= GetValue(i); | |
| 332 closure.set_context(context); | |
| 333 if (FLAG_trace_deoptimization_verbose) { | |
| 334 OS::PrintErr(" closure@context (offset %" Pd ") <- %s\n", | |
| 335 offset.Value(), value.ToCString()); | |
| 336 } | |
| 337 } | |
| 338 } | |
| 339 } else { | 300 } else { |
| 340 const Instance& obj = Instance::Cast(*object_); | 301 const Instance& obj = Instance::Cast(*object_); |
| 341 | 302 |
| 342 Smi& offset = Smi::Handle(); | 303 Smi& offset = Smi::Handle(); |
| 343 Field& field = Field::Handle(); | 304 Field& field = Field::Handle(); |
| 344 Object& value = Object::Handle(); | 305 Object& value = Object::Handle(); |
| 345 const Array& offset_map = Array::Handle(cls.OffsetToFieldMap()); | 306 const Array& offset_map = Array::Handle(cls.OffsetToFieldMap()); |
| 346 | 307 |
| 347 for (intptr_t i = 0; i < field_count_; i++) { | 308 for (intptr_t i = 0; i < field_count_; i++) { |
| 348 offset ^= GetFieldOffset(i); | 309 offset ^= GetFieldOffset(i); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 361 if (FLAG_trace_deoptimization_verbose) { | 322 if (FLAG_trace_deoptimization_verbose) { |
| 362 OS::PrintErr(" null Field @ offset(%" Pd ") <- %s\n", | 323 OS::PrintErr(" null Field @ offset(%" Pd ") <- %s\n", |
| 363 offset.Value(), value.ToCString()); | 324 offset.Value(), value.ToCString()); |
| 364 } | 325 } |
| 365 } | 326 } |
| 366 } | 327 } |
| 367 } | 328 } |
| 368 } | 329 } |
| 369 | 330 |
| 370 } // namespace dart | 331 } // namespace dart |
| OLD | NEW |