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

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

Issue 10880040: Support abstract getters without parameters. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Update language.status Created 8 years, 4 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) 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 interface HVisitor<R> { 5 interface 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 1510 matching lines...) Expand 10 before | Expand all | Expand 10 after
1521 accept(HVisitor visitor) => visitor.visitForeignNew(this); 1521 accept(HVisitor visitor) => visitor.visitForeignNew(this);
1522 } 1522 }
1523 1523
1524 class HInvokeBinary extends HInvokeStatic { 1524 class HInvokeBinary extends HInvokeStatic {
1525 HInvokeBinary(HStatic target, HInstruction left, HInstruction right) 1525 HInvokeBinary(HStatic target, HInstruction left, HInstruction right)
1526 : super(<HInstruction>[target, left, right]); 1526 : super(<HInstruction>[target, left, right]);
1527 1527
1528 HInstruction get left => inputs[1]; 1528 HInstruction get left => inputs[1];
1529 HInstruction get right => inputs[2]; 1529 HInstruction get right => inputs[2];
1530 1530
1531 abstract BinaryOperation get operation(); 1531 abstract BinaryOperation get operation;
1532 abstract isBuiltin(HTypeMap types); 1532 abstract isBuiltin(HTypeMap types);
1533 } 1533 }
1534 1534
1535 class HBinaryArithmetic extends HInvokeBinary { 1535 class HBinaryArithmetic extends HInvokeBinary {
1536 HBinaryArithmetic(HStatic target, HInstruction left, HInstruction right) 1536 HBinaryArithmetic(HStatic target, HInstruction left, HInstruction right)
1537 : super(target, left, right); 1537 : super(target, left, right);
1538 1538
1539 void prepareGvn(HTypeMap types) { 1539 void prepareGvn(HTypeMap types) {
1540 // An arithmetic expression can take part in global value 1540 // An arithmetic expression can take part in global value
1541 // numbering and do not have any side-effects if we know that all 1541 // numbering and do not have any side-effects if we know that all
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
1582 if (input == right && left.isNumber(types)) return HType.NUMBER; 1582 if (input == right && left.isNumber(types)) return HType.NUMBER;
1583 return HType.UNKNOWN; 1583 return HType.UNKNOWN;
1584 } 1584 }
1585 1585
1586 HType computeLikelyType(HTypeMap types) { 1586 HType computeLikelyType(HTypeMap types) {
1587 if (left.isTypeUnknown(types)) return HType.NUMBER; 1587 if (left.isTypeUnknown(types)) return HType.NUMBER;
1588 return HType.UNKNOWN; 1588 return HType.UNKNOWN;
1589 } 1589 }
1590 1590
1591 // TODO(1603): The class should be marked as abstract. 1591 // TODO(1603): The class should be marked as abstract.
1592 abstract BinaryOperation get operation(); 1592 abstract BinaryOperation get operation;
1593 } 1593 }
1594 1594
1595 class HAdd extends HBinaryArithmetic { 1595 class HAdd extends HBinaryArithmetic {
1596 HAdd(HStatic target, HInstruction left, HInstruction right) 1596 HAdd(HStatic target, HInstruction left, HInstruction right)
1597 : super(target, left, right); 1597 : super(target, left, right);
1598 accept(HVisitor visitor) => visitor.visitAdd(this); 1598 accept(HVisitor visitor) => visitor.visitAdd(this);
1599 1599
1600 AddOperation get operation => const AddOperation(); 1600 AddOperation get operation => const AddOperation();
1601 int typeCode() => HInstruction.ADD_TYPECODE; 1601 int typeCode() => HInstruction.ADD_TYPECODE;
1602 bool typeEquals(other) => other is HAdd; 1602 bool typeEquals(other) => other is HAdd;
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
1829 // If the outgoing type should be a number (integer, double or both) we 1829 // If the outgoing type should be a number (integer, double or both) we
1830 // want the outgoing type to be the input too. 1830 // want the outgoing type to be the input too.
1831 // If we don't know the outgoing type we try to make it a number. 1831 // If we don't know the outgoing type we try to make it a number.
1832 if (propagatedType.isNumber()) return propagatedType; 1832 if (propagatedType.isNumber()) return propagatedType;
1833 if (propagatedType.isUnknown()) return HType.NUMBER; 1833 if (propagatedType.isUnknown()) return HType.NUMBER;
1834 return HType.UNKNOWN; 1834 return HType.UNKNOWN;
1835 } 1835 }
1836 1836
1837 HType computeLikelyType(HTypeMap types) => HType.NUMBER; 1837 HType computeLikelyType(HTypeMap types) => HType.NUMBER;
1838 1838
1839 abstract UnaryOperation get operation(); 1839 abstract UnaryOperation get operation;
1840 } 1840 }
1841 1841
1842 class HNegate extends HInvokeUnary { 1842 class HNegate extends HInvokeUnary {
1843 HNegate(HStatic target, HInstruction input) : super(target, input); 1843 HNegate(HStatic target, HInstruction input) : super(target, input);
1844 accept(HVisitor visitor) => visitor.visitNegate(this); 1844 accept(HVisitor visitor) => visitor.visitNegate(this);
1845 1845
1846 NegateOperation get operation => const NegateOperation(); 1846 NegateOperation get operation => const NegateOperation();
1847 int typeCode() => HInstruction.NEGATE_TYPECODE; 1847 int typeCode() => HInstruction.NEGATE_TYPECODE;
1848 bool typeEquals(other) => other is HNegate; 1848 bool typeEquals(other) => other is HNegate;
1849 bool dataEquals(HInstruction other) => true; 1849 bool dataEquals(HInstruction other) => true;
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
2163 } 2163 }
2164 } 2164 }
2165 return HType.UNKNOWN; 2165 return HType.UNKNOWN;
2166 } 2166 }
2167 2167
2168 HType computeLikelyType(HTypeMap types) => HType.BOOLEAN; 2168 HType computeLikelyType(HTypeMap types) => HType.BOOLEAN;
2169 2169
2170 bool isBuiltin(HTypeMap types) 2170 bool isBuiltin(HTypeMap types)
2171 => left.isNumber(types) && right.isNumber(types); 2171 => left.isNumber(types) && right.isNumber(types);
2172 // TODO(1603): the class should be marked as abstract. 2172 // TODO(1603): the class should be marked as abstract.
2173 abstract BinaryOperation get operation(); 2173 abstract BinaryOperation get operation;
2174 } 2174 }
2175 2175
2176 class HEquals extends HRelational { 2176 class HEquals extends HRelational {
2177 HEquals(HStatic target, HInstruction left, HInstruction right) 2177 HEquals(HStatic target, HInstruction left, HInstruction right)
2178 : super(target, left, right); 2178 : super(target, left, right);
2179 accept(HVisitor visitor) => visitor.visitEquals(this); 2179 accept(HVisitor visitor) => visitor.visitEquals(this);
2180 2180
2181 bool isBuiltin(HTypeMap types) { 2181 bool isBuiltin(HTypeMap types) {
2182 // All primitive types have === semantics. 2182 // All primitive types have === semantics.
2183 // Note that this includes all constants except the user-constructed 2183 // Note that this includes all constants except the user-constructed
(...skipping 628 matching lines...) Expand 10 before | Expand all | Expand 10 after
2812 HBasicBlock get start => expression.start; 2812 HBasicBlock get start => expression.start;
2813 HBasicBlock get end { 2813 HBasicBlock get end {
2814 // We don't create a switch block if there are no cases. 2814 // We don't create a switch block if there are no cases.
2815 assert(!statements.isEmpty()); 2815 assert(!statements.isEmpty());
2816 return statements.last().end; 2816 return statements.last().end;
2817 } 2817 }
2818 2818
2819 bool accept(HStatementInformationVisitor visitor) => 2819 bool accept(HStatementInformationVisitor visitor) =>
2820 visitor.visitSwitchInfo(this); 2820 visitor.visitSwitchInfo(this);
2821 } 2821 }
OLDNEW
« no previous file with comments | « dart/lib/compiler/implementation/scanner/scanner.dart ('k') | dart/lib/compiler/implementation/tree/dartstring.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698