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

Unified Diff: sdk/lib/_internal/compiler/implementation/inferrer/inferrer_visitor.dart

Issue 701793002: Fix a bug in the handling of Phi nodes. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: comments Created 6 years, 1 month 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: sdk/lib/_internal/compiler/implementation/inferrer/inferrer_visitor.dart
diff --git a/sdk/lib/_internal/compiler/implementation/inferrer/inferrer_visitor.dart b/sdk/lib/_internal/compiler/implementation/inferrer/inferrer_visitor.dart
index 1e603a92e7038275f6afc75c8435d14f20753ccf..65ea6bc8cf39868dea103e4205248cd2572b5089 100644
--- a/sdk/lib/_internal/compiler/implementation/inferrer/inferrer_visitor.dart
+++ b/sdk/lib/_internal/compiler/implementation/inferrer/inferrer_visitor.dart
@@ -79,6 +79,16 @@ abstract class TypeSystem<T> {
*/
T allocatePhi(Node node, Local variable, T inputType);
+
+ /**
+ * Returns a new type for holding the potential types of [element].
+ * [inputType] is the first incoming type of the phi. [allocateLoopPhi]
+ * only differs from [allocatePhi] in that it allows the underlying
+ * implementation of [TypeSystem] to differentiate Phi nodes due to loops
+ * from other merging uses.
+ */
+ T allocateLoopPhi(Node node, Local variable, T inputType);
+
/**
* Simplies the phi representing [element] and of the type
* [phiType]. For example, if this phi has one incoming input, an
@@ -605,7 +615,7 @@ class LocalsHandler<T> {
void startLoop(Node loop) {
locals.forEachLocal((Local variable, T type) {
- T newType = types.allocatePhi(loop, variable, type);
+ T newType = types.allocateLoopPhi(loop, variable, type);
if (newType != type) {
locals[variable] = newType;
}

Powered by Google App Engine
This is Rietveld 408576698