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

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

Issue 10989016: Add is_inlinable field to functions. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Use bit field Created 8 years, 2 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 | « runtime/vm/flow_graph_builder.cc ('k') | runtime/vm/object.h » ('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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 23 matching lines...) Expand all
34 : FlowGraphVisitor(flow_graph->postorder()), 34 : FlowGraphVisitor(flow_graph->postorder()),
35 caller_graph_(flow_graph), 35 caller_graph_(flow_graph),
36 next_ssa_temp_index_(flow_graph->max_virtual_register_number()), 36 next_ssa_temp_index_(flow_graph->max_virtual_register_number()),
37 inlined_(false) { } 37 inlined_(false) { }
38 38
39 bool TryInlining(const Function& function, 39 bool TryInlining(const Function& function,
40 GrowableArray<Value*>* arguments, 40 GrowableArray<Value*>* arguments,
41 Definition* call) { 41 Definition* call) {
42 TRACE_INLINING(OS::Print(" => %s\n", function.ToCString())); 42 TRACE_INLINING(OS::Print(" => %s\n", function.ToCString()));
43 43
44 // Abort if the inlinable bit on the function is low.
45 if (!function.is_inlinable()) {
46 TRACE_INLINING(OS::Print(" Bailout: not inlinable\n"));
47 return false;
48 }
49
44 // Abort if the callee has optional parameters. 50 // Abort if the callee has optional parameters.
45 if (function.HasOptionalParameters()) { 51 if (function.HasOptionalParameters()) {
46 TRACE_INLINING(OS::Print(" Bailout: optional parameters\n")); 52 TRACE_INLINING(OS::Print(" Bailout: optional parameters\n"));
47 return false; 53 return false;
48 } 54 }
49 55
50 // Assuming no optional parameters the actual/formal count should match. 56 // Assuming no optional parameters the actual/formal count should match.
51 ASSERT(arguments->length() == function.num_fixed_parameters()); 57 ASSERT(arguments->length() == function.num_fixed_parameters());
52 58
53 // Abort if the callee has an intrinsic translation. 59 // Abort if the callee has an intrinsic translation.
54 if (Intrinsifier::CanIntrinsify(function)) { 60 if (Intrinsifier::CanIntrinsify(function)) {
61 function.set_is_inlinable(false);
55 TRACE_INLINING(OS::Print(" Bailout: can intrinsify\n")); 62 TRACE_INLINING(OS::Print(" Bailout: can intrinsify\n"));
56 return false; 63 return false;
57 } 64 }
58 65
59 Isolate* isolate = Isolate::Current(); 66 Isolate* isolate = Isolate::Current();
60 // Save and clear IC data. 67 // Save and clear IC data.
61 const Array& prev_ic_data = Array::Handle(isolate->ic_data_array()); 68 const Array& prev_ic_data = Array::Handle(isolate->ic_data_array());
62 isolate->set_ic_data_array(Array::null()); 69 isolate->set_ic_data_array(Array::null());
63 // Save and clear deopt id. 70 // Save and clear deopt id.
64 const intptr_t prev_deopt_id = isolate->deopt_id(); 71 const intptr_t prev_deopt_id = isolate->deopt_id();
(...skipping 17 matching lines...) Expand all
82 isolate->set_ic_data_array(unoptimized_code.ExtractTypeFeedbackArray()); 89 isolate->set_ic_data_array(unoptimized_code.ExtractTypeFeedbackArray());
83 } 90 }
84 91
85 // Build the callee graph. 92 // Build the callee graph.
86 FlowGraphBuilder builder(parsed_function); 93 FlowGraphBuilder builder(parsed_function);
87 FlowGraph* callee_graph = 94 FlowGraph* callee_graph =
88 builder.BuildGraph(FlowGraphBuilder::kValueContext); 95 builder.BuildGraph(FlowGraphBuilder::kValueContext);
89 96
90 // Abort if the callee graph contains control flow. 97 // Abort if the callee graph contains control flow.
91 if (callee_graph->preorder().length() != 2) { 98 if (callee_graph->preorder().length() != 2) {
99 function.set_is_inlinable(false);
92 isolate->set_long_jump_base(base); 100 isolate->set_long_jump_base(base);
93 isolate->set_ic_data_array(prev_ic_data.raw()); 101 isolate->set_ic_data_array(prev_ic_data.raw());
94 TRACE_INLINING(OS::Print(" Bailout: control flow\n")); 102 TRACE_INLINING(OS::Print(" Bailout: control flow\n"));
95 return false; 103 return false;
96 } 104 }
97 105
98 // Compute SSA on the callee graph, catching bailouts. 106 // Compute SSA on the callee graph, catching bailouts.
99 callee_graph->ComputeSSA(next_ssa_temp_index_); 107 callee_graph->ComputeSSA(next_ssa_temp_index_);
100 callee_graph->ComputeUseLists(); 108 callee_graph->ComputeUseLists();
101 109
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 if (FLAG_trace_inlining && FLAG_print_flow_graph) { 251 if (FLAG_trace_inlining && FLAG_print_flow_graph) {
244 OS::Print("After Inlining of %s\n", flow_graph_-> 252 OS::Print("After Inlining of %s\n", flow_graph_->
245 parsed_function().function().ToFullyQualifiedCString()); 253 parsed_function().function().ToFullyQualifiedCString());
246 FlowGraphPrinter printer(*flow_graph_); 254 FlowGraphPrinter printer(*flow_graph_);
247 printer.PrintBlocks(); 255 printer.PrintBlocks();
248 } 256 }
249 } 257 }
250 } 258 }
251 259
252 } // namespace dart 260 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/flow_graph_builder.cc ('k') | runtime/vm/object.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698