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

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

Issue 10704119: Use the instruction iterator rather than an explicit loop in more places. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 5 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.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 9
10 namespace dart { 10 namespace dart {
(...skipping 15 matching lines...) Expand all
26 virtual void VisitStoreIndexed(StoreIndexedComp* comp, BindInstr* instr); 26 virtual void VisitStoreIndexed(StoreIndexedComp* comp, BindInstr* instr);
27 virtual void VisitRelationalOp(RelationalOpComp* comp, BindInstr* instr); 27 virtual void VisitRelationalOp(RelationalOpComp* comp, BindInstr* instr);
28 28
29 virtual void VisitStrictCompare(StrictCompareComp* comp, BindInstr* instr); 29 virtual void VisitStrictCompare(StrictCompareComp* comp, BindInstr* instr);
30 virtual void VisitEqualityCompare(EqualityCompareComp* comp, 30 virtual void VisitEqualityCompare(EqualityCompareComp* comp,
31 BindInstr* instr); 31 BindInstr* instr);
32 32
33 virtual void VisitBind(BindInstr* instr); 33 virtual void VisitBind(BindInstr* instr);
34 34
35 private: 35 private:
36 void VisitBlocks();
37
38 bool TryReplaceWithBinaryOp(BindInstr* instr, 36 bool TryReplaceWithBinaryOp(BindInstr* instr,
39 InstanceCallComp* comp, 37 InstanceCallComp* comp,
40 Token::Kind op_kind); 38 Token::Kind op_kind);
41 bool TryReplaceWithUnaryOp(BindInstr* instr, 39 bool TryReplaceWithUnaryOp(BindInstr* instr,
42 InstanceCallComp* comp, 40 InstanceCallComp* comp,
43 Token::Kind op_kind); 41 Token::Kind op_kind);
44 42
45 bool TryInlineInstanceGetter(BindInstr* instr, 43 bool TryInlineInstanceGetter(BindInstr* instr,
46 InstanceCallComp* comp); 44 InstanceCallComp* comp);
47 bool TryInlineInstanceSetter(BindInstr* instr, InstanceSetterComp* comp); 45 bool TryInlineInstanceSetter(BindInstr* instr, InstanceSetterComp* comp);
48 46
49 bool TryInlineInstanceMethod(BindInstr* instr, InstanceCallComp* comp); 47 bool TryInlineInstanceMethod(BindInstr* instr, InstanceCallComp* comp);
50 48
51 DISALLOW_COPY_AND_ASSIGN(FlowGraphOptimizer); 49 DISALLOW_COPY_AND_ASSIGN(FlowGraphOptimizer);
52 }; 50 };
53 51
54 52
55 // Analyze the generated flow graph. Currently only if it is a leaf 53 // Analyze the generated flow graph. Currently only if it is a leaf
56 // method, i.e., does not contain any calls to runtime or other Dart code. 54 // method, i.e., does not contain any calls to runtime or other Dart code.
57 class FlowGraphAnalyzer : public ValueObject { 55 class FlowGraphAnalyzer : public ValueObject {
58 public: 56 public:
59 explicit FlowGraphAnalyzer(const GrowableArray<BlockEntryInstr*>& blocks); 57 explicit FlowGraphAnalyzer(const GrowableArray<BlockEntryInstr*>& blocks)
58 : blocks_(blocks), is_leaf_(false) {}
60 virtual ~FlowGraphAnalyzer() {} 59 virtual ~FlowGraphAnalyzer() {}
61 60
62 void Analyze(); 61 void Analyze();
63 62
64 bool is_leaf() const { return is_leaf_; } 63 bool is_leaf() const { return is_leaf_; }
65 64
66 private: 65 private:
67 const GrowableArray<BlockEntryInstr*>& blocks_; 66 const GrowableArray<BlockEntryInstr*>& blocks_;
68 bool is_leaf_; 67 bool is_leaf_;
69 68
70 DISALLOW_COPY_AND_ASSIGN(FlowGraphAnalyzer); 69 DISALLOW_COPY_AND_ASSIGN(FlowGraphAnalyzer);
71 }; 70 };
72 71
73 } // namespace dart 72 } // namespace dart
74 73
75 #endif // VM_FLOW_GRAPH_OPTIMIZER_H_ 74 #endif // VM_FLOW_GRAPH_OPTIMIZER_H_
OLDNEW
« no previous file with comments | « runtime/vm/flow_graph_compiler.cc ('k') | runtime/vm/flow_graph_optimizer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698