| 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/flow_graph_optimizer.h" | 5 #include "vm/flow_graph_optimizer.h" |
| 6 | 6 |
| 7 #include "vm/bit_vector.h" | 7 #include "vm/bit_vector.h" |
| 8 #include "vm/branch_optimizer.h" | 8 #include "vm/branch_optimizer.h" |
| 9 #include "vm/cha.h" | 9 #include "vm/cha.h" |
| 10 #include "vm/compiler.h" | 10 #include "vm/compiler.h" |
| (...skipping 4625 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4636 if (!getter.IsNull() && !setter.IsNull()) { | 4636 if (!getter.IsNull() && !setter.IsNull()) { |
| 4637 if (field.is_double_initialized()) { | 4637 if (field.is_double_initialized()) { |
| 4638 unboxed_field = true; | 4638 unboxed_field = true; |
| 4639 } else if ((setter.usage_counter() > 0) && | 4639 } else if ((setter.usage_counter() > 0) && |
| 4640 ((FLAG_getter_setter_ratio * setter.usage_counter()) >= | 4640 ((FLAG_getter_setter_ratio * setter.usage_counter()) >= |
| 4641 getter.usage_counter())) { | 4641 getter.usage_counter())) { |
| 4642 unboxed_field = true; | 4642 unboxed_field = true; |
| 4643 } | 4643 } |
| 4644 } | 4644 } |
| 4645 if (!unboxed_field) { | 4645 if (!unboxed_field) { |
| 4646 // TODO(srdjan): Instead of aborting pass this field to the mutator thread |
| 4647 // so that it can: |
| 4648 // - set it to unboxed |
| 4649 // - deoptimize dependent code. |
| 4650 if (Compiler::IsBackgroundCompilation()) { |
| 4651 Compiler::AbortBackgroundCompilation(Thread::kNoDeoptId); |
| 4652 } |
| 4646 if (FLAG_trace_optimization || FLAG_trace_field_guards) { | 4653 if (FLAG_trace_optimization || FLAG_trace_field_guards) { |
| 4647 THR_Print("Disabling unboxing of %s\n", field.ToCString()); | 4654 THR_Print("Disabling unboxing of %s\n", field.ToCString()); |
| 4648 if (!setter.IsNull()) { | 4655 if (!setter.IsNull()) { |
| 4649 OS::Print(" setter usage count: %" Pd "\n", setter.usage_counter()); | 4656 OS::Print(" setter usage count: %" Pd "\n", setter.usage_counter()); |
| 4650 } | 4657 } |
| 4651 if (!getter.IsNull()) { | 4658 if (!getter.IsNull()) { |
| 4652 OS::Print(" getter usage count: %" Pd "\n", getter.usage_counter()); | 4659 OS::Print(" getter usage count: %" Pd "\n", getter.usage_counter()); |
| 4653 } | 4660 } |
| 4654 } | 4661 } |
| 4655 field.set_is_unboxing_candidate(false); | 4662 field.set_is_unboxing_candidate(false); |
| 4656 if (Compiler::IsBackgroundCompilation()) { | 4663 if (Compiler::IsBackgroundCompilation()) { |
| 4657 // Delay deoptimization of dependent code to the code installation time. | 4664 UNIMPLEMENTED(); |
| 4658 // The invalidation of the background compilation result occurs only | |
| 4659 // when the deoptimization is triggered at code installation. | |
| 4660 flow_graph()->deoptimize_dependent_code().Add(&field); | |
| 4661 } else { | 4665 } else { |
| 4662 field.DeoptimizeDependentCode(); | 4666 field.DeoptimizeDependentCode(); |
| 4663 } | 4667 } |
| 4664 } else { | 4668 } else { |
| 4665 FlowGraph::AddToGuardedFields(flow_graph_->guarded_fields(), &field); | 4669 FlowGraph::AddToGuardedFields(flow_graph_->guarded_fields(), &field); |
| 4666 } | 4670 } |
| 4667 } | 4671 } |
| 4668 } | 4672 } |
| 4669 | 4673 |
| 4670 | 4674 |
| (...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5049 // the code for this instruction, however, leaving the environment | 5053 // the code for this instruction, however, leaving the environment |
| 5050 // changes code. | 5054 // changes code. |
| 5051 current->RemoveEnvironment(); | 5055 current->RemoveEnvironment(); |
| 5052 } | 5056 } |
| 5053 } | 5057 } |
| 5054 } | 5058 } |
| 5055 } | 5059 } |
| 5056 | 5060 |
| 5057 | 5061 |
| 5058 } // namespace dart | 5062 } // namespace dart |
| OLD | NEW |