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 26 matching lines...) Expand all Loading... |
37 fpu_registers_(fpu_registers), | 37 fpu_registers_(fpu_registers), |
38 num_args_(0), | 38 num_args_(0), |
39 deopt_reason_(kDeoptUnknown), | 39 deopt_reason_(kDeoptUnknown), |
40 isolate_(Isolate::Current()), | 40 isolate_(Isolate::Current()), |
41 deferred_boxes_(NULL), | 41 deferred_boxes_(NULL), |
42 deferred_object_refs_(NULL), | 42 deferred_object_refs_(NULL), |
43 deferred_objects_count_(0), | 43 deferred_objects_count_(0), |
44 deferred_objects_(NULL) { | 44 deferred_objects_(NULL) { |
45 object_table_ = code.object_table(); | 45 object_table_ = code.object_table(); |
46 | 46 |
47 intptr_t deopt_reason = kDeoptUnknown; | 47 DeoptReasonId deopt_reason = kDeoptUnknown; |
48 const DeoptInfo& deopt_info = | 48 const DeoptInfo& deopt_info = |
49 DeoptInfo::Handle(code.GetDeoptInfoAtPc(frame->pc(), &deopt_reason)); | 49 DeoptInfo::Handle(code.GetDeoptInfoAtPc(frame->pc(), &deopt_reason)); |
50 ASSERT(!deopt_info.IsNull()); | 50 ASSERT(!deopt_info.IsNull()); |
51 deopt_info_ = deopt_info.raw(); | 51 deopt_info_ = deopt_info.raw(); |
52 deopt_reason_ = static_cast<DeoptReasonId>(deopt_reason); | 52 deopt_reason_ = deopt_reason; |
53 | 53 |
54 const Function& function = Function::Handle(code.function()); | 54 const Function& function = Function::Handle(code.function()); |
55 | 55 |
56 // Do not include incoming arguments if there are optional arguments | 56 // Do not include incoming arguments if there are optional arguments |
57 // (they are copied into local space at method entry). | 57 // (they are copied into local space at method entry). |
58 num_args_ = | 58 num_args_ = |
59 function.HasOptionalParameters() ? 0 : function.num_fixed_parameters(); | 59 function.HasOptionalParameters() ? 0 : function.num_fixed_parameters(); |
60 | 60 |
61 // The fixed size section of the (fake) Dart frame called via a stub by the | 61 // The fixed size section of the (fake) Dart frame called via a stub by the |
62 // optimized function contains FP, PP (ARM and MIPS only), PC-marker and | 62 // optimized function contains FP, PP (ARM and MIPS only), PC-marker and |
(...skipping 26 matching lines...) Expand all Loading... |
89 dest_frame_ = new intptr_t[dest_frame_size_]; | 89 dest_frame_ = new intptr_t[dest_frame_size_]; |
90 ASSERT(source_frame_ != NULL); | 90 ASSERT(source_frame_ != NULL); |
91 for (intptr_t i = 0; i < dest_frame_size_; i++) { | 91 for (intptr_t i = 0; i < dest_frame_size_; i++) { |
92 dest_frame_[i] = 0; | 92 dest_frame_[i] = 0; |
93 } | 93 } |
94 dest_frame_is_allocated_ = true; | 94 dest_frame_is_allocated_ = true; |
95 } | 95 } |
96 | 96 |
97 if (FLAG_trace_deoptimization || FLAG_trace_deoptimization_verbose) { | 97 if (FLAG_trace_deoptimization || FLAG_trace_deoptimization_verbose) { |
98 OS::PrintErr( | 98 OS::PrintErr( |
99 "Deoptimizing (reason %" Pd " '%s') at pc %#" Px " '%s' (count %d)\n", | 99 "Deoptimizing (reason %d '%s') at pc %#" Px " '%s' (count %d)\n", |
100 deopt_reason, | 100 deopt_reason, |
101 DeoptReasonToText(deopt_reason_), | 101 DeoptReasonToText(deopt_reason_), |
102 frame->pc(), | 102 frame->pc(), |
103 function.ToFullyQualifiedCString(), | 103 function.ToFullyQualifiedCString(), |
104 function.deoptimization_counter()); | 104 function.deoptimization_counter()); |
105 } | 105 } |
106 } | 106 } |
107 | 107 |
108 | 108 |
109 DeoptContext::~DeoptContext() { | 109 DeoptContext::~DeoptContext() { |
(...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
608 ASSERT(continue_at_pc != 0); | 608 ASSERT(continue_at_pc != 0); |
609 *dest_addr = continue_at_pc; | 609 *dest_addr = continue_at_pc; |
610 | 610 |
611 uword pc = code.GetPcForDeoptId(deopt_id_, PcDescriptors::kIcCall); | 611 uword pc = code.GetPcForDeoptId(deopt_id_, PcDescriptors::kIcCall); |
612 if (pc != 0) { | 612 if (pc != 0) { |
613 // If the deoptimization happened at an IC call, update the IC data | 613 // If the deoptimization happened at an IC call, update the IC data |
614 // to avoid repeated deoptimization at the same site next time around. | 614 // to avoid repeated deoptimization at the same site next time around. |
615 ICData& ic_data = ICData::Handle(); | 615 ICData& ic_data = ICData::Handle(); |
616 CodePatcher::GetInstanceCallAt(pc, code, &ic_data); | 616 CodePatcher::GetInstanceCallAt(pc, code, &ic_data); |
617 if (!ic_data.IsNull()) { | 617 if (!ic_data.IsNull()) { |
618 ic_data.set_deopt_reason(deopt_context->deopt_reason()); | 618 ic_data.AddDeoptReason(deopt_context->deopt_reason()); |
619 } | 619 } |
620 } else if (deopt_context->deopt_reason() == kDeoptHoistedCheckClass) { | 620 } else if (deopt_context->deopt_reason() == kDeoptHoistedCheckClass) { |
621 // Prevent excessive deoptimization. | 621 // Prevent excessive deoptimization. |
622 Function::Handle(code.function()).set_allows_hoisting_check_class(false); | 622 Function::Handle(code.function()).set_allows_hoisting_check_class(false); |
623 } | 623 } |
624 } | 624 } |
625 | 625 |
626 intptr_t object_table_index() const { return object_table_index_; } | 626 intptr_t object_table_index() const { return object_table_index_; } |
627 intptr_t deopt_id() const { return deopt_id_; } | 627 intptr_t deopt_id() const { return deopt_id_; } |
628 | 628 |
(...skipping 848 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1477 Smi* offset, | 1477 Smi* offset, |
1478 DeoptInfo* info, | 1478 DeoptInfo* info, |
1479 Smi* reason) { | 1479 Smi* reason) { |
1480 intptr_t i = index * kEntrySize; | 1480 intptr_t i = index * kEntrySize; |
1481 *offset ^= table.At(i); | 1481 *offset ^= table.At(i); |
1482 *info ^= table.At(i + 1); | 1482 *info ^= table.At(i + 1); |
1483 *reason ^= table.At(i + 2); | 1483 *reason ^= table.At(i + 2); |
1484 } | 1484 } |
1485 | 1485 |
1486 } // namespace dart | 1486 } // namespace dart |
OLD | NEW |