Chromium Code Reviews| 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/disassembler.h" | |
| 10 #include "vm/flags.h" | 11 #include "vm/flags.h" |
| 11 #include "vm/object.h" | 12 #include "vm/object.h" |
| 12 | 13 |
| 13 namespace dart { | 14 namespace dart { |
| 14 | 15 |
| 15 DECLARE_FLAG(bool, trace_deoptimization); | 16 DECLARE_FLAG(bool, trace_deoptimization); |
| 16 DECLARE_FLAG(bool, trace_deoptimization_verbose); | 17 DECLARE_FLAG(bool, trace_deoptimization_verbose); |
| 17 | 18 |
| 18 | 19 |
| 19 void DeferredDouble::Materialize(DeoptContext* deopt_context) { | 20 void DeferredDouble::Materialize(DeoptContext* deopt_context) { |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 107 function ^= deopt_context->ObjectAt(index_); | 108 function ^= deopt_context->ObjectAt(index_); |
| 108 const Error& error = Error::Handle(zone, | 109 const Error& error = Error::Handle(zone, |
| 109 Compiler::EnsureUnoptimizedCode(thread, function)); | 110 Compiler::EnsureUnoptimizedCode(thread, function)); |
| 110 if (!error.IsNull()) { | 111 if (!error.IsNull()) { |
| 111 Exceptions::PropagateError(error); | 112 Exceptions::PropagateError(error); |
| 112 } | 113 } |
| 113 const Code& code = Code::Handle(zone, function.unoptimized_code()); | 114 const Code& code = Code::Handle(zone, function.unoptimized_code()); |
| 114 // Check that deopt_id exists. | 115 // Check that deopt_id exists. |
| 115 // TODO(vegorov): verify after deoptimization targets as well. | 116 // TODO(vegorov): verify after deoptimization targets as well. |
| 116 #ifdef DEBUG | 117 #ifdef DEBUG |
| 117 ASSERT(Thread::IsDeoptAfter(deopt_id_) || | 118 if (!Thread::IsDeoptAfter(deopt_id_)) { |
| 118 (code.GetPcForDeoptId(deopt_id_, RawPcDescriptors::kDeopt) != 0)); | 119 if (code.GetPcForDeoptId(deopt_id_, RawPcDescriptors::kDeopt) == 0) { |
| 120 OS::PrintErr("DeferredRetAddr::Materialize: deopt_id_ = %ld\n", | |
| 121 deopt_id_); | |
| 122 Disassembler::DisassembleCodeUnoptimized( | |
| 123 Function::Handle(code.function()), false); | |
| 124 } | |
| 125 ASSERT(code.GetPcForDeoptId(deopt_id_, RawPcDescriptors::kDeopt) != 0); | |
|
zra
2016/06/24 22:37:49
Hitting this assert. deopt_id_ is 38. It's listed
| |
| 126 } | |
| 127 // ASSERT(Thread::IsDeoptAfter(deopt_id_) || | |
| 128 // (code.GetPcForDeoptId(deopt_id_, RawPcDescriptors::kDeopt) != 0)); | |
| 119 #endif | 129 #endif |
| 120 | 130 |
| 121 uword continue_at_pc = code.GetPcForDeoptId(deopt_id_, | 131 uword continue_at_pc = code.GetPcForDeoptId(deopt_id_, |
| 122 RawPcDescriptors::kDeopt); | 132 RawPcDescriptors::kDeopt); |
| 123 ASSERT(continue_at_pc != 0); | 133 ASSERT(continue_at_pc != 0); |
| 124 uword* dest_addr = reinterpret_cast<uword*>(slot()); | 134 uword* dest_addr = reinterpret_cast<uword*>(slot()); |
| 125 *dest_addr = continue_at_pc; | 135 *dest_addr = continue_at_pc; |
| 126 | 136 |
| 127 if (FLAG_trace_deoptimization_verbose) { | 137 if (FLAG_trace_deoptimization_verbose) { |
| 128 OS::PrintErr("materializing return addr at 0x%" Px ": 0x%" Px "\n", | 138 OS::PrintErr("materializing return addr at 0x%" Px ": 0x%" Px "\n", |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 348 } | 358 } |
| 349 } else { | 359 } else { |
| 350 const Instance& obj = Instance::Cast(*object_); | 360 const Instance& obj = Instance::Cast(*object_); |
| 351 | 361 |
| 352 Smi& offset = Smi::Handle(); | 362 Smi& offset = Smi::Handle(); |
| 353 Field& field = Field::Handle(); | 363 Field& field = Field::Handle(); |
| 354 Object& value = Object::Handle(); | 364 Object& value = Object::Handle(); |
| 355 const Array& offset_map = Array::Handle(cls.OffsetToFieldMap()); | 365 const Array& offset_map = Array::Handle(cls.OffsetToFieldMap()); |
| 356 | 366 |
| 357 for (intptr_t i = 0; i < field_count_; i++) { | 367 for (intptr_t i = 0; i < field_count_; i++) { |
| 368 //RawObject* o = GetFieldOffset(i); | |
| 369 //OS::PrintErr("i = %ld, o = %p\n", i, o); | |
| 358 offset ^= GetFieldOffset(i); | 370 offset ^= GetFieldOffset(i); |
| 359 field ^= offset_map.At(offset.Value() / kWordSize); | 371 field ^= offset_map.At(offset.Value() / kWordSize); |
| 360 value = GetValue(i); | 372 value = GetValue(i); |
| 361 if (!field.IsNull()) { | 373 if (!field.IsNull()) { |
| 362 obj.SetField(field, value); | 374 obj.SetField(field, value); |
| 363 if (FLAG_trace_deoptimization_verbose) { | 375 if (FLAG_trace_deoptimization_verbose) { |
| 364 OS::PrintErr(" %s <- %s\n", | 376 OS::PrintErr(" %s <- %s\n", |
| 365 String::Handle(field.name()).ToCString(), | 377 String::Handle(field.name()).ToCString(), |
| 366 value.ToCString()); | 378 value.ToCString()); |
| 367 } | 379 } |
| 368 } else { | 380 } else { |
| 369 ASSERT(offset.Value() == cls.type_arguments_field_offset()); | 381 ASSERT(offset.Value() == cls.type_arguments_field_offset()); |
| 370 obj.SetFieldAtOffset(offset.Value(), value); | 382 obj.SetFieldAtOffset(offset.Value(), value); |
| 371 if (FLAG_trace_deoptimization_verbose) { | 383 if (FLAG_trace_deoptimization_verbose) { |
| 372 OS::PrintErr(" null Field @ offset(%" Pd ") <- %s\n", | 384 OS::PrintErr(" null Field @ offset(%" Pd ") <- %s\n", |
| 373 offset.Value(), | 385 offset.Value(), |
| 374 value.ToCString()); | 386 value.ToCString()); |
| 375 } | 387 } |
| 376 } | 388 } |
| 377 } | 389 } |
| 378 } | 390 } |
| 379 } | 391 } |
| 380 | 392 |
| 381 } // namespace dart | 393 } // namespace dart |
| OLD | NEW |