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

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

Issue 10139012: Refactor types in ssa nodes. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: More fixes. 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_propagation.dart
diff --git a/lib/compiler/implementation/ssa/types.dart b/lib/compiler/implementation/ssa/types_propagation.dart
similarity index 93%
copy from lib/compiler/implementation/ssa/types.dart
copy to lib/compiler/implementation/ssa/types_propagation.dart
index 0f12bb9e8e1b3d6998147afeddea202411b5822c..5783756dee792936bd639e5149d79331eeac21d2 100644
--- a/lib/compiler/implementation/ssa/types.dart
+++ b/lib/compiler/implementation/ssa/types_propagation.dart
@@ -1,4 +1,4 @@
-// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
+// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
@@ -43,7 +43,9 @@ class SsaTypePropagator extends HGraphVisitor implements OptimizationPhase {
// type of all other incoming edges as "unitialized" and take this into
// account when doing the propagation inside the phis. Just setting
// the [propagatedType] is however easier.
- phi.propagatedType = phi.inputs[0].propagatedType;
+ if (phi.propagatedType.isUnknown()) {
ngeoffray 2012/04/25 11:41:13 Please add a comment on why the phi may already ha
floitsch 2012/04/25 19:52:15 Done.
+ phi.propagatedType = phi.inputs[0].propagatedType;
+ }
addToWorkList(phi);
});
} else {
@@ -110,8 +112,8 @@ class SsaSpeculativeTypePropagator extends SsaTypePropagator {
HType computeDesiredType(HInstruction instruction) {
HType desiredType = HType.UNKNOWN;
for (final user in instruction.usedBy) {
- desiredType =
- desiredType.combine(user.computeDesiredTypeForInput(instruction));
+ HType userType = user.computeDesiredTypeForInput(instruction);
+ desiredType = desiredType.intersection(userType);
// No need to continue if two users disagree on the type.
if (desiredType.isConflicting()) break;
}
@@ -134,6 +136,6 @@ class SsaSpeculativeTypePropagator extends SsaTypePropagator {
// TODO(ngeoffray): Allow speculative optimizations on
// non-primitive types?
if (desiredType.isNonPrimitive()) return newType;
- return newType.combine(desiredType);
+ return newType.intersection(desiredType);
}
}

Powered by Google App Engine
This is Rietveld 408576698