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

Side by Side Diff: lib/compiler/implementation/ssa/nodes.dart

Issue 9969006: Code cleanup for speculative type optimization. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 8 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
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 interface HVisitor<R> { 5 interface HVisitor<R> {
6 R visitAdd(HAdd node); 6 R visitAdd(HAdd node);
7 R visitBitAnd(HBitAnd node); 7 R visitBitAnd(HBitAnd node);
8 R visitBitNot(HBitNot node); 8 R visitBitNot(HBitNot node);
9 R visitBitOr(HBitOr node); 9 R visitBitOr(HBitOr node);
10 R visitBitXor(HBitXor node); 10 R visitBitXor(HBitXor node);
(...skipping 838 matching lines...) Expand 10 before | Expand all | Expand 10 after
849 849
850 int getChangesFlags() => flags & ((1 << FLAG_CHANGES_COUNT) - 1); 850 int getChangesFlags() => flags & ((1 << FLAG_CHANGES_COUNT) - 1);
851 bool hasSideEffects() => getChangesFlags() != 0; 851 bool hasSideEffects() => getChangesFlags() != 0;
852 void prepareGvn() { setAllSideEffects(); } 852 void prepareGvn() { setAllSideEffects(); }
853 853
854 void setAllSideEffects() { flags |= ((1 << FLAG_CHANGES_COUNT) - 1); } 854 void setAllSideEffects() { flags |= ((1 << FLAG_CHANGES_COUNT) - 1); }
855 void clearAllSideEffects() { flags &= ~((1 << FLAG_CHANGES_COUNT) - 1); } 855 void clearAllSideEffects() { flags &= ~((1 << FLAG_CHANGES_COUNT) - 1); }
856 856
857 bool useGvn() => getFlag(FLAG_USE_GVN); 857 bool useGvn() => getFlag(FLAG_USE_GVN);
858 void setUseGvn() { setFlag(FLAG_USE_GVN); } 858 void setUseGvn() { setFlag(FLAG_USE_GVN); }
859 // Does this node pNotentially affect control flow. 859 // Does this node potentially affect control flow.
Lasse Reichstein Nielsen 2012/03/30 12:41:09 Oh, drat. Maybe I should reenable window autofocus
860 bool isControlFlow() => false; 860 bool isControlFlow() => false;
861 861
862 bool isArray() => type.isArray(); 862 bool isArray() => type.isArray();
863 bool isBoolean() => type.isBoolean(); 863 bool isBoolean() => type.isBoolean();
864 bool isInteger() => type.isInteger(); 864 bool isInteger() => type.isInteger();
865 bool isNumber() => type.isNumber(); 865 bool isNumber() => type.isNumber();
866 bool isString() => type.isString(); 866 bool isString() => type.isString();
867 bool isTypeUnknown() => type.isUnknown(); 867 bool isTypeUnknown() => type.isUnknown();
868 bool isStringOrArray() => type.isStringOrArray(); 868 bool isStringOrArray() => type.isStringOrArray();
869 869
870 // Compute the type of the instruction. 870 // Compute the type of the instruction.
871 HType computeType() => HType.UNKNOWN; 871 HType computeType() => HType.UNKNOWN;
872 872
873 HType computeDesiredType() {
874 HType candidateType = HType.UNKNOWN;
875 for (final user in usedBy) {
876 HType desiredType = user.computeDesiredInputType(this);
877 if (candidateType.isUnknown()) {
878 candidateType = desiredType;
879 } else if (!type.isUnknown() && candidateType != desiredType) {
880 candidateType = candidateType.combine(desiredType);
881 if (!candidateType.isKnown()) {
882 candidateType = HType.UNKNOWN;
883 break;
884 }
885 }
886 }
887 return candidateType;
888 }
889
890 HType computeDesiredInputType(HInstruction input) => HType.UNKNOWN; 873 HType computeDesiredInputType(HInstruction input) => HType.UNKNOWN;
891 874
892 // Returns whether the instruction does produce the type it claims. 875 // Returns whether the instruction does produce the type it claims.
893 // For most instructions, this returns false. A type guard will be 876 // For most instructions, this returns false. A type guard will be
894 // inserted to make sure the users get the right type in. 877 // inserted to make sure the users get the right type in.
895 bool hasExpectedType() => false; 878 bool hasExpectedType() => false;
896 879
897 bool isInBasicBlock() => block !== null; 880 bool isInBasicBlock() => block !== null;
898 881
899 String inputsToString() { 882 String inputsToString() {
(...skipping 1201 matching lines...) Expand 10 before | Expand all | Expand 10 after
2101 class HIfBlockInformation { 2084 class HIfBlockInformation {
2102 final HIf branch; 2085 final HIf branch;
2103 final SubGraph thenGraph; 2086 final SubGraph thenGraph;
2104 final SubGraph elseGraph; 2087 final SubGraph elseGraph;
2105 final HBasicBlock joinBlock; 2088 final HBasicBlock joinBlock;
2106 HIfBlockInformation(this.branch, 2089 HIfBlockInformation(this.branch,
2107 this.thenGraph, 2090 this.thenGraph,
2108 this.elseGraph, 2091 this.elseGraph,
2109 this.joinBlock); 2092 this.joinBlock);
2110 } 2093 }
OLDNEW
« no previous file with comments | « no previous file | lib/compiler/implementation/ssa/types.dart » ('j') | lib/compiler/implementation/ssa/types.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698