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

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

Issue 11312122: Change List constructors. (Closed) Base URL: https://dart.googlecode.com/svn/experimental/lib_v2/dart
Patch Set: Address comments and fix. Created 8 years, 1 month 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
diff --git a/sdk/lib/_internal/compiler/implementation/ssa/optimize.dart b/sdk/lib/_internal/compiler/implementation/ssa/optimize.dart
index e27f697219c86f8b502a192a324313fd6a712c9c..c01e4714e43908ff10567f1d3cb3d473e37a2869 100644
--- a/sdk/lib/_internal/compiler/implementation/ssa/optimize.dart
+++ b/sdk/lib/_internal/compiler/implementation/ssa/optimize.dart
@@ -256,11 +256,17 @@ class SsaConstantFolder extends HBaseVisitor implements OptimizationPhase {
DartType defaultClass = compiler.listClass.defaultClass;
// TODO(ngeoffray): make sure that the only reason the List class is
// not resolved is because it's not being used.
- return element.isConstructor()
- && defaultClass != null
- && element.enclosingElement.declaration == defaultClass.element
- && node.inputs.length == 2
- && node.inputs[1].isInteger(types);
+ if (defaultClass == null) return false;
+ if (!element.isConstructor()) return false;
+ // TODO(ngeoffray): cache constructor.
+ if (element.enclosingElement.declaration != defaultClass.element) {
+ return false;
+ }
+ FunctionElement fixedLengthListConstructor =
+ compiler.listClass.lookupConstructor(
+ new Selector.callConstructor(const SourceString("fixedLength"),
+ compiler.listClass.getLibrary()));
+ return element == fixedLengthListConstructor.defaultImplementation;
}
HInstruction visitInvokeStatic(HInvokeStatic node) {

Powered by Google App Engine
This is Rietveld 408576698