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 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
284 target_function.AreValidArgumentCounts(call->ArgumentCount(), 0, | 284 target_function.AreValidArgumentCounts(call->ArgumentCount(), 0, |
285 /* error_message = */ NULL)) { | 285 /* error_message = */ NULL)) { |
286 const Class& cls = Class::Handle(Z, target_function.Owner()); | 286 const Class& cls = Class::Handle(Z, target_function.Owner()); |
287 if (!CHA::IsImplemented(cls) && !CHA::HasSubclasses(cls)) { | 287 if (!CHA::IsImplemented(cls) && !CHA::HasSubclasses(cls)) { |
288 const ICData& ic_data = | 288 const ICData& ic_data = |
289 ICData::ZoneHandle(Z, ICData::NewFrom(*call->ic_data(), 1)); | 289 ICData::ZoneHandle(Z, ICData::NewFrom(*call->ic_data(), 1)); |
290 ic_data.AddReceiverCheck(cls.id(), target_function); | 290 ic_data.AddReceiverCheck(cls.id(), target_function); |
291 call->set_ic_data(&ic_data); | 291 call->set_ic_data(&ic_data); |
292 if (has_unique_no_such_method_) { | 292 if (has_unique_no_such_method_) { |
293 call->set_has_unique_selector(true); | 293 call->set_has_unique_selector(true); |
| 294 // Add redefinition of the receiver to prevent code motion across |
| 295 // this call. |
| 296 RedefinitionInstr* redefinition = |
| 297 new (Z) RedefinitionInstr(new (Z) Value(call->ArgumentAt(0))); |
| 298 redefinition->set_ssa_temp_index(flow_graph_->alloc_ssa_temp_index()); |
| 299 redefinition->InsertAfter(call); |
| 300 // Replace all uses of the receiver dominated by this call. |
| 301 FlowGraph::RenameDominatedUses(call->ArgumentAt(0), redefinition, |
| 302 redefinition); |
| 303 if (!redefinition->HasUses()) { |
| 304 redefinition->RemoveFromGraph(); |
| 305 } |
294 } | 306 } |
295 return true; | 307 return true; |
296 } | 308 } |
297 } | 309 } |
298 } | 310 } |
299 | 311 |
300 return false; | 312 return false; |
301 } | 313 } |
302 | 314 |
303 | 315 |
(...skipping 1869 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2173 FlowGraph::kEffect); | 2185 FlowGraph::kEffect); |
2174 current_iterator()->RemoveCurrentFromGraph(); | 2186 current_iterator()->RemoveCurrentFromGraph(); |
2175 } | 2187 } |
2176 } | 2188 } |
2177 } | 2189 } |
2178 } | 2190 } |
2179 | 2191 |
2180 #endif // DART_PRECOMPILER | 2192 #endif // DART_PRECOMPILER |
2181 | 2193 |
2182 } // namespace dart | 2194 } // namespace dart |
OLD | NEW |