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

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

Issue 12211112: Start work on a non-complete type inferrer. Currently only analyzes return types. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 10 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: sdk/lib/_internal/compiler/implementation/ssa/builder.dart
===================================================================
--- sdk/lib/_internal/compiler/implementation/ssa/builder.dart (revision 18442)
+++ sdk/lib/_internal/compiler/implementation/ssa/builder.dart (working copy)
@@ -296,8 +296,7 @@
builder.parameters[parameterElement] = parameter;
directLocals[parameterElement] = parameter;
parameter.guaranteedType =
- builder.mapInferredType(
- typesTask.getGuaranteedTypeOfElement(parameterElement));
+ builder.getGuaranteedTypeOfElement(parameterElement);
});
}
@@ -3376,11 +3375,14 @@
}
HInvokeStatic instruction = new HInvokeStatic(inputs, HType.UNKNOWN);
- // TODO(ngeoffray): Only do this if knowing the return type is
- // useful.
- HType returnType =
- builder.backend.optimisticReturnTypesWithRecompilationOnTypeChange(
- currentElement, element);
+ HType returnType = getGuaranteedTypeOfElement(element);
+ if (returnType.isUnknown()) {
+ // TODO(ngeoffray): Only do this if knowing the return type is
+ // useful.
+ returnType =
+ builder.backend.optimisticReturnTypesWithRecompilationOnTypeChange(
+ currentElement, element);
+ }
if (returnType != null) instruction.guaranteedType = returnType;
pushWithPosition(instruction, node);
} else {
@@ -3572,7 +3574,14 @@
}
inputs.add(receiver);
inputs.addAll(arguments);
- return new HInvokeDynamicMethod(selector, inputs, isIntercepted);
+ HInstruction invoke = new HInvokeDynamicMethod(
+ selector, inputs, isIntercepted);
+ HType returnType = mapInferredType(
+ compiler.typesTask.getGuaranteedTypeOfNode(work.element, node));
+ if (returnType != null) {
+ invoke.guaranteedType = returnType;
+ }
+ return invoke;
}
visitSendSet(SendSet node) {
@@ -4656,10 +4665,15 @@
for (BaseType baseType in concreteType.baseTypes) {
ssaType = ssaType.union(mapBaseType(baseType), compiler);
}
- assert(!ssaType.isConflicting());
+ if (ssaType.isConflicting()) return HType.UNKNOWN;
return ssaType;
}
+ HType getGuaranteedTypeOfElement(Element element) {
+ return mapInferredType(
+ compiler.typesTask.getGuaranteedTypeOfElement(element));
+ }
+
// [type] is either an instance of [DartType] or special objects
// like [native.SpecialType.JsObject], or [native.SpecialType.JsArray].
HType mapNativeType(type) {

Powered by Google App Engine
This is Rietveld 408576698