Chromium Code Reviews| 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 455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 466 &inlined_info_); | 466 &inlined_info_); |
| 467 while (collected_call_sites_->HasCalls()) { | 467 while (collected_call_sites_->HasCalls()) { |
| 468 TRACE_INLINING(OS::Print(" Depth %" Pd " ----------\n", | 468 TRACE_INLINING(OS::Print(" Depth %" Pd " ----------\n", |
| 469 inlining_depth_)); | 469 inlining_depth_)); |
| 470 // Swap collected and inlining arrays and clear the new collecting array. | 470 // Swap collected and inlining arrays and clear the new collecting array. |
| 471 call_sites_temp = collected_call_sites_; | 471 call_sites_temp = collected_call_sites_; |
| 472 collected_call_sites_ = inlining_call_sites_; | 472 collected_call_sites_ = inlining_call_sites_; |
| 473 inlining_call_sites_ = call_sites_temp; | 473 inlining_call_sites_ = call_sites_temp; |
| 474 collected_call_sites_->Clear(); | 474 collected_call_sites_->Clear(); |
| 475 // Inline call sites at the current depth. | 475 // Inline call sites at the current depth. |
| 476 InlineInstanceCalls(); | |
|
srdjan
2014/04/09 18:28:43
Any reason for changing the order?
Florian Schneider
2014/04/10 08:49:25
The reason is that dispatchers are instance calls,
| |
| 476 InlineStaticCalls(); | 477 InlineStaticCalls(); |
| 477 InlineClosureCalls(); | 478 InlineClosureCalls(); |
| 478 InlineInstanceCalls(); | |
| 479 // Increment the inlining depth. Checked before recursive inlining. | 479 // Increment the inlining depth. Checked before recursive inlining. |
| 480 ++inlining_depth_; | 480 ++inlining_depth_; |
| 481 } | 481 } |
| 482 collected_call_sites_ = NULL; | 482 collected_call_sites_ = NULL; |
| 483 inlining_call_sites_ = NULL; | 483 inlining_call_sites_ = NULL; |
| 484 } | 484 } |
| 485 | 485 |
| 486 bool inlined() const { return inlined_; } | 486 bool inlined() const { return inlined_; } |
| 487 | 487 |
| 488 double GrowthFactor() const { | 488 double GrowthFactor() const { |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 705 call_site_count, | 705 call_site_count, |
| 706 constants_count)); | 706 constants_count)); |
| 707 if (FLAG_print_inlining_tree) { | 707 if (FLAG_print_inlining_tree) { |
| 708 inlined_info_.Add(InlinedInfo( | 708 inlined_info_.Add(InlinedInfo( |
| 709 &call_data->caller, &function, inlining_depth_, call_data->call, | 709 &call_data->caller, &function, inlining_depth_, call_data->call, |
| 710 "Heuristic fail")); | 710 "Heuristic fail")); |
| 711 } | 711 } |
| 712 return false; | 712 return false; |
| 713 } | 713 } |
| 714 | 714 |
| 715 collected_call_sites_->FindCallSites(callee_graph, | 715 if (function.IsInvokeFieldDispatcher() || |
| 716 inlining_depth_, | 716 function.IsNoSuchMethodDispatcher()) { |
| 717 &inlined_info_); | 717 // Append call sites to the currently processed list so that dispatcher |
| 718 // methods get inlined regardless of the current depth. | |
| 719 inlining_call_sites_->FindCallSites(callee_graph, | |
| 720 0, | |
| 721 &inlined_info_); | |
| 722 } else { | |
| 723 collected_call_sites_->FindCallSites(callee_graph, | |
| 724 inlining_depth_, | |
| 725 &inlined_info_); | |
| 726 } | |
| 718 | 727 |
| 719 // Add the function to the cache. | 728 // Add the function to the cache. |
| 720 if (!in_cache) { | 729 if (!in_cache) { |
| 721 function_cache_.Add(parsed_function); | 730 function_cache_.Add(parsed_function); |
| 722 } | 731 } |
| 723 | 732 |
| 724 // Build succeeded so we restore the bailout jump. | 733 // Build succeeded so we restore the bailout jump. |
| 725 inlined_ = true; | 734 inlined_ = true; |
| 726 inlined_size_ += size; | 735 inlined_size_ += size; |
| 727 isolate->set_deopt_id(prev_deopt_id); | 736 isolate->set_deopt_id(prev_deopt_id); |
| (...skipping 920 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1648 OS::Print("After Inlining of %s\n", flow_graph_-> | 1657 OS::Print("After Inlining of %s\n", flow_graph_-> |
| 1649 parsed_function().function().ToFullyQualifiedCString()); | 1658 parsed_function().function().ToFullyQualifiedCString()); |
| 1650 FlowGraphPrinter printer(*flow_graph_); | 1659 FlowGraphPrinter printer(*flow_graph_); |
| 1651 printer.PrintBlocks(); | 1660 printer.PrintBlocks(); |
| 1652 } | 1661 } |
| 1653 } | 1662 } |
| 1654 } | 1663 } |
| 1655 } | 1664 } |
| 1656 | 1665 |
| 1657 } // namespace dart | 1666 } // namespace dart |
| OLD | NEW |