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

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

Issue 53753003: Cleanups. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 1 month 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 | « runtime/vm/flow_graph_compiler_x64.cc ('k') | runtime/vm/intrinsifier.cc » ('j') | 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/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 1442 matching lines...) Expand 10 before | Expand all | Expand 10 after
1453 // If there are no inlined variants, leave the call in place. 1453 // If there are no inlined variants, leave the call in place.
1454 if (inlined_variants_.is_empty()) return; 1454 if (inlined_variants_.is_empty()) return;
1455 1455
1456 // Now build a decision tree (a DAG because of shared inline variants) and 1456 // Now build a decision tree (a DAG because of shared inline variants) and
1457 // inline it at the call site. 1457 // inline it at the call site.
1458 TargetEntryInstr* entry = BuildDecisionGraph(); 1458 TargetEntryInstr* entry = BuildDecisionGraph();
1459 exit_collector_->ReplaceCall(entry); 1459 exit_collector_->ReplaceCall(entry);
1460 } 1460 }
1461 1461
1462 1462
1463 static uint16_t ClampUint16(intptr_t v) {
1464 return (v > 0xFFFF) ? 0xFFFF : static_cast<uint16_t>(v);
1465 }
1466
1467
1463 void FlowGraphInliner::CollectGraphInfo(FlowGraph* flow_graph) { 1468 void FlowGraphInliner::CollectGraphInfo(FlowGraph* flow_graph) {
1464 GraphInfoCollector info; 1469 GraphInfoCollector info;
1465 info.Collect(*flow_graph); 1470 info.Collect(*flow_graph);
1466 const Function& function = flow_graph->parsed_function().function(); 1471 const Function& function = flow_graph->parsed_function().function();
1467 function.set_optimized_instruction_count( 1472 function.set_optimized_instruction_count(
1468 static_cast<uint16_t>(info.instruction_count())); 1473 ClampUint16(info.instruction_count()));
1469 function.set_optimized_call_site_count( 1474 function.set_optimized_call_site_count(ClampUint16(info.call_site_count()));
1470 static_cast<uint16_t>(info.call_site_count()));
1471 } 1475 }
1472 1476
1473 1477
1474 void FlowGraphInliner::Inline() { 1478 void FlowGraphInliner::Inline() {
1475 // Collect graph info and store it on the function. 1479 // Collect graph info and store it on the function.
1476 // We might later use it for an early bailout from the inlining. 1480 // We might later use it for an early bailout from the inlining.
1477 CollectGraphInfo(flow_graph_); 1481 CollectGraphInfo(flow_graph_);
1478 1482
1479 if ((FLAG_inlining_filter != NULL) && 1483 if ((FLAG_inlining_filter != NULL) &&
1480 (strstr(flow_graph_-> 1484 (strstr(flow_graph_->
(...skipping 25 matching lines...) Expand all
1506 OS::Print("After Inlining of %s\n", flow_graph_-> 1510 OS::Print("After Inlining of %s\n", flow_graph_->
1507 parsed_function().function().ToFullyQualifiedCString()); 1511 parsed_function().function().ToFullyQualifiedCString());
1508 FlowGraphPrinter printer(*flow_graph_); 1512 FlowGraphPrinter printer(*flow_graph_);
1509 printer.PrintBlocks(); 1513 printer.PrintBlocks();
1510 } 1514 }
1511 } 1515 }
1512 } 1516 }
1513 } 1517 }
1514 1518
1515 } // namespace dart 1519 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/flow_graph_compiler_x64.cc ('k') | runtime/vm/intrinsifier.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698