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

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

Issue 10700123: Remove the instruction pointer from computations. (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 | « no previous file | 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 {
11 11
12 template <typename T> class GrowableArray; 12 template <typename T> class GrowableArray;
13 13
14 class FlowGraphOptimizer : public FlowGraphVisitor { 14 class FlowGraphOptimizer : public FlowGraphVisitor {
15 public: 15 public:
16 explicit FlowGraphOptimizer(const GrowableArray<BlockEntryInstr*>& blocks) 16 explicit FlowGraphOptimizer(const GrowableArray<BlockEntryInstr*>& blocks)
17 : FlowGraphVisitor(blocks) {} 17 : FlowGraphVisitor(blocks) {}
18 virtual ~FlowGraphOptimizer() {} 18 virtual ~FlowGraphOptimizer() {}
19 19
20 void ApplyICData(); 20 void ApplyICData();
21 21
22 virtual void VisitStaticCall(StaticCallComp* comp); 22 virtual void VisitStaticCall(StaticCallComp* comp, BindInstr* instr);
23 virtual void VisitInstanceCall(InstanceCallComp* comp); 23 virtual void VisitInstanceCall(InstanceCallComp* comp, BindInstr* instr);
24 virtual void VisitInstanceSetter(InstanceSetterComp* comp); 24 virtual void VisitInstanceSetter(InstanceSetterComp* comp, BindInstr* instr);
25 virtual void VisitLoadIndexed(LoadIndexedComp* comp); 25 virtual void VisitLoadIndexed(LoadIndexedComp* comp, BindInstr* instr);
26 virtual void VisitStoreIndexed(StoreIndexedComp* comp); 26 virtual void VisitStoreIndexed(StoreIndexedComp* comp, BindInstr* instr);
27 virtual void VisitRelationalOp(RelationalOpComp* comp); 27 virtual void VisitRelationalOp(RelationalOpComp* comp, BindInstr* instr);
28 28
29 virtual void VisitStrictCompare(StrictCompareComp* comp); 29 virtual void VisitStrictCompare(StrictCompareComp* comp, BindInstr* instr);
30 virtual void VisitEqualityCompare(EqualityCompareComp* comp); 30 virtual void VisitEqualityCompare(EqualityCompareComp* comp,
31 BindInstr* instr);
31 32
32 virtual void VisitBind(BindInstr* instr); 33 virtual void VisitBind(BindInstr* instr);
33 34
34 private: 35 private:
35 void VisitBlocks(); 36 void VisitBlocks();
36 37
37 bool TryReplaceWithBinaryOp(InstanceCallComp* comp, Token::Kind op_kind); 38 bool TryReplaceWithBinaryOp(BindInstr* instr,
38 bool TryReplaceWithUnaryOp(InstanceCallComp* comp, Token::Kind op_kind); 39 InstanceCallComp* comp,
40 Token::Kind op_kind);
41 bool TryReplaceWithUnaryOp(BindInstr* instr,
42 InstanceCallComp* comp,
43 Token::Kind op_kind);
39 44
40 bool TryInlineInstanceGetter(InstanceCallComp* comp); 45 bool TryInlineInstanceGetter(BindInstr* instr,
41 bool TryInlineInstanceSetter(InstanceSetterComp* comp); 46 InstanceCallComp* comp);
47 bool TryInlineInstanceSetter(BindInstr* instr, InstanceSetterComp* comp);
42 48
43 bool TryInlineInstanceMethod(InstanceCallComp* comp); 49 bool TryInlineInstanceMethod(BindInstr* instr, InstanceCallComp* comp);
44 50
45 DISALLOW_COPY_AND_ASSIGN(FlowGraphOptimizer); 51 DISALLOW_COPY_AND_ASSIGN(FlowGraphOptimizer);
46 }; 52 };
47 53
48 54
49 // Analyze the generated flow graph. Currently only if it is a leaf 55 // Analyze the generated flow graph. Currently only if it is a leaf
50 // method, i.e., does not contain any calls to runtime or other Dart code. 56 // method, i.e., does not contain any calls to runtime or other Dart code.
51 class FlowGraphAnalyzer : public ValueObject { 57 class FlowGraphAnalyzer : public ValueObject {
52 public: 58 public:
53 explicit FlowGraphAnalyzer(const GrowableArray<BlockEntryInstr*>& blocks); 59 explicit FlowGraphAnalyzer(const GrowableArray<BlockEntryInstr*>& blocks);
54 virtual ~FlowGraphAnalyzer() {} 60 virtual ~FlowGraphAnalyzer() {}
55 61
56 void Analyze(); 62 void Analyze();
57 63
58 bool is_leaf() const { return is_leaf_; } 64 bool is_leaf() const { return is_leaf_; }
59 65
60 private: 66 private:
61 const GrowableArray<BlockEntryInstr*>& blocks_; 67 const GrowableArray<BlockEntryInstr*>& blocks_;
62 bool is_leaf_; 68 bool is_leaf_;
63 69
64 DISALLOW_COPY_AND_ASSIGN(FlowGraphAnalyzer); 70 DISALLOW_COPY_AND_ASSIGN(FlowGraphAnalyzer);
65 }; 71 };
66 72
67 } // namespace dart 73 } // namespace dart
68 74
69 #endif // VM_FLOW_GRAPH_OPTIMIZER_H_ 75 #endif // VM_FLOW_GRAPH_OPTIMIZER_H_
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/flow_graph_optimizer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698