| 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 #if !defined(DART_PRECOMPILED_RUNTIME) | 4 #if !defined(DART_PRECOMPILED_RUNTIME) |
| 5 #include "vm/flow_graph_inliner.h" | 5 #include "vm/flow_graph_inliner.h" |
| 6 | 6 |
| 7 #include "vm/aot_optimizer.h" | 7 #include "vm/aot_optimizer.h" |
| 8 #include "vm/precompiler.h" | 8 #include "vm/precompiler.h" |
| 9 #include "vm/block_scheduler.h" | 9 #include "vm/block_scheduler.h" |
| 10 #include "vm/branch_optimizer.h" | 10 #include "vm/branch_optimizer.h" |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 public: | 151 public: |
| 152 GraphInfoCollector() : call_site_count_(0), instruction_count_(0) {} | 152 GraphInfoCollector() : call_site_count_(0), instruction_count_(0) {} |
| 153 | 153 |
| 154 void Collect(const FlowGraph& graph) { | 154 void Collect(const FlowGraph& graph) { |
| 155 call_site_count_ = 0; | 155 call_site_count_ = 0; |
| 156 instruction_count_ = 0; | 156 instruction_count_ = 0; |
| 157 for (BlockIterator block_it = graph.postorder_iterator(); !block_it.Done(); | 157 for (BlockIterator block_it = graph.postorder_iterator(); !block_it.Done(); |
| 158 block_it.Advance()) { | 158 block_it.Advance()) { |
| 159 for (ForwardInstructionIterator it(block_it.Current()); !it.Done(); | 159 for (ForwardInstructionIterator it(block_it.Current()); !it.Done(); |
| 160 it.Advance()) { | 160 it.Advance()) { |
| 161 Instruction* current = it.Current(); |
| 162 // Don't count instructions that won't generate any code. |
| 163 if (current->IsRedefinition()) { |
| 164 continue; |
| 165 } |
| 161 ++instruction_count_; | 166 ++instruction_count_; |
| 162 Instruction* current = it.Current(); | |
| 163 if (current->IsInstanceCall() || current->IsStaticCall() || | 167 if (current->IsInstanceCall() || current->IsStaticCall() || |
| 164 current->IsClosureCall()) { | 168 current->IsClosureCall()) { |
| 165 ++call_site_count_; | 169 ++call_site_count_; |
| 166 continue; | 170 continue; |
| 167 } | 171 } |
| 168 if (current->IsPolymorphicInstanceCall()) { | 172 if (current->IsPolymorphicInstanceCall()) { |
| 169 PolymorphicInstanceCallInstr* call = | 173 PolymorphicInstanceCallInstr* call = |
| 170 current->AsPolymorphicInstanceCall(); | 174 current->AsPolymorphicInstanceCall(); |
| 171 // These checks make sure that the number of call-sites counted does | 175 // These checks make sure that the number of call-sites counted does |
| 172 // not change relative to the time when the current set of inlining | 176 // not change relative to the time when the current set of inlining |
| (...skipping 3646 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3819 } | 3823 } |
| 3820 | 3824 |
| 3821 default: | 3825 default: |
| 3822 return false; | 3826 return false; |
| 3823 } | 3827 } |
| 3824 } | 3828 } |
| 3825 | 3829 |
| 3826 | 3830 |
| 3827 } // namespace dart | 3831 } // namespace dart |
| 3828 #endif // !defined(DART_PRECOMPILED_RUNTIME) | 3832 #endif // !defined(DART_PRECOMPILED_RUNTIME) |
| OLD | NEW |