Put back optimization on fixed-size array.

Review URL: https://codereview.chromium.org//11413139

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@15244 260f80e4-7a28-3924-810f-c04153c831b5
This commit is contained in:
ngeoffray@google.com 2012-11-22 08:52:34 +00:00
parent 33322164fc
commit 74ff79dec4
3 changed files with 3 additions and 12 deletions

View file

@ -655,7 +655,6 @@ class JavaScriptBackend extends Backend {
ClassElement jsNullClass;
ClassElement jsBoolClass;
ClassElement objectInterceptorClass;
ClassElement listImplementation;
Element jsArrayLength;
Element jsStringLength;
Element getInterceptorMethod;
@ -789,8 +788,6 @@ class JavaScriptBackend extends Backend {
jsStringClass.ensureResolved(compiler);
jsStringLength =
jsStringClass.lookupLocalMember(const SourceString('length'));
listImplementation =
compiler.coreLibrary.find(const SourceString('ListImplementation'));
}
void addInterceptors(ClassElement cls) {
@ -824,7 +821,7 @@ class JavaScriptBackend extends Backend {
}
if (cls == compiler.stringClass) {
result = jsStringClass;
} else if (cls == compiler.listClass || cls == listImplementation) {
} else if (cls == compiler.listClass) {
result = jsArrayClass;
} else if (cls == compiler.intClass) {
result = jsIntClass;

View file

@ -216,12 +216,7 @@ class SsaConstantFolder extends HBaseVisitor implements OptimizationPhase {
bool isFixedSizeListConstructor(HInvokeStatic node) {
Element element = node.target.element;
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
return element.getEnclosingClass() == compiler.listClass
&& node.inputs.length == 2
&& node.inputs[1].isInteger(types);
}

View file

@ -211,8 +211,7 @@ const String DEFAULT_CORELIB_WITH_LIST_INTERFACE = r'''
class Object {}
class Type {}
class Function {}
interface List default ListImplementation { List([length]);}
class ListImplementation { factory List([length]) => null; }
class List { List([length]); }
abstract class Map {}
class Closure {}
class Null {}