| OLD | NEW |
| 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 #ifndef VM_FLOW_GRAPH_INLINER_H_ | 5 #ifndef VM_FLOW_GRAPH_INLINER_H_ |
| 6 #define VM_FLOW_GRAPH_INLINER_H_ | 6 #define VM_FLOW_GRAPH_INLINER_H_ |
| 7 | 7 |
| 8 #include "vm/allocation.h" | 8 #include "vm/allocation.h" |
| 9 #include "vm/growable_array.h" | 9 #include "vm/growable_array.h" |
| 10 | 10 |
| 11 namespace dart { | 11 namespace dart { |
| 12 | 12 |
| 13 class Field; | 13 class Field; |
| 14 class FlowGraph; | 14 class FlowGraph; |
| 15 class Function; | 15 class Function; |
| 16 | 16 |
| 17 class FlowGraphInliner : ValueObject { | 17 class FlowGraphInliner : ValueObject { |
| 18 public: | 18 public: |
| 19 FlowGraphInliner(FlowGraph* flow_graph, | 19 FlowGraphInliner(FlowGraph* flow_graph, |
| 20 GrowableArray<const Function*>* inline_id_to_function) | 20 GrowableArray<const Function*>* inline_id_to_function); |
| 21 : flow_graph_(flow_graph), inline_id_to_function_(inline_id_to_function) { | |
| 22 } | |
| 23 | 21 |
| 24 // The flow graph is destructively updated upon inlining. | 22 // The flow graph is destructively updated upon inlining. |
| 25 void Inline(); | 23 void Inline(); |
| 26 | 24 |
| 27 // Compute graph info if it was not already computed or if 'force' is true. | 25 // Compute graph info if it was not already computed or if 'force' is true. |
| 28 static void CollectGraphInfo(FlowGraph* flow_graph, bool force = false); | 26 static void CollectGraphInfo(FlowGraph* flow_graph, bool force = false); |
| 29 static void SetInliningId(const FlowGraph& flow_graph, intptr_t inlining_id); | 27 static void SetInliningId(const FlowGraph& flow_graph, intptr_t inlining_id); |
| 30 | 28 |
| 31 static bool AlwaysInline(const Function& function); | 29 bool AlwaysInline(const Function& function); |
| 32 | 30 |
| 33 FlowGraph* flow_graph() const { return flow_graph_; } | 31 FlowGraph* flow_graph() const { return flow_graph_; } |
| 34 intptr_t NextInlineId(const Function& function); | 32 intptr_t NextInlineId(const Function& function); |
| 35 | 33 |
| 34 bool trace_inlining() const { return trace_inlining_; } |
| 35 |
| 36 private: | 36 private: |
| 37 friend class CallSiteInliner; | 37 friend class CallSiteInliner; |
| 38 | 38 |
| 39 FlowGraph* flow_graph_; | 39 FlowGraph* flow_graph_; |
| 40 GrowableArray<const Function*>* inline_id_to_function_; | 40 GrowableArray<const Function*>* inline_id_to_function_; |
| 41 const bool trace_inlining_; |
| 41 | 42 |
| 42 DISALLOW_COPY_AND_ASSIGN(FlowGraphInliner); | 43 DISALLOW_COPY_AND_ASSIGN(FlowGraphInliner); |
| 43 }; | 44 }; |
| 44 | 45 |
| 45 } // namespace dart | 46 } // namespace dart |
| 46 | 47 |
| 47 #endif // VM_FLOW_GRAPH_INLINER_H_ | 48 #endif // VM_FLOW_GRAPH_INLINER_H_ |
| OLD | NEW |