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

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

Issue 9956012: Don't use === instead of equality-method call for user class constants. (Closed) Base URL: https://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
« no previous file with comments | « no previous file | tests/language/src/CompileTimeConstantNTest.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) 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 1825 matching lines...) Expand 10 before | Expand all | Expand 10 after
1836 // TODO(1603): the class should be marked as abstract. 1836 // TODO(1603): the class should be marked as abstract.
1837 abstract BinaryOperation get operation(); 1837 abstract BinaryOperation get operation();
1838 } 1838 }
1839 1839
1840 class HEquals extends HRelational { 1840 class HEquals extends HRelational {
1841 HEquals(HStatic target, HInstruction left, HInstruction right) 1841 HEquals(HStatic target, HInstruction left, HInstruction right)
1842 : super(target, left, right); 1842 : super(target, left, right);
1843 accept(HVisitor visitor) => visitor.visitEquals(this); 1843 accept(HVisitor visitor) => visitor.visitEquals(this);
1844 1844
1845 bool get builtin() { 1845 bool get builtin() {
1846 return (left.isNumber() && right.isNumber()) || left is HConstant; 1846 if (left.isNumber() && right.isNumber()) return true;
1847 if (left is !HConstant) return false;
1848 HConstant leftConstant = left;
1849 // TODO(floitsch): we can do better if we know that the constant does not
1850 // have the equality operator overridden.
1851 return !leftConstant.constant.isConstructedObject();
1847 } 1852 }
1848 1853
1849 HType computeType() => HType.BOOLEAN; 1854 HType computeType() => HType.BOOLEAN;
1850 1855
1851 HType computeDesiredInputType(HInstruction input) { 1856 HType computeDesiredInputType(HInstruction input) {
1852 // TODO(floitsch): we want the target to be a function. 1857 // TODO(floitsch): we want the target to be a function.
1853 if (input == target) return HType.UNKNOWN; 1858 if (input == target) return HType.UNKNOWN;
1854 if (left.isNumber() || right.isNumber()) return HType.NUMBER; 1859 if (left.isNumber() || right.isNumber()) return HType.NUMBER;
1855 return HType.UNKNOWN; 1860 return HType.UNKNOWN;
1856 } 1861 }
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
2057 class HIfBlockInformation { 2062 class HIfBlockInformation {
2058 final HIf branch; 2063 final HIf branch;
2059 final SubGraph thenGraph; 2064 final SubGraph thenGraph;
2060 final SubGraph elseGraph; 2065 final SubGraph elseGraph;
2061 final HBasicBlock joinBlock; 2066 final HBasicBlock joinBlock;
2062 HIfBlockInformation(this.branch, 2067 HIfBlockInformation(this.branch,
2063 this.thenGraph, 2068 this.thenGraph,
2064 this.elseGraph, 2069 this.elseGraph,
2065 this.joinBlock); 2070 this.joinBlock);
2066 } 2071 }
OLDNEW
« no previous file with comments | « no previous file | tests/language/src/CompileTimeConstantNTest.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698