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

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: Address comments. 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
« no previous file with comments | « lib/compiler/implementation/ssa/tracer.dart ('k') | tests/language/language-leg.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..fcb795dd939e4a8ee77a547f300a4c6acca22828 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) {
@@ -78,7 +78,7 @@ class SsaTypePropagator extends HGraphVisitor implements OptimizationPhase {
// The non-speculative type propagator only propagates types forward. We
// thus only need to add the users of the [instruction] to the list.
addToWorkList(instruction.usedBy[i]);
- }
+ }
}
void addToWorkList(HInstruction instruction) {
@@ -101,7 +101,7 @@ class SsaSpeculativeTypePropagator extends SsaTypePropagator {
// want to propagate the desired outgoing type.
for (int i = 0, length = instruction.usedBy.length; i < length; i++) {
addToWorkList(instruction.usedBy[i]);
- }
+ }
for (int i = 0, length = instruction.inputs.length; i < length; i++) {
addToWorkList(instruction.inputs[i]);
}
@@ -119,10 +119,14 @@ class SsaSpeculativeTypePropagator extends SsaTypePropagator {
}
HType computeType(HInstruction instruction) {
+ // Once we are in a conflicting state don't update the type anymore.
+ HType oldType = instruction.propagatedType;
+ if (oldType.isConflicting()) return oldType;
+
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
- // work with.
+ // work with.
instruction.propagatedType = newType;
HType desiredType = computeDesiredType(instruction);
// If the desired type is conflicting just return the computed type.
« no previous file with comments | « lib/compiler/implementation/ssa/tracer.dart ('k') | tests/language/language-leg.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698