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 2970 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2981 | 2981 |
2982 void JitOptimizer::VisitStoreInstanceField( | 2982 void JitOptimizer::VisitStoreInstanceField( |
2983 StoreInstanceFieldInstr* instr) { | 2983 StoreInstanceFieldInstr* instr) { |
2984 if (instr->IsUnboxedStore()) { | 2984 if (instr->IsUnboxedStore()) { |
2985 ASSERT(instr->is_potential_unboxed_initialization_); | 2985 ASSERT(instr->is_potential_unboxed_initialization_); |
2986 // Determine if this field should be unboxed based on the usage of getter | 2986 // Determine if this field should be unboxed based on the usage of getter |
2987 // and setter functions: The heuristic requires that the setter has a | 2987 // and setter functions: The heuristic requires that the setter has a |
2988 // usage count of at least 1/kGetterSetterRatio of the getter usage count. | 2988 // usage count of at least 1/kGetterSetterRatio of the getter usage count. |
2989 // This is to avoid unboxing fields where the setter is never or rarely | 2989 // This is to avoid unboxing fields where the setter is never or rarely |
2990 // executed. | 2990 // executed. |
2991 const Field& field = Field::ZoneHandle(Z, instr->field().raw()); | 2991 const Field& field = Field::ZoneHandle(Z, instr->field().Original()); |
2992 const String& field_name = String::Handle(Z, field.name()); | 2992 const String& field_name = String::Handle(Z, field.name()); |
2993 const Class& owner = Class::Handle(Z, field.owner()); | 2993 const Class& owner = Class::Handle(Z, field.Owner()); |
2994 const Function& getter = | 2994 const Function& getter = |
2995 Function::Handle(Z, owner.LookupGetterFunction(field_name)); | 2995 Function::Handle(Z, owner.LookupGetterFunction(field_name)); |
2996 const Function& setter = | 2996 const Function& setter = |
2997 Function::Handle(Z, owner.LookupSetterFunction(field_name)); | 2997 Function::Handle(Z, owner.LookupSetterFunction(field_name)); |
2998 bool unboxed_field = false; | 2998 bool unboxed_field = false; |
2999 if (!getter.IsNull() && !setter.IsNull()) { | 2999 if (!getter.IsNull() && !setter.IsNull()) { |
3000 if (field.is_double_initialized()) { | 3000 if (field.is_double_initialized()) { |
3001 unboxed_field = true; | 3001 unboxed_field = true; |
3002 } else if ((setter.usage_counter() > 0) && | 3002 } else if ((setter.usage_counter() > 0) && |
3003 ((FLAG_getter_setter_ratio * setter.usage_counter()) >= | 3003 ((FLAG_getter_setter_ratio * setter.usage_counter()) >= |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3148 | 3148 |
3149 // Discard the environment from the original instruction because the store | 3149 // Discard the environment from the original instruction because the store |
3150 // can't deoptimize. | 3150 // can't deoptimize. |
3151 instr->RemoveEnvironment(); | 3151 instr->RemoveEnvironment(); |
3152 ReplaceCall(instr, store); | 3152 ReplaceCall(instr, store); |
3153 return true; | 3153 return true; |
3154 } | 3154 } |
3155 | 3155 |
3156 | 3156 |
3157 } // namespace dart | 3157 } // namespace dart |
OLD | NEW |