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

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: Change to fixedLength. 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
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/lib/js_helper.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/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..ba1fa66413480c496246f1b7f87b9ad6473ea3be 100644
--- a/sdk/lib/_internal/compiler/implementation/ssa/optimize.dart
+++ b/sdk/lib/_internal/compiler/implementation/ssa/optimize.dart
@@ -254,13 +254,14 @@ class SsaConstantFolder extends HBaseVisitor implements OptimizationPhase {
bool isFixedSizeListConstructor(HInvokeStatic node) {
Element element = node.target.element;
DartType defaultClass = compiler.listClass.defaultClass;
ngeoffray 2012/11/07 14:27:52 Please add a TODO that this should be cached.
floitsch 2012/11/07 16:42:48 Done.
+ if (defaultClass == null) return false;
ngeoffray 2012/11/07 14:27:52 Also check if element is a constructor.
floitsch 2012/11/07 16:42:48 Done.
+ Element fixedListLengthConstructor = compiler.listClass.lookupConstructor(
+ new Selector.callConstructor(const SourceString("fixedLength"),
+ compiler.listClass.getLibrary()));
// 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);
+ return element == fixedListLengthConstructor
+ && element.enclosingElement.declaration == defaultClass.element;
ngeoffray 2012/11/07 14:27:52 Do this check earlier.
floitsch 2012/11/07 16:42:48 Done.
}
HInstruction visitInvokeStatic(HInvokeStatic node) {
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/lib/js_helper.dart ('k') | sdk/lib/core/list.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698