| 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/deopt_instructions.h" | 5 #include "vm/deopt_instructions.h" |
| 6 | 6 |
| 7 #include "vm/assembler.h" | 7 #include "vm/assembler.h" |
| 8 #include "vm/code_patcher.h" | 8 #include "vm/code_patcher.h" |
| 9 #include "vm/intermediate_language.h" | 9 #include "vm/intermediate_language.h" |
| 10 #include "vm/locations.h" | 10 #include "vm/locations.h" |
| (...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 278 uword pc = code.GetPcForDeoptId(deopt_id_, PcDescriptors::kIcCall); | 278 uword pc = code.GetPcForDeoptId(deopt_id_, PcDescriptors::kIcCall); |
| 279 if (pc != 0) { | 279 if (pc != 0) { |
| 280 // If the deoptimization happened at an IC call, update the IC data | 280 // If the deoptimization happened at an IC call, update the IC data |
| 281 // to avoid repeated deoptimization at the same site next time around. | 281 // to avoid repeated deoptimization at the same site next time around. |
| 282 ICData& ic_data = ICData::Handle(); | 282 ICData& ic_data = ICData::Handle(); |
| 283 CodePatcher::GetInstanceCallAt(pc, code, &ic_data, NULL); | 283 CodePatcher::GetInstanceCallAt(pc, code, &ic_data, NULL); |
| 284 if (!ic_data.IsNull()) { | 284 if (!ic_data.IsNull()) { |
| 285 ic_data.set_deopt_reason(deopt_context->deopt_reason()); | 285 ic_data.set_deopt_reason(deopt_context->deopt_reason()); |
| 286 } | 286 } |
| 287 } | 287 } |
| 288 | |
| 289 const Array& deopt_history = Array::Handle(function.deopt_history()); | |
| 290 ASSERT(!deopt_history.IsNull()); | |
| 291 intptr_t count = function.deoptimization_counter(); | |
| 292 ASSERT(count > 0); | |
| 293 if (count <= deopt_history.Length()) { | |
| 294 deopt_history.SetAt(count - 1, Smi::Handle(Smi::New(deopt_id_))); | |
| 295 if (FLAG_trace_deoptimization_verbose) { | |
| 296 OS::Print(" adding id %"Pd" to history at %"Pd"\n", | |
| 297 deopt_id_, count - 1); | |
| 298 } | |
| 299 } | |
| 300 } | 288 } |
| 301 | 289 |
| 302 intptr_t object_table_index() const { return object_table_index_; } | 290 intptr_t object_table_index() const { return object_table_index_; } |
| 303 intptr_t deopt_id() const { return deopt_id_; } | 291 intptr_t deopt_id() const { return deopt_id_; } |
| 304 | 292 |
| 305 private: | 293 private: |
| 306 static const intptr_t kFieldWidth = kBitsPerWord / 2; | 294 static const intptr_t kFieldWidth = kBitsPerWord / 2; |
| 307 class ObjectTableIndex : public BitField<intptr_t, 0, kFieldWidth> { }; | 295 class ObjectTableIndex : public BitField<intptr_t, 0, kFieldWidth> { }; |
| 308 class DeoptId : public BitField<intptr_t, kFieldWidth, kFieldWidth> { }; | 296 class DeoptId : public BitField<intptr_t, kFieldWidth, kFieldWidth> { }; |
| 309 | 297 |
| (...skipping 800 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1110 Smi* offset, | 1098 Smi* offset, |
| 1111 DeoptInfo* info, | 1099 DeoptInfo* info, |
| 1112 Smi* reason) { | 1100 Smi* reason) { |
| 1113 intptr_t i = index * kEntrySize; | 1101 intptr_t i = index * kEntrySize; |
| 1114 *offset ^= table.At(i); | 1102 *offset ^= table.At(i); |
| 1115 *info ^= table.At(i + 1); | 1103 *info ^= table.At(i + 1); |
| 1116 *reason ^= table.At(i + 2); | 1104 *reason ^= table.At(i + 2); |
| 1117 } | 1105 } |
| 1118 | 1106 |
| 1119 } // namespace dart | 1107 } // namespace dart |
| OLD | NEW |