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

Unified Diff: lib/compiler/implementation/ssa/types.dart

Issue 9969006: Code cleanup for speculative type optimization. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: lib/compiler/implementation/ssa/types.dart
===================================================================
--- lib/compiler/implementation/ssa/types.dart (revision 6027)
+++ lib/compiler/implementation/ssa/types.dart (working copy)
@@ -86,13 +86,23 @@
final String name = 'speculative type propagator';
SsaSpeculativeTypePropagator(Compiler compiler) : super(compiler);
+ HType computeDesiredType(HInstruction instruction) {
+ HType desiredType = HType.UNKNOWN;
+ for (final user in instruction.usedBy) {
+ desiredType =
+ desiredType.combine(user.computeDesiredInputType(instruction));
+ // No need to continue if two users disagree on the type.
+ if (desiredType.isConflicting()) break;
+ }
+ return desiredType;
+ }
+
HType computeType(HInstruction instruction) {
HType newType = super.computeType(instruction);
- HType desiredType = instruction.computeDesiredType();
- HType combined = newType.combine(desiredType);
- // If the propagated type [newType] does not conflict with the
- // speculated type [desiredType], use it.
- if (combined.isKnown()) return combined;
- return newType;
+ HType desiredType = computeDesiredType(instruction);
floitsch 2012/03/30 23:16:00 No need to compute the desired type if the 'newTyp
+ // If the desired type is conflicting just return the computed
+ // type.
+ if (desiredType.isConflicting()) return newType;
+ return newType.combine(desiredType);
}
}
« lib/compiler/implementation/ssa/nodes.dart ('K') | « lib/compiler/implementation/ssa/nodes.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698