| OLD | NEW |
| 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 815 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 826 bool useGvn() => getFlag(FLAG_USE_GVN); | 826 bool useGvn() => getFlag(FLAG_USE_GVN); |
| 827 void setUseGvn() { setFlag(FLAG_USE_GVN); } | 827 void setUseGvn() { setFlag(FLAG_USE_GVN); } |
| 828 // Does this node potentially affect control flow. | 828 // Does this node potentially affect control flow. |
| 829 bool isControlFlow() => false; | 829 bool isControlFlow() => false; |
| 830 | 830 |
| 831 // All isFunctions work on the propagated types. | 831 // All isFunctions work on the propagated types. |
| 832 bool isArray(HTypeMap types) => types[this].isArray(); | 832 bool isArray(HTypeMap types) => types[this].isArray(); |
| 833 bool isReadableArray(HTypeMap types) => types[this].isReadableArray(); | 833 bool isReadableArray(HTypeMap types) => types[this].isReadableArray(); |
| 834 bool isMutableArray(HTypeMap types) => types[this].isMutableArray(); | 834 bool isMutableArray(HTypeMap types) => types[this].isMutableArray(); |
| 835 bool isExtendableArray(HTypeMap types) => types[this].isExtendableArray(); | 835 bool isExtendableArray(HTypeMap types) => types[this].isExtendableArray(); |
| 836 bool isFixedArray(HTypeMap types) => types[this].isFixedArray(); |
| 836 bool isBoolean(HTypeMap types) => types[this].isBoolean(); | 837 bool isBoolean(HTypeMap types) => types[this].isBoolean(); |
| 837 bool isInteger(HTypeMap types) => types[this].isInteger(); | 838 bool isInteger(HTypeMap types) => types[this].isInteger(); |
| 838 bool isDouble(HTypeMap types) => types[this].isDouble(); | 839 bool isDouble(HTypeMap types) => types[this].isDouble(); |
| 839 bool isNumber(HTypeMap types) => types[this].isNumber(); | 840 bool isNumber(HTypeMap types) => types[this].isNumber(); |
| 840 bool isString(HTypeMap types) => types[this].isString(); | 841 bool isString(HTypeMap types) => types[this].isString(); |
| 841 bool isTypeUnknown(HTypeMap types) => types[this].isUnknown(); | 842 bool isTypeUnknown(HTypeMap types) => types[this].isUnknown(); |
| 842 bool isIndexablePrimitive(HTypeMap types) | 843 bool isIndexablePrimitive(HTypeMap types) |
| 843 => types[this].isIndexablePrimitive(); | 844 => types[this].isIndexablePrimitive(); |
| 844 bool isPrimitive(HTypeMap types) => types[this].isPrimitive(); | 845 bool isPrimitive(HTypeMap types) => types[this].isPrimitive(); |
| 845 bool canBePrimitive(HTypeMap types) => types[this].canBePrimitive(); | 846 bool canBePrimitive(HTypeMap types) => types[this].canBePrimitive(); |
| (...skipping 579 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1425 return HType.MUTABLE_ARRAY; | 1426 return HType.MUTABLE_ARRAY; |
| 1426 } | 1427 } |
| 1427 } | 1428 } |
| 1428 return HType.UNKNOWN; | 1429 return HType.UNKNOWN; |
| 1429 } | 1430 } |
| 1430 | 1431 |
| 1431 void prepareGvn(HTypeMap types) { | 1432 void prepareGvn(HTypeMap types) { |
| 1432 if (isLengthGetterOnStringOrArray(types)) { | 1433 if (isLengthGetterOnStringOrArray(types)) { |
| 1433 setUseGvn(); | 1434 setUseGvn(); |
| 1434 clearAllSideEffects(); | 1435 clearAllSideEffects(); |
| 1435 // If the input is a string, we know the length cannot change. | 1436 // If the input is a string or a fixed length array, we know |
| 1436 // We cannot do the same thing for non-extendable array because | 1437 // the length cannot change. |
| 1437 // we don't express that type yet: a mutable array might be | 1438 if (!inputs[1].isString(types) && !inputs[1].isFixedArray(types)) { |
| 1438 // extendable. | 1439 setDependsOnSomething(); |
| 1439 if (!inputs[1].isString(types)) setDependsOnSomething(); | 1440 } |
| 1440 } else if (isSideEffectFree) { | 1441 } else if (isSideEffectFree) { |
| 1441 setUseGvn(); | 1442 setUseGvn(); |
| 1442 clearAllSideEffects(); | 1443 clearAllSideEffects(); |
| 1443 setDependsOnSomething(); | 1444 setDependsOnSomething(); |
| 1444 } else { | 1445 } else { |
| 1445 setAllSideEffects(); | 1446 setAllSideEffects(); |
| 1446 } | 1447 } |
| 1447 } | 1448 } |
| 1448 | 1449 |
| 1449 int typeCode() => HInstruction.INVOKE_INTERCEPTOR_TYPECODE; | 1450 int typeCode() => HInstruction.INVOKE_INTERCEPTOR_TYPECODE; |
| (...skipping 1467 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2917 HBasicBlock get start => expression.start; | 2918 HBasicBlock get start => expression.start; |
| 2918 HBasicBlock get end { | 2919 HBasicBlock get end { |
| 2919 // We don't create a switch block if there are no cases. | 2920 // We don't create a switch block if there are no cases. |
| 2920 assert(!statements.isEmpty()); | 2921 assert(!statements.isEmpty()); |
| 2921 return statements.last().end; | 2922 return statements.last().end; |
| 2922 } | 2923 } |
| 2923 | 2924 |
| 2924 bool accept(HStatementInformationVisitor visitor) => | 2925 bool accept(HStatementInformationVisitor visitor) => |
| 2925 visitor.visitSwitchInfo(this); | 2926 visitor.visitSwitchInfo(this); |
| 2926 } | 2927 } |
| OLD | NEW |