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

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

Issue 11187046: Apply optimization after class-id propagation: instance calls without ICData are optimized by using… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 2 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
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 template <typename T> class DirectChainedHashMap; 14 template <typename T> class DirectChainedHashMap;
15 15
16 class FlowGraphOptimizer : public FlowGraphVisitor { 16 class FlowGraphOptimizer : public FlowGraphVisitor {
17 public: 17 public:
18 explicit FlowGraphOptimizer(FlowGraph* flow_graph) 18 explicit FlowGraphOptimizer(FlowGraph* flow_graph)
19 : FlowGraphVisitor(flow_graph->reverse_postorder()), 19 : FlowGraphVisitor(flow_graph->reverse_postorder()),
20 flow_graph_(flow_graph) { } 20 flow_graph_(flow_graph) { }
21 virtual ~FlowGraphOptimizer() {} 21 virtual ~FlowGraphOptimizer() {}
22 22
23 // Use ICData to optimize, replace or eliminate instructions.
23 void ApplyICData(); 24 void ApplyICData();
24 25
26 // Use propagated class ids to optimize, replace or eliminate instructions.
27 void ApplyClassIds();
28
25 void OptimizeComputations(); 29 void OptimizeComputations();
26 30
27 void EliminateDeadPhis(); 31 void EliminateDeadPhis();
28 32
29 void SelectRepresentations(); 33 void SelectRepresentations();
30 34
31 void PropagateSminess(); 35 void PropagateSminess();
32 36
33 void InferSmiRanges(); 37 void InferSmiRanges();
34 38
35 virtual void VisitStaticCall(StaticCallInstr* instr); 39 virtual void VisitStaticCall(StaticCallInstr* instr);
36 virtual void VisitInstanceCall(InstanceCallInstr* instr); 40 virtual void VisitInstanceCall(InstanceCallInstr* instr);
37 virtual void VisitRelationalOp(RelationalOpInstr* instr); 41 virtual void VisitRelationalOp(RelationalOpInstr* instr);
38 virtual void VisitEqualityCompare(EqualityCompareInstr* instr); 42 virtual void VisitEqualityCompare(EqualityCompareInstr* instr);
39 virtual void VisitBranch(BranchInstr* instr); 43 virtual void VisitBranch(BranchInstr* instr);
40 44
41 void InsertBefore(Instruction* next, 45 void InsertBefore(Instruction* next,
42 Instruction* instr, 46 Instruction* instr,
43 Environment* env, 47 Environment* env,
44 Definition::UseKind use_kind); 48 Definition::UseKind use_kind);
45 49
46 private: 50 private:
51 // Attempt to build ICData for call using propagated class-ids.
52 bool TryCreateICData(InstanceCallInstr* call);
53
47 intptr_t PrepareIndexedOp(InstanceCallInstr* call, 54 intptr_t PrepareIndexedOp(InstanceCallInstr* call,
48 intptr_t class_id, 55 intptr_t class_id,
49 Value** array, 56 Value** array,
50 Value** index); 57 Value** index);
51 bool TryReplaceWithStoreIndexed(InstanceCallInstr* call); 58 bool TryReplaceWithStoreIndexed(InstanceCallInstr* call);
52 bool TryReplaceWithLoadIndexed(InstanceCallInstr* call); 59 bool TryReplaceWithLoadIndexed(InstanceCallInstr* call);
53 60
54 bool TryReplaceWithBinaryOp(InstanceCallInstr* call, Token::Kind op_kind); 61 bool TryReplaceWithBinaryOp(InstanceCallInstr* call, Token::Kind op_kind);
55 bool TryReplaceWithUnaryOp(InstanceCallInstr* call, Token::Kind op_kind); 62 bool TryReplaceWithUnaryOp(InstanceCallInstr* call, Token::Kind op_kind);
56 63
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 220
214 // Worklists of blocks and definitions. 221 // Worklists of blocks and definitions.
215 GrowableArray<BlockEntryInstr*> block_worklist_; 222 GrowableArray<BlockEntryInstr*> block_worklist_;
216 GrowableArray<Definition*> definition_worklist_; 223 GrowableArray<Definition*> definition_worklist_;
217 }; 224 };
218 225
219 226
220 } // namespace dart 227 } // namespace dart
221 228
222 #endif // VM_FLOW_GRAPH_OPTIMIZER_H_ 229 #endif // VM_FLOW_GRAPH_OPTIMIZER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698