| 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/jit_optimizer.h" | 5 #include "vm/jit_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 2757 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2768 } | 2768 } |
| 2769 } | 2769 } |
| 2770 } | 2770 } |
| 2771 } | 2771 } |
| 2772 } | 2772 } |
| 2773 | 2773 |
| 2774 | 2774 |
| 2775 void JitOptimizer::VisitStoreInstanceField( | 2775 void JitOptimizer::VisitStoreInstanceField( |
| 2776 StoreInstanceFieldInstr* instr) { | 2776 StoreInstanceFieldInstr* instr) { |
| 2777 if (instr->IsUnboxedStore()) { | 2777 if (instr->IsUnboxedStore()) { |
| 2778 ASSERT(instr->is_potential_unboxed_initialization_); | |
| 2779 // Determine if this field should be unboxed based on the usage of getter | 2778 // Determine if this field should be unboxed based on the usage of getter |
| 2780 // and setter functions: The heuristic requires that the setter has a | 2779 // and setter functions: The heuristic requires that the setter has a |
| 2781 // usage count of at least 1/kGetterSetterRatio of the getter usage count. | 2780 // usage count of at least 1/kGetterSetterRatio of the getter usage count. |
| 2782 // This is to avoid unboxing fields where the setter is never or rarely | 2781 // This is to avoid unboxing fields where the setter is never or rarely |
| 2783 // executed. | 2782 // executed. |
| 2784 const Field& field = instr->field(); | 2783 const Field& field = instr->field(); |
| 2785 const String& field_name = String::Handle(Z, field.name()); | 2784 const String& field_name = String::Handle(Z, field.name()); |
| 2786 const Class& owner = Class::Handle(Z, field.Owner()); | 2785 const Class& owner = Class::Handle(Z, field.Owner()); |
| 2787 const Function& getter = | 2786 const Function& getter = |
| 2788 Function::Handle(Z, owner.LookupGetterFunction(field_name)); | 2787 Function::Handle(Z, owner.LookupGetterFunction(field_name)); |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2946 | 2945 |
| 2947 // Discard the environment from the original instruction because the store | 2946 // Discard the environment from the original instruction because the store |
| 2948 // can't deoptimize. | 2947 // can't deoptimize. |
| 2949 instr->RemoveEnvironment(); | 2948 instr->RemoveEnvironment(); |
| 2950 ReplaceCall(instr, store); | 2949 ReplaceCall(instr, store); |
| 2951 return true; | 2950 return true; |
| 2952 } | 2951 } |
| 2953 | 2952 |
| 2954 | 2953 |
| 2955 } // namespace dart | 2954 } // namespace dart |
| OLD | NEW |