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

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

Issue 10116023: Don't rely on any speculative type in the bailout version. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Cosmetic change (formatting). 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 side-by-side diff with in-line comments
Download patch
Index: lib/compiler/implementation/ssa/types.dart
diff --git a/lib/compiler/implementation/ssa/types.dart b/lib/compiler/implementation/ssa/types.dart
index d59d7be820f5ecf776d0bf70cafbb84cb06b1376..c8244f3a78a8ccc3ba28c08941f1e170f522b1db 100644
--- a/lib/compiler/implementation/ssa/types.dart
+++ b/lib/compiler/implementation/ssa/types.dart
@@ -21,14 +21,14 @@ class SsaTypePropagator extends HGraphVisitor implements OptimizationPhase {
// Re-compute and update the type of the instruction. Returns
// whether or not the type was changed.
bool updateType(HInstruction instruction) {
- if (instruction.propagatedType.isConflicting()) return false;
-
HType oldType = instruction.propagatedType;
HType newType = instruction.hasGuaranteedType()
? instruction.guaranteedType
: computeType(instruction);
- instruction.propagatedType = oldType.combine(newType);
- return oldType !== instruction.propagatedType;
+ // We unconditionally replace the propagated type with the new type. The
+ // computeType must make sure that we eventually reach a stable state.
+ instruction.propagatedType = newType;
+ return oldType !== newType;
}
void visitGraph(HGraph graph) {
@@ -119,6 +119,11 @@ class SsaSpeculativeTypePropagator extends SsaTypePropagator {
}
HType computeType(HInstruction instruction) {
+ // Once we are in a conflicting state don't update the type anymore.
+ if (instruction.propagatedType.isConflicting()) {
kasperl 2012/04/18 11:46:15 Cache instruction.propagatedType in a local variab
floitsch 2012/04/18 17:18:46 Done.
+ return instruction.propagatedType;
+ }
+
HType newType = super.computeType(instruction);
// [computeDesiredType] goes to all usedBys and lets them compute their
// desired type. By setting the [newType] here we give them more context to

Powered by Google App Engine
This is Rietveld 408576698