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

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

Issue 2265873005: VM: Remove more duplicate code between AOT and JIT compiler. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: fix comment Created 4 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
« no previous file with comments | « runtime/vm/flow_graph_inliner.cc ('k') | runtime/vm/jit_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_JIT_OPTIMIZER_H_ 5 #ifndef VM_JIT_OPTIMIZER_H_
6 #define VM_JIT_OPTIMIZER_H_ 6 #define VM_JIT_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
(...skipping 12 matching lines...) Expand all
23 virtual ~JitOptimizer() {} 23 virtual ~JitOptimizer() {}
24 24
25 FlowGraph* flow_graph() const { return flow_graph_; } 25 FlowGraph* flow_graph() const { return flow_graph_; }
26 26
27 // Use ICData to optimize, replace or eliminate instructions. 27 // Use ICData to optimize, replace or eliminate instructions.
28 void ApplyICData(); 28 void ApplyICData();
29 29
30 // Use propagated class ids to optimize, replace or eliminate instructions. 30 // Use propagated class ids to optimize, replace or eliminate instructions.
31 void ApplyClassIds(); 31 void ApplyClassIds();
32 32
33 // Optimize (a << b) & c pattern: if c is a positive Smi or zero, then the
34 // shift can be a truncating Smi shift-left and result is always Smi.
35 // Merge instructions (only per basic-block).
36 void TryOptimizePatterns();
37
38 virtual void VisitStaticCall(StaticCallInstr* instr); 33 virtual void VisitStaticCall(StaticCallInstr* instr);
39 virtual void VisitInstanceCall(InstanceCallInstr* instr); 34 virtual void VisitInstanceCall(InstanceCallInstr* instr);
40 virtual void VisitStoreInstanceField(StoreInstanceFieldInstr* instr); 35 virtual void VisitStoreInstanceField(StoreInstanceFieldInstr* instr);
41 virtual void VisitAllocateContext(AllocateContextInstr* instr); 36 virtual void VisitAllocateContext(AllocateContextInstr* instr);
42 virtual void VisitLoadCodeUnits(LoadCodeUnitsInstr* instr); 37 virtual void VisitLoadCodeUnits(LoadCodeUnitsInstr* instr);
43 38
44 void InsertBefore(Instruction* next, 39 void InsertBefore(Instruction* next,
45 Instruction* instr, 40 Instruction* instr,
46 Environment* env, 41 Environment* env,
47 FlowGraph::UseKind use_kind) { 42 FlowGraph::UseKind use_kind) {
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 // call, using the call's IC data to determine the check, and the call's 94 // call, using the call's IC data to determine the check, and the call's
100 // deopt ID and deoptimization environment if the check fails. 95 // deopt ID and deoptimization environment if the check fails.
101 void AddReceiverCheck(InstanceCallInstr* call); 96 void AddReceiverCheck(InstanceCallInstr* call);
102 97
103 void ReplaceCall(Definition* call, Definition* replacement); 98 void ReplaceCall(Definition* call, Definition* replacement);
104 99
105 100
106 bool InstanceCallNeedsClassCheck(InstanceCallInstr* call, 101 bool InstanceCallNeedsClassCheck(InstanceCallInstr* call,
107 RawFunction::Kind kind) const; 102 RawFunction::Kind kind) const;
108 103
109 bool InlineFloat32x4Getter(InstanceCallInstr* call,
110 MethodRecognizer::Kind getter);
111 bool InlineFloat64x2Getter(InstanceCallInstr* call,
112 MethodRecognizer::Kind getter);
113 bool InlineInt32x4Getter(InstanceCallInstr* call,
114 MethodRecognizer::Kind getter);
115 bool InlineFloat32x4BinaryOp(InstanceCallInstr* call, 104 bool InlineFloat32x4BinaryOp(InstanceCallInstr* call,
116 Token::Kind op_kind); 105 Token::Kind op_kind);
117 bool InlineInt32x4BinaryOp(InstanceCallInstr* call, 106 bool InlineInt32x4BinaryOp(InstanceCallInstr* call,
118 Token::Kind op_kind); 107 Token::Kind op_kind);
119 bool InlineFloat64x2BinaryOp(InstanceCallInstr* call, 108 bool InlineFloat64x2BinaryOp(InstanceCallInstr* call,
120 Token::Kind op_kind); 109 Token::Kind op_kind);
121 bool InlineImplicitInstanceGetter(InstanceCallInstr* call); 110 bool InlineImplicitInstanceGetter(InstanceCallInstr* call);
122 111
123 RawBool* InstanceOfAsBool(const ICData& ic_data, 112 RawBool* InstanceOfAsBool(const ICData& ic_data,
124 const AbstractType& type, 113 const AbstractType& type,
125 ZoneGrowableArray<intptr_t>* results) const; 114 ZoneGrowableArray<intptr_t>* results) const;
126 115
127 void ReplaceWithMathCFunction(InstanceCallInstr* call, 116 void ReplaceWithMathCFunction(InstanceCallInstr* call,
128 MethodRecognizer::Kind recognized_kind); 117 MethodRecognizer::Kind recognized_kind);
129 118
130 void OptimizeLeftShiftBitAndSmiOp(Definition* bit_and_instr,
131 Definition* left_instr,
132 Definition* right_instr);
133 void TryMergeTruncDivMod(GrowableArray<BinarySmiOpInstr*>* merge_candidates);
134 void TryMergeMathUnary(GrowableArray<MathUnaryInstr*>* merge_candidates);
135
136 void AppendExtractNthOutputForMerged(Definition* instr, intptr_t ix,
137 Representation rep, intptr_t cid);
138 bool TryStringLengthOneEquality(InstanceCallInstr* call, Token::Kind op_kind); 119 bool TryStringLengthOneEquality(InstanceCallInstr* call, Token::Kind op_kind);
139 120
140 RawField* GetField(intptr_t class_id, const String& field_name); 121 RawField* GetField(intptr_t class_id, const String& field_name);
141 122
142 Thread* thread() const { return flow_graph_->thread(); } 123 Thread* thread() const { return flow_graph_->thread(); }
143 Isolate* isolate() const { return flow_graph_->isolate(); } 124 Isolate* isolate() const { return flow_graph_->isolate(); }
144 Zone* zone() const { return flow_graph_->zone(); } 125 Zone* zone() const { return flow_graph_->zone(); }
145 126
146 const Function& function() const { return flow_graph_->function(); } 127 const Function& function() const { return flow_graph_->function(); }
147 128
148 FlowGraph* flow_graph_; 129 FlowGraph* flow_graph_;
149 130
150 DISALLOW_COPY_AND_ASSIGN(JitOptimizer); 131 DISALLOW_COPY_AND_ASSIGN(JitOptimizer);
151 }; 132 };
152 133
153 134
154 } // namespace dart 135 } // namespace dart
155 136
156 #endif // VM_JIT_OPTIMIZER_H_ 137 #endif // VM_JIT_OPTIMIZER_H_
OLDNEW
« no previous file with comments | « runtime/vm/flow_graph_inliner.cc ('k') | runtime/vm/jit_optimizer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698