| 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 2901 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2912 StoreInstanceFieldInstr* instr) { | 2912 StoreInstanceFieldInstr* instr) { |
| 2913 if (instr->IsUnboxedStore()) { | 2913 if (instr->IsUnboxedStore()) { |
| 2914 ASSERT(instr->is_potential_unboxed_initialization_); | 2914 ASSERT(instr->is_potential_unboxed_initialization_); |
| 2915 // Determine if this field should be unboxed based on the usage of getter | 2915 // Determine if this field should be unboxed based on the usage of getter |
| 2916 // and setter functions: The heuristic requires that the setter has a | 2916 // and setter functions: The heuristic requires that the setter has a |
| 2917 // usage count of at least 1/kGetterSetterRatio of the getter usage count. | 2917 // usage count of at least 1/kGetterSetterRatio of the getter usage count. |
| 2918 // This is to avoid unboxing fields where the setter is never or rarely | 2918 // This is to avoid unboxing fields where the setter is never or rarely |
| 2919 // executed. | 2919 // executed. |
| 2920 const Field& field = instr->field(); | 2920 const Field& field = instr->field(); |
| 2921 const String& field_name = String::Handle(Z, field.name()); | 2921 const String& field_name = String::Handle(Z, field.name()); |
| 2922 const Class& owner = | 2922 const Class& owner = Class::Handle(Z, field.Owner()); |
| 2923 Class::Handle(Z, Field::Handle(Z, field.Original()).Owner()); | |
| 2924 const Function& getter = | 2923 const Function& getter = |
| 2925 Function::Handle(Z, owner.LookupGetterFunction(field_name)); | 2924 Function::Handle(Z, owner.LookupGetterFunction(field_name)); |
| 2926 const Function& setter = | 2925 const Function& setter = |
| 2927 Function::Handle(Z, owner.LookupSetterFunction(field_name)); | 2926 Function::Handle(Z, owner.LookupSetterFunction(field_name)); |
| 2928 bool unboxed_field = false; | 2927 bool unboxed_field = false; |
| 2929 if (!getter.IsNull() && !setter.IsNull()) { | 2928 if (!getter.IsNull() && !setter.IsNull()) { |
| 2930 if (field.is_double_initialized()) { | 2929 if (field.is_double_initialized()) { |
| 2931 unboxed_field = true; | 2930 unboxed_field = true; |
| 2932 } else if ((setter.usage_counter() > 0) && | 2931 } else if ((setter.usage_counter() > 0) && |
| 2933 ((FLAG_getter_setter_ratio * setter.usage_counter()) >= | 2932 ((FLAG_getter_setter_ratio * setter.usage_counter()) >= |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3083 | 3082 |
| 3084 // Discard the environment from the original instruction because the store | 3083 // Discard the environment from the original instruction because the store |
| 3085 // can't deoptimize. | 3084 // can't deoptimize. |
| 3086 instr->RemoveEnvironment(); | 3085 instr->RemoveEnvironment(); |
| 3087 ReplaceCall(instr, store); | 3086 ReplaceCall(instr, store); |
| 3088 return true; | 3087 return true; |
| 3089 } | 3088 } |
| 3090 | 3089 |
| 3091 | 3090 |
| 3092 } // namespace dart | 3091 } // namespace dart |
| OLD | NEW |