| 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/flow_graph_optimizer.h" | 5 #include "vm/flow_graph_optimizer.h" |
| 6 | 6 |
| 7 #include "vm/bit_vector.h" | 7 #include "vm/bit_vector.h" |
| 8 #include "vm/cha.h" | 8 #include "vm/cha.h" |
| 9 #include "vm/flow_graph_builder.h" | 9 #include "vm/flow_graph_builder.h" |
| 10 #include "vm/flow_graph_compiler.h" | 10 #include "vm/flow_graph_compiler.h" |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 // This occurs when an instance call has too many checks. | 82 // This occurs when an instance call has too many checks. |
| 83 // TODO(srdjan): Replace IC call with megamorphic call. | 83 // TODO(srdjan): Replace IC call with megamorphic call. |
| 84 return false; | 84 return false; |
| 85 } | 85 } |
| 86 GrowableArray<intptr_t> class_ids(call->ic_data()->num_args_tested()); | 86 GrowableArray<intptr_t> class_ids(call->ic_data()->num_args_tested()); |
| 87 ASSERT(call->ic_data()->num_args_tested() <= call->ArgumentCount()); | 87 ASSERT(call->ic_data()->num_args_tested() <= call->ArgumentCount()); |
| 88 for (intptr_t i = 0; i < call->ic_data()->num_args_tested(); i++) { | 88 for (intptr_t i = 0; i < call->ic_data()->num_args_tested(); i++) { |
| 89 intptr_t cid = call->PushArgumentAt(i)->value()->Type()->ToCid(); | 89 intptr_t cid = call->PushArgumentAt(i)->value()->Type()->ToCid(); |
| 90 class_ids.Add(cid); | 90 class_ids.Add(cid); |
| 91 } | 91 } |
| 92 // TODO(srdjan): Test for other class_ids > 1. | 92 // TODO(srdjan): Test for number of arguments checked greater than 1. |
| 93 if (class_ids.length() != 1) return false; | 93 if (class_ids.length() != 1) { |
| 94 return false; |
| 95 } |
| 94 if (class_ids[0] != kDynamicCid) { | 96 if (class_ids[0] != kDynamicCid) { |
| 95 const intptr_t num_named_arguments = call->argument_names().IsNull() ? | 97 const intptr_t num_named_arguments = call->argument_names().IsNull() ? |
| 96 0 : call->argument_names().Length(); | 98 0 : call->argument_names().Length(); |
| 97 const Class& receiver_class = Class::Handle( | 99 const Class& receiver_class = Class::Handle( |
| 98 Isolate::Current()->class_table()->At(class_ids[0])); | 100 Isolate::Current()->class_table()->At(class_ids[0])); |
| 99 Function& function = Function::Handle(); | 101 Function& function = Function::Handle(); |
| 100 function = Resolver::ResolveDynamicForReceiverClass( | 102 function = Resolver::ResolveDynamicForReceiverClass( |
| 101 receiver_class, | 103 receiver_class, |
| 102 call->function_name(), | 104 call->function_name(), |
| 103 call->ArgumentCount(), | 105 call->ArgumentCount(), |
| (...skipping 4523 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4627 if (changed) { | 4629 if (changed) { |
| 4628 // We may have changed the block order and the dominator tree. | 4630 // We may have changed the block order and the dominator tree. |
| 4629 flow_graph->DiscoverBlocks(); | 4631 flow_graph->DiscoverBlocks(); |
| 4630 GrowableArray<BitVector*> dominance_frontier; | 4632 GrowableArray<BitVector*> dominance_frontier; |
| 4631 flow_graph->ComputeDominators(&dominance_frontier); | 4633 flow_graph->ComputeDominators(&dominance_frontier); |
| 4632 } | 4634 } |
| 4633 } | 4635 } |
| 4634 | 4636 |
| 4635 | 4637 |
| 4636 } // namespace dart | 4638 } // namespace dart |
| OLD | NEW |