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/intermediate_language.h" | 5 #include "vm/intermediate_language.h" |
6 | 6 |
7 #include "vm/bit_vector.h" | 7 #include "vm/bit_vector.h" |
8 #include "vm/bootstrap.h" | 8 #include "vm/bootstrap.h" |
9 #include "vm/compiler.h" | 9 #include "vm/compiler.h" |
10 #include "vm/constant_propagator.h" | 10 #include "vm/constant_propagator.h" |
(...skipping 3147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3158 compiler->GenerateStaticCall(deopt_id(), instance_call()->token_pos(), | 3158 compiler->GenerateStaticCall(deopt_id(), instance_call()->token_pos(), |
3159 target, instance_call()->ArgumentCount(), | 3159 target, instance_call()->ArgumentCount(), |
3160 instance_call()->argument_names(), locs(), | 3160 instance_call()->argument_names(), locs(), |
3161 ICData::Handle()); | 3161 ICData::Handle()); |
3162 return; | 3162 return; |
3163 } | 3163 } |
3164 | 3164 |
3165 compiler->EmitPolymorphicInstanceCall( | 3165 compiler->EmitPolymorphicInstanceCall( |
3166 ic_data(), instance_call()->ArgumentCount(), | 3166 ic_data(), instance_call()->ArgumentCount(), |
3167 instance_call()->argument_names(), deopt_id(), | 3167 instance_call()->argument_names(), deopt_id(), |
3168 instance_call()->token_pos(), locs(), complete()); | 3168 instance_call()->token_pos(), locs(), complete(), total_ic_count()); |
3169 } | 3169 } |
3170 #endif | 3170 #endif |
3171 | 3171 |
3172 | 3172 |
3173 RawType* PolymorphicInstanceCallInstr::ComputeRuntimeType( | 3173 RawType* PolymorphicInstanceCallInstr::ComputeRuntimeType( |
3174 const ICData& ic_data) { | 3174 const ICData& ic_data) { |
3175 bool is_string = true; | 3175 bool is_string = true; |
3176 bool is_integer = true; | 3176 bool is_integer = true; |
3177 bool is_double = true; | 3177 bool is_double = true; |
3178 | 3178 |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3229 AbstractType::Handle(ComputeRuntimeType(ic_data())); | 3229 AbstractType::Handle(ComputeRuntimeType(ic_data())); |
3230 if (!type.IsNull()) { | 3230 if (!type.IsNull()) { |
3231 return flow_graph->GetConstant(type); | 3231 return flow_graph->GetConstant(type); |
3232 } | 3232 } |
3233 } | 3233 } |
3234 | 3234 |
3235 return this; | 3235 return this; |
3236 } | 3236 } |
3237 | 3237 |
3238 | 3238 |
| 3239 void PolymorphicInstanceCallInstr::InitializeIcCount() { |
| 3240 const intptr_t num_checks = ic_data().NumberOfChecks(); |
| 3241 intptr_t total = 0; |
| 3242 for (intptr_t i = 0; i < num_checks; i++) { |
| 3243 total += ic_data().GetCountAt(i); |
| 3244 } |
| 3245 total_ic_count_ = total; |
| 3246 } |
| 3247 |
| 3248 |
3239 Definition* StaticCallInstr::Canonicalize(FlowGraph* flow_graph) { | 3249 Definition* StaticCallInstr::Canonicalize(FlowGraph* flow_graph) { |
3240 if (!FLAG_precompiled_mode) { | 3250 if (!FLAG_precompiled_mode) { |
3241 return this; | 3251 return this; |
3242 } | 3252 } |
3243 | 3253 |
3244 if (function().recognized_kind() == MethodRecognizer::kObjectRuntimeType) { | 3254 if (function().recognized_kind() == MethodRecognizer::kObjectRuntimeType) { |
3245 if (input_use_list() == NULL) { | 3255 if (input_use_list() == NULL) { |
3246 // This function has only environment uses. In precompiled mode it is | 3256 // This function has only environment uses. In precompiled mode it is |
3247 // fine to remove it - because we will never deoptimize. | 3257 // fine to remove it - because we will never deoptimize. |
3248 return flow_graph->constant_dead(); | 3258 return flow_graph->constant_dead(); |
(...skipping 715 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3964 set_native_c_function(native_function); | 3974 set_native_c_function(native_function); |
3965 function().SetIsNativeAutoSetupScope(auto_setup_scope); | 3975 function().SetIsNativeAutoSetupScope(auto_setup_scope); |
3966 Dart_NativeEntryResolver resolver = library.native_entry_resolver(); | 3976 Dart_NativeEntryResolver resolver = library.native_entry_resolver(); |
3967 bool is_bootstrap_native = Bootstrap::IsBootstapResolver(resolver); | 3977 bool is_bootstrap_native = Bootstrap::IsBootstapResolver(resolver); |
3968 set_is_bootstrap_native(is_bootstrap_native); | 3978 set_is_bootstrap_native(is_bootstrap_native); |
3969 } | 3979 } |
3970 | 3980 |
3971 #undef __ | 3981 #undef __ |
3972 | 3982 |
3973 } // namespace dart | 3983 } // namespace dart |
OLD | NEW |