Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(606)

Side by Side Diff: runtime/vm/flow_graph_inliner.cc

Issue 17749004: Fix bot redness: max_calls can be zero if no call was actually executed. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/compiler.h" 7 #include "vm/compiler.h"
8 #include "vm/flags.h" 8 #include "vm/flags.h"
9 #include "vm/flow_graph.h" 9 #include "vm/flow_graph.h"
10 #include "vm/flow_graph_builder.h" 10 #include "vm/flow_graph_builder.h"
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 245
246 GrowableArray<intptr_t> static_call_counts(num_static_calls); 246 GrowableArray<intptr_t> static_call_counts(num_static_calls);
247 for (intptr_t i = 0; i < num_static_calls; ++i) { 247 for (intptr_t i = 0; i < num_static_calls; ++i) {
248 const intptr_t aggregate_count = 248 const intptr_t aggregate_count =
249 static_calls_[i + static_call_start_ix]. 249 static_calls_[i + static_call_start_ix].
250 call->ic_data()->AggregateCount(); 250 call->ic_data()->AggregateCount();
251 static_call_counts.Add(aggregate_count); 251 static_call_counts.Add(aggregate_count);
252 if (aggregate_count > max_count) max_count = aggregate_count; 252 if (aggregate_count > max_count) max_count = aggregate_count;
253 } 253 }
254 254
255 255 // max_count can be 0 if none of the calls was executed.
256 for (intptr_t i = 0; i < num_instance_calls; ++i) { 256 for (intptr_t i = 0; i < num_instance_calls; ++i) {
257 ASSERT(max_count > 0); 257 const double ratio = (max_count == 0) ?
258 const double ratio = 258 0.0 : static_cast<double>(instance_call_counts[i]) / max_count;
259 static_cast<double>(instance_call_counts[i]) / max_count;
260 instance_calls_[i + instance_call_start_ix].ratio = ratio; 259 instance_calls_[i + instance_call_start_ix].ratio = ratio;
261 } 260 }
262 for (intptr_t i = 0; i < num_static_calls; ++i) { 261 for (intptr_t i = 0; i < num_static_calls; ++i) {
263 ASSERT(max_count > 0); 262 const double ratio = (max_count == 0) ?
264 const double ratio = 263 0.0 : static_cast<double>(static_call_counts[i]) / max_count;
265 static_cast<double>(static_call_counts[i]) / max_count;
266 static_calls_[i + static_call_start_ix].ratio = ratio; 264 static_calls_[i + static_call_start_ix].ratio = ratio;
267 } 265 }
268 } 266 }
269 267
270 void FindCallSites(FlowGraph* graph) { 268 void FindCallSites(FlowGraph* graph) {
271 ASSERT(graph != NULL); 269 ASSERT(graph != NULL);
272 270
273 const intptr_t instance_call_start_ix = instance_calls_.length(); 271 const intptr_t instance_call_start_ix = instance_calls_.length();
274 const intptr_t static_call_start_ix = static_calls_.length(); 272 const intptr_t static_call_start_ix = static_calls_.length();
275 for (BlockIterator block_it = graph->postorder_iterator(); 273 for (BlockIterator block_it = graph->postorder_iterator();
(...skipping 1092 matching lines...) Expand 10 before | Expand all | Expand 10 after
1368 OS::Print("After Inlining of %s\n", flow_graph_-> 1366 OS::Print("After Inlining of %s\n", flow_graph_->
1369 parsed_function().function().ToFullyQualifiedCString()); 1367 parsed_function().function().ToFullyQualifiedCString());
1370 FlowGraphPrinter printer(*flow_graph_); 1368 FlowGraphPrinter printer(*flow_graph_);
1371 printer.PrintBlocks(); 1369 printer.PrintBlocks();
1372 } 1370 }
1373 } 1371 }
1374 } 1372 }
1375 } 1373 }
1376 1374
1377 } // namespace dart 1375 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698