| 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/cpu.h" | 9 #include "vm/cpu.h" |
| 10 #include "vm/dart_entry.h" | 10 #include "vm/dart_entry.h" |
| (...skipping 4432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4443 StoreInstanceFieldInstr* instr) { | 4443 StoreInstanceFieldInstr* instr) { |
| 4444 if (instr->IsUnboxedStore()) { | 4444 if (instr->IsUnboxedStore()) { |
| 4445 ASSERT(instr->is_initialization_); | 4445 ASSERT(instr->is_initialization_); |
| 4446 // Determine if this field should be unboxed based on the usage of getter | 4446 // Determine if this field should be unboxed based on the usage of getter |
| 4447 // and setter functions: The heuristic requires that the setter has a | 4447 // and setter functions: The heuristic requires that the setter has a |
| 4448 // usage count of at least 1/kGetterSetterRatio of the getter usage count. | 4448 // usage count of at least 1/kGetterSetterRatio of the getter usage count. |
| 4449 // This is to avoid unboxing fields where the setter is never or rarely | 4449 // This is to avoid unboxing fields where the setter is never or rarely |
| 4450 // executed. | 4450 // executed. |
| 4451 const Field& field = Field::ZoneHandle(I, instr->field().raw()); | 4451 const Field& field = Field::ZoneHandle(I, instr->field().raw()); |
| 4452 const String& field_name = String::Handle(I, field.name()); | 4452 const String& field_name = String::Handle(I, field.name()); |
| 4453 class Class& owner = Class::Handle(I, field.owner()); | 4453 const Class& owner = Class::Handle(I, field.owner()); |
| 4454 const Function& getter = | 4454 const Function& getter = |
| 4455 Function::Handle(I, owner.LookupGetterFunction(field_name)); | 4455 Function::Handle(I, owner.LookupGetterFunction(field_name)); |
| 4456 const Function& setter = | 4456 const Function& setter = |
| 4457 Function::Handle(I, owner.LookupSetterFunction(field_name)); | 4457 Function::Handle(I, owner.LookupSetterFunction(field_name)); |
| 4458 bool result = !getter.IsNull() | 4458 bool result = !getter.IsNull() |
| 4459 && !setter.IsNull() | 4459 && !setter.IsNull() |
| 4460 && (setter.usage_counter() > 0) | 4460 && (setter.usage_counter() > 0) |
| 4461 && (FLAG_getter_setter_ratio * setter.usage_counter() >= | 4461 && (FLAG_getter_setter_ratio * setter.usage_counter() >= |
| 4462 getter.usage_counter()); | 4462 getter.usage_counter()); |
| 4463 if (!result) { | 4463 if (!result) { |
| (...skipping 5151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9615 | 9615 |
| 9616 // Insert materializations at environment uses. | 9616 // Insert materializations at environment uses. |
| 9617 for (intptr_t i = 0; i < exits_collector_.exits().length(); i++) { | 9617 for (intptr_t i = 0; i < exits_collector_.exits().length(); i++) { |
| 9618 CreateMaterializationAt( | 9618 CreateMaterializationAt( |
| 9619 exits_collector_.exits()[i], alloc, alloc->cls(), *slots); | 9619 exits_collector_.exits()[i], alloc, alloc->cls(), *slots); |
| 9620 } | 9620 } |
| 9621 } | 9621 } |
| 9622 | 9622 |
| 9623 | 9623 |
| 9624 } // namespace dart | 9624 } // namespace dart |
| OLD | NEW |