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

Unified Diff: sdk/lib/_internal/compiler/implementation/ssa/optimize.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
Index: sdk/lib/_internal/compiler/implementation/ssa/optimize.dart
===================================================================
--- sdk/lib/_internal/compiler/implementation/ssa/optimize.dart (revision 19761)
+++ sdk/lib/_internal/compiler/implementation/ssa/optimize.dart (working copy)
@@ -336,30 +336,6 @@
return node;
}
- bool isFixedSizeListConstructor(HInvokeStatic node) {
- Element element = node.target.element;
- if (backend.fixedLengthListConstructor == null) {
- backend.fixedLengthListConstructor =
- compiler.listClass.lookupConstructor(
- new Selector.callConstructor(const SourceString(""),
- compiler.listClass.getLibrary()));
- }
- // TODO(ngeoffray): checking if the second input is an integer
- // should not be necessary but it currently makes it easier for
- // other optimizations to reason on a fixed length constructor
- // that we know takes an int.
- return element == backend.fixedLengthListConstructor
- && node.inputs.length == 2
- && node.inputs[1].isInteger();
- }
-
- HInstruction visitInvokeStatic(HInvokeStatic node) {
- if (isFixedSizeListConstructor(node)) {
- node.instructionType = HType.FIXED_ARRAY;
- }
- return node;
- }
-
HInstruction visitInvokeDynamicMethod(HInvokeDynamicMethod node) {
if (node.isCallOnInterceptor) return handleInterceptorCall(node);
HType receiverType = node.receiver.instructionType;
@@ -593,7 +569,14 @@
// Try to recognize the length getter with input
// [:new List(int):].
HInvokeStatic call = node.receiver;
- if (isFixedSizeListConstructor(call)) {
+ Element element = call.target.element;
+ // TODO(ngeoffray): checking if the second input is an integer
+ // should not be necessary but it currently makes it easier for
+ // other optimizations to reason on a fixed length constructor
kasperl 2013/03/11 08:40:57 reason on -> reason about
ngeoffray 2013/03/11 08:59:57 Done.
+ // that we know takes an int.
+ if (element == compiler.unnamedListConstructor
+ && call.inputs.length == 2
+ && call.inputs[1].isInteger()) {
return call.inputs[1];
}
}

Powered by Google App Engine
This is Rietveld 408576698