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

Side by Side Diff: runtime/vm/flow_graph_type_propagator.cc

Issue 2412653002: VM Propagate receiver type from calls to unique selectors in AOT compilation. (Closed)
Patch Set: addressed comments, added test 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
« no previous file with comments | « runtime/vm/flow_graph_type_propagator.h ('k') | runtime/vm/intermediate_language.h » ('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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 #include "vm/flow_graph_type_propagator.h" 5 #include "vm/flow_graph_type_propagator.h"
6 6
7 #include "vm/cha.h" 7 #include "vm/cha.h"
8 #include "vm/bit_vector.h" 8 #include "vm/bit_vector.h"
9 #include "vm/il_printer.h" 9 #include "vm/il_printer.h"
10 #include "vm/regexp_assembler.h" 10 #include "vm/regexp_assembler.h"
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 } 209 }
210 return NULL; 210 return NULL;
211 } 211 }
212 212
213 213
214 void FlowGraphTypePropagator::VisitValue(Value* value) { 214 void FlowGraphTypePropagator::VisitValue(Value* value) {
215 CompileType* type = TypeOf(value->definition()); 215 CompileType* type = TypeOf(value->definition());
216 value->SetReachingType(type); 216 value->SetReachingType(type);
217 217
218 if (FLAG_support_il_printer && FLAG_trace_type_propagation) { 218 if (FLAG_support_il_printer && FLAG_trace_type_propagation) {
219 THR_Print("reaching type to v%" Pd " for v%" Pd " is %s\n", 219 THR_Print("reaching type to %s for v%" Pd " is %s\n",
220 value->instruction()->IsDefinition() ? 220 value->instruction()->ToCString(),
221 value->instruction()->AsDefinition()->ssa_temp_index() : -1,
222 value->definition()->ssa_temp_index(), 221 value->definition()->ssa_temp_index(),
223 type->ToCString()); 222 type->ToCString());
224 } 223 }
225 } 224 }
226 225
227 226
228 void FlowGraphTypePropagator::VisitJoinEntry(JoinEntryInstr* join) { 227 void FlowGraphTypePropagator::VisitJoinEntry(JoinEntryInstr* join) {
229 for (PhiIterator it(join); !it.Done(); it.Advance()) { 228 for (PhiIterator it(join); !it.Done(); it.Advance()) {
230 worklist_.Add(it.Current()); 229 worklist_.Add(it.Current());
231 } 230 }
(...skipping 24 matching lines...) Expand all
256 check->unary_checks().GetReceiverClassIdAt(0)); 255 check->unary_checks().GetReceiverClassIdAt(0));
257 } 256 }
258 257
259 258
260 void FlowGraphTypePropagator::VisitCheckClassId(CheckClassIdInstr* check) { 259 void FlowGraphTypePropagator::VisitCheckClassId(CheckClassIdInstr* check) {
261 // Can't propagate the type/cid because it may cause illegal code motion and 260 // Can't propagate the type/cid because it may cause illegal code motion and
262 // we don't track dependencies in all places via redefinitions. 261 // we don't track dependencies in all places via redefinitions.
263 } 262 }
264 263
265 264
265 void FlowGraphTypePropagator::VisitInstanceCall(InstanceCallInstr* instr) {
266 if (instr->has_unique_selector()) {
267 SetCid(instr->ArgumentAt(0),
268 instr->ic_data()->GetReceiverClassIdAt(0));
269 }
270 }
271
272
273 void FlowGraphTypePropagator::VisitPolymorphicInstanceCall(
274 PolymorphicInstanceCallInstr* instr) {
275 if (instr->instance_call()->has_unique_selector()) {
276 SetCid(instr->ArgumentAt(0),
277 instr->ic_data().GetReceiverClassIdAt(0));
278 }
279 }
280
281
266 void FlowGraphTypePropagator::VisitGuardFieldClass( 282 void FlowGraphTypePropagator::VisitGuardFieldClass(
267 GuardFieldClassInstr* guard) { 283 GuardFieldClassInstr* guard) {
268 const intptr_t cid = guard->field().guarded_cid(); 284 const intptr_t cid = guard->field().guarded_cid();
269 if ((cid == kIllegalCid) || 285 if ((cid == kIllegalCid) ||
270 (cid == kDynamicCid) || 286 (cid == kDynamicCid) ||
271 Field::IsExternalizableCid(cid)) { 287 Field::IsExternalizableCid(cid)) {
272 return; 288 return;
273 } 289 }
274 290
275 Definition* def = guard->value()->definition(); 291 Definition* def = guard->value()->definition();
(...skipping 1136 matching lines...) Expand 10 before | Expand all | Expand 10 after
1412 CompileType MergedMathInstr::ComputeType() const { 1428 CompileType MergedMathInstr::ComputeType() const {
1413 return CompileType::Dynamic(); 1429 return CompileType::Dynamic();
1414 } 1430 }
1415 1431
1416 1432
1417 CompileType ExtractNthOutputInstr::ComputeType() const { 1433 CompileType ExtractNthOutputInstr::ComputeType() const {
1418 return CompileType::FromCid(definition_cid_); 1434 return CompileType::FromCid(definition_cid_);
1419 } 1435 }
1420 1436
1421 } // namespace dart 1437 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/flow_graph_type_propagator.h ('k') | runtime/vm/intermediate_language.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698