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

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

Issue 11024003: Add a fixed array type. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 2 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 | « lib/compiler/implementation/ssa/nodes.dart ('k') | lib/compiler/implementation/ssa/types.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/compiler/implementation/ssa/optimize.dart
===================================================================
--- lib/compiler/implementation/ssa/optimize.dart (revision 13221)
+++ lib/compiler/implementation/ssa/optimize.dart (working copy)
@@ -203,13 +203,8 @@
// Try to recognize the length interceptor with input [:new List(int):].
if (node.isLengthGetter() && node.inputs[1] is HInvokeStatic) {
HInvokeStatic call = node.inputs[1];
- Element element = call.target.element;
- if (element.isConstructor() &&
- element.enclosingElement.declaration ==
- compiler.listClass.defaultClass.element) {
- if (call.inputs.length == 2 && call.inputs[1].isInteger(types)) {
- return call.inputs[1];
- }
+ if (isFixedSizeListConstructor(call)) {
+ return call.inputs[1];
}
}
HInstruction input = node.inputs[1];
@@ -251,6 +246,21 @@
return node;
}
+ bool isFixedSizeListConstructor(HInvokeStatic node) {
+ Element element = node.inputs[0].element;
+ return element.isConstructor()
+ && element.enclosingElement == compiler.listClass.defaultClass.element
+ && node.inputs.length == 2
+ && node.inputs[1].isInteger(types);
+ }
+
+ HInstruction visitInvokeStatic(HInvokeStatic node) {
+ if (isFixedSizeListConstructor(node)) {
+ node.guaranteedType = HType.FIXED_ARRAY;
+ }
+ return node;
+ }
+
HInstruction visitInvokeDynamic(HInvokeDynamic node) {
HType receiverType = types[node.receiver];
if (receiverType.isExact()) {
« no previous file with comments | « lib/compiler/implementation/ssa/nodes.dart ('k') | lib/compiler/implementation/ssa/types.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698