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

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

Issue 10562002: Extend the {+,-,/,*}= support by allowing non-constants on the right side. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 6 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 | « lib/compiler/implementation/ssa/codegen.dart ('k') | no next file » | 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 739 matching lines...) Expand 10 before | Expand all | Expand 10 after
750 bool isReadableArray() => propagatedType.isReadableArray(); 750 bool isReadableArray() => propagatedType.isReadableArray();
751 bool isMutableArray() => propagatedType.isMutableArray(); 751 bool isMutableArray() => propagatedType.isMutableArray();
752 bool isExtendableArray() => propagatedType.isExtendableArray(); 752 bool isExtendableArray() => propagatedType.isExtendableArray();
753 bool isBoolean() => propagatedType.isBoolean(); 753 bool isBoolean() => propagatedType.isBoolean();
754 bool isInteger() => propagatedType.isInteger(); 754 bool isInteger() => propagatedType.isInteger();
755 bool isDouble() => propagatedType.isDouble(); 755 bool isDouble() => propagatedType.isDouble();
756 bool isNumber() => propagatedType.isNumber(); 756 bool isNumber() => propagatedType.isNumber();
757 bool isString() => propagatedType.isString(); 757 bool isString() => propagatedType.isString();
758 bool isTypeUnknown() => propagatedType.isUnknown(); 758 bool isTypeUnknown() => propagatedType.isUnknown();
759 bool isIndexablePrimitive() => propagatedType.isIndexablePrimitive(); 759 bool isIndexablePrimitive() => propagatedType.isIndexablePrimitive();
760 bool isPrimitive() => propagatedType.isPrimitive();
760 bool canBePrimitive() => propagatedType.canBePrimitive(); 761 bool canBePrimitive() => propagatedType.canBePrimitive();
761 762
762 /** 763 /**
763 * This is the type the instruction is guaranteed to have. It does not 764 * This is the type the instruction is guaranteed to have. It does not
764 * take any propagation into account. 765 * take any propagation into account.
765 */ 766 */
766 HType guaranteedType = HType.UNKNOWN; 767 HType guaranteedType = HType.UNKNOWN;
767 bool hasGuaranteedType() => !guaranteedType.isUnknown(); 768 bool hasGuaranteedType() => !guaranteedType.isUnknown();
768 769
769 /** 770 /**
(...skipping 766 matching lines...) Expand 10 before | Expand all | Expand 10 after
1536 1537
1537 // TODO(floitsch): Should HBinaryArithmetic really be the super class of 1538 // TODO(floitsch): Should HBinaryArithmetic really be the super class of
1538 // HBinaryBitOp? 1539 // HBinaryBitOp?
1539 class HBinaryBitOp extends HBinaryArithmetic { 1540 class HBinaryBitOp extends HBinaryArithmetic {
1540 HBinaryBitOp(HStatic target, HInstruction left, HInstruction right) 1541 HBinaryBitOp(HStatic target, HInstruction left, HInstruction right)
1541 : super(target, left, right); 1542 : super(target, left, right);
1542 1543
1543 bool get builtin() => left.isInteger() && right.isInteger(); 1544 bool get builtin() => left.isInteger() && right.isInteger();
1544 1545
1545 HType computeTypeFromInputTypes() { 1546 HType computeTypeFromInputTypes() {
1546 if (left.isInteger()) return HType.INTEGER; 1547 // All bitwise operations on primitive types either produce an
1548 // integer or throw an error.
1549 if (left.isPrimitive()) return HType.INTEGER;
1547 return HType.UNKNOWN; 1550 return HType.UNKNOWN;
1548 } 1551 }
1549 1552
1550 HType computeDesiredTypeForNonTargetInput(HInstruction input) { 1553 HType computeDesiredTypeForNonTargetInput(HInstruction input) {
1551 // If the outgoing type should be a number we can get that only if both 1554 // If the outgoing type should be a number we can get that only if both
1552 // inputs are integers. If we don't know the outgoing type we try to make 1555 // inputs are integers. If we don't know the outgoing type we try to make
1553 // it an integer. 1556 // it an integer.
1554 if (propagatedType.isUnknown() || propagatedType.isNumber()) { 1557 if (propagatedType.isUnknown() || propagatedType.isNumber()) {
1555 return HType.INTEGER; 1558 return HType.INTEGER;
1556 } 1559 }
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
1671 bool dataEquals(HInstruction other) => true; 1674 bool dataEquals(HInstruction other) => true;
1672 } 1675 }
1673 1676
1674 class HBitNot extends HInvokeUnary { 1677 class HBitNot extends HInvokeUnary {
1675 HBitNot(HStatic target, HInstruction input) : super(target, input); 1678 HBitNot(HStatic target, HInstruction input) : super(target, input);
1676 accept(HVisitor visitor) => visitor.visitBitNot(this); 1679 accept(HVisitor visitor) => visitor.visitBitNot(this);
1677 1680
1678 bool get builtin() => operand.isInteger(); 1681 bool get builtin() => operand.isInteger();
1679 1682
1680 HType computeTypeFromInputTypes() { 1683 HType computeTypeFromInputTypes() {
1681 HType operandType = operand.propagatedType; 1684 // All bitwise operations on primitive types either produce an
1682 if (operandType.isInteger()) return HType.INTEGER; 1685 // integer or throw an error.
1686 if (operand.isPrimitive()) return HType.INTEGER;
1683 return HType.UNKNOWN; 1687 return HType.UNKNOWN;
1684 } 1688 }
1685 1689
1686 HType computeDesiredTypeForNonTargetInput(HInstruction input) { 1690 HType computeDesiredTypeForNonTargetInput(HInstruction input) {
1687 // Bit operations only work on integers. If there is no desired output 1691 // Bit operations only work on integers. If there is no desired output
1688 // type or if it as a number we want to get an integer as input. 1692 // type or if it as a number we want to get an integer as input.
1689 if (propagatedType.isUnknown() || propagatedType.isNumber()) { 1693 if (propagatedType.isUnknown() || propagatedType.isNumber()) {
1690 return HType.INTEGER; 1694 return HType.INTEGER;
1691 } 1695 }
1692 return HType.UNKNOWN; 1696 return HType.UNKNOWN;
(...skipping 896 matching lines...) Expand 10 before | Expand all | Expand 10 after
2589 HBasicBlock get start() => expression.start; 2593 HBasicBlock get start() => expression.start;
2590 HBasicBlock get end() { 2594 HBasicBlock get end() {
2591 // We don't create a switch block if there are no cases. 2595 // We don't create a switch block if there are no cases.
2592 assert(!statements.isEmpty()); 2596 assert(!statements.isEmpty());
2593 return statements.last().end; 2597 return statements.last().end;
2594 } 2598 }
2595 2599
2596 bool accept(HStatementInformationVisitor visitor) => 2600 bool accept(HStatementInformationVisitor visitor) =>
2597 visitor.visitSwitchInfo(this); 2601 visitor.visitSwitchInfo(this);
2598 } 2602 }
OLDNEW
« no previous file with comments | « lib/compiler/implementation/ssa/codegen.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698