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

Side by Side Diff: lib/compiler/implementation/ssa/types.dart

Issue 10119010: Start propagating non-primitive types in the backend, and fold instructions that know about the typ… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 8 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) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 class SsaTypePropagator extends HGraphVisitor implements OptimizationPhase { 5 class SsaTypePropagator extends HGraphVisitor implements OptimizationPhase {
6 6
7 final Map<int, HInstruction> workmap; 7 final Map<int, HInstruction> workmap;
8 final List<int> worklist; 8 final List<int> worklist;
9 final Compiler compiler; 9 final Compiler compiler;
10 String get name() => 'type propagator'; 10 String get name() => 'type propagator';
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 120
121 HType computeType(HInstruction instruction) { 121 HType computeType(HInstruction instruction) {
122 HType newType = super.computeType(instruction); 122 HType newType = super.computeType(instruction);
123 // [computeDesiredType] goes to all usedBys and lets them compute their 123 // [computeDesiredType] goes to all usedBys and lets them compute their
124 // desired type. By setting the [newType] here we give them more context to 124 // desired type. By setting the [newType] here we give them more context to
125 // work with. 125 // work with.
126 instruction.propagatedType = newType; 126 instruction.propagatedType = newType;
127 HType desiredType = computeDesiredType(instruction); 127 HType desiredType = computeDesiredType(instruction);
128 // If the desired type is conflicting just return the computed type. 128 // If the desired type is conflicting just return the computed type.
129 if (desiredType.isConflicting()) return newType; 129 if (desiredType.isConflicting()) return newType;
130 // TODO(ngeoffray): Allow speculative optimizations on
131 // non-primitive types?
floitsch 2012/04/18 19:18:48 Why not. But that would require adding a isNonPrim
132 if (desiredType.isNonPrimitive()) return newType;
130 return newType.combine(desiredType); 133 return newType.combine(desiredType);
131 } 134 }
132 } 135 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698