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_inliner.h" | 5 #include "vm/flow_graph_inliner.h" |
6 | 6 |
7 #include "vm/block_scheduler.h" | 7 #include "vm/block_scheduler.h" |
8 #include "vm/compiler.h" | 8 #include "vm/compiler.h" |
9 #include "vm/flags.h" | 9 #include "vm/flags.h" |
10 #include "vm/flow_graph.h" | 10 #include "vm/flow_graph.h" |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 instruction_count_ = 0; | 164 instruction_count_ = 0; |
165 for (BlockIterator block_it = graph.postorder_iterator(); | 165 for (BlockIterator block_it = graph.postorder_iterator(); |
166 !block_it.Done(); | 166 !block_it.Done(); |
167 block_it.Advance()) { | 167 block_it.Advance()) { |
168 for (ForwardInstructionIterator it(block_it.Current()); | 168 for (ForwardInstructionIterator it(block_it.Current()); |
169 !it.Done(); | 169 !it.Done(); |
170 it.Advance()) { | 170 it.Advance()) { |
171 ++instruction_count_; | 171 ++instruction_count_; |
172 Instruction* current = it.Current(); | 172 Instruction* current = it.Current(); |
173 if (current->IsStaticCall() || | 173 if (current->IsStaticCall() || |
174 current->IsClosureCall() || | 174 current->IsClosureCall()) { |
175 (current->IsPolymorphicInstanceCall() && | |
176 !current->AsPolymorphicInstanceCall()->HasRecognizedTarget())) { | |
177 ++call_site_count_; | 175 ++call_site_count_; |
| 176 continue; |
| 177 } |
| 178 if (current->IsPolymorphicInstanceCall()) { |
| 179 PolymorphicInstanceCallInstr* call = |
| 180 current->AsPolymorphicInstanceCall(); |
| 181 // These checks make sure that the number of call-sites counted does |
| 182 // not change relative to the time when the current set of inlining |
| 183 // parameters was fixed. |
| 184 // TODO(fschneider): Determine new heuristic parameters that avoid |
| 185 // these checks entirely. |
| 186 if (!call->HasRecognizedTarget() && |
| 187 (call->instance_call()->token_kind() != Token::kEQ)) { |
| 188 ++call_site_count_; |
| 189 } |
178 } | 190 } |
179 } | 191 } |
180 } | 192 } |
181 } | 193 } |
182 | 194 |
183 intptr_t call_site_count() const { return call_site_count_; } | 195 intptr_t call_site_count() const { return call_site_count_; } |
184 intptr_t instruction_count() const { return instruction_count_; } | 196 intptr_t instruction_count() const { return instruction_count_; } |
185 | 197 |
186 private: | 198 private: |
187 intptr_t call_site_count_; | 199 intptr_t call_site_count_; |
(...skipping 1322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1510 OS::Print("After Inlining of %s\n", flow_graph_-> | 1522 OS::Print("After Inlining of %s\n", flow_graph_-> |
1511 parsed_function().function().ToFullyQualifiedCString()); | 1523 parsed_function().function().ToFullyQualifiedCString()); |
1512 FlowGraphPrinter printer(*flow_graph_); | 1524 FlowGraphPrinter printer(*flow_graph_); |
1513 printer.PrintBlocks(); | 1525 printer.PrintBlocks(); |
1514 } | 1526 } |
1515 } | 1527 } |
1516 } | 1528 } |
1517 } | 1529 } |
1518 | 1530 |
1519 } // namespace dart | 1531 } // namespace dart |
OLD | NEW |