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

Unified Diff: sdk/lib/_internal/compiler/implementation/types/simple_types_inferrer.dart

Issue 12753003: Recognize const/fixed/growable arrays in simple types inferrer. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 9 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 | « sdk/lib/_internal/compiler/implementation/ssa/optimize.dart ('k') | sdk/lib/core/list.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/_internal/compiler/implementation/types/simple_types_inferrer.dart
===================================================================
--- sdk/lib/_internal/compiler/implementation/types/simple_types_inferrer.dart (revision 19764)
+++ sdk/lib/_internal/compiler/implementation/types/simple_types_inferrer.dart (working copy)
@@ -166,6 +166,9 @@
TypeMask boolType;
TypeMask functionType;
TypeMask listType;
+ TypeMask constListType;
+ TypeMask fixedListType;
+ TypeMask growableListType;
TypeMask mapType;
TypeMask constMapType;
TypeMask stringType;
@@ -346,8 +349,15 @@
rawTypeOf(backend.stringImplementation));
boolType = new TypeMask.nonNullExact(
rawTypeOf(backend.boolImplementation));
+
listType = new TypeMask.nonNullExact(
rawTypeOf(backend.listImplementation));
+ constListType = new TypeMask.nonNullExact(
+ rawTypeOf(backend.constListImplementation));
+ fixedListType = new TypeMask.nonNullExact(
+ rawTypeOf(backend.fixedListImplementation));
+ growableListType = new TypeMask.nonNullExact(
+ rawTypeOf(backend.growableListImplementation));
mapType = new TypeMask.nonNullSubtype(
rawTypeOf(backend.mapImplementation));
@@ -969,15 +979,15 @@
}
TypeMask visitLiteralList(LiteralList node) {
- return inferrer.listType;
+ return node.isConst()
+ ? inferrer.constListType
+ : inferrer.growableListType;
}
TypeMask visitLiteralMap(LiteralMap node) {
- if (node.isConst()) {
- return inferrer.constMapType;
- } else {
- return inferrer.mapType;
- }
+ return node.isConst()
+ ? inferrer.constMapType
+ : inferrer.mapType;
}
TypeMask visitLiteralNull(LiteralNull node) {
@@ -1139,7 +1149,13 @@
}
ArgumentsTypes arguments = analyzeArguments(node.arguments);
inferrer.registerCalledElement(outermostElement, element, arguments);
- return inferrer.returnTypeOfElement(element);
+ if (Elements.isGrowableListConstructorCall(element, node, compiler)) {
+ return inferrer.growableListType;
+ } else if (Elements.isFixedListConstructorCall(element, node, compiler)) {
+ return inferrer.fixedListType;
+ } else {
+ return inferrer.returnTypeOfElement(element);
+ }
}
TypeMask handleForeignSend(Send node) {
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/ssa/optimize.dart ('k') | sdk/lib/core/list.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698