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/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/cha.h" | 8 #include "vm/cha.h" |
| 9 #include "vm/compiler.h" | 9 #include "vm/compiler.h" |
| 10 #include "vm/cpu.h" | 10 #include "vm/cpu.h" |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 44 DEFINE_FLAG(bool, truncating_left_shift, true, | 44 DEFINE_FLAG(bool, truncating_left_shift, true, |
| 45 "Optimize left shift to truncate if possible"); | 45 "Optimize left shift to truncate if possible"); |
| 46 DEFINE_FLAG(bool, use_cha_deopt, true, | 46 DEFINE_FLAG(bool, use_cha_deopt, true, |
| 47 "Use class hierarchy analysis even if it can cause deoptimization."); | 47 "Use class hierarchy analysis even if it can cause deoptimization."); |
| 48 #if defined(TARGET_ARCH_ARM) || defined(TARGET_ARCH_IA32) | 48 #if defined(TARGET_ARCH_ARM) || defined(TARGET_ARCH_IA32) |
| 49 DEFINE_FLAG(bool, trace_smi_widening, false, "Trace Smi->Int32 widening pass."); | 49 DEFINE_FLAG(bool, trace_smi_widening, false, "Trace Smi->Int32 widening pass."); |
| 50 #endif | 50 #endif |
| 51 | 51 |
| 52 DECLARE_FLAG(bool, polymorphic_with_deopt); | 52 DECLARE_FLAG(bool, polymorphic_with_deopt); |
| 53 DECLARE_FLAG(bool, source_lines); | 53 DECLARE_FLAG(bool, source_lines); |
| 54 DECLARE_FLAG(bool, trace_field_guards); | |
| 54 DECLARE_FLAG(bool, trace_type_check_elimination); | 55 DECLARE_FLAG(bool, trace_type_check_elimination); |
| 55 DECLARE_FLAG(bool, warn_on_javascript_compatibility); | 56 DECLARE_FLAG(bool, warn_on_javascript_compatibility); |
| 56 | 57 |
| 57 // Quick access to the current isolate and zone. | 58 // Quick access to the current isolate and zone. |
| 58 #define I (isolate()) | 59 #define I (isolate()) |
| 59 #define Z (zone()) | 60 #define Z (zone()) |
| 60 | 61 |
| 61 static bool ShouldInlineSimd() { | 62 static bool ShouldInlineSimd() { |
| 62 return FlowGraphCompiler::SupportsUnboxedSimd128(); | 63 return FlowGraphCompiler::SupportsUnboxedSimd128(); |
| 63 } | 64 } |
| (...skipping 4525 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4589 // usage count of at least 1/kGetterSetterRatio of the getter usage count. | 4590 // usage count of at least 1/kGetterSetterRatio of the getter usage count. |
| 4590 // This is to avoid unboxing fields where the setter is never or rarely | 4591 // This is to avoid unboxing fields where the setter is never or rarely |
| 4591 // executed. | 4592 // executed. |
| 4592 const Field& field = Field::ZoneHandle(Z, instr->field().raw()); | 4593 const Field& field = Field::ZoneHandle(Z, instr->field().raw()); |
| 4593 const String& field_name = String::Handle(Z, field.name()); | 4594 const String& field_name = String::Handle(Z, field.name()); |
| 4594 const Class& owner = Class::Handle(Z, field.owner()); | 4595 const Class& owner = Class::Handle(Z, field.owner()); |
| 4595 const Function& getter = | 4596 const Function& getter = |
| 4596 Function::Handle(Z, owner.LookupGetterFunction(field_name)); | 4597 Function::Handle(Z, owner.LookupGetterFunction(field_name)); |
| 4597 const Function& setter = | 4598 const Function& setter = |
| 4598 Function::Handle(Z, owner.LookupSetterFunction(field_name)); | 4599 Function::Handle(Z, owner.LookupSetterFunction(field_name)); |
| 4599 bool result = !getter.IsNull() | 4600 bool result = false; |
|
Cutch
2015/08/07 13:40:30
s/result/unboxed_field ?
srdjan
2015/08/07 16:15:22
Done.
| |
| 4600 && !setter.IsNull() | 4601 if (!getter.IsNull() && !setter.IsNull()) { |
| 4601 && (setter.usage_counter() > 0) | 4602 if (field.is_double_initialized()) { |
| 4602 && (FLAG_getter_setter_ratio * setter.usage_counter() >= | 4603 result = true; |
| 4603 getter.usage_counter()); | 4604 } else if ((setter.usage_counter() > 0) && |
| 4605 ((FLAG_getter_setter_ratio * setter.usage_counter()) >= | |
| 4606 getter.usage_counter())) { | |
|
Cutch
2015/08/07 13:40:30
added whitespace before getter?
srdjan
2015/08/07 16:15:22
Made it aligned with FLAG_getter_setter.... 2 spac
| |
| 4607 result = true; | |
| 4608 } | |
| 4609 } | |
| 4604 if (!result) { | 4610 if (!result) { |
| 4605 if (FLAG_trace_optimization) { | 4611 if (FLAG_trace_optimization || FLAG_trace_field_guards) { |
| 4606 ISL_Print("Disabling unboxing of %s\n", field.ToCString()); | 4612 ISL_Print("Disabling unboxing of %s\n", field.ToCString()); |
| 4613 if (!setter.IsNull()) { | |
| 4614 OS::Print(" setter usage count: %" Pd "\n", setter.usage_counter()); | |
| 4615 } | |
| 4616 if (!getter.IsNull()) { | |
| 4617 OS::Print(" getter usage count: %" Pd "\n", getter.usage_counter()); | |
| 4618 } | |
| 4607 } | 4619 } |
| 4608 field.set_is_unboxing_candidate(false); | 4620 field.set_is_unboxing_candidate(false); |
| 4609 field.DeoptimizeDependentCode(); | 4621 field.DeoptimizeDependentCode(); |
| 4610 } else { | 4622 } else { |
| 4611 FlowGraph::AddToGuardedFields(flow_graph_->guarded_fields(), &field); | 4623 FlowGraph::AddToGuardedFields(flow_graph_->guarded_fields(), &field); |
| 4612 } | 4624 } |
| 4613 } | 4625 } |
| 4614 } | 4626 } |
| 4615 | 4627 |
| 4616 | 4628 |
| (...skipping 4142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 8759 | 8771 |
| 8760 // Insert materializations at environment uses. | 8772 // Insert materializations at environment uses. |
| 8761 for (intptr_t i = 0; i < exits_collector_.exits().length(); i++) { | 8773 for (intptr_t i = 0; i < exits_collector_.exits().length(); i++) { |
| 8762 CreateMaterializationAt( | 8774 CreateMaterializationAt( |
| 8763 exits_collector_.exits()[i], alloc, *slots); | 8775 exits_collector_.exits()[i], alloc, *slots); |
| 8764 } | 8776 } |
| 8765 } | 8777 } |
| 8766 | 8778 |
| 8767 | 8779 |
| 8768 } // namespace dart | 8780 } // namespace dart |
| OLD | NEW |