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

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

Issue 10174040: Better constant fold identity checks. (100 bytes saved on swarm, yeah! :)) (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 7 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 856 matching lines...) Expand 10 before | Expand all | Expand 10 after
867 inputUsedBy.removeLast(); 867 inputUsedBy.removeLast();
868 break; 868 break;
869 } 869 }
870 } 870 }
871 } 871 }
872 this.block = null; 872 this.block = null;
873 assert(isValid()); 873 assert(isValid());
874 } 874 }
875 875
876 bool isConstant() => false; 876 bool isConstant() => false;
877 bool isConstantBoolean() => false;
877 bool isConstantNull() => false; 878 bool isConstantNull() => false;
878 bool isConstantNumber() => false; 879 bool isConstantNumber() => false;
879 bool isConstantString() => false; 880 bool isConstantString() => false;
880 bool isConstantList() => false; 881 bool isConstantList() => false;
881 bool isConstantMap() => false; 882 bool isConstantMap() => false;
882 883
883 bool isValid() { 884 bool isValid() {
884 HValidator validator = new HValidator(); 885 HValidator validator = new HValidator();
885 validator.currentBlock = block; 886 validator.currentBlock = block;
886 validator.visitInstruction(this); 887 validator.visitInstruction(this);
(...skipping 974 matching lines...) Expand 10 before | Expand all | Expand 10 after
1861 // TODO(1603): the class should be marked as abstract. 1862 // TODO(1603): the class should be marked as abstract.
1862 abstract BinaryOperation get operation(); 1863 abstract BinaryOperation get operation();
1863 } 1864 }
1864 1865
1865 class HEquals extends HRelational { 1866 class HEquals extends HRelational {
1866 HEquals(HStatic target, HInstruction left, HInstruction right) 1867 HEquals(HStatic target, HInstruction left, HInstruction right)
1867 : super(target, left, right); 1868 : super(target, left, right);
1868 accept(HVisitor visitor) => visitor.visitEquals(this); 1869 accept(HVisitor visitor) => visitor.visitEquals(this);
1869 1870
1870 bool get builtin() { 1871 bool get builtin() {
1871 // All useful types have === semantics. 1872 // All primitive types have === semantics.
1872 // Note that this includes all constants except the user-constructed 1873 // Note that this includes all constants except the user-constructed
1873 // objects. 1874 // objects.
1874 return left.isConstantNull() || left.propagatedType.isUseful(); 1875 return left.isConstantNull() || left.propagatedType.isPrimitive();
1875 } 1876 }
1876 1877
1877 HType computeTypeFromInputTypes() { 1878 HType computeTypeFromInputTypes() {
1878 if (builtin) return HType.BOOLEAN; 1879 if (builtin) return HType.BOOLEAN;
1879 return HType.UNKNOWN; 1880 return HType.UNKNOWN;
1880 } 1881 }
1881 1882
1882 HType computeDesiredTypeForNonTargetInput(HInstruction input) { 1883 HType computeDesiredTypeForNonTargetInput(HInstruction input) {
1883 if (input == left && right.propagatedType.isUseful()) { 1884 if (input == left && right.propagatedType.isUseful()) {
1884 // All our useful types have === semantics. But we don't want to 1885 // All our useful types have === semantics. But we don't want to
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after
2232 final bool isAnd; 2233 final bool isAnd;
2233 final SubExpression left; 2234 final SubExpression left;
2234 final SubExpression right; 2235 final SubExpression right;
2235 final HBasicBlock joinBlock; 2236 final HBasicBlock joinBlock;
2236 HAndOrBlockInformation(this.isAnd, 2237 HAndOrBlockInformation(this.isAnd,
2237 this.left, 2238 this.left,
2238 this.right, 2239 this.right,
2239 this.joinBlock); 2240 this.joinBlock);
2240 bool accept(HBlockInformationVisitor visitor) => visitor.visitAndOrInfo(this); 2241 bool accept(HBlockInformationVisitor visitor) => visitor.visitAndOrInfo(this);
2241 } 2242 }
OLDNEW
« no previous file with comments | « frog/tests/leg_only/src/ConstantFoldNumberDart2JSTest.dart ('k') | lib/compiler/implementation/ssa/optimize.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698