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