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

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

Issue 10823184: Basic type inference skeleton (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Address review comments Created 8 years, 4 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: dart/lib/compiler/implementation/ssa/builder.dart
diff --git a/dart/lib/compiler/implementation/ssa/builder.dart b/dart/lib/compiler/implementation/ssa/builder.dart
index a66dbaf7c2a4c7ff9fa48ead04383232ebeafb22..9ec35abf63a242c6d2ed1528a8e8896d3dabe96c 100644
--- a/dart/lib/compiler/implementation/ssa/builder.dart
+++ b/dart/lib/compiler/implementation/ssa/builder.dart
@@ -217,6 +217,8 @@ class LocalsHandler {
: directLocals = new Map<Element, HInstruction>(),
redirectionMapping = new Map<Element, Element>();
+ get typesTask() => builder.compiler.typesTask;
+
/**
* Creates a new [LocalsHandler] based on [other]. We only need to
* copy the [directLocals], since the other fields can be shared
@@ -315,6 +317,8 @@ class LocalsHandler {
builder.add(parameter);
builder.parameters[element] = parameter;
directLocals[element] = parameter;
+ parameter.guaranteedType =
+ builder.mapInferredType(typesTask.getGuaranteedTypeOfElement(element));
});
enterScope(node);
@@ -3291,6 +3295,17 @@ class SsaBuilder extends ResolvedVisitor implements Visitor {
compiler.internalError('SsaBuilder.visitTypeVariable');
}
+ HType mapInferredType(Element element) {
+ if (element === builder.compiler.boolClass) return HType.BOOLEAN;
ngeoffray 2012/08/16 12:53:10 Should those be BOOLEAN_OR_NULL, ... ?
ahe 2012/08/16 17:26:54 No. It has been inferred that it must be a bool. T
+ if (element === builder.compiler.doubleClass) return HType.DOUBLE;
+ if (element === builder.compiler.intClass) return HType.INTEGER;
+ // TODO(ahe): How to map listClass to HType?
ngeoffray 2012/08/16 12:53:10 new HBoundedPotentialPrimitiveArray(element.comput
ahe 2012/08/16 17:26:54 It can't be null and it will be a primitive array.
+ if (element === builder.compiler.listClass) return HType.UNKNOWN;
+ if (element === builder.compiler.nullClass) return HType.NULL;
+ if (element === builder.compiler.stringClass) return HType.STRING;
+ return HType.UNKNOWN;
+ }
+
/** HACK HACK HACK */
void hackAroundPossiblyAbortingBody(Node statement, void body()) {
visitCondition() {

Powered by Google App Engine
This is Rietveld 408576698