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

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

Issue 2379733002: Recognize and optimize a.runtimeType == b.runtimeType pattern. (Closed)
Patch Set: Support polymorphic inlining of Object.get:runtimeType Created 4 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
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_AOT_OPTIMIZER_H_ 5 #ifndef VM_AOT_OPTIMIZER_H_
6 #define VM_AOT_OPTIMIZER_H_ 6 #define VM_AOT_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 class CSEInstructionMap; 13 class CSEInstructionMap;
14 template <typename T> class GrowableArray; 14 template <typename T> class GrowableArray;
15 class ParsedFunction; 15 class ParsedFunction;
16 class Precompiler;
16 class RawBool; 17 class RawBool;
17 18
18 class AotOptimizer : public FlowGraphVisitor { 19 class AotOptimizer : public FlowGraphVisitor {
19 public: 20 public:
20 AotOptimizer( 21 AotOptimizer(
22 Precompiler* precompiler,
21 FlowGraph* flow_graph, 23 FlowGraph* flow_graph,
22 bool use_speculative_inlining, 24 bool use_speculative_inlining,
23 GrowableArray<intptr_t>* inlining_black_list) 25 GrowableArray<intptr_t>* inlining_black_list)
24 : FlowGraphVisitor(flow_graph->reverse_postorder()), 26 : FlowGraphVisitor(flow_graph->reverse_postorder()),
27 precompiler_(precompiler),
25 flow_graph_(flow_graph), 28 flow_graph_(flow_graph),
26 use_speculative_inlining_(use_speculative_inlining), 29 use_speculative_inlining_(use_speculative_inlining),
27 inlining_black_list_(inlining_black_list) { 30 inlining_black_list_(inlining_black_list) {
28 ASSERT(!use_speculative_inlining || (inlining_black_list != NULL)); 31 ASSERT(!use_speculative_inlining || (inlining_black_list != NULL));
29 } 32 }
30 virtual ~AotOptimizer() {} 33 virtual ~AotOptimizer() {}
31 34
32 FlowGraph* flow_graph() const { return flow_graph_; } 35 FlowGraph* flow_graph() const { return flow_graph_; }
33 36
34 // Add ICData to InstanceCalls, so that optimizations can be run on them. 37 // Add ICData to InstanceCalls, so that optimizations can be run on them.
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 Environment* deopt_environment, 102 Environment* deopt_environment,
100 Instruction* insert_before); 103 Instruction* insert_before);
101 104
102 // Add a class check for a call's first argument immediately before the 105 // Add a class check for a call's first argument immediately before the
103 // call, using the call's IC data to determine the check, and the call's 106 // call, using the call's IC data to determine the check, and the call's
104 // deopt ID and deoptimization environment if the check fails. 107 // deopt ID and deoptimization environment if the check fails.
105 void AddReceiverCheck(InstanceCallInstr* call); 108 void AddReceiverCheck(InstanceCallInstr* call);
106 109
107 void ReplaceCall(Definition* call, Definition* replacement); 110 void ReplaceCall(Definition* call, Definition* replacement);
108 111
112 bool RecognizeRuntimeTypeGetter(InstanceCallInstr* call);
113
109 bool InstanceCallNeedsClassCheck(InstanceCallInstr* call, 114 bool InstanceCallNeedsClassCheck(InstanceCallInstr* call,
110 RawFunction::Kind kind) const; 115 RawFunction::Kind kind) const;
111 116
112 bool InlineFloat32x4BinaryOp(InstanceCallInstr* call, 117 bool InlineFloat32x4BinaryOp(InstanceCallInstr* call,
113 Token::Kind op_kind); 118 Token::Kind op_kind);
114 bool InlineInt32x4BinaryOp(InstanceCallInstr* call, 119 bool InlineInt32x4BinaryOp(InstanceCallInstr* call,
115 Token::Kind op_kind); 120 Token::Kind op_kind);
116 bool InlineFloat64x2BinaryOp(InstanceCallInstr* call, 121 bool InlineFloat64x2BinaryOp(InstanceCallInstr* call,
117 Token::Kind op_kind); 122 Token::Kind op_kind);
118 bool InlineImplicitInstanceGetter(InstanceCallInstr* call); 123 bool InlineImplicitInstanceGetter(InstanceCallInstr* call);
(...skipping 10 matching lines...) Expand all
129 RawField* GetField(intptr_t class_id, const String& field_name); 134 RawField* GetField(intptr_t class_id, const String& field_name);
130 135
131 Thread* thread() const { return flow_graph_->thread(); } 136 Thread* thread() const { return flow_graph_->thread(); }
132 Isolate* isolate() const { return flow_graph_->isolate(); } 137 Isolate* isolate() const { return flow_graph_->isolate(); }
133 Zone* zone() const { return flow_graph_->zone(); } 138 Zone* zone() const { return flow_graph_->zone(); }
134 139
135 const Function& function() const { return flow_graph_->function(); } 140 const Function& function() const { return flow_graph_->function(); }
136 141
137 bool IsAllowedForInlining(intptr_t deopt_id); 142 bool IsAllowedForInlining(intptr_t deopt_id);
138 143
144 Precompiler* precompiler_;
139 FlowGraph* flow_graph_; 145 FlowGraph* flow_graph_;
140 146
141 const bool use_speculative_inlining_; 147 const bool use_speculative_inlining_;
142 148
143 GrowableArray<intptr_t>* inlining_black_list_; 149 GrowableArray<intptr_t>* inlining_black_list_;
144 150
145 DISALLOW_COPY_AND_ASSIGN(AotOptimizer); 151 DISALLOW_COPY_AND_ASSIGN(AotOptimizer);
146 }; 152 };
147 153
148 154
149 } // namespace dart 155 } // namespace dart
150 156
151 #endif // VM_AOT_OPTIMIZER_H_ 157 #endif // VM_AOT_OPTIMIZER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698