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

Side by Side Diff: runtime/vm/flow_graph_optimizer.h

Issue 10832411: Remove support for non-ssa optimizing code generation. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: disable optimizations on bailout Created 8 years, 4 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_compiler_x64.cc ('k') | runtime/vm/flow_graph_optimizer.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) 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_OPTIMIZER_H_ 5 #ifndef VM_FLOW_GRAPH_OPTIMIZER_H_
6 #define VM_FLOW_GRAPH_OPTIMIZER_H_ 6 #define VM_FLOW_GRAPH_OPTIMIZER_H_
7 7
8 #include "vm/intermediate_language.h" 8 #include "vm/intermediate_language.h"
9 #include "vm/flow_graph.h" 9 #include "vm/flow_graph.h"
10 10
11 namespace dart { 11 namespace dart {
12 12
13 template <typename T> class GrowableArray; 13 template <typename T> class GrowableArray;
14 14
15 class FlowGraphOptimizer : public FlowGraphVisitor { 15 class FlowGraphOptimizer : public FlowGraphVisitor {
16 public: 16 public:
17 FlowGraphOptimizer(const FlowGraph& flow_graph, bool use_ssa) 17 explicit FlowGraphOptimizer(const FlowGraph& flow_graph)
18 : FlowGraphVisitor(flow_graph.reverse_postorder()), use_ssa_(use_ssa) {} 18 : FlowGraphVisitor(flow_graph.reverse_postorder()) {}
19 virtual ~FlowGraphOptimizer() {} 19 virtual ~FlowGraphOptimizer() {}
20 20
21 void ApplyICData(); 21 void ApplyICData();
22 22
23 void OptimizeComputations(); 23 void OptimizeComputations();
24 24
25 virtual void VisitStaticCall(StaticCallComp* comp, BindInstr* instr); 25 virtual void VisitStaticCall(StaticCallComp* comp, BindInstr* instr);
26 virtual void VisitInstanceCall(InstanceCallComp* comp, BindInstr* instr); 26 virtual void VisitInstanceCall(InstanceCallComp* comp, BindInstr* instr);
27 virtual void VisitRelationalOp(RelationalOpComp* comp, BindInstr* instr); 27 virtual void VisitRelationalOp(RelationalOpComp* comp, BindInstr* instr);
28 virtual void VisitEqualityCompare(EqualityCompareComp* comp, 28 virtual void VisitEqualityCompare(EqualityCompareComp* comp,
(...skipping 11 matching lines...) Expand all
40 bool TryReplaceWithUnaryOp(BindInstr* instr, 40 bool TryReplaceWithUnaryOp(BindInstr* instr,
41 InstanceCallComp* comp, 41 InstanceCallComp* comp,
42 Token::Kind op_kind); 42 Token::Kind op_kind);
43 43
44 bool TryInlineInstanceGetter(BindInstr* instr, 44 bool TryInlineInstanceGetter(BindInstr* instr,
45 InstanceCallComp* comp); 45 InstanceCallComp* comp);
46 bool TryInlineInstanceSetter(BindInstr* instr, InstanceCallComp* comp); 46 bool TryInlineInstanceSetter(BindInstr* instr, InstanceCallComp* comp);
47 47
48 bool TryInlineInstanceMethod(BindInstr* instr, InstanceCallComp* comp); 48 bool TryInlineInstanceMethod(BindInstr* instr, InstanceCallComp* comp);
49 49
50 bool use_ssa_;
51
52 DISALLOW_COPY_AND_ASSIGN(FlowGraphOptimizer); 50 DISALLOW_COPY_AND_ASSIGN(FlowGraphOptimizer);
53 }; 51 };
54 52
55 53
56 // Analyze the generated flow graph. Currently only if it is a leaf 54 // Analyze the generated flow graph. Currently only if it is a leaf
57 // method, i.e., does not contain any calls to runtime or other Dart code. 55 // method, i.e., does not contain any calls to runtime or other Dart code.
58 class FlowGraphAnalyzer : public ValueObject { 56 class FlowGraphAnalyzer : public ValueObject {
59 public: 57 public:
60 explicit FlowGraphAnalyzer(const FlowGraph& flow_graph) 58 explicit FlowGraphAnalyzer(const FlowGraph& flow_graph)
61 : blocks_(flow_graph.reverse_postorder()), is_leaf_(false) {} 59 : blocks_(flow_graph.reverse_postorder()), is_leaf_(false) {}
62 virtual ~FlowGraphAnalyzer() {} 60 virtual ~FlowGraphAnalyzer() {}
63 61
64 void Analyze(); 62 void Analyze();
65 63
66 bool is_leaf() const { return is_leaf_; } 64 bool is_leaf() const { return is_leaf_; }
67 65
68 private: 66 private:
69 const GrowableArray<BlockEntryInstr*>& blocks_; 67 const GrowableArray<BlockEntryInstr*>& blocks_;
70 bool is_leaf_; 68 bool is_leaf_;
71 69
72 DISALLOW_COPY_AND_ASSIGN(FlowGraphAnalyzer); 70 DISALLOW_COPY_AND_ASSIGN(FlowGraphAnalyzer);
73 }; 71 };
74 72
75 73
76 class ParsedFunction; 74 class ParsedFunction;
77 75
78 76
79 class FlowGraphTypePropagator : public FlowGraphVisitor { 77 class FlowGraphTypePropagator : public FlowGraphVisitor {
80 public: 78 public:
81 explicit FlowGraphTypePropagator(const FlowGraph& flow_graph, 79 explicit FlowGraphTypePropagator(const FlowGraph& flow_graph)
82 bool is_ssa)
83 : FlowGraphVisitor(flow_graph.reverse_postorder()), 80 : FlowGraphVisitor(flow_graph.reverse_postorder()),
84 parsed_function_(flow_graph.parsed_function()), 81 parsed_function_(flow_graph.parsed_function()),
85 is_ssa_(is_ssa),
86 still_changing_(false) { } 82 still_changing_(false) { }
87 virtual ~FlowGraphTypePropagator() { } 83 virtual ~FlowGraphTypePropagator() { }
88 84
89 const ParsedFunction& parsed_function() const { return parsed_function_; } 85 const ParsedFunction& parsed_function() const { return parsed_function_; }
90 86
91 void PropagateTypes(); 87 void PropagateTypes();
92 88
93 virtual void VisitAssertAssignable(AssertAssignableComp* comp, 89 virtual void VisitAssertAssignable(AssertAssignableComp* comp,
94 BindInstr* instr); 90 BindInstr* instr);
95 virtual void VisitAssertBoolean(AssertBooleanComp* comp, BindInstr* instr); 91 virtual void VisitAssertBoolean(AssertBooleanComp* comp, BindInstr* instr);
96 virtual void VisitInstanceOf(InstanceOfComp* comp, BindInstr* instr); 92 virtual void VisitInstanceOf(InstanceOfComp* comp, BindInstr* instr);
97 93
98 virtual void VisitGraphEntry(GraphEntryInstr* graph_entry); 94 virtual void VisitGraphEntry(GraphEntryInstr* graph_entry);
99 virtual void VisitJoinEntry(JoinEntryInstr* join_entry); 95 virtual void VisitJoinEntry(JoinEntryInstr* join_entry);
100 virtual void VisitBind(BindInstr* bind); 96 virtual void VisitBind(BindInstr* bind);
101 virtual void VisitPhi(PhiInstr* phi); 97 virtual void VisitPhi(PhiInstr* phi);
102 virtual void VisitParameter(ParameterInstr* param); 98 virtual void VisitParameter(ParameterInstr* param);
103 virtual void VisitPushArgument(PushArgumentInstr* bind); 99 virtual void VisitPushArgument(PushArgumentInstr* bind);
104 100
105 private: 101 private:
106 const ParsedFunction& parsed_function_; 102 const ParsedFunction& parsed_function_;
107 const bool is_ssa_; // TODO(regis): Remove once virtual frame backend is
108 // removed.
109 bool still_changing_; 103 bool still_changing_;
110 DISALLOW_COPY_AND_ASSIGN(FlowGraphTypePropagator); 104 DISALLOW_COPY_AND_ASSIGN(FlowGraphTypePropagator);
111 }; 105 };
112 106
113 107
114 class LocalCSE : public ValueObject { 108 class LocalCSE : public ValueObject {
115 public: 109 public:
116 explicit LocalCSE(const FlowGraph& flow_graph) 110 explicit LocalCSE(const FlowGraph& flow_graph)
117 : blocks_(flow_graph.reverse_postorder()) { } 111 : blocks_(flow_graph.reverse_postorder()) { }
118 112
119 void Optimize(); 113 void Optimize();
120 114
121 private: 115 private:
122 const GrowableArray<BlockEntryInstr*>& blocks_; 116 const GrowableArray<BlockEntryInstr*>& blocks_;
123 117
124 DISALLOW_COPY_AND_ASSIGN(LocalCSE); 118 DISALLOW_COPY_AND_ASSIGN(LocalCSE);
125 }; 119 };
126 120
127 121
128 } // namespace dart 122 } // namespace dart
129 123
130 #endif // VM_FLOW_GRAPH_OPTIMIZER_H_ 124 #endif // VM_FLOW_GRAPH_OPTIMIZER_H_
OLDNEW
« no previous file with comments | « runtime/vm/flow_graph_compiler_x64.cc ('k') | runtime/vm/flow_graph_optimizer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698