| 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/aot_optimizer.h" | 5 #include "vm/aot_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 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 280 } | 280 } |
| 281 return true; | 281 return true; |
| 282 } | 282 } |
| 283 } | 283 } |
| 284 } | 284 } |
| 285 | 285 |
| 286 return false; | 286 return false; |
| 287 } | 287 } |
| 288 | 288 |
| 289 | 289 |
| 290 const ICData& AotOptimizer::TrySpecializeICData(const ICData& ic_data, | |
| 291 intptr_t cid) { | |
| 292 ASSERT(ic_data.NumArgsTested() == 1); | |
| 293 | |
| 294 if ((ic_data.NumberOfUsedChecks() == 1) && ic_data.HasReceiverClassId(cid)) { | |
| 295 return ic_data; // Nothing to do | |
| 296 } | |
| 297 | |
| 298 const Function& function = | |
| 299 Function::Handle(Z, ic_data.GetTargetForReceiverClassId(cid)); | |
| 300 // TODO(fschneider): Try looking up the function on the class if it is | |
| 301 // not found in the ICData. | |
| 302 if (!function.IsNull()) { | |
| 303 const ICData& new_ic_data = ICData::ZoneHandle( | |
| 304 Z, ICData::New(Function::Handle(Z, ic_data.Owner()), | |
| 305 String::Handle(Z, ic_data.target_name()), | |
| 306 Object::empty_array(), // Dummy argument descriptor. | |
| 307 ic_data.deopt_id(), ic_data.NumArgsTested(), false)); | |
| 308 new_ic_data.SetDeoptReasons(ic_data.DeoptReasons()); | |
| 309 new_ic_data.AddReceiverCheck(cid, function); | |
| 310 return new_ic_data; | |
| 311 } | |
| 312 | |
| 313 return ic_data; | |
| 314 } | |
| 315 | |
| 316 | |
| 317 static bool ClassIdIsOneOf(intptr_t class_id, | 290 static bool ClassIdIsOneOf(intptr_t class_id, |
| 318 const GrowableArray<intptr_t>& class_ids) { | 291 const GrowableArray<intptr_t>& class_ids) { |
| 319 for (intptr_t i = 0; i < class_ids.length(); i++) { | 292 for (intptr_t i = 0; i < class_ids.length(); i++) { |
| 320 ASSERT(class_ids[i] != kIllegalCid); | 293 ASSERT(class_ids[i] != kIllegalCid); |
| 321 if (class_ids[i] == class_id) { | 294 if (class_ids[i] == class_id) { |
| 322 return true; | 295 return true; |
| 323 } | 296 } |
| 324 } | 297 } |
| 325 return false; | 298 return false; |
| 326 } | 299 } |
| (...skipping 1849 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2176 FlowGraph::kEffect); | 2149 FlowGraph::kEffect); |
| 2177 current_iterator()->RemoveCurrentFromGraph(); | 2150 current_iterator()->RemoveCurrentFromGraph(); |
| 2178 } | 2151 } |
| 2179 } | 2152 } |
| 2180 } | 2153 } |
| 2181 } | 2154 } |
| 2182 | 2155 |
| 2183 #endif // DART_PRECOMPILER | 2156 #endif // DART_PRECOMPILER |
| 2184 | 2157 |
| 2185 } // namespace dart | 2158 } // namespace dart |
| OLD | NEW |