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

Side by Side Diff: lib/compiler/implementation/ssa/nodes.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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | lib/compiler/implementation/ssa/optimize.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 abstract class HVisitor<R> { 5 abstract class HVisitor<R> {
6 R visitAdd(HAdd node); 6 R visitAdd(HAdd node);
7 R visitBailoutTarget(HBailoutTarget node); 7 R visitBailoutTarget(HBailoutTarget node);
8 R visitBitAnd(HBitAnd node); 8 R visitBitAnd(HBitAnd node);
9 R visitBitNot(HBitNot node); 9 R visitBitNot(HBitNot node);
10 R visitBitOr(HBitOr node); 10 R visitBitOr(HBitOr node);
(...skipping 851 matching lines...) Expand 10 before | Expand all | Expand 10 after
862 bool useGvn() => getFlag(FLAG_USE_GVN); 862 bool useGvn() => getFlag(FLAG_USE_GVN);
863 void setUseGvn() { setFlag(FLAG_USE_GVN); } 863 void setUseGvn() { setFlag(FLAG_USE_GVN); }
864 // Does this node potentially affect control flow. 864 // Does this node potentially affect control flow.
865 bool isControlFlow() => false; 865 bool isControlFlow() => false;
866 866
867 // All isFunctions work on the propagated types. 867 // All isFunctions work on the propagated types.
868 bool isArray(HTypeMap types) => types[this].isArray(); 868 bool isArray(HTypeMap types) => types[this].isArray();
869 bool isReadableArray(HTypeMap types) => types[this].isReadableArray(); 869 bool isReadableArray(HTypeMap types) => types[this].isReadableArray();
870 bool isMutableArray(HTypeMap types) => types[this].isMutableArray(); 870 bool isMutableArray(HTypeMap types) => types[this].isMutableArray();
871 bool isExtendableArray(HTypeMap types) => types[this].isExtendableArray(); 871 bool isExtendableArray(HTypeMap types) => types[this].isExtendableArray();
872 bool isFixedArray(HTypeMap types) => types[this].isFixedArray();
872 bool isBoolean(HTypeMap types) => types[this].isBoolean(); 873 bool isBoolean(HTypeMap types) => types[this].isBoolean();
873 bool isInteger(HTypeMap types) => types[this].isInteger(); 874 bool isInteger(HTypeMap types) => types[this].isInteger();
874 bool isDouble(HTypeMap types) => types[this].isDouble(); 875 bool isDouble(HTypeMap types) => types[this].isDouble();
875 bool isNumber(HTypeMap types) => types[this].isNumber(); 876 bool isNumber(HTypeMap types) => types[this].isNumber();
876 bool isString(HTypeMap types) => types[this].isString(); 877 bool isString(HTypeMap types) => types[this].isString();
877 bool isTypeUnknown(HTypeMap types) => types[this].isUnknown(); 878 bool isTypeUnknown(HTypeMap types) => types[this].isUnknown();
878 bool isIndexablePrimitive(HTypeMap types) 879 bool isIndexablePrimitive(HTypeMap types)
879 => types[this].isIndexablePrimitive(); 880 => types[this].isIndexablePrimitive();
880 bool isPrimitive(HTypeMap types) => types[this].isPrimitive(); 881 bool isPrimitive(HTypeMap types) => types[this].isPrimitive();
881 bool canBePrimitive(HTypeMap types) => types[this].canBePrimitive(); 882 bool canBePrimitive(HTypeMap types) => types[this].canBePrimitive();
(...skipping 590 matching lines...) Expand 10 before | Expand all | Expand 10 after
1472 return HType.MUTABLE_ARRAY; 1473 return HType.MUTABLE_ARRAY;
1473 } 1474 }
1474 } 1475 }
1475 return HType.UNKNOWN; 1476 return HType.UNKNOWN;
1476 } 1477 }
1477 1478
1478 void prepareGvn(HTypeMap types) { 1479 void prepareGvn(HTypeMap types) {
1479 clearAllSideEffects(); 1480 clearAllSideEffects();
1480 if (isLengthGetterOnStringOrArray(types)) { 1481 if (isLengthGetterOnStringOrArray(types)) {
1481 setUseGvn(); 1482 setUseGvn();
1482 // If the input is a string, we know the length cannot change. 1483 // If the input is a string or a fixed length array, we know
1483 // We cannot do the same thing for non-extendable array because 1484 // the length cannot change.
1484 // we don't express that type yet: a mutable array might be 1485 if (!inputs[1].isString(types) && !inputs[1].isFixedArray(types)) {
1485 // extendable. 1486 setDependsOnInstancePropertyStore();
1486 if (!inputs[1].isString(types)) setDependsOnInstancePropertyStore(); 1487 }
1487 } else if (isSideEffectFree) { 1488 } else if (isSideEffectFree) {
1488 setUseGvn(); 1489 setUseGvn();
1489 setDependsOnSomething(); 1490 setDependsOnSomething();
1490 } else { 1491 } else {
1491 setAllSideEffects(); 1492 setAllSideEffects();
1492 } 1493 }
1493 } 1494 }
1494 1495
1495 int typeCode() => HInstruction.INVOKE_INTERCEPTOR_TYPECODE; 1496 int typeCode() => HInstruction.INVOKE_INTERCEPTOR_TYPECODE;
1496 bool typeEquals(other) => other is HInvokeInterceptor; 1497 bool typeEquals(other) => other is HInvokeInterceptor;
(...skipping 1475 matching lines...) Expand 10 before | Expand all | Expand 10 after
2972 HBasicBlock get start => expression.start; 2973 HBasicBlock get start => expression.start;
2973 HBasicBlock get end { 2974 HBasicBlock get end {
2974 // We don't create a switch block if there are no cases. 2975 // We don't create a switch block if there are no cases.
2975 assert(!statements.isEmpty()); 2976 assert(!statements.isEmpty());
2976 return statements.last().end; 2977 return statements.last().end;
2977 } 2978 }
2978 2979
2979 bool accept(HStatementInformationVisitor visitor) => 2980 bool accept(HStatementInformationVisitor visitor) =>
2980 visitor.visitSwitchInfo(this); 2981 visitor.visitSwitchInfo(this);
2981 } 2982 }
OLDNEW
« no previous file with comments | « no previous file | lib/compiler/implementation/ssa/optimize.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698